From 87598896ac8d29c19650bd12cbba2ccb93c9d95b Mon Sep 17 00:00:00 2001 From: Packit Date: Sep 14 2020 13:10:44 +0000 Subject: libmicrohttpd-0.9.59 base --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e574a68 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,69 @@ +Primary developers: +Christian Grothoff (maintainer) +Evgeny Grin (Karlson2k) (maintainer) +Andrey Uzunov (libmicrospdy experiment) +Nils Durner (W32 port) +Sagie Amir (TLS/SSL support using GNUtls) +Richard Alimi (performance) +Amr Ali (digest authentication) +Matthieu Speder (basic authentication, client certificates) + +Code contributions also came from: +Chris GauthierDickey +Elliot Glaysher +Daniel Pittman +John Popplewell +Heikki Lindholm +Alex Sadovsky +Greg Schohn +Thomas Martin +Peter Ross +RuXu W +Matthew Moore +Colin Caughie +David Carvalho +David Reiss +Markus Doppelbauer +Matt Holiday +Michael Cronenworth +Milan Straka +Mika Raento +Mike Crowe +John Muth +Geoffrey McRae +Piotr Grzybowski +Gerrit Telkamp +Erik Slagter +Andreas Wehrmann +Eivind Sarto +Thomas Stalder +Zhimin Huang +Jan Seeger +Will Bryant +LRN +Sven Geggus +Steve Wolf +Brecht Sanders +Jan Janak +Matthew Mundell +Scott Goldman +Jared Cantwell +Luke-Jr +Sree Harsha Totakura +Hani Benhabiles +Guy Martin +Robert Groenenberg +Denis Dowling +Louis Benoit +Flavio Coelin +Silvio Clecio + +Documentation contributions also came from: +Marco Maggi +Sebastian Gerhardt + +Special thanks to: +Florian Weimer +Ramakrishnan Muthukrishnan +Gervasa Markham +Liz Steininger diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..9b3e553 --- /dev/null +++ b/COPYING @@ -0,0 +1,510 @@ +Some of this code is DUAL-LICENSED. If you use MHD without HTTPS/SSL +support, you are free to choose between the LGPL and the eCos License +(http://ecos.sourceware.org/license-overview.html). If you compile +MHD with HTTPS support, you must obey the terms of the GNU LGPL. + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..5eb20f4 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2594 @@ +Thu Feb 1 10:12:22 CET 2018 + Releasing GNU libicrohttpd 0.9.59. -CG + +Thu Feb 1 08:39:50 CET 2018 + Fix masking operation. -CG/silvioprog + +Mon Jan 29 17:33:54 CET 2018 + Fix deadlock when failing to prepare chunked response + (#5260). -CG/ghaderer + +Thu Jan 4 12:24:33 CET 2018 + Fix __clang_major__ related warnings for non-clang + compilers reported by Tim on the mailinglist. -CG + +Mon Dec 11 17:11:00 MSK 2017 + Fixed tests on platforms with huge number of CPUs. + Doxygen configuration was updated. + Various doxygen fixes. -EG + +Mon Dec 07 21:08:00 MSK 2017 + Releasing GNU libmicrohttpd 0.9.58. -EG + +Mon Dec 07 16:01:00 MSK 2017 + Fixed HTTPS tests on modern platforms. -EG + +Mon Dec 04 15:43:00 MSK 2017 + Minor documentation installation fixes. -EG + +Mon Nov 27 22:58:38 CET 2017 + Tolerate AF_UNIX when trying to determine our binding port + from socket. Use `sockaddr_storage` instead of trying to + guess the sockaddr type before calling getsockname(). -CG + +Mon Nov 27 22:24:00 MSK 2017 + Releasing GNU libmicrohttpd 0.9.57. -EG + +Mon Nov 27 21:36:00 MSK 2017 + Updated README. -EG + +Mon Nov 27 18:37:00 MSK 2017 + Corrected names in W32 DLL resources. + Reordered and clarified configure summary message. + Additional compiler warning mutes for builds with various configure + parameters. + Fixed tests on Cygwin. + Used larger SETSIZE for Cygwin (same value as for native W32). + Minor fixes for Cygwin. + Added configure parameter to force disable usage of sendfile(). + Minor testsuite fixes. + Really fixed builds with optimisation for size. -EG + +Sat Nov 25 18:37:00 MSK 2017 + Fixed build with optimisation for size. -EG + +Fri Nov 24 20:14:02 CET 2017 + Releasing GNU libmicrohttpd 0.9.56. -CG + +Thu Nov 23 17:40:00 MSK 2017 + Added MHD_FEATURE_SENDFILE enum value and report. -EG + +Thu Nov 23 08:56:00 MSK 2017 + Fixed receiving large requests in TLS mode with epoll. + Improved GnuTLS and libgcrypt detection in configure, do not ignore + flags in GNUTLS_{CFLAGS,LIBS} variables. + Added special trick for Solaris/Openindiana to find GnuTLS-3 with + right bitness. + Added support for Solaris sendfile(3) function. + Fixed dataraces with thread ID on W32 and pthread. Now check for + correct thread in MHD_queue_response() works correctly. + Fixed and silenced compiler warnings in tests and examples. + Removed usage of TLS flags in examples where TLS is not required. + Added support for MultiSSL in https tests with libcurl >= 7.56.0. + Improved detection of OFF_T_MAX, SIZE_MAX. Added macros for + SSIZE_MAX in mhd_limits.h. There are some platforms that really + require those macros. + Added support for Darwin's sendfile() function. + Updated .gitignore files. + Reworked mhd_sys_extentions.m4 with better support of modern + platforms, more reliable detection of required macros, and + detection of disabling of system-specific features by + _XOPEN_SOURCE macro. -EG + +Wed Nov 1 20:43:00 MSK 2017 + Mixed and muted many compiler warnings. Now GCC's flags + -Wall -Wextra could be used for building. + Fixed compilation of examples without libmagic. + Better detection of libgnutls in configure. + Reworked launch of nested configure in "po" directory to + prevent useless reconfiguration. + Fixed some wrong asserts. + Enabled "test_options" test. + Use "test_start_stop" without libcurl. + Use chunks with sendfile() to prevent locking thread for + single connection with large file. + Added support for FreeBSD's sendfile with additional + optimisations for FreeBSD 11. + Refactoring and improvements for MHD_start_daemon_va() and + MHD_stop_daemon(). + Fixed testing with GnuTLS >= 3.6.0. -EG + +Mon Oct 9 22:38:07 CEST 2017 + Add MHD_free() to allow proper free()-ing of username/password + data returned via MHD_digest_auth_get_username() or + MHD_basic_auth_get_username_password() on Windows. -CG + +Tue Sep 26 14:00:58 CEST 2017 + Fixing race involving setting "at_limit" flag. -CG + +Tue Sep 08 21:39:00 MSK 2017 + Fixed build of examples when MHD build with non-pthread lib. + MHD_queue_response(): added check for using in correct thread. + Fixed sending responses larger 16 KiB in TLS mode with epoll. + Improved doxy for MHD_get_timeout() and related functions. + Minor internal refactoring. -EG + +Tue Jul 23 11:32:00 MSK 2017 + Updated chunked_example.c to provide real illustration of usage of + chunked encoding. -EG + +Thu Jul 13 21:41:00 MSK 2017 + Restored SIGPIPE suppression in TLS mode. + Added new value MHD_FEATURE_AUTOSUPPRESS_SIGPIPE so application could + check whether SIGPIPE handling is required. + Used GNUTLS_NONBLOCK for TLS sessions. -EG + +Tue Jun 20 23:52:00 MSK 2017 + Libgcrypt is now optional and required only for old GnuTLS versions. -EG + +Wed Jun 14 21:42:00 MSK 2017 + Added support for debug assert() and new configure parameter + --enable-asserts for debug builds. + Removed non-functional Symbian support. -EG + +Mon Jun 05 23:34:00 MSK 2017 + More internal refactoring: + merged MHD_tls_connection_handle_read/write() with non-TLS version, + reduced and unified number of layers for network processing (before + refactoring MHD_tls_connection_handle_read->MHD_connection_handle_read-> + do_read->recv_tls_adapter->GnuTLS->recv_param_adapter - 5 MHD layers; + after refactoring MHD_connection_handle_read->recv_tls_adapter->GnuTLS - + 2 MHD layers), + simplified and removed dead code from + MHD_connection_handle_read/write() without functional change. -EG + +Mon Jun 05 22:20:00 MSK 2017 + Internal refactoring: + used TCP sockets directly with GnuTLS (performance improvement), + moved some connection-related code from daemon.c to + connection.c/connection_https.c, + removed hacks around sendfile() and implemented correct support of + sendfile(), + removed do_read() and do_write() to reduce number of layer around send() + and recv() and to improve readability and maintainability of code, + implemented separate tracking of TLS layer state, independent of HTTP + connection stage. -EG + +Sun Jun 04 15:02:00 MSK 2017 + Improved thread-safety of MHD_add_connection() and + internal_add_connection(), minor optimisations. -EG + +Sun May 28 23:26:00 MSK 2017 + Releasing GNU libmicrohttpd 0.9.55. -EG + +Sun May 21 18:48:00 MSK 2017 + Fixed build with disabled "UPGRADE". + Fixed possible null-dereference in HTTPS test. + Fixed compiler warning in process_request_body(), minor optimizations. + Do not allow suspend of "upgraded" connections. + Fixed returned value for MHD_CONNECTION_INFO_CONNECTION_SUSPENDED. + Fixed removal from timeout lists of non-existing connections in + cleanup_connection(). + Fixed double locking of mutex. -EG + +Sun May 14 15:05:00 MSK 2017 + Fixed resuming connections and closing upgraded connections in select() + mode with thread-per-connection. -EG + +Sun May 14 14:49:00 MSK 2017 + Removed extra call to resume connections in MHD_run(). + Handle resumed connection without delay in epoll mode. + Update states of resumed connection after resume in thread-per-connection + mode. + Fixed resuming connections and closing upgraded connections in poll() + mode with thread-per-connection. -EG + +Thu May 11 22:37:00 MSK 2017 + Faster start really processing data in resumed connections. -EG + +Thu May 11 14:24:00 MSK 2017 + Do not add any "Connection" headers for "upgrade" connections. -EG + +Wed May 10 23:09:00 MSK 2017 + Resume resuming connection before other processing in external polling + mode. -EG + +Tue May 9 23:16:00 MSK 2017 + Fixed: Do not add "Connection: Keep-Alive" header for "upgrade" + connections. -EG + +Tue May 9 21:01:00 MSK 2017 + Fixed: check all "Connection" headers of request for "Close" and "Upgrade" + tokens instead of using only first "Connection" header with full string + match. -EG + +Tue May 9 12:28:00 MSK 2017 + Revert: continue match footers in MHD_get_response_header() for backward + compatibility. -EG + +Mon May 8 19:30:00 MSK 2017 + Fixed: use case-insensitive matching for header name in + MHD_get_response_header(), match only headers (not footers). -EG + +Fri May 5 20:57:00 MSK 2017 + Fixed null dereference when connection has "Upgrade" request and + connection is not upgraded. -JB/EG + Better handle Keep-Alive/Close. -EG + +Tue May 2 18:37:53 CEST 2017 + Update manual. -CG + Add MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE. + Releasing GNU libmicrohttpd 0.9.54. -CG + +Thu Apr 27 22:31:00 CEST 2017 + Replaced flags MHD_USE_PEDANTIC_CHECKS and MHD_USE_PERMISSIVE_CHECKS by + single option MHD_OPTION_STRICT_FOR_CLIENT. Flag MHD_USE_PEDANTIC_CHECKS + is still supported. -EG + +Tue Apr 26 15:11:00 CEST 2017 + Fixed shift in HTTP reasons strings. + Added test for HTTP reasons strings. -EG + +Tue Apr 25 19:11:00 CEST 2017 + Allow flag MHD_USE_POLL with MHD_USE_THREAD_PER_CONNECTION and without + flag MHD_USE_INTERNAL_POLLING_THREAD for backward compatibility. -EG + +Mon Apr 24 17:29:45 CEST 2017 + Enforce RFC 7230's rule on no whitespace by default, + introduce new MHD_USE_PERMISSIVE_CHECKS to disable. -CG + +Sun Apr 23 20:05:44 CEST 2017 + Enforce RFC 7230's rule on no whitespace in HTTP header + field names if MHD_USE_PEDANTIC_CHECKS is set. -CG + +Sun Apr 23 19:20:33 CEST 2017 + Replace remaining occurences of sprintf() with + MHD_snprintf_(). Thanks to Ram for pointing this out. -CG + +Sat Apr 22 20:39:00 MSK 2017 + Fixed builds in Linux without epoll. + Check for invalid --with-thread= configure parameters. + Fixed support for old libgcrypt on W32 with W32 threads. -EG + +Tue Apr 11 22:17:00 MSK 2017 + Releasing GNU libmicrohttpd 0.9.53. -EG + +Mon Apr 10 19:50:20 MSK 2017 + HTTPS tests: skip tests instead of failing if HTTPS is not supported by + libcurl. + HTTPS tests: fixed return values so testsuite is able to correctly + interpret it. + Fixed ignored result of epoll test in test_https_get_select. -EG + +Thu Apr 06 23:02:07 MSK 2017 + Make zzuf tests compatible with *BSD platforms. -EG + +Thu Apr 06 22:14:22 MSK 2017 + Added warning for hypothetical extra large timeout. + Fixed incorrect timeout calculation under extra rare conditions. + Fixed accidental usage of IPv6 in testsuite in specific conditions. -EG + +Wed Apr 05 14:14:22 MSK 2017 + Updated autoinit_funcs.h to latest upstream version with proper support of + Oracle/Sun compiler. -EG + +Wed Apr 05 12:53:26 MSK 2017 + Fixed some compiler warnings. + Fixed error snprintf() errors detection in digestauth.c. + Converted many run-time 'strlen()' to compile-time calculations. -EG + +Sun Mar 26 13:49:01 MSK 2017 + Internal refactoring for simplification and unification. + Minor optimizations and minor fixes. + MHD_USE_ITC used again in thread pool mode. -EG + +Sat Mar 25 20:58:24 CET 2017 + Remove dead MHD_strx_to_sizet-functions and associated + test cases from code. -CG + +Sat Mar 25 20:40:10 CET 2017 + Allow chunk size > 16 MB (up to 2^64-1). Ignore + chunk extensions instead of triggering an error. + (fixes #4967). -CG + +Tue Mar 25 20:59:18 MSK 2017 + Check for invalid combinations of flags and options in + MHD_start_daemon(). -EG + +Tue Mar 21 13:51:04 CET 2017 + Use "-lrt" to link libmicrohttpd if we are using + clock_gettime() as needed by glibc < 2.17. -CG + +Tue Mar 21 13:42:07 CET 2017 + Allow chaining of suspend-resume calls withuot + the application processing data from the network. -CG + +Mon Mar 20 0:51:24 MSK 2017 + Added autoconf module for detection whatever shutdown of listening socket + trigger select. This is only reliable method to use such feature as some + platforms change behaviour from version to version. -EG + +Sun Mar 19 13:57:30 MSK 2017 + Rewritten logic of handling "upgraded" TLS connections in epoll mode: + used edge trigger instead of level trigger, + upgraded "ready" connection are stored in DL-list, + fixed handling of more than 128 ready connections, + fixed busy-waiting for idle "upgraded" TLS connections. -EG + +Fri Mar 17 10:45:31 MSK 2017 + If read buffer is full, MHD need to receive remote data and application + suspended connection, do not fail while connection is suspended and give + application one more chance to read data from buffer once connection is + resumed. -EG + +Thu Mar 16 23:45:29 MSK 2017 + Allow again to run MHD in external epoll mode by + MHD_run_from_select() - this allow unification of user code + and produce no harm for performance. Especially useful with + MHD_USE_AUTO flag. -EG + +Thu Mar 16 23:12:07 MSK 2017 + Idle connection should be disconnected *after* "timeout" number of + second, not *before* this number. -EG/VT + +Thu Mar 16 22:31:54 MSK 2017 + Unified update of last activity on connections. + Update last activity only if something is really transmitted. + Update last activity each time when something is transmitted. + Removed early duplicated check for timeout on HTTPS connections. + Removed update of last active time for connections without timeout. + Fixed reset of timeout timer on resumed connections. + Fixed never-expired timeouts on HTTPS connections. + Fixed thread-safety of MHD_set_connection_option(). -EG + +Thu Mar 16 21:05:08 MSK 2017 + Fixed minor bug resulted in slight slowdown of HTTPS connection + handshake. -EG + +Thu Mar 16 20:35:59 MSK 2017 + Improved thread-safety for DL-lists. -EG + +Thu Mar 16 17:55:01 MSK 2017 + Fixed thread-safety of MHD_get_daemon_info() for + MHD_DAEMON_INFO_CURRENT_CONNECTIONS. -EG + +Thu Mar 16 16:49:07 MSK 2017 + Added ability to get actual daemon flags via MHD_get_daemon_info(). + Fixed test_upgrade to work in request mode. + Fixed compiler warnings in test_upgrade. -EG + +Wed Mar 15 23:29:59 MSK 2017 + Prevented socket read/write if connection is suspended. + Added missing resets of 'connection->in_idle'. + Reworked handling of suspended connection: ensure that + connection is not disconnected by timeout, always + updated read/write states right after suspending. -EG + +Wed Mar 15 21:02:26 MSK 2017 + Added new enum value MHD_CONNECTION_INFO_CONNECTION_TIMEOUT + to get connection timeout by MHD_get_connection_info(). -EG + +Sat Mar 11 12:03:45 CET 2017 + Fix largepost example from tutorial to properly generate + error pages. -CG + Fix largepost example, must only queue replies either before upload + happens or after upload is done, not while upload is ongoing + +Fri Mar 10 16:37:12 CET 2017 + Fix hypothetical integer overflow for very, very large + timeout values. -CG + +Fri Mar 10 16:22:54 CET 2017 + Handle case that we do not listen at all more gracefully + in MHD_start_daemon() and not pass '-1' to helper functions + that expect a valid socket. -CG + +Tue Mar 7 12:11:44 BRT 2017 + Updates file `.gitignore`. + +Tue Mar 7 10:37:45 BRT 2017 + Updated the MHD_OPTION_URI_LOG_CALLBACK's documentation. + +Mon Mar 6 21:46:59 BRT 2017 + Added the i18n example fixing #4924. -SC + +Wed Mar 1 23:47:05 CET 2017 + Minor internal optimisations. + Changed closure connection monitoring logic: now all connections are + monitored for OOB data (which treated as error), connections are not + monitored any more for incoming data if incoming data is not required for + processing. except_fd_set is not optional now for MHD_get_fdset(), + MHD_get_fdset2() and MHD_run_from_select(). + Improved connection processing in epoll mode: now connection can process + both read and write each turn. + Updated HTTP response codes; updated and added all missing standard HTTP + headers names (and headers categories); updated and added all missing + standard and additional HTTP methods. Now MHD return status + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE (431) instead of old + MHD_HTTP_REQUEST_ENTITY_TOO_LARGE (413) for very long header. + Reworked handling of data pending in TLS buffers, resolved busy-waiting + if incoming data is pending in TLS buffers and connection is in + LOOP_INFO_WRITE mode. + Do not clear 'ready' flag in epoll mode if send()/recv() result is + EINTERRUPTED. + Better detection of unready connection state: used less number of calls of + recv()/send() in epoll mode. + Configure: do not run gcrypt and GnuTLS tests if HTTPS is disabled by + configure parameter. + Fixed wrong value returned by MHD_get_timeout(). + All double-linked lists now walked from tail to head. As new items are + added to head, this result in more uniform processing time. + Improved sockets errors handling in epoll mode. + OOB data on 'upgraded' sockets is treated as error. -EG + +Thu Feb 16 11:20:05 CET 2017 + Replace tsearch configure check with code from gnulib. -CG + +Wed Feb 15 13:35:36 CET 2017 + Fixing a few very rare race conditions for thread-pool or + thread-per-connection operations during shutdown. + Various minor cosmetic improvements. + Fixed #4884 and #4888 (solaris portability issues). -CG + +Wed Feb 08 22:33:10 MSK 2016 + Ported test_quiesce_stream to W32. + Improved precompiler flags selection of OpenBSD. + Fixed sending responses backed by files not supported by sendfile(). + Fixed thread safety for responses backed by file FD. + Updated fileserver_example. + Improved handling of 'upgraded' TLS forwarding in select() and poll() + modes. + Fixed processing of incoming TLS data in epoll mode if more than 128 + connections are active. + Fixed accepting more than 128 incoming connection in epoll mode. + Improved test_large_put, added poll() and epoll testing. + Added test_large_put_inc for testing of incremental buffer processing. + Rewritten epoll connection processing logic: handle all connection one + time per turn instead of trying to handle all active connection until all + pending data is dried. Result is more uniform connection processing + period. -EG + +Wed Nov 23 15:24:10 MSK 2016 + Used SO_REUSEADDR (on non-W32) alongside with SO_REUSEPORT if option + MHD_OPTION_LISTENING_ADDRESS_REUSE was set. -EG + +Wed Nov 23 12:48:23 MSK 2016 + Move all gettext-related staff to 'po' subdirectory. + Excluded gettext files generation from normal build. + Removed generated files from GIT. -EG + +Tue Nov 15 19:08:43 MSK 2016 + Fixed forwarding "upgraded" TLS connections for + chunks sizes larger than buffer size. -EG + +Mon Nov 14 22:18:30 MSK 2016 + Fixed unintentional usage of SO_REUSEADDR on W32. + Added support for SO_EXCLBIND on Solaris. + Fixed using MHD with MHD_OPTION_LISTENING_ADDRESS_REUSE + on Linux kernels before 3.9 (longterm 3.2 and 3.4 + are still supported). -EG + +Sun Nov 13 19:16:38 CET 2016 + Fixed a few race issues on suspend-resume in cases where the + application uses threads even though MHD did not (or at least + had no internal need for locking). Also fixed DLL handling of + the timeout list, avoiding manipulating it for suspended + connections. Finally, eliminated calling application logic + on suspended connections (which before could happen under + certain circumstances). -CG + +Thu Nov 11 20:49:23 MSK 2016 + Added support for various forms of + pthread_attr_setname_np() so thread names will be set + more efficiently on certain platforms (Solaris, NetBSD etc.) -EG + +Thu Nov 10 21:50:35 MSK 2016 + Added rejection in MHD_start_daemon() of invalid combinations + of daemon flags. + Added MHD_USE_AUTO and MHD_USE_AUTO_INTERNAL_THREAD for + automatic selection of polling function depending on + platform capabilities and requested mode. -EG + +Thu Nov 10 17:49:56 MSK 2016 + Ported "upgrade" tests to W32 and other platforms, used + "gnutls-cli" instead of "openssl" in tests, minor bugs + fixed, added verbose reporting if requested. + "Upgrade" processing - changed internal handling logic, improved + and refactored, bugs fixed, fixed sigpipe on Darwin, added + printing error to log, fixed compilation without HTTPS. + Added 'configure' parameter "--disable-httpupgrade" for building + minimal-sized MHD versions. + Added feature check "MHD_FEATURE_UPGRADE". + Responses destroyed (freed) earlier if possible. + Added many remarks in code comments about thread safety. + Some data races and other multithread-related issues are fixed, + including usage of closed sockets (may resulted in accidental closing + of wrong socket). + SO_NOSIGPIPE is used on all platform which support it, not only + on Darwin. + Added support for suspending connections in thread-per-connection + mode (itself almost useless, mostly to unify modes support). + Fixed Inter-Thread Communication channel usage in epoll modes. + Reworked daemon cleanups and handling MHD_stop_daemon(): resources + are freed only by specific threads, data races and other fixes. + Started usage of C99 standard 'bool' where supported with + fallback to 'int'. + Renamed many MHD flags. Now they are self-explainable and more + obvious, like MHD_USE_INTERNAL_POLLING_THREAD instead of + MHD_USE_SELECT_INTERNALLY. Old flag names are supported for + backward compatibility. + Improved processing of "fast" connections: now full sequence + "read request - send reply headers - send reply body" is processed + after single select()/poll(). If connection is slow, request is huge + or response in not immediately ready - connection will be processed + in "traditional" way. + Added usage of "calloc()" where supported. + Minor documentation fixes. + Minor improvements and fixes. -EG + "Upgrade" test fixes. + Documentation updated. + Added HTTP "Upgrade" example. -CG + +Mon Oct 17 19:08:18 CEST 2016 + Fixed misc. issues relating to upgrade. + Releasing experimental 0.9.52. -CG + +Wed Oct 12 14:26:20 CEST 2016 + Migrated repository from Subversion to Git. -CG + +Tue Oct 11 18:09:56 CEST 2016 + Deprecated MHD_USE_SSL, use MHD_USE_TLS instead. -CG + +Tue Oct 11 18:14:40 MSK 2016 + Code internal refactoring: 'pipes' renamed to 'inter-thread + communication (channels)/ITCs', as code can use different types + of communications. + Optimizations: ITCs now always created in non-blocking mode. + Added configure parameter to choose ITC type. + Updated documentation and comments. + Minor errors fixed (related to heavy load). -EG + +Thu Sep 22 17:51:04 CEST 2016 + Implementing support for eventfd() instead of pipe() for + signaling (on platforms that support it); fixing #3557. -CG + +Thu Sep 22 11:03:43 CEST 2016 + Simplify internal error handling logic by folding it into the + MHD_socket_close_, MHD_mutex_lock_, MHD_mutex_unlock_ and + MHD_mutex_destroy_ functions. -CG + +Tue Sep 13 22:20:26 MSK 2016 + Added autoconf macro to enable maximum platform + features. Fixed compiling on Solaris. -EG + +Wed Sep 7 12:57:57 CEST 2016 + Fixing #4641. -Hawk + +Wed Sep 7 00:28:59 CEST 2016 + Adding remaining "_"-markups for i18n (#4614). -CG + +Tue Sep 6 23:39:56 CEST 2016 + Allow out-of-order nonces for digest authentication (#4636). -CG + +Tue Sep 6 21:29:09 CEST 2016 + Martin was right, "socket_context" should be "void *" + in `union MHD_ConnectionInfo`. -MS + +Sun Sep 4 18:16:32 CEST 2016 + Fixing potential memory leak (#4634). -CG + +Sun Sep 4 17:25:45 CEST 2016 + Tests for "Upgrade" logic are now in place and passing. + However, still need to make sure code is portable. -CG + +Sat Sep 3 11:56:20 CEST 2016 + Adding logic for handling HTTP "Upgrade" in thread-per-connection + mode. Also still untested. -CG + +Sat Aug 27 21:01:43 CEST 2016 + Adding a few extra safety checks around HTTP "Upgrade" + (against wrong uses of API), and a testcase. -CG + +Sat Aug 27 20:07:53 CEST 2016 + Adding completely *untested* logic for HTTP "Upgrade" + handling. -CG + +Sat Aug 27 18:20:38 CEST 2016 + Releasing libmicrohttpd 0.9.51. -CG + +Tue Aug 23 22:54:07 MSK 2016 + Internal refactoring: W32 compatibility layer was finally + replaced with several specialized abstraction layers for + sockets, control pipes (inter-thread communication) and + generic functions. Now all major platform functions + (including threads and mutex) are implemented in thin + abstraction layers. + Improved performance on W32 due to eliminating + translation of error to POSIX codes and using W32 codes + directly (through macros). + Improved error reporting on all platforms. + Improved error handling and reporting on Darwin. + Minor fixes. -EG + +Tue Aug 16 15:14:30 MSK 2016 + Minor improvement for monotonic clock. + Minor configure fix for non-bash shells. -EG + +Mon Aug 15 13:06:52 CEST 2016 + Fixed possible crash due to write to read-only region of + memory given ill-formed HTTP request (write was otherwise + harmless, writing 0 to where there was already a 0). + Fixed issue with closed connection slots not immediately + being available again for new connections if we reached + our connection limit. + Avoid even accept()ing connections in certain thread modes + if we are at the connection limit and + MHD_USE_PIPE_FOR_SHUTDOWN is available. -CG + +Wed Aug 10 16:42:57 MSK 2016 + Moved threads, locks and mutex abstraction to separate files, + some minor errors fixed, added support for thread name functions + on various platforms, added configure flag for disable thread + naming. -EG + +Sat Jul 23 20:45:51 CEST 2016 + Added macro detection of speed/size compiler optimization. + Added different implementation of functions in mhd_str.c for + size optimization. Enabled automatically if compiler size + optimization is detected or MHD_FAVOR_SMALL_CODE is defined. + Added unit tests for all mhd_str.c functions. -EG + +Sat Jul 16 21:54:49 CEST 2016 + Warn user if they sent connection into blocking + state by not processing all POST data, not suspending, + and not running in external select mode. -CG + +Fri Jul 8 21:35:07 CEST 2016 + Fix FIXME in tutorial. -CG + +Fri Jul 8 15:57:06 CEST 2016 + Adding support for 308 status code. -CG + +Sat Jun 25 13:49:31 CEST 2016 + Use shutdown to trigger select on NetBSD. -EG + +Thu Jun 2 09:55:50 CEST 2016 + Releasing libmicrohttpd 0.9.50. -CG + +Wed Jun 1 21:59:34 CEST 2016 + Do not send "Content-Length" header for 1xx/204/304 status codes. -CG + +Tue May 17 13:32:21 CEST 2016 + Allow clients to determine whether a connection is suspended; + introduces MHD_CONNECTION_INFO_CONNECTION_SUSPENDED. -CG/FC + +Sun May 15 12:17:25 CEST 2016 + Fix handling system or process resource limit exhaustion upon + accept(). -CG/CP + +Thu May 12 08:42:19 CEST 2016 + Fix handling of partial writes in MHD_USE_EPOLL_LINUX_ONLY; only + consider sockets returning EAGAIN as unready. -CG/CP + +Mon May 2 06:08:26 CEST 2016 + Adding logic to help address FE performance issue as + discussed on the mailinglist with subject + "single-threaded daemon, multiple pending requests, responses batched". + The new logic is only enabled when MHD_USE_EPOLL_TURBO is set. + Note that some additional refactoring was also done to clean up + the code and avoid code duplication, which may have actually fixed + an unrelated issue with HTTPS and a POLL-style event loop. -CG + +Sat Apr 30 10:22:37 CEST 2016 + Added clarifications to manual based on questions on list. -CG + +Sat Apr 23 20:12:01 CET 2016 + Tests perf_get_concurrent and test_concurrent_stop ported to use + pthread instead of fork(). Added more error detections. -EG + +Sat Apr 23 16:06:30 CET 2016 + Improved test_quiesce test. -EG + +Sat Apr 23 15:39:38 CET 2016 + Notify other threads in MHD_quiesce_daemon() so listen socket FD + is removed from awaiting select() and poll(). -EG + +Sat Apr 23 14:17:15 CET 2016 + Revert "shutdown trigger select" on Darwin. Fixed daemon shutdown + on Darwin without "MHD_USE_PIPE_FOR_SHUTDOWN" option. -EG + +Fri Apr 22 14:29:28 CET 2016 + Fixed race conditions when stopping quiesced daemon with thread + pool. -EG + +Wed Apr 20 18:12:30 CET 2016 + Fixed macros in sysfdsetsize.c which could prevent compiling with + non-default FD_SETSIZE. + Fixed comments in mhd_str.c. + Updated test_post.c to not ignore specific error on W32 if libcurl + is built with workaround for WinSock bug. -EG + +Mon Apr 18 19:35:14 CET 2016 + Fixed data races leading to inability in rare situations to + resume suspended connection. -EG + +Tue Apr 13 21:46:01 CET 2016 + Removed unneeded locking for global timeout list in + MHD_USE_THREAD_PER_CONNECTION mode. + Added 'simplepost' and 'largepost' examples to VS projects. + Added strtoXX() locale-independent replacement functions. + Added more error checking and minor fixes in digest auth + functions - should improve security. + Ignored specific errors in 'test_post' test until libcurl + will implement workaround for WinSock bug. + Fixed handling of caller-supplied socket with + MHD_OPTION_LISTEN_SOCKET (regression in 0.9.49). + Minor fixes. + Various cosmetics and comments fixes. -EG + +Sat Apr 09 13:05:42 CET 2016 + Releasing libmicrohttpd 0.9.49. -EG + +Fri Apr 08 18:32:17 CET 2016 + Some minor internal fixes, addition error checking and + micro optimizations. + Reworked usage of sockets shutdown() - now work equally + on all platforms, disconnection should be "more graceful". -EG + +Tue Mar 15 21:52:27 CET 2016 + Do not crash if pthread_create() fails. -DD + +Tue Mar 15 20:29:34 CET 2016 + Do not use eready DLL data structure unless + we are actually using epoll(). -DD/CG + +Fri Feb 5 20:43:11 CET 2016 + Fixed testsuite compile warning on W32. + Added check test for triggering poll() on + listen socket. -EG + +Thu Feb 4 11:38:11 CET 2016 + Added some buffer overrun protection. + Fixed handling of misformed URI with spaces. -EG + +Wed Feb 3 15:41:57 CET 2016 + Make signal-pipe non-blocking and drain it. -CG + +Sat Jan 30 15:49:07 CET 2016 + Fix running select() with empty fdsets on W32. -EG + +Mon Jan 25 13:45:50 CET 2016 + Added check test for triggering select() on + listen socket. -EG + +Thu Jan 21 19:35:18 CET 2016 + Fixed old bug with making sockets non-blocking on + various platforms so now sockets are really + non-blocking on all supported platforms. + Reworked and fixed code for using SOCK_CLOEXEC, + SOCK_NONBLOCK and EPOLL_CLOEXEC resulting in + fewer used system calls. -EG + +Tue Jan 19 20:59:59 CET 2016 + Cleaned up and optimized with minor fixes code for + making sockets non-blocking non-inheritable. -EG + +Tue Jan 19 11:14:18 CET 2016 + Removed workaround for Cygwin non-blocking sockets: + handling non-blocking sockets were fixed in Cygwin + and libmicrohttpd how uses non-blocking sockets on + all platforms. -EG + +Mon Jan 18 23:54:45 CET 2016 + Cleaned up examples to avoid giving oversimplified code + that may lead to complications if adopted naively. -CG + +Sun Jan 17 11:18:55 CET 2016 + Do no refuse to send response if sendfile() failed with + EINVAL (common error for files located on SMB/CIF). -EG + +Sat Jan 16 19:14:39 CET 2016 + Use US-ASCII only (instead of user locale settings) when + performing caseless string comparison as required by + standard. -EG + +Tue Jan 12 16:10:09 CET 2016 + Fixed declaraion of MHD_get_reason_phrase_for(). -EG + +Mon Jan 11 19:58:50 CET 2016 + Configure.ac small fixes and refactoring. -EG + +Fri Dec 18 15:54:50 CET 2015 + Releasing libmicrohttpd 0.9.48. -CG + +Tue Dec 15 18:35:55 CET 2015 + Improved compatibility with VS2010 and other older + compilers. -EG + +Tue Dec 8 21:48:44 CET 2015 + Default backlog size for listen socket was changed from + 32 to SOMAXCONN, added new option MHD_OPTION_LISTEN_BACKLOG_SIZE + to override default backlog size. + If not all connections can be handled by MHD_select() than + at least some of connections will be processed instead of + failing without any processing. + Fixed redefenition of FD_SETSIZE on W32 so select() will + work with 2000 connections instead of 64. + Better handled redefenition of FD_SETSIZE on all + platforms. -EG + +Sat Dec 5 17:30:45 CET 2015 + Close sockets more aggressively in multi-threaded + mode (possibly relevant for idle servers). -CG + +Fri Dec 4 13:53:05 CET 2015 + Releasing libmicrohttpd 0.9.47. -CG + +Thu Dec 3 18:21:44 CET 2015 + Reworked VS project files. Used x64 build tools by + default, many optimizations, fixes. + Added project files for VS 2015. -EG + +Tue Dec 1 14:05:13 CET 2015 + SPDY is dead, killing experimental libmicrospdy. -CG + +Tue Dec 1 10:01:12 CET 2015 + New logic for controlling socket buffer modes. + Eliminated delay before last packet in response and before + "100 Continue" response on all platforms. Also response + header are pushed to client without waiting for response + body. -EG + +Wed Nov 25 17:02:53 CET 2015 + Remove 200ms delay observable with keep-alive on Darwin + and *BSD platfroms. -EG + +Tue Nov 10 15:25:48 CET 2015 + Fix issue with shutdown if connection was resumed just + before shutdown. -FC + +Fri Nov 6 22:54:38 CET 2015 + Fixing the buffer shrinkage issue, this time with test. -CG + Releasing libmicrohttpd 0.9.46. -CG + +Tue Nov 3 23:24:52 CET 2015 + Undoing change from Sun Oct 25 15:29:23 CET 2015 + as the original code was counter-intuitive but + correct, and the new code does break pipelining. + Ignore empty lines at the beginning of an HTTP + request (more tolerant implementation). -CG + +Sat Oct 31 15:52:52 CET 2015 + Releasing libmicrohttpd 0.9.45. -CG + +Tue Oct 27 12:08:02 CET 2015 + Rework deprecation maros: fix errors with old GCC versions, + improved support for old clang and new GCC. -EG + +Sun Oct 25 23:05:32 CET 2015 + Return correct header kind in MHD_get_connection_values() + even if a bitmask is used for the "kind" argument. -FC/CG + +Sun Oct 25 15:29:23 CET 2015 + Fixing transient resource leak affecting long-lived + connections with many keep-alives and HTTP request + pipelining under certain circumstances (which reduced + the receive window). + Fixed assertion failure triggered by a race in + thread-per-connection mode on shutdown in rare + circumstances. -CG + +Mon Oct 5 11:53:52 CEST 2015 + Deduplicate code between digestauth and connection + parsing logic for URI arguments, shared code moved + to new MHD_parse_arguments_ function in internal.c. -CG + +Thu Oct 1 21:22:05 CEST 2015 + Releasing libmicrohttpd 0.9.44. -CG + +Wed Sep 30 21:05:38 CEST 2015 + Various fixes for W32 VS project files. -EG + +Fri Sep 25 09:49:10 CEST 2015 + Fix digest authentication with URL arguments where + value-less keys are given before the last argument. + Thanks to MA for reporting. -CG + +Tue Sep 22 19:17:54 CEST 2015 + Do not use shutdown() on listen socket if MHD_USE_PIPE_FOR_SHUTDOWN + is set. -CG + +Wed Sep 16 11:06:02 CEST 2015 + Releasing libmicrohttpd 0.9.43. -CG + +Wed Sep 2 16:50:31 CEST 2015 + Call resume_suspended_connections() when the user is running + its own mainloop and calls MHD_run_from_select() to support + resuming connections with external select. -FC + +Sun Aug 30 14:53:51 CEST 2015 + Correct documentation as to when MHD_USE_EPOLL_LINUX_ONLY + is allowed. -CG + +Thu Aug 27 09:38:44 CEST 2015 + Reimplement monotonic clock functions for better + support various platforms. + Print more information during configure. -EG + +Fri Aug 14 14:13:55 CEST 2015 + Export MHD_get_reason_phrase_for() symbol. -CG + +Sat Aug 8 12:19:47 CEST 2015 + Added checks for overflows and buffer overruns, fixed + possible buffer overrun. + Updated md5 implementation. + Fixed many compiler warning (mostly for VC compiler). -EG + +Tue Aug 4 13:50:23 CEST 2015 + Fix failure to properly clean up timed out connections + if running in external select mode without listen socket, + which caused busy waiting until new connections arrived. + (Fixes #3924, thanks to slimp for reporting and testcase). -CG + +Sun Aug 2 19:08:20 CEST 2015 + Ignore close() errors on sockets except for EBADF, + fixes #3926. -CG + +Sat Jun 27 22:16:27 CEST 2015 + Make sure to decrement connection counter before + calling connection notifier so that + MHD_DAEMON_INFO_CURRENT_CONNECTIONS does not + present stale information (relevant if this is + used for termination detection of a daemon + stopped via MHD_quiesce_daemon()). Thanks to + Markus Doppelbauer for reporting. -CG + +Fri Jun 26 23:17:20 CEST 2015 + Fix (automatic) handling of HEAD requests with + MHD_create_response_from_callback() and HTTP/1.1 + connection keep-alives. Thanks to Cristian Klein + for reporting. -CG + +Tue Jun 09 18:30:17 CEST 2015 + Add new functions MHD_create_response_from_fd64() and + MHD_create_response_from_fd_at_offset64(). -EG + +Thu Jun 4 13:37:05 CEST 2015 + Fixing memory leak in digest authentication. -AW + +Wed Jun 03 21:23:47 CEST 2015 + Add deprecation compiler messages for deprecated functions + and macros. -EG + +Fri May 29 12:23:01 CEST 2015 + Fixing digest authentication when used in combination + with escaped characters in URLs. -CG/AW + +Wed May 13 11:49:09 CEST 2015 + Releasing libmicrohttpd 0.9.42. -CG + +Wed May 13 11:33:59 CEST 2015 + Fix off-by-one in MHD_start_daemon_va() error handling logic + when initialization of threads for thread pool fails for some + reason. -CG/JC + +Thu May 7 17:05:46 CEST 2015 + Add support for poll() in W32. -EG + +Wed May 6 18:07:38 CEST 2015 + Fix #3784: actually implement MHD_CONNECTION_INFO_SOCKET_CONTEXT. -asherkin + +Thu Apr 30 00:03::49 CEST 2015 + Releasing libmicrohttpd 0.9.41. -CG + +Thu Apr 30 00:02:33 CEST 2015 + Fix issue where resumed connections would not continue + unless other requests are active in certain + event-loop modes. Thanks to Mike Castillo for reporting. -CG + +Wed Apr 15 03:16:18 CEST 2015 + Fixing issue #3753 (testcase issue). -CG + +Wed Apr 15 00:30:34 CEST 2015 + Fix looping issue when using MHD_USE_POLL_INTERNALLY + and a client times out. -LB + +Sun Apr 12 21:48:50 CEST 2015 + Fix looping issue when combining MHD_USE_EPOLL_LINUX_ONLY + with HTTPS and slow clients. -CG + +Fri Apr 10 22:02:27 CEST 2015 + Fix logic to add "Connection: Close" that was broken in 0.9.38 + when adding MHD_RF_HTTP_VERSION_1_0_ONLY. -CG + +Fri Apr 10 00:38:40 CEST 2015 + Ensure fast termination in MHD_USE_THREAD_PER_CONNECTION + mode on W32 by using signal pipe. -CG + +Thu Apr 9 09:01:15 CEST 2015 + Fixing issue with undrained signal pipe when using + MHD_USE_SELECT_INTERNALLY and MHD_USE_POLL in combination + with MHD_resume_connection(), causing 100% CPU usage. -DD + +Tue Apr 7 00:12:36 CEST 2015 + Releasing libmicrohttpd 0.9.40. -CG + +Sat Apr 4 18:28:24 CEST 2015 + Fix potential deadlock issue in MHD_USE_THREAD_PER_CONNECTION + mode if shutdown is initiated while connections are active. -CG + +Sat Apr 4 17:48:13 CEST 2015 + Fix issue in thread-pool mode where a MHD_stop_daemon() + might not reach threads that stopped listening because + we hit the maximum number of concurrent connections and + the option MHD_USE_PIPE_FOR_SHUTDOWN was also not used. + Testcase added as well. -CG + +Fri Apr 3 12:55:31 CEST 2015 + Update HTTPS testcases to avoid SSLv3, as SSLv3 is dead. + +Fri Apr 3 12:25:28 CEST 2015 + Do not enforce FD_SETSIZE-limit on worker control + pipe when using MHD_USE_EPOLL_LINUX_ONLY (#3751). -MH/CG + +Tue Mar 31 10:28:26 CEST 2015 + Adding MHD_OPTION_NOTIFY_CONNECTION, + MHD_CONNECTION_NOTIFY_STARTED, + MHD_CONNECTION_NOTIFY_CLOSED and + MHD_CONNECTION_INFO_SOCKET_CONTEXT to allow + applications to trigger operations when TCP + connections start or end, instead of just + exposing HTTP requests starting and ending. -RG/CG + +Thu Feb 26 09:55:43 CET 2015 + Fixing bug that prevented MHD_OPTION_HTTPS_MEM_DHPARAMS + from working within a MHD_OPTION_ARRAY. -DD + +Sun Feb 8 01:24:38 CET 2015 + Adding MHD_OPTION_HTTPS_KEY_PASSWORD as proposed by + Andrew Basile. -CG/AB + +Wed Feb 4 20:34:22 CET 2015 + Fix issue where for HTTP/1.0-clients that set + Connection: Keep-Alive header a response of + indefinite size was generated with chunked encoding. -CG + +Sun Jan 18 20:09:06 CET 2015 + Fix potential infinite loop on shutdown in multi-threaded mode + under certain conditions. -CG + +Mon Dec 22 16:33:18 CET 2014 + Releasing 0.9.39. -CG + +Mon Dec 22 13:02:36 CET 2014 + Fix generated compiler flags for Solaris Studio linker (#3584). -CG + +Sat Dec 20 00:35:40 CET 2014 + Adding MHD_http_unescape() to public API (#3585). -CG + Updating documentation to document + MHD_is_feature_supported(). -CG + +Thu Dec 4 00:43:10 CET 2014 + If "Connection: upgrade" is requested, do not add + "Connection: Keep-Alive" in the response. -GJ + +Tue Nov 18 13:52:29 CET 2014 + Call MHD_cleanup_connections() during MHD_DAEMON_INFO_CURRENT_CONNECTIONS + processing for more accurate results. -MS + +Wed Oct 29 20:45:21 CET 2014 + Adding MHD_OPTION_LISTENING_ADDRESS_REUSE option allowing clients + to force allowing re-use of the address:port combination + (SO_REUSEPORT). -MS + +Wed Oct 29 16:27:05 CET 2014 + Adding MHD_DAEMON_INFO_CURRENT_CONNECTIONS to allow clients + to query the number of active connections. -MS + +Fri Oct 3 14:28:58 CEST 2014 + Releasing 0.9.38. -CG + +Mon Sep 29 22:25:34 CEST 2014 + Properly decode '+' in URL-encoded POST data. -CG/KM + +Fri Sep 12 17:32:09 CEST 2014 + Fix --disable-dauth configure option (#3543). -doostee + +Thu Jun 26 21:06:04 CEST 2014 + Fix failure to terminate 'instantly' in thread-per-connection + mode if there is a client with open connections. + Thanks to Kenneth Mastro for reporting. -CG + +Sun Jun 22 12:22:08 CEST 2014 + Actually, avoid locking on response as responses must + not be modified in a connection-specific way; instead + modify the connection's data buffer to add missing + responses headers. If we are forced to add + "Connection: close", suppress output of conflicting + application-provided "Connection: Keep-Alive" header. -CG + +Sun Jun 22 00:22:08 CEST 2014 + Lock on response if adding headers, needed if response + object is shared across threads and connections. -CG + +Thu Jun 19 17:32:32 CEST 2014 + Ensure that listen FD is bound to epoll FD even before + MHD_run() is called if running with MHD_USE_EPOLL_LINUX_ONLY + in combination with 'external select' mode. Thanks to + Marcos Pindado Sebastian for reporting. -CG + +Sun Jun 8 15:10:44 CEST 2014 + Add 'MHD_set_response_options' as a way to set per-response + flags. Add flag to force HTTP 1.0-only conservative + behavior, in particular suppressing adding "Connection" + headers. -CG + +Mon Jun 2 00:03:28 CEST 2014 + Added back unescaping for URI path (#3413) but without + unescaping '+' (#3371) to remain compatible with + MHD 0.9.34 and before. Note that applications providing + a custom MHD_OPTION_UNESCAPE_CALLBACK are no longer expected + to replace '+' with ' ', as that is now done separately for + the locations where this transformation is appropriate. + Releasing 0.9.37. -CG + +Wed May 28 15:30:56 CEST 2014 + Properly applying patch that was supposed to be + committed on "May 2 20:22:45 CEST 2014" to address + infinite loop (DoS) when HTTP connection is reset (#3392). -GM + +Sun May 25 20:18:27 CEST 2014 + Fixed W32 build issues. -EG + Releasing 0.9.36. -CG + +Sat May 17 06:47:00 CEST 2014 + Fix notifying client about completed request twice + under certain circumstances. -CG + +Tue May 13 18:24:37 CEST 2014 + Fix accidental transmission of footer termination '\r\n' + for responses with zero byte payload and non-chunked + encoding (#3397). Thanks to amatus for reporting. -CG + +Sun May 4 11:05:26 CEST 2014 + Fix gnutls header check to make it cross-compile aware. -BK + +May 2 20:22:45 CEST 2014 + Fix infinite loop (DoS) when HTTP connection is reset (#3392). -GM + Fix possible issue from combination of epoll and suspend/resume + logic if edge trigger event is lost; also simplify logic to + maintain simpler invariants on the epoll state. -CG + Use OpenSSL cipher list "HIGH" in libmicrospdy (#3391). -CG + Releasing 0.9.35. -CG + +Thu Apr 10 09:39:38 CEST 2014 + Removed unescaping for URI path (#3371) as '+' should not + be converted to space in accordance with + http://www.w3.org/TR/html401/appendix/notes.html#ampersands-in-uris + and http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1 + Note that we now also no longer convert '#38;' to '&'; if needed, + the application needs to apply unescaping to the path of the URI + itself (before, MHD unescaped '#38;' but not '&', so this + inconsistency was now resolved by simply not unescaping anything + before the first '&'). -CG + +Tue Apr 08 15:35:44 CET 2014 + Added support for W32 native threads. + Added --with-threads=LIB configure parameter. -EG + +Mon Apr 7 13:25:30 CEST 2014 + Add MHD_OPTION_HTTPS_MEM_DHPARAMS to allow applications + to enable PFS. -HB/CG + +Tue Apr 01 07:10:23 CET 2014 + Added usage of native mutex on W32. -EG + +Sat Mar 29 16:12:03 CET 2014 + Added MHD_is_feature_supported() function. -EG + +Thu Mar 27 14:47:54 CET 2014 + Used larger FD_SETSIZE internally on W32. + Extended API to work with non-default FD_SETSIZE. -EG + +Tue Mar 25 12:53:55 CET 2014 + Fix limiting by IPv6 address. -EG + +Tue Mar 25 09:06:13 CET 2014 + Added more FD_SETSIZE checks. + Implemented FD_SETSIZE checks for W32. -EG + +Wed Mar 05 13:15:05 CET 2014 + Cleanup and refactoring of configure.ac. + m4 macros updated. + Custom configure macros replaced with autoconf archive macros. + SPDY disabled by default on W32. + Changed configure flag from '--disable-pipe' to + '--enable-socketpair'. + Added configure flags '--disable-doc' and '--disable-examples'. + Narrowed down extrenal lib specific compiler and linker flags + usage. -EG + +Wed Feb 26 17:42:34 CET 2014 + Refactoring of configure.ac: custom macros replaced with macros + from Autoconf Archive. + Minor corrections of configure.ac. + Excluded pthread flags from global flags, pthread now used only + where required. + W32: fixed .dll resource compilation with '-isystem' CPPFLAG. + W32: improved header compatibility with MSVC. + W32: now tested on Win64, compiled by MinGW-w64. -EG + +Mon Feb 24 23:13:53 CET 2014 + Added support for TCP FASTOPEN. -SHT + Releasing 0.9.34. -CG + +Thu Feb 20 14:17:05 CET 2014 + W32: Added creation of libmicrohttpd.lib, libmicrohttpd.def, + libmicrohttpd.exp and libmicrohttpd-static.lib for easy use + compiled MHD with MSVC. + W32: Use MS lib.exe tool if available for creating MSVC staff. + W32: Added .dll information resource. -EG + +Tue Feb 18 19:46:45 CET 2014 + Removed dependency on plibc for simpler compilation for W32. + Added configure option "--disable-pipes" to use socketpairs + instead of pipes for signalling to child threads. Pipes are + always disabled on W32. + Some code refactoring. -EG + +Sat Feb 8 15:08:35 CET 2014 + Corrected some uses of 'int' vs. 'size_t'. -EG/CG + +Wed Jan 22 09:44:33 CET 2014 + MHD_USE_DUAL_STACK in libmicrohttpd currently just *inhibits + setting* the IPV6_V6ONLY socket option, but per Microsoft's + documentation the default on Windows is that this is enabled, thus + MHD_USE_DUAL_STACK will not work (since it leaves the + default). libmicrohttpd should probably just unconditionally set + IPV6_V6ONLY to the desired value when the option is available. -LJ + +Wed Jan 1 21:38:18 CET 2014 + Allow Keep-Alive with HTTP 1.0 (if explicitly requested), + and automatically set "Connection: Keep-Alive" in response + in this case as well. -CG + +Tue Dec 24 12:27:39 CET 2013 + Adding explicit annotations to hide symbols that are not for + export in the C code (gcc 4.0 or higher only). -CG + +Sun Dec 22 14:54:30 CET 2013 + Adding a few lines to avoid warnings from picky compilers. -CG + +Sat Dec 21 17:26:08 CET 2013 + Fixed an issue with a missing argument in the postexample. + Fixed issue with bogus offset increment involving sendfile + on GNU/Linux. Adding support for SNI. + Releasing 0.9.33. -CG + +Mon Dec 9 21:41:57 CET 2013 + Fix for per-worker daemon pipes enabled with + MHD_USE_SUSPEND_RESUME that were not closed in + MHD_stop_daemon. -MH + +Sat Dec 7 00:44:49 CET 2013 + Fixing warnings and build issue if --disable-https is given + to configure. -CG + +Tue Dec 3 21:25:56 CET 2013 + Security fix: do not read past 0-terminator when unescaping + strings (thanks to Florian Weimer for reporting). + Releasing 0.9.32. -CG + +Tue Dec 3 21:05:38 CET 2013 + Signaling n times for shutdown works, but for resume we need to + wake up the correct daemon. Even if we signal n times in that + case also, there's no guarantee that some daemon can't run + through its select loop more than once before the daemon we want + to wake up gets a chance to read. Thus we need a signal pipe + per thread in the thread pool IF MHD_suspend_connection is used. + This introduces a new flag MHD_USE_SUSPEND_RESUME to add those + additional pipes and only allow MHD_suspend_connection to be + used in conjunction with this flag. + + Also, as MHD_resume_connection() will be called on a non-daemon + thread, but none of the queue insert/delete calls are thread safe, + we need to be concerned about (a) corrupting the queue, and (b) + having to add mutex protection around every access to the queues, + including loops through timer queues, etc. This wasn't a problem + before adding resume; even suspend should be safe since it happens + in a callback from the daemon. + + I think it's easier to (a) have MHD_suspend_connection() move the + connection to a suspended queue, (b) have MHD_resume_connection() + mark the connection as resuming, and then (c) do all the actual + queue manipulations in MHD_select (poll, epoll, etc.) to move the + resumed connections back to their normal queues, in response to + the wake up. The changes are simpler & cleaner. There is a cost to + the basic select loop that is avoided by making suspend/resume a + startup option. The per-worker pipes can then also be enabled only + with that option set. -MH + +Fri Nov 29 20:17:03 CET 2013 + Eliminating theoretical stack overflow by limiting length + of URIs in authentication headers to 32k (only applicable + if the application explicitly raised the memroy limits, + and only applies to MHD_digest_auth_check). Issue was + reported by Florian Weimer. -CG + +Tue Nov 26 01:26:15 CET 2013 + Fix race on shutdown signal with thread pool on non-Linux + systems by signalling n times for n threads. -CG + +Sun Nov 24 13:41:15 CET 2013 + Introduce state to mark connections in suspended state (with + epoll); add missing locking operations in MHD_suspend_connection. + Fix definition of MHD_TLS_CONNECTION_INIT. -MH/JC + +Wed Oct 30 09:34:20 CET 2013 + Fixing issue in PostProcessor when getting partial boundary + at the beginning, expanding test suite. -CG + +Sun Oct 27 15:19:44 CET 2013 + Implementing faster processing of upload data in multipart + encoding (thanks to performance analysis by Adam Homolya). -CG + +Thu Oct 24 10:40:03 CEST 2013 + Adding support for connection flow control via + MHD_suspend_connection and MHD_resume_connection. -CG + +Sat Oct 19 16:40:32 CEST 2013 + Releasing libmicrohttpd 0.9.31. -CG + +Mon Sep 23 20:24:48 CEST 2013 + Fixing build issues on OS X with CLOCK_MONOTONIC not being + implemented on OS X. -CG + +Mon Sep 23 14:15:00 CEST 2013 + Make libmicrohttpd play nicely with upcoming libgcrypt 1.6.0. -CG + +Fri Sep 20 17:01:37 CEST 2013 + Improved configure checks for cURL. -CG + +Wed Sep 18 18:29:24 CEST 2013 + Signal connection termination as OK (and not as ERROR) if the + stream was terminated by the callback returning + MHD_CONTENT_READER_END_OF_STREAM. Also, release response + mutex before calling the termination callback, to avoid + possible deadlock if the client destroys the response in + the termination callback (due to non-recursiveness of the + lock). -CG + +Wed Sep 18 14:31:35 CEST 2013 + Adding #define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN. -CG + +Tue Sep 17 21:32:47 CEST 2013 + Also pass MHD connection handle in URI log callback. -CG + +Fri Sep 6 10:00:44 CEST 2013 + Improved check for proper OpenSSL version for + libmicrospdy. -CG + +Wed Sep 4 17:23:15 CEST 2013 + Set IPV6_V6ONLY socket option correctly when IPv6 is + enabled (MHD_USE_IPv6) but not dual stack + (MHD_USE_DUAL_STACK) -MW + +Mon Sep 2 22:59:45 CEST 2013 + Fix use-after-free in epoll()-mode on read error. + Releasing libmicrohttpd 0.9.30. -CG + +Sun Sep 1 21:55:53 CEST 2013 + Fixing build issues on FreeBSD. -CG + +Fri Aug 30 13:53:04 CEST 2013 + Started to implement #3008 (RFC 2616, section 8.1.4 + says HTTP server SHOULD terminate connection if the + client closes it for writing via TCP FIN, so we should + continue to try to read and react differently + if recv() returns zero). -CG + +Wed Aug 28 18:40:47 CEST 2013 + Fix #3007 (build issue if messages are disabled). -CG + +Tue Aug 27 18:39:08 CEST 2013 + Fix build issue if SOCK_NONBLOCK/EPOLL_CLOEXEC are not + defined (as is the case on older glibc versions). -CG + +Fri Aug 23 14:28:02 CEST 2013 + Releasing libmicrohttpd 0.9.29. -CG + +Mon Aug 12 23:51:18 CEST 2013 + Updated manual, documenting W32 select/shutdown issue. -CG + +Sat Aug 10 21:01:18 CEST 2013 + Fixed #2983. -CG + +Sat Aug 10 20:39:27 CEST 2013 + Use 'errno' to indicate why 'MHD_add_connection' failed + (#2984). -CG + +Sat Aug 10 17:31:31 CEST 2013 + Disable use of 'shutdown' on W32 always as winsock + doesn't properly behave with half-closed connections + (see http://www.chilkatsoft.com/p/p_299.asp). -CG/LRN + +Thu Aug 8 07:55:07 CEST 2013 + Fixing issue with pipelining not working as desired. -CG + +Wed Aug 7 08:17:40 CEST 2013 + Removing dependency on liberty (on W32). -MC + +Fri Aug 2 20:55:47 CEST 2013 + Fix HTTP 1.1 compliance with respect to not returning + content-length headers for successful "CONNECT" requests. + Note that for unsuccessful "CONNECT" requests with an + empty response body, users must now explicitly set the + content-length header. -CG + +Sun Jul 28 16:35:17 CEST 2013 + Fixing build issue (missing #ifdef) in conjunction with + --disable-messages. -blueness + +Sat Jul 20 12:35:40 CEST 2013 + Fixing combination of MHD_USE_SSL and MHD_USE_EPOLL_LINUX_ONLY. -CG + +Fri Jul 19 09:57:27 CEST 2013 + Fix issue where connections were not cleaned up when + 'MHD_run_from_select' was used. Adding experimental + TURBO mode. + Releasing libmicrohttpd 0.9.28. -CG + +Sun Jul 14 19:57:56 CEST 2013 + Removing 'shutdown' calls that happen just before close or + that are for read-only and for a client that has already + stopped sending anyway (thus reducing number of system calls + slightly). -CG + +Sun Jul 14 19:37:37 CEST 2013 + Name MHD worker threads on glibc >= 2.12. -,L4X[o](B + +Fri Jul 5 12:05:01 CEST 2013 + Added MHD_OPTION_CONNECTION_MEMORY_INCREMENT to allow users + to specify a custom value for incrementing read buffer + sizes (#2899). -MH + +Fri Jun 28 14:05:15 CEST 2013 + If we shutdown connection for reading on POST due to error, + really do not process further requests even if we already + read the next request from the connection. Furthermore, do + not shutdown connections for reading on GET/HEAD/etc. just + because the application queued a response immediately --- + reserve that behavior for PUT/POST. -CG + +Tue Jun 25 15:08:30 CEST 2013 + Added option 'MHD_USE_DUAL_STACK' to support a single + daemon for IPv4 and IPv6 without the application having + to do the binding. -CG + +Mon Jun 24 22:33:34 CEST 2013 + Finished integration with epoll, including benchmarking and + documentation. -CG + +Sun Jun 23 15:28:13 CEST 2013 + Added option 'MHD_USE_PIPE_FOR_SHUTDOWN' to cleanly support + 'MHD_quiesce_daemon' with thread pools and per-connection + threads (we then need a pipe for shutdown, but if + 'MHD_quiesce_daemon' is not used, we do not want to + require the use of a pipe; introducing the pipe after + the threads have been started can also fail, so the + application needs to tell us early on). -CG + +Sat Jun 22 20:24:17 CEST 2013 + Removed locking calls for thread modes that do not need them. + Reorganized way to obtain connection's event loop state. + Added sorted XDLL for connections with default timeout to + avoid having to loop over all connections to determine current + timeout (custom per-connection timeouts are in another list + which is iterated each time). -CG + +Fri Jun 21 20:55:48 CEST 2013 + Preparing build system and tests for epoll support. -CG + +Tue May 21 14:34:36 CEST 2013 + Improving configure tests for OpenSSL and spdylay to + avoid build errors in libmicrospdy code if those libraries + are not present. -CG + +Mon May 20 12:29:35 CEST 2013 + Added MHD_CONNECTION_INFO_CONNECTION_FD to allow clients + direct access to connection socket; useful for COMET + applications that need to disable NAGLE (#2886). -CG + +Mon May 15 12:49:01 CEST 2013 + Fixing #2859. -CG + +Sun May 5 21:44:08 CEST 2013 + Merged libmicrospdy code with libmicrohttpd build system + (no major changes to libmicrospdy itself yet). -CG + +Sun May 5 20:13:59 CEST 2013 + Improved documentation and code style a bit. + Releasing libmicrohttpd 0.9.27. -CG + +Thu Apr 25 13:08:10 CEST 2013 + Added 'MHD_quiesce_daemon' to allow application to stop + processing new incoming connections while finishing + ongoing requests. -CG + +Sun Mar 31 23:17:13 CEST 2013 + Added MHD demonstration code 'src/examples/demo.c'. -CG + +Sun Mar 31 20:27:48 CEST 2013 + Adding new API call 'MHD_run_from_select' to allow programs + running in 'external select mode' to reduce the number of + 'select' calls by a factor of two. -CG + +Sun Mar 31 20:03:48 CEST 2013 + Performance improvements, updated documentation. + Make better use of available memory pool memory for + reading (especially important for large POST uploads); + improve post processor speed by internally adjusting the + buffer size by 4 bytes to ensure "round" IO sizes given + a "round" post processor buffer size argument. Note + that applications that previously added 4 bytes to the + post processor buffer size might now perform worse. + Using the new 'demo' example, POST upload speed + increased from ~90 MB/s to ~120 MB/s for a large file + (note that the improvement comes from better aligned + disk IO; without disk IO, the speed was (and remains) + at ~1500 MB/s on this system). -CG + +Fri Mar 29 16:44:29 CET 2013 + Renaming testcases to consistenly begin with test_; + Changing build system to build examples in doc/. + Releasing libmicrohttpd 0.9.26. -CG + +Thu Mar 7 10:13:08 CET 2013 + Fix bug in postprocessor URL parser (#2818). -jgresula + +Mon Mar 4 13:45:35 CET 2013 + Fix dropping of SSL connections if uptime is less than + MHD_OPTION_CONNECTION_TIMEOUT due to integer underflow (#2802). -greed + +Fri Mar 1 01:11:57 CET 2013 + Fully initialize cleanup mutex struct for each thread (#2803). -Ulion + +Wed Feb 6 01:51:52 CET 2013 + Releasing libmicrohttpd 0.9.25. -CG + +Fri Feb 1 10:19:44 CET 2013 + Handle case where POST data contains "key=" without value + at the end and is not new-line terminated by invoking the + callback with the "key" during MHD_destroy_post_processor (#2733). -CG + +Wed Jan 30 13:09:30 CET 2013 + Adding more 'const' to allow keeping of reason phrases in ROM. + (see mailinglist). -CG/MV + +Tue Jan 29 21:27:56 CET 2013 + Make code work with PlibC 0.1.7 (which removed plibc_init_utf8). + Only relevant for W32. Fixes #2734. -CG + +Sat Jan 26 21:26:48 CET 2013 + Fixing regression introduced Jan 6 (test on data_size instead + of total_size. -CG + +Fri Jan 11 23:21:55 CET 2013 + Also return MHD_YES from MHD_destroy_post_processor if + we did not get '\r\n' in the upload. -CG + +Sun Jan 6 21:10:13 CET 2013 + Enable use of "MHD_create_response_from_callback" with + body size of zero. -CG + +Tue Dec 25 16:16:30 CET 2012 + Releasing libmicrohttpd 0.9.24. -CG + +Tue Dec 18 21:18:11 CET 2012 + Given both 'chunked' encoding and 'content-length', + ignore the 'content-length' header as per RFC. -ES + +Thu Dec 6 10:14:44 CET 2012 + Force adding "Connection: close" header to response if + client asked for connection to be closed (so far, we + did close the connection, but did not send the + "Connection: close" header explicitly, which some clients + seem to dislike. (See discussion on mailinglist). + Also, if there is already a transfer-encoding other + than 'chunked' set by the application, we also now close + the connection if the response is of unknown size. -CG + +Wed Dec 5 19:22:26 CET 2012 + Fixing parameter loss of POST parameters with IE8 and Chrome + in the PostProcessor as the code failed to properly handle + partial data. -MM + +Fri Nov 9 21:36:46 CET 2012 + Releasing libmicrohttpd 0.9.23. -CG + +Thu Nov 8 22:32:59 CET 2012 + Ship our own version of tsearch and friends if not provided by platform, + so that MHD works nicely on Android. -JJ + +Mon Oct 22 13:05:01 CEST 2012 + Immediately do a second read if we get a full buffer from + TLS as there might be more data in the TLS buffers even if + there is no activity on the socket. -CG + +Tue Oct 16 01:33:55 CEST 2012 + Consistently use "#ifdef" and "#ifndef" WINDOWS, and not + sometimes "#if". -CG + +Sat Sep 1 20:51:21 CEST 2012 + Releasing libmicrohttpd 0.9.22. -CG + +Sat Sep 1 20:38:35 CEST 2012 + Adding configure option to allow selecting support for basic + and digest authentication separately (#2525). -CG + +Thu Aug 30 21:12:56 CEST 2012 + Fixing URI argument parsing when string contained keys without + equals sign (i.e. '&bar&') in the middle of the argument (#2531). + Also replacing 'strstr' with more efficient 'strchr' when + possible. -CG + +Tue Aug 21 14:36:17 CEST 2012 + Use "int" instead of "enum X" in 'va_arg' calls to be nice to + compilers that use 'short' (i.e. 8 or 16 bit) enums but pass + enums still as "int" in varargs. (See discussion on mailinglist). -CG/MV + +Tue Aug 21 14:31:54 CEST 2012 + Reduce default size in post processor buffer (for small systems; + performance impact on large systems should be minimal). -CG/MV + +Thu Jul 19 21:48:42 CEST 2012 + Releasing libmicrohttpd 0.9.21. -CG + +Thu Jul 19 11:34:50 CEST 2012 + Consistently use 'panic' function instead of ever directly + calling 'abort ()'. Eliminating unused mutex in SSL mode. + Removing check in testcases that fails depending on which + version of gnuTLS is involved. -CG + +Tue Jul 17 23:50:43 CEST 2012 + Stylistic code clean up. Allowing lookup up of trailing values + without keys using "MHD_lookup_connection_value" with a key of NULL + (thus achieving consistency with the existing iterator API). -CG + +Tue Jul 17 22:37:05 CEST 2012 + Adding experimental (!) code for MHD operation without listen socket. -CG + +Tue Jul 17 22:15:57 CEST 2012 + Making sendfile test pass again on non-W32 systems. -CG + +Mon Jul 9 13:43:35 CEST 2012 + Misc changes to allow testcases to pass on W32. -LRN + +Sun Jul 8 15:05:31 CEST 2012 + Misc changes to fix build on W32. -LRN + +Fri Jun 22 11:31:25 CEST 2012 + Make sure sockets opened by MHD are non-inheritable by default (#2414). -CG + +Tue Jun 19 19:44:53 CEST 2012 + Change various uses of time(NULL) to new MHD_monotonic_time() function to + make timeouts immune to the system real time clock changing. -MC + +Tue Jun 12 21:35:00 CEST 2012 + Adding 451 status code. -CG + +Thu May 31 13:33:45 CEST 2012 + Releasing 0.9.20. -CG + +Tue May 29 13:55:03 CEST 2012 + Fixed some testcase build issues with disabled post processor. -CG + +Tue May 29 13:45:15 CEST 2012 + Fixing bug where MHD failed to call connection termination callback + if a connection either was closed due to read errors or if MHD + was terminated with certain threading models. Added new + termination code MHD_REQUEST_TERMINATED_READ_ERROR for the + read-termination cause. -CG + +Thu Mar 15 23:47:53 CET 2012 + Eliminating code clone in tls connection read/write handlers. -CG + +Fri Mar 2 23:44:56 CET 2012 + Making sure that MHD_get_connection_values iterates over the + headers in the order in which they were received. -CG + +Wed Feb 1 09:39:12 CET 2012 + Fixed compilation problem on MinGW. -BS + +Tue Jan 31 17:50:24 CET 2012 + Releasing 0.9.19. -CG + +Mon Jan 30 20:02:34 CET 2012 + Fixed handling of garbage prior to first multipart boundary + (#2126). -woof + +Fri Jan 27 11:00:43 CET 2012 + Fixed postprocessor failure for applications that enclosed boundary + in quotes (#2120). -woof + +Tue Jan 24 16:07:53 CET 2012 + Added configure check for sin_len in 'struct sockaddr' and adding + code to initialize this field if it exists now. -CG + +Mon Jan 23 14:02:26 CET 2012 + Fixed double-free if specified cipher was not valid (during + MHD_daemon_start). Releasing 0.9.18. -CG + +Thu Jan 19 22:11:12 CET 2012 + Switch to non-blocking sockets for all systems but Cygwin + (we already used non-blocking sockets for GNU/Linux); also + use non-blocking sockets on Cygwin for HTTPS as this is + required to avoid DoS-by-partial-record via gnutls. On + Cygwin, #1824 implies that we need to use blocking sockets + for HTTP on Cygwin for now. -CG + +Thu Jan 19 17:46:05 CET 2012 + Fixing use of uninitialized 'earliest_deadline' variable in + MHD_get_timeout which can lead to returning an incorrect + (too early) timeout (#2085). -tclaveirole + +Thu Jan 19 13:31:27 CET 2012 + Fixing digest authentication for GET requests with URI arguments + (#2059). -CG + +Sat Jan 7 17:30:48 CET 2012 + Digest authentication expects nonce count in base 16, not base 10 + (#2061). -tclaveirole + +Thu Jan 5 22:01:37 CET 2012 + Partial fix for #2059, digest authentication with GET arguments. -CG + +Thu Dec 1 15:22:57 CET 2011 + Updated authorization_example.c to actually demonstrate the current + MHD API. -SG + +Mon Nov 21 18:51:30 CET 2011 + Added option to suppress generation of the 'Date:' header to be + used on embedded systems without RTC. Documented the new option + and the configure options. -CG + +Sat Nov 19 20:08:40 CET 2011 + Releasing 0.9.17. -CG + +Fri Nov 18 20:17:22 CET 2011 + Fixing return value of MHD_get_timeout if timeouts are not in use. + (#1914). -rboulton + +Sun Nov 13 13:34:29 CET 2011 + Trying to fix accidental addition of a "Connection: close" footer + under certain (rare) circumstances. -CG + +Fri Nov 4 10:03:00 CET 2011 + Small updates to the tutorial. + Releasing 0.9.16. -CG + +Thu Nov 3 10:14:59 CET 2011 + shutdown(RDWR) fails on OS X after shutdown(RD), so only use + shutdown(WR) if we already closed the socket for reading (otherwise + OS X might not do shutdown (WR) at all). -CG + +Tue Nov 1 18:51:50 CET 2011 + Force adding of 'Connection: close' to the header if we (for whatever + reason) are shutting down the socket for reading (see also + #1760). -CG + +Thu Oct 27 14:16:34 CEST 2011 + Treat EAGAIN the same way as EINTR (helps on W32). -LRN + +Wed Oct 12 10:40:12 CEST 2011 + Made sockets blocking again for non-Linux platforms as non-blocking + sockets cause problems (#1824) on Cygwin but offer better performance + on Linux (see change on August 11 2011). -CG/pross + +Fri Oct 7 19:50:07 CEST 2011 + Fixed problems with testcases on W32. -LRN + +Fri Sep 30 17:56:36 CEST 2011 + Fixed MHD_CONNECTION_OPTION_TIMEOUT for HTTPS (#1811). -CG + +Wed Sep 28 08:37:55 CEST 2011 + Releasing libmicrohttpd 0.9.15. -CG + +Tue Sep 27 13:07:36 CEST 2011 + Added ability to access URL arguments of the form 'url?foo' (without + '='). Added testcase and updated documentation accordingly. -CG + +Mon Sep 26 21:24:00 CEST 2011 + Only run response cleanup testcase if curl binary was found by + configure. -CG + +Wed Sep 21 09:53:18 CEST 2011 + Reverting to using pipes for signalling select on non-Linux + platforms where shutdown-on-listen-sockets does not work. -WB/CG + +Mon Sep 19 14:06:30 CEST 2011 + Fixing problem introduced with prompt response cleanup code. -CG + +Wed Sep 14 13:43:26 CEST 2011 + Fixing minor memory leak if daemon with HTTPS support failed to + initialize (#1766). -CG + +Tue Sep 13 09:47:58 CEST 2011 + Try to release responses more promptly upon connection termination. -CG + +Mon Sep 12 10:20:28 CEST 2011 + Releasing libmicrohttpd 0.9.14. -CG + +Mon Sep 12 10:05:36 CEST 2011 + Added new function to allow setting of a custom timeout value + for an individual connection (the MHD_set_connection_option is + more generic, but this is currently the only use). -CG + +Sat Sep 10 07:30:12 CEST 2011 + Documenting that MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT is not + implemented and will not be implemented, and what to use instead. -CG + +Fri Sep 9 13:42:20 CEST 2011 + Added testcase to demonstrate that response cleanup calling is + working. No bug was found. -CG + +Thu Aug 18 11:05:16 CEST 2011 + Fixed bug with wrong state transition if callback returned + MHD_CONTENT_READER_END_OF_STREAM causing spurious extra callbacks + to the handler (thanks to Jan Seeger for pointing it out). -CG/JS + +Thu Aug 11 11:40:03 CEST 2011 + Changing sockets to be non-blocking as suggested by Eivind Sarto + on the mailinglist. -CG + +Mon Jul 25 16:13:15 CEST 2011 + Added a logo. -CG + +Sat Jul 16 22:42:10 CEST 2011 + Change type of nonce to 'unsigned long int' to match return type + from 'strtoul'. Fixes ERANGE check which would have previously + failed. -CG + +Wed Jul 13 09:26:17 CEST 2011 + Fixing HTTP error status strings for certain high-numbered status codes. + Added support for some more (non-standard) status codes. + Releasing libmicrohttpd 0.9.13. -CG + +Thu Jul 7 10:24:20 CEST 2011 + Adding performance measurements. -CG + +Thu Jun 23 14:21:13 CEST 2011 + Releasing libmicrohttpd 0.9.12. -CG + +Wed Jun 22 14:32:23 CEST 2011 + Force closing connection if either the client asked it or + if the response contains 'Connection: close' (so far, + only the client's request was considered). -CG/RV + +Wed Jun 22 10:37:35 CEST 2011 + Removing listen socket from poll/select sets in + MHD_USE_THREAD_PER_CONNECTION mode; using 'shutdown' + on connection sockets to signal termination instead. -CG + +Wed Jun 22 10:25:13 CEST 2011 + Eliminate unnecessary (and badly synchronized) calls to + MHD_get_timeout in MHD_USE_THREAD_PER_CONNECTION mode. + Document that this is not acceptable. -CG + +Tue Jun 21 13:54:59 CEST 2011 + Fixing tiny memory leak in SSL code from 'gnutls_priority_init'. + Fixing data race between code doing connection shutdown and + connection cleanup. + Changing code to reduce connection cleanup cost from O(n) to O(1). + Cleaning up logging code around 'connection_close_error'. -CG + +Sat Jun 11 13:05:12 CEST 2011 + Replacing use of sscanf by strtoul (#1688). -CG/bplant + +Fri Jun 3 15:26:42 CEST 2011 + Adding MHD_CONNECTION_INFO_DAEMON to obtain MHD_Daemon + responsible for a given connection. -CG + +Wed May 25 14:23:20 CEST 2011 + Trying to fix stutter problem on timeout described by + David Myers on the mailinglist (5/10/2011). -CG + +Fri May 20 22:11:55 CEST 2011 + Fixed bug in testcase setup code causing crashes in + tls_session_timeout_test on some systems. + Releasing libmicrohttpd 0.9.11. -CG + +Fri May 20 19:34:59 CEST 2011 + Fixed bug in parsing multipart/form-data with post processor where + the code failed to add a 0-terminator in the correct position. -PP + +Thu May 12 14:40:46 CEST 2011 + Fixed bug where if multiple HTTP request messages are piped in at once, + microhttpd would call the handler with the wrong upload_data_size. -HZM + +Thu May 12 14:40:08 CEST 2011 + Documented possible issue with off_t being sometimes + 32-bit and sometimes 64-bit depending on #includes. -CG + +Sun May 8 21:52:47 CEST 2011 + Allow MHD_SIZE_UNKNOWN to be used in conjunction with + MHD_create_response_from_fd (fixing #1679). -TG + +Wed Apr 27 16:11:18 CEST 2011 + Releasing libmicrohttpd 0.9.10. -CG + +Fri Apr 8 11:40:35 CEST 2011 + Workaround for cygwin poll brokenness. -TS + +Sun Apr 3 13:56:52 CEST 2011 + Fixing compile error on OS X. -CG + +Wed Mar 30 12:56:09 CEST 2011 + Initialize tv_usec in MHD_USE_THREAD_PER_CONNECTION with select + and per-connection timeout. -CG + +Tue Mar 29 14:15:13 CEST 2011 + Releasing libmicrohttpd 0.9.9. -CG + +Tue Mar 29 14:11:19 CEST 2011 + Fixed call to mmap for memory pool, extended testcase to cover + POLL. -CG + +Wed Mar 23 23:24:25 CET 2011 + Do not use POLLIN when we only care about POLLHUP (significantly + improves performance when using MHD_USE_THREAD_PER_CONNECTION + in combination with MHD_USE_POLL). -ES + +Sun Mar 20 09:16:53 CET 2011 + Fixing race when using MHD_USE_THREAD_PER_CONNECTION in combination + with MHD_USE_POLL. -CG + +Fri Mar 18 13:23:47 CET 2011 + Removing MSG_DONTWAIT which should not be needed and was presumably + causing problems with EAGAIN under certain circumstances. -ES + +Fri Mar 11 22:25:29 CET 2011 + Fixing bug in MHD_create_response_from_fd_at_offset with non-zero offsets. -ES + +Sat Mar 5 22:00:36 CET 2011 + Do not use POLLRDHUP, which causes build errors on OS X / OpenSolaris + (#1667). -CG + +Fri Mar 4 10:24:04 CET 2011 + Added new API to allow MHD server to initiate connection to + client (special use-case for servers behind NAT), thereby + addressing #1661 (externally created connections). + Releasing libmicrohttpd 0.9.8. -CG + +Fri Mar 4 10:07:18 CET 2011 + Avoid using a pipe for signalling as well, just use server + socket shutdown (also for thread-per-connection). -CG + +Thu Mar 3 21:42:47 CET 2011 + Fixing issue where Base64 decode fails when char is defined + as unsigned char (Mantis 1666). -CG/tmayer + +Tue Mar 1 13:58:04 CET 2011 + Allow use of 'poll' in combination with the external select mode. + Avoid using pthread signals (SIGALRM), use pipe instead. + Corrected timeout calculation (s vs. ms). -CG + +Wed Feb 23 14:21:44 CET 2011 + Removing useless code pointed out by Eivind Sarto. -CG + +Fri Feb 18 11:03:59 CET 2011 + Handle large (>2 GB) file transfers with sendfile on 32-bit + systems better; handle odd sendfile failures by libc/kernel + by falling back to standard 'SEND'. -CG + +Sun Feb 13 10:52:29 CET 2011 + Handle gnutls receive error(s) for interrupted SSL + connections better. -MS + Releasing libmicrohttpd 0.9.7. -CG + +Fri Feb 11 10:15:38 CET 2011 + Fixing parameter ordering in documentation (#1659). -wellska + +Thu Jan 27 10:51:39 CET 2011 + Disable 'EXTRA_CHECKS's by default as suggested in #1652 + (I guess it is time). -CG/timn + +Thu Jan 27 10:48:55 CET 2011 + Removing bogus assertion in basic authentication code (#1651). -CG/timn + +Tue Jan 25 14:10:45 CET 2011 + Releasing libmicrohttpd 0.9.6. -CG + +Mon Jan 24 16:36:35 CET 2011 + Fixing compilation error if DAUTH_SUPPORT was 0 (#1646). -CG/bplant + +Tue Jan 18 23:58:09 CET 2011 + Fixing hash calculation in digest auth; old function had + collisions causing the browser to challenge users for + authentication too often. -CG/AW + +Fri Jan 14 19:19:45 CET 2011 + Removing dead code, adding missing new symbols to export list. + Fixed two missing NULL checks after malloc operations. -CG + +Mon Jan 10 14:07:33 CET 2011 + Releasing libmicrohttpd 0.9.5. -CG + +Wed Jan 5 15:20:11 CET 2011 + Fixing double-locking on non-Linux platforms when using + MHD_create_response_from_fd (#1639). -CG + Avoid use of strndup for better portability (#1636). -CG + +Tue Jan 4 13:07:21 CET 2011 + Added MHD_create_response_from_buffer, deprecating + MHD_create_response_from_data. Deprecating + MHD_create_response_from_fd as well. -CG + +Sun Dec 26 00:02:15 CET 2010 + Releasing libmicrohttpd 0.9.4. -CG + +Sat Dec 25 21:57:14 CET 2010 + Adding support for basic authentication. + Documented how to obtain client SSL certificates in tutorial. -MS + +Thu Dec 23 15:40:36 CET 2010 + Increasing nonce length to 128 to support digest authentication + with Opera (see #1633). + +Mon Dec 20 21:22:57 CET 2010 + Added macro MHD_LONG_LONG to allow change of MHD's "long long" use + to some other type on platforms that do not support "long long" + (Mantis #1631). -CG/bplant + +Sun Dec 19 19:54:15 CET 2010 + Added 'MHD_create_response_from_fd_at_offset'. -CG + +Sun Dec 19 15:16:16 CET 2010 + Fixing --enable and --disable configure options to behave properly. -CG + +Sun Dec 19 13:46:52 CET 2010 + Added option to specify size of stacks for threads created by MHD. -CG + +Tue Nov 23 09:41:00 CET 2010 + Releasing libmicrohttpd 0.9.3. -CG + +Thu Nov 18 23:10:36 CET 2010 + Fixing #1619 (testcases not working with NSS on Fedora). -CG/timn + +Thu Nov 18 22:55:58 CET 2010 + Fixing #1621 (socket not closed under certain circumstances). -CG/jaredc + +Wed Nov 17 12:16:53 CET 2010 + Allowing signalling of errors in generating chunked responses to + clients (by closing connectins) using the new + MHD_CONTENT_READER_END_WITH_ERROR ((size_t)-2) return value. Also + introducing MHD_CONTENT_READER_END_OF_STREAM constant instead + of (size_t) -1 / SIZE_MAX. + +Sun Nov 14 20:45:45 CET 2010 + Adding API call to generate HTTP footers in response. -CG + +Sat Oct 16 12:38:43 CEST 2010 + Releasing libmicrohttpd 0.9.2. -CG + +Tue Oct 12 15:41:51 CEST 2010 + Fixed issue with data received via SSL being delayed in the + GNUtls buffer if sender stopped transmitting (but did not close + the connection) and MHD buffer size was smaller than last fragment, + resulting in possibly significantly delayed processing of + incoming data. -CG + +Wed Sep 22 09:48:59 CEST 2010 + Changed port argument from 'unsigned short' to 'uint16_t'. + Removed dead code when compiling with messages enabled. + Minimal unrelated code cleanup. -CG + +Tue Sep 21 15:12:41 CEST 2010 + Use "size_t" for buffer size instead of "int". -CG + +Sat Sep 18 07:16:30 CEST 2010 + Adding support for SHOUTcast. -CG + +Wed Sep 15 09:33:46 CEST 2010 + Fixed double-free. -CG/ES + +Fri Sep 10 14:47:11 CEST 2010 + Releasing libmicrohttpd 0.9.1. -CG + +Fri Sep 10 14:29:37 CEST 2010 + Adding proper nonce counter checking for digest authentication. -CG/AA + +Sat Sep 4 21:55:52 CEST 2010 + Digest authentication now seems to be working. -CG/AA + +Wed Sep 1 13:59:16 CEST 2010 + Added ability to specify external unescape function. + "microhttpd.h" now includes the right headers for GNU/Linux + systems unless MHD_PLATFORM_H is defined (in which case it + is assumed that the right headers were already determined by + some configure-like process). -CG + +Tue Aug 31 15:39:25 CEST 2010 + Fixed bug with missing call to response cleanup in case of + connection handling error (for example, after getting a SIGPIPE). -CG + +Tue Aug 24 11:39:25 CEST 2010 + Fixed bug in handling EAGAIN from GnuTLS (caused + needlessly dropped SSL connections). -CG + +Sun Aug 22 16:49:13 CEST 2010 + Initial draft for digest authentication. -AA + +Thu Aug 19 14:15:01 CEST 2010 + Changed code to enable error messages and HTTPS by default; + added option to disable post processor API (use + breaks binary compatibility, should only be done + for embedded systems that require minimal footprint). -CG + +Thu Aug 19 13:26:00 CEST 2010 + Patches for Windows to ease compilation trouble. -GT/CG + +Sat Aug 14 15:43:30 CEST 2010 + Fixed small, largely hypothetical leaks. + Reduced calls to strlen for header processing. -CG + +Fri Aug 6 12:51:59 CEST 2010 + Fixing (small) memory leak on daemon-shutdown with + SSL enabled. -CG/PG + +Thu Aug 5 22:24:37 CEST 2010 + Fixing timeout bug on systems that think it's still + 1970 (can happen if system time not initialized). -CG + +Mon Jul 26 10:46:57 CEST 2010 + Releasing libmicrohttpd 0.9.0. -CG + +Sun Jul 25 14:57:47 CEST 2010 + Adding support for sendfile on Linux. Adding support + for systemd-style passing of an existing listen socket + as an option. IPv6 sockets now only bind to IPv6 + (if platform supports this). -CG + +Sun Jul 25 11:10:45 CEST 2010 + Changed code to use external libgnutls code instead of + the "fork". Minor API changes for setting TLS options. -CG + +Sun Jun 13 10:52:34 CEST 2010 + Cleaned up example code. -CG + +Fri Apr 23 09:56:37 CEST 2010 + Do not return HTTP headers for requests without version + numbers. Do return HTTP version 1.0 if client requested + HTTP version 1.1 (previously, we returned HTTP/1.1 even + if the client specified HTTP/1.0). -GM/CG + +Sat Mar 13 09:41:01 CET 2010 + Releasing libmicrohttpd 0.4.6. -CG + +Wed Mar 10 13:18:26 CET 2010 + Fixing bug in 100 CONTINUE replacement when handling POSTs + (see report on mailinglist), with testcase. -CG/MC + +Tue Feb 23 09:16:15 CET 2010 + Added configure check for endianness to define WORDS_BIGENDIAN + which fixes SSL support on big endian architectures. -JA/CG + +Sat Feb 20 10:01:09 CET 2010 + Added check for inconsistent options (MHD_OPTION_PROTOCOL_VERSION + without MHD_USE_SSL) causing instant segfault. -JA/CG + +Tue Feb 9 20:31:51 CET 2010 + Fixed issue with poll doing busy waiting. -BK/CG + +Thu Jan 28 21:28:56 CET 2010 + Releasing libmicrohttpd 0.4.5. -CG + +Thu Jan 28 20:35:48 CET 2010 + Make sure addresses returned by memory pool are + aligned (fixes bus errors on Sparc). -CG + +Thu Dec 17 20:26:52 CET 2009 + poll.h is not stricly required anymore. -ND + +Fri Dec 4 13:17:50 CET 2009 + Adding MHD_OPTION_ARRAY. -CG + +Mon Nov 16 14:41:26 CET 2009 + Fixed busy-loop in internal select mode for inactive + clients with infinite connection timeout. -CG + +Thu Nov 12 16:19:14 CET 2009 + Adding support for setting a custom error handler for + fatal errors (previously, the implementation always + called 'abort' in these cases). -CG/ND + +Wed Nov 11 12:54:16 CET 2009 + Adding support for poll (alternative to select allowing + for more than FD_SETSIZE parallel connections). -JM + +Wed Oct 28 20:26:00 CET 2009 + Releasing libmicrohttpd 0.4.4. -CG + +Wed Oct 14 14:37:37 CEST 2009 + Fixing (rare) deadlock due to SELECT missing SIGALRM by + making all SELECT calls block for at most 1s. While this + can in (rare) situations delay the shutdown by 1s, I think + this is preferable (both performance and possibly portability-wise) + over using a pipe for the signal. -CG + +Sun Oct 11 14:57:29 CEST 2009 + Adding eCos license as an additional license for the + non-HTTPS code of MHD. -CG + +Sun Oct 11 11:24:27 CEST 2009 + Adding support for Symbian. -MR + +Fri Oct 9 15:21:29 CEST 2009 + Check for error codes from pthread operations (to help with + error diagnostics) and abort if something went wrong. -CG + +Thu Oct 8 10:43:02 CEST 2009 + Added check for sockets being '< FD_SETSIZE' (just to be safe). -CG + +Mon Oct 5 21:17:26 CEST 2009 + Adding "COOKIE" header string #defines. -CG + +Mon Oct 5 08:29:06 CEST 2009 + Documenting default values. -CG + +Fri Aug 28 22:56:47 CEST 2009 + Releasing libmicrohttpd 0.4.3. -CG + +Sun Aug 23 16:21:35 UTC 2009 + Allow MHD_get_daemon_info to return the daemon's listen socket. + Includes a test case that uses this functionality to bind a server to + an OS-assigned port, look the port up with getsockname, and curl it. -DR + +Tue Aug 4 00:14:04 CEST 2009 + Fixing double-call to read from content-reader callback for first + data segment (as reported by Alex on the mailinglist). -CG + +Thu Jul 29 21:41:52 CEST 2009 + Fixed issue with the code not using the "block_size" argument + given to MHD_create_response_from_callback causing inefficiencies + for values < 2048 and segmentation faults for values > 2048 + (as reported by Andre Colomb on the mailinglist). -CG + +Sun May 17 03:29:46 MDT 2009 + Releasing libmicrohttpd 0.4.2. -CG + +Fri May 15 11:00:20 MDT 2009 + Grow reserved read buffer more aggressively so that we are not + needlessly stuck reading only a handfull of bytes in each iteration. -CG + +Thu May 14 21:20:30 MDT 2009 + Fixed issue where the "NOTIFY_COMPLETED" handler could be called + twice (if a socket error or timeout occured for a pipelined + connection after successfully completing a request and before + the next request was successfully transmitted). This could + confuse applications not expecting to see a connection "complete" + that they were never aware of in the first place. -CG + +Mon May 11 13:01:16 MDT 2009 + Fixed issue where error code on timeout was "TERMINATED_WITH_ERROR" + instead of "TERMINATED_TIMEOUT_REACHED". -CG + +Wed Apr 1 21:33:05 CEST 2009 + Added MHD_get_version(). -ND + +Wed Mar 18 22:59:07 MDT 2009 + Releasing libmicrohttpd 0.4.1. -CG + +Wed Mar 18 17:46:58 MDT 2009 + Always RECV/SEND with MSG_DONTWAIT to (possibly) address + strange deadlock reported by Erik on the mailinglist --- + and/or issues with blocking read after select on GNU/Linux + (see select man page under bugs). -CG + +Tue Mar 17 01:19:50 MDT 2009 + Added support for thread-pools. -CG/RA + +Mon Mar 2 23:44:08 MST 2009 + Fixed problem with 64-bit upload and download sizes and + "-1" being used to indicate "unknown" by introducing + new 64-bit constant "MHD_SIZE_UNKNOWN". -CG/DC + +Wed Feb 18 08:13:56 MST 2009 + Added missing #include for build on arm-linux-uclibc. -CG/CC + +Mon Feb 16 21:12:21 MST 2009 + Moved MHD_get_connection_info so that it is always defined, + even if HTTPS support is not enabled. -CG + +Sun Feb 8 21:15:30 MST 2009 + Releasing libmicrohttpd 0.4.0. -CG + +Thu Feb 5 22:43:45 MST 2009 + Incompatible API change to allow 64-bit uploads and downloads. + Clients must use "uint64_t" for the "pos" + argument (MHD_ContentReaderCallback) and the "off" + argument (MHD_PostDataIterator) and the "size" + argument (MHD_create_response_from_callback) now. + Also, "unsigned int" was changed to "size_t" for + the "upload_data_size" argument (MHD_AccessHandlerCallback), + the argument to MHD_OPTION_CONNECTION_MEMORY_LIMIT, + the "block_size" argument (MHD_create_response_from_callback), + the "buffer_size" argument (MHD_create_post_processor) and + the "post_data_len" argument (MHD_post_process). You may + need to #include before from now on. -CG + +Thu Feb 5 20:21:08 MST 2009 + Allow getting address information about the connecting + client after the accept call. -CG + +Mon Feb 2 22:21:48 MST 2009 + Fixed missing size adjustment for offsets for %-encoded + arguments processed by the post processor (Mantis #1447). -CG/SN + +Fri Jan 23 16:57:21 MST 2009 + Support charset specification (ignore) after content-type + when post-processing HTTP POST requests (Mantis #1443). -CG/SN + +Fri Dec 26 23:08:04 MST 2008 + Fixed broken check for identical connection address. -CG + Making cookie parser more RFC2109 compliant (handle + spaces around key, allow value to be optional). -CG + +Sat Dec 6 18:36:17 MST 2008 + Added configure option to disable checking for CURL support. + Added MHD_OPTION to allow specification of custom logger. -CG + +Tue Nov 18 01:19:53 MST 2008 + Removed support for untested and/or broken SSL features + and (largely useless) options. -CG + +Sun Nov 16 16:54:54 MST 2008 + Added option to get unparsed URI via callback. + Releasing GNU libmicrohttpd 0.4.0pre1. -CG + +Sun Nov 16 02:48:14 MST 2008 + Removed tons of dead code. -CG + +Sat Nov 15 17:34:24 MST 2008 + Added build support for code coverage analysis. -CG + +Sat Nov 15 00:31:33 MST 2008 + Removing (broken) support for HTTPS servers with + anonymous (aka "no") certificates as well as + various useless dead code. -CG + +Sat Nov 8 02:18:42 MST 2008 + Unset TCP_CORK at the end of transmitting a response + to improve performance (on systems where this is + supported). -MM + +Tue Sep 30 16:48:08 MDT 2008 + Make MHD useful to Cygwin users; detect IPv6 headers + in configure. + +Sun Sep 28 14:57:46 MDT 2008 + Unescape URIs (convert "%ef%e4%45" to "$BCf9q(B"). -CG + +Wed Sep 10 22:43:59 MDT 2008 + Releasing GNU libmicrohttpd 0.4.0pre0. -CG + +Wed Sep 10 21:36:06 MDT 2008 + Fixed data race on closing sockets during + shutdown (in one-thread-per-connection mode). -CG + +Thu Sep 4 23:37:18 MDT 2008 + Fixed some boundary issues with processing + chunked requests; removed memmove from a + number of spots, in favor of using an index into + the current buffer instead. -GS + +Sun Aug 24 13:05:41 MDT 2008 + Now handling clients returning 0 from response callback + as specified in the documentation (abort if internal + select is used, retry immediately if a thread per + connection is used). -CG + +Sun Aug 24 12:44:43 MDT 2008 + Added missing reason phrase. -SG + +Sun Aug 24 10:33:22 MDT 2008 + Fixed bug where MHD failed to transmit the response when + the client decided not to send "100 CONTINUE" during + a PUT/POST request. -CG + +Wed Jul 16 18:54:03 MDT 2008 + Fixed bug generating chunked responses with chunk sizes + greater than 0xFFFFFF (would cause protocol violations). -CG + +Mon May 26 13:28:57 MDT 2008 + Updated and improved documentation. + Releasing GNU libmicrohttpd 0.3.1. -CG + +Fri May 23 16:54:41 MDT 2008 + Fixed issue with postprocessor not handling URI-encoded + values of more than 1024 bytes correctly. -CG + +Mon May 5 09:18:29 MDT 2008 + Fixed date header (was off by 1900 years). -JP + +Sun Apr 13 01:06:20 MDT 2008 + Releasing GNU libmicrohttpd 0.3.0. -CG + +Sat Apr 12 21:34:26 MDT 2008 + Generate an internal server error if the programmer fails + to handle upload data correctly. Tweaked testcases to + avoid running into the problem in the testcases. + Completed zzuf-based fuzzing testcases. -CG + +Sat Apr 12 15:14:05 MDT 2008 + Restructured the code (curl-testcases and zzuf testcases + are now in different directories; code examples are in + src/examples/). + Fixed a problem (introduced in 0.2.3) with handling very + large requests (the code did not return proper error code). + If "--enable-messages" is specified, the code now includes + reasonable default HTML webpages for various build-in + errors (such as request too large and malformed requests). + Without that flag, the webpages returned will still be + empty. + Started to add zzuf-based fuzzing-testcases (these require + the zzuf and socat binaries to be installed). -CG + +Fri Apr 11 20:20:34 MDT 2008 + I hereby dub libmicrohttpd a GNU package. -Richard Stallman + +Sat Mar 29 22:36:09 MDT 2008 + Fixed bugs in handling of malformed HTTP requests + (causing either NULL dereferences or connections to + persist until time-out, if any). -CG + + Updated and integrated TexInfo documentation. -CG + +Tue Mar 25 13:40:53 MDT 2008 + Prevent multi-part post-processor from going to error + state when the input buffer is full and current token + just changes processor state without consuming any data. + Also, the original implementation would not consume any + input in process_value_to_boundary if there is no new + line character in sight. -AS + + Remove checks for request method after it finished writing + response footers as it's only _pipelined_ requests that + should not be allowed after POST or PUT requests. Reusing + the existing connection is perfectly ok though. And there + is no reliable way to detect pipelining on server side + anyway so it is the client's responsibility to not send new + data before it gets a response after a POST operation. -AS + + Clarified license in man page. Releasing + libmicrohttpd 0.2.3 -CG + +Sat Mar 22 01:12:38 MDT 2008 + Releasing libmicrohttpd 0.2.2. -CG + +Mon Feb 25 19:13:53 MST 2008 + Fixed a problem with sockets closed for reading ending up + in the read set under certain circumstances. -CG + +Wed Jan 30 23:15:44 MST 2008 + Added support for nested multiparts to post processor. + Made sure that MHD does not allow pipelining for methods + other than HEAD and GET (and of course still also only + allows it for http 1.1). Releasing libmicrohttpd 0.2.1. -CG + +Mon Jan 21 11:59:46 MST 2008 + Added option to limit number of concurrent connections + accepted from the same IP address. -CG + +Fri Jan 4 16:02:08 MST 2008 + Fix to properly close connection if application signals + problem handling the request. - AS + +Wed Jan 2 16:41:05 MST 2008 + Improvements and bugfixes to post processor implementation. - AS + +Wed Dec 19 21:12:04 MST 2007 + Implemented chunked (HTTP 1.1) downloads (including + sending of HTTP footers). Also allowed queuing of + a response early to suppress the otherwise automatic + "100 CONTINUE" response. Removed the mostly useless + "(un)register handler" methods from the API. Changed + the internal implementation to use a finite state + machine (cleaner code, slightly less memory consumption). + Releasing libmicrohttpd 0.2.0. - CG + +Sun Dec 16 03:24:13 MST 2007 + Implemented handling of chunked (HTTP 1.1) uploads. + Note that the upload callback must be able to + process chunks in the size uploaded by the client, + MHD will not "join" small chunks into a big + contiguous block of memory (even if buffer space + would be available). - CG + +Wed Dec 5 21:39:35 MST 2007 + Fixed race in multi-threaded server mode. + Fixed handling of POST data when receiving a + "Connection: close" header (#1296). + Releasing libmicrohttpd 0.1.2. - CG + +Sat Nov 17 00:55:24 MST 2007 + Fixed off-by-one in error message string matching. + Added code to avoid generating SIGPIPE on platforms + where this is possible (everywhere else, the main + application should install a handler for SIGPIPE). + +Thu Oct 11 11:02:06 MDT 2007 + Releasing libmicrohttpd 0.1.1. - CG + +Thu Oct 11 10:09:12 MDT 2007 + Fixing response to include HTTP status message. - EG + +Thu Sep 27 10:19:46 MDT 2007 + Fixing parsing of "%xx" in URLs with GET arguments. - eglaysher + +Sun Sep 9 14:32:23 MDT 2007 + Added option to compile debug/warning messages; + error messages are now disabled by default. + Modified linker option for GNU LD to not export + non-public symbols (further reduces binary size). + Releasing libmicrohttpd 0.1.0. - CG + +Sat Sep 8 21:54:04 MDT 2007 + Extended API to allow for incremental POST + processing. The new API is binary-compatible + as long as the app does not handle POSTs, but + since that maybe the case, we're strictly speaking + breaking backwards compatibility (since url-encoded + POST data is no longer obtained the same way). - CG + +Thu Aug 30 00:59:24 MDT 2007 + Improving API to allow clients to associate state + with a connection and to be notified about request + termination (this is a binary-compatible change). - CG + Fixed compile errors under OS X. - HL + +Sun Aug 26 03:11:46 MDT 2007 + Added MHD_USE_PEDANTIC_CHECKS option which enforces + receiving a "Host:" header in HTTP 1.1 (and sends a + HTTP 400 status back if this is violated). - CG + +Tue Aug 21 01:01:46 MDT 2007 + Fixing assertion failure that occured when a client + closed the connection after sending some data but + not the full headers. - CG + +Sat Aug 18 03:06:09 MDT 2007 + Check for out of memory when adding headers to + responses. Check for NULL key when looking + for headers. If a content reader callback + for a response returns zero (has no data yet), + do not possibly fall into busy waiting when + using external select (with internal selects + we have no choice). - CG + +Wed Aug 15 01:46:44 MDT 2007 + Extending API to allow timeout of connections. + Changed API (MHD_create_response_from_callback) to + allow user to specify IO buffer size. + Improved error handling. + Released libmicrohttpd 0.0.3. - CG + +Tue Aug 14 19:45:49 MDT 2007 + Changed license to LGPL (with consent from all contributors). + Released libmicrohttpd 0.0.2. - CG + +Sun Aug 12 00:09:26 MDT 2007 + Released libmicrohttpd 0.0.1. - CG + +Fri Aug 10 17:31:23 MDT 2007 + Fixed problems with handling of responses created from + callbacks. Allowing accept policy callback to be NULL + (to accept from all). Added minimal fileserver example. + Only send 100 continue header when specifically requested. - CG + +Wed Aug 8 01:46:06 MDT 2007 + Added pool allocation and connection limitations (total + number and memory size). Released libmicrohttpd 0.0.0. - CG + +Tue Jan 9 20:52:48 MST 2007 + Created project build files and updated API. - CG diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..8865734 --- /dev/null +++ b/INSTALL @@ -0,0 +1,368 @@ +Installation Instructions +************************* + + Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software +Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell command './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. Some packages provide this +'INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + 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, generally using the just-built uninstalled binaries. + + 4. Type 'make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the 'make install' phase executed with root + privileges. + + 5. Optionally, type 'make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior 'make install' required + root privileges, verifies that the installation completed + correctly. + + 6. 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. + + 7. Often, you can also type 'make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide 'make + distcheck', which can by used by developers to test that all other + targets like 'make install' and 'make uninstall' work correctly. + This target is generally not run by end users. + +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 '..'. This is known +as a "VPATH" build. + + 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. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple '-arch' options to the +compiler but only a single '-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the 'lipo' tool if you have problems. + +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', where PREFIX must be an +absolute file name. + + 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. In general, the default +for these options is expressed in terms of '${prefix}', so that +specifying just '--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to 'configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +'make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, 'make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +'${prefix}'. Any directories that were specified during 'configure', +but not in terms of '${prefix}', must each be overridden at install time +for the entire installation to be relocated. The approach of makefile +variable overrides for each directory variable is required by the GNU +Coding Standards, and ideally causes no recompilation. However, some +platforms have known limitations with the semantics of shared libraries +that end up requiring recompilation when using this method, particularly +noticeable in packages that use GNU Libtool. + + The second method involves providing the 'DESTDIR' variable. For +example, 'make install DESTDIR=/alternate/directory' will prepend +'/alternate/directory' before all installation names. The approach of +'DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of '${prefix}' +at 'configure' time. + +Optional Features +================= + + 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'. + + 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. + + Some packages offer the ability to configure how verbose the +execution of 'make' will be. For these packages, running './configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with 'make V=1'; while running './configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with 'make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC +is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX 'make' updates targets which have the same time stamps as their +prerequisites, which makes it generally unusable when shipped generated +files such as 'configure' are involved. Use GNU 'make' instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its '' header file. The option '-nodtk' can be used as a +workaround. If GNU CC is not installed, it is therefore recommended to +try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put '/usr/ucb' early in your 'PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in '/usr/bin'. So, if you need '/usr/ucb' +in your 'PATH', put it _after_ '/usr/bin'. + + On Haiku, software installed for all users goes in '/boot/common', +not '/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +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 limitation. Until the limitation is lifted, you can use this +workaround: + + CONFIG_SHELL=/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 all of the options to 'configure', and exit. + +'--help=short' +'--help=recursive' + Print a summary of the options unique to this package's + 'configure', and exit. The 'short' variant lists options used only + in the top level, while the 'recursive' variant lists options also + present in any nested packages. + +'--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. + +'--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: for + more details, including other options available for fine-tuning the + installation locations. + +'--no-create' +'-n' + Run the configure checks, but stop before creating any output + files. + +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff --git a/MHD_config.h.in b/MHD_config.h.in new file mode 100644 index 0000000..e221742 --- /dev/null +++ b/MHD_config.h.in @@ -0,0 +1,592 @@ +/* MHD_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Define to 1 if libmicrohttpd is compiled with basic Auth support. */ +#undef BAUTH_SUPPORT + +/* This is a Cygwin system */ +#undef CYGWIN + +/* Define to 1 if libmicrohttpd is compiled with digest Auth support. */ +#undef DAUTH_SUPPORT + +/* Define to 1 to enable epoll support */ +#undef EPOLL_SUPPORT + +/* This is a FreeBSD system */ +#undef FREEBSD + +/* Define to `1' if host machine runs on GNU Hurd. */ +#undef GNU_HURD + +/* Define to 1 if you have the `accept4' function. */ +#undef HAVE_ACCEPT4 + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define if you have usable assert() and assert.h */ +#undef HAVE_ASSERT + +/* Define to 1 if you have the `gmtime_s' function in C11 form. */ +#undef HAVE_C11_GMTIME_S + +/* Define to 1 if you have the usable `calloc' function. */ +#undef HAVE_CALLOC + +/* Have clock_gettime */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 if you have `clock_get_time', `host_get_clock_service' and + `mach_port_deallocate' functions. */ +#undef HAVE_CLOCK_GET_TIME + +/* Define to 1 if you have Darwin-style sendfile(2). */ +#undef HAVE_DARWIN_SENDFILE + +/* Define to 1 if you have the declaration of `getsockname', and to 0 if you + don't. */ +#undef HAVE_DECL_GETSOCKNAME + +/* Define to 1 if you have the declaration of `SOCK_NONBLOCK', and to 0 if you + don't. */ +#undef HAVE_DECL_SOCK_NONBLOCK + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* Define if you have epoll_create1 function. */ +#undef HAVE_EPOLL_CREATE1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the usable `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have FreeBSD-style sendfile(2). */ +#undef HAVE_FREEBSD_SENDFILE + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#undef HAVE_FSEEKO + +/* Define to 1 if you have the header file. */ +#undef HAVE_GCRYPT_H + +/* Define to 1 if you have `gethrtime' function. */ +#undef HAVE_GETHRTIME + +/* Define to 1 if you have the `getsockname' function. */ +#undef HAVE_GETSOCKNAME + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the `gmtime_r' function. */ +#undef HAVE_GMTIME_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_GNUTLS_GNUTLS_H + +/* Provides IPv6 headers */ +#undef HAVE_INET6 + +/* Define to 1 if you have the header file. */ +#undef HAVE_INETLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have a functional curl library. */ +#undef HAVE_LIBCURL + +/* Define to 1 if you have suitable libmagic. */ +#undef HAVE_LIBMAGIC + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have linux-style sendfile(2). */ +#undef HAVE_LINUX_SENDFILE + +/* can use shutdown on listen sockets */ +#undef HAVE_LISTEN_SHUTDOWN + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the `lseek64' function. */ +#undef HAVE_LSEEK64 + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MATH_H + +/* Define to 1 if you have the `memmem' function. */ +#undef HAVE_MEMMEM + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 to enable support for error messages. */ +#undef HAVE_MESSAGES + +/* Define to 1 if you have the `[nanosleep]' function. */ +#undef HAVE_NANOSLEEP + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_TCP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define if you have usable pipe2(2) function */ +#undef HAVE_PIPE2_FUNC + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if libmicrohttpd is compiled with postprocessor support. */ +#undef HAVE_POSTPROCESSOR + +/* Define to 1 if you have the `pread' function. */ +#undef HAVE_PREAD + +/* Define to 1 if you have the `pread64' function. */ +#undef HAVE_PREAD64 + +/* Define if you have IBM i form of pthread_attr_setname_np(3) function. */ +#undef HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI + +/* Define if you have NetBSD form (or OSF1 form) of pthread_attr_setname_np(3) + function. */ +#undef HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_NP_H + +/* Have PTHREAD_PRIO_INHERIT. */ +#undef HAVE_PTHREAD_PRIO_INHERIT + +/* Define if you have Darwin form of pthread_setname_np(3) function. */ +#undef HAVE_PTHREAD_SETNAME_NP_DARWIN + +/* Define if you have GNU/Linux form of pthread_setname_np(3) function. */ +#undef HAVE_PTHREAD_SETNAME_NP_GNU + +/* Define if you have NetBSD form (or OSF1 form) of pthread_setname_np(3) + function. */ +#undef HAVE_PTHREAD_SETNAME_NP_NETBSD + +/* Define if you have FreeBSD form of pthread_set_name_np(3) function. */ +#undef HAVE_PTHREAD_SET_NAME_NP_FREEBSD + +/* Define to 1 if you have the `rand' function. */ +#undef HAVE_RAND + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if you have the real boolean type. */ +#undef HAVE_REAL_BOOL + +/* Define to 1 if you have the header file and your system have + properly functioning tsearch(), tfind() and tdelete() functions */ +#undef HAVE_SEARCH_H + +/* Define to 1 if you have the `sendfile64' function. */ +#undef HAVE_SENDFILE64 + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Do we have sockaddr_in.sin_len? */ +#undef HAVE_SOCKADDR_IN_SIN_LEN + +/* Define to 1 if you have the header file. */ +#undef HAVE_SOCKLIB_H + +/* SOCK_NONBLOCK is defined in a socket header */ +#undef HAVE_SOCK_NONBLOCK + +/* Define to 1 if you have Solaris-style sendfile(3). */ +#undef HAVE_SOLARIS_SENDFILE + +/* Define to 1 if you have the header file and defines + 'bool' type. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BYTEORDER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENTFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ISA_DEFS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MACHINE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MSG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the `tsearch' function. */ +#undef HAVE_TSEARCH + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `usleep' function. */ +#undef HAVE_USLEEP + +/* Define to 1 if you have the `gmtime_s' function in W32 form. */ +#undef HAVE_W32_GMTIME_S + +/* Define to 1 if you have the usable `waitpid' function. */ +#undef HAVE_WAITPID + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to 1 if libmicrohttpd is compiled with HTTPS support. */ +#undef HTTPS_SUPPORT + +/* Define to 1 if your C compiler supports inline functions. */ +#undef INLINE_FUNC + +/* Defined if libcurl supports AsynchDNS */ +#undef LIBCURL_FEATURE_ASYNCHDNS + +/* Defined if libcurl supports IDN */ +#undef LIBCURL_FEATURE_IDN + +/* Defined if libcurl supports IPv6 */ +#undef LIBCURL_FEATURE_IPV6 + +/* Defined if libcurl supports KRB4 */ +#undef LIBCURL_FEATURE_KRB4 + +/* Defined if libcurl supports libz */ +#undef LIBCURL_FEATURE_LIBZ + +/* Defined if libcurl supports NTLM */ +#undef LIBCURL_FEATURE_NTLM + +/* Defined if libcurl supports SSL */ +#undef LIBCURL_FEATURE_SSL + +/* Defined if libcurl supports SSPI */ +#undef LIBCURL_FEATURE_SSPI + +/* Defined if libcurl supports DICT */ +#undef LIBCURL_PROTOCOL_DICT + +/* Defined if libcurl supports FILE */ +#undef LIBCURL_PROTOCOL_FILE + +/* Defined if libcurl supports FTP */ +#undef LIBCURL_PROTOCOL_FTP + +/* Defined if libcurl supports FTPS */ +#undef LIBCURL_PROTOCOL_FTPS + +/* Defined if libcurl supports HTTP */ +#undef LIBCURL_PROTOCOL_HTTP + +/* Defined if libcurl supports HTTPS */ +#undef LIBCURL_PROTOCOL_HTTPS + +/* Defined if libcurl supports IMAP */ +#undef LIBCURL_PROTOCOL_IMAP + +/* Defined if libcurl supports LDAP */ +#undef LIBCURL_PROTOCOL_LDAP + +/* Defined if libcurl supports POP3 */ +#undef LIBCURL_PROTOCOL_POP3 + +/* Defined if libcurl supports RTSP */ +#undef LIBCURL_PROTOCOL_RTSP + +/* Defined if libcurl supports SMTP */ +#undef LIBCURL_PROTOCOL_SMTP + +/* Defined if libcurl supports TELNET */ +#undef LIBCURL_PROTOCOL_TELNET + +/* Defined if libcurl supports TFTP */ +#undef LIBCURL_PROTOCOL_TFTP + +/* This is a Linux kernel */ +#undef LINUX + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* Define to `1' if HTTPS require initialisation of libgcrypt */ +#undef MHD_HTTPS_REQUIRE_GRYPT + +/* Define to 1 to disable setting name on generated threads */ +#undef MHD_NO_THREAD_NAMES + +/* gnuTLS lib version - used in conjunction with cURL */ +#undef MHD_REQ_CURL_GNUTLS_VERSION + +/* NSS lib version - used in conjunction with cURL */ +#undef MHD_REQ_CURL_NSS_VERSION + +/* required cURL SSL version to run tests */ +#undef MHD_REQ_CURL_OPENSSL_VERSION + +/* required cURL version to run tests */ +#undef MHD_REQ_CURL_VERSION + +/* Define if you have usable `getsockname' function. */ +#undef MHD_USE_GETSOCKNAME + +/* define to use pthreads */ +#undef MHD_USE_POSIX_THREADS + +/* define to use W32 threads */ +#undef MHD_USE_W32_THREADS + +/* This is a MinGW system */ +#undef MINGW + +/* Define to disable usage of debug asserts. */ +#undef NDEBUG + +/* This is a NetBSD system */ +#undef NETBSD + +/* This is an OpenBSD system */ +#undef OPENBSD + +/* This is a OS/390 system */ +#undef OS390 + +/* This is an OS X system */ +#undef OSX + +/* Some strange OS */ +#undef OTHEROS + +/* 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 home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +#undef PTHREAD_CREATE_JOINABLE + +/* This is a Solaris system */ +#undef SOLARIS + +/* This is a BSD system */ +#undef SOMEBSD + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if libmicrohttpd is compiled with HTTP Upgrade support. */ +#undef UPGRADE_SUPPORT + +/* Version number of package */ +#undef VERSION + +/* This is a Windows system */ +#undef WINDOWS + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _ALL_SOURCE + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _BSD_SOURCE + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _DARWIN_C_SOURCE + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Define to use debug asserts. */ +#undef _DEBUG + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define to 1 to enable GNU-related header features */ +#undef _GNU_SOURCE + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +#undef _LARGEFILE_SOURCE + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* defines how to decorate public symbols while building */ +#undef _MHD_EXTERN + +/* Define to use eventFD for inter-thread communication */ +#undef _MHD_ITC_EVENTFD + +/* Define to use pipe for inter-thread communication */ +#undef _MHD_ITC_PIPE + +/* Define to use socketpair for inter-thread communication */ +#undef _MHD_ITC_SOCKETPAIR + +/* Define to prefix which will be used with MHD static inline functions. */ +#undef _MHD_static_inline + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _NETBSD_SOURCE + +/* Need with solaris or errno doesnt work */ +#undef _REENTRANT + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef _TANDEM_SOURCE + +/* Define to maximum value supported by system headers */ +#undef _XOPEN_SOURCE + +/* Define to 1 if _XOPEN_SOURCE is defined to value less than 500 and system + headers requre this symbol */ +#undef _XOPEN_SOURCE_EXTENDED + +/* Define to maximum value supported by system headers if _XOPEN_SOURCE is + defined to value less than 500 and headers do not support + _XOPEN_SOURCE_EXTENDED */ +#undef _XOPEN_VERSION + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef __BSD_VISIBLE + +/* Define to 1 if it is required by headers to expose additional symbols */ +#undef __EXTENSIONS__ + +/* Define to type name which will be used as boolean type. */ +#undef bool + +/* Define curl_free() as free() if our version of curl lacks curl_free. */ +#undef curl_free + +/* Define to value interpreted by compiler as boolean "false", if "false" is + not defined by system headers. */ +#undef false + +/* Define to value interpreted by compiler as boolean "true", if "true" is not + defined by system headers. */ +#undef true diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..b67b3cb --- /dev/null +++ b/Makefile.am @@ -0,0 +1,113 @@ +# This Makefile.am is in the public domain +ACLOCAL_AMFLAGS = -I m4 +SUBDIRS = contrib m4 src . +DIST_SUBDIRS = $(SUBDIRS) po +EXTRA_PO_DIST = po/ABOUT-NLS $(top_srcdir)/po/configure.ac po/configure +W32COMMON = w32/common/gen_dll_res.ps1 w32/common/microhttpd_dll_res_vc.rc.in w32/common/microhttpd_dll_res_vc.rc \ + w32/common/MHD_config.h w32/common/vs_dirs.props w32/common/common-build-settings.vcxproj \ + w32/common/libmicrohttpd-build-settings.vcxproj w32/common/libmicrohttpd-files.vcxproj w32/common/libmicrohttpd-filters.vcxproj \ + w32/common/hellobrowser-files.vcxproj w32/common/hellobrowser-filters.vcxproj \ + w32/common/apps-build-settings.vcxproj +W32VS2013 = w32/VS2013/libmicrohttpd.vcxproj w32/VS2013/libmicrohttpd.vcxproj.filters \ + w32/VS2013/hellobrowser.vcxproj w32/VS2013/hellobrowser.vcxproj.filters \ + w32/VS2013/simplepost.vcxproj w32/VS2013/largepost.vcxproj \ + w32/VS2013/libmicrohttpd.sln +W32VS2015 = w32/VS2015/libmicrohttpd.vcxproj w32/VS2015/libmicrohttpd.vcxproj.filters \ + w32/VS2015/hellobrowser.vcxproj w32/VS2015/hellobrowser.vcxproj.filters \ + w32/VS2015/simplepost.vcxproj w32/VS2015/largepost.vcxproj \ + w32/VS2015/libmicrohttpd.sln +W32VS2017 = w32/VS2017/libmicrohttpd.vcxproj w32/VS2017/libmicrohttpd.vcxproj.filters \ + w32/VS2017/hellobrowser.vcxproj w32/VS2017/hellobrowser.vcxproj.filters \ + w32/VS2017/simplepost.vcxproj w32/VS2017/largepost.vcxproj \ + w32/VS2017/libmicrohttpd.sln +EXTRA_DIST = \ + acinclude.m4 \ + libmicrohttpd.pc.in \ + $(EXTRA_PO_DIST) \ + $(W32COMMON) $(W32VS2013) $(W32VS2015) $(W32VS2017) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libmicrohttpd.pc + +if BUILD_DOC +SUBDIRS += doc +endif + +.PHONY: po-files update-po-files po-files-pre-distdir renew-po-configure.ac update-POTFILES.in + +# Do not override automake rule, only add prerequisite +distdir@EMPTY_VAR@: po-files-pre-distdir + +# Do not override automake rule, only add prerequisite +distclean-recursive@EMPTY_VAR@: po/Makefile + +srcdir_po = $(top_srcdir)/po + +# Test target: build main po file +po-files: $(srcdir_po)/libmicrohttpd.pot + +# Test target: force update all po files +update-po-files: po-files-pre-distdir Makefile + @$(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) libmicrohttpd.pot-update + +# Update po-related files before make distdir +po-files-pre-distdir: update-POTFILES.in renew-po-configure.ac + @$(MAKE) $(AM_MAKEFLAGS) po/Makefile + +# Clean in po directory only if po/Makefile was generated to avoid +# useless generation of po/Makefile only for 'clean' target +clean-local: + @ if test -f po/Makefile; then \ + $(MAKE) $(AM_MAKEFLAGS) po/Makefile && \ + $(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) clean || exit 1; \ + fi; + +po/Makefile: $(srcdir_po)/Makefile.in.in $(srcdir_po)/Makevars $(srcdir_po)/POTFILES.in po/config.status + @$(am__cd) po && @SHELL@ ./config.status ./Makefile.in po-directories + +po/configargs.stamp: + @$(MAKE) $(AM_MAKEFLAGS) $(top_builddir)/config.status && \ + @SHELL@ ./config.status po/configargs.stamp + +# Regenerate po/config.status if 'po/configure' was updated or 'configure' parameters was changed +po/config.status: $(srcdir_po)/configure po/configargs.stamp + @$(MKDIR_P) po && $(am__cd) po && echo "cd po && @SHELL@ ./configure @ac_configure_args@" && \ + @SHELL@ $(abs_top_srcdir)/po/configure @ac_configure_args@ --srcdir=$(abs_top_srcdir)/po \ + --disable-option-checking --no-create --no-recursion + +# Next rules actually create files in source tree, not in build tree, but those files should +# stay in source tree and should be distributed in tarball, i.e. should not be created during +# normal builds. +$(srcdir_po)/libmicrohttpd.pot: po/Makefile + @$(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) libmicrohttpd.pot + +# This target doesn't depend on po/configure.acT so po/configure.ac (and po/configure) will not be +# forced to regenerate after each run of main configure. +# If po/configure.ac is missing - it will be generated. +$(srcdir_po)/configure.ac: + @$(MAKE) $(AM_MAKEFLAGS) renew-po-configure.ac + +# Update po/configure.ac only if po/configure.acT (generated by main configure) is different. +# If po/configure.ac is unchanged then po/configure will not be regenerated +renew-po-configure.ac: + @$(MAKE) $(AM_MAKEFLAGS) po/configure.acT && \ + if ! test -f $(srcdir_po)/configure.ac || \ + ! cmp -s po/configure.acT $(srcdir_po)/configure.ac ; then \ + echo "cp po/configure.acT $(srcdir_po)/configure.ac" && \ + cp po/configure.acT $(srcdir_po)/configure.ac || exit 1; \ + fi + +$(srcdir_po)/configure: $(srcdir_po)/configure.ac + @$(am__cd) $(srcdir_po) && echo "Creating po/configure..." && \ + echo "@ACLOCAL@" && @ACLOCAL@ && \ + echo "@AUTOCONF@" && @AUTOCONF@ + +# Generate po/POTFILES.in if po/POTFILES.in is missing +$(srcdir_po)/POTFILES.in: + @$(MAKE) $(AM_MAKEFLAGS) update-POTFILES.in + +update-POTFILES.in: + @$(am__cd) $(srcdir_po) && echo @ECHO_N@ "Creating po/POTFILES.in... @ECHO_C@" && chmod o+w . && \ + find '../src/include' ! -name 'include' -prune -name '*.h' ! -name 'mhd_options.h' > POTFILES.in && \ + find '../src/microhttpd' ! -name 'microhttpd' -prune \( -name '*.h' -o -name '*.c' \) ! -name 'test_*' >> POTFILES.in && \ + echo "@ECHO_T@done." || (rm -f POTFILES.in ; echo "@ECHO_T@failed." && false) diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..27c9a88 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,1043 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_DOC_TRUE@am__append_1 = doc +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = MHD_config.h +CONFIG_CLEAN_FILES = libmicrohttpd.pc \ + w32/common/microhttpd_dll_res_vc.rc po/configure.acT +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(pkgconfigdir)" +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)MHD_config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +am__DIST_COMMON = $(srcdir)/MHD_config.h.in $(srcdir)/Makefile.in \ + $(srcdir)/libmicrohttpd.pc.in $(top_srcdir)/po/configure.ac.in \ + $(top_srcdir)/w32/common/microhttpd_dll_res_vc.rc.in AUTHORS \ + COPYING ChangeLog INSTALL NEWS README compile config.guess \ + config.rpath config.sub install-sh ltmain.sh missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +ACLOCAL_AMFLAGS = -I m4 +SUBDIRS = contrib m4 src . $(am__append_1) +DIST_SUBDIRS = $(SUBDIRS) po +EXTRA_PO_DIST = po/ABOUT-NLS $(top_srcdir)/po/configure.ac po/configure +W32COMMON = w32/common/gen_dll_res.ps1 w32/common/microhttpd_dll_res_vc.rc.in w32/common/microhttpd_dll_res_vc.rc \ + w32/common/MHD_config.h w32/common/vs_dirs.props w32/common/common-build-settings.vcxproj \ + w32/common/libmicrohttpd-build-settings.vcxproj w32/common/libmicrohttpd-files.vcxproj w32/common/libmicrohttpd-filters.vcxproj \ + w32/common/hellobrowser-files.vcxproj w32/common/hellobrowser-filters.vcxproj \ + w32/common/apps-build-settings.vcxproj + +W32VS2013 = w32/VS2013/libmicrohttpd.vcxproj w32/VS2013/libmicrohttpd.vcxproj.filters \ + w32/VS2013/hellobrowser.vcxproj w32/VS2013/hellobrowser.vcxproj.filters \ + w32/VS2013/simplepost.vcxproj w32/VS2013/largepost.vcxproj \ + w32/VS2013/libmicrohttpd.sln + +W32VS2015 = w32/VS2015/libmicrohttpd.vcxproj w32/VS2015/libmicrohttpd.vcxproj.filters \ + w32/VS2015/hellobrowser.vcxproj w32/VS2015/hellobrowser.vcxproj.filters \ + w32/VS2015/simplepost.vcxproj w32/VS2015/largepost.vcxproj \ + w32/VS2015/libmicrohttpd.sln + +W32VS2017 = w32/VS2017/libmicrohttpd.vcxproj w32/VS2017/libmicrohttpd.vcxproj.filters \ + w32/VS2017/hellobrowser.vcxproj w32/VS2017/hellobrowser.vcxproj.filters \ + w32/VS2017/simplepost.vcxproj w32/VS2017/largepost.vcxproj \ + w32/VS2017/libmicrohttpd.sln + +EXTRA_DIST = \ + acinclude.m4 \ + libmicrohttpd.pc.in \ + $(EXTRA_PO_DIST) \ + $(W32COMMON) $(W32VS2013) $(W32VS2015) $(W32VS2017) + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libmicrohttpd.pc +srcdir_po = $(top_srcdir)/po +all: MHD_config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu 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) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +MHD_config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/MHD_config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status MHD_config.h +$(srcdir)/MHD_config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f MHD_config.h stamp-h1 +libmicrohttpd.pc: $(top_builddir)/config.status $(srcdir)/libmicrohttpd.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +w32/common/microhttpd_dll_res_vc.rc: $(top_builddir)/config.status $(top_srcdir)/w32/common/microhttpd_dll_res_vc.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +po/configure.acT: $(top_builddir)/config.status $(top_srcdir)/po/configure.ac.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files + +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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -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) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_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*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(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 \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_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: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { 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-recursive +all-am: Makefile $(DATA) MHD_config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-pkgconfigDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-pkgconfigDATA + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool clean-local cscope cscopelist-am ctags ctags-am \ + dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-pkgconfigDATA + +.PRECIOUS: Makefile + + +.PHONY: po-files update-po-files po-files-pre-distdir renew-po-configure.ac update-POTFILES.in + +# Do not override automake rule, only add prerequisite +distdir@EMPTY_VAR@: po-files-pre-distdir + +# Do not override automake rule, only add prerequisite +distclean-recursive@EMPTY_VAR@: po/Makefile + +# Test target: build main po file +po-files: $(srcdir_po)/libmicrohttpd.pot + +# Test target: force update all po files +update-po-files: po-files-pre-distdir Makefile + @$(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) libmicrohttpd.pot-update + +# Update po-related files before make distdir +po-files-pre-distdir: update-POTFILES.in renew-po-configure.ac + @$(MAKE) $(AM_MAKEFLAGS) po/Makefile + +# Clean in po directory only if po/Makefile was generated to avoid +# useless generation of po/Makefile only for 'clean' target +clean-local: + @ if test -f po/Makefile; then \ + $(MAKE) $(AM_MAKEFLAGS) po/Makefile && \ + $(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) clean || exit 1; \ + fi; + +po/Makefile: $(srcdir_po)/Makefile.in.in $(srcdir_po)/Makevars $(srcdir_po)/POTFILES.in po/config.status + @$(am__cd) po && @SHELL@ ./config.status ./Makefile.in po-directories + +po/configargs.stamp: + @$(MAKE) $(AM_MAKEFLAGS) $(top_builddir)/config.status && \ + @SHELL@ ./config.status po/configargs.stamp + +# Regenerate po/config.status if 'po/configure' was updated or 'configure' parameters was changed +po/config.status: $(srcdir_po)/configure po/configargs.stamp + @$(MKDIR_P) po && $(am__cd) po && echo "cd po && @SHELL@ ./configure @ac_configure_args@" && \ + @SHELL@ $(abs_top_srcdir)/po/configure @ac_configure_args@ --srcdir=$(abs_top_srcdir)/po \ + --disable-option-checking --no-create --no-recursion + +# Next rules actually create files in source tree, not in build tree, but those files should +# stay in source tree and should be distributed in tarball, i.e. should not be created during +# normal builds. +$(srcdir_po)/libmicrohttpd.pot: po/Makefile + @$(am__cd) po && $(MAKE) $(AM_MAKEFLAGS) libmicrohttpd.pot + +# This target doesn't depend on po/configure.acT so po/configure.ac (and po/configure) will not be +# forced to regenerate after each run of main configure. +# If po/configure.ac is missing - it will be generated. +$(srcdir_po)/configure.ac: + @$(MAKE) $(AM_MAKEFLAGS) renew-po-configure.ac + +# Update po/configure.ac only if po/configure.acT (generated by main configure) is different. +# If po/configure.ac is unchanged then po/configure will not be regenerated +renew-po-configure.ac: + @$(MAKE) $(AM_MAKEFLAGS) po/configure.acT && \ + if ! test -f $(srcdir_po)/configure.ac || \ + ! cmp -s po/configure.acT $(srcdir_po)/configure.ac ; then \ + echo "cp po/configure.acT $(srcdir_po)/configure.ac" && \ + cp po/configure.acT $(srcdir_po)/configure.ac || exit 1; \ + fi + +$(srcdir_po)/configure: $(srcdir_po)/configure.ac + @$(am__cd) $(srcdir_po) && echo "Creating po/configure..." && \ + echo "@ACLOCAL@" && @ACLOCAL@ && \ + echo "@AUTOCONF@" && @AUTOCONF@ + +# Generate po/POTFILES.in if po/POTFILES.in is missing +$(srcdir_po)/POTFILES.in: + @$(MAKE) $(AM_MAKEFLAGS) update-POTFILES.in + +update-POTFILES.in: + @$(am__cd) $(srcdir_po) && echo @ECHO_N@ "Creating po/POTFILES.in... @ECHO_C@" && chmod o+w . && \ + find '../src/include' ! -name 'include' -prune -name '*.h' ! -name 'mhd_options.h' > POTFILES.in && \ + find '../src/microhttpd' ! -name 'microhttpd' -prune \( -name '*.h' -o -name '*.c' \) ! -name 'test_*' >> POTFILES.in && \ + echo "@ECHO_T@done." || (rm -f POTFILES.in ; echo "@ECHO_T@failed." && false) + +# 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: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..20d61fc --- /dev/null +++ b/NEWS @@ -0,0 +1,2 @@ +Tue Jan 9 20:52:48 MST 2007 + Project posted. diff --git a/README b/README new file mode 100644 index 0000000..037387a --- /dev/null +++ b/README @@ -0,0 +1,79 @@ +About +===== + +GNU libmicrohttpd is a GNU package offering a C library that provides +a compact API and implementation of an HTTP 1.1 web server (HTTP 1.0 +is also supported). GNU libmicrohttpd only implements the HTTP 1.1 +protocol. The main application must still provide the application +logic to generate the content. + +GNU libmicrohttpd is dual-licensed under the GNU Lesser General Public +License (LGPLv3+) and the eCos License. See COPYING for details. + + +Installation +============ + +See INSTALL for generic installation instructions. + +If you are using Git, run "autoreconf -fi" to create configure. + +In order to run the testcases, you need a recent version of libcurl. +libcurl is not required if you just want to install the library. + +Especially for development, do use the MHD_USE_ERROR_LOG option to get +error messages. + + +Configure options +================= + + +If you are concerned about space, you should set "CFLAGS" to "-Os +-fomit-frame-pointer" to have gcc generate tight code. + +You can use the following options to disable certain MHD features: + +--disable-https: no HTTPS / TLS / SSL support (significant reduction) +--disable-messages: no error messages (they take space!) +--disable-postprocessor: no MHD_PostProcessor API +--disable-dauth: no digest authentication API +--disable-epoll: no support for epoll, even on Linux + +The resulting binary should be about 30-40k depending on the platform. + + +Portability +=========== + +The latest version of libmicrohttpd will try to avoid SIGPIPE on its +sockets. This should work on OS X, Linux and recent BSD systems (at +least). On other systems that may trigger a SIGPIPE on send/recv, the +main application should install a signal handler to handle SIGPIPE. + +libmicrohttpd should work well on GNU/Linux, W32, FreeBSD, Darwin, +NetBSD, OpenBSD, Solaris/OpenIndiana, and z/OS. +Note that HTTPS is not supported on z/OS (yet). We also have reports +of users using it on vxWorks. + + +Development Status +================== + +This is a beta release for libmicrohttpd. Before declaring the +library stable, we should have testcases for the following features: + +- HTTP/1.1 pipelining (need to figure out how to ensure curl pipelines + -- and it seems libcurl has issues with pipelining, + see http://curl.haxx.se/mail/lib-2007-12/0248.html) +- resource limit enforcement +- client queuing early response, suppressing 100 CONTINUE +- chunked encoding to validate handling of footers +- more testing for SSL support +- MHD basic and digest authentication + +In particular, the following functions are not covered by 'make check': +- mhd_panic_std (daemon.c); special case (abort) +- parse_options (daemon.c) +- MHD_set_panic_func (daemon.c) +- MHD_get_version (daemon.c) diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1 @@ + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..2fbb83e --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1173 @@ +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- + +# Copyright (C) 1996-2017 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_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +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-2017 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.15' +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.15.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 AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.15.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2017 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], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2017 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_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$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 +m4_define([_AM_COND_VALUE_$1], [$2])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-2017 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. + + +# 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", "OBJC", "OBJCXX", "UPC", or "GJC". +# 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 + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" 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". + rm -rf conftest.dir + 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 + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + 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 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # 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. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + 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 + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2017 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_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + 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"` + # 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'`; 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-2017 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 macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# 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.65])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], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +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], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [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]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). 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])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# 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-2017 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 +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2017 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. + +# 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-2017 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_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.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 +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +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-2017 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_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 is modern enough. +# If it is, 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 +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2017 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_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], +[m4_foreach_w([_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])]) + +# Copyright (C) 1999-2017 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_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2017 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_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2017 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_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# 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 ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + 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 + 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 + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + 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]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2017 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_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2017 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-2017 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]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2017 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_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. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + 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 /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 + +m4_include([m4/ax_append_compile_flags.m4]) +m4_include([m4/ax_append_flag.m4]) +m4_include([m4/ax_check_compile_flag.m4]) +m4_include([m4/ax_check_link_flag.m4]) +m4_include([m4/ax_count_cpus.m4]) +m4_include([m4/ax_have_epoll.m4]) +m4_include([m4/ax_pthread.m4]) +m4_include([m4/ax_require_defined.m4]) +m4_include([m4/libcurl.m4]) +m4_include([m4/libgcrypt.m4]) +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) +m4_include([m4/mhd_shutdown_socket_trigger.m4]) +m4_include([m4/mhd_sys_extentions.m4]) +m4_include([m4/pkg.m4]) +m4_include([m4/search_h.m4]) +m4_include([m4/tsearch.m4]) +m4_include([acinclude.m4]) diff --git a/compile b/compile new file mode 100755 index 0000000..a85b723 --- /dev/null +++ b/compile @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# 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, see . + +# 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. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# 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-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..31e01ef --- /dev/null +++ b/config.guess @@ -0,0 +1,1463 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2017 Free Software Foundation, Inc. + +timestamp='2017-11-07' + +# 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 3 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, see . +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# +# Please send patches to . + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -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 ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2017 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 + +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + +# 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 tuples: *-*-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=`(uname -p 2>/dev/null || \ + /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 ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-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) and ABI. + case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + 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 + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + 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/[-_].*//' | cut -d. -f1,2` + ;; + 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}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; + *:MidnightBSD:*:*) + echo ${UNAME_MACHINE}-unknown-midnightbsd${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 ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; + *:Redox:*:*) + echo ${UNAME_MACHINE}-unknown-redox + 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` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + 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 ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + 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:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo ${SUN_ARCH}-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 /* 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 + + 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:*:[4567]) + 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/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + 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:4.4BSD:*) + 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 + #include + + 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 -q __LP64__ + 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 + 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:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + *:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-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-${LIBC}`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 "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + 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 -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${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-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-${LIBC} + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + 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.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*: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' /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 i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + echo i586-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; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + 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; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; 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.[02]*:*) + 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 + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # 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 ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + 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 ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-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 + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi + 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 ;; + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-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 ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; +esac + +echo "$0: unable to guess system type" >&2 + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}" in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&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-functions 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.rpath b/config.rpath new file mode 100755 index 0000000..98183ff --- /dev/null +++ b/config.rpath @@ -0,0 +1,684 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2016 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# 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. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's _LT_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + ecc*) + wl='-Wl,' + ;; + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + nagfor*) + wl='-Wl,-Wl,,' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + xl* | bgxl* | bgf* | mpixl*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + wl= + ;; + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + newsos6) + ;; + *nto* | *qnx*) + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + wl='-Qoption ld ' + ;; + *) + wl='-Wl,' + ;; + esac + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + haiku*) + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then + : + else + ld_shlibs=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd2.[01]*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + *nto* | *qnx*) + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix[4-9]*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + case "$host_cpu" in + powerpc*) + library_names_spec='$libname$shrext' ;; + m68k) + library_names_spec='$libname.a' ;; + esac + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32* | cegcc*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd[23].*) + library_names_spec='$libname$shrext$versuffix' + ;; + freebsd* | dragonfly*) + library_names_spec='$libname$shrext' + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + haiku*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + *nto* | *qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + tpf*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# 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. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + +# 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 or ALIAS + +Canonicalize a configuration name. + +Options: + -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 ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2017 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-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + 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 | -microblaze*) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -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*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -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 \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 | or1k | or1knd | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ + | pyramid \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | wasm32 \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-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-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | ba-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | e2k-* | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ + | pyramid-* \ + | riscv32-* | riscv64-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | 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-* | sv1-* | sx*-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ + | wasm32-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # 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 + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + asmjs) + basic_machine=asmjs-unknown + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + 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 | 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 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2*) + basic_machine=m68k-bull + os=-sysv3 + ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; + 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*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 + ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-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 + ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + 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 + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + nsx-tandem) + basic_machine=nsx-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 + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + 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 | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle) + 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) + 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 | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + 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 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + 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 + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + 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 + ;; + wasm32) + basic_machine=wasm32-unknown + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + x64) + basic_machine=x86_64-pc + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-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[24]aeb | 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. + -auroraux) + os=-auroraux + ;; + -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|'` + ;; + # Now 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* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -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* | -cegcc* | -glidix* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -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* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) + # 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 + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $basic_machine in + arm*) + os=-eabi + ;; + *) + os=-elf + ;; + esac + ;; + -nacl*) + ;; + -ios) + ;; + -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 + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + 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 + ;; + 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 + ;; + pru-*) + os=-elf + ;; + *-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 + ;; + -cnk*|-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-functions 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..7e728ac --- /dev/null +++ b/configure @@ -0,0 +1,26036 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for GNU Libmicrohttpd 0.9.59. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 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=: + # Pre-4.2 versions of Zsh do 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_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +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.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do 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_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: libmicrohttpd@gnu.org about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_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 || +$as_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" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # 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" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # 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 +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +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 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + 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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +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='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/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= + +# Identity of this package. +PACKAGE_NAME='GNU Libmicrohttpd' +PACKAGE_TARNAME='libmicrohttpd' +PACKAGE_VERSION='0.9.59' +PACKAGE_STRING='GNU Libmicrohttpd 0.9.59' +PACKAGE_BUGREPORT='libmicrohttpd@gnu.org' +PACKAGE_URL='http://www.gnu.org/software/libmicrohttpd/' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_func_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +EMPTY_VAR +ac_configure_args +MHD_LIBDEPS_PKGCFG +MHD_REQ_PRIVATE +MHD_LIBDEPS +MHD_LIB_LDFLAGS +MHD_LIB_CFLAGS +MHD_LIB_CPPFLAGS +CPU_COUNT +USE_COVERAGE_FALSE +USE_COVERAGE_TRUE +HAVE_FORK_WAITPID_FALSE +HAVE_FORK_WAITPID_TRUE +ENABLE_UPGRADE_FALSE +ENABLE_UPGRADE_TRUE +ENABLE_DAUTH_FALSE +ENABLE_DAUTH_TRUE +ENABLE_BAUTH_FALSE +ENABLE_BAUTH_TRUE +GNUTLS_LDFLAGS +GNUTLS_CPPFLAGS +HTTPS_REQUIRE_GRYPT_FALSE +HTTPS_REQUIRE_GRYPT_TRUE +ENABLE_HTTPS_FALSE +ENABLE_HTTPS_TRUE +HAVE_GNUTLS_SNI_FALSE +HAVE_GNUTLS_SNI_TRUE +HAVE_GNUTLS_FALSE +HAVE_GNUTLS_TRUE +LIBGCRYPT_LIBS +LIBGCRYPT_CFLAGS +LIBGCRYPT_CONFIG +GNUTLS_LIBS +GNUTLS_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +HAVE_SOCAT_FALSE +HAVE_SOCAT_TRUE +HAVE_ZZUF_FALSE +HAVE_ZZUF_TRUE +have_socat +have_zzuf +HAVE_POSTPROCESSOR_FALSE +HAVE_POSTPROCESSOR_TRUE +HAVE_LIBMAGIC_FALSE +HAVE_LIBMAGIC_TRUE +HAVE_CURL_FALSE +HAVE_CURL_TRUE +LIBCURL +LIBCURL_CPPFLAGS +_libcurl_config +HIDDEN_VISIBILITY_CFLAGS +MHD_HAVE_TSEARCH_FALSE +MHD_HAVE_TSEARCH_TRUE +REPLACE_TSEARCH +HAVE_TSEARCH +GNULIB_TSEARCH +BUILD_EXAMPLES_FALSE +BUILD_EXAMPLES_TRUE +BUILD_DOC_FALSE +BUILD_DOC_TRUE +W32_STATIC_LIB_FALSE +W32_STATIC_LIB_TRUE +HAVE_MAKEINFO_BINARY_FALSE +HAVE_MAKEINFO_BINARY_TRUE +HAVE_MAKEINFO_BINARY +HAVE_CURL_BINARY_FALSE +HAVE_CURL_BINARY_TRUE +HAVE_CURL_BINARY +HAVE_LISTEN_SHUTDOWN_FALSE +HAVE_LISTEN_SHUTDOWN_TRUE +USE_MS_LIB_TOOL_FALSE +USE_MS_LIB_TOOL_TRUE +W32_SHARED_LIB_EXP_FALSE +W32_SHARED_LIB_EXP_TRUE +HAVE_W32_FALSE +HAVE_W32_TRUE +USE_W32_THREADS_FALSE +USE_W32_THREADS_TRUE +USE_POSIX_THREADS_FALSE +USE_POSIX_THREADS_TRUE +HAVE_POSIX_THREADS_FALSE +HAVE_POSIX_THREADS_TRUE +PTHREAD_CFLAGS +PTHREAD_LIBS +PTHREAD_CC +ax_pthread_config +CYGWIN_TARGET_FALSE +CYGWIN_TARGET_TRUE +lt_cv_objdir +MS_LIB_TOOL +MHD_W32_DLL_SUFF +PACKAGE_VERSION_SUBMINOR +PACKAGE_VERSION_MINOR +PACKAGE_VERSION_MAJOR +RC +LT_SYS_LIBRARY_PATH +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +NM +ac_ct_DUMPBIN +DUMPBIN +LD +EGREP +SED +LIBTOOL +OBJDUMP +DLLTOOL +AS +FGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LN_S +LIB_VERSION_AGE +LIB_VERSION_REVISION +LIB_VERSION_CURRENT +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_aix_soname +with_gnu_ld +with_sysroot +enable_libtool_lock +with_threads +enable_thread_names +enable_doc +enable_examples +enable_poll +enable_epoll +enable_itc +enable_curl +with_libcurl +enable_largefile +enable_sendfile +enable_messages +enable_postprocessor +enable_https +with_gnutls +with_libgcrypt_prefix +enable_bauth +enable_dauth +enable_httpupgrade +enable_coverage +enable_asserts +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +LT_SYS_LIBRARY_PATH +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +GNUTLS_CFLAGS +GNUTLS_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# 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' +runstatedir='${localstatedir}/run' +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= ;; + *) 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_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=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_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_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'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +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 runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +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 + 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 .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + 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 .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + 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 GNU Libmicrohttpd 0.9.59 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] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --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/libmicrohttpd] + --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 + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of GNU Libmicrohttpd 0.9.59:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-thread-names auto + do not set names on MHD generated threads + --disable-doc do not build any documentation + --disable-examples do not build any examples + --enable-poll[=ARG] enable poll support (yes, no, auto) [auto] + --enable-epoll[=ARG] enable epoll support (yes, no, auto) [auto] + --enable-itc=TYPE use TYPE of inter-thread communication (pipe, + socketpair, eventfd) [auto] + --disable-curl disable cURL based testcases + --disable-largefile omit support for large files + --disable-sendfile disable usage of sendfile() for HTTP connections + [auto] + --disable-messages disable MHD error messages + --disable-postprocessor disable MHD PostProcessor functionality + --enable-https enable HTTPS support (yes, no, auto)[auto] + --disable-bauth disable HTTP basic Auth support + --disable-dauth disable HTTP basic and digest Auth support + --disable-httpupgrade disable HTTP "Upgrade" support + --enable-coverage compile the library with code coverage support + --enable-asserts enable test build with debug asserts + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot[=DIR] Search for dependent libraries within DIR (or the + compiler's sysroot if not specified). + --with-threads=LIB choose threading library (posix, w32, auto) [auto] + --with-libcurl=PREFIX look for the curl library in PREFIX/lib and headers + in PREFIX/include + --with-gnutls[=PFX] use GnuTLS for HTTPS support, optional PFX overrides + pkg-config data for GnuTLS headers (PFX/include) and + libs (PFX/lib) + --with-libgcrypt-prefix=PFX + prefix where LIBGCRYPT is installed (optional) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + GNUTLS_CFLAGS + C compiler flags for GNUTLS, overriding pkg-config + GNUTLS_LIBS linker flags for GNUTLS, overriding pkg-config + +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 . +GNU Libmicrohttpd home page: . +General help using GNU software: . +_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" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && 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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_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 + $as_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 +GNU Libmicrohttpd configure 0.9.59 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 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 + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* 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 $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +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 +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------------ ## +## Report this to libmicrohttpd@gnu.org ## +## ------------------------------------ ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +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 +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member +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 GNU Libmicrohttpd $as_me 0.9.59, which was +generated by GNU Autoconf 2.69. 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=. + $as_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=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append 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 + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset 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 + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + 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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; 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 + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_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'; as_fn_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 + +$as_echo "/* confdefs.h */" > 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 + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + 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. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +mhd_undef_all_extensions=" +#ifdef _GNU_SOURCE +#undef _GNU_SOURCE +#endif +#ifdef _XOPEN_SOURCE +#undef _XOPEN_SOURCE +#endif +#ifdef _XOPEN_SOURCE_EXTENDED +#undef _XOPEN_SOURCE_EXTENDED +#endif +#ifdef _XOPEN_VERSION +#undef _XOPEN_VERSION +#endif +#ifdef _POSIX_C_SOURCE +#undef _POSIX_C_SOURCE +#endif +#ifdef _POSIX_SOURCE +#undef _POSIX_SOURCE +#endif +#ifdef _DEFAULT_SOURCE +#undef _DEFAULT_SOURCE +#endif +#ifdef _BSD_SOURCE +#undef _BSD_SOURCE +#endif +#ifdef _SVID_SOURCE +#undef _SVID_SOURCE +#endif +#ifdef __EXTENSIONS__ +#undef __EXTENSIONS__ +#endif +#ifdef _ALL_SOURCE +#undef _ALL_SOURCE +#endif +#ifdef _TANDEM_SOURCE +#undef _TANDEM_SOURCE +#endif +#ifdef _DARWIN_C_SOURCE +#undef _DARWIN_C_SOURCE +#endif +#ifdef __BSD_VISIBLE +#undef __BSD_VISIBLE +#endif +#ifdef _NETBSD_SOURCE +#undef _NETBSD_SOURCE +#endif +" + +as_fn_append ac_func_list " accept4" +as_fn_append ac_func_list " gmtime_r" +as_fn_append ac_func_list " memmem" +as_fn_append ac_func_list " snprintf" +# 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,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_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 + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_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. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +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.15' + +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 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +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. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$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' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# 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 ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + 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 + 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". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +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 $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&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 + as_fn_executable_p "$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 + + test -d ./--version && rmdir ./--version + 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. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +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 + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + 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='libmicrohttpd' + VERSION='0.9.59' + + +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"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + +ac_config_headers="$ac_config_headers MHD_config.h" + + + +LIB_VERSION_CURRENT=58 +LIB_VERSION_REVISION=0 +LIB_VERSION_AGE=46 + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether z/OS special settings are required" >&5 +$as_echo_n "checking whether z/OS special settings are required... " >&6; } +if test `uname -s` = "OS/390" +then +# configure binaries for z/OS + if test -z "$CC" + then + CC=`pwd`"/contrib/xcc" + chmod +x $CC || true + fi + if test -z "$CPP" + then + CPP="c89 -E" + fi + if test -z "$CXXCPP" + then + CXXCPP="c++ -E -+" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# _CCC_CCMODE=1 +# _C89_CCMODE=1 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +# Checks for programs. +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_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='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$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" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM 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. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 | *.dSYM | *.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 +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* 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" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +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) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +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 + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +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 + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&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". + rm -rf conftest.dir + 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 + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + 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 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # 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. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + 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 + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$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 + + + case $ac_cv_prog_cc_stdc in #( + no) : + ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* 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" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +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) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 +else + ac_cv_prog_cc_stdc=no +fi + +fi + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 +$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } + if ${ac_cv_prog_cc_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +fi + + case $ac_cv_prog_cc_stdc in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; #( + '') : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 +$as_echo "$ac_cv_prog_cc_stdc" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&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 to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$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 to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +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 + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of stdio.h" >&5 +$as_echo_n "checking for presence of stdio.h... " >&6; } +if ${mhd_cv_header_stdio_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_stdio_h_present="yes" +else + mhd_cv_header_stdio_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_stdio_h_present" >&5 +$as_echo "$mhd_cv_header_stdio_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of wchar.h" >&5 +$as_echo_n "checking for presence of wchar.h... " >&6; } +if ${mhd_cv_header_wchar_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_wchar_h_present="yes" +else + mhd_cv_header_wchar_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_wchar_h_present" >&5 +$as_echo "$mhd_cv_header_wchar_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of stdlib.h" >&5 +$as_echo_n "checking for presence of stdlib.h... " >&6; } +if ${mhd_cv_header_stdlib_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_stdlib_h_present="yes" +else + mhd_cv_header_stdlib_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_stdlib_h_present" >&5 +$as_echo "$mhd_cv_header_stdlib_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of string.h" >&5 +$as_echo_n "checking for presence of string.h... " >&6; } +if ${mhd_cv_header_string_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_string_h_present="yes" +else + mhd_cv_header_string_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_string_h_present" >&5 +$as_echo "$mhd_cv_header_string_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of strings.h" >&5 +$as_echo_n "checking for presence of strings.h... " >&6; } +if ${mhd_cv_header_strings_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_strings_h_present="yes" +else + mhd_cv_header_strings_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_strings_h_present" >&5 +$as_echo "$mhd_cv_header_strings_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of stdint.h" >&5 +$as_echo_n "checking for presence of stdint.h... " >&6; } +if ${mhd_cv_header_stdint_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_stdint_h_present="yes" +else + mhd_cv_header_stdint_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_stdint_h_present" >&5 +$as_echo "$mhd_cv_header_stdint_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of fcntl.h" >&5 +$as_echo_n "checking for presence of fcntl.h... " >&6; } +if ${mhd_cv_header_fcntl_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_fcntl_h_present="yes" +else + mhd_cv_header_fcntl_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_fcntl_h_present" >&5 +$as_echo "$mhd_cv_header_fcntl_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of sys/types.h" >&5 +$as_echo_n "checking for presence of sys/types.h... " >&6; } +if ${mhd_cv_header_sys_types_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_sys_types_h_present="yes" +else + mhd_cv_header_sys_types_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_sys_types_h_present" >&5 +$as_echo "$mhd_cv_header_sys_types_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of time.h" >&5 +$as_echo_n "checking for presence of time.h... " >&6; } +if ${mhd_cv_header_time_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_time_h_present="yes" +else + mhd_cv_header_time_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_time_h_present" >&5 +$as_echo "$mhd_cv_header_time_h_present" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for presence of unistd.h" >&5 +$as_echo_n "checking for presence of unistd.h... " >&6; } +if ${mhd_cv_header_unistd_h_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF +#include +_ACEOF + if ac_fn_c_try_cpp "$LINENO"; then : + mhd_cv_header_unistd_h_present="yes" +else + mhd_cv_header_unistd_h_present="no" + +fi +rm -f conftest.err conftest.i + rm -f conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_header_unistd_h_present" >&5 +$as_echo "$mhd_cv_header_unistd_h_present" >&6; } + + + + if test -z "$mhd_basic_headers_includes"; then : + if test "x$mhd_cv_header_stdio_h_present" = x"yes"; then : + mhd_basic_headers_includes="\ +#include +" +else + mhd_basic_headers_includes="" + +fi + if test "x$mhd_cv_header_sys_types_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_wchar_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_stdlib_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_string_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_strings_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_stdint_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_fcntl_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_time_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + if test "x$mhd_cv_header_unistd_h_present" = x"yes"; then : + mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" + +fi + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + 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" + as_fn_executable_p "$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 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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 + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_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 fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_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_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + + 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 + mhd_mse_sys_ext_defines="" + mhd_mse_sys_ext_flags="" + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _GNU_SOURCE is already defined" >&5 +$as_echo_n "checking whether _GNU_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__gnu_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef _GNU_SOURCE +#error _GNU_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__gnu_source_defined="yes" +else + mhd_cv_macro__gnu_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__gnu_source_defined" >&5 +$as_echo "$mhd_cv_macro__gnu_source_defined" >&6; } + if test "x$mhd_cv_macro__gnu_source_defined" = x"yes"; then : + mhd_cv_macro_add__gnu_source="no" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _GNU_SOURCE" >&5 +$as_echo_n "checking whether headers accept _GNU_SOURCE... " >&6; } +if ${mhd_cv_define__gnu_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define _GNU_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__gnu_source_accepted="yes" +else + mhd_cv_define__gnu_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__gnu_source_accepted" >&5 +$as_echo "$mhd_cv_define__gnu_source_accepted" >&6; } + if test "x$mhd_cv_define__gnu_source_accepted" = x"yes"; then : + mhd_cv_macro_add__gnu_source="yes" +else + mhd_cv_macro_add__gnu_source="no" + +fi + +fi + + if test "x$mhd_cv_macro_add__gnu_source" = x"yes"; then : + + mhd_mse_sys_ext_defines="${mhd_mse_sys_ext_defines}#define _GNU_SOURCE 1 +" + if test "x${mhd_mse_sys_ext_flags}" = "x"; then : + mhd_mse_sys_ext_flags="_GNU_SOURCE" +else + mhd_mse_sys_ext_flags="${mhd_mse_sys_ext_flags} _GNU_SOURCE" + +fi + + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try __BSD_VISIBLE macro" >&5 +$as_echo_n "checking whether to try __BSD_VISIBLE macro... " >&6; } +if ${mhd_cv_macro_try___bsd_visible+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Warning: test with inverted logic! */ +#ifdef __FreeBSD__ +#error Target FreeBSD +choke me now; +#endif /* __FreeBSD__ */ + +#ifdef __ANDROID__ +#include +#ifndef __ANDROID_API_O__ +#error Target is Android NDK before R14 +choke me now; +#endif /* ! __ANDROID_API_O__ */ +#endif /* __ANDROID__ */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_try___bsd_visible="no" +else + mhd_cv_macro_try___bsd_visible="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_try___bsd_visible" >&5 +$as_echo "$mhd_cv_macro_try___bsd_visible" >&6; } + if test "x$mhd_cv_macro_try___bsd_visible" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __BSD_VISIBLE is already defined" >&5 +$as_echo_n "checking whether __BSD_VISIBLE is already defined... " >&6; } +if ${mhd_cv_macro___bsd_visible_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +/* Warning: test with inverted logic! */ +#ifdef __BSD_VISIBLE +#error __BSD_VISIBLE is defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___bsd_visible_defined="no" +else + mhd_cv_macro___bsd_visible_defined="yes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___bsd_visible_defined" >&5 +$as_echo "$mhd_cv_macro___bsd_visible_defined" >&6; } + if test "x$mhd_cv_macro___bsd_visible_defined" = x"yes"; then : + : +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept __BSD_VISIBLE" >&5 +$as_echo_n "checking whether headers accept __BSD_VISIBLE... " >&6; } +if ${mhd_cv_define___bsd_visible_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define __BSD_VISIBLE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define___bsd_visible_accepted="yes" +else + mhd_cv_define___bsd_visible_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define___bsd_visible_accepted" >&5 +$as_echo "$mhd_cv_define___bsd_visible_accepted" >&6; } + if test "x$mhd_cv_define___bsd_visible_accepted" = x"yes"; then : + + mhd_mse_sys_ext_defines="${mhd_mse_sys_ext_defines}#define __BSD_VISIBLE 1 +" + if test "x${mhd_mse_sys_ext_flags}" = "x"; then : + mhd_mse_sys_ext_flags="__BSD_VISIBLE" +else + mhd_mse_sys_ext_flags="${mhd_mse_sys_ext_flags} __BSD_VISIBLE" + +fi + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _DARWIN_C_SOURCE macro" >&5 +$as_echo_n "checking whether to try _DARWIN_C_SOURCE macro... " >&6; } +if ${mhd_cv_macro___apple___defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef __APPLE__ +#error __APPLE__ is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___apple___defined="yes" +else + mhd_cv_macro___apple___defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___apple___defined" >&5 +$as_echo "$mhd_cv_macro___apple___defined" >&6; } + if test "x$mhd_cv_macro___apple___defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _DARWIN_C_SOURCE is already defined" >&5 +$as_echo_n "checking whether _DARWIN_C_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__darwin_c_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef _DARWIN_C_SOURCE +#error _DARWIN_C_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__darwin_c_source_defined="yes" +else + mhd_cv_macro__darwin_c_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__darwin_c_source_defined" >&5 +$as_echo "$mhd_cv_macro__darwin_c_source_defined" >&6; } + if test "x$mhd_cv_macro__darwin_c_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _DARWIN_C_SOURCE" >&5 +$as_echo_n "checking whether headers accept _DARWIN_C_SOURCE... " >&6; } +if ${mhd_cv_define__darwin_c_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define _DARWIN_C_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__darwin_c_source_accepted="yes" +else + mhd_cv_define__darwin_c_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__darwin_c_source_accepted" >&5 +$as_echo "$mhd_cv_define__darwin_c_source_accepted" >&6; } + if test "x$mhd_cv_define__darwin_c_source_accepted" = x"yes"; then : + + mhd_mse_sys_ext_defines="${mhd_mse_sys_ext_defines}#define _DARWIN_C_SOURCE 1 +" + if test "x${mhd_mse_sys_ext_flags}" = "x"; then : + mhd_mse_sys_ext_flags="_DARWIN_C_SOURCE" +else + mhd_mse_sys_ext_flags="${mhd_mse_sys_ext_flags} _DARWIN_C_SOURCE" + +fi + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try __EXTENSIONS__ macro" >&5 +$as_echo_n "checking whether to try __EXTENSIONS__ macro... " >&6; } +if ${mhd_cv_macro___sun_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef __sun +#error __sun is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___sun_defined="yes" +else + mhd_cv_macro___sun_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___sun_defined" >&5 +$as_echo "$mhd_cv_macro___sun_defined" >&6; } + if test "x$mhd_cv_macro___sun_defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __EXTENSIONS__ is already defined" >&5 +$as_echo_n "checking whether __EXTENSIONS__ is already defined... " >&6; } +if ${mhd_cv_macro___extensions___defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef __EXTENSIONS__ +#error __EXTENSIONS__ is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___extensions___defined="yes" +else + mhd_cv_macro___extensions___defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___extensions___defined" >&5 +$as_echo "$mhd_cv_macro___extensions___defined" >&6; } + if test "x$mhd_cv_macro___extensions___defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept __EXTENSIONS__" >&5 +$as_echo_n "checking whether headers accept __EXTENSIONS__... " >&6; } +if ${mhd_cv_define___extensions___accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define __EXTENSIONS__ 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define___extensions___accepted="yes" +else + mhd_cv_define___extensions___accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define___extensions___accepted" >&5 +$as_echo "$mhd_cv_define___extensions___accepted" >&6; } + if test "x$mhd_cv_define___extensions___accepted" = x"yes"; then : + + mhd_mse_sys_ext_defines="${mhd_mse_sys_ext_defines}#define __EXTENSIONS__ 1 +" + if test "x${mhd_mse_sys_ext_flags}" = "x"; then : + mhd_mse_sys_ext_flags="__EXTENSIONS__" +else + mhd_mse_sys_ext_flags="${mhd_mse_sys_ext_flags} __EXTENSIONS__" + +fi + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _NETBSD_SOURCE macro" >&5 +$as_echo_n "checking whether to try _NETBSD_SOURCE macro... " >&6; } +if ${mhd_cv_macro___netbsd___defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef __NetBSD__ +#error __NetBSD__ is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___netbsd___defined="yes" +else + mhd_cv_macro___netbsd___defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___netbsd___defined" >&5 +$as_echo "$mhd_cv_macro___netbsd___defined" >&6; } + if test "x$mhd_cv_macro___netbsd___defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _NETBSD_SOURCE is already defined" >&5 +$as_echo_n "checking whether _NETBSD_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__netbsd_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef _NETBSD_SOURCE +#error _NETBSD_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__netbsd_source_defined="yes" +else + mhd_cv_macro__netbsd_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__netbsd_source_defined" >&5 +$as_echo "$mhd_cv_macro__netbsd_source_defined" >&6; } + if test "x$mhd_cv_macro__netbsd_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _NETBSD_SOURCE" >&5 +$as_echo_n "checking whether headers accept _NETBSD_SOURCE... " >&6; } +if ${mhd_cv_define__netbsd_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define _NETBSD_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__netbsd_source_accepted="yes" +else + mhd_cv_define__netbsd_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__netbsd_source_accepted" >&5 +$as_echo "$mhd_cv_define__netbsd_source_accepted" >&6; } + if test "x$mhd_cv_define__netbsd_source_accepted" = x"yes"; then : + + mhd_mse_sys_ext_defines="${mhd_mse_sys_ext_defines}#define _NETBSD_SOURCE 1 +" + if test "x${mhd_mse_sys_ext_flags}" = "x"; then : + mhd_mse_sys_ext_flags="_NETBSD_SOURCE" +else + mhd_mse_sys_ext_flags="${mhd_mse_sys_ext_flags} _NETBSD_SOURCE" + +fi + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _BSD_SOURCE macro" >&5 +$as_echo_n "checking whether to try _BSD_SOURCE macro... " >&6; } +if ${mhd_cv_macro___openbsd___defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef __OpenBSD__ +#error __OpenBSD__ is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___openbsd___defined="yes" +else + mhd_cv_macro___openbsd___defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___openbsd___defined" >&5 +$as_echo "$mhd_cv_macro___openbsd___defined" >&6; } + if test "x$mhd_cv_macro___openbsd___defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _BSD_SOURCE is already defined" >&5 +$as_echo_n "checking whether _BSD_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__bsd_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef _BSD_SOURCE +#error _BSD_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__bsd_source_defined="yes" +else + mhd_cv_macro__bsd_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__bsd_source_defined" >&5 +$as_echo "$mhd_cv_macro__bsd_source_defined" >&6; } + if test "x$mhd_cv_macro__bsd_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _BSD_SOURCE" >&5 +$as_echo_n "checking whether headers accept _BSD_SOURCE... " >&6; } +if ${mhd_cv_define__bsd_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define _BSD_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__bsd_source_accepted="yes" +else + mhd_cv_define__bsd_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__bsd_source_accepted" >&5 +$as_echo "$mhd_cv_define__bsd_source_accepted" >&6; } + if test "x$mhd_cv_define__bsd_source_accepted" = x"yes"; then : + + mhd_mse_sys_ext_defines="${mhd_mse_sys_ext_defines}#define _BSD_SOURCE 1 +" + if test "x${mhd_mse_sys_ext_flags}" = "x"; then : + mhd_mse_sys_ext_flags="_BSD_SOURCE" +else + mhd_mse_sys_ext_flags="${mhd_mse_sys_ext_flags} _BSD_SOURCE" + +fi + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _TANDEM_SOURCE macro" >&5 +$as_echo_n "checking whether to try _TANDEM_SOURCE macro... " >&6; } +if ${mhd_cv_macro___tandem_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef __TANDEM +#error __TANDEM is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro___tandem_defined="yes" +else + mhd_cv_macro___tandem_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro___tandem_defined" >&5 +$as_echo "$mhd_cv_macro___tandem_defined" >&6; } + if test "x$mhd_cv_macro___tandem_defined" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _TANDEM_SOURCE is already defined" >&5 +$as_echo_n "checking whether _TANDEM_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__tandem_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef _TANDEM_SOURCE +#error _TANDEM_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__tandem_source_defined="yes" +else + mhd_cv_macro__tandem_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__tandem_source_defined" >&5 +$as_echo "$mhd_cv_macro__tandem_source_defined" >&6; } + if test "x$mhd_cv_macro__tandem_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _TANDEM_SOURCE" >&5 +$as_echo_n "checking whether headers accept _TANDEM_SOURCE... " >&6; } +if ${mhd_cv_define__tandem_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define _TANDEM_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__tandem_source_accepted="yes" +else + mhd_cv_define__tandem_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__tandem_source_accepted" >&5 +$as_echo "$mhd_cv_define__tandem_source_accepted" >&6; } + if test "x$mhd_cv_define__tandem_source_accepted" = x"yes"; then : + + mhd_mse_sys_ext_defines="${mhd_mse_sys_ext_defines}#define _TANDEM_SOURCE 1 +" + if test "x${mhd_mse_sys_ext_flags}" = "x"; then : + mhd_mse_sys_ext_flags="_TANDEM_SOURCE" +else + mhd_mse_sys_ext_flags="${mhd_mse_sys_ext_flags} _TANDEM_SOURCE" + +fi + + +fi + +fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to try _ALL_SOURCE macro" >&5 +$as_echo_n "checking whether to try _ALL_SOURCE macro... " >&6; } +if ${mhd_cv_macro_try__all_source+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if !defined(__TOS_MVS__) && !defined (__INTERIX) +#error Target is not z/OS, AIX or Interix +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_try__all_source="yes" +else + mhd_cv_macro_try__all_source="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_try__all_source" >&5 +$as_echo "$mhd_cv_macro_try__all_source" >&6; } + if test "x$mhd_cv_macro_try__all_source" = x"yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _ALL_SOURCE is already defined" >&5 +$as_echo_n "checking whether _ALL_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__all_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef _ALL_SOURCE +#error _ALL_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__all_source_defined="yes" +else + mhd_cv_macro__all_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__all_source_defined" >&5 +$as_echo "$mhd_cv_macro__all_source_defined" >&6; } + if test "x$mhd_cv_macro__all_source_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _ALL_SOURCE" >&5 +$as_echo_n "checking whether headers accept _ALL_SOURCE... " >&6; } +if ${mhd_cv_define__all_source_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define _ALL_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__all_source_accepted="yes" +else + mhd_cv_define__all_source_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__all_source_accepted" >&5 +$as_echo "$mhd_cv_define__all_source_accepted" >&6; } + if test "x$mhd_cv_define__all_source_accepted" = x"yes"; then : + + mhd_mse_sys_ext_defines="${mhd_mse_sys_ext_defines}#define _ALL_SOURCE 1 +" + if test "x${mhd_mse_sys_ext_flags}" = "x"; then : + mhd_mse_sys_ext_flags="_ALL_SOURCE" +else + mhd_mse_sys_ext_flags="${mhd_mse_sys_ext_flags} _ALL_SOURCE" + +fi + + +fi + +fi + +fi + + mhd_mse_xopen_features="" + mhd_mse_xopen_defines="" + mhd_mse_xopen_flags="" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE is already defined" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__xopen_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef _XOPEN_SOURCE +#error _XOPEN_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_source_defined="yes" +else + mhd_cv_macro__xopen_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_source_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_source_defined" >&6; } + if test "x$mhd_cv_macro__xopen_source_defined" = x"no"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking headers for POSIX.1-2008/SUSv4 features" >&5 +$as_echo_n "checking headers for POSIX.1-2008/SUSv4 features... " >&6; } +if ${mhd_cv_headers_posix2008+:} false; then : + $as_echo_n "(cached) " >&6 +else + { mhd_cpsxfs_tmp_features_available=; unset mhd_cpsxfs_tmp_features_available;} + { mhd_cpsxfs_tmp_extentions_allowed=; unset mhd_cpsxfs_tmp_extentions_allowed;} + { mhd_cpsxfs_tmp_src_xopen_allowed=; unset mhd_cpsxfs_tmp_src_xopen_allowed;} + { mhd_cpsxfs_tmp_features_disableable=; unset mhd_cpsxfs_tmp_features_disableable;} + mhd_cpsxf_tmp_src_variable=" + + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +/* Check will be passed if ALL features are avalable + * and failed if ANY feature is not avalable. */ +int main() +{ + +#ifndef stpncpy + (void) stpncpy; +#endif +#ifndef strnlen + (void) strnlen; +#endif + +#if !defined(__NetBSD__) && !defined(__OpenBSD__) +/* NetBSD and OpenBSD didn't implement wcsnlen() for some reason. */ +#ifndef wcsnlen + (void) wcsnlen; +#endif +#endif + +#ifdef __CYGWIN__ +/* The only depend function on Cygwin, but missing on some other platforms */ +#ifndef strndup + (void) strndup; +#endif +#endif + +#ifndef __sun +/* illumos forget to uncomment some _XPG7 macros. */ +#ifndef renameat + (void) renameat; +#endif + +#ifndef getline + (void) getline; +#endif +#endif /* ! __sun */ + +/* gmtime_r() becomes mandatory only in POSIX.1-2008. */ +#ifndef gmtime_r + (void) gmtime_r; +#endif + +/* unsetenv() actually defined in POSIX.1-2001 so it + * must be present with _XOPEN_SOURCE == 700 too. */ +#ifndef unsetenv + (void) unsetenv; +#endif + + return 0; +} + +" + mhd_cpsxf_tmp_defs_variable=" +${mhd_mse_sys_ext_defines} +" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and without _XOPEN_SOURCE" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 700 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions and with _XOPEN_SOURCE=700" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +#define _ANSI_SOURCE 1 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with disabled extensions, with _POSIX_C_SOURCE=1 and _ANSI_SOURCE=1" >&5 + mhd_cpsxfs_tmp_features_disableable="no" # VAR-FEATURES-DISABLEABLE-YES_NO + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with disabled extensions, with _POSIX_C_SOURCE=1 and _ANSI_SOURCE=1" >&5 + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions and with _XOPEN_SOURCE=700" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions" >&5 + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 700 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=700" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="required" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 700 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=700" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_extentions_allowed="required" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 700 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions and _XOPEN_SOURCE=700" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions and _XOPEN_SOURCE=700" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 700 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=700" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="required" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 700 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=700 and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=700 and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=700" >&5 + mhd_cpsxfs_tmp_features_available="no" # VAR-FEATURES-AVAILABLE-YES_NO + + +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 + { mhd_cpsxf_tmp_defs_variable=; unset mhd_cpsxf_tmp_defs_variable;} + { mhd_cpsxf_tmp_src_variable=; unset mhd_cpsxf_tmp_src_variable;} + + if test "x$mhd_cpsxfs_tmp_features_available" = x"yes"; then : + + if test "x$mhd_cpsxfs_tmp_features_disableable" = x"yes"; then : + + if test "x$mhd_cpsxfs_tmp_extentions_allowed" = x"required"; then : + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_posix2008="available, activated by extension macro, works with _XOPEN_SOURCE=700" + +else + + mhd_cv_headers_posix2008="available, activated by extension macro, does not work with _XOPEN_SOURCE=700" + + +fi + +else + + if test "x$mhd_cpsxfs_tmp_extentions_allowed" = x"allowed"; then : + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"required"; then : + + mhd_cv_headers_posix2008="available, activated by _XOPEN_SOURCE=700, works with extension macro" + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_posix2008="available, works with _XOPEN_SOURCE=700, works with extension macro" + +else + + mhd_cv_headers_posix2008="available, works with extension macro, does not work with _XOPEN_SOURCE=700" + + +fi + + +fi + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"required"; then : + + mhd_cv_headers_posix2008="available, activated by _XOPEN_SOURCE=700, does not work with extension macro" + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_posix2008="available, works with _XOPEN_SOURCE=700, does not work with extension macro" + +else + + mhd_cv_headers_posix2008="available, does not work with _XOPEN_SOURCE=700, does not work with extension macro" + + +fi + + +fi + + +fi + + +fi + +else + + mhd_cv_headers_posix2008="available, works always" + + +fi + +else + + mhd_cv_headers_posix2008="not available" + + +fi + { mhd_cpsxfs_tmp_features_disableable=; unset mhd_cpsxfs_tmp_features_disableable;} + { mhd_cpsxfs_tmp_src_xopen_allowed=; unset mhd_cpsxfs_tmp_src_xopen_allowed;} + { mhd_cpsxfs_tmp_extentions_allowed=; unset mhd_cpsxfs_tmp_extentions_allowed;} + { mhd_cpsxfs_tmp_features_available=; unset mhd_cpsxfs_tmp_features_available;} + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_headers_posix2008" >&5 +$as_echo "$mhd_cv_headers_posix2008" >&6; } + if `echo "${mhd_cv_headers_posix2008}" | $GREP '^available' >/dev/null 2>&1`; then : + + if `echo "${mhd_cv_headers_posix2008}" | $FGREP 'does not work with _XOPEN_SOURCE' >/dev/null 2>&1`; then : + : +else + mhd_mse_xopen_defines="${mhd_mse_xopen_defines}#define _XOPEN_SOURCE 700 +" + if test "x${mhd_mse_xopen_flags}" = "x"; then : + mhd_mse_xopen_flags="_XOPEN_SOURCE=700" +else + mhd_mse_xopen_flags="${mhd_mse_xopen_flags} _XOPEN_SOURCE=700" + +fi + +fi + + mhd_mse_xopen_features="${mhd_cv_headers_posix2008}" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking headers for POSIX.1-2001/SUSv3 features" >&5 +$as_echo_n "checking headers for POSIX.1-2001/SUSv3 features... " >&6; } +if ${mhd_cv_headers_posix2001+:} false; then : + $as_echo_n "(cached) " >&6 +else + + { mhd_cpsxfs_tmp_features_available=; unset mhd_cpsxfs_tmp_features_available;} + { mhd_cpsxfs_tmp_extentions_allowed=; unset mhd_cpsxfs_tmp_extentions_allowed;} + { mhd_cpsxfs_tmp_src_xopen_allowed=; unset mhd_cpsxfs_tmp_src_xopen_allowed;} + { mhd_cpsxfs_tmp_features_disableable=; unset mhd_cpsxfs_tmp_features_disableable;} + mhd_cpsxf_tmp_src_variable=" + + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +/* Check will be passed if ALL features are available + * and failed if ANY feature is not available. */ +int main() +{ + +#ifndef setenv + (void) setenv; +#endif + +#ifndef __NetBSD__ +#ifndef vsscanf + (void) vsscanf; +#endif +#endif + +/* Availability of next features varies, but they all must be present + * on platform with support for _XOPEN_SOURCE = 600. */ + +/* vsnprintf() should be available with _XOPEN_SOURCE >= 500, but some platforms + * provide it only with _POSIX_C_SOURCE >= 200112 (autodefined when + * _XOPEN_SOURCE >= 600) where specification of vsnprintf() is aligned with + * ISO C99 while others platforms defined it with even earlier standards. */ +#ifndef vsnprintf + (void) vsnprintf; +#endif + +/* On platforms that prefer POSIX over X/Open, fseeko() is available + * with _POSIX_C_SOURCE >= 200112 (autodefined when _XOPEN_SOURCE >= 600). + * On other platforms it should be available with _XOPEN_SOURCE >= 500. */ +#ifndef fseeko + (void) fseeko; +#endif + +/* F_GETOWN must be defined with _XOPEN_SOURCE >= 600, but some platforms + * define it with _XOPEN_SOURCE >= 500. */ +#ifndef F_GETOWN +#error F_GETOWN is not defined +choke me now; +#endif + return 0; +} + +" + mhd_cpsxf_tmp_defs_variable=" +${mhd_mse_sys_ext_defines} +" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and without _XOPEN_SOURCE" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 600 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions and with _XOPEN_SOURCE=600" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +#define _ANSI_SOURCE 1 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with disabled extensions, with _POSIX_C_SOURCE=1 and _ANSI_SOURCE=1" >&5 + mhd_cpsxfs_tmp_features_disableable="no" # VAR-FEATURES-DISABLEABLE-YES_NO + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with disabled extensions, with _POSIX_C_SOURCE=1 and _ANSI_SOURCE=1" >&5 + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions and with _XOPEN_SOURCE=600" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions" >&5 + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 600 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=600" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="required" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 600 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=600" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_extentions_allowed="required" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 600 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions and _XOPEN_SOURCE=600" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions and _XOPEN_SOURCE=600" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 600 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=600" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="required" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 600 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=600 and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=600 and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=600" >&5 + mhd_cpsxfs_tmp_features_available="no" # VAR-FEATURES-AVAILABLE-YES_NO + + +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 + { mhd_cpsxf_tmp_defs_variable=; unset mhd_cpsxf_tmp_defs_variable;} + { mhd_cpsxf_tmp_src_variable=; unset mhd_cpsxf_tmp_src_variable;} + + if test "x$mhd_cpsxfs_tmp_features_available" = x"yes"; then : + + if test "x$mhd_cpsxfs_tmp_features_disableable" = x"yes"; then : + + if test "x$mhd_cpsxfs_tmp_extentions_allowed" = x"required"; then : + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_posix2001="available, activated by extension macro, works with _XOPEN_SOURCE=600" + +else + + mhd_cv_headers_posix2001="available, activated by extension macro, does not work with _XOPEN_SOURCE=600" + + +fi + +else + + if test "x$mhd_cpsxfs_tmp_extentions_allowed" = x"allowed"; then : + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"required"; then : + + mhd_cv_headers_posix2001="available, activated by _XOPEN_SOURCE=600, works with extension macro" + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_posix2001="available, works with _XOPEN_SOURCE=600, works with extension macro" + +else + + mhd_cv_headers_posix2001="available, works with extension macro, does not work with _XOPEN_SOURCE=600" + + +fi + + +fi + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"required"; then : + + mhd_cv_headers_posix2001="available, activated by _XOPEN_SOURCE=600, does not work with extension macro" + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_posix2001="available, works with _XOPEN_SOURCE=600, does not work with extension macro" + +else + + mhd_cv_headers_posix2001="available, does not work with _XOPEN_SOURCE=600, does not work with extension macro" + + +fi + + +fi + + +fi + + +fi + +else + + mhd_cv_headers_posix2001="available, works always" + + +fi + +else + + mhd_cv_headers_posix2001="not available" + + +fi + { mhd_cpsxfs_tmp_features_disableable=; unset mhd_cpsxfs_tmp_features_disableable;} + { mhd_cpsxfs_tmp_src_xopen_allowed=; unset mhd_cpsxfs_tmp_src_xopen_allowed;} + { mhd_cpsxfs_tmp_extentions_allowed=; unset mhd_cpsxfs_tmp_extentions_allowed;} + { mhd_cpsxfs_tmp_features_available=; unset mhd_cpsxfs_tmp_features_available;} + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_headers_posix2001" >&5 +$as_echo "$mhd_cv_headers_posix2001" >&6; } + if `echo "${mhd_cv_headers_posix2001}" | $GREP '^available' >/dev/null 2>&1`; then : + + if `echo "${mhd_cv_headers_posix2001}" | $FGREP 'does not work with _XOPEN_SOURCE' >/dev/null 2>&1`; then : + : +else + mhd_mse_xopen_defines="${mhd_mse_xopen_defines}#define _XOPEN_SOURCE 600 +" + if test "x${mhd_mse_xopen_flags}" = "x"; then : + mhd_mse_xopen_flags="_XOPEN_SOURCE=600" +else + mhd_mse_xopen_flags="${mhd_mse_xopen_flags} _XOPEN_SOURCE=600" + +fi + +fi + + mhd_mse_xopen_features="${mhd_cv_headers_posix2001}" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking headers for SUSv2/XPG5 features" >&5 +$as_echo_n "checking headers for SUSv2/XPG5 features... " >&6; } +if ${mhd_cv_headers_susv2+:} false; then : + $as_echo_n "(cached) " >&6 +else + + { mhd_cpsxfs_tmp_features_available=; unset mhd_cpsxfs_tmp_features_available;} + { mhd_cpsxfs_tmp_extentions_allowed=; unset mhd_cpsxfs_tmp_extentions_allowed;} + { mhd_cpsxfs_tmp_src_xopen_allowed=; unset mhd_cpsxfs_tmp_src_xopen_allowed;} + { mhd_cpsxfs_tmp_features_disableable=; unset mhd_cpsxfs_tmp_features_disableable;} + mhd_cpsxf_tmp_src_variable=" + + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +/* Check will be passed if ALL features are available + * and failed if ANY feature is not available. */ +int main() +{ +/* It's not easy to write reliable test for _XOPEN_SOURCE = 500 as + * platforms not always precisely follow this standard and some + * functions are already deprecated in later standards. */ + +/* Availability of next features varies, but they all must be present + * on platform with correct support for _XOPEN_SOURCE = 500. */ + +/* Mandatory with _XOPEN_SOURCE >= 500 but as XSI extension available + * with much older standards. */ +#ifndef ftruncate + (void) ftruncate; +#endif + +/* Added with _XOPEN_SOURCE >= 500 but was available in some standards + * before. XSI extension. */ +#ifndef pread + (void) pread; +#endif + +#ifndef __APPLE__ +/* Actually comes from XPG4v2 and must be available + * with _XOPEN_SOURCE >= 500 as well. */ +#ifndef symlink + (void) symlink; +#endif + +/* Actually comes from XPG4v2 and must be available + * with _XOPEN_SOURCE >= 500 as well. XSI extension. */ +#ifndef strdup + (void) strdup; +#endif +#endif /* ! __APPLE__ */ + return 0; +} + +" + mhd_cpsxf_tmp_defs_variable=" +${mhd_mse_sys_ext_defines} +" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with undefined all extensions and without _XOPEN_SOURCE" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 500 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions and with _XOPEN_SOURCE=500" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_undef_all_extensions + +#define _POSIX_C_SOURCE 1 +#define _ANSI_SOURCE 1 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with disabled extensions, with _POSIX_C_SOURCE=1 and _ANSI_SOURCE=1" >&5 + mhd_cpsxfs_tmp_features_disableable="no" # VAR-FEATURES-DISABLEABLE-YES_NO + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with disabled extensions, with _POSIX_C_SOURCE=1 and _ANSI_SOURCE=1" >&5 + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions and with _XOPEN_SOURCE=500" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions" >&5 + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 500 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=500" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="required" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 500 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=500" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with undefined all extensions and without _XOPEN_SOURCE" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + mhd_cpsxfs_tmp_features_disableable="yes" # VAR-FEATURES-DISABLEABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_extentions_allowed="required" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 500 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with extensions and _XOPEN_SOURCE=500" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions and _XOPEN_SOURCE=500" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="not allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with extensions" >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE 500 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=500" >&5 + mhd_cpsxfs_tmp_features_available="yes" # VAR-FEATURES-AVAILABLE-YES_NO + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="allowed" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT by default" >&5 + mhd_cpsxfs_tmp_src_xopen_allowed="required" # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +$mhd_cpsxf_tmp_defs_variable +#define _XOPEN_SOURCE 500 +$mhd_cpsxf_tmp_src_variable + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features work with _XOPEN_SOURCE=500 and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=500 and extensions" >&5 + mhd_cpsxfs_tmp_extentions_allowed="not allowed" # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + $as_echo "$as_me:${as_lineno-$LINENO}: Checked features DO NOT work with _XOPEN_SOURCE=500" >&5 + mhd_cpsxfs_tmp_features_available="no" # VAR-FEATURES-AVAILABLE-YES_NO + + +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 + { mhd_cpsxf_tmp_defs_variable=; unset mhd_cpsxf_tmp_defs_variable;} + { mhd_cpsxf_tmp_src_variable=; unset mhd_cpsxf_tmp_src_variable;} + + if test "x$mhd_cpsxfs_tmp_features_available" = x"yes"; then : + + if test "x$mhd_cpsxfs_tmp_features_disableable" = x"yes"; then : + + if test "x$mhd_cpsxfs_tmp_extentions_allowed" = x"required"; then : + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_susv2="available, activated by extension macro, works with _XOPEN_SOURCE=500" + +else + + mhd_cv_headers_susv2="available, activated by extension macro, does not work with _XOPEN_SOURCE=500" + + +fi + +else + + if test "x$mhd_cpsxfs_tmp_extentions_allowed" = x"allowed"; then : + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"required"; then : + + mhd_cv_headers_susv2="available, activated by _XOPEN_SOURCE=500, works with extension macro" + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_susv2="available, works with _XOPEN_SOURCE=500, works with extension macro" + +else + + mhd_cv_headers_susv2="available, works with extension macro, does not work with _XOPEN_SOURCE=500" + + +fi + + +fi + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"required"; then : + + mhd_cv_headers_susv2="available, activated by _XOPEN_SOURCE=500, does not work with extension macro" + +else + + if test "x$mhd_cpsxfs_tmp_src_xopen_allowed" = x"allowed"; then : + + mhd_cv_headers_susv2="available, works with _XOPEN_SOURCE=500, does not work with extension macro" + +else + + mhd_cv_headers_susv2="available, does not work with _XOPEN_SOURCE=500, does not work with extension macro" + + +fi + + +fi + + +fi + + +fi + +else + + mhd_cv_headers_susv2="available, works always" + + +fi + +else + + mhd_cv_headers_susv2="not available" + + +fi + { mhd_cpsxfs_tmp_features_disableable=; unset mhd_cpsxfs_tmp_features_disableable;} + { mhd_cpsxfs_tmp_src_xopen_allowed=; unset mhd_cpsxfs_tmp_src_xopen_allowed;} + { mhd_cpsxfs_tmp_extentions_allowed=; unset mhd_cpsxfs_tmp_extentions_allowed;} + { mhd_cpsxfs_tmp_features_available=; unset mhd_cpsxfs_tmp_features_available;} + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_headers_susv2" >&5 +$as_echo "$mhd_cv_headers_susv2" >&6; } + if `echo "${mhd_cv_headers_susv2}" | $GREP '^available' >/dev/null 2>&1`; then : + + if `echo "${mhd_cv_headers_susv2}" | $FGREP 'does not work with _XOPEN_SOURCE' >/dev/null 2>&1`; then : + : +else + mhd_mse_xopen_defines="${mhd_mse_xopen_defines}#define _XOPEN_SOURCE 500 +" + if test "x${mhd_mse_xopen_flags}" = "x"; then : + mhd_mse_xopen_flags="_XOPEN_SOURCE=500" +else + mhd_mse_xopen_flags="${mhd_mse_xopen_flags} _XOPEN_SOURCE=500" + +fi + +fi + + mhd_mse_xopen_features="${mhd_cv_headers_susv2}" + +else + mhd_mse_xopen_features="${mhd_cv_headers_susv2}" + + +fi + + + + + +fi + + + + + +fi + + + + +fi + + if test "x${mhd_cv_macro__xopen_source_defined}" = "xno" && \ + test "x${mhd_cv_macro__xopen_source_def_fiveh}" = "xno" || \ + test "x${mhd_mse_xopen_features}" = "xnot available" ; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE is already defined" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE is already defined... " >&6; } +if ${mhd_cv_macro__xopen_source_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#ifndef _XOPEN_SOURCE +#error _XOPEN_SOURCE is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_source_defined="yes" +else + mhd_cv_macro__xopen_source_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_source_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_source_defined" >&6; } + if test "x$mhd_cv_macro__xopen_source_defined" = x"yes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether predefined value of _XOPEN_SOURCE is more or equal 500" >&5 +$as_echo_n "checking whether predefined value of _XOPEN_SOURCE is more or equal 500... " >&6; } +if ${mhd_cv_macro__xopen_source_def_fiveh+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#if _XOPEN_SOURCE+0 < 500 +#error Value of _XOPEN_SOURCE is less than 500 +choke me now; +#endif + +int +main () +{ +int i = 0; i++; if(i) return i + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_source_def_fiveh="yes" +else + mhd_cv_macro__xopen_source_def_fiveh="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_source_def_fiveh" >&5 +$as_echo "$mhd_cv_macro__xopen_source_def_fiveh" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _XOPEN_SOURCE with value 1" >&5 +$as_echo_n "checking whether headers accept _XOPEN_SOURCE with value 1... " >&6; } +if ${mhd_cv_define__xopen_source_accepted_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +#define _XOPEN_SOURCE 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_source_accepted_1="yes" +else + mhd_cv_define__xopen_source_accepted_1="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_accepted_1" >&5 +$as_echo "$mhd_cv_define__xopen_source_accepted_1" >&6; } + if test "x$mhd_cv_define__xopen_source_accepted_1" = x"yes"; then : + mhd_mse_xopen_defines="${mhd_mse_xopen_defines}#define _XOPEN_SOURCE 1 +" + if test "x${mhd_mse_xopen_flags}" = "x"; then : + mhd_mse_xopen_flags="_XOPEN_SOURCE=1" +else + mhd_mse_xopen_flags="${mhd_mse_xopen_flags} _XOPEN_SOURCE=1" + +fi + +fi + +fi + + if test "x${mhd_cv_define__xopen_source_accepted_1}" = "xyes" || \ + test "x${mhd_cv_macro__xopen_source_def_fiveh}" = "xno"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE_EXTENDED is already defined" >&5 +$as_echo_n "checking whether _XOPEN_SOURCE_EXTENDED is already defined... " >&6; } +if ${mhd_cv_macro__xopen_source_extended_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +${mhd_mse_sys_ext_defines} + +#ifndef _XOPEN_SOURCE_EXTENDED +#error _XOPEN_SOURCE_EXTENDED is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_source_extended_defined="yes" +else + mhd_cv_macro__xopen_source_extended_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_source_extended_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_source_extended_defined" >&6; } + if test "x$mhd_cv_macro__xopen_source_extended_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether headers accept _XOPEN_SOURCE_EXTENDED" >&5 +$as_echo_n "checking whether headers accept _XOPEN_SOURCE_EXTENDED... " >&6; } +if ${mhd_cv_define__xopen_source_extended_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +${mhd_mse_sys_ext_defines} + +#define _XOPEN_SOURCE_EXTENDED 1 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_source_extended_accepted="yes" +else + mhd_cv_define__xopen_source_extended_accepted="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_source_extended_accepted" >&5 +$as_echo "$mhd_cv_define__xopen_source_extended_accepted" >&6; } + if test "x$mhd_cv_define__xopen_source_extended_accepted" = x"yes"; then : + mhd_mse_xopen_defines="${mhd_mse_xopen_defines}#define _XOPEN_SOURCE_EXTENDED 1 +" + if test "x${mhd_mse_xopen_flags}" = "x"; then : + mhd_mse_xopen_flags="_XOPEN_SOURCE_EXTENDED" +else + mhd_mse_xopen_flags="${mhd_mse_xopen_flags} _XOPEN_SOURCE_EXTENDED" + +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_VERSION is already defined" >&5 +$as_echo_n "checking whether _XOPEN_VERSION is already defined... " >&6; } +if ${mhd_cv_macro__xopen_version_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +${mhd_mse_sys_ext_defines} + +#ifndef _XOPEN_VERSION +#error _XOPEN_VERSION is not defined +choke me now; +#endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro__xopen_version_defined="yes" +else + mhd_cv_macro__xopen_version_defined="no" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro__xopen_version_defined" >&5 +$as_echo "$mhd_cv_macro__xopen_version_defined" >&6; } + if test "x$mhd_cv_macro__xopen_version_defined" = x"yes"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for value of _XOPEN_VERSION accepted by headers" >&5 +$as_echo_n "checking for value of _XOPEN_VERSION accepted by headers... " >&6; } +if ${mhd_cv_define__xopen_version_accepted+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} + +#define _XOPEN_VERSION 4 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_version_accepted="4" +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} + +#define _XOPEN_VERSION 3 + /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ + + +int +main () +{ +int i = 1; i++; if(i) return i + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_define__xopen_version_accepted="3" +else + mhd_cv_define__xopen_version_accepted="no" + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_define__xopen_version_accepted" >&5 +$as_echo "$mhd_cv_define__xopen_version_accepted" >&6; } + if test "x$mhd_cv_define__xopen_version_accepted" = x"no"; then : + : +else + mhd_mse_xopen_defines="${mhd_mse_xopen_defines}#define _XOPEN_VERSION ${mhd_cv_define__xopen_version_accepted} +" + if test "x${mhd_mse_xopen_flags}" = "x"; then : + mhd_mse_xopen_flags="_XOPEN_VERSION=${mhd_cv_define__xopen_version_accepted}" +else + mhd_mse_xopen_flags="${mhd_mse_xopen_flags} _XOPEN_VERSION=${mhd_cv_define__xopen_version_accepted}" + +fi + +fi + +fi + + +fi + +fi + + + +fi + + +fi + + mhd_mse_sys_features_src=" +#ifdef __APPLE__ +#include +#else +#error No useful system features. +choke me now; +#endif + +int main() +{ +#ifdef __APPLE__ +#ifndef sendfile + (void) sendfile; +#endif +#endif + return 0; +} +" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for useful system-specific features" >&5 +$as_echo_n "checking for useful system-specific features... " >&6; } +if ${mhd_cv_headers_useful_features_present+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +${mhd_mse_sys_features_src} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_headers_useful_features_present="yes" +else + mhd_cv_headers_useful_features_present="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_headers_useful_features_present" >&5 +$as_echo "$mhd_cv_headers_useful_features_present" >&6; } + if test "x$mhd_cv_headers_useful_features_present" = x"yes"; then : + + if test "x${mhd_mse_xopen_flags}" = "x"; then : + : +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether useful system-specific features works with ${mhd_mse_xopen_flags}" >&5 +$as_echo_n "checking whether useful system-specific features works with ${mhd_mse_xopen_flags}... " >&6; } +if ${mhd_cv_headers_useful_features_works_xopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +${mhd_mse_sys_ext_defines} +${mhd_mse_xopen_defines} +${mhd_mse_sys_features_src} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_headers_useful_features_works_xopen="yes" +else + mhd_cv_headers_useful_features_works_xopen="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_headers_useful_features_works_xopen" >&5 +$as_echo "$mhd_cv_headers_useful_features_works_xopen" >&6; } + +fi + +fi + + + if test "x${mhd_cv_headers_useful_features_present}" = "xyes" && \ + test "x${mhd_cv_headers_useful_features_works_xopen}" = "xno" && \ + test "x${mhd_mse_xopen_flags}" != "x"; then : + + if `echo "${mhd_mse_xopen_features}" | $FGREP ', activated by _XOPEN_SOURCE' >/dev/null 2>&1`; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: _XOPEN_SOURCE macro is required to activate all headers symbols, however some useful system-specific features does not work with _XOPEN_SOURCE. _XOPEN_SOURCE macro will not be used." >&5 +$as_echo "$as_me: WARNING: _XOPEN_SOURCE macro is required to activate all headers symbols, however some useful system-specific features does not work with _XOPEN_SOURCE. _XOPEN_SOURCE macro will not be used." >&2;} + + +fi + + { mhd_mse_xopen_defines=; unset mhd_mse_xopen_defines;} + { mhd_mse_xopen_flags=; unset mhd_mse_xopen_flags;} + { mhd_mse_xopen_values=; unset mhd_mse_xopen_values;} + + +fi + + { mhd_mse_sys_features_src=; unset mhd_mse_sys_features_src;} + { mhd_mse_xopen_defines=; unset mhd_mse_xopen_defines;} + { mhd_mse_sys_ext_defines=; unset mhd_mse_sys_ext_defines;} + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for final set of defined symbols" >&5 +$as_echo_n "checking for final set of defined symbols... " >&6; } + + for mhd_mse_Flag in ${mhd_mse_sys_ext_flags} ${mhd_mse_xopen_flags} + do + case $mhd_mse_Flag in #( + *=*) : + cat >>confdefs.h <<_ACEOF +#define `echo $mhd_mse_Flag | cut -f 1 -d =` `echo $mhd_mse_Flag | cut -f 2 -d = -s` +_ACEOF + + ;; #( + *) : + cat >>confdefs.h <<_ACEOF +#define $mhd_mse_Flag 1 +_ACEOF + + ;; +esac + + done + { mhd_mse_Flag=; unset mhd_mse_Flag;} + mhd_mse_result=`echo ${mhd_mse_sys_ext_flags} ${mhd_mse_xopen_flags}` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mhd_mse_result}" >&5 +$as_echo "${mhd_mse_result}" >&6; } + { mhd_mse_result=; unset mhd_mse_result;} + { mhd_mse_xopen_flags=; unset mhd_mse_xopen_flags;} + { mhd_mse_sys_ext_flags=; unset mhd_mse_sys_ext_flags;} + 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 + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.6' +macro_revision='2.4.6' + + + + + + + + + + + + + +ltmain=$ac_aux_dir/ltmain.sh + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case $ECHO in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_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 +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_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_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + 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" + as_fn_executable_p "$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 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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 + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +$as_echo "$with_sysroot" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +$as_echo_n "checking for a working dd... " >&6; } +if ${ac_cv_path_lt_DD+:} false; then : + $as_echo_n "(cached) " >&6 +else + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_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 +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in dd; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi +else + ac_cv_path_lt_DD=$lt_DD +fi + +rm -f conftest.i conftest2.i conftest.out +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +$as_echo "$ac_cv_path_lt_DD" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +$as_echo_n "checking how to truncate binary pipes... " >&6; } +if ${lt_cv_truncate_bin+:} false; then : + $as_echo_n "(cached) " >&6 +else + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +$as_echo "$lt_cv_truncate_bin" >&6; } + + + + + + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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 + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[012][,.]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#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 +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options +enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AS="${ac_tool_prefix}as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AS=$ac_cv_prog_AS +if test -n "$AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +$as_echo "$AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AS"; then + ac_ct_AS=$AS + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AS"; then + ac_cv_prog_ac_ct_AS="$ac_ct_AS" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AS="as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AS=$ac_cv_prog_ac_ct_AS +if test -n "$ac_ct_AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +$as_echo "$ac_ct_AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AS" = x; then + AS="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AS=$ac_ct_AS + fi +else + AS="$ac_cv_prog_AS" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + + ;; +esac + +test -z "$AS" && AS=as + + + + + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + enable_dlopen=no + + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + pic_mode=default +fi + + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } + +# Check whether --with-aix-soname was given. +if test "${with_aix_soname+set}" = set; then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else + if ${lt_cv_with_aix_soname+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_with_aix_soname=aix +fi + + with_aix_soname=$lt_cv_with_aix_soname +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +$as_echo "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/${ac_tool_prefix}file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC=$CC +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works"; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works"; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test no = "$hard_links"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='$wl--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + export_dynamic_flag_spec='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test no = "$ld_shlibs"; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' $wl-bernotok' + allow_undefined_flag=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test yes = "$GCC"; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test yes = "$lt_cv_prog_compiler__b"; then + archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test yes = "$lt_cv_irix_exported_symbol"; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + link_all_deplibs=no + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + else + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; + + osf3*) + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='$wl-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='$wl-z,text' + allow_undefined_flag='$wl-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='$wl-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test no = "$ld_shlibs" && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([A-Za-z]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test yes = "$hardcode_automatic"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else + + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen=shl_load +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen=dlopen +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report what library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +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 + +CC=$lt_save_CC + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. +set dummy ${ac_tool_prefix}windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RC"; then + ac_cv_prog_RC="$RC" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RC="${ac_tool_prefix}windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RC=$ac_cv_prog_RC +if test -n "$RC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 +$as_echo "$RC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RC"; then + ac_ct_RC=$RC + # Extract the first word of "windres", so it can be a program name with args. +set dummy windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RC"; then + ac_cv_prog_ac_ct_RC="$ac_ct_RC" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RC="windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RC=$ac_cv_prog_ac_ct_RC +if test -n "$ac_ct_RC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 +$as_echo "$ac_ct_RC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RC" = x; then + RC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RC=$ac_ct_RC + fi +else + RC="$ac_cv_prog_RC" +fi + + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code=$lt_simple_compile_test_code + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +compiler_RC=$CC +func_cc_basename $compiler +cc_basename=$func_cc_basename_result + +lt_cv_prog_compiler_c_o_RC=yes + +if test -n "$compiler"; then + : + + + +fi + +GCC=$lt_save_GCC +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 + +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS + + +# Workaround for libgcrypt +if test "x$lt_sysroot" != "x" && test "x$SYSROOT" = "x"; then : + SYSROOT="$lt_sysroot" +fi + +PACKAGE_VERSION_MAJOR='0' +PACKAGE_VERSION_MINOR='9' +PACKAGE_VERSION_SUBMINOR='59' +as_fn_arith $LIB_VERSION_CURRENT - $LIB_VERSION_AGE && MHD_W32_DLL_SUFF=$as_val + + + + +ac_config_files="$ac_config_files src/microhttpd/microhttpd_dll_res.rc" + + +MHD_LIB_CPPFLAGS="" +MHD_LIB_CFLAGS="" +MHD_LIB_LDFLAGS="" +MHD_LIBDEPS="" +# for pkg-config +MHD_REQ_PRIVATE='' +MHD_LIBDEPS_PKGCFG='' + + + + +ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default + +" +if test "x$ac_cv_header_stdbool_h" = xyes; then : + + ac_fn_c_check_type "$LINENO" "bool" "ac_cv_type_bool" " +#include + + +" +if test "x$ac_cv_type_bool" = xyes; then : + + $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h + + $as_echo "#define HAVE_REAL_BOOL 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Header is present, but \"bool\" type cannot be detected. Check compiler flags." >&5 +$as_echo "$as_me: WARNING: Header is present, but \"bool\" type cannot be detected. Check compiler flags." >&2;} + $as_echo "#define bool int" >>confdefs.h + + +fi + + +else + + ac_fn_c_check_type "$LINENO" "bool" "ac_cv_type_bool" " + +" +if test "x$ac_cv_type_bool" = xyes; then : + $as_echo "#define HAVE_REAL_BOOL 1" >>confdefs.h + +else + + ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" " + +" +if test "x$ac_cv_type__Bool" = xyes; then : + + $as_echo "#define HAVE_REAL_BOOL 1" >>confdefs.h + + $as_echo "#define bool _Bool" >>confdefs.h + + +else + + $as_echo "#define bool int" >>confdefs.h + + +fi + + +fi + + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"true\" is defined or builtin" >&5 +$as_echo_n "checking whether \"true\" is defined or builtin... " >&6; } +if ${mhd_cv_macro_true_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_STDBOOL_H +#include +#endif + +int +main () +{ + +#if defined(true) + /* dummy */ +#else + (void)true; +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_true_defined='yes' +else + mhd_cv_macro_true_defined='no' +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_true_defined" >&5 +$as_echo "$mhd_cv_macro_true_defined" >&6; } +if test "x$mhd_cv_macro_true_defined" = x"yes"; then : + : +else + +$as_echo "#define true (!0)" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"false\" is defined or builtin" >&5 +$as_echo_n "checking whether \"false\" is defined or builtin... " >&6; } +if ${mhd_cv_macro_false_defined+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_STDBOOL_H +#include +#endif + +int +main () +{ + +#if !defined(false) + (void)false; +#else + /* dummy */ +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_false_defined='yes' +else + mhd_cv_macro_false_defined='no' +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_false_defined" >&5 +$as_echo "$mhd_cv_macro_false_defined" >&6; } +if test "x$mhd_cv_macro_false_defined" = x"yes"; then : + : +else + +$as_echo "#define false 0" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"true\" and \"false\" could be used" >&5 +$as_echo_n "checking whether \"true\" and \"false\" could be used... " >&6; } +if ${mhd_cv_macro_true_false_valid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_STDBOOL_H +#include +#endif + +int +main () +{ + + int var1[true ? 1 : -1] = { 1 }; + int var2[false ? -1 : 1] = { 2 }; + int var3[!true ? -1 : 1] = { 3 }; + int var4[!false ? 1 : -1] = { 4 }; + if (var1[0] == var2[0] || var3[0] == var4[0]) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_macro_true_false_valid='yes' +else + mhd_cv_macro_true_false_valid='no' +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_macro_true_false_valid" >&5 +$as_echo "$mhd_cv_macro_true_false_valid" >&6; } +if test "x$mhd_cv_macro_true_false_valid" = x"yes"; then : + : +else + as_fn_error $? "Value of \"true\" or value of \"false\" is not valid. Check config.log for details." "$LINENO" 5 +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=attributes" >&5 +$as_echo_n "checking whether C compiler accepts -Werror=attributes... " >&6; } +if ${ax_cv_check_cflags___Werror_attributes+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Werror=attributes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___Werror_attributes=yes +else + ax_cv_check_cflags___Werror_attributes=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Werror_attributes" >&5 +$as_echo "$ax_cv_check_cflags___Werror_attributes" >&6; } +if test "x$ax_cv_check_cflags___Werror_attributes" = xyes; then : + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror=attributes" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Werror=attributes actually works" >&5 +$as_echo_n "checking whether -Werror=attributes actually works... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__attribute__((non_existing_attrb_dummy)) int SimpleFunc(void) {return 3;} +int +main () +{ +int r = SimpleFunc(); if (r) return r; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + errattr_CFLAGS="" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + errattr_CFLAGS="-Werror=attributes" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + +else + errattr_CFLAGS="" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for function inline keywords suppoted by $CC" >&5 +$as_echo_n "checking for function inline keywords suppoted by $CC... " >&6; } +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $errattr_CFLAGS" +inln_prfx="none" +# Prefer always inline functions +for inln_prfx_chk in InlineWithAttr __forceinline inline __inline__ __inline _inline _Inline; do + # Try to link to avoid "symbol undefined" problems at build time + if test "x$inln_prfx_chk" = "xInlineWithAttr"; then : + + if test "x$errattr_CFLAGS" = "x"; then : + # Skip test with attribute as negative result can't be detected + inln_prfx_chk="__forceinline" # use next value + +else + inln_prfx_chk="inline __attribute__((always_inline))" +fi + +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef __cplusplus +#error This test is only for C. +choke me +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif + static $inln_prfx_chk bool cmpfn(int x, int y) + { return x > y; } + static $inln_prfx_chk int sumfn(int x, int y) + { return x + y; } + +int +main () +{ + + int a = 1, b = 100, c; + if (cmpfn(a, b)) + c = sumfn(a, b); + else + c = 0 - sumfn(a, b); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + inln_prfx="$inln_prfx_chk" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + test "x$inln_prfx" != "xnone" && break +done +if test "x$inln_prfx" != "xnone"; then : + + +$as_echo "#define INLINE_FUNC 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define _MHD_static_inline static $inln_prfx +_ACEOF + + +else + + +$as_echo "#define _MHD_static_inline static" >>confdefs.h + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $inln_prfx" >&5 +$as_echo "$inln_prfx" >&6; } +CFLAGS="$save_CFLAGS" + +# Check system type +shutdown_trig_select='no' +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for target host OS" >&5 +$as_echo_n "checking for target host OS... " >&6; } +case "$host_os" in +*darwin* | *rhapsody* | *macosx*) + +cat >>confdefs.h <<_ACEOF +#define OSX 1 +_ACEOF + + CFLAGS="-no-cpp-precomp -fno-common $CFLAGS" + mhd_host_os='Darwin' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +freebsd*) + +cat >>confdefs.h <<_ACEOF +#define SOMEBSD 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define FREEBSD 1 +_ACEOF + + mhd_host_os='FreeBSD' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +openbsd*) + +cat >>confdefs.h <<_ACEOF +#define SOMEBSD 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define OPENBSD 1 +_ACEOF + + mhd_host_os='OpenBSD' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +netbsd*) + +cat >>confdefs.h <<_ACEOF +#define SOMEBSD 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define NETBSD 1 +_ACEOF + + mhd_host_os='NetBSD' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +*solaris*) + +cat >>confdefs.h <<_ACEOF +#define SOLARIS 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define _REENTRANT 1 +_ACEOF + + mhd_host_os='Solaris' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 +$as_echo_n "checking for library containing gethostbyname... " >&6; } +if ${ac_cv_search_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 gethostbyname (); +int +main () +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_gethostbyname=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_gethostbyname+:} false; then : + break +fi +done +if ${ac_cv_search_gethostbyname+:} false; then : + +else + ac_cv_search_gethostbyname=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 +$as_echo "$ac_cv_search_gethostbyname" >&6; } +ac_res=$ac_cv_search_gethostbyname +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if ${ac_cv_search_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_socket+:} false; then : + break +fi +done +if ${ac_cv_search_socket+:} false; then : + +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + ;; +*arm-linux*) + +cat >>confdefs.h <<_ACEOF +#define LINUX 1 +_ACEOF + + mhd_host_os='ARM Linux' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + CFLAGS="-fPIC -pipe $CFLAGS" + ;; +*linux*) + +cat >>confdefs.h <<_ACEOF +#define LINUX 1 +_ACEOF + + mhd_host_os='Linux' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +*cygwin*) + +cat >>confdefs.h <<_ACEOF +#define CYGWIN 1 +_ACEOF + + mhd_host_os='Windows (Cygwin)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + os_is_windows=yes + ;; +*mingw*) + +cat >>confdefs.h <<_ACEOF +#define MINGW 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define WINDOWS 1 +_ACEOF + + mhd_host_os='Windows (MinGW)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + LIBS="$LIBS -lws2_32" + for ac_header in winsock2.h ws2tcpip.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error $? "Winsock2 headers are required for W32" "$LINENO" 5 +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MS lib utility" >&5 +$as_echo_n "checking for MS lib utility... " >&6; } +if ${ac_cv_use_ms_lib_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + mslibcheck=`lib 2>&1` + if [[ $mslibcheck = "Microsoft (R) Library Manager"* ]]; then + ac_cv_use_ms_lib_tool=yes + else + ac_cv_use_ms_lib_tool=no + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_use_ms_lib_tool" >&5 +$as_echo "$ac_cv_use_ms_lib_tool" >&6; } + if test "x$ac_cv_use_ms_lib_tool" = "xyes"; then + MS_LIB_TOOL=lib + + fi + + os_is_windows=yes + os_is_native_w32=yes + ;; +*openedition*) + +cat >>confdefs.h <<_ACEOF +#define OS390 1 +_ACEOF + + mhd_host_os='OS/390' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +gnu*) + +$as_echo "#define GNU_HURD 1" >>confdefs.h + + mhd_host_os='GNU Hurd' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + ;; +*) + mhd_host_os='unrecognised OS' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_host_os" >&5 +$as_echo "$mhd_host_os" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unrecognised OS $host_os" >&5 +$as_echo "$as_me: WARNING: Unrecognised OS $host_os" >&2;} + +cat >>confdefs.h <<_ACEOF +#define OTHEROS 1 +_ACEOF + +;; +esac + + if test "x$os_is_windows" = "xyes" && \ + test "x${os_is_native_w32}" != "xyes"; then + CYGWIN_TARGET_TRUE= + CYGWIN_TARGET_FALSE='#' +else + CYGWIN_TARGET_TRUE='#' + CYGWIN_TARGET_FALSE= +fi + + + +# Check whether --with-threads was given. +if test "${with_threads+set}" = set; then : + withval=$with_threads; +else + with_threads='auto' +fi + +case $with_threads in #( + win32) : + with_threads='w32' ;; #( + pthreads) : + with_threads='posix' ;; #( + posix) : + : ;; #( + w32) : + : ;; #( + auto) : + : ;; #( + *) : + as_fn_error $? "incorrect parameter \"$with_threads\" specified for --with-threads" "$LINENO" 5 + ;; +esac + +# Check for posix threads support, regardless of configure parameters as +# testsuite use only posix threads. + + + + +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 + +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + if test "x$PTHREAD_CC" != "x"; then : + CC="$PTHREAD_CC" +fi + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 +$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 pthread_join (); +int +main () +{ +return pthread_join (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_pthread_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 +$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} +fi +rm -f conftest* + + ;; + + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; +esac + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +if test "x$GCC" = "xyes"; then : + ax_pthread_flags="-pthread -pthreads $ax_pthread_flags" +fi + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; + + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +if test "x$ax_pthread_check_macro" = "x--"; then : + ax_pthread_check_cond=0 +else + ax_pthread_check_cond="!defined($ax_pthread_check_macro)" +fi + +# Are we compiling with Clang? + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 +$as_echo_n "checking whether $CC is Clang... " >&6; } +if ${ax_cv_PTHREAD_CLANG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then : + ax_cv_PTHREAD_CLANG=yes +fi +rm -f conftest* + + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG" >&6; } +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + +ax_pthread_clang_warning=no + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 +$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } +if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + if test "x$ax_pthread_try" = "xunknown"; then : + break +fi + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_link="$ax_pthread_2step_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + if test "x$ax_pthread_try" = "x"; then : + ax_pthread_try=no +fi + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 +$as_echo_n "checking whether pthreads work without any flags... " >&6; } + ;; + + -mt,pthread) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with -mt -lpthread" >&5 +$as_echo_n "checking whether pthreads work with -mt -lpthread... " >&6; } + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + + -*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 +$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. +set dummy pthread-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ax_pthread_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ax_pthread_config"; then + ac_cv_prog_ax_pthread_config="$ax_pthread_config" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ax_pthread_config="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" +fi +fi +ax_pthread_config=$ac_cv_prog_ax_pthread_config +if test -n "$ax_pthread_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 +$as_echo "$ax_pthread_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$ax_pthread_config" = "xno"; then : + continue +fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 +$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; } +int +main () +{ +pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_pthread_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xyes"; then : + break +fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 +$as_echo_n "checking for joinable pthread attribute... " >&6; } +if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int attr = $ax_pthread_attr; return attr /* ; */ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 +$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } + if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"; then : + +cat >>confdefs.h <<_ACEOF +#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR +_ACEOF + + ax_pthread_joinable_attr_defined=yes + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 +$as_echo_n "checking whether more special flags are required for pthreads... " >&6; } +if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 +$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } + if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"; then : + PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int i = PTHREAD_PRIO_INHERIT; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_PRIO_INHERIT=yes +else + ax_cv_PTHREAD_PRIO_INHERIT=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"; then : + +$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + + ax_pthread_prio_inherit_defined=yes + +fi + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + case "x/$CC" in #( + x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : + #handle absolute path differently from PATH based program lookup + case "x$CC" in #( + x/*) : + if as_fn_executable_p ${CC}_r; then : + PTHREAD_CC="${CC}_r" +fi ;; #( + *) : + for ac_prog in ${CC}_r +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PTHREAD_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PTHREAD_CC"; then + ac_cv_prog_PTHREAD_CC="$PTHREAD_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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PTHREAD_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PTHREAD_CC=$ac_cv_prog_PTHREAD_CC +if test -n "$PTHREAD_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 +$as_echo "$PTHREAD_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$PTHREAD_CC" && break +done +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + ;; +esac ;; #( + *) : + ;; +esac + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + + + + + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + + mhd_have_posix_threads='yes' + +$as_echo "#define HAVE_PTHREAD_H 1" >>confdefs.h + + + : +else + ax_pthread_ok=no + mhd_have_posix_threads='no' +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 "x$mhd_have_posix_threads" = "xyes"; then + HAVE_POSIX_THREADS_TRUE= + HAVE_POSIX_THREADS_FALSE='#' +else + HAVE_POSIX_THREADS_TRUE='#' + HAVE_POSIX_THREADS_FALSE= +fi + + +mhd_have_w32_threads='no' +if test "x$with_threads" = "xauto"; then : + + if test "x$os_is_windows" = "xyes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for W32 threads" >&5 +$as_echo_n "checking for W32 threads... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ + HANDLE h = CreateThread(NULL, 0, NULL, NULL, 0, NULL); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_have_w32_threads='yes' +else + mhd_have_w32_threads='no' + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_have_w32_threads" >&5 +$as_echo "$mhd_have_w32_threads" >&6; } + +fi + + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for threading lib to use with libmicrohttpd" >&5 +$as_echo_n "checking for threading lib to use with libmicrohttpd... " >&6; } +if test "x$with_threads" = "xposix"; then : + # forced posix threads + if test "x$mhd_have_posix_threads" = "xyes"; then : + USE_THREADS='posix' +else + if test "x$os_is_windows" = "xyes" ; then : + as_fn_error $? "Posix threads are not available. Try to configure --with-threads=auto" "$LINENO" 5 +else + as_fn_error $? "No threading lib is available. Consider installing pthreads" "$LINENO" 5 +fi + +fi + +elif test "x$with_threads" = "xw32" ; then : + # forced w32 threads + if test "x$mhd_have_w32_threads" = "xyes"; then : + USE_THREADS='w32' +else + as_fn_error $? "W32 threads are not available. Try to configure --with-threads=auto" "$LINENO" 5 +fi + +else + # automatic threads lib selection + if test "x$os_is_native_w32" = "xyes" && test "x$mhd_have_w32_threads" = "xyes" ; then : + USE_THREADS='w32' +elif test "x$mhd_have_posix_threads" = "xyes" ; then : + USE_THREADS='posix' +elif test "x$mhd_have_w32_threads" = "xyes" ; then : + USE_THREADS='w32' +else + as_fn_error $? "No threading lib is available. Consider installing pthreads" "$LINENO" 5 + +fi + + +fi +if test "x$USE_THREADS" = "xposix"; then + CC="$PTHREAD_CC" + +$as_echo "#define MHD_USE_POSIX_THREADS 1" >>confdefs.h + + MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $PTHREAD_CFLAGS" + MHD_LIBDEPS="$PTHREAD_LIBS $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$PTHREAD_LIBS $MHD_LIBDEPS_PKGCFG" +elif test "x$USE_THREADS" = "xw32"; then + +$as_echo "#define MHD_USE_W32_THREADS 1" >>confdefs.h + +fi + if test "x$USE_THREADS" = "xposix"; then + USE_POSIX_THREADS_TRUE= + USE_POSIX_THREADS_FALSE='#' +else + USE_POSIX_THREADS_TRUE='#' + USE_POSIX_THREADS_FALSE= +fi + + if test "x$USE_THREADS" = "xw32"; then + USE_W32_THREADS_TRUE= + USE_W32_THREADS_FALSE='#' +else + USE_W32_THREADS_TRUE='#' + USE_W32_THREADS_FALSE= +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_THREADS" >&5 +$as_echo "$USE_THREADS" >&6; } + +# Check whether --enable-thread-names was given. +if test "${enable_thread_names+set}" = set; then : + enableval=$enable_thread_names; +else + enable_thread_names='auto' +fi + + +if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; then + # Check for thread name function + HAVE_THREAD_NAME_FUNC="no" + SAVE_LIBS="$LIBS" + SAVE_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + for ac_header in pthread_np.h +do : + ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" " +$ac_includes_default + +#include + + +" +if test "x$ac_cv_header_pthread_np_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_NP_H 1 +_ACEOF + +fi + +done + + + # Try to find how to set thread name by thread attributes. + # If pthread_attr_setname_np(3) is not declared, it's not possible to detect + # form of pthread_attr_setname_np(3) due to C "feature" "implicit declaration". + ac_fn_c_check_decl "$LINENO" "pthread_attr_setname_np" "ac_cv_have_decl_pthread_attr_setname_np" " +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +" +if test "x$ac_cv_have_decl_pthread_attr_setname_np" = xyes; then : + +fi + + + if test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_setname_np(3) in NetBSD or OSF1 form" >&5 +$as_echo_n "checking for pthread_attr_setname_np(3) in NetBSD or OSF1 form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +int +main () +{ + + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setname_np(&thr_attr, "name", 0); + pthread_attr_destroy(&thr_attr); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_attr_setname_np(3) in IBM i form" >&5 +$as_echo_n "checking for pthread_attr_setname_np(3) in IBM i form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +int +main () +{ + + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setname_np(&thr_attr, "name"); + pthread_attr_destroy(&thr_attr); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + # Try to find how to set thread name for started thread - less convinent + # than setting name by attributes. + # If pthread_setname_np(3) is not declared, it's not possible to detect + # form of pthread_setname_np(3) due to C "feature" "implicit declaration". + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes"; then : + ac_fn_c_check_decl "$LINENO" "pthread_setname_np" "ac_cv_have_decl_pthread_setname_np" " +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +" +if test "x$ac_cv_have_decl_pthread_setname_np" = xyes; then : + +fi + + +fi + + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np(3) in NetBSD or OSF1 form" >&5 +$as_echo_n "checking for pthread_setname_np(3) in NetBSD or OSF1 form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +int +main () +{ +int res = pthread_setname_np(pthread_self(), "name", 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_SETNAME_NP_NETBSD 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np(3) in GNU/Linux form" >&5 +$as_echo_n "checking for pthread_setname_np(3) in GNU/Linux form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +int +main () +{ +int res = pthread_setname_np(pthread_self(), "name"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_SETNAME_NP_GNU 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_setname_np(3) in Darwin form" >&5 +$as_echo_n "checking for pthread_setname_np(3) in Darwin form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +int +main () +{ +int res = pthread_setname_np("name"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_SETNAME_NP_DARWIN 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + if test "x$HAVE_THREAD_NAME_FUNC" != "xyes"; then : + + ac_fn_c_check_decl "$LINENO" "pthread_set_name_np" "ac_cv_have_decl_pthread_set_name_np" " +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + + +" +if test "x$ac_cv_have_decl_pthread_set_name_np" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_set_name_np(3) in FreeBSD form" >&5 +$as_echo_n "checking for pthread_set_name_np(3) in FreeBSD form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + +int +main () +{ +pthread_set_name_np(pthread_self(), "name"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_PTHREAD_SET_NAME_NP_FREEBSD 1" >>confdefs.h + + HAVE_THREAD_NAME_FUNC="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + +fi + + LIBS="$SAVE_LIBS" + CFLAGS="$SAVE_CFLAGS" +fi + +if test "x$enable_thread_names" != "xno"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable thread names" >&5 +$as_echo_n "checking whether to enable thread names... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#ifdef MHD_NO_THREAD_NAMES +#error Thread names are disabled. +choke me +#endif + +/* Keep in sync with mhd_threads.h */ +#if defined(MHD_USE_POSIX_THREADS) && (defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) || \ + defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || \ + defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) ) +int a = 1; +#elif defined(MHD_USE_W32_THREADS) && defined(_MSC_FULL_VER) +int b = 2; +#else +#error No thread name function is available. +choke me +#endif + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + enable_thread_names='yes' + +else + + if test "x$enable_thread_names" = "xyes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "thread names was explicitly requested, but thread name function is not available" "$LINENO" 5 + +fi + enable_thread_names='no' + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_thread_names" >&5 +$as_echo "$enable_thread_names" >&6; } + +fi + +if test "x$enable_thread_names" = "xno"; then : + +$as_echo "#define MHD_NO_THREAD_NAMES 1" >>confdefs.h + +fi + + if test "x$os_is_native_w32" = "xyes"; then + HAVE_W32_TRUE= + HAVE_W32_FALSE='#' +else + HAVE_W32_TRUE='#' + HAVE_W32_FALSE= +fi + +w32_shared_lib_exp=no +if test "x$enable_shared" = "xyes" && test "x$os_is_native_w32" = "xyes"; then + if test "x$ac_cv_use_ms_lib_tool" = "xyes" || test -n "$DLLTOOL"; then + w32_shared_lib_exp=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GNU dlltool or MS lib.exe is required for creating shared library export on W32" >&5 +$as_echo "$as_me: WARNING: GNU dlltool or MS lib.exe is required for creating shared library export on W32" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Export library libmicrohttpd.lib will not be created" >&5 +$as_echo "$as_me: WARNING: Export library libmicrohttpd.lib will not be created" >&2;} + fi +fi + if test "x$w32_shared_lib_exp" = "xyes"; then + W32_SHARED_LIB_EXP_TRUE= + W32_SHARED_LIB_EXP_FALSE='#' +else + W32_SHARED_LIB_EXP_TRUE='#' + W32_SHARED_LIB_EXP_FALSE= +fi + + if test "x$ac_cv_use_ms_lib_tool" = "xyes"; then + USE_MS_LIB_TOOL_TRUE= + USE_MS_LIB_TOOL_FALSE='#' +else + USE_MS_LIB_TOOL_TRUE='#' + USE_MS_LIB_TOOL_FALSE= +fi + + + for ac_header in sys/time.h +do : + ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default +" +if test "x$ac_cv_header_sys_time_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_TIME_H 1 +_ACEOF + for ac_func in gettimeofday +do : + ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" +if test "x$ac_cv_func_gettimeofday" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETTIMEOFDAY 1 +_ACEOF + +fi +done + +fi + +done + + for ac_header in time.h +do : + ac_fn_c_check_header_compile "$LINENO" "time.h" "ac_cv_header_time_h" "$ac_includes_default +" +if test "x$ac_cv_header_time_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TIME_H 1 +_ACEOF + for ac_func in nanosleep +do : + ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep" +if test "x$ac_cv_func_nanosleep" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NANOSLEEP 1 +_ACEOF + +fi +done + +fi + +done + + for ac_header in unistd.h +do : + ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default +" +if test "x$ac_cv_header_unistd_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UNISTD_H 1 +_ACEOF + for ac_func in usleep +do : + ac_fn_c_check_func "$LINENO" "usleep" "ac_cv_func_usleep" +if test "x$ac_cv_func_usleep" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_USLEEP 1 +_ACEOF + +fi +done + +fi + +done + + for ac_header in string.h sys/types.h sys/socket.h netinet/in.h time.h sys/select.h netinet/tcp.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether shutdown of listen socket trigger select()" >&5 +$as_echo_n "checking whether shutdown of listen socket trigger select()... " >&6; } +if ${mhd_cv_host_shtdwn_trgr_select+:} false; then : + $as_echo_n "(cached) " >&6 +else + # On Linux shutdown of listen socket always trigger select(). +# On Windows select() always ignore shutdown of listen socket. +# On other paltforms result may vary depending on platform version. + case $host_os in #( + linux | linux-* | *-linux | *-linux-*) : + mhd_cv_host_shtdwn_trgr_select='yes' ;; #( + mingw*) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + cygwin* | msys*) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + winnt* | interix*) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + mks) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + uwin) : + mhd_cv_host_shtdwn_trgr_select='no' ;; #( + *) : + mhd_cv_host_shtdwn_trgr_select='maybe' + ;; +esac + + + if test "x$mhd_cv_host_shtdwn_trgr_select" = x"maybe"; then : + 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 + + MHD_CST_SAVE_CC="$CC" + MHD_CST_SAVE_CFLAGS="$CFLAGS" + MHD_CST_SAVE_LIBS="$LIBS" + CC="$PTHREAD_CC" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + if test "$cross_compiling" = yes; then : + mhd_cv_host_shtdwn_trgr_select='guessing no' +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_TIME_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif + +#if !defined(_WIN32) || defined(__CYGWIN__) +# ifdef HAVE_SYS_TYPES_H +# include +# endif +# ifdef HAVE_SYS_SOCKET_H +# include +# endif +# ifdef HAVE_NETINET_IN_H +# include +# endif +# ifdef HAVE_SYS_TIME_H +# include +# endif +# ifdef HAVE_SYS_SELECT_H +# include +# endif +# ifdef HAVE_NETINET_TCP_H +# include +# endif + typedef int MHD_socket; +# define MHD_INVALID_SOCKET (-1) +# define MHD_POSIX_SOCKETS 1 +#else +# include +# include +# include + typedef SOCKET MHD_socket; +# define MHD_INVALID_SOCKET (INVALID_SOCKET) +# define MHD_WINSOCK_SOCKETS 1 +#endif + +#include + + #ifndef SHUT_RD +# define SHUT_RD 0 +#endif +#ifndef SHUT_WR +# define SHUT_WR 1 +#endif +#ifndef SHUT_RDWR +# define SHUT_RDWR 2 +#endif + +#ifndef NULL +# define NULL ((void*)0) +#endif + +#ifdef HAVE_GETTIMEOFDAY +# if defined(_WIN32) && !defined(__CYGWIN__) +# undef HAVE_GETTIMEOFDAY +# endif +#endif + + +#ifdef HAVE_NANOSLEEP +static const struct timespec sm_tmout = {0, 1000}; +# define short_sleep() nanosleep(&sm_tmout, NULL) +#elif defined(HAVE_USLEEP) +# define short_sleep() usleep(1) +#else +# define short_sleep() (void)0 +#endif + +static volatile int going_select = 0; +static volatile int select_ends = 0; +static volatile int gerror = 0; +static int timeout_mils; + +#ifndef HAVE_GETTIMEOFDAY +static volatile long long select_elapsed_time = 0; + +static long long time_chk(void) +{ + long long ret = time(NULL); + if (-1 == ret) + gerror = 4; + return ret; +} +#endif + + +static void* select_thrd_func(void* param) +{ +#ifndef HAVE_GETTIMEOFDAY + long long start, stop; +#endif + fd_set rs; + struct timeval tmot = {0, 0}; + MHD_socket fd = *((MHD_socket*)param); + + FD_ZERO(&rs); + FD_SET(fd, &rs); + tmot.tv_usec = timeout_mils * 1000; +#ifndef HAVE_GETTIMEOFDAY + start = time_chk(); +#endif + going_select = 1; + if (0 > select ((int)(fd) + 1, &rs, NULL, NULL, &tmot)) + gerror = 5; +#ifndef HAVE_GETTIMEOFDAY + stop = time_chk(); + select_elapsed_time = stop - start; +#endif + select_ends = 1; + return NULL; +} + + +static MHD_socket create_socket(void) +{ return socket (AF_INET, SOCK_STREAM, 0); } + +static void close_socket(MHD_socket fd) +{ +#ifdef MHD_POSIX_SOCKETS + close(fd); +#else + closesocket(fd); +#endif +} + +static MHD_socket +create_socket_listen(int port) +{ + MHD_socket fd; + struct sockaddr_in sock_addr; + fd = create_socket(); + if (MHD_INVALID_SOCKET == fd) + return fd; + + memset (&sock_addr, 0, sizeof (struct sockaddr_in)); + sock_addr.sin_family = AF_INET; + sock_addr.sin_port = htons(port); + sock_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind (fd, (const struct sockaddr*) &sock_addr, sizeof(sock_addr)) < 0 || + listen(fd, SOMAXCONN) < 0) + { + close_socket(fd); + return MHD_INVALID_SOCKET; + } + return fd; +} + +#ifdef HAVE_GETTIMEOFDAY +#define diff_time(tv1, tv2) ((long long)(tv1.tv_sec-tv2.tv_sec)*10000 + (long long)(tv1.tv_usec-tv2.tv_usec)/100) +#else +#define diff_time(tv1, tv2) ((long long)(tv1-tv2)) +#endif + +static long long test_run_select(int timeout_millsec, int use_shutdown, long long delay_before_shutdown) +{ + pthread_t select_thrd; + MHD_socket fd; +#ifdef HAVE_GETTIMEOFDAY + struct timeval start, stop; +#else + long long start; +#endif + + fd = create_socket_listen(0); + if (MHD_INVALID_SOCKET == fd) + return -7; + going_select = 0; + select_ends = 0; + gerror = 0; + timeout_mils = timeout_millsec; + if (0 != pthread_create (&select_thrd, NULL, select_thrd_func, (void*)&fd)) + return -8; + while (!going_select) {short_sleep();} +#ifdef HAVE_GETTIMEOFDAY + gettimeofday (&start, NULL); +#else + start = time_chk(); +#endif + if (use_shutdown) + { +#ifdef HAVE_GETTIMEOFDAY + struct timeval current; + do {short_sleep(); gettimeofday(¤t, NULL); } while (delay_before_shutdown > diff_time(current, start)); +#else + while (delay_before_shutdown > time_chk() - start) {short_sleep();} +#endif + shutdown(fd, SHUT_RDWR); + } +#ifdef HAVE_GETTIMEOFDAY + while (!select_ends) {short_sleep();} + gettimeofday (&stop, NULL); +#endif + if (0 != pthread_join(select_thrd, NULL)) + return -9; + close_socket(fd); + if (gerror) + return -10; +#ifdef HAVE_GETTIMEOFDAY + return (long long)diff_time(stop, start); +#else + return select_elapsed_time; +#endif +} + +static int test_it(void) +{ + long long duration2; +#ifdef HAVE_GETTIMEOFDAY + long long duration0, duration1; + duration0 = test_run_select(0, 0, 0); + if (0 > duration0) + return -duration0; + + duration1 = test_run_select(50, 0, 0); + if (0 > duration1) + return -duration1 + 20; + + duration2 = test_run_select(500, 1, (duration0 + duration1) / 2); + if (0 > duration2) + return -duration2 + 40; + + if (duration1 * 2 > duration2) + { /* Check second time to be sure. */ + duration2 = test_run_select(500, 1, (duration0 + duration1) / 2); + if (0 > duration2) + return -duration2 + 60; + if (duration1 * 2 > duration2) + return 0; + } +#else + duration2 = test_run_select(5000, 1, 2); + if (0 > duration2) + return -duration2 + 80; + + if (4 > duration2) + { /* Check second time to be sure. */ + duration2 = test_run_select(5000, 1, 2); + if (0 > duration2) + return -duration2 + 100; + if (4 > duration2) + return 0; + } +#endif + return 1; +} + + +static int init(void) +{ +#ifdef MHD_WINSOCK_SOCKETS + WSADATA wsa_data; + + if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion) + { + WSACleanup(); + return 0; + } +#endif /* MHD_WINSOCK_SOCKETS */ + return 1; +} + +static void cleanup(void) +{ +#ifdef MHD_WINSOCK_SOCKETS + WSACleanup(); +#endif /* MHD_WINSOCK_SOCKETS */ +} + +int main(void) +{ + int res; + if (!init()) + return 19; + + res = test_it(); + + cleanup(); + if (gerror) + return gerror; + + return res; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mhd_cv_host_shtdwn_trgr_select='yes' +else + mhd_cv_host_shtdwn_trgr_select='no' +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + CC="$MHD_CST_SAVE_CC" + CFLAGS="$MHD_CST_SAVE_CFLAGS" + LIBS="$MHD_CST_SAVE_LIBS" + { MHD_CST_SAVE_CC=; unset MHD_CST_SAVE_CC;} + { MHD_CST_SAVE_CFLAGS=; unset MHD_CST_SAVE_CFLAGS;} + { MHD_CST_SAVE_LIBS=; unset MHD_CST_SAVE_LIBS;} + 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 + + + +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_host_shtdwn_trgr_select" >&5 +$as_echo "$mhd_cv_host_shtdwn_trgr_select" >&6; } + if test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"; then : + +$as_echo "#define HAVE_LISTEN_SHUTDOWN 1" >>confdefs.h + +elif test "x$mhd_cv_host_shtdwn_trgr_select" = "xno"; then : + +fi + + + if test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"; then + HAVE_LISTEN_SHUTDOWN_TRUE= + HAVE_LISTEN_SHUTDOWN_FALSE='#' +else + HAVE_LISTEN_SHUTDOWN_TRUE='#' + HAVE_LISTEN_SHUTDOWN_FALSE= +fi + + +# set GCC options +# use '-fno-strict-aliasing', but only if the compiler +# and linker can take it +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fno-strict-aliasing" >&5 +$as_echo_n "checking whether the linker accepts -fno-strict-aliasing... " >&6; } +if ${ax_cv_check_ldflags___fno_strict_aliasing+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS -fno-strict-aliasing" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_check_ldflags___fno_strict_aliasing=yes +else + ax_cv_check_ldflags___fno_strict_aliasing=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___fno_strict_aliasing" >&5 +$as_echo "$ax_cv_check_ldflags___fno_strict_aliasing" >&6; } +if test "x$ax_cv_check_ldflags___fno_strict_aliasing" = xyes; then : + + + + +for flag in -fno-strict-aliasing; do + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +$as_echo_n "checking whether C compiler accepts $flag... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : + +if ${CFLAGS+:} false; then : + + case " $CFLAGS " in #( + *" $flag "*) : + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 + (: CFLAGS already contains $flag) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append CFLAGS " $flag" + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + (: CFLAGS="$CFLAGS") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; +esac + +else + + CFLAGS=$flag + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + (: CFLAGS="$CFLAGS") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + +fi + +else + : +fi + +done + +else + : +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +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 + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +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 + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + + +# Extract the first word of "curl", so it can be a program name with args. +set dummy curl; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_CURL_BINARY+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_CURL_BINARY"; then + ac_cv_prog_HAVE_CURL_BINARY="$HAVE_CURL_BINARY" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_CURL_BINARY="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_CURL_BINARY" && ac_cv_prog_HAVE_CURL_BINARY="no" +fi +fi +HAVE_CURL_BINARY=$ac_cv_prog_HAVE_CURL_BINARY +if test -n "$HAVE_CURL_BINARY"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_CURL_BINARY" >&5 +$as_echo "$HAVE_CURL_BINARY" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$HAVE_CURL_BINARY" = "xyes"; then + HAVE_CURL_BINARY_TRUE= + HAVE_CURL_BINARY_FALSE='#' +else + HAVE_CURL_BINARY_TRUE='#' + HAVE_CURL_BINARY_FALSE= +fi + +# Extract the first word of "makeinfo", so it can be a program name with args. +set dummy makeinfo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_HAVE_MAKEINFO_BINARY+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$HAVE_MAKEINFO_BINARY"; then + ac_cv_prog_HAVE_MAKEINFO_BINARY="$HAVE_MAKEINFO_BINARY" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_HAVE_MAKEINFO_BINARY="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_HAVE_MAKEINFO_BINARY" && ac_cv_prog_HAVE_MAKEINFO_BINARY="no" +fi +fi +HAVE_MAKEINFO_BINARY=$ac_cv_prog_HAVE_MAKEINFO_BINARY +if test -n "$HAVE_MAKEINFO_BINARY"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_MAKEINFO_BINARY" >&5 +$as_echo "$HAVE_MAKEINFO_BINARY" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$HAVE_MAKEINFO_BINARY" = "xyes"; then + HAVE_MAKEINFO_BINARY_TRUE= + HAVE_MAKEINFO_BINARY_FALSE='#' +else + HAVE_MAKEINFO_BINARY_TRUE='#' + HAVE_MAKEINFO_BINARY_FALSE= +fi + + if test "x$os_is_native_w32" = "xyes" && test "x$enable_static" = "xyes"; then + W32_STATIC_LIB_TRUE= + W32_STATIC_LIB_FALSE='#' +else + W32_STATIC_LIB_TRUE='#' + W32_STATIC_LIB_FALSE= +fi + + + +# Check whether --enable-doc was given. +if test "${enable_doc+set}" = set; then : + enableval=$enable_doc; +else + enable_doc=yes +fi + +test "x$enable_doc" = "xno" || enable_doc=yes + if test "x$enable_doc" = "xyes"; then + BUILD_DOC_TRUE= + BUILD_DOC_FALSE='#' +else + BUILD_DOC_TRUE='#' + BUILD_DOC_FALSE= +fi + + +# Check whether --enable-examples was given. +if test "${enable_examples+set}" = set; then : + enableval=$enable_examples; +else + enable_examples=yes +fi + +test "x$enable_examples" = "xno" || enable_examples=yes + if test "x$enable_examples" = "xyes"; then + BUILD_EXAMPLES_TRUE= + BUILD_EXAMPLES_FALSE='#' +else + BUILD_EXAMPLES_TRUE='#' + BUILD_EXAMPLES_FALSE= +fi + + +# Check whether --enable-poll was given. +if test "${enable_poll+set}" = set; then : + enableval=$enable_poll; enable_poll=${enableval} +else + enable_poll='auto' + +fi + + +if test "$enable_poll" != "no"; then + if test "$os_is_native_w32" != "yes"; then + for ac_header in poll.h +do : + ac_fn_c_check_header_compile "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default +" +if test "x$ac_cv_header_poll_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_POLL_H 1 +_ACEOF + + for ac_func in poll +do : + ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" +if test "x$ac_cv_func_poll" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_POLL 1 +_ACEOF + have_poll='yes' +else + have_poll='no' +fi +done + + +fi + +done + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for WSAPoll()" >&5 +$as_echo_n "checking for WSAPoll()... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ + +WSAPOLLFD fda[2]; +WSAPoll(fda, 2, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + have_poll='yes' + $as_echo "#define HAVE_POLL 1" >>confdefs.h + + +else + have_poll='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_poll" >&5 +$as_echo "$have_poll" >&6; } + fi + if test "$enable_poll" = "yes" && test "$have_poll" != "yes"; then + as_fn_error $? "Support for poll was explicitly requested but cannot be enabled on this platform." "$LINENO" 5 + fi + enable_poll="$have_poll" +fi + +# Check whether --enable-epoll was given. +if test "${enable_epoll+set}" = set; then : + enableval=$enable_epoll; enable_epoll=${enableval} +else + enable_epoll='auto' + +fi + + +if test "$enable_epoll" != "no"; then + ax_have_epoll_cppflags="${CPPFLAGS}" + ac_fn_c_check_header_mongrel "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_version_h" = xyes; then : + CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H" +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux epoll(7) interface" >&5 +$as_echo_n "checking for Linux epoll(7) interface... " >&6; } + if ${ax_cv_have_epoll+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include +#ifdef HAVE_LINUX_VERSION_H +# include +# if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,45) +# error linux kernel version is too old to have epoll +# endif +#endif + +int +main () +{ +int fd, rc; +struct epoll_event ev; +fd = epoll_create(128); +rc = epoll_wait(fd, &ev, 1, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_have_epoll=yes +else + ax_cv_have_epoll=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + CPPFLAGS="${ax_have_epoll_cppflags}" + if test "${ax_cv_have_epoll}" = "yes"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi + + if test "${ax_cv_have_epoll}" = "yes"; then + +$as_echo "#define EPOLL_SUPPORT 1" >>confdefs.h + + enable_epoll='yes' + else + if test "$enable_epoll" = "yes"; then + as_fn_error $? "Support for epoll was explicitly requested but cannot be enabled on this platform." "$LINENO" 5 + fi + enable_epoll='no' + fi +fi + +if test "x$enable_epoll" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for epoll_create1()" >&5 +$as_echo_n "checking for epoll_create1()... " >&6; } +if ${mhd_cv_have_epoll_create1+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ + +int fd; +fd = epoll_create1(EPOLL_CLOEXEC); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_have_epoll_create1=yes +else + mhd_cv_have_epoll_create1=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_have_epoll_create1" >&5 +$as_echo "$mhd_cv_have_epoll_create1" >&6; } + if test "x$mhd_cv_have_epoll_create1" = "xyes"; then : + + +$as_echo "#define HAVE_EPOLL_CREATE1 1" >>confdefs.h + +fi +fi + +# Check for headers that are ALWAYS required +for ac_header in fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + as_fn_error $? "Compiling libmicrohttpd requires standard UNIX headers files" "$LINENO" 5 +fi + +done + + +# Check for optional headers +for ac_header in sys/types.h sys/time.h sys/msg.h time.h sys/mman.h sys/ioctl.h \ + sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \ + endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \ + inttypes.h stddef.h unistd.h \ + sockLib.h inetLib.h net/if.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + GNULIB_TSEARCH=0; + HAVE_TSEARCH=1; + REPLACE_TSEARCH=0; + +ac_fn_c_check_header_compile "$LINENO" "search.h" "ac_cv_header_search_h" "$ac_includes_default +" +if test "x$ac_cv_header_search_h" = xyes; then : + + + + for ac_func in tsearch +do : + ac_fn_c_check_func "$LINENO" "tsearch" "ac_cv_func_tsearch" +if test "x$ac_cv_func_tsearch" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TSEARCH 1 +_ACEOF + +fi +done + + if test $ac_cv_func_tsearch = yes; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tdelete works" >&5 +$as_echo_n "checking whether tdelete works... " >&6; } +if ${gl_cv_func_tdelete_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + case "$host_os" in + openbsd*) gl_cv_func_tdelete_works="guessing no";; + *) gl_cv_func_tdelete_works="guessing yes";; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static int +cmp_fn (const void *a, const void *b) +{ + return *(const int *) a - *(const int *) b; +} +int +main () +{ + int result = 0; + int x = 0; + void *root = NULL; + if (!(tfind (&x, &root, cmp_fn) == NULL)) + result |= 1; + tsearch (&x, &root, cmp_fn); + if (!(tfind (&x, &root, cmp_fn) != NULL)) + result |= 2; + if (!(tdelete (&x, &root, cmp_fn) != NULL)) + result |= 4; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_tdelete_works=yes +else + gl_cv_func_tdelete_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_tdelete_works" >&5 +$as_echo "$gl_cv_func_tdelete_works" >&6; } + case "$gl_cv_func_tdelete_works" in + *no) + REPLACE_TSEARCH=1 + ;; + esac + else + HAVE_TSEARCH=0 + fi + + if test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"; then : + +$as_echo "#define HAVE_SEARCH_H 1" >>confdefs.h + +fi + +fi + + + + if test "x$ac_cv_header_search_h" = xyes && test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"; then + MHD_HAVE_TSEARCH_TRUE= + MHD_HAVE_TSEARCH_FALSE='#' +else + MHD_HAVE_TSEARCH_TRUE='#' + MHD_HAVE_TSEARCH_FALSE= +fi + + +# Check for generic functions +for ac_func in rand random +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +ac_fn_c_check_member "$LINENO" "struct sockaddr_in" "sin_len" "ac_cv_member_struct_sockaddr_in_sin_len" " +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif + +" +if test "x$ac_cv_member_struct_sockaddr_in_sin_len" = xyes; then : + +$as_echo "#define HAVE_SOCKADDR_IN_SIN_LEN 1" >>confdefs.h + + +fi + + +ac_fn_c_check_decl "$LINENO" "getsockname" "ac_cv_have_decl_getsockname" " +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WINSOCK2_H +#include +#endif + + +" +if test "x$ac_cv_have_decl_getsockname" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETSOCKNAME $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + + for ac_func in getsockname +do : + ac_fn_c_check_func "$LINENO" "getsockname" "ac_cv_func_getsockname" +if test "x$ac_cv_func_getsockname" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETSOCKNAME 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getsockname() is usable" >&5 +$as_echo_n "checking whether getsockname() is usable... " >&6; } +if ${mhc_cv_getsockname_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + mhc_cv_getsockname_usable='assuming yes' + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WINSOCK2_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_IP_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + + +static void zr_mem(void *ptr, socklen_t size) +{ char *mem = ptr; while(size--) {mem[0] = 0; mem++;} } + +int main(void) +{ + const socklen_t c_addr_size = (socklen_t)sizeof(struct sockaddr_in); + struct sockaddr_in sa; + socklen_t addr_size; + int ret = 1; +#if !defined(_WIN32) || defined(__CYGWIN__) + int sckt; + const int invld_sckt = -1; +#else + SOCKET sckt; + const SOCKET invld_sckt = INVALID_SOCKET; + WSADATA wsa_data; + + if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion) + return 20; +#endif + + sckt = socket (PF_INET, SOCK_STREAM, 0); + if (invld_sckt != sckt) + { + zr_mem(&sa, c_addr_size); + sa.sin_family = AF_INET; +#if HAVE_SOCKADDR_IN_SIN_LEN + sa.sin_len = c_addr_size; +#endif + if (0 == bind (sckt, (struct sockaddr *)&sa, c_addr_size)) + { + if (0 == listen (sckt, 1)) + { + addr_size = c_addr_size; + if (0 == getsockname (sckt, (struct sockaddr *)&sa, &addr_size)) + { + if (c_addr_size >= addr_size) + { + if (0 != ntohs(sa.sin_port)) + { ret = 0; + } else ret = 7; + } else ret = 6; + } else ret = 5; + } else ret = 4; + } else ret = 3; + } else ret = 2; +#if !defined(_WIN32) || defined(__CYGWIN__) + close (sckt); +#else + closesocket (sckt); + WSACleanup(); +#endif + return ret; +} + + + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mhc_cv_getsockname_usable='yes' +else + mhc_cv_getsockname_usable='no' +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhc_cv_getsockname_usable" >&5 +$as_echo "$mhc_cv_getsockname_usable" >&6; } + if test "x$mhc_cv_getsockname_usable" = x"no"; then : + : +else + +$as_echo "#define MHD_USE_GETSOCKNAME 1" >>confdefs.h + +fi + + +fi +done + + +fi + + +# Check for inter-thread signaling type +# Check whether --enable-itc was given. +if test "${enable_itc+set}" = set; then : + enableval=$enable_itc; +else + enable_itc='auto' + +fi + + +case $enable_itc in #( + pipe) : + : ;; #( + socketpair) : + : ;; #( + eventfd) : + : ;; #( + auto) : + if test "x$os_is_windows" = x"yes"; then : + enable_itc='socketpair' +fi ;; #( + eventFD) : + enable_itc='eventfd' ;; #( + socket) : + enable_itc='socketpair' ;; #( + no) : + as_fn_error $? "inter-thread communication cannot be disabled" "$LINENO" 5 ;; #( + *) : + as_fn_error $? "unrecognized type \"$enable_itc\" of inter-thread communication specified by \"--enable-itc=$enable_itc\"" "$LINENO" 5 + ;; +esac +# AS_UNSET([[use_itc]]) + +if test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"; then : + + if test "x$os_is_native_w32" = x"yes"; then : + +else + + for ac_header in sys/eventfd.h +do : + ac_fn_c_check_header_compile "$LINENO" "sys/eventfd.h" "ac_cv_header_sys_eventfd_h" "$ac_includes_default +" +if test "x$ac_cv_header_sys_eventfd_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_EVENTFD_H 1 +_ACEOF + +fi + +done + + if test "x$ac_cv_header_sys_eventfd_h" = x"yes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether eventfd(2) is usable" >&5 +$as_echo_n "checking whether eventfd(2) is usable... " >&6; } +if ${mhd_cv_eventfd_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ +int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK) + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_eventfd_usable='yes' +else + mhd_cv_eventfd_usable='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_eventfd_usable" >&5 +$as_echo "$mhd_cv_eventfd_usable" >&6; } + +fi + +fi + if test "x$mhd_cv_eventfd_usable" = x"yes"; then : + + use_itc='eventfd' + enable_itc="$use_itc" + +$as_echo "#define _MHD_ITC_EVENTFD 1" >>confdefs.h + + +else + + if test "x$enable_itc" = x"eventfd"; then : + as_fn_error $? "eventfd(2) is not usable, consider using other type of inter-thread communication" "$LINENO" 5 +fi + +fi + +fi + +if test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"; then : + + if test "x$os_is_native_w32" = x"yes"; then : + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pipe(3) is usable" >&5 +$as_echo_n "checking whether pipe(3) is usable... " >&6; } +if ${mhd_cv_pipe_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +$ac_includes_default +#ifdef HAVE_UNISTD_H +#include +#endif + +int +main () +{ + + int arr[2]; + int res; + res = pipe(arr) + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_pipe_usable='yes' +else + mhd_cv_pipe_usable='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_pipe_usable" >&5 +$as_echo "$mhd_cv_pipe_usable" >&6; } + +fi + if test "x$mhd_cv_pipe_usable" = x"yes"; then : + + use_itc='pipe' + enable_itc="$use_itc" + +$as_echo "#define _MHD_ITC_PIPE 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pipe2(2) is usable" >&5 +$as_echo_n "checking whether pipe2(2) is usable... " >&6; } +if ${mhd_cv_pipe2_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +$ac_includes_default +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +int +main () +{ + + int arr[2]; + int res; + res = pipe2(arr, O_CLOEXEC | O_NONBLOCK) + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_pipe2_usable='yes' +else + mhd_cv_pipe2_usable='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_pipe2_usable" >&5 +$as_echo "$mhd_cv_pipe2_usable" >&6; } + if test "x$mhd_cv_pipe2_usable" = x"yes"; then : + +$as_echo "#define HAVE_PIPE2_FUNC 1" >>confdefs.h + +fi + +else + + if test "x$enable_itc" = x"pipe"; then : + as_fn_error $? "pipe(3) is not usable, consider using other type of inter-thread communication" "$LINENO" 5 +fi + +fi + +fi + +if test "x$enable_itc" = "xsocketpair" || test "x$enable_itc" = "xauto"; then : + + if test "x$os_is_native_w32" = x"yes"; then : + mhd_cv_socketpair_usable='yes' +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether socketpair(3) is usable" >&5 +$as_echo_n "checking whether socketpair(3) is usable... " >&6; } +if ${mhd_cv_socketpair_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +$ac_includes_default +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +int +main () +{ + + int arr[2]; + int res; +#if defined(AF_LOCAL) + res = socketpair(AF_LOCAL, SOCK_STREAM, 0, arr); +#elif defined(AF_UNIX) + res = socketpair(AF_UNIX, SOCK_STREAM, 0, arr); +#else +#error AF_LOCAL and AF_UNIX are both undefined + choke me now; +#endif + if (res != 0) return 1 + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_socketpair_usable='yes' +else + mhd_cv_socketpair_usable='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_socketpair_usable" >&5 +$as_echo "$mhd_cv_socketpair_usable" >&6; } + +fi + if test "x$mhd_cv_socketpair_usable" = x"yes"; then : + + use_itc='socketpair' + enable_itc="$use_itc" + +$as_echo "#define _MHD_ITC_SOCKETPAIR 1" >>confdefs.h + + +else + + if test "x$enable_itc" = x"socketpair"; then : + as_fn_error $? "socketpair(3) is not usable, consider using other type of inter-thread communication" "$LINENO" 5 +fi + +fi + +fi + +if test -z "$use_itc"; then : + as_fn_error $? "cannot find useable type of inter-thread communication" "$LINENO" 5 +fi + + + + + + for ac_func in $ac_func_list +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + + + + +ac_fn_c_check_decl "$LINENO" "gmtime_s" "ac_cv_have_decl_gmtime_s" "#define __STDC_WANT_LIB_EXT1__ 1 +#include +" +if test "x$ac_cv_have_decl_gmtime_s" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gmtime_s is in C11 form" >&5 +$as_echo_n "checking whether gmtime_s is in C11 form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#ifdef __cplusplus +extern "C" +#endif + struct tm* gmtime_s(const time_t* time, struct tm* result); + +int +main () +{ + + struct tm res; + time_t t; + gmtime_s (&t, &res); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_C11_GMTIME_S 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gmtime_s is in W32 form" >&5 +$as_echo_n "checking whether gmtime_s is in W32 form... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef __cplusplus +extern "C" +#endif +errno_t gmtime_s(struct tm* _tm, const time_t* time); + +int +main () +{ + + struct tm res; + time_t t; + gmtime_s (&res, &t); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_W32_GMTIME_S 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + + +ac_fn_c_check_decl "$LINENO" "SOCK_NONBLOCK" "ac_cv_have_decl_SOCK_NONBLOCK" " +#if defined(HAVE_SYS_TYPES_H) +# include +#endif +#if defined(HAVE_SYS_SOCKET_H) +# include +#elif defined(HAVE_WINSOCK2_H) +# include +#endif + +" +if test "x$ac_cv_have_decl_SOCK_NONBLOCK" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SOCK_NONBLOCK $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + +$as_echo "#define HAVE_SOCK_NONBLOCK 1" >>confdefs.h + +fi + + + +ac_fn_c_check_decl "$LINENO" "clock_gettime" "ac_cv_have_decl_clock_gettime" " +#include + +" +if test "x$ac_cv_have_decl_clock_gettime" = xyes; then : + + SAVE_LIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +$as_echo_n "checking for library containing clock_gettime... " >&6; } +if ${ac_cv_search_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $MHD_LIBDEPS $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_clock_gettime=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_clock_gettime+:} false; then : + break +fi +done +if ${ac_cv_search_clock_gettime+:} false; then : + +else + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 +$as_echo "$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + +$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h + + if test "x$ac_cv_search_clock_gettime" = x"none required"; then : + +else + + MHD_LIBDEPS="$ac_cv_search_clock_gettime $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$ac_cv_search_clock_gettime $MHD_LIBDEPS_PKGCFG" + +fi + +fi + + LIBS="$SAVE_LIBS" + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_get_time" >&5 +$as_echo_n "checking for clock_get_time... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ + + clock_serv_t cs; + mach_timespec_t mt; + host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cs); + clock_get_time(cs, &mt); + mach_port_deallocate(mach_task_self(), cs); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_CLOCK_GET_TIME 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethrtime" >&5 +$as_echo_n "checking for gethrtime... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_SYS_TIME_H +/* Solaris define gethrtime() in sys/time.h */ +#include +#endif /* HAVE_SYS_TIME_H */ +#ifdef HAVE_TIME_H +/* HP-UX define gethrtime() in time.h */ +#include +#endif /* HAVE_TIME_H */ + +int +main () +{ +hrtime_t hrt = gethrtime(); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_GETHRTIME 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +# IPv6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv6" >&5 +$as_echo_n "checking for IPv6... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_SYS_SOCKET_H +#include +#endif +#if HAVE_WINSOCK2_H +#include +#endif +#if HAVE_WS2TCPIP_H +#include +#endif + +int +main () +{ + +int af=AF_INET6; +int pf=PF_INET6; +struct sockaddr_in6 sa; +printf("%d %d %p\n", af, pf, &sa); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +have_inet6=yes; + +$as_echo "#define HAVE_INET6 1" >>confdefs.h + + +else + +have_inet6=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_inet6" >&5 +$as_echo "$have_inet6" >&6; } + +HIDDEN_VISIBILITY_CFLAGS="" +case "$host" in + *-*-mingw*) + +$as_echo "#define _MHD_EXTERN __attribute__((visibility(\"default\"))) __declspec(dllexport) extern" >>confdefs.h + + HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden" + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fvisibility=hidden" >&5 +$as_echo_n "checking whether the linker accepts -fvisibility=hidden... " >&6; } +if ${ax_cv_check_ldflags___fvisibility_hidden+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS -fvisibility=hidden" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_check_ldflags___fvisibility_hidden=yes +else + ax_cv_check_ldflags___fvisibility_hidden=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___fvisibility_hidden" >&5 +$as_echo "$ax_cv_check_ldflags___fvisibility_hidden" >&6; } +if test "x$ax_cv_check_ldflags___fvisibility_hidden" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5 +$as_echo_n "checking whether C compiler accepts -fvisibility=hidden... " >&6; } +if ${ax_cv_check_cflags___fvisibility_hidden+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -fvisibility=hidden" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___fvisibility_hidden=yes +else + ax_cv_check_cflags___fvisibility_hidden=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fvisibility_hidden" >&5 +$as_echo "$ax_cv_check_cflags___fvisibility_hidden" >&6; } +if test "x$ax_cv_check_cflags___fvisibility_hidden" = xyes; then : + +$as_echo "#define _MHD_EXTERN __attribute__((visibility(\"default\"))) extern" >>confdefs.h + + HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden" +else + : +fi + +else + : +fi + + ;; +esac + + +# libcurl (required for testing) +# Check whether --enable-curl was given. +if test "${enable_curl+set}" = set; then : + enableval=$enable_curl; enable_curl=${enableval} +fi + +curl=0 +if test "$enable_curl" != "no" +then + + + + + + + + + + + + + + + + + + + + + + + + + +# Check whether --with-libcurl was given. +if test "${with_libcurl+set}" = set; then : + withval=$with_libcurl; _libcurl_with=$withval +else + _libcurl_with=yes +fi + + + if test "$_libcurl_with" != "no" ; then + + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + + + _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[1]+256*A[2]+A[3]; print X;}'" + + _libcurl_try_link=yes + + if test -d "$_libcurl_with" ; then + LIBCURL_CPPFLAGS="-I$withval/include" + _libcurl_ldflags="-L$withval/lib" + # Extract the first word of "curl-config", so it can be a program name with args. +set dummy curl-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path__libcurl_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $_libcurl_config in + [\\/]* | ?:[\\/]*) + ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in "$withval/bin" +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +_libcurl_config=$ac_cv_path__libcurl_config +if test -n "$_libcurl_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5 +$as_echo "$_libcurl_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + # Extract the first word of "curl-config", so it can be a program name with args. +set dummy curl-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path__libcurl_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $_libcurl_config in + [\\/]* | ?:[\\/]*) + ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +_libcurl_config=$ac_cv_path__libcurl_config +if test -n "$_libcurl_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5 +$as_echo "$_libcurl_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + + if test x$_libcurl_config != "x" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the version of libcurl" >&5 +$as_echo_n "checking for the version of libcurl... " >&6; } +if ${libcurl_cv_lib_curl_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $2}'` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_version" >&5 +$as_echo "$libcurl_cv_lib_curl_version" >&6; } + + _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` + _libcurl_wanted=`echo 7.16.4 | $_libcurl_version_parse` + + if test $_libcurl_wanted -gt 0 ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl >= version 7.16.4" >&5 +$as_echo_n "checking for libcurl >= version 7.16.4... " >&6; } +if ${libcurl_cv_lib_version_ok+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test $_libcurl_version -ge $_libcurl_wanted ; then + libcurl_cv_lib_version_ok=yes + else + libcurl_cv_lib_version_ok=no + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_version_ok" >&5 +$as_echo "$libcurl_cv_lib_version_ok" >&6; } + fi + + if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then + if test x"$LIBCURL_CPPFLAGS" = "x" ; then + LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` + fi + if test x"$LIBCURL" = "x" ; then + LIBCURL=`$_libcurl_config --libs` + + # This is so silly, but Apple actually has a bug in their + # curl-config script. Fixed in Tiger, but there are still + # lots of Panther installs around. + case "${host}" in + powerpc-apple-darwin7*) + LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` + ;; + esac + fi + + # All curl-config scripts support --feature + _libcurl_features=`$_libcurl_config --feature` + + # Is it modern enough to have --protocols? (7.12.4) + if test $_libcurl_version -ge 461828 ; then + _libcurl_protocols=`$_libcurl_config --protocols` + fi + else + _libcurl_try_link=no + fi + + unset _libcurl_wanted + fi + + if test $_libcurl_try_link = yes ; then + + # we didn't find curl-config, so let's see if the user-supplied + # link line (or failing that, "-lcurl") is enough. + LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcurl is usable" >&5 +$as_echo_n "checking whether libcurl is usable... " >&6; } +if ${libcurl_cv_lib_curl_usable+:} false; then : + $as_echo_n "(cached) " >&6 +else + + _libcurl_save_cppflags=$CPPFLAGS + CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" + _libcurl_save_libs=$LIBS + LIBS="$LIBCURL $LIBS" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + +/* Try and use a few common options to force a failure if we are + missing symbols or can't link. */ +int x; +curl_easy_setopt(NULL,CURLOPT_URL,NULL); +x=CURL_ERROR_SIZE; +x=CURLOPT_WRITEFUNCTION; +x=CURLOPT_WRITEDATA; +x=CURLOPT_ERRORBUFFER; +x=CURLOPT_STDERR; +x=CURLOPT_VERBOSE; +if (x) {;} + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + libcurl_cv_lib_curl_usable=yes +else + libcurl_cv_lib_curl_usable=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + CPPFLAGS=$_libcurl_save_cppflags + LIBS=$_libcurl_save_libs + unset _libcurl_save_cppflags + unset _libcurl_save_libs + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_usable" >&5 +$as_echo "$libcurl_cv_lib_curl_usable" >&6; } + + if test $libcurl_cv_lib_curl_usable = yes ; then + + # Does curl_free() exist in this version of libcurl? + # If not, fake it with free() + + _libcurl_save_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" + _libcurl_save_libs=$LIBS + LIBS="$LIBS $LIBCURL" + + ac_fn_c_check_func "$LINENO" "curl_free" "ac_cv_func_curl_free" +if test "x$ac_cv_func_curl_free" = xyes; then : + +else + +$as_echo "#define curl_free free" >>confdefs.h + +fi + + + CPPFLAGS=$_libcurl_save_cppflags + LIBS=$_libcurl_save_libs + unset _libcurl_save_cppflags + unset _libcurl_save_libs + + +$as_echo "#define HAVE_LIBCURL 1" >>confdefs.h + + + + + for _libcurl_feature in $_libcurl_features ; do + cat >>confdefs.h <<_ACEOF +#define `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_cpp` 1 +_ACEOF + + eval `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_sh`=yes + done + + if test "x$_libcurl_protocols" = "x" ; then + + # We don't have --protocols, so just assume that all + # protocols are available + _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" + + if test x$libcurl_feature_SSL = xyes ; then + _libcurl_protocols="$_libcurl_protocols HTTPS" + + # FTPS wasn't standards-compliant until version + # 7.11.0 (0x070b00 == 461568) + if test $_libcurl_version -ge 461568; then + _libcurl_protocols="$_libcurl_protocols FTPS" + fi + fi + + # RTSP, IMAP, POP3 and SMTP were added in + # 7.20.0 (0x071400 == 463872) + if test $_libcurl_version -ge 463872; then + _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP" + fi + fi + + for _libcurl_protocol in $_libcurl_protocols ; do + cat >>confdefs.h <<_ACEOF +#define `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_cpp` 1 +_ACEOF + + eval `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_sh`=yes + done + else + unset LIBCURL + unset LIBCURL_CPPFLAGS + fi + fi + + unset _libcurl_try_link + unset _libcurl_version_parse + unset _libcurl_config + unset _libcurl_feature + unset _libcurl_features + unset _libcurl_protocol + unset _libcurl_protocols + unset _libcurl_version + unset _libcurl_ldflags + fi + + if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then + # This is the IF-NO path + + if test "x$enable_curl" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cURL-based tests cannot be enabled because libcurl is missing" >&5 +$as_echo "$as_me: WARNING: cURL-based tests cannot be enabled because libcurl is missing" >&2;} + fi + enable_curl=no + + else + # This is the IF-YES path + enable_curl=yes + fi + + unset _libcurl_with + +fi +if test "$enable_curl" != "no" +then +# Lib cURL & cURL - OpenSSL versions + +$as_echo "#define MHD_REQ_CURL_VERSION \"7.16.4\"" >>confdefs.h + + +$as_echo "#define MHD_REQ_CURL_OPENSSL_VERSION \"0.9.8\"" >>confdefs.h + + +$as_echo "#define MHD_REQ_CURL_GNUTLS_VERSION \"2.8.6\"" >>confdefs.h + + +$as_echo "#define MHD_REQ_CURL_NSS_VERSION \"3.12.0\"" >>confdefs.h + +fi + if test "x$enable_curl" = "xyes"; then + HAVE_CURL_TRUE= + HAVE_CURL_FALSE='#' +else + HAVE_CURL_TRUE='#' + HAVE_CURL_FALSE= +fi + + +mhd_have_libmagic="no" +SAVE_LIBS="$LIBS" +LIBS="$LIBS -lmagic" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suitable libmagic" >&5 +$as_echo_n "checking for suitable libmagic... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ + + char var_data[256]; + const char *var_mime; + magic_t var_magic = magic_open (MAGIC_MIME_TYPE); + (void)magic_load (var_magic, NULL); + var_data[0] = 0; + var_mime = magic_buffer (var_magic, var_data, 1); + magic_close (var_magic); + + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_LIBMAGIC 1" >>confdefs.h + + mhd_have_libmagic="yes" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS="$SAVE_LIBS" + if test "x$mhd_have_libmagic" = "xyes"; then + HAVE_LIBMAGIC_TRUE= + HAVE_LIBMAGIC_FALSE='#' +else + HAVE_LIBMAGIC_TRUE='#' + HAVE_LIBMAGIC_FALSE= +fi + + +# large file support (> 4 GB) +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if ${ac_cv_sys_file_offset_bits+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if ${ac_cv_sys_large_files+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi + + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } +if ${ac_cv_sys_largefile_source+:} false; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include /* for off_t */ + #include +int +main () +{ +int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_sys_largefile_source=no; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGEFILE_SOURCE 1 +#include /* for off_t */ + #include +int +main () +{ +int (*fp) (FILE *, off_t, int) = fseeko; + return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_sys_largefile_source=1; break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_cv_sys_largefile_source=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 +$as_echo "$ac_cv_sys_largefile_source" >&6; } +case $ac_cv_sys_largefile_source in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source +_ACEOF +;; +esac +rm -rf conftest* + +# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug +# in glibc 2.1.3, but that breaks too many other things. +# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. +if test $ac_cv_sys_largefile_source != unknown; then + +$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h + +fi + +for ac_func in lseek64 pread64 pread +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# check for various sendfile functions +# Check whether --enable-sendfile was given. +if test "${enable_sendfile+set}" = set; then : + enableval=$enable_sendfile; +else + enable_sendfile="auto" +fi + +case $enable_sendfile in #( + auto | yes) : + found_sendfile="no" ;; #( + no) : + found_sendfile="disabled" ;; #( + *) : + as_fn_error $? "unknown value specified: --enable-sendfile=$enable_sendfile" "$LINENO" 5 + ;; +esac +if test "x$found_sendfile" = x"no"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux-style sendfile(2)" >&5 +$as_echo_n "checking for Linux-style sendfile(2)... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +static void empty_func(void) +{ +/* Check for declaration */ + (void)sendfile; +} +/* Declare again to check form match */ +ssize_t sendfile(int, int, off_t*, size_t); + +int +main () +{ + + int fd1=0, fd2=2; + off_t o = 0; + size_t s = 5; + ssize_t r; + r = sendfile (fd1, fd2, &o, s); + if (r) + empty_func(); + + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_LINUX_SENDFILE 1" >>confdefs.h + + found_sendfile="yes, Linux-style" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + for ac_func in sendfile64 +do : + ac_fn_c_check_func "$LINENO" "sendfile64" "ac_cv_func_sendfile64" +if test "x$ac_cv_func_sendfile64" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SENDFILE64 1 +_ACEOF + +fi +done + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +fi +if test "x$found_sendfile" = x"no"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD-style sendfile(2)" >&5 +$as_echo_n "checking for FreeBSD-style sendfile(2)... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +static void empty_func(void) +{ +/* Check for declaration */ + (void)sendfile; +} +/* Declare again to check form match */ +int sendfile(int, int, off_t, size_t, + struct sf_hdtr*, off_t*, int); + +int +main () +{ + + int fd1=0, fd2=1; + off_t o = 0; + size_t s = 5; + off_t r1; + int r2; + r2 = sendfile (fd1, fd2, o, s, (void*)0, &r1, 0); + if (r2) + empty_func(); + + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_FREEBSD_SENDFILE 1" >>confdefs.h + + found_sendfile="yes, FreeBSD-style" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +fi +if test "x$found_sendfile" = x"no"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Darwin-style sendfile(2)" >&5 +$as_echo_n "checking for Darwin-style sendfile(2)... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +static void empty_func(void) +{ +/* Check for declaration */ + (void)sendfile; +} +/* Declare again to check form match */ +int sendfile(int, int, off_t, off_t*, + struct sf_hdtr *, int); + +int +main () +{ + + int fd=0, s=1; + off_t o = 0; + off_t l = 5; + int r; + r = sendfile (fd, s, o, &l, (void*)0, 0); + if (r) + empty_func(); + + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_DARWIN_SENDFILE 1" >>confdefs.h + + found_sendfile="yes, Darwin-style" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +fi + +if test "x$found_sendfile" = x"no"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Solaris-style sendfile(3)" >&5 +$as_echo_n "checking for Solaris-style sendfile(3)... " >&6; } + SAVE_LIBS="$LIBS" + LIBS="$LIBS -lsendfile" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +static void empty_func(void) +{ +/* Check for declaration */ + (void)sendfile; +} +/* Declare again to check form match */ +ssize_t sendfile(int out_fd, int in_fd, + off_t *off, size_t len); + +int +main () +{ + + int fd1=0, fd2=1; + off_t o = 0; + size_t l = 5; + ssize_t r; + r = sendfile (fd1, fd2, &o, l); + if (r) + empty_func(); + + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_SOLARIS_SENDFILE 1" >>confdefs.h + + found_sendfile="yes, Solaris-style" + MHD_LIBDEPS="-lsendfile $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="-lsendfile $MHD_LIBDEPS_PKGCFG" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + for ac_func in sendfile64 +do : + ac_fn_c_check_func "$LINENO" "sendfile64" "ac_cv_func_sendfile64" +if test "x$ac_cv_func_sendfile64" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SENDFILE64 1 +_ACEOF + +fi +done + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$SAVE_LIBS" + + +fi +if test "x$found_sendfile" = "xno" && test "x$enable_sendfile" = "xyes"; then : + as_fn_error $? "sendfile() usage was requested by configure parameter, but no usable sendfile() function is detected" "$LINENO" 5 + +fi + +# optional: have error messages ? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to generate error messages" >&5 +$as_echo_n "checking whether to generate error messages... " >&6; } +# Check whether --enable-messages was given. +if test "${enable_messages+set}" = set; then : + enableval=$enable_messages; enable_messages=${enableval} +else + enable_messages=yes +fi + +if test "x$enable_messages" = "xyes"; then : + +$as_echo "#define HAVE_MESSAGES 1" >>confdefs.h + +else + enable_messages=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_messages" >&5 +$as_echo "$enable_messages" >&6; } + + +# optional: have postprocessor? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable postprocessor" >&5 +$as_echo_n "checking whether to enable postprocessor... " >&6; } +# Check whether --enable-postprocessor was given. +if test "${enable_postprocessor+set}" = set; then : + enableval=$enable_postprocessor; enable_postprocessor=${enableval} +else + enable_postprocessor=yes +fi + +if test "x$enable_postprocessor" != "xno"; then : + enable_postprocessor=yes + +$as_echo "#define HAVE_POSTPROCESSOR 1" >>confdefs.h + +fi + if test "x$enable_postprocessor" != "xno"; then + HAVE_POSTPROCESSOR_TRUE= + HAVE_POSTPROCESSOR_FALSE='#' +else + HAVE_POSTPROCESSOR_TRUE='#' + HAVE_POSTPROCESSOR_FALSE= +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_postprocessor" >&5 +$as_echo "$enable_postprocessor" >&6; } + + +# optional: have zzuf, socat? +# Extract the first word of "zzuf", so it can be a program name with args. +set dummy zzuf; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_have_zzuf+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$have_zzuf"; then + ac_cv_prog_have_zzuf="$have_zzuf" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_zzuf="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_zzuf" && ac_cv_prog_have_zzuf="no" +fi +fi +have_zzuf=$ac_cv_prog_have_zzuf +if test -n "$have_zzuf"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_zzuf" >&5 +$as_echo "$have_zzuf" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "socat", so it can be a program name with args. +set dummy socat; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_have_socat+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$have_socat"; then + ac_cv_prog_have_socat="$have_socat" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_have_socat="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_have_socat" && ac_cv_prog_have_socat="no" +fi +fi +have_socat=$ac_cv_prog_have_socat +if test -n "$have_socat"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_socat" >&5 +$as_echo "$have_socat" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$have_zzuf" = "xyes"; then + HAVE_ZZUF_TRUE= + HAVE_ZZUF_FALSE='#' +else + HAVE_ZZUF_TRUE='#' + HAVE_ZZUF_FALSE= +fi + + if test "x$have_socat" = "xyes"; then + HAVE_SOCAT_TRUE= + HAVE_SOCAT_FALSE='#' +else + HAVE_SOCAT_TRUE='#' + HAVE_SOCAT_FALSE= +fi + + +have_gnutls=no +have_gnutls_sni=no +have_gcrypt=no +{ GNUTLS_CPPFLAGS=; unset GNUTLS_CPPFLAGS;} +{ GNUTLS_LDFLAGS=; unset GNUTLS_LDFLAGS;} + +# optional: HTTPS support. Enabled by default +# Check whether --enable-https was given. +if test "${enable_https+set}" = set; then : + enableval=$enable_https; enable_https=${enableval} +fi + +if test "x$enable_https" != "xno" +then +# +# Next block is large unindented block +# + +# gnutls +have_gnutls_pkgcfg=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to find GnuTLS library" >&5 +$as_echo_n "checking how to find GnuTLS library... " >&6; } + +# Check whether --with-gnutls was given. +if test "${with_gnutls+set}" = set; then : + withval=$with_gnutls; + case $with_gnutls in + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: GnuTLS disabled" >&5 +$as_echo "GnuTLS disabled" >&6; } + { GNUTLS_CPPFLAGS=; unset GNUTLS_CPPFLAGS;} + { GNUTLS_CFLAGS=; unset GNUTLS_CFLAGS;} + { GNUTLS_LDFLAGS=; unset GNUTLS_LDFLAGS;} + { GNUTLS_LIBS=; unset GNUTLS_LIBS;} + ;; + yes) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: automatically, forced" >&5 +$as_echo "automatically, forced" >&6; } + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: -I$with_gnutls/include -L$with_gnutls/lib -lgnutls" >&5 +$as_echo "-I$with_gnutls/include -L$with_gnutls/lib -lgnutls" >&6; } + SAVE_LDFLAGS="$LDFLAGS" + SAVE_CPPFLAGS="$CPPFLAGS" + LDFLAGS="-L$with_gnutls/lib $LDFLAGS" + CPPFLAGS="-I$with_gnutls/include $CPPFLAGS" + have_gnutls_pkgcfg=no + for ac_header in gnutls/gnutls.h +do : + ac_fn_c_check_header_compile "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default +" +if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GNUTLS_GNUTLS_H 1 +_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_priority_set in -lgnutls" >&5 +$as_echo_n "checking for gnutls_priority_set in -lgnutls... " >&6; } +if ${ac_cv_lib_gnutls_gnutls_priority_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgnutls $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 gnutls_priority_set (); +int +main () +{ +return gnutls_priority_set (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gnutls_gnutls_priority_set=yes +else + ac_cv_lib_gnutls_gnutls_priority_set=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_priority_set" >&5 +$as_echo "$ac_cv_lib_gnutls_gnutls_priority_set" >&6; } +if test "x$ac_cv_lib_gnutls_gnutls_priority_set" = xyes; then : + + GNUTLS_CPPFLAGS="-I$with_gnutls/include" + GNUTLS_LDFLAGS="-L$with_gnutls/lib" + GNUTLS_LIBS="-lgnutls" + have_gnutls=yes + +fi + +fi + +done + + if test "x$have_gnutls" != "xyes"; then : + as_fn_error $? "can't find usable libgnutls at specified prefix $with_gnutls" "$LINENO" 5 +fi + LDFLAGS="$SAVE_LDFLAGS" + CPPFLAGS="$SAVE_CPPFLAGS" + ;; + esac + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: automatically" >&5 +$as_echo "automatically" >&6; } + +fi + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi +if test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to add pkg-config special search directories" >&5 +$as_echo_n "checking whether to add pkg-config special search directories... " >&6; } +if ${mhd_cv_pkgconf_add_dirs+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "x$host_os" = "xsolaris2.11" && test "x$cross_compiling" = "xno"; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +char size_chk[7-sizeof(char*)]; +#if defined(_LP64) || defined(__LP64__) || defined(__x86_64) || defined(__x86_64__) +#error This is 64-bit target. +choke me now +#endif +#if defined(__amd64) || defined(__amd64__) || defined(__sparcv9) || defined(__sparc_v9__) +#error This is 64-bit target. +choke me now +#endif + +int +main () +{ + + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + mhd_cv_pkgconf_add_dirs='/usr/lib/pkgconfig/gnutls-3' + +else + + if test "x$host_cpu" = "xx86_64" || test "x$host_cpu" = "xi386"; then : + mhd_cv_pkgconf_add_dirs='/usr/lib/amd64/pkgconfig/gnutls-3:/usr/lib/amd64/pkgconfig' +elif test "x$host_cpu" = "xsparc"; then : + mhd_cv_pkgconf_add_dirs='/usr/lib/sparkv9/pkgconfig/gnutls-3:/usr/lib/sparkv9/pkgconfig' +else + mhd_cv_pkgconf_add_dirs='/usr/lib/64/pkgconfig/gnutls-3:/usr/lib/64/pkgconfig' + +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + mhd_cv_pkgconf_add_dirs='no' + +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_pkgconf_add_dirs" >&5 +$as_echo "$mhd_cv_pkgconf_add_dirs" >&6; } + if test "x$mhd_cv_pkgconf_add_dirs" != "xno"; then : + + test "x$PKG_CONFIG_PATH" = "x" || PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${PATH_SEPARATOR}" + PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${mhd_cv_pkgconf_add_dirs}" + export PKG_CONFIG_PATH + + +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls" >&5 +$as_echo_n "checking for gnutls... " >&6; } + +if test -n "$GNUTLS_CFLAGS"; then + pkg_cv_GNUTLS_CFLAGS="$GNUTLS_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnutls") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GNUTLS_LIBS"; then + pkg_cv_GNUTLS_LIBS="$GNUTLS_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnutls") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GNUTLS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gnutls" 2>&1` + else + GNUTLS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gnutls" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GNUTLS_PKG_ERRORS" >&5 + + + # check for GnuTLS at default paths + have_gnutls_pkgcfg='no' + for ac_header in gnutls/gnutls.h +do : + ac_fn_c_check_header_compile "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default +" +if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GNUTLS_GNUTLS_H 1 +_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_priority_set in -lgnutls" >&5 +$as_echo_n "checking for gnutls_priority_set in -lgnutls... " >&6; } +if ${ac_cv_lib_gnutls_gnutls_priority_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgnutls $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 gnutls_priority_set (); +int +main () +{ +return gnutls_priority_set (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gnutls_gnutls_priority_set=yes +else + ac_cv_lib_gnutls_gnutls_priority_set=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_priority_set" >&5 +$as_echo "$ac_cv_lib_gnutls_gnutls_priority_set" >&6; } +if test "x$ac_cv_lib_gnutls_gnutls_priority_set" = xyes; then : + + GNUTLS_LIBS="-lgnutls" + have_gnutls=yes + +fi + +fi + +done + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + # check for GnuTLS at default paths + have_gnutls_pkgcfg='no' + for ac_header in gnutls/gnutls.h +do : + ac_fn_c_check_header_compile "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default +" +if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GNUTLS_GNUTLS_H 1 +_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_priority_set in -lgnutls" >&5 +$as_echo_n "checking for gnutls_priority_set in -lgnutls... " >&6; } +if ${ac_cv_lib_gnutls_gnutls_priority_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgnutls $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 gnutls_priority_set (); +int +main () +{ +return gnutls_priority_set (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gnutls_gnutls_priority_set=yes +else + ac_cv_lib_gnutls_gnutls_priority_set=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_priority_set" >&5 +$as_echo "$ac_cv_lib_gnutls_gnutls_priority_set" >&6; } +if test "x$ac_cv_lib_gnutls_gnutls_priority_set" = xyes; then : + + GNUTLS_LIBS="-lgnutls" + have_gnutls=yes + +fi + +fi + +done + + +else + GNUTLS_CFLAGS=$pkg_cv_GNUTLS_CFLAGS + GNUTLS_LIBS=$pkg_cv_GNUTLS_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + have_gnutls_pkgcfg='yes' + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CFLAGS="$GNUTLS_CFLAGS $CFLAGS" + LIBS="$LIBS $GNUTLS_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GnuTLS is usable" >&5 +$as_echo_n "checking whether GnuTLS is usable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ + + gnutls_session_t session; + gnutls_priority_t priorities; + gnutls_global_init(); + gnutls_priority_init(&priorities, "NORMAL", NULL); + gnutls_init(&session, GNUTLS_SERVER); + gnutls_priority_set(session, priorities); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_gnutls=yes + # GNUTLS_CFLAGS is actually CPPFLAGS + GNUTLS_CPPFLAGS="$GNUTLS_CFLAGS" + # GNUTLS_CFLAGS is combination of LDFLAGS and LIBS + GNUTLS_LDFLAGS="$GNUTLS_LIBS" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_gnutls=no + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + if test "x$have_gnutls" != "xyes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config reports that GnuTLS is present, but GnuTLS can't be used" >&5 +$as_echo "$as_me: WARNING: pkg-config reports that GnuTLS is present, but GnuTLS can't be used" >&2;} + { GNUTLS_CPPFLAGS=; unset GNUTLS_CPPFLAGS;} + { GNUTLS_CFLAGS=; unset GNUTLS_CFLAGS;} + { GNUTLS_LDFLAGS=; unset GNUTLS_LDFLAGS;} + { GNUTLS_LIBS=; unset GNUTLS_LIBS;} + + +fi + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" + +fi + +fi + +have_gcrypt='unknown' +if test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"; then : + + + +# Check whether --with-libgcrypt-prefix was given. +if test "${with_libgcrypt_prefix+set}" = set; then : + withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval" +else + libgcrypt_config_prefix="" +fi + + if test x"${LIBGCRYPT_CONFIG}" = x ; then + if test x"${libgcrypt_config_prefix}" != x ; then + LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" + else + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&5 +$as_echo "$as_me: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&2;} + ;; + esac + fi + fi + + # Extract the first word of "libgcrypt-config", so it can be a program name with args. +set dummy libgcrypt-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_LIBGCRYPT_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $LIBGCRYPT_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no" + ;; +esac +fi +LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG +if test -n "$LIBGCRYPT_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5 +$as_echo "$LIBGCRYPT_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + tmp=1.2.2 + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` + else + req_libgcrypt_api=0 + min_libgcrypt_version="$tmp" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5 +$as_echo_n "checking for LIBGCRYPT - version >= $min_libgcrypt_version... " >&6; } + ok=no + if test "$LIBGCRYPT_CONFIG" != "no" ; then + req_major=`echo $min_libgcrypt_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` + req_minor=`echo $min_libgcrypt_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` + req_micro=`echo $min_libgcrypt_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` + libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` + major=`echo $libgcrypt_config_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` + minor=`echo $libgcrypt_config_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` + micro=`echo $libgcrypt_config_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` + if test "$major" -gt "$req_major"; then + ok=yes + else + if test "$major" -eq "$req_major"; then + if test "$minor" -gt "$req_minor"; then + ok=yes + else + if test "$minor" -eq "$req_minor"; then + if test "$micro" -ge "$req_micro"; then + ok=yes + fi + fi + fi + fi + fi + fi + if test $ok = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libgcrypt_config_version)" >&5 +$as_echo "yes ($libgcrypt_config_version)" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + if test $ok = yes; then + # If we have a recent libgcrypt, we should also check that the + # API is compatible + if test "$req_libgcrypt_api" -gt 0 ; then + tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` + if test "$tmp" -gt 0 ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGCRYPT API version" >&5 +$as_echo_n "checking LIBGCRYPT API version... " >&6; } + if test "$req_libgcrypt_api" -eq "$tmp" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay" >&5 +$as_echo "okay" >&6; } + else + ok=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5 +$as_echo "does not match. want=$req_libgcrypt_api got=$tmp" >&6; } + fi + fi + fi + fi + if test $ok = yes; then + LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` + LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` + have_gcrypt=yes + libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none` + if test x"$libgcrypt_config_host" != xnone ; then + if test x"$libgcrypt_config_host" != x"$host" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +*** +*** The config script $LIBGCRYPT_CONFIG was +*** built for $libgcrypt_config_host and thus may not match the +*** used host $host. +*** You may want to use the configure option --with-libgcrypt-prefix +*** to specify a matching config script or use \$SYSROOT. +***" >&5 +$as_echo "$as_me: WARNING: +*** +*** The config script $LIBGCRYPT_CONFIG was +*** built for $libgcrypt_config_host and thus may not match the +*** used host $host. +*** You may want to use the configure option --with-libgcrypt-prefix +*** to specify a matching config script or use \$SYSROOT. +***" >&2;} + gpg_config_script_warn="$gpg_config_script_warn libgcrypt" + fi + fi + else + LIBGCRYPT_CFLAGS="" + LIBGCRYPT_LIBS="" + have_gcrypt=no + fi + + + + if test "x$have_gcrypt" = "xyes"; then : + + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LIBS="$LIBS" + SAVE_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" + # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both + CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" + for ac_header in gcrypt.h +do : + ac_fn_c_check_header_compile "$LINENO" "gcrypt.h" "ac_cv_header_gcrypt_h" "$ac_includes_default +" +if test "x$ac_cv_header_gcrypt_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GCRYPT_H 1 +_ACEOF + +else + have_gcrypt=no +fi + +done + + # Check for GnuTLS with gcrypt flags + LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS" + # A bit of hack: unset cache variable to force recheck + { ac_cv_header_gnutls_gnutls_h=; unset ac_cv_header_gnutls_gnutls_h;} + for ac_header in gnutls/gnutls.h +do : + ac_fn_c_check_header_compile "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default +" +if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GNUTLS_GNUTLS_H 1 +_ACEOF + { ac_cv_lib_gnutls_gnutls_priority_set=; unset ac_cv_lib_gnutls_gnutls_priority_set;} # A bit of hack: unset cache variable to force recheck + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_priority_set in -lgnutls" >&5 +$as_echo_n "checking for gnutls_priority_set in -lgnutls... " >&6; } +if ${ac_cv_lib_gnutls_gnutls_priority_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgnutls $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 gnutls_priority_set (); +int +main () +{ +return gnutls_priority_set (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gnutls_gnutls_priority_set=yes +else + ac_cv_lib_gnutls_gnutls_priority_set=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_priority_set" >&5 +$as_echo "$ac_cv_lib_gnutls_gnutls_priority_set" >&6; } +if test "x$ac_cv_lib_gnutls_gnutls_priority_set" = xyes; then : + + GNUTLS_CPPFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_LDFLAGS="$LIBGCRYPT_LIBS" + GNUTLS_LIBS="-lgnutls" + have_gnutls=yes + +fi + +fi + +done + + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" + + +fi + + +fi +if test "x$have_gnutls" != "xyes" && test "x$with_gnutls" = "xyes"; then : + as_fn_error $? "can't find usable libgnutls" "$LINENO" 5 +fi +# +# End of large unindented block +# + + if test "x$have_gnutls" = "xyes"; then : + + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CPPFLAGS="$GNUTLS_CPPFLAGS $CPPFLAGS" + CFLAGS="$GNUTLS_CFLAGS $CFLAGS" + LDFLAGS="$GNUTLS_LDFLAGS $LDFLAGS" + LIBS="$LIBS $GNUTLS_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_privkey_import_x509_raw()" >&5 +$as_echo_n "checking for gnutls_privkey_import_x509_raw()... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#include + +int +main () +{ + + gnutls_datum_t data; + gnutls_privkey_t key = 0; +#ifndef gnutls_load_file + (void)gnutls_load_file; /* Check for declaration. */ +#endif +#ifndef gnutls_privkey_import_x509_raw + (void)gnutls_privkey_import_x509_raw; /* Check for declaration. */ +#endif + gnutls_load_file("key.pem", &data); + gnutls_privkey_import_x509_raw(key, &data, GNUTLS_X509_FMT_PEM, NULL, 0); + gnutls_free(data.data); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + have_gnutls_sni=yes +else + have_gnutls_sni=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gnutls_sni" >&5 +$as_echo "$have_gnutls_sni" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GnuTLS require libgcrypt initialisaion" >&5 +$as_echo_n "checking whether GnuTLS require libgcrypt initialisaion... " >&6; } +if ${mhd_cv_grypt_required+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ + +#if !defined(GNUTLS_VERSION_NUMBER) || GNUTLS_VERSION_NUMBER+0 <= 0x020c14 +#error Old versions of GnuTLS require libgcript initialisaion +choke me now +#endif + + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mhd_cv_grypt_required='no' +else + mhd_cv_grypt_required='yes' + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_grypt_required" >&5 +$as_echo "$mhd_cv_grypt_required" >&6; } + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" + +else + + { GNUTLS_CPPFLAGS=; unset GNUTLS_CPPFLAGS;} + { GNUTLS_LDFLAGS=; unset GNUTLS_LDFLAGS;} + + +fi + + if test "x$mhd_cv_grypt_required" = "xyes" && test "x$have_gcrypt" = "xunknown"; then : + + + +# Check whether --with-libgcrypt-prefix was given. +if test "${with_libgcrypt_prefix+set}" = set; then : + withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval" +else + libgcrypt_config_prefix="" +fi + + if test x"${LIBGCRYPT_CONFIG}" = x ; then + if test x"${libgcrypt_config_prefix}" != x ; then + LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" + else + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&5 +$as_echo "$as_me: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&2;} + ;; + esac + fi + fi + + # Extract the first word of "libgcrypt-config", so it can be a program name with args. +set dummy libgcrypt-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_LIBGCRYPT_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $LIBGCRYPT_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no" + ;; +esac +fi +LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG +if test -n "$LIBGCRYPT_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5 +$as_echo "$LIBGCRYPT_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + tmp=1.2.2 + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` + else + req_libgcrypt_api=0 + min_libgcrypt_version="$tmp" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5 +$as_echo_n "checking for LIBGCRYPT - version >= $min_libgcrypt_version... " >&6; } + ok=no + if test "$LIBGCRYPT_CONFIG" != "no" ; then + req_major=`echo $min_libgcrypt_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` + req_minor=`echo $min_libgcrypt_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` + req_micro=`echo $min_libgcrypt_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` + libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` + major=`echo $libgcrypt_config_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` + minor=`echo $libgcrypt_config_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` + micro=`echo $libgcrypt_config_version | \ + sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` + if test "$major" -gt "$req_major"; then + ok=yes + else + if test "$major" -eq "$req_major"; then + if test "$minor" -gt "$req_minor"; then + ok=yes + else + if test "$minor" -eq "$req_minor"; then + if test "$micro" -ge "$req_micro"; then + ok=yes + fi + fi + fi + fi + fi + fi + if test $ok = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libgcrypt_config_version)" >&5 +$as_echo "yes ($libgcrypt_config_version)" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + if test $ok = yes; then + # If we have a recent libgcrypt, we should also check that the + # API is compatible + if test "$req_libgcrypt_api" -gt 0 ; then + tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` + if test "$tmp" -gt 0 ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGCRYPT API version" >&5 +$as_echo_n "checking LIBGCRYPT API version... " >&6; } + if test "$req_libgcrypt_api" -eq "$tmp" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay" >&5 +$as_echo "okay" >&6; } + else + ok=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5 +$as_echo "does not match. want=$req_libgcrypt_api got=$tmp" >&6; } + fi + fi + fi + fi + if test $ok = yes; then + LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` + LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` + have_gcrypt=yes + libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none` + if test x"$libgcrypt_config_host" != xnone ; then + if test x"$libgcrypt_config_host" != x"$host" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +*** +*** The config script $LIBGCRYPT_CONFIG was +*** built for $libgcrypt_config_host and thus may not match the +*** used host $host. +*** You may want to use the configure option --with-libgcrypt-prefix +*** to specify a matching config script or use \$SYSROOT. +***" >&5 +$as_echo "$as_me: WARNING: +*** +*** The config script $LIBGCRYPT_CONFIG was +*** built for $libgcrypt_config_host and thus may not match the +*** used host $host. +*** You may want to use the configure option --with-libgcrypt-prefix +*** to specify a matching config script or use \$SYSROOT. +***" >&2;} + gpg_config_script_warn="$gpg_config_script_warn libgcrypt" + fi + fi + else + LIBGCRYPT_CFLAGS="" + LIBGCRYPT_LIBS="" + have_gcrypt=no + fi + + + + if test "x$have_gcrypt" = "xyes"; then : + + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" + # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both + CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" + for ac_header in gcrypt.h +do : + ac_fn_c_check_header_compile "$LINENO" "gcrypt.h" "ac_cv_header_gcrypt_h" "$ac_includes_default +" +if test "x$ac_cv_header_gcrypt_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GCRYPT_H 1 +_ACEOF + +else + have_gcrypt=no +fi + +done + + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + + +fi + + +fi + + { crypt_missing=; unset crypt_missing;} + if test "x$have_gnutls" = "xyes"; then : + + if test "x$mhd_cv_grypt_required" = "xyes" && test "x$have_gcrypt" != "xyes"; then : + + crypt_missing="required libgcrypt" + if test "x$enable_https" = "xyes" ; then : + as_fn_error $? "HTTPS support cannot be enabled without $crypt_missing." "$LINENO" 5 +fi + enable_https=no + MSG_HTTPS="no (lacking $crypt_missing)" + { LIBGCRYPT_CFLAGS=; unset LIBGCRYPT_CFLAGS;} + { LIBGCRYPT_LIBS=; unset LIBGCRYPT_LIBS;} + { GNUTLS_CPPFLAGS=; unset GNUTLS_CPPFLAGS;} + { GNUTLS_CFLAGS=; unset GNUTLS_CFLAGS;} + { GNUTLS_LDFLAGS=; unset GNUTLS_LDFLAGS;} + { GNUTLS_LIBS=; unset GNUTLS_LIBS;} + +else + + +$as_echo "#define HTTPS_SUPPORT 1" >>confdefs.h + + enable_https=yes + if test "x$mhd_cv_grypt_required" = "xyes"; then : + + MSG_HTTPS="yes (using libgnutls and libgcrypt)" + MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CPPFLAGS" + MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CFLAGS" + MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS" + MHD_LIBDEPS="$GNUTLS_LIBS $LIBGCRYPT_LIBS $MHD_LIBDEPS" + +$as_echo "#define MHD_HTTPS_REQUIRE_GRYPT 1" >>confdefs.h + + +else + + MSG_HTTPS="yes (using libgnutls)" + { LIBGCRYPT_CFLAGS=; unset LIBGCRYPT_CFLAGS;} + { LIBGCRYPT_LIBS=; unset LIBGCRYPT_LIBS;} + MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $GNUTLS_CPPFLAGS" + MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $GNUTLS_CFLAGS" + MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS" + MHD_LIBDEPS="$GNUTLS_LIBS $MHD_LIBDEPS" + + +fi + if test "x$have_gnutls_pkgcfg" = "xyes" ; then : + # remove GnuTLS from private libs in .pc file as it defined in Requires.private + MHD_REQ_PRIVATE='gnutls' + if test "x$mhd_cv_grypt_required" = "xyes"; then : + MHD_LIBDEPS_PKGCFG="$LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG" + +fi + +else + + MHD_REQ_PRIVATE='' + if test "x$mhd_cv_grypt_required" = "xyes"; then : + MHD_LIBDEPS_PKGCFG="$LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG" + +fi + MHD_LIBDEPS_PKGCFG="$GNUTLS_LIBS $MHD_LIBDEPS_PKGCFG" + +fi + + +fi + +else + + crypt_missing="libgnutls" + if test "x$enable_https" = "xyes" ; then : + as_fn_error $? "HTTPS support cannot be enabled without $crypt_missing." "$LINENO" 5 +fi + enable_https=no + MSG_HTTPS="no (lacking $crypt_missing)" + { LIBGCRYPT_CFLAGS=; unset LIBGCRYPT_CFLAGS;} + { LIBGCRYPT_LIBS=; unset LIBGCRYPT_LIBS;} + { GNUTLS_CPPFLAGS=; unset GNUTLS_CPPFLAGS;} + { GNUTLS_CFLAGS=; unset GNUTLS_CFLAGS;} + { GNUTLS_LDFLAGS=; unset GNUTLS_LDFLAGS;} + { GNUTLS_LIBS=; unset GNUTLS_LIBS;} + + +fi +else + MSG_HTTPS="no (disabled)" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support HTTPS" >&5 +$as_echo_n "checking whether to support HTTPS... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSG_HTTPS" >&5 +$as_echo "$MSG_HTTPS" >&6; } + + if test "x$have_gnutls" = "xyes"; then + HAVE_GNUTLS_TRUE= + HAVE_GNUTLS_FALSE='#' +else + HAVE_GNUTLS_TRUE='#' + HAVE_GNUTLS_FALSE= +fi + + if test "x$have_gnutls_sni" = "xyes"; then + HAVE_GNUTLS_SNI_TRUE= + HAVE_GNUTLS_SNI_FALSE='#' +else + HAVE_GNUTLS_SNI_TRUE='#' + HAVE_GNUTLS_SNI_FALSE= +fi + + if test "x$enable_https" = "xyes"; then + ENABLE_HTTPS_TRUE= + ENABLE_HTTPS_FALSE='#' +else + ENABLE_HTTPS_TRUE='#' + ENABLE_HTTPS_FALSE= +fi + + if test "x$enable_https" = "xyes" && test "x$mhd_cv_grypt_required" = "xyes"; then + HTTPS_REQUIRE_GRYPT_TRUE= + HTTPS_REQUIRE_GRYPT_FALSE='#' +else + HTTPS_REQUIRE_GRYPT_TRUE='#' + HTTPS_REQUIRE_GRYPT_FALSE= +fi + + + + + + +# optional: HTTP Basic Auth support. Enabled by default +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support HTTP basic authentication" >&5 +$as_echo_n "checking whether to support HTTP basic authentication... " >&6; } +# Check whether --enable-bauth was given. +if test "${enable_bauth+set}" = set; then : + enableval=$enable_bauth; enable_bauth=${enableval} +else + enable_bauth=yes +fi + +if test "x$enable_bauth" != "xno"; then : + enable_bauth=yes + +$as_echo "#define BAUTH_SUPPORT 1" >>confdefs.h + +fi + if test "x$enable_bauth" != "xno"; then + ENABLE_BAUTH_TRUE= + ENABLE_BAUTH_FALSE='#' +else + ENABLE_BAUTH_TRUE='#' + ENABLE_BAUTH_FALSE= +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_bauth" >&5 +$as_echo "$enable_bauth" >&6; } + +# optional: HTTP Digest Auth support. Enabled by default +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support HTTP digest authentication" >&5 +$as_echo_n "checking whether to support HTTP digest authentication... " >&6; } +# Check whether --enable-dauth was given. +if test "${enable_dauth+set}" = set; then : + enableval=$enable_dauth; enable_dauth=${enableval} +else + enable_dauth=yes +fi + +if test "x$enable_dauth" != "xno"; then : + enable_dauth=yes + +$as_echo "#define DAUTH_SUPPORT 1" >>confdefs.h + +fi + if test "x$enable_dauth" != "xno"; then + ENABLE_DAUTH_TRUE= + ENABLE_DAUTH_FALSE='#' +else + ENABLE_DAUTH_TRUE='#' + ENABLE_DAUTH_FALSE= +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_dauth" >&5 +$as_echo "$enable_dauth" >&6; } + +# optional: HTTP "Upgrade" support. Enabled by default +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support HTTP \"Upgrade\"" >&5 +$as_echo_n "checking whether to support HTTP \"Upgrade\"... " >&6; } +# Check whether --enable-httpupgrade was given. +if test "${enable_httpupgrade+set}" = set; then : + enableval=$enable_httpupgrade; if test "x$enable_httpupgrade" = x"no"; then : + +else + enable_httpupgrade='yes' +fi +else + enable_httpupgrade='yes' +fi + +if test "x$enable_httpupgrade" = x"yes"; then : + + +$as_echo "#define UPGRADE_SUPPORT 1" >>confdefs.h + +fi + if test "x$enable_httpupgrade" = "xyes"; then + ENABLE_UPGRADE_TRUE= + ENABLE_UPGRADE_FALSE='#' +else + ENABLE_UPGRADE_TRUE='#' + ENABLE_UPGRADE_FALSE= +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_httpupgrade" >&5 +$as_echo "$enable_httpupgrade" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for calloc()" >&5 +$as_echo_n "checking for calloc()... " >&6; } +if ${mhd_cv_have_func_calloc+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ +void * ptr = calloc(1, 2) + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_have_func_calloc='yes' +else + mhd_cv_have_func_calloc='no' + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_have_func_calloc" >&5 +$as_echo "$mhd_cv_have_func_calloc" >&6; } +if test "x$mhd_cv_have_func_calloc" = x"yes"; then : + +$as_echo "#define HAVE_CALLOC 1" >>confdefs.h + +fi + +# Check for fork() and waitpid(). They are used for tests. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fork()" >&5 +$as_echo_n "checking for fork()... " >&6; } +mhd_have_fork_waitpid='no' +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +int +main () +{ + + pid_t p = fork (); + if (0 == p) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_FORK 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for waitpid()" >&5 +$as_echo_n "checking for waitpid()... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include + +int +main () +{ + + pid_t p = fork (); + if (0 == p) + return 1; + waitpid (p, (void*)0, 0) + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_WAITPID 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + mhd_have_fork_waitpid='yes' + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + if test "x$mhd_have_fork_waitpid" = "xyes"; then + HAVE_FORK_WAITPID_TRUE= + HAVE_FORK_WAITPID_FALSE='#' +else + HAVE_FORK_WAITPID_TRUE='#' + HAVE_FORK_WAITPID_FALSE= +fi + + +# gcov compilation +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compile with support for code coverage analysis" >&5 +$as_echo_n "checking whether to compile with support for code coverage analysis... " >&6; } +# Check whether --enable-coverage was given. +if test "${enable_coverage+set}" = set; then : + enableval=$enable_coverage; use_gcov=${enableval} +else + use_gcov=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_gcov" >&5 +$as_echo "$use_gcov" >&6; } + if test "x$use_gcov" = "xyes"; then + USE_COVERAGE_TRUE= + USE_COVERAGE_FALSE='#' +else + USE_COVERAGE_TRUE='#' + USE_COVERAGE_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking the number of available CPUs" >&5 +$as_echo_n "checking the number of available CPUs... " >&6; } + CPU_COUNT="0" + + # Try generic methods + + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1; then : + : # empty +else + # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null; then : + : # empty +else + # Try platform-specific preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^[0-9]+,' -c` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0" ;; #( + freebsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0" ;; #( + netbsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0" ;; #( + solaris*) : + command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^[0-9].*on-line' -c 2>/dev/null` || CPU_COUNT="0" ;; #( + mingw*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + msys*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + cygwin*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + *) : + ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1; then : + : # empty +else + # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null; then : + : # empty +else + # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0" ;; #( + freebsd*) : + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + netbsd*) : + CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^[0-9]+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + solaris*) : + command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0" ;; #( + mingw*) : + if CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\[0-9]+$' -c`; then : + : # empty +else + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" +fi ;; #( + msys*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + cygwin*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + *) : + ;; +esac +fi + if test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPU_COUNT" >&5 +$as_echo "$CPU_COUNT" >&6; } + +else + CPU_COUNT="1" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unable to detect (assuming 1)" >&5 +$as_echo "unable to detect (assuming 1)" >&6; } + +fi +if test "$CPU_COUNT" -gt "32"; then : + CPU_COUNT="32" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable debug asserts" >&5 +$as_echo_n "checking whether to enable debug asserts... " >&6; } +# Check whether --enable-asserts was given. +if test "${enable_asserts+set}" = set; then : + enableval=$enable_asserts; +else + enable_asserts='no' +fi + +case $enable_asserts in #( + yes) : + : ;; #( + no) : + : ;; #( + *) : + enable_asserts='no' ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_asserts" >&5 +$as_echo "$enable_asserts" >&6; } + +if test "x$enable_asserts" = x"yes"; then : + + +$as_echo "#define _DEBUG 1" >>confdefs.h + + mhd_assert_test_prg="#include + int pos_val(void) {return 5;} + int neg_val(void) {return -5;} + int main(void) + { int pos_var = pos_val(), neg_var = neg_val(); + assert(neg_var > pos_var); /* Must trigger assert. */ + (void)pos_var; (void)neg_var; + return 0; } + " + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system assert() is available" >&5 +$as_echo_n "checking whether system assert() is available... " >&6; } +if ${mhd_cv_sys_assert_avail+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$mhd_assert_test_prg +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + mhd_cv_sys_assert_avail='yes' +else + mhd_cv_sys_assert_avail='no' +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_sys_assert_avail" >&5 +$as_echo "$mhd_cv_sys_assert_avail" >&6; } + if test "x$mhd_cv_sys_assert_avail" = x"yes"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system assert() is usable" >&5 +$as_echo_n "checking whether system assert() is usable... " >&6; } +if ${mhd_cv_sys_assert_use+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + mhd_cv_sys_assert_use='assuming yes' +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$mhd_assert_test_prg +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + mhd_cv_sys_assert_use='no' +else + mhd_cv_sys_assert_use='yes' +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mhd_cv_sys_assert_use" >&5 +$as_echo "$mhd_cv_sys_assert_use" >&6; } + if test "x$mhd_cv_sys_assert_use" = x"no"; then : + +else + +$as_echo "#define HAVE_ASSERT 1" >>confdefs.h + +fi + + +fi + { mhd_assert_test_prg=; unset mhd_assert_test_prg;} + +else + +$as_echo "#define NDEBUG 1" >>confdefs.h + + +fi + +MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined" + + + + + + +# for pkg-config + + + + + + + +# Used for 'po' directory staff + +EMPTY_VAR= + + +ac_config_files="$ac_config_files libmicrohttpd.pc w32/common/microhttpd_dll_res_vc.rc po/configure.acT:po/configure.ac.in Makefile contrib/Makefile doc/Makefile doc/doxygen/libmicrohttpd.doxy doc/doxygen/Makefile doc/examples/Makefile m4/Makefile src/Makefile src/include/Makefile src/microhttpd/Makefile src/examples/Makefile src/testcurl/Makefile src/testcurl/https/Makefile src/testzzuf/Makefile" + +ac_config_commands="$ac_config_commands po/configargs.stamp" + +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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; 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 + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_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= +U= +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=`$as_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. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${CYGWIN_TARGET_TRUE}" && test -z "${CYGWIN_TARGET_FALSE}"; then + as_fn_error $? "conditional \"CYGWIN_TARGET\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_POSIX_THREADS_TRUE}" && test -z "${HAVE_POSIX_THREADS_FALSE}"; then + as_fn_error $? "conditional \"HAVE_POSIX_THREADS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_POSIX_THREADS_TRUE}" && test -z "${USE_POSIX_THREADS_FALSE}"; then + as_fn_error $? "conditional \"USE_POSIX_THREADS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_W32_THREADS_TRUE}" && test -z "${USE_W32_THREADS_FALSE}"; then + as_fn_error $? "conditional \"USE_W32_THREADS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_W32_TRUE}" && test -z "${HAVE_W32_FALSE}"; then + as_fn_error $? "conditional \"HAVE_W32\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${W32_SHARED_LIB_EXP_TRUE}" && test -z "${W32_SHARED_LIB_EXP_FALSE}"; then + as_fn_error $? "conditional \"W32_SHARED_LIB_EXP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_MS_LIB_TOOL_TRUE}" && test -z "${USE_MS_LIB_TOOL_FALSE}"; then + as_fn_error $? "conditional \"USE_MS_LIB_TOOL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LISTEN_SHUTDOWN_TRUE}" && test -z "${HAVE_LISTEN_SHUTDOWN_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LISTEN_SHUTDOWN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +if test -z "${HAVE_CURL_BINARY_TRUE}" && test -z "${HAVE_CURL_BINARY_FALSE}"; then + as_fn_error $? "conditional \"HAVE_CURL_BINARY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_MAKEINFO_BINARY_TRUE}" && test -z "${HAVE_MAKEINFO_BINARY_FALSE}"; then + as_fn_error $? "conditional \"HAVE_MAKEINFO_BINARY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${W32_STATIC_LIB_TRUE}" && test -z "${W32_STATIC_LIB_FALSE}"; then + as_fn_error $? "conditional \"W32_STATIC_LIB\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_DOC_TRUE}" && test -z "${BUILD_DOC_FALSE}"; then + as_fn_error $? "conditional \"BUILD_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_EXAMPLES_TRUE}" && test -z "${BUILD_EXAMPLES_FALSE}"; then + as_fn_error $? "conditional \"BUILD_EXAMPLES\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MHD_HAVE_TSEARCH_TRUE}" && test -z "${MHD_HAVE_TSEARCH_FALSE}"; then + as_fn_error $? "conditional \"MHD_HAVE_TSEARCH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_CURL_TRUE}" && test -z "${HAVE_CURL_FALSE}"; then + as_fn_error $? "conditional \"HAVE_CURL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBMAGIC_TRUE}" && test -z "${HAVE_LIBMAGIC_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBMAGIC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_POSTPROCESSOR_TRUE}" && test -z "${HAVE_POSTPROCESSOR_FALSE}"; then + as_fn_error $? "conditional \"HAVE_POSTPROCESSOR\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_ZZUF_TRUE}" && test -z "${HAVE_ZZUF_FALSE}"; then + as_fn_error $? "conditional \"HAVE_ZZUF\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_SOCAT_TRUE}" && test -z "${HAVE_SOCAT_FALSE}"; then + as_fn_error $? "conditional \"HAVE_SOCAT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_GNUTLS_TRUE}" && test -z "${HAVE_GNUTLS_FALSE}"; then + as_fn_error $? "conditional \"HAVE_GNUTLS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_GNUTLS_SNI_TRUE}" && test -z "${HAVE_GNUTLS_SNI_FALSE}"; then + as_fn_error $? "conditional \"HAVE_GNUTLS_SNI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_HTTPS_TRUE}" && test -z "${ENABLE_HTTPS_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_HTTPS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HTTPS_REQUIRE_GRYPT_TRUE}" && test -z "${HTTPS_REQUIRE_GRYPT_FALSE}"; then + as_fn_error $? "conditional \"HTTPS_REQUIRE_GRYPT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_BAUTH_TRUE}" && test -z "${ENABLE_BAUTH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_BAUTH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_DAUTH_TRUE}" && test -z "${ENABLE_DAUTH_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_DAUTH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ENABLE_UPGRADE_TRUE}" && test -z "${ENABLE_UPGRADE_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_UPGRADE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_FORK_WAITPID_TRUE}" && test -z "${HAVE_FORK_WAITPID_FALSE}"; then + as_fn_error $? "conditional \"HAVE_FORK_WAITPID\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USE_COVERAGE_TRUE}" && test -z "${USE_COVERAGE_FALSE}"; then + as_fn_error $? "conditional \"USE_COVERAGE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $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} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## 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=: + # Pre-4.2 versions of Zsh do 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_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +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.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +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 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + 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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_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 || +$as_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" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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 GNU Libmicrohttpd $as_me 0.9.59, which was +generated by GNU Autoconf 2.69. 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 + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# 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_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + 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 . +GNU Libmicrohttpd home page: . +General help using GNU software: ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +GNU Libmicrohttpd config.status 0.9.59 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 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' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +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=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + 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 ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_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. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append 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 || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +LD_RC='`$ECHO "$LD_RC" | $SED "$delay_single_quote_subst"`' +reload_flag_RC='`$ECHO "$reload_flag_RC" | $SED "$delay_single_quote_subst"`' +reload_cmds_RC='`$ECHO "$reload_cmds_RC" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_RC='`$ECHO "$old_archive_cmds_RC" | $SED "$delay_single_quote_subst"`' +compiler_RC='`$ECHO "$compiler_RC" | $SED "$delay_single_quote_subst"`' +GCC_RC='`$ECHO "$GCC_RC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_RC='`$ECHO "$lt_prog_compiler_no_builtin_flag_RC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_RC='`$ECHO "$lt_prog_compiler_pic_RC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_RC='`$ECHO "$lt_prog_compiler_wl_RC" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_RC='`$ECHO "$lt_prog_compiler_static_RC" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_RC='`$ECHO "$lt_cv_prog_compiler_c_o_RC" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_RC='`$ECHO "$archive_cmds_need_lc_RC" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_RC='`$ECHO "$enable_shared_with_static_runtimes_RC" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_RC='`$ECHO "$export_dynamic_flag_spec_RC" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_RC='`$ECHO "$whole_archive_flag_spec_RC" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_RC='`$ECHO "$compiler_needs_object_RC" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_RC='`$ECHO "$old_archive_from_new_cmds_RC" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_RC='`$ECHO "$old_archive_from_expsyms_cmds_RC" | $SED "$delay_single_quote_subst"`' +archive_cmds_RC='`$ECHO "$archive_cmds_RC" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_RC='`$ECHO "$archive_expsym_cmds_RC" | $SED "$delay_single_quote_subst"`' +module_cmds_RC='`$ECHO "$module_cmds_RC" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_RC='`$ECHO "$module_expsym_cmds_RC" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_RC='`$ECHO "$with_gnu_ld_RC" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_RC='`$ECHO "$allow_undefined_flag_RC" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_RC='`$ECHO "$no_undefined_flag_RC" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_RC='`$ECHO "$hardcode_libdir_flag_spec_RC" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_RC='`$ECHO "$hardcode_libdir_separator_RC" | $SED "$delay_single_quote_subst"`' +hardcode_direct_RC='`$ECHO "$hardcode_direct_RC" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_RC='`$ECHO "$hardcode_direct_absolute_RC" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_RC='`$ECHO "$hardcode_minus_L_RC" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_RC='`$ECHO "$hardcode_shlibpath_var_RC" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_RC='`$ECHO "$hardcode_automatic_RC" | $SED "$delay_single_quote_subst"`' +inherit_rpath_RC='`$ECHO "$inherit_rpath_RC" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_RC='`$ECHO "$link_all_deplibs_RC" | $SED "$delay_single_quote_subst"`' +always_export_symbols_RC='`$ECHO "$always_export_symbols_RC" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_RC='`$ECHO "$export_symbols_cmds_RC" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_RC='`$ECHO "$exclude_expsyms_RC" | $SED "$delay_single_quote_subst"`' +include_expsyms_RC='`$ECHO "$include_expsyms_RC" | $SED "$delay_single_quote_subst"`' +prelink_cmds_RC='`$ECHO "$prelink_cmds_RC" | $SED "$delay_single_quote_subst"`' +postlink_cmds_RC='`$ECHO "$postlink_cmds_RC" | $SED "$delay_single_quote_subst"`' +file_list_spec_RC='`$ECHO "$file_list_spec_RC" | $SED "$delay_single_quote_subst"`' +hardcode_action_RC='`$ECHO "$hardcode_action_RC" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in AS \ +DLLTOOL \ +OBJDUMP \ +SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_import \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ +nm_file_list_spec \ +lt_cv_truncate_bin \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +LD_RC \ +reload_flag_RC \ +compiler_RC \ +lt_prog_compiler_no_builtin_flag_RC \ +lt_prog_compiler_pic_RC \ +lt_prog_compiler_wl_RC \ +lt_prog_compiler_static_RC \ +lt_cv_prog_compiler_c_o_RC \ +export_dynamic_flag_spec_RC \ +whole_archive_flag_spec_RC \ +compiler_needs_object_RC \ +with_gnu_ld_RC \ +allow_undefined_flag_RC \ +no_undefined_flag_RC \ +hardcode_libdir_flag_spec_RC \ +hardcode_libdir_separator_RC \ +exclude_expsyms_RC \ +include_expsyms_RC \ +file_list_spec_RC; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path \ +reload_cmds_RC \ +old_archive_cmds_RC \ +old_archive_from_new_cmds_RC \ +old_archive_from_expsyms_cmds_RC \ +archive_cmds_RC \ +archive_expsym_cmds_RC \ +module_cmds_RC \ +module_expsym_cmds_RC \ +export_symbols_cmds_RC \ +prelink_cmds_RC \ +postlink_cmds_RC; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' + +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile' + + + + + +ac_configure_args="$ac_configure_args" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "MHD_config.h") CONFIG_HEADERS="$CONFIG_HEADERS MHD_config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "src/microhttpd/microhttpd_dll_res.rc") CONFIG_FILES="$CONFIG_FILES src/microhttpd/microhttpd_dll_res.rc" ;; + "libmicrohttpd.pc") CONFIG_FILES="$CONFIG_FILES libmicrohttpd.pc" ;; + "w32/common/microhttpd_dll_res_vc.rc") CONFIG_FILES="$CONFIG_FILES w32/common/microhttpd_dll_res_vc.rc" ;; + "po/configure.acT") CONFIG_FILES="$CONFIG_FILES po/configure.acT:po/configure.ac.in" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "contrib/Makefile") CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/doxygen/libmicrohttpd.doxy") CONFIG_FILES="$CONFIG_FILES doc/doxygen/libmicrohttpd.doxy" ;; + "doc/doxygen/Makefile") CONFIG_FILES="$CONFIG_FILES doc/doxygen/Makefile" ;; + "doc/examples/Makefile") CONFIG_FILES="$CONFIG_FILES doc/examples/Makefile" ;; + "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/include/Makefile") CONFIG_FILES="$CONFIG_FILES src/include/Makefile" ;; + "src/microhttpd/Makefile") CONFIG_FILES="$CONFIG_FILES src/microhttpd/Makefile" ;; + "src/examples/Makefile") CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;; + "src/testcurl/Makefile") CONFIG_FILES="$CONFIG_FILES src/testcurl/Makefile" ;; + "src/testcurl/https/Makefile") CONFIG_FILES="$CONFIG_FILES src/testcurl/https/Makefile" ;; + "src/testzzuf/Makefile") CONFIG_FILES="$CONFIG_FILES src/testzzuf/Makefile" ;; + "po/configargs.stamp") CONFIG_COMMANDS="$CONFIG_COMMANDS po/configargs.stamp" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + 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= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # 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. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[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="$ac_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 || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append 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 '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + 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 || +$as_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"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_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 || ac_write_fail=1 +# 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= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + 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 || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;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 +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_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 "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# 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 || +$as_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) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + 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 || +$as_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"` + # 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'`; 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 || +$as_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; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 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. + +# GNU Libtool 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 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool 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, see . + + +# The names of the tagged configurations supported by this script. +available_tags='RC ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Assembler program. +AS=$lt_AS + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Object dumper program. +OBJDUMP=$lt_OBJDUMP + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain=$ac_aux_dir/ltmain.sh + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: RC + +# The linker used to build libraries. +LD=$lt_LD_RC + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_RC +reload_cmds=$lt_reload_cmds_RC + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_RC + +# A language specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU compiler? +with_gcc=$GCC_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_RC + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_RC + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_RC + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_RC + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_RC + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_RC + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_RC + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_RC + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# ### END LIBTOOL TAG CONFIG: RC +_LT_EOF + + ;; + "po/configargs.stamp":C) + $as_echo "$ac_configure_args" > "$ac_tmp/configargs.stamp" || as_fn_error $? "cannot create file $ac_tmp/configargs.stamp" "$LINENO" 5 + if cmp -s "po/configargs.stamp" "$ac_tmp/configargs.stamp" >/dev/null 2>&1; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: po/configargs.stamp is unchanged" >&5 +$as_echo "$as_me: po/configargs.stamp is unchanged" >&6;} +else + + rm -f po/configargs.stamp + mv "$ac_tmp/configargs.stamp" po/configargs.stamp || as_fn_error $? "cannot create file $ac_tmp/configargs.stamp" "$LINENO" 5 + { $as_echo "$as_me:${as_lineno-$LINENO}: po/configargs.stamp is updated" >&5 +$as_echo "$as_me: po/configargs.stamp is updated" >&6;} + + +fi + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# 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 || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +# Finally: summary +if test "x$enable_curl" != "xyes"; then + MSG_CURL="no, many unit tests will not run" +else + MSG_CURL="yes" +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: GNU libmicrohttpd ${PACKAGE_VERSION} Configuration Summary: + Target directory: ${prefix} + Cross-compiling: ${cross_compiling} + Operating System: ${host_os} + Shutdown of listening socket trigger select: ${mhd_cv_host_shtdwn_trgr_select} + Inter-thread comm: ${use_itc} + poll support: ${enable_poll=no} + epoll support: ${enable_epoll=no} + sendfile used: ${found_sendfile} + HTTPS support: ${MSG_HTTPS} + Threading lib: ${USE_THREADS} + Use thread names: ${enable_thread_names} + Use debug asserts: ${enable_asserts} + Messages: ${enable_messages} + Basic auth.: ${enable_bauth} + Digest auth.: ${enable_dauth} + HTTP \"Upgrade\": ${enable_httpupgrade} + Postproc: ${enable_postprocessor} + Build docs: ${enable_doc} + Build examples: ${enable_examples} + Test with libcurl: ${MSG_CURL} +" >&5 +$as_echo "$as_me: GNU libmicrohttpd ${PACKAGE_VERSION} Configuration Summary: + Target directory: ${prefix} + Cross-compiling: ${cross_compiling} + Operating System: ${host_os} + Shutdown of listening socket trigger select: ${mhd_cv_host_shtdwn_trgr_select} + Inter-thread comm: ${use_itc} + poll support: ${enable_poll=no} + epoll support: ${enable_epoll=no} + sendfile used: ${found_sendfile} + HTTPS support: ${MSG_HTTPS} + Threading lib: ${USE_THREADS} + Use thread names: ${enable_thread_names} + Use debug asserts: ${enable_asserts} + Messages: ${enable_messages} + Basic auth.: ${enable_bauth} + Digest auth.: ${enable_dauth} + HTTP \"Upgrade\": ${enable_httpupgrade} + Postproc: ${enable_postprocessor} + Build docs: ${enable_doc} + Build examples: ${enable_examples} + Test with libcurl: ${MSG_CURL} +" >&6;} + +if test "x$enable_https" = "xyes" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: HTTPS subsystem configuration: + License : LGPL only + " >&5 +$as_echo "$as_me: HTTPS subsystem configuration: + License : LGPL only + " >&6;} +else + { $as_echo "$as_me:${as_lineno-$LINENO}: + License : LGPL or eCos +" >&5 +$as_echo "$as_me: + License : LGPL or eCos +" >&6;} +fi + +if test "x$enable_bauth" != "xyes" || \ + test "x$enable_dauth" != "xyes" || \ + test "x$enable_httpupgrade" != "xyes" || \ + test "x$enable_postprocessor" != "xyes" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This will be a custom build with missing symbols. Do NOT use this build in a distribution. Building with these kinds of configure options is only for custom builds for embedded systems." >&5 +$as_echo "$as_me: WARNING: This will be a custom build with missing symbols. Do NOT use this build in a distribution. Building with these kinds of configure options is only for custom builds for embedded systems." >&6;} +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c3d2826 --- /dev/null +++ b/configure.ac @@ -0,0 +1,2083 @@ +# This file is part of libmicrohttpd. +# (C) 2006-2017 Christian Grothoff (and other contributing authors) +# +# libmicrohttpd 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 3, or (at your +# option) any later version. +# +# libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# +# Process this file with autoconf to produce a configure script. +# +# +AC_PREREQ([2.64]) +LT_PREREQ([2.4.0]) +AC_INIT([GNU Libmicrohttpd],[0.9.59],[libmicrohttpd@gnu.org]) +AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) +AC_CONFIG_HEADERS([MHD_config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +LIB_VERSION_CURRENT=58 +LIB_VERSION_REVISION=0 +LIB_VERSION_AGE=46 +AC_SUBST(LIB_VERSION_CURRENT) +AC_SUBST(LIB_VERSION_REVISION) +AC_SUBST(LIB_VERSION_AGE) + +AC_MSG_CHECKING([[whether z/OS special settings are required]]) +if test `uname -s` = "OS/390" +then +# configure binaries for z/OS + if test -z "$CC" + then + CC=`pwd`"/contrib/xcc" + chmod +x $CC || true + fi + if test -z "$CPP" + then + CPP="c89 -E" + fi + if test -z "$CXXCPP" + then + CXXCPP="c++ -E -+" + fi + AC_MSG_RESULT([[yes]]) +# _CCC_CCMODE=1 +# _C89_CCMODE=1 +else + AC_MSG_RESULT([[no]]) +fi + +# Checks for programs. +AC_PROG_AWK +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_CANONICAL_HOST +AC_PROG_CC_STDC +MHD_SYS_EXT +LT_INIT([win32-dll]) +LT_LANG([Windows Resource]) + +# Workaround for libgcrypt +AS_IF([[test "x$lt_sysroot" != "x" && test "x$SYSROOT" = "x"]], [[SYSROOT="$lt_sysroot"]]) + +PACKAGE_VERSION_MAJOR='m4_car(m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))' +PACKAGE_VERSION_MINOR='m4_argn(2, m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))' +PACKAGE_VERSION_SUBMINOR='m4_argn(3, m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.])))' +AS_VAR_ARITH([MHD_W32_DLL_SUFF],[[$LIB_VERSION_CURRENT - $LIB_VERSION_AGE]]) +AC_SUBST([PACKAGE_VERSION_MAJOR]) +AC_SUBST([PACKAGE_VERSION_MINOR]) +AC_SUBST([PACKAGE_VERSION_SUBMINOR]) +AC_SUBST([MHD_W32_DLL_SUFF]) +AC_CONFIG_FILES([src/microhttpd/microhttpd_dll_res.rc]) + +MHD_LIB_CPPFLAGS="" +MHD_LIB_CFLAGS="" +MHD_LIB_LDFLAGS="" +MHD_LIBDEPS="" +# for pkg-config +MHD_REQ_PRIVATE='' +MHD_LIBDEPS_PKGCFG='' + +AH_TEMPLATE([[HAVE_STDBOOL_H]], [Define to 1 if you have the header file and defines 'bool' type.]) +AH_TEMPLATE([[HAVE_REAL_BOOL]], [Define to 1 if you have the real boolean type.]) +AH_TEMPLATE([[bool]], [Define to type name which will be used as boolean type.]) +AC_CHECK_HEADER([stdbool.h], + [ + AC_CHECK_TYPE([bool], + [ + AC_DEFINE([[HAVE_STDBOOL_H]], [[1]]) + AC_DEFINE([[HAVE_REAL_BOOL]], [[1]]) + ], + [ + AC_MSG_WARN([[Header is present, but "bool" type cannot be detected. Check compiler flags.]]) + AC_DEFINE([[bool]], [[int]]) + ], [ +#include + ] + ) + ], + [ + AC_CHECK_TYPE([bool], + [AC_DEFINE([[HAVE_REAL_BOOL]], [[1]])], + [ + AC_CHECK_TYPE([_Bool], + [ + AC_DEFINE([[HAVE_REAL_BOOL]], [[1]]) + AC_DEFINE([[bool]], [[_Bool]]) + ], + [ + AC_DEFINE([[bool]], [[int]]) + ], [] + ) + ], [] + ) + ], + [AC_INCLUDES_DEFAULT] +) + +AC_CACHE_CHECK([[whether "true" is defined or builtin]], [[mhd_cv_macro_true_defined]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include +#endif + ]], [[ +#if defined(true) + /* dummy */ +#else + (void)true; +#endif + ]]) + ], [[mhd_cv_macro_true_defined='yes']], [[mhd_cv_macro_true_defined='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_true_defined]], [["yes"]], [[:]], + [AC_DEFINE([[true]],[[(!0)]], [Define to value interpreted by compiler as boolean "true", if "true" is not defined by system headers.])]) + +AC_CACHE_CHECK([[whether "false" is defined or builtin]], [[mhd_cv_macro_false_defined]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include +#endif + ]], [[ +#if !defined(false) + (void)false; +#else + /* dummy */ +#endif + ]]) + ], [[mhd_cv_macro_false_defined='yes']], [[mhd_cv_macro_false_defined='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_false_defined]], [["yes"]], [[:]], + [AC_DEFINE([[false]],[[0]], [Define to value interpreted by compiler as boolean "false", if "false" is not defined by system headers.])]) + +AC_CACHE_CHECK([[whether "true" and "false" could be used]], [[mhd_cv_macro_true_false_valid]], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_STDBOOL_H +#include +#endif + ]], [[ + int var1[true ? 1 : -1] = { 1 }; + int var2[false ? -1 : 1] = { 2 }; + int var3[!true ? -1 : 1] = { 3 }; + int var4[!false ? 1 : -1] = { 4 }; + if (var1[0] == var2[0] || var3[0] == var4[0]) + return 1; + ]]) + ], [[mhd_cv_macro_true_false_valid='yes']], [[mhd_cv_macro_true_false_valid='no']]) + ]) +AS_VAR_IF([[mhd_cv_macro_true_false_valid]], [["yes"]], [[:]], + [AC_MSG_ERROR([[Value of "true" or value of "false" is not valid. Check config.log for details.]])]) + + +AX_CHECK_COMPILE_FLAG([[-Werror=attributes]], + [ + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror=attributes" + AC_MSG_CHECKING([[whether -Werror=attributes actually works]]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[__attribute__((non_existing_attrb_dummy)) int SimpleFunc(void) {return 3;}]], [[int r = SimpleFunc(); if (r) return r;]])], + [ + AC_MSG_RESULT([[no]]) + errattr_CFLAGS="" + ], [ + AC_MSG_RESULT([[yes]]) + errattr_CFLAGS="-Werror=attributes" + ]) + CFLAGS="$save_CFLAGS" + ], + [[errattr_CFLAGS=""]], [], []) +AC_MSG_CHECKING([[for function inline keywords suppoted by $CC]]) +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $errattr_CFLAGS" +inln_prfx="none" +# Prefer always inline functions +for inln_prfx_chk in InlineWithAttr __forceinline inline __inline__ __inline _inline _Inline; do + # Try to link to avoid "symbol undefined" problems at build time + AS_IF([[test "x$inln_prfx_chk" = "xInlineWithAttr"]], + [ + AS_IF([[test "x$errattr_CFLAGS" = "x"]], + [[ # Skip test with attribute as negative result can't be detected + inln_prfx_chk="__forceinline" # use next value + ]],[[inln_prfx_chk="inline __attribute__((always_inline))"]]) + ]) + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[ +#ifdef __cplusplus +#error This test is only for C. +choke me +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif + static $inln_prfx_chk bool cmpfn(int x, int y) + { return x > y; } + static $inln_prfx_chk int sumfn(int x, int y) + { return x + y; } + ]],[[ + int a = 1, b = 100, c; + if (cmpfn(a, b)) + c = sumfn(a, b); + else + c = 0 - sumfn(a, b); + ]]) + ], + [[ inln_prfx="$inln_prfx_chk" ]]) + test "x$inln_prfx" != "xnone" && break +done +AS_IF([[test "x$inln_prfx" != "xnone"]], + [ + AC_DEFINE([INLINE_FUNC],[1],[Define to 1 if your C compiler supports inline functions.]) + AC_DEFINE_UNQUOTED([_MHD_static_inline],[static $inln_prfx],[Define to prefix which will be used with MHD static inline functions.]) + ], [ + AC_DEFINE([_MHD_static_inline],[static],[Define to prefix which will be used with MHD static inline functions.]) + ]) +AC_MSG_RESULT([[$inln_prfx]]) +CFLAGS="$save_CFLAGS" + +# Check system type +shutdown_trig_select='no' +AC_MSG_CHECKING([[for target host OS]]) +case "$host_os" in +*darwin* | *rhapsody* | *macosx*) + AC_DEFINE_UNQUOTED(OSX,1,[This is an OS X system]) + CFLAGS="-no-cpp-precomp -fno-common $CFLAGS" + mhd_host_os='Darwin' + AC_MSG_RESULT([[$mhd_host_os]]) + ;; +freebsd*) + AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) + AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system]) + mhd_host_os='FreeBSD' + AC_MSG_RESULT([[$mhd_host_os]]) + ;; +openbsd*) + AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) + AC_DEFINE_UNQUOTED(OPENBSD,1,[This is an OpenBSD system]) + mhd_host_os='OpenBSD' + AC_MSG_RESULT([[$mhd_host_os]]) + ;; +netbsd*) + AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) + AC_DEFINE_UNQUOTED(NETBSD,1,[This is a NetBSD system]) + mhd_host_os='NetBSD' + AC_MSG_RESULT([[$mhd_host_os]]) + ;; +*solaris*) + AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system]) + AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work]) + mhd_host_os='Solaris' + AC_MSG_RESULT([[$mhd_host_os]]) + AC_SEARCH_LIBS(gethostbyname, nsl) + AC_SEARCH_LIBS(socket, socket) + ;; +*arm-linux*) + AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel]) + mhd_host_os='ARM Linux' + AC_MSG_RESULT([[$mhd_host_os]]) + CFLAGS="-fPIC -pipe $CFLAGS" + ;; +*linux*) + AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux kernel]) + mhd_host_os='Linux' + AC_MSG_RESULT([[$mhd_host_os]]) + ;; +*cygwin*) + AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) + mhd_host_os='Windows (Cygwin)' + AC_MSG_RESULT([[$mhd_host_os]]) + os_is_windows=yes + ;; +*mingw*) + AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) + AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) + mhd_host_os='Windows (MinGW)' + AC_MSG_RESULT([[$mhd_host_os]]) + LIBS="$LIBS -lws2_32" + AC_CHECK_HEADERS([winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([[Winsock2 headers are required for W32]])], [AC_INCLUDES_DEFAULT]) + AC_CACHE_CHECK([for MS lib utility], [ac_cv_use_ms_lib_tool], + [[mslibcheck=`lib 2>&1` + if [[ $mslibcheck = "Microsoft (R) Library Manager"* ]]; then + ac_cv_use_ms_lib_tool=yes + else + ac_cv_use_ms_lib_tool=no + fi + ]]) + if test "x$ac_cv_use_ms_lib_tool" = "xyes"; then + AC_SUBST([MS_LIB_TOOL], [[lib]]) + fi + AC_SUBST([lt_cv_objdir]) + os_is_windows=yes + os_is_native_w32=yes + ;; +*openedition*) + AC_DEFINE_UNQUOTED(OS390,1,[This is a OS/390 system]) + mhd_host_os='OS/390' + AC_MSG_RESULT([[$mhd_host_os]]) + ;; +gnu*) + AC_DEFINE([[GNU_HURD]], [[1]], [Define to `1' if host machine runs on GNU Hurd.]) + mhd_host_os='GNU Hurd' + AC_MSG_RESULT([[$mhd_host_os]]) + ;; +*) + mhd_host_os='unrecognised OS' + AC_MSG_RESULT([[$mhd_host_os]]) + AC_MSG_WARN([Unrecognised OS $host_os]) + AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS]) +;; +esac + +AM_CONDITIONAL([CYGWIN_TARGET], [[test "x$os_is_windows" = "xyes" && \ + test "x${os_is_native_w32}" != "xyes"]]) + +AC_ARG_WITH([threads], + [AS_HELP_STRING([--with-threads=LIB],[choose threading library (posix, w32, auto) [auto]])], + [], [with_threads='auto']) +AS_CASE([[$with_threads]], + [[win32]], [[with_threads='w32']], + [[pthreads]], [[with_threads='posix']], + [[posix]], [[:]], + [[w32]], [[:]], + [[auto]], [[:]], + [AC_MSG_ERROR([[incorrect parameter "$with_threads" specified for --with-threads]])] +) + +# Check for posix threads support, regardless of configure parameters as +# testsuite use only posix threads. +AX_PTHREAD( + [ + mhd_have_posix_threads='yes' + AC_DEFINE([[HAVE_PTHREAD_H]],[[1]],[Define to 1 if you have the header file.]) + ],[[mhd_have_posix_threads='no']]) +AM_CONDITIONAL([HAVE_POSIX_THREADS],[test "x$mhd_have_posix_threads" = "xyes"]) + +mhd_have_w32_threads='no' +AS_IF([[test "x$with_threads" = "xauto"]], + [ + AS_IF([[test "x$os_is_windows" = "xyes"]], + [ + AC_MSG_CHECKING([[for W32 threads]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include + ]], [ HANDLE h = CreateThread(NULL, 0, NULL, NULL, 0, NULL);])] + , [[mhd_have_w32_threads='yes']], [[mhd_have_w32_threads='no']] + ) + AC_MSG_RESULT([[$mhd_have_w32_threads]]) + ]) + ] +) + +AC_MSG_CHECKING([[for threading lib to use with libmicrohttpd]]) +AS_IF([[test "x$with_threads" = "xposix"]], + [ # forced posix threads + AS_IF([[test "x$mhd_have_posix_threads" = "xyes"]], [[ USE_THREADS='posix' ]], + [ AS_IF([[test "x$os_is_windows" = "xyes"]] , + [ AC_MSG_ERROR([[Posix threads are not available. Try to configure --with-threads=auto]])], + [ AC_MSG_ERROR([[No threading lib is available. Consider installing pthreads]])] ) + ]) + ] , + [[ test "x$with_threads" = "xw32" ]] , + [ # forced w32 threads + AS_IF([[test "x$mhd_have_w32_threads" = "xyes"]], + [[ USE_THREADS='w32' ]], + [ AC_MSG_ERROR([[W32 threads are not available. Try to configure --with-threads=auto]])]) + ] , + [ # automatic threads lib selection + AS_IF([[test "x$os_is_native_w32" = "xyes" && test "x$mhd_have_w32_threads" = "xyes"]] , + [[ USE_THREADS='w32' ]] , + [[ test "x$mhd_have_posix_threads" = "xyes" ]], [[ USE_THREADS='posix' ]], + [[ test "x$mhd_have_w32_threads" = "xyes" ]], [[ USE_THREADS='w32' ]], + [ AC_MSG_ERROR([[No threading lib is available. Consider installing pthreads]]) ] + ) + ] + ) +if test "x$USE_THREADS" = "xposix"; then + CC="$PTHREAD_CC" + AC_DEFINE([MHD_USE_POSIX_THREADS],[1],[define to use pthreads]) + MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $PTHREAD_CFLAGS" + MHD_LIBDEPS="$PTHREAD_LIBS $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$PTHREAD_LIBS $MHD_LIBDEPS_PKGCFG" +elif test "x$USE_THREADS" = "xw32"; then + AC_DEFINE([MHD_USE_W32_THREADS],[1],[define to use W32 threads]) +fi +AM_CONDITIONAL([USE_POSIX_THREADS], [test "x$USE_THREADS" = "xposix"]) +AM_CONDITIONAL([USE_W32_THREADS], [test "x$USE_THREADS" = "xw32"]) +AC_MSG_RESULT([[$USE_THREADS]]) + +AC_ARG_ENABLE([[thread-names]], + [AS_HELP_STRING([--disable-thread-names [auto] ],[do not set names on MHD generated threads])], + [], [enable_thread_names='auto']) + +if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; then + # Check for thread name function + HAVE_THREAD_NAME_FUNC="no" + SAVE_LIBS="$LIBS" + SAVE_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + AC_CHECK_HEADERS([pthread_np.h],[],[], + [ +AC_INCLUDES_DEFAULT + [ +#include + ] + ]) + + # Try to find how to set thread name by thread attributes. + # If pthread_attr_setname_np(3) is not declared, it's not possible to detect + # form of pthread_attr_setname_np(3) due to C "feature" "implicit declaration". + AC_CHECK_DECL([[pthread_attr_setname_np]],[],[],[[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]]) + + AS_IF([[test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_attr_setname_np(3) in NetBSD or OSF1 form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[ + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setname_np(&thr_attr, "name", 0); + pthread_attr_destroy(&thr_attr); + ]])], + [AC_DEFINE([[HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD]], [[1]], [Define if you have NetBSD form (or OSF1 form) of pthread_attr_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_attr_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_attr_setname_np(3) in IBM i form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[ + pthread_attr_t thr_attr; + pthread_attr_init(&thr_attr); + pthread_attr_setname_np(&thr_attr, "name"); + pthread_attr_destroy(&thr_attr); + ]])], + [AC_DEFINE([[HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI]], [[1]], [Define if you have IBM i form of pthread_attr_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + # Try to find how to set thread name for started thread - less convinent + # than setting name by attributes. + # If pthread_setname_np(3) is not declared, it's not possible to detect + # form of pthread_setname_np(3) due to C "feature" "implicit declaration". + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes"]], + [AC_CHECK_DECL([[pthread_setname_np]],[],[],[[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + ]]) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_setname_np(3) in NetBSD or OSF1 form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[int res = pthread_setname_np(pthread_self(), "name", 0);]])], + [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_NETBSD]], [[1]], [Define if you have NetBSD form (or OSF1 form) of pthread_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_setname_np(3) in GNU/Linux form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[int res = pthread_setname_np(pthread_self(), "name");]])], + [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_GNU]], [[1]], [Define if you have GNU/Linux form of pthread_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], + [AC_MSG_CHECKING([[for pthread_setname_np(3) in Darwin form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[int res = pthread_setname_np("name");]])], + [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_DARWIN]], [[1]], [Define if you have Darwin form of pthread_setname_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ]) + + AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes"]], + [ + AC_CHECK_DECL([[pthread_set_name_np]], + [ + AC_MSG_CHECKING([[for pthread_set_name_np(3) in FreeBSD form]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif +]], [[pthread_set_name_np(pthread_self(), "name");]])], + [AC_DEFINE([[HAVE_PTHREAD_SET_NAME_NP_FREEBSD]], [[1]], [Define if you have FreeBSD form of pthread_set_name_np(3) function.]) + HAVE_THREAD_NAME_FUNC="yes" + AC_MSG_RESULT([[yes]])], + [AC_MSG_RESULT([[no]])] + ) + ],[],[[ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif + ]] + ) + ]) + + LIBS="$SAVE_LIBS" + CFLAGS="$SAVE_CFLAGS" +fi + +AS_IF( + [[test "x$enable_thread_names" != "xno"]], + [ + AC_MSG_CHECKING([[whether to enable thread names]]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], [[ +#ifdef MHD_NO_THREAD_NAMES +#error Thread names are disabled. +choke me +#endif + +/* Keep in sync with mhd_threads.h */ +#if defined(MHD_USE_POSIX_THREADS) && (defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) || \ + defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || \ + defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) ) +int a = 1; +#elif defined(MHD_USE_W32_THREADS) && defined(_MSC_FULL_VER) +int b = 2; +#else +#error No thread name function is available. +choke me +#endif + ]]) + ], [ + enable_thread_names='yes' + ], [ + AS_IF([[test "x$enable_thread_names" = "xyes"]], + [ + AC_MSG_RESULT([[no]]) + AC_MSG_ERROR([[thread names was explicitly requested, but thread name function is not available]]) + ]) + enable_thread_names='no' + ]) + AC_MSG_RESULT([[$enable_thread_names]]) + ]) + +AS_IF([[test "x$enable_thread_names" = "xno"]], + [AC_DEFINE([[MHD_NO_THREAD_NAMES]], [[1]], [Define to 1 to disable setting name on generated threads])]) + +AM_CONDITIONAL(HAVE_W32, [test "x$os_is_native_w32" = "xyes"]) +w32_shared_lib_exp=no +if test "x$enable_shared" = "xyes" && test "x$os_is_native_w32" = "xyes"; then + if test "x$ac_cv_use_ms_lib_tool" = "xyes" || test -n "$DLLTOOL"; then + w32_shared_lib_exp=yes + else + AC_MSG_WARN([[GNU dlltool or MS lib.exe is required for creating shared library export on W32]]) + AC_MSG_WARN([[Export library libmicrohttpd.lib will not be created]]) + fi +fi +AM_CONDITIONAL(W32_SHARED_LIB_EXP, [test "x$w32_shared_lib_exp" = "xyes"]) +AM_CONDITIONAL(USE_MS_LIB_TOOL, [test "x$ac_cv_use_ms_lib_tool" = "xyes"]) + +MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER([AC_DEFINE([HAVE_LISTEN_SHUTDOWN],[1],[can use shutdown on listen sockets])]) +AM_CONDITIONAL([HAVE_LISTEN_SHUTDOWN], [test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"]) + +# set GCC options +# use '-fno-strict-aliasing', but only if the compiler +# and linker can take it +AX_CHECK_LINK_FLAG([-fno-strict-aliasing], + [AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing])]) + +AC_C_BIGENDIAN + +AC_CHECK_PROG([HAVE_CURL_BINARY],[curl],[yes],[no]) +AM_CONDITIONAL([HAVE_CURL_BINARY],[test "x$HAVE_CURL_BINARY" = "xyes"]) +AC_CHECK_PROG([HAVE_MAKEINFO_BINARY],[makeinfo],[yes],[no]) +AM_CONDITIONAL([HAVE_MAKEINFO_BINARY],[test "x$HAVE_MAKEINFO_BINARY" = "xyes"]) +AM_CONDITIONAL(W32_STATIC_LIB, [test "x$os_is_native_w32" = "xyes" && test "x$enable_static" = "xyes"]) + + +AC_ARG_ENABLE([[doc]], + [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], , + [enable_doc=yes]) +test "x$enable_doc" = "xno" || enable_doc=yes +AM_CONDITIONAL([BUILD_DOC], [test "x$enable_doc" = "xyes"]) + +AC_ARG_ENABLE([[examples]], + [AS_HELP_STRING([[--disable-examples]], [do not build any examples])], , + [enable_examples=yes]) +test "x$enable_examples" = "xno" || enable_examples=yes +AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$enable_examples" = "xyes"]) + +AC_ARG_ENABLE([[poll]], + [AS_HELP_STRING([[--enable-poll[=ARG]]], [enable poll support (yes, no, auto) [auto]])], + [enable_poll=${enableval}], + [enable_poll='auto'] + ) + +if test "$enable_poll" != "no"; then + if test "$os_is_native_w32" != "yes"; then + AC_CHECK_HEADERS([poll.h], + [ + AC_CHECK_FUNCS([poll], [have_poll='yes'], [have_poll='no']) + ], [], [AC_INCLUDES_DEFAULT]) + else + AC_MSG_CHECKING([for WSAPoll()]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]], [[ +WSAPOLLFD fda[2]; +WSAPoll(fda, 2, 0);]])], + [ + have_poll='yes' + AC_DEFINE([HAVE_POLL],[1]) + ], [have_poll='no']) + AC_MSG_RESULT([$have_poll]) + fi + if test "$enable_poll" = "yes" && test "$have_poll" != "yes"; then + AC_MSG_ERROR([[Support for poll was explicitly requested but cannot be enabled on this platform.]]) + fi + enable_poll="$have_poll" +fi + +AC_ARG_ENABLE([[epoll]], + [AS_HELP_STRING([[--enable-epoll[=ARG]]], [enable epoll support (yes, no, auto) [auto]])], + [enable_epoll=${enableval}], + [enable_epoll='auto'] + ) + +if test "$enable_epoll" != "no"; then + AX_HAVE_EPOLL + if test "${ax_cv_have_epoll}" = "yes"; then + AC_DEFINE([[EPOLL_SUPPORT]],[[1]],[Define to 1 to enable epoll support]) + enable_epoll='yes' + else + if test "$enable_epoll" = "yes"; then + AC_MSG_ERROR([[Support for epoll was explicitly requested but cannot be enabled on this platform.]]) + fi + enable_epoll='no' + fi +fi + +if test "x$enable_epoll" = "xyes"; then + AC_CACHE_CHECK([for epoll_create1()], [mhd_cv_have_epoll_create1], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]], [[ +int fd; +fd = epoll_create1(EPOLL_CLOEXEC);]])], + [mhd_cv_have_epoll_create1=yes], + [mhd_cv_have_epoll_create1=no])]) + AS_IF([test "x$mhd_cv_have_epoll_create1" = "xyes"],[ + AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1 function.])]) +fi + +# Check for headers that are ALWAYS required +AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h], [], [AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files])], [AC_INCLUDES_DEFAULT]) + +# Check for optional headers +AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h time.h sys/mman.h sys/ioctl.h \ + sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \ + endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \ + inttypes.h stddef.h unistd.h \ + sockLib.h inetLib.h net/if.h], [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_HEADER([[search.h]], + [ + gl_FUNC_TSEARCH + AS_IF([[test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]], + [AC_DEFINE([[HAVE_SEARCH_H]], [[1]], + [Define to 1 if you have the header file and your system have properly functioning tsearch(), tfind() and tdelete() functions])]) + ], + [], [AC_INCLUDES_DEFAULT]) + +AM_CONDITIONAL([MHD_HAVE_TSEARCH], [[test "x$ac_cv_header_search_h" = xyes && test "x$HAVE_TSEARCH" = "x1" && test "x$REPLACE_TSEARCH" != "x1"]]) + +# Check for generic functions +AC_CHECK_FUNCS([rand random]) + +AC_CHECK_MEMBER([struct sockaddr_in.sin_len], + [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?]) + ], + [], + [ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif + ]) + +AC_CHECK_DECLS([getsockname], + [ + AC_CHECK_FUNCS([getsockname], + [ + AC_CACHE_CHECK([[whether getsockname() is usable]], [[mhc_cv_getsockname_usable]], + [ + AC_RUN_IFELSE( + [ + AC_LANG_SOURCE( + [[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WINSOCK2_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_IP_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + + +static void zr_mem(void *ptr, socklen_t size) +{ char *mem = ptr; while(size--) {mem[0] = 0; mem++;} } + +int main(void) +{ + const socklen_t c_addr_size = (socklen_t)sizeof(struct sockaddr_in); + struct sockaddr_in sa; + socklen_t addr_size; + int ret = 1; +#if !defined(_WIN32) || defined(__CYGWIN__) + int sckt; + const int invld_sckt = -1; +#else + SOCKET sckt; + const SOCKET invld_sckt = INVALID_SOCKET; + WSADATA wsa_data; + + if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion) + return 20; +#endif + + sckt = socket (PF_INET, SOCK_STREAM, 0); + if (invld_sckt != sckt) + { + zr_mem(&sa, c_addr_size); + sa.sin_family = AF_INET; +#if HAVE_SOCKADDR_IN_SIN_LEN + sa.sin_len = c_addr_size; +#endif + if (0 == bind (sckt, (struct sockaddr *)&sa, c_addr_size)) + { + if (0 == listen (sckt, 1)) + { + addr_size = c_addr_size; + if (0 == getsockname (sckt, (struct sockaddr *)&sa, &addr_size)) + { + if (c_addr_size >= addr_size) + { + if (0 != ntohs(sa.sin_port)) + { ret = 0; + } else ret = 7; + } else ret = 6; + } else ret = 5; + } else ret = 4; + } else ret = 3; + } else ret = 2; +#if !defined(_WIN32) || defined(__CYGWIN__) + close (sckt); +#else + closesocket (sckt); + WSACleanup(); +#endif + return ret; +} + ]] + ) + ], + [[mhc_cv_getsockname_usable='yes']], + [[mhc_cv_getsockname_usable='no']], + [[mhc_cv_getsockname_usable='assuming yes']] + ) + ] + ) + AS_VAR_IF([[mhc_cv_getsockname_usable]], [["no"]], [:], + [AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable `getsockname' function.])]) + ] + ) + ], [], + [[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WINSOCK2_H +#include +#endif + ]] +) + +# Check for inter-thread signaling type +AC_ARG_ENABLE([[itc]], + [AS_HELP_STRING([[--enable-itc=TYPE]], [use TYPE of inter-thread communication (pipe, socketpair, eventfd) [auto]])], [], + [[enable_itc='auto']] +) + +AS_CASE([[$enable_itc]], + [[pipe]], [[:]], + [[socketpair]], [[:]], + [[eventfd]], [[:]], + [[auto]], [AS_VAR_IF([[os_is_windows]], [["yes"]], [[enable_itc='socketpair']])], + [[eventFD]], [[enable_itc='eventfd']], + [[socket]], [[enable_itc='socketpair']], + [[no]], [AC_MSG_ERROR([[inter-thread communication cannot be disabled]])], + [AC_MSG_ERROR([[unrecognized type "$enable_itc" of inter-thread communication specified by "--enable-itc=$enable_itc"]])] +) +# AS_UNSET([[use_itc]]) + +AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [ + AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ + AC_CHECK_HEADERS([sys/eventfd.h], [], [], [AC_INCLUDES_DEFAULT]) + AS_VAR_IF([[ac_cv_header_sys_eventfd_h]], [["yes"]], [ + AC_CACHE_CHECK([whether eventfd(2) is usable], [[mhd_cv_eventfd_usable]], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]], [[int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK) + ]]) + ], [[mhd_cv_eventfd_usable='yes']], [[mhd_cv_eventfd_usable='no']]) + ]) + ]) + ]) + AS_VAR_IF([[mhd_cv_eventfd_usable]], [["yes"]], [ + use_itc='eventfd' + enable_itc="$use_itc" + AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for inter-thread communication]) + ], [ + AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is not usable, consider using other type of inter-thread communication]])]) + ]) +]) + +AS_IF([[test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"]], [ + AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ + AC_CACHE_CHECK([[whether pipe(3) is usable]], [[mhd_cv_pipe_usable]], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +AC_INCLUDES_DEFAULT +#ifdef HAVE_UNISTD_H +#include +#endif + ], [[ + int arr[2]; + int res; + res = pipe(arr) + ]]) + ], [[mhd_cv_pipe_usable='yes']], [[mhd_cv_pipe_usable='no']]) + ]) + ]) + AS_VAR_IF([[mhd_cv_pipe_usable]], [["yes"]], [ + use_itc='pipe' + enable_itc="$use_itc" + AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication]) + AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +AC_INCLUDES_DEFAULT +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + ], [[ + int arr[2]; + int res; + res = pipe2(arr, O_CLOEXEC | O_NONBLOCK) + ]]) + ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']]) + ]) + AS_VAR_IF([[mhd_cv_pipe2_usable]], [["yes"]], + [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])]) + ], [ + AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])]) + ]) +]) + +AS_IF([[test "x$enable_itc" = "xsocketpair" || test "x$enable_itc" = "xauto"]], [ + AS_VAR_IF([[os_is_native_w32]], [["yes"]], [[mhd_cv_socketpair_usable='yes']], [ + AC_CACHE_CHECK([[whether socketpair(3) is usable]], [[mhd_cv_socketpair_usable]], [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + ], [[ + int arr[2]; + int res; +#if defined(AF_LOCAL) + res = socketpair(AF_LOCAL, SOCK_STREAM, 0, arr); +#elif defined(AF_UNIX) + res = socketpair(AF_UNIX, SOCK_STREAM, 0, arr); +#else +#error AF_LOCAL and AF_UNIX are both undefined + choke me now; +#endif + if (res != 0) return 1 + ]]) + ], [[mhd_cv_socketpair_usable='yes']], [[mhd_cv_socketpair_usable='no']]) + ]) + ]) + AS_VAR_IF([[mhd_cv_socketpair_usable]], [["yes"]], [ + use_itc='socketpair' + enable_itc="$use_itc" + AC_DEFINE([[_MHD_ITC_SOCKETPAIR]], [[1]], [Define to use socketpair for inter-thread communication]) + ], [ + AS_VAR_IF([[enable_itc]], [["socketpair"]], [AC_MSG_ERROR([[socketpair(3) is not usable, consider using other type of inter-thread communication]])]) + ]) +]) + +AS_IF([[test -z "$use_itc"]], [AC_MSG_ERROR([[cannot find useable type of inter-thread communication]])]) + + +AC_CHECK_FUNCS_ONCE([accept4 gmtime_r memmem snprintf]) +AC_CHECK_DECL([gmtime_s], + [ + AC_MSG_CHECKING([[whether gmtime_s is in C11 form]]) + AC_LINK_IFELSE( + [ AC_LANG_PROGRAM( + [[ +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#ifdef __cplusplus +extern "C" +#endif + struct tm* gmtime_s(const time_t* time, struct tm* result); + ]], [[ + struct tm res; + time_t t; + gmtime_s (&t, &res); + ]]) + ], + [ + AC_DEFINE([HAVE_C11_GMTIME_S], [1], [Define to 1 if you have the `gmtime_s' function in C11 form.]) + AC_MSG_RESULT([[yes]]) + ], + [ + AC_MSG_RESULT([[no]]) + AC_MSG_CHECKING([[whether gmtime_s is in W32 form]]) + AC_LINK_IFELSE( + [ AC_LANG_PROGRAM( + [[ +#include +#ifdef __cplusplus +extern "C" +#endif +errno_t gmtime_s(struct tm* _tm, const time_t* time); + ]], [[ + struct tm res; + time_t t; + gmtime_s (&res, &t); + ]]) + ], + [ + AC_DEFINE([HAVE_W32_GMTIME_S], [1], [Define to 1 if you have the `gmtime_s' function in W32 form.]) + AC_MSG_RESULT([[yes]]) + ], + [AC_MSG_RESULT([[no]]) + ]) + ]) + ], [], + [[#define __STDC_WANT_LIB_EXT1__ 1 +#include ]]) + + +AC_CHECK_DECLS([SOCK_NONBLOCK], [AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], [SOCK_NONBLOCK is defined in a socket header])], [], + [ +#if defined(HAVE_SYS_TYPES_H) +# include +#endif +#if defined(HAVE_SYS_SOCKET_H) +# include +#elif defined(HAVE_WINSOCK2_H) +# include +#endif + ]) + + +AC_CHECK_DECL([[clock_gettime]], + [ + SAVE_LIBS="$LIBS" + AC_SEARCH_LIBS([clock_gettime], [rt], + [ + AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime]) + AS_VAR_IF([[ac_cv_search_clock_gettime]],[["none required"]], [], + [ + MHD_LIBDEPS="$ac_cv_search_clock_gettime $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$ac_cv_search_clock_gettime $MHD_LIBDEPS_PKGCFG" + ]) + ], [], [$MHD_LIBDEPS]) + LIBS="$SAVE_LIBS" + ], [], [[ +#include + ]]) + +AC_MSG_CHECKING([[for clock_get_time]]) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[ + clock_serv_t cs; + mach_timespec_t mt; + host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cs); + clock_get_time(cs, &mt); + mach_port_deallocate(mach_task_self(), cs); + ]]) + ], + [ + AC_DEFINE([HAVE_CLOCK_GET_TIME], [1], [Define to 1 if you have `clock_get_time', `host_get_clock_service' and `mach_port_deallocate' functions.]) + AC_MSG_RESULT([[yes]]) + ], + [AC_MSG_RESULT([[no]]) + ]) + +AC_MSG_CHECKING([[for gethrtime]]) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#ifdef HAVE_SYS_TIME_H +/* Solaris define gethrtime() in sys/time.h */ +#include +#endif /* HAVE_SYS_TIME_H */ +#ifdef HAVE_TIME_H +/* HP-UX define gethrtime() in time.h */ +#include +#endif /* HAVE_TIME_H */ + ]], [[hrtime_t hrt = gethrtime(); ]]) + ], + [ + AC_DEFINE([HAVE_GETHRTIME], [1], [Define to 1 if you have `gethrtime' function.]) + AC_MSG_RESULT([[yes]]) + ], + [AC_MSG_RESULT([[no]]) + ]) + +# IPv6 +AC_MSG_CHECKING(for IPv6) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +#if HAVE_NETINET_IN_H +#include +#endif +#if HAVE_SYS_SOCKET_H +#include +#endif +#if HAVE_WINSOCK2_H +#include +#endif +#if HAVE_WS2TCPIP_H +#include +#endif +]], [[ +int af=AF_INET6; +int pf=PF_INET6; +struct sockaddr_in6 sa; +printf("%d %d %p\n", af, pf, &sa); +]])],[ +have_inet6=yes; +AC_DEFINE([HAVE_INET6], [1], [Provides IPv6 headers]) +],[ +have_inet6=no +]) +AC_MSG_RESULT($have_inet6) + +HIDDEN_VISIBILITY_CFLAGS="" +case "$host" in + *-*-mingw*) + dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport) + AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern], + [defines how to decorate public symbols while building]) + HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden" + ;; + *) + dnl on other compilers, check if we can do -fvisibility=hidden + AX_CHECK_LINK_FLAG([-fvisibility=hidden], + [AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], + [AC_DEFINE([_MHD_EXTERN], [__attribute__((visibility("default"))) extern], + [defines how to decorate public symbols while building]) + HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"])]) + ;; +esac +AC_SUBST(HIDDEN_VISIBILITY_CFLAGS) + +# libcurl (required for testing) +AC_ARG_ENABLE([curl], + [AS_HELP_STRING([--disable-curl],[disable cURL based testcases])], + [enable_curl=${enableval}]) +curl=0 +if test "$enable_curl" != "no" +then + LIBCURL_CHECK_CONFIG([yes],[7.16.4],[enable_curl=yes], + [ + if test "x$enable_curl" = "xyes"; then + AC_MSG_WARN([[cURL-based tests cannot be enabled because libcurl is missing]]) + fi + enable_curl=no + ]) +fi +if test "$enable_curl" != "no" +then +# Lib cURL & cURL - OpenSSL versions + AC_DEFINE([MHD_REQ_CURL_VERSION], ["7.16.4"], [required cURL version to run tests]) + AC_DEFINE([MHD_REQ_CURL_OPENSSL_VERSION], ["0.9.8"], [required cURL SSL version to run tests]) + AC_DEFINE([MHD_REQ_CURL_GNUTLS_VERSION], ["2.8.6"], [gnuTLS lib version - used in conjunction with cURL]) + AC_DEFINE([MHD_REQ_CURL_NSS_VERSION], ["3.12.0"], [NSS lib version - used in conjunction with cURL]) +fi +AM_CONDITIONAL([HAVE_CURL], [test "x$enable_curl" = "xyes"]) + +mhd_have_libmagic="no" +SAVE_LIBS="$LIBS" +LIBS="$LIBS -lmagic" +AC_MSG_CHECKING([[for suitable libmagic]]) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + ]], + [[ + char var_data[256]; + const char *var_mime; + magic_t var_magic = magic_open (MAGIC_MIME_TYPE); + (void)magic_load (var_magic, NULL); + var_data[0] = 0; + var_mime = magic_buffer (var_magic, var_data, 1); + magic_close (var_magic); + ]] + ) + ], + [ + AC_DEFINE([HAVE_LIBMAGIC], [1], [Define to 1 if you have suitable libmagic.]) + mhd_have_libmagic="yes" + AC_MSG_RESULT([[yes]]) + ], + [AC_MSG_RESULT([[no]]) + ] +) +LIBS="$SAVE_LIBS" +AM_CONDITIONAL([HAVE_LIBMAGIC], [[test "x$mhd_have_libmagic" = "xyes"]]) + +# large file support (> 4 GB) +AC_SYS_LARGEFILE +AC_FUNC_FSEEKO +AC_CHECK_FUNCS([lseek64 pread64 pread]) + +# check for various sendfile functions +AC_ARG_ENABLE([sendfile], + [AS_HELP_STRING([--disable-sendfile], + [disable usage of sendfile() for HTTP connections [auto]])], + [], + [enable_sendfile="auto"]) +AS_CASE([$enable_sendfile], + [[auto | yes]],[[found_sendfile="no"]], + [[no]],[[found_sendfile="disabled"]], + [AC_MSG_ERROR([[unknown value specified: --enable-sendfile=$enable_sendfile]])] +) +AS_VAR_IF([[found_sendfile]], [["no"]], + [ + AC_MSG_CHECKING([[for Linux-style sendfile(2)]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + +static void empty_func(void) +{ +/* Check for declaration */ + (void)sendfile; +} +/* Declare again to check form match */ +ssize_t sendfile(int, int, off_t*, size_t); + ]], + [[ + int fd1=0, fd2=2; + off_t o = 0; + size_t s = 5; + ssize_t r; + r = sendfile (fd1, fd2, &o, s); + if (r) + empty_func(); + ]] + ) + ], + [ + AC_DEFINE([HAVE_LINUX_SENDFILE], [1], [Define to 1 if you have linux-style sendfile(2).]) + found_sendfile="yes, Linux-style" + AC_MSG_RESULT([[yes]]) + AC_CHECK_FUNCS([sendfile64]) + ], + [AC_MSG_RESULT([[no]]) + ] + ) + ] +) +AS_VAR_IF([[found_sendfile]], [["no"]], + [ + AC_MSG_CHECKING([[for FreeBSD-style sendfile(2)]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +#include + +static void empty_func(void) +{ +/* Check for declaration */ + (void)sendfile; +} +/* Declare again to check form match */ +int sendfile(int, int, off_t, size_t, + struct sf_hdtr*, off_t*, int); + ]], + [[ + int fd1=0, fd2=1; + off_t o = 0; + size_t s = 5; + off_t r1; + int r2; + r2 = sendfile (fd1, fd2, o, s, (void*)0, &r1, 0); + if (r2) + empty_func(); + ]] + ) + ], + [ + AC_DEFINE([HAVE_FREEBSD_SENDFILE], [1], [Define to 1 if you have FreeBSD-style sendfile(2).]) + found_sendfile="yes, FreeBSD-style" + AC_MSG_RESULT([[yes]]) + ], + [AC_MSG_RESULT([[no]]) + ] + ) + ] +) +AS_VAR_IF([[found_sendfile]], [["no"]], + [ + AC_MSG_CHECKING([[for Darwin-style sendfile(2)]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +#include + +static void empty_func(void) +{ +/* Check for declaration */ + (void)sendfile; +} +/* Declare again to check form match */ +int sendfile(int, int, off_t, off_t*, + struct sf_hdtr *, int); + ]], + [[ + int fd=0, s=1; + off_t o = 0; + off_t l = 5; + int r; + r = sendfile (fd, s, o, &l, (void*)0, 0); + if (r) + empty_func(); + ]] + ) + ], + [ + AC_DEFINE([HAVE_DARWIN_SENDFILE], [1], [Define to 1 if you have Darwin-style sendfile(2).]) + found_sendfile="yes, Darwin-style" + AC_MSG_RESULT([[yes]]) + ], + [AC_MSG_RESULT([[no]]) + ] + ) + ] +) + +AS_VAR_IF([[found_sendfile]], [["no"]], + [ + AC_MSG_CHECKING([[for Solaris-style sendfile(3)]]) + SAVE_LIBS="$LIBS" + LIBS="$LIBS -lsendfile" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +#include + +static void empty_func(void) +{ +/* Check for declaration */ + (void)sendfile; +} +/* Declare again to check form match */ +ssize_t sendfile(int out_fd, int in_fd, + off_t *off, size_t len); + ]], + [[ + int fd1=0, fd2=1; + off_t o = 0; + size_t l = 5; + ssize_t r; + r = sendfile (fd1, fd2, &o, l); + if (r) + empty_func(); + ]] + ) + ], + [ + AC_DEFINE([HAVE_SOLARIS_SENDFILE], [1], [Define to 1 if you have Solaris-style sendfile(3).]) + found_sendfile="yes, Solaris-style" + MHD_LIBDEPS="-lsendfile $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="-lsendfile $MHD_LIBDEPS_PKGCFG" + AC_MSG_RESULT([[yes]]) + AC_CHECK_FUNCS([sendfile64]) + ], + [AC_MSG_RESULT([[no]]) + ] + ) + LIBS="$SAVE_LIBS" + ] +) +AS_IF([[test "x$found_sendfile" = "xno" && test "x$enable_sendfile" = "xyes"]], + AC_MSG_ERROR([[sendfile() usage was requested by configure parameter, but no usable sendfile() function is detected]]) +) + +# optional: have error messages ? +AC_MSG_CHECKING([[whether to generate error messages]]) +AC_ARG_ENABLE([messages], + [AS_HELP_STRING([--disable-messages], + [disable MHD error messages])], + [enable_messages=${enableval}], + [enable_messages=yes]) +AS_IF([[test "x$enable_messages" = "xyes"]], + [ AC_DEFINE([HAVE_MESSAGES],[1],[Define to 1 to enable support for error messages.]) ], + [[ enable_messages=no ]]) +AC_MSG_RESULT([[$enable_messages]]) + + +# optional: have postprocessor? +AC_MSG_CHECKING([[whether to enable postprocessor]]) +AC_ARG_ENABLE([postprocessor], + [AS_HELP_STRING([--disable-postprocessor], + [disable MHD PostProcessor functionality])], + [enable_postprocessor=${enableval}], + [enable_postprocessor=yes]) +AS_IF([[test "x$enable_postprocessor" != "xno"]], + [ enable_postprocessor=yes + AC_DEFINE([HAVE_POSTPROCESSOR],[1],[Define to 1 if libmicrohttpd is compiled with postprocessor support.]) ]) +AM_CONDITIONAL([HAVE_POSTPROCESSOR], [test "x$enable_postprocessor" != "xno"]) +AC_MSG_RESULT([[$enable_postprocessor]]) + + +# optional: have zzuf, socat? +AC_CHECK_PROG([have_zzuf],[zzuf], [yes], [no]) +AC_CHECK_PROG([have_socat],[socat], [yes], [no]) +AM_CONDITIONAL([HAVE_ZZUF], [test "x$have_zzuf" = "xyes"]) +AM_CONDITIONAL([HAVE_SOCAT], [test "x$have_socat" = "xyes"]) + +have_gnutls=no +have_gnutls_sni=no +have_gcrypt=no +AS_UNSET([GNUTLS_CPPFLAGS]) +AS_UNSET([GNUTLS_LDFLAGS]) + +# optional: HTTPS support. Enabled by default +AC_ARG_ENABLE([https], + [AS_HELP_STRING([--enable-https], + [enable HTTPS support (yes, no, auto)[auto]])], + [enable_https=${enableval}]) +if test "x$enable_https" != "xno" +then +# +# Next block is large unindented block +# + +# gnutls +have_gnutls_pkgcfg=no +AC_MSG_CHECKING([[how to find GnuTLS library]]) +AC_ARG_WITH([[gnutls]], + [AS_HELP_STRING([[--with-gnutls[=PFX]]],[use GnuTLS for HTTPS support, optional PFX overrides pkg-config data for GnuTLS headers (PFX/include) and libs (PFX/lib)])], + [ + case $with_gnutls in + no) + AC_MSG_RESULT([[GnuTLS disabled]]) + AS_UNSET([GNUTLS_CPPFLAGS]) + AS_UNSET([GNUTLS_CFLAGS]) + AS_UNSET([GNUTLS_LDFLAGS]) + AS_UNSET([GNUTLS_LIBS]) + ;; + yes) + AC_MSG_RESULT([[automatically, forced]]) + ;; + *) + AC_MSG_RESULT([[-I$with_gnutls/include -L$with_gnutls/lib -lgnutls]]) + SAVE_LDFLAGS="$LDFLAGS" + SAVE_CPPFLAGS="$CPPFLAGS" + LDFLAGS="-L$with_gnutls/lib $LDFLAGS" + CPPFLAGS="-I$with_gnutls/include $CPPFLAGS" + have_gnutls_pkgcfg=no + AC_CHECK_HEADERS([gnutls/gnutls.h], + [AC_CHECK_LIB([gnutls], [gnutls_priority_set], + [ + GNUTLS_CPPFLAGS="-I$with_gnutls/include" + GNUTLS_LDFLAGS="-L$with_gnutls/lib" + GNUTLS_LIBS="-lgnutls" + have_gnutls=yes + ])], [], [AC_INCLUDES_DEFAULT]) + AS_IF([test "x$have_gnutls" != "xyes"], [AC_MSG_ERROR([can't find usable libgnutls at specified prefix $with_gnutls])]) + LDFLAGS="$SAVE_LDFLAGS" + CPPFLAGS="$SAVE_CPPFLAGS" + ;; + esac + ], + [AC_MSG_RESULT([[automatically]]) + ]) + +AS_IF([test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"], + [ + AC_CACHE_CHECK([[whether to add pkg-config special search directories]], [mhd_cv_pkgconf_add_dirs], + [ + AS_IF([[test "x$host_os" = "xsolaris2.11" && test "x$cross_compiling" = "xno"]], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +char size_chk[7-sizeof(char*)]; +#if defined(_LP64) || defined(__LP64__) || defined(__x86_64) || defined(__x86_64__) +#error This is 64-bit target. +choke me now +#endif +#if defined(__amd64) || defined(__amd64__) || defined(__sparcv9) || defined(__sparc_v9__) +#error This is 64-bit target. +choke me now +#endif + ]], [[]] + ) + ], + [ + mhd_cv_pkgconf_add_dirs='/usr/lib/pkgconfig/gnutls-3' + ], + [ + AS_IF([[test "x$host_cpu" = "xx86_64" || test "x$host_cpu" = "xi386"]], + [[mhd_cv_pkgconf_add_dirs='/usr/lib/amd64/pkgconfig/gnutls-3:/usr/lib/amd64/pkgconfig']], + [[test "x$host_cpu" = "xsparc"]], + [[mhd_cv_pkgconf_add_dirs='/usr/lib/sparkv9/pkgconfig/gnutls-3:/usr/lib/sparkv9/pkgconfig']], + [[mhd_cv_pkgconf_add_dirs='/usr/lib/64/pkgconfig/gnutls-3:/usr/lib/64/pkgconfig']] + ) + ] + ) + ], + [[ mhd_cv_pkgconf_add_dirs='no' ]] + ) + ] + ) + AS_IF([[test "x$mhd_cv_pkgconf_add_dirs" != "xno"]], + [ + test "x$PKG_CONFIG_PATH" = "x" || PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${PATH_SEPARATOR}" + PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${mhd_cv_pkgconf_add_dirs}" + export PKG_CONFIG_PATH + ] + ) + PKG_CHECK_MODULES(GNUTLS, [[gnutls]], + [ + have_gnutls_pkgcfg='yes' + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CFLAGS="$GNUTLS_CFLAGS $CFLAGS" + LIBS="$LIBS $GNUTLS_LIBS" + AC_MSG_CHECKING([[whether GnuTLS is usable]]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]], [[ + gnutls_session_t session; + gnutls_priority_t priorities; + gnutls_global_init(); + gnutls_priority_init(&priorities, "NORMAL", NULL); + gnutls_init(&session, GNUTLS_SERVER); + gnutls_priority_set(session, priorities); + ]])], + [ + AC_MSG_RESULT([[yes]]) + have_gnutls=yes + # GNUTLS_CFLAGS is actually CPPFLAGS + GNUTLS_CPPFLAGS="$GNUTLS_CFLAGS" + # GNUTLS_CFLAGS is combination of LDFLAGS and LIBS + GNUTLS_LDFLAGS="$GNUTLS_LIBS" + ], + [ + AC_MSG_RESULT([[no]]) + have_gnutls=no + ]) + + AS_IF([test "x$have_gnutls" != "xyes"], + [ + AC_MSG_WARN([pkg-config reports that GnuTLS is present, but GnuTLS can't be used]) + AS_UNSET([GNUTLS_CPPFLAGS]) + AS_UNSET([GNUTLS_CFLAGS]) + AS_UNSET([GNUTLS_LDFLAGS]) + AS_UNSET([GNUTLS_LIBS]) + ] + ) + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" + ], + [ + # check for GnuTLS at default paths + have_gnutls_pkgcfg='no' + AC_CHECK_HEADERS([gnutls/gnutls.h], + [AC_CHECK_LIB([gnutls], [gnutls_priority_set], + [ + GNUTLS_LIBS="-lgnutls" + have_gnutls=yes + ])], [], [AC_INCLUDES_DEFAULT]) + ]) + ]) + +have_gcrypt='unknown' +AS_IF([test "x$with_gnutls" != "xno" && test "x$have_gnutls" != "xyes"], + [ + AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no]) + AS_IF([[test "x$have_gcrypt" = "xyes"]], + [ + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LIBS="$LIBS" + SAVE_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" + # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both + CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" + AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT]) + # Check for GnuTLS with gcrypt flags + LDFLAGS="$LDFLAGS $LIBGCRYPT_LIBS" + # A bit of hack: unset cache variable to force recheck + AS_UNSET([ac_cv_header_gnutls_gnutls_h]) + AC_CHECK_HEADERS([gnutls/gnutls.h], + [AS_UNSET([ac_cv_lib_gnutls_gnutls_priority_set]) # A bit of hack: unset cache variable to force recheck + AC_CHECK_LIB([gnutls], [gnutls_priority_set], + [ + GNUTLS_CPPFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS" + GNUTLS_LDFLAGS="$LIBGCRYPT_LIBS" + GNUTLS_LIBS="-lgnutls" + have_gnutls=yes + ])], [], [AC_INCLUDES_DEFAULT]) + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" + ] + ) + ] +) +AS_IF([test "x$have_gnutls" != "xyes" && test "x$with_gnutls" = "xyes"], [AC_MSG_ERROR([[can't find usable libgnutls]])]) +# +# End of large unindented block +# + + AS_IF([test "x$have_gnutls" = "xyes"], + [ + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CPPFLAGS="$GNUTLS_CPPFLAGS $CPPFLAGS" + CFLAGS="$GNUTLS_CFLAGS $CFLAGS" + LDFLAGS="$GNUTLS_LDFLAGS $LDFLAGS" + LIBS="$LIBS $GNUTLS_LIBS" + AC_MSG_CHECKING([[for gnutls_privkey_import_x509_raw()]]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#include + ]], [[ + gnutls_datum_t data; + gnutls_privkey_t key = 0; +#ifndef gnutls_load_file + (void)gnutls_load_file; /* Check for declaration. */ +#endif +#ifndef gnutls_privkey_import_x509_raw + (void)gnutls_privkey_import_x509_raw; /* Check for declaration. */ +#endif + gnutls_load_file("key.pem", &data); + gnutls_privkey_import_x509_raw(key, &data, GNUTLS_X509_FMT_PEM, NULL, 0); + gnutls_free(data.data); + ]])], [[have_gnutls_sni=yes]], [[have_gnutls_sni=no]]) + AC_MSG_RESULT([[$have_gnutls_sni]]) + AC_CACHE_CHECK([[whether GnuTLS require libgcrypt initialisaion]], [mhd_cv_grypt_required], + [ + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM( + [ +#include + ], + [ +#if !defined(GNUTLS_VERSION_NUMBER) || GNUTLS_VERSION_NUMBER+0 <= 0x020c14 +#error Old versions of GnuTLS require libgcript initialisaion +choke me now +#endif + ] + ) + ], + [[mhd_cv_grypt_required='no']], [[mhd_cv_grypt_required='yes']] + ) + ] + ) + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" + ], + [ + AS_UNSET([GNUTLS_CPPFLAGS]) + AS_UNSET([GNUTLS_LDFLAGS]) + ] + ) + + AS_IF([[test "x$mhd_cv_grypt_required" = "xyes" && test "x$have_gcrypt" = "xunknown"]], + [ + AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no]) + AS_IF([[test "x$have_gcrypt" = "xyes"]], + [ + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" + # LIBGCRYPT_CFLAGS can be actually a CPPFLAGS, so check them both + CPPFLAGS="$CPPFLAGS $LIBGCRYPT_CFLAGS" + AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no], [AC_INCLUDES_DEFAULT]) + CPPFLAGS="$SAVE_CPPFLAGS" + CFLAGS="$SAVE_CFLAGS" + ] + ) + ] + ) + + AS_UNSET([[crypt_missing]]) + AS_IF([[test "x$have_gnutls" = "xyes"]], + [ + AS_IF([[test "x$mhd_cv_grypt_required" = "xyes" && test "x$have_gcrypt" != "xyes"]], + [ + crypt_missing="required libgcrypt" + AS_IF([[test "x$enable_https" = "xyes" ]], [AC_MSG_ERROR([[HTTPS support cannot be enabled without $crypt_missing.]])]) + enable_https=no + MSG_HTTPS="no (lacking $crypt_missing)" + AS_UNSET([LIBGCRYPT_CFLAGS]) + AS_UNSET([LIBGCRYPT_LIBS]) + AS_UNSET([GNUTLS_CPPFLAGS]) + AS_UNSET([GNUTLS_CFLAGS]) + AS_UNSET([GNUTLS_LDFLAGS]) + AS_UNSET([GNUTLS_LIBS]) + ], + [ + AC_DEFINE([[HTTPS_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTPS support.]) + enable_https=yes + AS_IF([[test "x$mhd_cv_grypt_required" = "xyes"]], + [ + MSG_HTTPS="yes (using libgnutls and libgcrypt)" + MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CPPFLAGS" + MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $LIBGCRYPT_CFLAGS $GNUTLS_CFLAGS" + MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS" + MHD_LIBDEPS="$GNUTLS_LIBS $LIBGCRYPT_LIBS $MHD_LIBDEPS" + AC_DEFINE([[MHD_HTTPS_REQUIRE_GRYPT]], [[1]], [Define to `1' if HTTPS require initialisation of libgcrypt]) + ], + [ + MSG_HTTPS="yes (using libgnutls)" + AS_UNSET([LIBGCRYPT_CFLAGS]) + AS_UNSET([LIBGCRYPT_LIBS]) + MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $GNUTLS_CPPFLAGS" + MHD_LIB_CFLAGS="$MHD_LIB_CFLAGS $GNUTLS_CFLAGS" + MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS $GNUTLS_LDFLAGS" + MHD_LIBDEPS="$GNUTLS_LIBS $MHD_LIBDEPS" + ] + ) + AS_IF([[ test "x$have_gnutls_pkgcfg" = "xyes" ]], + [ # remove GnuTLS from private libs in .pc file as it defined in Requires.private + MHD_REQ_PRIVATE='gnutls' + AS_IF([[test "x$mhd_cv_grypt_required" = "xyes"]], + [[MHD_LIBDEPS_PKGCFG="$LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG"]] + ) + ], + [ + MHD_REQ_PRIVATE='' + AS_IF([[test "x$mhd_cv_grypt_required" = "xyes"]], + [[MHD_LIBDEPS_PKGCFG="$LIBGCRYPT_LIBS $MHD_LIBDEPS_PKGCFG"]] + ) + MHD_LIBDEPS_PKGCFG="$GNUTLS_LIBS $MHD_LIBDEPS_PKGCFG" + ]) + ] + ) + ], + [ + crypt_missing="libgnutls" + AS_IF([[test "x$enable_https" = "xyes" ]], [AC_MSG_ERROR([[HTTPS support cannot be enabled without $crypt_missing.]])]) + enable_https=no + MSG_HTTPS="no (lacking $crypt_missing)" + AS_UNSET([LIBGCRYPT_CFLAGS]) + AS_UNSET([LIBGCRYPT_LIBS]) + AS_UNSET([GNUTLS_CPPFLAGS]) + AS_UNSET([GNUTLS_CFLAGS]) + AS_UNSET([GNUTLS_LDFLAGS]) + AS_UNSET([GNUTLS_LIBS]) + ] + ) +else + MSG_HTTPS="no (disabled)" +fi +AC_MSG_CHECKING(whether to support HTTPS) +AC_MSG_RESULT([$MSG_HTTPS]) + +AM_CONDITIONAL([HAVE_GNUTLS], [[test "x$have_gnutls" = "xyes"]]) +AM_CONDITIONAL([HAVE_GNUTLS_SNI], [[test "x$have_gnutls_sni" = "xyes"]]) +AM_CONDITIONAL([ENABLE_HTTPS], [test "x$enable_https" = "xyes"]) +AM_CONDITIONAL([HTTPS_REQUIRE_GRYPT], [[test "x$enable_https" = "xyes" && test "x$mhd_cv_grypt_required" = "xyes"]]) +AC_SUBST([GNUTLS_CPPFLAGS]) +AC_SUBST([GNUTLS_CFLAGS]) +AC_SUBST([GNUTLS_LDFLAGS]) +AC_SUBST([GNUTLS_LIBS]) + +# optional: HTTP Basic Auth support. Enabled by default +AC_MSG_CHECKING([[whether to support HTTP basic authentication]]) +AC_ARG_ENABLE([bauth], + AS_HELP_STRING([--disable-bauth], + [disable HTTP basic Auth support]), + [enable_bauth=${enableval}], + [enable_bauth=yes]) +AS_IF([[test "x$enable_bauth" != "xno"]], + [ enable_bauth=yes + AC_DEFINE([BAUTH_SUPPORT],[1],[Define to 1 if libmicrohttpd is compiled with basic Auth support.]) ]) +AM_CONDITIONAL([ENABLE_BAUTH], [test "x$enable_bauth" != "xno"]) +AC_MSG_RESULT([[$enable_bauth]]) + +# optional: HTTP Digest Auth support. Enabled by default +AC_MSG_CHECKING([[whether to support HTTP digest authentication]]) +AC_ARG_ENABLE([dauth], + AS_HELP_STRING([--disable-dauth], + [disable HTTP basic and digest Auth support]), + [enable_dauth=${enableval}], + [enable_dauth=yes]) +AS_IF([[test "x$enable_dauth" != "xno"]], + [ enable_dauth=yes + AC_DEFINE([DAUTH_SUPPORT],[1],[Define to 1 if libmicrohttpd is compiled with digest Auth support.]) ]) +AM_CONDITIONAL([ENABLE_DAUTH], [test "x$enable_dauth" != "xno"]) +AC_MSG_RESULT([[$enable_dauth]]) + +# optional: HTTP "Upgrade" support. Enabled by default +AC_MSG_CHECKING([[whether to support HTTP "Upgrade"]]) +AC_ARG_ENABLE([[httpupgrade]], + AS_HELP_STRING([[--disable-httpupgrade]], + [disable HTTP "Upgrade" support]), + [AS_VAR_IF([[enable_httpupgrade]],[["no"]],[],[[enable_httpupgrade='yes']])], + [[enable_httpupgrade='yes']]) +AS_VAR_IF([[enable_httpupgrade]],[["yes"]], + [ + AC_DEFINE([[UPGRADE_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is compiled with HTTP Upgrade support.]) ]) +AM_CONDITIONAL([ENABLE_UPGRADE], [[test "x$enable_httpupgrade" = "xyes"]]) +AC_MSG_RESULT([[$enable_httpupgrade]]) + +AC_CACHE_CHECK([[for calloc()]], [[mhd_cv_have_func_calloc]], + [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include + ]],[[void * ptr = calloc(1, 2)]]) + ], + [[mhd_cv_have_func_calloc='yes']], + [[mhd_cv_have_func_calloc='no']] + ) + ] +) +AS_VAR_IF([[mhd_cv_have_func_calloc]], [["yes"]], + [AC_DEFINE([[HAVE_CALLOC]], [[1]], [Define to 1 if you have the usable `calloc' function.])]) + +# Check for fork() and waitpid(). They are used for tests. +AC_MSG_CHECKING([[for fork()]]) +mhd_have_fork_waitpid='no' +AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + ]], [[ + pid_t p = fork (); + if (0 == p) + return 1; + ]]) + ], [ + AC_DEFINE([[HAVE_FORK]], [[1]], [Define to 1 if you have the usable `fork' function.]) + AC_MSG_RESULT([[yes]]) + + AC_MSG_CHECKING([[for waitpid()]]) + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[ +#include + ]], [[ + pid_t p = fork (); + if (0 == p) + return 1; + waitpid (p, (void*)0, 0) + ]]) + ], [ + AC_DEFINE([[HAVE_WAITPID]], [[1]], [Define to 1 if you have the usable `waitpid' function.]) + AC_MSG_RESULT([[yes]]) + mhd_have_fork_waitpid='yes' + ],[ + AC_MSG_RESULT([[no]]) + ]) +],[ + AC_MSG_RESULT([[no]]) +]) + +AM_CONDITIONAL([HAVE_FORK_WAITPID], [test "x$mhd_have_fork_waitpid" = "xyes"]) + +# gcov compilation +AC_MSG_CHECKING(whether to compile with support for code coverage analysis) +AC_ARG_ENABLE([coverage], + AS_HELP_STRING([--enable-coverage], + [compile the library with code coverage support]), + [use_gcov=${enableval}], + [use_gcov=no]) +AC_MSG_RESULT($use_gcov) +AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) + +AX_COUNT_CPUS +AS_IF([[test "$CPU_COUNT" -gt "32"]], [[CPU_COUNT="32"]])dnl Limit resource usage +AC_SUBST([CPU_COUNT]) + +AC_MSG_CHECKING([[whether to enable debug asserts]]) +AC_ARG_ENABLE([[asserts]], + AS_HELP_STRING([[--enable-asserts]], + [enable test build with debug asserts]), + [], [[enable_asserts='no']]) +AS_CASE([[$enable_asserts]], [[yes]], [[:]], [[no]], [[:]], [[enable_asserts='no']]) +AC_MSG_RESULT([[$enable_asserts]]) + +AS_VAR_IF([[enable_asserts]], [["yes"]], + [ + AC_DEFINE([[_DEBUG]], [[1]], [Define to use debug asserts.]) + [mhd_assert_test_prg="#include + int pos_val(void) {return 5;} + int neg_val(void) {return -5;} + int main(void) + { int pos_var = pos_val(), neg_var = neg_val(); + assert(neg_var > pos_var); /* Must trigger assert. */ + (void)pos_var; (void)neg_var; + return 0; } + "] + AC_CACHE_CHECK([[whether system assert() is available]], [mhd_cv_sys_assert_avail], + [ + AC_LINK_IFELSE([AC_LANG_SOURCE([[$mhd_assert_test_prg]])], + [[mhd_cv_sys_assert_avail='yes']], + [[mhd_cv_sys_assert_avail='no']]) + ] + ) + AS_VAR_IF([[mhd_cv_sys_assert_avail]], [["yes"]], + [ + AC_CACHE_CHECK([[whether system assert() is usable]], [mhd_cv_sys_assert_use], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[$mhd_assert_test_prg]])], + [[mhd_cv_sys_assert_use='no']], + [[mhd_cv_sys_assert_use='yes']], + [[mhd_cv_sys_assert_use='assuming yes']]) + ] + ) + AS_VAR_IF([[mhd_cv_sys_assert_use]], [["no"]], [], + [AC_DEFINE([[HAVE_ASSERT]], [[1]], [Define if you have usable assert() and assert.h])]) + ] + ) + AS_UNSET([mhd_assert_test_prg]) + ], + [AC_DEFINE([[NDEBUG]], [[1]], [Define to disable usage of debug asserts.])] +) + +MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined" + +AC_SUBST(MHD_LIB_CPPFLAGS) +AC_SUBST(MHD_LIB_CFLAGS) +AC_SUBST(MHD_LIB_LDFLAGS) +AC_SUBST(MHD_LIBDEPS) + +# for pkg-config +AC_SUBST([MHD_REQ_PRIVATE]) +AC_SUBST([MHD_LIBDEPS_PKGCFG]) + +AC_SUBST(CPPFLAGS) +AC_SUBST(LIBS) +AC_SUBST(LDFLAGS) + +# Used for 'po' directory staff +AC_SUBST([ac_configure_args]) +AC_SUBST([EMPTY_VAR], [[]]) + +AC_CONFIG_FILES([libmicrohttpd.pc +w32/common/microhttpd_dll_res_vc.rc +po/configure.acT:po/configure.ac.in +Makefile +contrib/Makefile +doc/Makefile +doc/doxygen/libmicrohttpd.doxy +doc/doxygen/Makefile +doc/examples/Makefile +m4/Makefile +src/Makefile +src/include/Makefile +src/microhttpd/Makefile +src/examples/Makefile +src/testcurl/Makefile +src/testcurl/https/Makefile +src/testzzuf/Makefile]) +AC_CONFIG_COMMANDS([po/configargs.stamp], [ + $as_echo "$ac_configure_args" > "$ac_tmp/configargs.stamp" || AC_MSG_ERROR([[cannot create file $ac_tmp/configargs.stamp]]) + AS_IF([[cmp -s "po/configargs.stamp" "$ac_tmp/configargs.stamp" >/dev/null 2>&1]], + [AC_MSG_NOTICE([[po/configargs.stamp is unchanged]])], + [ + rm -f po/configargs.stamp + mv "$ac_tmp/configargs.stamp" po/configargs.stamp || AC_MSG_ERROR([[cannot create file $ac_tmp/configargs.stamp]]) + AC_MSG_NOTICE([[po/configargs.stamp is updated]]) + ] + ) +], [ac_configure_args="$ac_configure_args"]) +AC_OUTPUT + +# Finally: summary +if test "x$enable_curl" != "xyes"; then + MSG_CURL="no, many unit tests will not run" +else + MSG_CURL="yes" +fi + +AC_MSG_NOTICE([GNU libmicrohttpd ${PACKAGE_VERSION} Configuration Summary: + Target directory: ${prefix} + Cross-compiling: ${cross_compiling} + Operating System: ${host_os} + Shutdown of listening socket trigger select: ${mhd_cv_host_shtdwn_trgr_select} + Inter-thread comm: ${use_itc} + poll support: ${enable_poll=no} + epoll support: ${enable_epoll=no} + sendfile used: ${found_sendfile} + HTTPS support: ${MSG_HTTPS} + Threading lib: ${USE_THREADS} + Use thread names: ${enable_thread_names} + Use debug asserts: ${enable_asserts} + Messages: ${enable_messages} + Basic auth.: ${enable_bauth} + Digest auth.: ${enable_dauth} + HTTP "Upgrade": ${enable_httpupgrade} + Postproc: ${enable_postprocessor} + Build docs: ${enable_doc} + Build examples: ${enable_examples} + Test with libcurl: ${MSG_CURL} +]) + +if test "x$enable_https" = "xyes" +then + AC_MSG_NOTICE([HTTPS subsystem configuration: + License : LGPL only + ]) +else + AC_MSG_NOTICE([ + License : LGPL or eCos +]) +fi + +if test "x$enable_bauth" != "xyes" || \ + test "x$enable_dauth" != "xyes" || \ + test "x$enable_httpupgrade" != "xyes" || \ + test "x$enable_postprocessor" != "xyes" +then + AC_MSG_NOTICE([WARNING: This will be a custom build with missing symbols. Do NOT use this build in a distribution. Building with these kinds of configure options is only for custom builds for embedded systems.]) +fi diff --git a/contrib/Makefile.am b/contrib/Makefile.am new file mode 100644 index 0000000..a5f99e1 --- /dev/null +++ b/contrib/Makefile.am @@ -0,0 +1,2 @@ +# This Makefile.am is in the public domain +EXTRA_DIST = xcc ascebc mhd.png mhd.svg mhd_logo.png diff --git a/contrib/Makefile.in b/contrib/Makefile.in new file mode 100644 index 0000000..36af573 --- /dev/null +++ b/contrib/Makefile.in @@ -0,0 +1,495 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +subdir = contrib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +EXTRA_DIST = xcc ascebc mhd.png mhd.svg mhd_logo.png +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu contrib/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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: diff --git a/contrib/ascebc b/contrib/ascebc new file mode 100644 index 0000000..a8c3f14 --- /dev/null +++ b/contrib/ascebc @@ -0,0 +1,11 @@ +#!/bin/sh +iconv -f UTF-8 -t IBM-1047 $1 > temp.file +if test -x $1 +then + rm $1 + mv temp.file $1 + chmod +x $1 +else + rm $1 + mv temp.file $1 +fi diff --git a/contrib/mhd.png b/contrib/mhd.png new file mode 100644 index 0000000..fb8f47b Binary files /dev/null and b/contrib/mhd.png differ diff --git a/contrib/mhd.svg b/contrib/mhd.svg new file mode 100644 index 0000000..dc744c9 --- /dev/null +++ b/contrib/mhd.svg @@ -0,0 +1,114 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + MHD + GNU + + + + + diff --git a/contrib/mhd_logo.png b/contrib/mhd_logo.png new file mode 100644 index 0000000..82d5ac2 Binary files /dev/null and b/contrib/mhd_logo.png differ diff --git a/contrib/xcc b/contrib/xcc new file mode 100644 index 0000000..591bc56 --- /dev/null +++ b/contrib/xcc @@ -0,0 +1,2 @@ +#!/bin/sh +c89 -Wc,'LANGLVL(EXTENDED),XPLINK' -Wl,'XPLINK' -D__STRING_CODE_SET__="ISO8859-1" -Wc,"ASCII" $@ diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..b39f98f --- /dev/null +++ b/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2016-01-11.22; # UTC + +# Copyright (C) 1999-2017 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, see . + +# 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 . + +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 outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +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" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# 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 + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +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 -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## 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). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - 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 -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # 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. +## 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. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -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 -ne 0; then + 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 ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # 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 + ;; + +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. + set_dir_from "$object" + set_base_from "$object" + 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 -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + 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. + set_dir_from "$object" + set_base_from "$object" + 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 -ne 0; then + 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,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_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. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool 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$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # 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 + ;; + +#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 "X$1" != 'X--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|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | 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 "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + 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. + -arch) + eat=yes ;; + -*|$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" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | 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 "X$1" != 'X--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. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # 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 + ;; + +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-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..ef8ee96 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,57 @@ +# This Makefile.am is in the public domain +man_MANS = libmicrohttpd.3 + +SUBDIRS = . doxygen + +if BUILD_EXAMPLES +SUBDIRS += examples +endif + +DISTCLEANFILES = \ + libmicrohttpd.cps \ + libmicrohttpd.dvi \ + libmicrohttpd-tutorial.cps \ + libmicrohttpd-tutorial.dvi +info_TEXINFOS = \ + libmicrohttpd.texi \ + libmicrohttpd-tutorial.texi +microhttpd_TEXINFOS = \ + chapters/basicauthentication.inc \ + chapters/bibliography.inc \ + chapters/exploringrequests.inc \ + chapters/hellobrowser.inc \ + chapters/introduction.inc \ + chapters/largerpost.inc \ + chapters/processingpost.inc \ + chapters/responseheaders.inc \ + chapters/tlsauthentication.inc \ + chapters/sessions.inc \ + fdl-1.3.texi \ + lgpl.texi \ + ecos.texi + +EXTRA_DIST = \ + $(man_MANS) \ + $(microhttpd_TEXINFOS) \ + libmicrohttpd_performance_data.png \ + libmicrohttpd_performance_data.eps + +install-info-local: + @echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + echo " $(INSTALL_DATA) libmicrohttpd_performance_data.png '$(DESTDIR)$(infodir)'"; \ + $(INSTALL_DATA) $(srcdir)/libmicrohttpd_performance_data.png "$(DESTDIR)$(infodir)" || exit 1; + +install-html-local: + @if test -n "$(htmldir)"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/libmicrohttpd.html'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/libmicrohttpd.html" || exit 1; \ + echo " $(INSTALL_DATA) libmicrohttpd_performance_data.png '$(DESTDIR)$(htmldir)/libmicrohttpd.html'"; \ + $(INSTALL_DATA) $(srcdir)/libmicrohttpd_performance_data.png "$(DESTDIR)$(htmldir)/libmicrohttpd.html" || exit 1; \ + else : ; fi + +uninstall-local: + @if test -d "$(DESTDIR)$(infodir)"; then \ + echo " rm -f '$(DESTDIR)$(infodir)/libmicrohttpd_performance_data.png'"; \ + rm -f "$(DESTDIR)$(infodir)/libmicrohttpd_performance_data.png" \ + else : ; fi diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..6cc2979 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,1126 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_EXAMPLES_TRUE@am__append_1 = examples +subdir = doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/version.texi \ + $(srcdir)/stamp-vti $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +AM_V_DVIPS = $(am__v_DVIPS_@AM_V@) +am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@) +am__v_DVIPS_0 = @echo " DVIPS " $@; +am__v_DVIPS_1 = +AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@) +am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@) +am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; +am__v_MAKEINFO_1 = +AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@) +am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@) +am__v_INFOHTML_0 = @echo " INFOHTML" $@; +am__v_INFOHTML_1 = +AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@) +am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@) +am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; +am__v_TEXI2DVI_1 = +AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@) +am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@) +am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; +am__v_TEXI2PDF_1 = +AM_V_texinfo = $(am__v_texinfo_@AM_V@) +am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@) +am__v_texinfo_0 = -q +am__v_texinfo_1 = +AM_V_texidevnull = $(am__v_texidevnull_@AM_V@) +am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) +am__v_texidevnull_0 = > /dev/null +am__v_texidevnull_1 = +INFO_DEPS = $(srcdir)/libmicrohttpd.info \ + $(srcdir)/libmicrohttpd-tutorial.info +am__TEXINFO_TEX_DIR = $(srcdir) +DVIS = libmicrohttpd.dvi libmicrohttpd-tutorial.dvi +PDFS = libmicrohttpd.pdf libmicrohttpd-tutorial.pdf +PSS = libmicrohttpd.ps libmicrohttpd-tutorial.ps +HTMLS = libmicrohttpd.html libmicrohttpd-tutorial.html +TEXINFOS = libmicrohttpd.texi libmicrohttpd-tutorial.texi +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man3dir)" +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man3dir = $(mandir)/man3 +NROFF = nroff +MANS = $(man_MANS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = . doxygen examples +am__DIST_COMMON = $(srcdir)/Makefile.in mdate-sh texinfo.tex +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +man_MANS = libmicrohttpd.3 +SUBDIRS = . doxygen $(am__append_1) +DISTCLEANFILES = \ + libmicrohttpd.cps \ + libmicrohttpd.dvi \ + libmicrohttpd-tutorial.cps \ + libmicrohttpd-tutorial.dvi + +info_TEXINFOS = \ + libmicrohttpd.texi \ + libmicrohttpd-tutorial.texi + +microhttpd_TEXINFOS = \ + chapters/basicauthentication.inc \ + chapters/bibliography.inc \ + chapters/exploringrequests.inc \ + chapters/hellobrowser.inc \ + chapters/introduction.inc \ + chapters/largerpost.inc \ + chapters/processingpost.inc \ + chapters/responseheaders.inc \ + chapters/tlsauthentication.inc \ + chapters/sessions.inc \ + fdl-1.3.texi \ + lgpl.texi \ + ecos.texi + +EXTRA_DIST = \ + $(man_MANS) \ + $(microhttpd_TEXINFOS) \ + libmicrohttpd_performance_data.png \ + libmicrohttpd_performance_data.eps + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .dvi .html .info .pdf .ps .texi +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +.texi.info: + $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && $(am__cd) $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $<; \ + then \ + rc=0; \ + $(am__cd) $(srcdir); \ + else \ + rc=$$?; \ + $(am__cd) $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc + +.texi.dvi: + $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ + $< + +.texi.pdf: + $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ + $< + +.texi.html: + $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) + $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@ && mv $(@:.html=.htp) $@; \ + else \ + rm -rf $(@:.html=.htp); exit 1; \ + fi +$(srcdir)/libmicrohttpd.info: libmicrohttpd.texi $(srcdir)/version.texi +libmicrohttpd.dvi: libmicrohttpd.texi $(srcdir)/version.texi +libmicrohttpd.pdf: libmicrohttpd.texi $(srcdir)/version.texi +libmicrohttpd.html: libmicrohttpd.texi $(srcdir)/version.texi +$(srcdir)/version.texi: $(srcdir)/stamp-vti +$(srcdir)/stamp-vti: libmicrohttpd.texi $(top_srcdir)/configure + @(dir=.; test -f ./libmicrohttpd.texi || dir=$(srcdir); \ + set `$(SHELL) $(srcdir)/mdate-sh $$dir/libmicrohttpd.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > vti.tmp$$$$ && \ + (cmp -s vti.tmp$$$$ $(srcdir)/version.texi \ + || (echo "Updating $(srcdir)/version.texi" && \ + cp vti.tmp$$$$ $(srcdir)/version.texi.tmp$$$$ && \ + mv $(srcdir)/version.texi.tmp$$$$ $(srcdir)/version.texi)) && \ + rm -f vti.tmp$$$$ $(srcdir)/version.texi.$$$$ + @cp $(srcdir)/version.texi $@ + +mostlyclean-vti: + -rm -f vti.tmp* $(srcdir)/version.texi.tmp* + +maintainer-clean-vti: + -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi +$(srcdir)/libmicrohttpd-tutorial.info: libmicrohttpd-tutorial.texi +libmicrohttpd-tutorial.dvi: libmicrohttpd-tutorial.texi +libmicrohttpd-tutorial.pdf: libmicrohttpd-tutorial.texi +libmicrohttpd-tutorial.html: libmicrohttpd-tutorial.texi +.dvi.ps: + $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) $(AM_V_texinfo) -o $@ $< + +uninstall-dvi-am: + @$(NORMAL_UNINSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ + rm -f "$(DESTDIR)$(dvidir)/$$f"; \ + done + +uninstall-html-am: + @$(NORMAL_UNINSTALL) + @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-info-am: + @$(PRE_UNINSTALL) + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ + then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ + done + +uninstall-pdf-am: + @$(NORMAL_UNINSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +uninstall-ps-am: + @$(NORMAL_UNINSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ + rm -f "$(DESTDIR)$(psdir)/$$f"; \ + done + +dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f "$(distdir)/$$relfile" || \ + cp -p $$file "$(distdir)/$$relfile"; \ + else :; fi; \ + done; \ + done + +mostlyclean-aminfo: + -rm -rf libmicrohttpd.t2d libmicrohttpd.t2p libmicrohttpd-tutorial.t2d \ + libmicrohttpd-tutorial.t2p + +clean-aminfo: + -test -z "libmicrohttpd.dvi libmicrohttpd.pdf libmicrohttpd.ps \ + libmicrohttpd.html libmicrohttpd-tutorial.dvi \ + libmicrohttpd-tutorial.pdf libmicrohttpd-tutorial.ps \ + libmicrohttpd-tutorial.html" \ + || rm -rf libmicrohttpd.dvi libmicrohttpd.pdf libmicrohttpd.ps \ + libmicrohttpd.html libmicrohttpd-tutorial.dvi \ + libmicrohttpd-tutorial.pdf libmicrohttpd-tutorial.ps \ + libmicrohttpd-tutorial.html + +maintainer-clean-aminfo: + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ + done +install-man3: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man3dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.3[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ + done; } + +uninstall-man3: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man3dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.3[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-info +check-am: all-am +check: check-recursive +all-am: Makefile $(INFO_DEPS) $(MANS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man3dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +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-recursive + +clean-am: clean-aminfo clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: $(DVIS) + +html: html-recursive + +html-am: $(HTMLS) + +info: info-recursive + +info-am: $(INFO_DEPS) + +install-data-am: install-info-am install-man + +install-dvi: install-dvi-recursive + +install-dvi-am: $(DVIS) + @$(NORMAL_INSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ + done +install-exec-am: + +install-html: install-html-recursive + +install-html-am: $(HTMLS) install-html-local + @$(NORMAL_INSTALL) + @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__strip_dir) \ + d2=$$d$$p; \ + if test -d "$$d2"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ + else \ + list2="$$list2 $$d2"; \ + fi; \ + done; \ + test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ + done; } +install-info: install-info-recursive + +install-info-am: $(INFO_DEPS) install-info-local + @$(NORMAL_INSTALL) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + fi; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + echo "$$ifile"; \ + else : ; fi; \ + done; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done + @$(POST_INSTALL) + @if $(am__can_run_installinfo); then \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: install-man3 + +install-pdf: install-pdf-recursive + +install-pdf-am: $(PDFS) + @$(NORMAL_INSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done +install-ps: install-ps-recursive + +install-ps-am: $(PSS) + @$(NORMAL_INSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \ + mostlyclean-libtool mostlyclean-vti + +pdf: pdf-recursive + +pdf-am: $(PDFS) + +ps: ps-recursive + +ps-am: $(PSS) + +uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ + uninstall-local uninstall-man uninstall-pdf-am uninstall-ps-am + +uninstall-man: uninstall-man3 + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-aminfo clean-generic clean-libtool \ + cscopelist-am ctags ctags-am dist-info distclean \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-html-local install-info install-info-am \ + install-info-local install-man install-man3 install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool \ + mostlyclean-vti pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-dvi-am uninstall-html-am \ + uninstall-info-am uninstall-local uninstall-man uninstall-man3 \ + uninstall-pdf-am uninstall-ps-am + +.PRECIOUS: Makefile + + +install-info-local: + @echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + echo " $(INSTALL_DATA) libmicrohttpd_performance_data.png '$(DESTDIR)$(infodir)'"; \ + $(INSTALL_DATA) $(srcdir)/libmicrohttpd_performance_data.png "$(DESTDIR)$(infodir)" || exit 1; + +install-html-local: + @if test -n "$(htmldir)"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/libmicrohttpd.html'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/libmicrohttpd.html" || exit 1; \ + echo " $(INSTALL_DATA) libmicrohttpd_performance_data.png '$(DESTDIR)$(htmldir)/libmicrohttpd.html'"; \ + $(INSTALL_DATA) $(srcdir)/libmicrohttpd_performance_data.png "$(DESTDIR)$(htmldir)/libmicrohttpd.html" || exit 1; \ + else : ; fi + +uninstall-local: + @if test -d "$(DESTDIR)$(infodir)"; then \ + echo " rm -f '$(DESTDIR)$(infodir)/libmicrohttpd_performance_data.png'"; \ + rm -f "$(DESTDIR)$(infodir)/libmicrohttpd_performance_data.png" \ + else : ; fi + +# 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: diff --git a/doc/chapters/basicauthentication.inc b/doc/chapters/basicauthentication.inc new file mode 100644 index 0000000..bbdd364 --- /dev/null +++ b/doc/chapters/basicauthentication.inc @@ -0,0 +1,159 @@ +With the small exception of IP address based access control, +requests from all connecting clients where served equally until now. +This chapter discusses a first method of client's authentication and +its limits. + +A very simple approach feasible with the means already discussed would +be to expect the password in the @emph{URI} string before granting access to +the secured areas. The password could be separated from the actual resource identifier +by a certain character, thus the request line might look like +@verbatim +GET /picture.png?mypassword +@end verbatim +@noindent + +In the rare situation where the client is customized enough and the connection occurs +through secured lines (e.g., a embedded device directly attached to another via wire) +and where the ability to embedd a password in the URI or to pass on a URI with a +password are desired, this can be a reasonable choice. + +But when it is assumed that the user connecting does so with an ordinary Internet browser, +this implementation brings some problems about. For example, the URI including the password +stays in the address field or at least in the history of the browser for anybody near enough to see. +It will also be inconvenient to add the password manually to any new URI when the browser does +not know how to compose this automatically. + +At least the convenience issue can be addressed by employing the simplest built-in password +facilities of HTTP compliant browsers, hence we want to start there. It will however turn out +to have still severe weaknesses in terms of security which need consideration. + +Before we will start implementing @emph{Basic Authentication} as described in @emph{RFC 2617}, +we should finally abandon the bad practice of responding every request the first time our callback +is called for a given connection. This is becoming more important now because the client and +the server will have to talk in a more bi-directional way than before to + +But how can we tell whether the callback has been called before for the particular connection? +Initially, the pointer this parameter references is set by @emph{MHD} in the callback. But it will +also be "remembered" on the next call (for the same connection). +Thus, we will generate no response until the parameter is non-null---implying the callback was +called before at least once. We do not need to share information between different calls of the callback, +so we can set the parameter to any adress that is assured to be not null. The pointer to the +@code{connection} structure will be pointing to a legal address, so we take this. + +The first time @code{answer_to_connection} is called, we will not even look at the headers. + +@verbatim +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, const char *version, + const char *upload_data, size_t *upload_data_size, + void **con_cls) +{ + if (0 != strcmp(method, "GET")) return MHD_NO; + if (NULL == *con_cls) {*con_cls = connection; return MHD_YES;} + + ... + /* else respond accordingly */ + ... +} +@end verbatim +@noindent + +Note how we lop off the connection on the first condition (no "GET" request), but return asking for more on +the other one with @code{MHD_YES}. +With this minor change, we can proceed to implement the actual authentication process. + +@heading Request for authentication + +Let us assume we had only files not intended to be handed out without the correct username/password, +so every "GET" request will be challenged. +@emph{RFC 2617} describes how the server shall ask for authentication by adding a +@emph{WWW-Authenticate} response header with the name of the @emph{realm} protected. +MHD can generate and queue such a failure response for you using +the @code{MHD_queue_basic_auth_fail_response} API. The only thing you need to do +is construct a response with the error page to be shown to the user +if he aborts basic authentication. But first, you should check if the +proper credentials were already supplied using the +@code{MHD_basic_auth_get_username_password} call. + +Your code would then look like this: +@verbatim +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + char *user; + char *pass; + int fail; + struct MHD_Response *response; + + if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) + return MHD_NO; + if (NULL == *con_cls) + { + *con_cls = connection; + return MHD_YES; + } + pass = NULL; + user = MHD_basic_auth_get_username_password (connection, &pass); + fail = ( (user == NULL) || + (0 != strcmp (user, "root")) || + (0 != strcmp (pass, "pa$$w0rd") ) ); + if (user != NULL) free (user); + if (pass != NULL) free (pass); + if (fail) + { + const char *page = "Go away."; + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_basic_auth_fail_response (connection, + "my realm", + response); + } + else + { + const char *page = "A secret."; + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + } + MHD_destroy_response (response); + return ret; +} +@end verbatim + +See the @code{examples} directory for the complete example file. + +@heading Remarks +For a proper server, the conditional statements leading to a return of @code{MHD_NO} should yield a +response with a more precise status code instead of silently closing the connection. For example, +failures of memory allocation are best reported as @emph{internal server error} and unexpected +authentication methods as @emph{400 bad request}. + +@heading Exercises +@itemize @bullet +@item +Make the server respond to wrong credentials (but otherwise well-formed requests) with the recommended +@emph{401 unauthorized} status code. If the client still does not authenticate correctly within the +same connection, close it and store the client's IP address for a certain time. (It is OK to check for +expiration not until the main thread wakes up again on the next connection.) If the client fails +authenticating three times during this period, add it to another list for which the +@code{AcceptPolicyCallback} function denies connection (temporally). + +@item +With the network utility @code{netcat} connect and log the response of a "GET" request as you +did in the exercise of the first example, this time to a file. Now stop the server and let @emph{netcat} +listen on the same port the server used to listen on and have it fake being the proper server by giving +the file's content as the response (e.g. @code{cat log | nc -l -p 8888}). Pretending to think your were +connecting to the actual server, browse to the eavesdropper and give the correct credentials. + +Copy and paste the encoded string you see in @code{netcat}'s output to some of the Base64 decode tools available online +and see how both the user's name and password could be completely restored. + +@end itemize + + diff --git a/doc/chapters/bibliography.inc b/doc/chapters/bibliography.inc new file mode 100644 index 0000000..cc288bc --- /dev/null +++ b/doc/chapters/bibliography.inc @@ -0,0 +1,29 @@ +@heading API reference +@itemize @bullet +@item +The @emph{GNU libmicrohttpd} manual by Marco Maggi and Christian Grothoff 2008 +@uref{http://gnunet.org/libmicrohttpd/microhttpd.html} + +@item +All referenced RFCs can be found on the website of @emph{The Internet Engineering Task Force} +@uref{http://www.ietf.org/} + +@item +@emph{RFC 2616}: Fielding, R., Gettys, J., Mogul, J., Frystyk, H., and T. Berners-Lee, +"Hypertext Transfer Protocol -- HTTP/1.1", RFC 2016, January 1997. + +@item +@emph{RFC 2617}: Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., Leach, P., +Luotonen, A., and L. Stewart, "HTTP Authentication: Basic and Digest Access Authentication", RFC 2617, June 1999. + + +@item +A well--structured @emph{HTML} reference can be found on +@uref{http://www.echoecho.com/html.htm} + +For those readers understanding German or French, there is an excellent document both for learning +@emph{HTML} and for reference, whose English version unfortunately has been discontinued. +@uref{http://de.selfhtml.org/} and @uref{http://fr.selfhtml.org/} + + +@end itemize diff --git a/doc/chapters/exploringrequests.inc b/doc/chapters/exploringrequests.inc new file mode 100644 index 0000000..2e43c38 --- /dev/null +++ b/doc/chapters/exploringrequests.inc @@ -0,0 +1,109 @@ +This chapter will deal with the information which the client sends to the +server at every request. We are going to examine the most useful fields of such an request +and print them out in a readable manner. This could be useful for logging facilities. + +The starting point is the @emph{hellobrowser} program with the former response removed. + +This time, we just want to collect information in the callback function, thus we will +just return MHD_NO after we have probed the request. This way, the connection is closed +without much ado by the server. + +@verbatim +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, + const char *method, const char *version, + const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + ... + return MHD_NO; +} +@end verbatim +@noindent +The ellipsis marks the position where the following instructions shall be inserted. + + +We begin with the most obvious information available to the server, the request line. You should +already have noted that a request consists of a command (or "HTTP method") and a URI (e.g. a filename). +It also contains a string for the version of the protocol which can be found in @code{version}. +To call it a "new request" is justified because we return only @code{MHD_NO}, thus ensuring the +function will not be called again for this connection. +@verbatim +printf ("New %s request for %s using version %s\n", method, url, version); +@end verbatim +@noindent + +The rest of the information is a bit more hidden. Nevertheless, there is lot of it sent from common +Internet browsers. It is stored in "key-value" pairs and we want to list what we find in the header. +As there is no mandatory set of keys a client has to send, each key-value pair is printed out one by +one until there are no more left. We do this by writing a separate function which will be called for +each pair just like the above function is called for each HTTP request. +It can then print out the content of this pair. +@verbatim +int print_out_key (void *cls, enum MHD_ValueKind kind, + const char *key, const char *value) +{ + printf ("%s: %s\n", key, value); + return MHD_YES; +} +@end verbatim +@noindent + +To start the iteration process that calls our new function for every key, the line +@verbatim +MHD_get_connection_values (connection, MHD_HEADER_KIND, &print_out_key, NULL); +@end verbatim +@noindent +needs to be inserted in the connection callback function too. The second parameter tells the function +that we are only interested in keys from the general HTTP header of the request. Our iterating +function @code{print_out_key} does not rely on any additional information to fulfill its duties +so the last parameter can be NULL. + +All in all, this constitutes the complete @code{logging.c} program for this chapter which can be +found in the @code{examples} section. + +Connecting with any modern Internet browser should yield a handful of keys. You should try to +interpret them with the aid of @emph{RFC 2616}. +Especially worth mentioning is the "Host" key which is often used to serve several different websites +hosted under one single IP address but reachable by different domain names (this is called virtual hosting). + +@heading Conclusion +The introduced capabilities to itemize the content of a simple GET request---especially the +URI---should already allow the server to satisfy clients' requests for small specific resources +(e.g. files) or even induce alteration of server state. However, the latter is not +recommended as the GET method (including its header data) is by convention considered a "safe" +operation, which should not change the server's state in a significant way. By convention, +GET operations can thus be performed by crawlers and other automatic software. Naturally +actions like searching for a passed string are fine. + +Of course, no transmission can occur while the return value is still set to @code{MHD_NO} in the +callback function. + +@heading Exercises +@itemize @bullet +@item +By parsing the @code{url} string and delivering responses accordingly, implement a small server for +"virtual" files. When asked for @code{/index.htm@{l@}}, let the response consist of a HTML page +containing a link to @code{/another.html} page which is also to be created "on the fly" in case of +being requested. If neither of these two pages are requested, @code{MHD_HTTP_NOT_FOUND} shall be +returned accompanied by an informative message. + +@item +A very interesting information has still been ignored by our logger---the client's IP address. +Implement a callback function +@verbatim +static int on_client_connect (void *cls, + const struct sockaddr *addr, + socklen_t addrlen) +@end verbatim +@noindent +that prints out the IP address in an appropriate format. You might want to use the POSIX function +@code{inet_ntoa} but bear in mind that @code{addr} is actually just a structure containing other +substructures and is @emph{not} the variable this function expects. +Make sure to return @code{MHD_YES} so that the library knows the client is allowed to connect +(and to then process the request). If one wanted to limit access basing on IP addresses, this would be the place +to do it. The address of your @code{on_client_connect} function must be passed as the third parameter to the +@code{MHD_start_daemon} call. + +@end itemize diff --git a/doc/chapters/hellobrowser.inc b/doc/chapters/hellobrowser.inc new file mode 100644 index 0000000..983cfb6 --- /dev/null +++ b/doc/chapters/hellobrowser.inc @@ -0,0 +1,222 @@ +The most basic task for a HTTP server is to deliver a static text message to any client connecting to it. +Given that this is also easy to implement, it is an excellent problem to start with. + +For now, the particular URI the client asks for shall have no effect on the message that will +be returned. In addition, the server shall end the connection after the message has been sent so that +the client will know there is nothing more to expect. + +The C program @code{hellobrowser.c}, which is to be found in the examples section, does just that. +If you are very eager, you can compile and start it right away but it is advisable to type the +lines in by yourself as they will be discussed and explained in detail. + +After the necessary includes and the definition of the port which our server should listen on +@verbatim +#include +#include +#include +#include + +#define PORT 8888 + +@end verbatim + +@noindent +the desired behaviour of our server when HTTP request arrive has to be implemented. We already have +agreed that it should not care about the particular details of the request, such as who is requesting +what. The server will respond merely with the same small HTML page to every request. + +The function we are going to write now will be called by @emph{GNU libmicrohttpd} every time an +appropriate request comes in. While the name of this callback function is arbitrary, its parameter +list has to follow a certain layout. So please, ignore the lot of parameters for now, they will be +explained at the point they are needed. We have to use only one of them, +@code{struct MHD_Connection *connection}, for the minimalistic functionality we want to achieve at the moment. + +This parameter is set by the @emph{libmicrohttpd} daemon and holds the necessary information to +relate the call with a certain connection. Keep in mind that a server might have to satisfy hundreds +of concurrent connections and we have to make sure that the correct data is sent to the destined +client. Therefore, this variable is a means to refer to a particular connection if we ask the +daemon to sent the reply. + +Talking about the reply, it is defined as a string right after the function header +@verbatim +int answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, + const char *method, const char *version, + const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + const char *page = "Hello, browser!"; + +@end verbatim + +@noindent +HTTP is a rather strict protocol and the client would certainly consider it "inappropriate" if we +just sent the answer string "as is". Instead, it has to be wrapped with additional information stored in so-called headers and footers. Most of the work in this area is done by the library for us---we +just have to ask. Our reply string packed in the necessary layers will be called a "response". +To obtain such a response we hand our data (the reply--string) and its size over to the +@code{MHD_create_response_from_buffer} function. The last two parameters basically tell @emph{MHD} +that we do not want it to dispose the message data for us when it has been sent and there also needs +no internal copy to be done because the @emph{constant} string won't change anyway. + +@verbatim + struct MHD_Response *response; + int ret; + + response = MHD_create_response_from_buffer (strlen (page), + (void*) page, MHD_RESPMEM_PERSISTENT); + +@end verbatim + +@noindent +Now that the the response has been laced up, it is ready for delivery and can be queued for sending. +This is done by passing it to another @emph{GNU libmicrohttpd} function. As all our work was done in +the scope of one function, the recipient is without doubt the one associated with the +local variable @code{connection} and consequently this variable is given to the queue function. +Every HTTP response is accompanied by a status code, here "OK", so that the client knows +this response is the intended result of his request and not due to some error or malfunction. + +Finally, the packet is destroyed and the return value from the queue returned, +already being set at this point to either MHD_YES or MHD_NO in case of success or failure. + +@verbatim + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + + return ret; +} + +@end verbatim + +@noindent +With the primary task of our server implemented, we can start the actual server daemon which will listen +on @code{PORT} for connections. This is done in the main function. +@verbatim +int main () +{ + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, + &answer_to_connection, NULL, MHD_OPTION_END); + if (NULL == daemon) return 1; + +@end verbatim + +@noindent +The first parameter is one of three possible modes of operation. Here we want the daemon to run in +a separate thread and to manage all incoming connections in the same thread. This means that while +producing the response for one connection, the other connections will be put on hold. In this +example, where the reply is already known and therefore the request is served quickly, this poses no problem. + +We will allow all clients to connect regardless of their name or location, therefore we do not check +them on connection and set the third and fourth parameter to NULL. + +Parameter five is the address of the function we want to be called whenever a new connection has been +established. Our @code{answer_to_connection} knows best what the client wants and needs no additional +information (which could be passed via the next parameter) so the next (sixth) parameter is NULL. Likewise, +we do not need to pass extra options to the daemon so we just write the MHD_OPTION_END as the last parameter. + +As the server daemon runs in the background in its own thread, the execution flow in our main +function will contine right after the call. Because of this, we must delay the execution flow in the +main thread or else the program will terminate prematurely. We let it pause in a processing-time +friendly manner by waiting for the enter key to be pressed. In the end, we stop the daemon so it can +do its cleanup tasks. +@verbatim + getchar (); + + MHD_stop_daemon (daemon); + return 0; +} + +@end verbatim + +@noindent +The first example is now complete. + +Compile it with +@verbatim +cc hellobrowser.c -o hellobrowser -I$PATH_TO_LIBMHD_INCLUDES + -L$PATH_TO_LIBMHD_LIBS -lmicrohttpd +@end verbatim +with the two paths set accordingly and run it. + +Now open your favorite Internet browser and go to the address @code{http://localhost:8888/}, provided that 8888 +is the port you chose. If everything works as expected, the browser will present the message of the +static HTML page it got from our minimal server. + +@heading Remarks +To keep this first example as small as possible, some drastic shortcuts were taken and are to be +discussed now. + +Firstly, there is no distinction made between the kinds of requests a client could send. We implied +that the client sends a GET request, that means, that he actually asked for some data. Even when +it is not intended to accept POST requests, a good server should at least recognize that this +request does not constitute a legal request and answer with an error code. This can be easily +implemented by checking if the parameter @code{method} equals the string "GET" and returning a +@code{MHD_NO} if not so. + +Secondly, the above practice of queuing a response upon the first call of the callback function +brings with it some limitations. This is because the content of the message body will not be +received if a response is queued in the first iteration. Furthermore, the connection will be closed +right after the response has been transferred then. This is typically not what you want as it +disables HTTP pipelining. The correct approach is to simply not queue a message on the first +callback unless there is an error. The @code{void**} argument to the callback provides a location +for storing information about the history of the connection; for the first call, the pointer +will point to NULL. A simplistic way to differenciate the first call from others is to check +if the pointer is NULL and set it to a non-NULL value during the first call. + +Both of these issues you will find addressed in the official @code{minimal_example.c} residing in +the @code{src/examples} directory of the @emph{MHD} package. The source code of this +program should look very familiar to you by now and easy to understand. + +For our example, we create the response from a static (persistent) buffer in memory and thus pass @code{MHD_RESPMEM_PERSISTENT} to the response construction +function. In the usual case, responses are not transmitted immediately +after being queued. For example, there might be other data on the system that needs to be sent with +a higher priority. Nevertheless, the queue function will return successfully---raising the problem +that the data we have pointed to may be invalid by the time it is about being sent. This is not an +issue here because we can expect the @code{page} string, which is a constant @emph{string literal} +here, to be static. That means it will be present and unchanged for as long as the program runs. +For dynamic data, one could choose to either have @emph{MHD} free the memory @code{page} points +to itself when it is not longer needed (by passing @code{MHD_RESPMEM_MUST_FREE}) or, alternatively, have the library to make and manage +its own copy of it (by passing @code{MHD_RESPMEM_MUST_COPY}). Naturally, this last option is the most expensive. + +@heading Exercises +@itemize @bullet +@item +While the server is running, use a program like @code{telnet} or @code{netcat} to connect to it. Try to form a +valid HTTP 1.1 request yourself like +@verbatim +GET /dontcare HTTP/1.1 +Host: itsme + +@end verbatim +@noindent +and see what the server returns to you. + + +@item +Also, try other requests, like POST, and see how our server does not mind and why. +How far in malforming a request can you go before the builtin functionality of @emph{MHD} intervenes +and an altered response is sent? Make sure you read about the status codes in the @emph{RFC}. + + +@item +Add the option @code{MHD_USE_PEDANTIC_CHECKS} to the start function of the daemon in @code{main}. +Mind the special format of the parameter list here which is described in the manual. How indulgent +is the server now to your input? + + +@item +Let the main function take a string as the first command line argument and pass @code{argv[1]} to +the @code{MHD_start_daemon} function as the sixth parameter. The address of this string will be +passed to the callback function via the @code{cls} variable. Decorate the text given at the command +line when the server is started with proper HTML tags and send it as the response instead of the +former static string. + + +@item +@emph{Demanding:} Write a separate function returning a string containing some useful information, +for example, the time. Pass the function's address as the sixth parameter and evaluate this function +on every request anew in @code{answer_to_connection}. Remember to free the memory of the string +every time after satisfying the request. + +@end itemize diff --git a/doc/chapters/introduction.inc b/doc/chapters/introduction.inc new file mode 100644 index 0000000..95caf9a --- /dev/null +++ b/doc/chapters/introduction.inc @@ -0,0 +1,23 @@ +This tutorial is for developers who want to learn how they can add HTTP serving +capabilities to their applications with the @emph{GNU libmicrohttpd} library, +abbreviated @emph{MHD}. The reader will learn how to +implement basic HTTP functions from simple executable +sample programs that implement various features. + +The text is supposed to be a supplement to the API reference manual of +@emph{GNU libmicrohttpd} and for that reason does not explain many of the parameters. +Therefore, the reader should always consult the manual to find the exact meaning +of the functions used in the tutorial. Furthermore, the reader is +encouraged to study the relevant @emph{RFCs}, which document the HTTP standard. + +@emph{GNU libmicrohttpd} is assumed to be already installed. This tutorial +is written for version @value{VERSION}. At the time being, +this tutorial has only been tested on @emph{GNU/Linux} machines even though +efforts were made not to rely on anything that would prevent the samples from being +built on similar systems. + +@section History + +This tutorial was originally written by Sebastian Gerhardt for MHD +0.4.0. It was slighly polished and updated to MHD 0.9.0 by Christian +Grothoff. \ No newline at end of file diff --git a/doc/chapters/largerpost.inc b/doc/chapters/largerpost.inc new file mode 100644 index 0000000..1f60028 --- /dev/null +++ b/doc/chapters/largerpost.inc @@ -0,0 +1,319 @@ +The previous chapter introduced a way to upload data to the server, but the developed example program +has some shortcomings, such as not being able to handle larger chunks of data. In this chapter, we +are going to discuss a more advanced server program that allows clients to upload a file in order to +have it stored on the server's filesystem. The server shall also watch and limit the number of +clients concurrently uploading, responding with a proper busy message if necessary. + + +@heading Prepared answers +We choose to operate the server with the @code{SELECT_INTERNALLY} method. This makes it easier to +synchronize the global states at the cost of possible delays for other connections if the processing +of a request is too slow. One of these variables that needs to be shared for all connections is the +total number of clients that are uploading. + +@verbatim +#define MAXCLIENTS 2 +static unsigned int nr_of_uploading_clients = 0; +@end verbatim +@noindent + +If there are too many clients uploading, we want the server to respond to all requests with a busy +message. +@verbatim +const char* busypage = + "This server is busy, please try again later."; +@end verbatim +@noindent + +Otherwise, the server will send a @emph{form} that informs the user of the current number of uploading clients, +and ask her to pick a file on her local filesystem which is to be uploaded. +@verbatim +const char* askpage = "\n\ + Upload a file, please!
\n\ + There are %u clients uploading at the moment.
\n\ +
\n\ + \n\ +
\n\ + "; +@end verbatim +@noindent + +If the upload has succeeded, the server will respond with a message saying so. +@verbatim +const char* completepage = "The upload has been completed."; +@end verbatim +@noindent + +We want the server to report internal errors, such as memory shortage or file access problems, +adequately. +@verbatim +const char* servererrorpage + = "An internal server error has occured."; +const char* fileexistspage + = "This file already exists."; +@end verbatim +@noindent + +It would be tolerable to send all these responses undifferentiated with a @code{200 HTTP_OK} +status code but in order to improve the @code{HTTP} conformance of our server a bit, we extend the +@code{send_page} function so that it accepts individual status codes. + +@verbatim +static int +send_page (struct MHD_Connection *connection, + const char* page, int status_code) +{ + int ret; + struct MHD_Response *response; + + response = MHD_create_response_from_buffer (strlen (page), (void*) page, + MHD_RESPMEM_MUST_COPY); + if (!response) return MHD_NO; + + ret = MHD_queue_response (connection, status_code, response); + MHD_destroy_response (response); + + return ret; +} +@end verbatim +@noindent + +Note how we ask @emph{MHD} to make its own copy of the message data. The reason behind this will +become clear later. + + +@heading Connection cycle +The decision whether the server is busy or not is made right at the beginning of the connection. To +do that at this stage is especially important for @emph{POST} requests because if no response is +queued at this point, and @code{MHD_YES} returned, @emph{MHD} will not sent any queued messages until +a postprocessor has been created and the post iterator is called at least once. + +@verbatim +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, + const char *method, const char *version, + const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + if (NULL == *con_cls) + { + struct connection_info_struct *con_info; + + if (nr_of_uploading_clients >= MAXCLIENTS) + return send_page(connection, busypage, MHD_HTTP_SERVICE_UNAVAILABLE); +@end verbatim +@noindent + +If the server is not busy, the @code{connection_info} structure is initialized as usual, with +the addition of a filepointer for each connection. + +@verbatim + con_info = malloc (sizeof (struct connection_info_struct)); + if (NULL == con_info) return MHD_NO; + con_info->fp = 0; + + if (0 == strcmp (method, "POST")) + { + ... + } + else con_info->connectiontype = GET; + + *con_cls = (void*) con_info; + + return MHD_YES; + } +@end verbatim +@noindent + +For @emph{POST} requests, the postprocessor is created and we register a new uploading client. From +this point on, there are many possible places for errors to occur that make it necessary to interrupt +the uploading process. We need a means of having the proper response message ready at all times. +Therefore, the @code{connection_info} structure is extended to hold the most current response +message so that whenever a response is sent, the client will get the most informative message. Here, +the structure is initialized to "no error". +@verbatim + if (0 == strcmp (method, "POST")) + { + con_info->postprocessor + = MHD_create_post_processor (connection, POSTBUFFERSIZE, + iterate_post, (void*) con_info); + + if (NULL == con_info->postprocessor) + { + free (con_info); + return MHD_NO; + } + + nr_of_uploading_clients++; + + con_info->connectiontype = POST; + con_info->answercode = MHD_HTTP_OK; + con_info->answerstring = completepage; + } + else con_info->connectiontype = GET; +@end verbatim +@noindent + +If the connection handler is called for the second time, @emph{GET} requests will be answered with +the @emph{form}. We can keep the buffer under function scope, because we asked @emph{MHD} to make its +own copy of it for as long as it is needed. +@verbatim + if (0 == strcmp (method, "GET")) + { + int ret; + char buffer[1024]; + + sprintf (buffer, askpage, nr_of_uploading_clients); + return send_page (connection, buffer, MHD_HTTP_OK); + } +@end verbatim +@noindent + + +The rest of the @code{answer_to_connection} function is very similar to the @code{simplepost.c} +example, except the more flexible content of the responses. The @emph{POST} data is processed until +there is none left and the execution falls through to return an error page if the connection +constituted no expected request method. +@verbatim + if (0 == strcmp (method, "POST")) + { + struct connection_info_struct *con_info = *con_cls; + + if (0 != *upload_data_size) + { + MHD_post_process (con_info->postprocessor, + upload_data, *upload_data_size); + *upload_data_size = 0; + + return MHD_YES; + } + else + return send_page (connection, con_info->answerstring, + con_info->answercode); + } + + return send_page(connection, errorpage, MHD_HTTP_BAD_REQUEST); +} +@end verbatim +@noindent + + +@heading Storing to data +Unlike the @code{simplepost.c} example, here it is to be expected that post iterator will be called +several times now. This means that for any given connection (there might be several concurrent of them) +the posted data has to be written to the correct file. That is why we store a file handle in every +@code{connection_info}, so that the it is preserved between successive iterations. +@verbatim +static int +iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, + const char *key, + const char *filename, const char *content_type, + const char *transfer_encoding, const char *data, + uint64_t off, size_t size) +{ + struct connection_info_struct *con_info = coninfo_cls; +@end verbatim +@noindent + +Because the following actions depend heavily on correct file processing, which might be error prone, +we default to reporting internal errors in case anything will go wrong. + +@verbatim +con_info->answerstring = servererrorpage; +con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR; +@end verbatim +@noindent + +In the "askpage" @emph{form}, we told the client to label its post data with the "file" key. Anything else +would be an error. + +@verbatim + if (0 != strcmp (key, "file")) return MHD_NO; +@end verbatim +@noindent + +If the iterator is called for the first time, no file will have been opened yet. The @code{filename} +string contains the name of the file (without any paths) the user selected on his system. We want to +take this as the name the file will be stored on the server and make sure no file of that name exists +(or is being uploaded) before we create one (note that the code below technically contains a +race between the two "fopen" calls, but we will overlook this for portability sake). +@verbatim + if (!con_info->fp) + { + if (NULL != (fp = fopen (filename, "rb")) ) + { + fclose (fp); + con_info->answerstring = fileexistspage; + con_info->answercode = MHD_HTTP_FORBIDDEN; + return MHD_NO; + } + + con_info->fp = fopen (filename, "ab"); + if (!con_info->fp) return MHD_NO; + } +@end verbatim +@noindent + + +Occasionally, the iterator function will be called even when there are 0 new bytes to process. The +server only needs to write data to the file if there is some. +@verbatim +if (size > 0) + { + if (!fwrite (data, size, sizeof(char), con_info->fp)) + return MHD_NO; + } +@end verbatim +@noindent + +If this point has been reached, everything worked well for this iteration and the response can +be set to success again. If the upload has finished, this iterator function will not be called again. +@verbatim + con_info->answerstring = completepage; + con_info->answercode = MHD_HTTP_OK; + + return MHD_YES; +} +@end verbatim +@noindent + + +The new client was registered when the postprocessor was created. Likewise, we unregister the client +on destroying the postprocessor when the request is completed. +@verbatim +void request_completed (void *cls, struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct connection_info_struct *con_info = *con_cls; + + if (NULL == con_info) return; + + if (con_info->connectiontype == POST) + { + if (NULL != con_info->postprocessor) + { + MHD_destroy_post_processor (con_info->postprocessor); + nr_of_uploading_clients--; + } + + if (con_info->fp) fclose (con_info->fp); + } + + free (con_info); + *con_cls = NULL; +} +@end verbatim +@noindent + + +This is essentially the whole example @code{largepost.c}. + + +@heading Remarks +Now that the clients are able to create files on the server, security aspects are becoming even more +important than before. Aside from proper client authentication, the server should always make sure +explicitly that no files will be created outside of a dedicated upload directory. In particular, +filenames must be checked to not contain strings like "../". diff --git a/doc/chapters/processingpost.inc b/doc/chapters/processingpost.inc new file mode 100644 index 0000000..920dac3 --- /dev/null +++ b/doc/chapters/processingpost.inc @@ -0,0 +1,238 @@ +The previous chapters already have demonstrated a variety of possibilities to send information +to the HTTP server, but it is not recommended that the @emph{GET} method is used to alter the way +the server operates. To induce changes on the server, the @emph{POST} method is preferred over +and is much more powerful than @emph{GET} and will be introduced in this chapter. + +We are going to write an application that asks for the visitor's name and, after the user has posted it, +composes an individual response text. Even though it was not mandatory to use the @emph{POST} method here, +as there is no permanent change caused by the POST, it is an illustrative example on how to share data +between different functions for the same connection. Furthermore, the reader should be able to extend +it easily. + +@heading GET request +When the first @emph{GET} request arrives, the server shall respond with a HTML page containing an +edit field for the name. + +@verbatim +const char* askpage = "\ + What's your name, Sir?
\ +
\ +
\ + "; +@end verbatim +@noindent + +The @code{action} entry is the @emph{URI} to be called by the browser when posting, and the +@code{name} will be used later to be sure it is the editbox's content that has been posted. + +We also prepare the answer page, where the name is to be filled in later, and an error page +as the response for anything but proper @emph{GET} and @emph{POST} requests: + +@verbatim +const char* greatingpage="

Welcome, %s!

"; + +const char* errorpage="This doesn't seem to be right."; +@end verbatim +@noindent + +Whenever we need to send a page, we use an extra function +@code{int send_page(struct MHD_Connection *connection, const char* page)} +for this, which does not contain anything new and whose implementation is therefore +not discussed further in the tutorial. + + +@heading POST request +Posted data can be of arbitrary and considerable size; for example, if a user uploads a big +image to the server. Similar to the case of the header fields, there may also be different streams +of posted data, such as one containing the text of an editbox and another the state of a button. +Likewise, we will have to register an iterator function that is going to be called maybe several times +not only if there are different POSTs but also if one POST has only been received partly yet and +needs processing before another chunk can be received. + +Such an iterator function is called by a @emph{postprocessor}, which must be created upon arriving +of the post request. We want the iterator function to read the first post data which is tagged +@code{name} and to create an individual greeting string based on the template and the name. +But in order to pass this string to other functions and still be able to differentiate different +connections, we must first define a structure to share the information, holding the most import entries. + +@verbatim +struct connection_info_struct +{ + int connectiontype; + char *answerstring; + struct MHD_PostProcessor *postprocessor; +}; +@end verbatim +@noindent + +With these information available to the iterator function, it is able to fulfill its task. +Once it has composed the greeting string, it returns @code{MHD_NO} to inform the post processor +that it does not need to be called again. Note that this function does not handle processing +of data for the same @code{key}. If we were to expect that the name will be posted in several +chunks, we had to expand the namestring dynamically as additional parts of it with the same @code{key} +came in. But in this example, the name is assumed to fit entirely inside one single packet. + +@verbatim +static int +iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, + const char *filename, const char *content_type, + const char *transfer_encoding, const char *data, + uint64_t off, size_t size) +{ + struct connection_info_struct *con_info = coninfo_cls; + + if (0 == strcmp (key, "name")) + { + if ((size > 0) && (size <= MAXNAMESIZE)) + { + char *answerstring; + answerstring = malloc (MAXANSWERSIZE); + if (!answerstring) return MHD_NO; + + snprintf (answerstring, MAXANSWERSIZE, greatingpage, data); + con_info->answerstring = answerstring; + } + else con_info->answerstring = NULL; + + return MHD_NO; + } + + return MHD_YES; +} +@end verbatim +@noindent + +Once a connection has been established, it can be terminated for many reasons. As these +reasons include unexpected events, we have to register another function that cleans up any resources +that might have been allocated for that connection by us, namely the post processor and the greetings +string. This cleanup function must take into account that it will also be called for finished +requests other than @emph{POST} requests. + +@verbatim +void request_completed (void *cls, struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct connection_info_struct *con_info = *con_cls; + + if (NULL == con_info) return; + if (con_info->connectiontype == POST) + { + MHD_destroy_post_processor (con_info->postprocessor); + if (con_info->answerstring) free (con_info->answerstring); + } + + free (con_info); + *con_cls = NULL; +} +@end verbatim +@noindent + +@emph{GNU libmicrohttpd} is informed that it shall call the above function when the daemon is started +in the main function. + +@verbatim +... +daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &request_completed, NULL, + MHD_OPTION_END); +... +@end verbatim +@noindent + +@heading Request handling +With all other functions prepared, we can now discuss the actual request handling. + +On the first iteration for a new request, we start by allocating a new instance of a +@code{struct connection_info_struct} structure, which will store all necessary information for later +iterations and other functions. + +@verbatim +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, + const char *method, const char *version, + const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + if(NULL == *con_cls) + { + struct connection_info_struct *con_info; + + con_info = malloc (sizeof (struct connection_info_struct)); + if (NULL == con_info) return MHD_NO; + con_info->answerstring = NULL; +@end verbatim +@noindent + +If the new request is a @emph{POST}, the postprocessor must be created now. In addition, the type +of the request is stored for convenience. +@verbatim + if (0 == strcmp (method, "POST")) + { + con_info->postprocessor + = MHD_create_post_processor (connection, POSTBUFFERSIZE, + iterate_post, (void*) con_info); + + if (NULL == con_info->postprocessor) + { + free (con_info); + return MHD_NO; + } + con_info->connectiontype = POST; + } + else con_info->connectiontype = GET; +@end verbatim +@noindent + +The address of our structure will both serve as the indicator for successive iterations and to remember +the particular details about the connection. +@verbatim + *con_cls = (void*) con_info; + return MHD_YES; + } +@end verbatim +@noindent + +The rest of the function will not be executed on the first iteration. A @emph{GET} request is easily +satisfied by sending the question form. +@verbatim + if (0 == strcmp (method, "GET")) + { + return send_page (connection, askpage); + } +@end verbatim +@noindent + +In case of @emph{POST}, we invoke the post processor for as long as data keeps incoming, setting +@code{*upload_data_size} to zero in order to indicate that we have processed---or at least have +considered---all of it. +@verbatim + if (0 == strcmp (method, "POST")) + { + struct connection_info_struct *con_info = *con_cls; + + if (*upload_data_size != 0) + { + MHD_post_process (con_info->postprocessor, upload_data, + *upload_data_size); + *upload_data_size = 0; + + return MHD_YES; + } + else if (NULL != con_info->answerstring) + return send_page (connection, con_info->answerstring); + } +@end verbatim +@noindent + +Finally, if they are neither @emph{GET} nor @emph{POST} requests, the error page is returned. +@verbatim + return send_page(connection, errorpage); +} +@end verbatim +@noindent + +These were the important parts of the program @code{simplepost.c}. diff --git a/doc/chapters/responseheaders.inc b/doc/chapters/responseheaders.inc new file mode 100644 index 0000000..ece7ce1 --- /dev/null +++ b/doc/chapters/responseheaders.inc @@ -0,0 +1,193 @@ +Now that we are able to inspect the incoming request in great detail, +this chapter discusses the means to enrich the outgoing responses likewise. + +As you have learned in the @emph{Hello, Browser} chapter, some obligatory +header fields are added and set automatically for simple responses by the library +itself but if more advanced features are desired, additional fields have to be created. +One of the possible fields is the content type field and an example will be developed around it. +This will lead to an application capable of correctly serving different types of files. + + +When we responded with HTML page packed in the static string previously, the client had no choice +but guessing about how to handle the response, because the server had not told him. +What if we had sent a picture or a sound file? Would the message have been understood +or merely been displayed as an endless stream of random characters in the browser? +This is what the mime content types are for. The header of the response is extended +by certain information about how the data is to be interpreted. + +To introduce the concept, a picture of the format @emph{PNG} will be sent to the client +and labeled accordingly with @code{image/png}. +Once again, we can base the new example on the @code{hellobrowser} program. + +@verbatim +#define FILENAME "picture.png" +#define MIMETYPE "image/png" + +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, + const char *method, const char *version, + const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + unsigned char *buffer = NULL; + struct MHD_Response *response; +@end verbatim +@noindent + +We want the program to open the file for reading and determine its size: +@verbatim + int fd; + int ret; + struct stat sbuf; + + if (0 != strcmp (method, "GET")) + return MHD_NO; + if ( (-1 == (fd = open (FILENAME, O_RDONLY))) || + (0 != fstat (fd, &sbuf)) ) + { + /* error accessing file */ + /* ... (see below) */ + } + /* ... (see below) */ +@end verbatim +@noindent + +When dealing with files, there is a lot that could go wrong on the +server side and if so, the client should be informed with @code{MHD_HTTP_INTERNAL_SERVER_ERROR}. + +@verbatim + /* error accessing file */ + if (fd != -1) close (fd); + const char *errorstr = + "An internal server error has occured!\ + "; + response = + MHD_create_response_from_buffer (strlen (errorstr), + (void *) errorstr, + MHD_RESPMEM_PERSISTENT); + if (response) + { + ret = + MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, + response); + MHD_destroy_response (response); + + return MHD_YES; + } + else + return MHD_NO; + if (!ret) + { + const char *errorstr = "An internal server error has occured!\ + "; + + if (buffer) free(buffer); + + response = MHD_create_response_from_buffer (strlen(errorstr), (void*) errorstr, + MHD_RESPMEM_PERSISTENT); + + if (response) + { + ret = MHD_queue_response (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + response); + MHD_destroy_response (response); + + return MHD_YES; + } + else return MHD_NO; + } +@end verbatim +@noindent + +Note that we nevertheless have to create a response object even for sending a simple error code. +Otherwise, the connection would just be closed without comment, leaving the client curious about +what has happened. + +But in the case of success a response will be constructed directly from the file descriptor: + +@verbatim + /* error accessing file */ + /* ... (see above) */ + } + + response = + MHD_create_response_from_fd_at_offset (sbuf.st_size, fd, 0); + MHD_add_response_header (response, "Content-Type", MIMETYPE); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); +@end verbatim +@noindent + +Note that the response object will take care of closing the file desciptor for us. + +Up to this point, there was little new. The actual novelty is that we enhance the header with the +meta data about the content. Aware of the field's name we want to add, it is as easy as that: +@verbatim +MHD_add_response_header(response, "Content-Type", MIMETYPE); +@end verbatim +@noindent +We do not have to append a colon expected by the protocol behind the first +field---@emph{GNU libhttpdmicro} will take care of this. + +The function finishes with the well-known lines +@verbatim + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} +@end verbatim +@noindent + +The complete program @code{responseheaders.c} is in the @code{examples} section as usual. +Find a @emph{PNG} file you like and save it to the directory the example is run from under the name +@code{picture.png}. You should find the image displayed on your browser if everything worked well. + +@heading Remarks +The include file of the @emph{MHD} library comes with the header types mentioned in @emph{RFC 2616} +already defined as macros. Thus, we could have written @code{MHD_HTTP_HEADER_CONTENT_TYPE} instead +of @code{"Content-Type"} as well. However, one is not limited to these standard headers and could +add custom response headers without violating the protocol. Whether, and how, the client would react +to these custom header is up to the receiver. Likewise, the client is allowed to send custom request +headers to the server as well, opening up yet more possibilities how client and server could +communicate with each other. + +The method of creating the response from a file on disk only works for static content. +Serving dynamically created responses will be a topic of a future chapter. + +@heading Exercises +@itemize @bullet + +@item +Remember that the original program was written under a few assumptions---a static response +using a local file being one of them. In order to simulate a very large or hard to reach file that cannot be provided +instantly, postpone the queuing in the callback with the @code{sleep} function for 30 seconds +@emph{if} the file @code{/big.png} is requested (but deliver the same as above). A request for +@code{/picture.png} should provide just the same but without any artificial delays. + +Now start two instances of your browser (or even use two machines) and see how the second client +is put on hold while the first waits for his request on the slow file to be fulfilled. + +Finally, change the sourcecode to use @code{MHD_USE_THREAD_PER_CONNECTION} when the daemon is +started and try again. + + +@item +Did you succeed in implementing the clock exercise yet? This time, let the server save the +program's start time @code{t} and implement a response simulating a countdown that reaches 0 at +@code{t+60}. Returning a message saying on which point the countdown is, the response should +ultimately be to reply "Done" if the program has been running long enough, + +An unofficial, but widely understood, response header line is @code{Refresh: DELAY; url=URL} with +the uppercase words substituted to tell the client it should request the given resource after +the given delay again. Improve your program in that the browser (any modern browser should work) +automatically reconnects and asks for the status again every 5 seconds or so. The URL would have +to be composed so that it begins with "http://", followed by the @emph{URI} the server is reachable +from the client's point of view. + +Maybe you want also to visualize the countdown as a status bar by creating a +@code{} consisting of one row and @code{n} columns whose fields contain small images of either +a red or a green light. + +@end itemize diff --git a/doc/chapters/sessions.inc b/doc/chapters/sessions.inc new file mode 100644 index 0000000..ee48e58 --- /dev/null +++ b/doc/chapters/sessions.inc @@ -0,0 +1,88 @@ +This chapter discusses how one should manage sessions, that is, share state between multiple +HTTP requests from the same user. We use a simple example where the user submits multiple +forms and the server is supposed to accumulate state from all of these forms. Naturally, as +this is a network protocol, our session mechanism must support having many users with +many concurrent sessions at the same time. + +In order to track users, we use a simple session cookie. A session cookie expires when the +user closes the browser. Changing from session cookies to persistent cookies only requires +adding an expiration time to the cookie. The server creates a fresh session cookie whenever +a request without a cookie is received, or if the supplied session cookie is not known to +the server. + +@heading Looking up the cookie + +Since MHD parses the HTTP cookie header for us, looking up an existing cookie +is straightforward: + +@verbatim +const char *value; + +value = MHD_lookup_connection_value (connection, + MHD_COOKIE_KIND, + "KEY"); +@end verbatim + +Here, "KEY" is the name we chose for our session cookie. + + +@heading Setting the cookie header + +MHD requires the user to provide the full cookie format string in order to set +cookies. In order to generate a unique cookie, our example creates a random +64-character text string to be used as the value of the cookie: + +@verbatim +char value[128]; +char raw_value[65]; + +for (unsigned int i=0;i openssl genrsa -out server.key 1024 +@end verbatim +@noindent + +In addition to the key, a certificate describing the server in human readable tokens +is also needed. This certificate will be attested with our aforementioned key. In this way, +we obtain a self-signed certificate, valid for one year. + +@verbatim +> openssl req -days 365 -out server.pem -new -x509 -key server.key +@end verbatim +@noindent + +To avoid unnecessary error messages in the browser, the certificate needs to +have a name that matches the @emph{URI}, for example, "localhost" or the domain. +If you plan to have a publicly reachable server, you will need to ask a trusted third party, +called @emph{Certificate Authority}, or @emph{CA}, to attest the certificate for you. This way, +any visitor can make sure the server's identity is real. + +Whether the server's certificate is signed by us or a third party, once it has been accepted +by the client, both sides will be communicating over encrypted channels. From this point on, +it is the client's turn to authenticate itself. But this has already been implemented in the basic +authentication scheme. + + +@heading Changing the source code + +We merely have to extend the server program so that it loads the two files into memory, + +@verbatim +int +main () +{ + struct MHD_Daemon *daemon; + char *key_pem; + char *cert_pem; + + key_pem = load_file (SERVERKEYFILE); + cert_pem = load_file (SERVERCERTFILE); + + if ((key_pem == NULL) || (cert_pem == NULL)) + { + printf ("The key/certificate files could not be read.\n"); + return 1; + } +@end verbatim +@noindent + +and then we point the @emph{MHD} daemon to it upon initalization. +@verbatim + + daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_SSL, + PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_HTTPS_MEM_KEY, key_pem, + MHD_OPTION_HTTPS_MEM_CERT, cert_pem, + MHD_OPTION_END); + + if (NULL == daemon) + { + printf ("%s\n", cert_pem); + + free (key_pem); + free (cert_pem); + + return 1; + } +@end verbatim +@noindent + + +The rest consists of little new besides some additional memory cleanups. +@verbatim + + getchar (); + + MHD_stop_daemon (daemon); + free (key_pem); + free (cert_pem); + + return 0; +} +@end verbatim +@noindent + + +The rather unexciting file loader can be found in the complete example @code{tlsauthentication.c}. + + +@heading Remarks +@itemize @bullet +@item +While the standard @emph{HTTP} port is 80, it is 443 for @emph{HTTPS}. The common internet browsers assume +standard @emph{HTTP} if they are asked to access other ports than these. Therefore, you will have to type +@code{https://localhost:8888} explicitly when you test the example, or the browser will not know how to +handle the answer properly. + +@item +The remaining weak point is the question how the server will be trusted initially. Either a @emph{CA} signs the +certificate or the client obtains the key over secure means. Anyway, the clients have to be aware (or configured) +that they should not accept certificates of unknown origin. + +@item +The introduced method of certificates makes it mandatory to set an expiration date---making it less feasible to +hardcode certificates in embedded devices. + +@item +The cryptographic facilities consume memory space and computing time. For this reason, websites usually consists +both of uncritically @emph{HTTP} parts and secured @emph{HTTPS}. + +@end itemize + + +@heading Client authentication + +You can also use MHD to authenticate the client via SSL/TLS certificates +(as an alternative to using the password-based Basic or Digest authentication). +To do this, you will need to link your application against @emph{gnutls}. +Next, when you start the MHD daemon, you must specify the root CA that you're +willing to trust: +@verbatim + daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_SSL, + PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_HTTPS_MEM_KEY, key_pem, + MHD_OPTION_HTTPS_MEM_CERT, cert_pem, + MHD_OPTION_HTTPS_MEM_TRUST, root_ca_pem, + MHD_OPTION_END); +@end verbatim + +With this, you can then obtain client certificates for each session. +In order to obtain the identity of the client, you first need to +obtain the raw GnuTLS session handle from @emph{MHD} using +@code{MHD_get_connection_info}. + +@verbatim +#include +#include + +gnutls_session_t tls_session; +union MHD_ConnectionInfo *ci; + +ci = MHD_get_connection_info (connection, + MHD_CONNECTION_INFO_GNUTLS_SESSION); +tls_session = ci->tls_session; +@end verbatim + +You can then extract the client certificate: + +@verbatim +/** + * Get the client's certificate + * + * @param tls_session the TLS session + * @return NULL if no valid client certificate could be found, a pointer + * to the certificate if found + */ +static gnutls_x509_crt_t +get_client_certificate (gnutls_session_t tls_session) +{ + unsigned int listsize; + const gnutls_datum_t * pcert; + gnutls_certificate_status_t client_cert_status; + gnutls_x509_crt_t client_cert; + + if (tls_session == NULL) + return NULL; + if (gnutls_certificate_verify_peers2(tls_session, + &client_cert_status)) + return NULL; + pcert = gnutls_certificate_get_peers(tls_session, + &listsize); + if ( (pcert == NULL) || + (listsize == 0)) + { + fprintf (stderr, + "Failed to retrieve client certificate chain\n"); + return NULL; + } + if (gnutls_x509_crt_init(&client_cert)) + { + fprintf (stderr, + "Failed to initialize client certificate\n"); + return NULL; + } + /* Note that by passing values between 0 and listsize here, you + can get access to the CA's certs */ + if (gnutls_x509_crt_import(client_cert, + &pcert[0], + GNUTLS_X509_FMT_DER)) + { + fprintf (stderr, + "Failed to import client certificate\n"); + gnutls_x509_crt_deinit(client_cert); + return NULL; + } + return client_cert; +} +@end verbatim + +Using the client certificate, you can then get the client's distinguished name +and alternative names: + +@verbatim +/** + * Get the distinguished name from the client's certificate + * + * @param client_cert the client certificate + * @return NULL if no dn or certificate could be found, a pointer + * to the dn if found + */ +char * +cert_auth_get_dn(gnutls_x509_crt_c client_cert) +{ + char* buf; + size_t lbuf; + + lbuf = 0; + gnutls_x509_crt_get_dn(client_cert, NULL, &lbuf); + buf = malloc(lbuf); + if (buf == NULL) + { + fprintf (stderr, + "Failed to allocate memory for certificate dn\n"); + return NULL; + } + gnutls_x509_crt_get_dn(client_cert, buf, &lbuf); + return buf; +} + + +/** + * Get the alternative name of specified type from the client's certificate + * + * @param client_cert the client certificate + * @param nametype The requested name type + * @param index The position of the alternative name if multiple names are + * matching the requested type, 0 for the first matching name + * @return NULL if no matching alternative name could be found, a pointer + * to the alternative name if found + */ +char * +MHD_cert_auth_get_alt_name(gnutls_x509_crt_t client_cert, + int nametype, + unsigned int index) +{ + char* buf; + size_t lbuf; + unsigned int seq; + unsigned int subseq; + unsigned int type; + int result; + + subseq = 0; + for (seq=0;;seq++) + { + lbuf = 0; + result = gnutls_x509_crt_get_subject_alt_name2(client_cert, seq, NULL, &lbuf, + &type, NULL); + if (result == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) + return NULL; + if (nametype != (int) type) + continue; + if (subseq == index) + break; + subseq++; + } + buf = malloc(lbuf); + if (buf == NULL) + { + fprintf (stderr, + "Failed to allocate memory for certificate alt name\n"); + return NULL; + } + result = gnutls_x509_crt_get_subject_alt_name2(client_cert, + seq, + buf, + &lbuf, + NULL, NULL); + if (result != nametype) + { + fprintf (stderr, + "Unexpected return value from gnutls: %d\n", + result); + free (buf); + return NULL; + } + return buf; +} +@end verbatim + +Finally, you should release the memory associated with the client +certificate: + +@verbatim +gnutls_x509_crt_deinit (client_cert); +@end verbatim + + + +@heading Using TLS Server Name Indication (SNI) + +SNI enables hosting multiple domains under one IP address with TLS. So +SNI is the TLS-equivalent of virtual hosting. To use SNI with MHD, you +need at least GnuTLS 3.0. The main change compared to the simple hosting +of one domain is that you need to provide a callback instead of the key +and certificate. For example, when you start the MHD daemon, you could +do this: +@verbatim + daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_SSL, + PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_HTTPS_CERT_CALLBACK, &sni_callback, + MHD_OPTION_END); +@end verbatim +Here, @code{sni_callback} is the name of a function that you will have to +implement to retrieve the X.509 certificate for an incoming connection. +The callback has type @code{gnutls_certificate_retrieve_function2} and +is documented in the GnuTLS API for the @code{gnutls_certificate_set_retrieve_function2} +as follows: + +@deftypefn {Function Pointer} int {*gnutls_certificate_retrieve_function2} (gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_pcert_st** pcert, unsigned int *pcert_length, gnutls_privkey_t * pkey) + +@table @var +@item req_ca_cert +is only used in X.509 certificates. Contains a list with the CA names that the server considers trusted. Normally we should send a certificate that is signed by one of these CAs. These names are DER encoded. To get a more meaningful value use the function @code{gnutls_x509_rdn_get()}. + +@item pk_algos +contains a list with server’s acceptable signature algorithms. The certificate returned should support the server’s given algorithms. + +@item pcert +should contain a single certificate and public or a list of them. + +@item pcert_length +is the size of the previous list. + +@item pkey +is the private key. +@end table +@end deftypefn + +A possible implementation of this callback would look like this: + +@verbatim +struct Hosts +{ + struct Hosts *next; + const char *hostname; + gnutls_pcert_st pcrt; + gnutls_privkey_t key; +}; + +static struct Hosts *hosts; + +int +sni_callback (gnutls_session_t session, + const gnutls_datum_t* req_ca_dn, + int nreqs, + const gnutls_pk_algorithm_t* pk_algos, + int pk_algos_length, + gnutls_pcert_st** pcert, + unsigned int *pcert_length, + gnutls_privkey_t * pkey) +{ + char name[256]; + size_t name_len; + struct Hosts *host; + unsigned int type; + + name_len = sizeof (name); + if (GNUTLS_E_SUCCESS != + gnutls_server_name_get (session, + name, + &name_len, + &type, + 0 /* index */)) + return -1; + for (host = hosts; NULL != host; host = host->next) + if (0 == strncmp (name, host->hostname, name_len)) + break; + if (NULL == host) + { + fprintf (stderr, + "Need certificate for %.*s\n", + (int) name_len, + name); + return -1; + } + fprintf (stderr, + "Returning certificate for %.*s\n", + (int) name_len, + name); + *pkey = host->key; + *pcert_length = 1; + *pcert = &host->pcrt; + return 0; +} +@end verbatim + +Note that MHD cannot offer passing a closure or any other additional information +to this callback, as the GnuTLS API unfortunately does not permit this at this +point. + +The @code{hosts} list can be initialized by loading the private keys and X.509 +certificats from disk as follows: + +@verbatim +static void +load_keys(const char *hostname, + const char *CERT_FILE, + const char *KEY_FILE) +{ + int ret; + gnutls_datum_t data; + struct Hosts *host; + + host = malloc (sizeof (struct Hosts)); + host->hostname = hostname; + host->next = hosts; + hosts = host; + + ret = gnutls_load_file (CERT_FILE, &data); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading certificate file %s.\n", + CERT_FILE); + exit(1); + } + ret = + gnutls_pcert_import_x509_raw (&host->pcrt, &data, GNUTLS_X509_FMT_PEM, + 0); + if (ret < 0) + { + fprintf(stderr, + "*** Error loading certificate file: %s\n", + gnutls_strerror (ret)); + exit(1); + } + gnutls_free (data.data); + + ret = gnutls_load_file (KEY_FILE, &data); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading key file %s.\n", + KEY_FILE); + exit(1); + } + + gnutls_privkey_init (&host->key); + ret = + gnutls_privkey_import_x509_raw (host->key, + &data, GNUTLS_X509_FMT_PEM, + NULL, 0); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading key file: %s\n", + gnutls_strerror (ret)); + exit(1); + } + gnutls_free (data.data); +} +@end verbatim + +The code above was largely lifted from GnuTLS. You can find other +methods for initializing certificates and keys in the GnuTLS manual +and source code. diff --git a/doc/doxygen/Makefile.am b/doc/doxygen/Makefile.am new file mode 100644 index 0000000..6f132dd --- /dev/null +++ b/doc/doxygen/Makefile.am @@ -0,0 +1,18 @@ +# This Makefile.am is in the public domain +all: + @echo -e \ +"Generate documentation:\n" \ +"\tmake full - full documentation with dependency graphs (slow)\n" \ +"\tmake fast - fast mode without dependency graphs" + +full: libmicrohttpd.doxy + doxygen $< + +fast: libmicrohttpd.doxy + sed 's/\(HAVE_DOT.*=\).*/\1 NO/' $< | doxygen - + +clean: + rm -rf html + + +EXTRA_DIST = libmicrohttpd.doxy diff --git a/doc/doxygen/Makefile.in b/doc/doxygen/Makefile.in new file mode 100644 index 0000000..60d9f30 --- /dev/null +++ b/doc/doxygen/Makefile.in @@ -0,0 +1,510 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +subdir = doc/doxygen +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = libmicrohttpd.doxy +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/libmicrohttpd.doxy.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = libmicrohttpd.doxy +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/doxygen/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/doxygen/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +libmicrohttpd.doxy: $(top_builddir)/config.status $(srcdir)/libmicrohttpd.doxy.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# This Makefile.am is in the public domain +all: + @echo -e \ +"Generate documentation:\n" \ +"\tmake full - full documentation with dependency graphs (slow)\n" \ +"\tmake fast - fast mode without dependency graphs" + +full: libmicrohttpd.doxy + doxygen $< + +fast: libmicrohttpd.doxy + sed 's/\(HAVE_DOT.*=\).*/\1 NO/' $< | doxygen - + +clean: + rm -rf html + +# 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: diff --git a/doc/doxygen/libmicrohttpd.doxy b/doc/doxygen/libmicrohttpd.doxy new file mode 100644 index 0000000..e9ef7f3 --- /dev/null +++ b/doc/doxygen/libmicrohttpd.doxy @@ -0,0 +1,2464 @@ +# Doxyfile 1.8.13 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "GNU libmicrohttpd" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = 0.9.59 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = . + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = YES + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = ../.. + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = ../../src/include \ + src/include + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = NO + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = NO + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = NO + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = NO + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = NO + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= NO + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = ../.. + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = *.c \ + *.h + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = */test_* \ + */.svn/* \ + */perf_* \ + */tls_test_* \ + */examples/* \ + */testcurl/* \ + */testzzuf/* \ + */platform/* \ + */symbian/* \ + MHD_config.h \ + microhttpd2.h + + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = MHD_DLOG + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /
' consisting of one row and 'n' columns whose + fields contain small images of either a red or a green light. + + +File: libmicrohttpd-tutorial.info, Node: Supporting basic authentication, Next: Processing POST data, Prev: Response headers, Up: Top + +5 Supporting basic authentication +********************************* + +With the small exception of IP address based access control, requests +from all connecting clients where served equally until now. This +chapter discusses a first method of client's authentication and its +limits. + + A very simple approach feasible with the means already discussed +would be to expect the password in the _URI_ string before granting +access to the secured areas. The password could be separated from the +actual resource identifier by a certain character, thus the request line +might look like +GET /picture.png?mypassword + + In the rare situation where the client is customized enough and the +connection occurs through secured lines (e.g., a embedded device +directly attached to another via wire) and where the ability to embedd a +password in the URI or to pass on a URI with a password are desired, +this can be a reasonable choice. + + But when it is assumed that the user connecting does so with an +ordinary Internet browser, this implementation brings some problems +about. For example, the URI including the password stays in the address +field or at least in the history of the browser for anybody near enough +to see. It will also be inconvenient to add the password manually to +any new URI when the browser does not know how to compose this +automatically. + + At least the convenience issue can be addressed by employing the +simplest built-in password facilities of HTTP compliant browsers, hence +we want to start there. It will however turn out to have still severe +weaknesses in terms of security which need consideration. + + Before we will start implementing _Basic Authentication_ as described +in _RFC 2617_, we should finally abandon the bad practice of responding +every request the first time our callback is called for a given +connection. This is becoming more important now because the client and +the server will have to talk in a more bi-directional way than before to + + But how can we tell whether the callback has been called before for +the particular connection? Initially, the pointer this parameter +references is set by _MHD_ in the callback. But it will also be +"remembered" on the next call (for the same connection). Thus, we will +generate no response until the parameter is non-null--implying the +callback was called before at least once. We do not need to share +information between different calls of the callback, so we can set the +parameter to any adress that is assured to be not null. The pointer to +the 'connection' structure will be pointing to a legal address, so we +take this. + + The first time 'answer_to_connection' is called, we will not even +look at the headers. + +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, const char *version, + const char *upload_data, size_t *upload_data_size, + void **con_cls) +{ + if (0 != strcmp(method, "GET")) return MHD_NO; + if (NULL == *con_cls) {*con_cls = connection; return MHD_YES;} + + ... + /* else respond accordingly */ + ... +} + + Note how we lop off the connection on the first condition (no "GET" +request), but return asking for more on the other one with 'MHD_YES'. +With this minor change, we can proceed to implement the actual +authentication process. + +Request for authentication +========================== + +Let us assume we had only files not intended to be handed out without +the correct username/password, so every "GET" request will be +challenged. _RFC 2617_ describes how the server shall ask for +authentication by adding a _WWW-Authenticate_ response header with the +name of the _realm_ protected. MHD can generate and queue such a +failure response for you using the 'MHD_queue_basic_auth_fail_response' +API. The only thing you need to do is construct a response with the +error page to be shown to the user if he aborts basic authentication. +But first, you should check if the proper credentials were already +supplied using the 'MHD_basic_auth_get_username_password' call. + + Your code would then look like this: +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + char *user; + char *pass; + int fail; + struct MHD_Response *response; + + if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) + return MHD_NO; + if (NULL == *con_cls) + { + *con_cls = connection; + return MHD_YES; + } + pass = NULL; + user = MHD_basic_auth_get_username_password (connection, &pass); + fail = ( (user == NULL) || + (0 != strcmp (user, "root")) || + (0 != strcmp (pass, "pa$$w0rd") ) ); + if (user != NULL) free (user); + if (pass != NULL) free (pass); + if (fail) + { + const char *page = "Go away."; + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_basic_auth_fail_response (connection, + "my realm", + response); + } + else + { + const char *page = "A secret."; + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + } + MHD_destroy_response (response); + return ret; +} + + See the 'examples' directory for the complete example file. + +Remarks +======= + +For a proper server, the conditional statements leading to a return of +'MHD_NO' should yield a response with a more precise status code instead +of silently closing the connection. For example, failures of memory +allocation are best reported as _internal server error_ and unexpected +authentication methods as _400 bad request_. + +Exercises +========= + + * Make the server respond to wrong credentials (but otherwise + well-formed requests) with the recommended _401 unauthorized_ + status code. If the client still does not authenticate correctly + within the same connection, close it and store the client's IP + address for a certain time. (It is OK to check for expiration not + until the main thread wakes up again on the next connection.) If + the client fails authenticating three times during this period, add + it to another list for which the 'AcceptPolicyCallback' function + denies connection (temporally). + + * With the network utility 'netcat' connect and log the response of a + "GET" request as you did in the exercise of the first example, this + time to a file. Now stop the server and let _netcat_ listen on the + same port the server used to listen on and have it fake being the + proper server by giving the file's content as the response (e.g. + 'cat log | nc -l -p 8888'). Pretending to think your were + connecting to the actual server, browse to the eavesdropper and + give the correct credentials. + + Copy and paste the encoded string you see in 'netcat''s output to + some of the Base64 decode tools available online and see how both + the user's name and password could be completely restored. + + +File: libmicrohttpd-tutorial.info, Node: Processing POST data, Next: Improved processing of POST data, Prev: Supporting basic authentication, Up: Top + +6 Processing POST data +********************** + +The previous chapters already have demonstrated a variety of +possibilities to send information to the HTTP server, but it is not +recommended that the _GET_ method is used to alter the way the server +operates. To induce changes on the server, the _POST_ method is +preferred over and is much more powerful than _GET_ and will be +introduced in this chapter. + + We are going to write an application that asks for the visitor's name +and, after the user has posted it, composes an individual response text. +Even though it was not mandatory to use the _POST_ method here, as there +is no permanent change caused by the POST, it is an illustrative example +on how to share data between different functions for the same +connection. Furthermore, the reader should be able to extend it easily. + +GET request +=========== + +When the first _GET_ request arrives, the server shall respond with a +HTML page containing an edit field for the name. + +const char* askpage = "\ + What's your name, Sir?
\ + \ + \ + "; + + The 'action' entry is the _URI_ to be called by the browser when +posting, and the 'name' will be used later to be sure it is the +editbox's content that has been posted. + + We also prepare the answer page, where the name is to be filled in +later, and an error page as the response for anything but proper _GET_ +and _POST_ requests: + +const char* greatingpage="

Welcome, %s!

"; + +const char* errorpage="This doesn't seem to be right."; + + Whenever we need to send a page, we use an extra function 'int +send_page(struct MHD_Connection *connection, const char* page)' for +this, which does not contain anything new and whose implementation is +therefore not discussed further in the tutorial. + +POST request +============ + +Posted data can be of arbitrary and considerable size; for example, if a +user uploads a big image to the server. Similar to the case of the +header fields, there may also be different streams of posted data, such +as one containing the text of an editbox and another the state of a +button. Likewise, we will have to register an iterator function that is +going to be called maybe several times not only if there are different +POSTs but also if one POST has only been received partly yet and needs +processing before another chunk can be received. + + Such an iterator function is called by a _postprocessor_, which must +be created upon arriving of the post request. We want the iterator +function to read the first post data which is tagged 'name' and to +create an individual greeting string based on the template and the name. +But in order to pass this string to other functions and still be able to +differentiate different connections, we must first define a structure to +share the information, holding the most import entries. + +struct connection_info_struct +{ + int connectiontype; + char *answerstring; + struct MHD_PostProcessor *postprocessor; +}; + + With these information available to the iterator function, it is able +to fulfill its task. Once it has composed the greeting string, it +returns 'MHD_NO' to inform the post processor that it does not need to +be called again. Note that this function does not handle processing of +data for the same 'key'. If we were to expect that the name will be +posted in several chunks, we had to expand the namestring dynamically as +additional parts of it with the same 'key' came in. But in this +example, the name is assumed to fit entirely inside one single packet. + +static int +iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, + const char *filename, const char *content_type, + const char *transfer_encoding, const char *data, + uint64_t off, size_t size) +{ + struct connection_info_struct *con_info = coninfo_cls; + + if (0 == strcmp (key, "name")) + { + if ((size > 0) && (size <= MAXNAMESIZE)) + { + char *answerstring; + answerstring = malloc (MAXANSWERSIZE); + if (!answerstring) return MHD_NO; + + snprintf (answerstring, MAXANSWERSIZE, greatingpage, data); + con_info->answerstring = answerstring; + } + else con_info->answerstring = NULL; + + return MHD_NO; + } + + return MHD_YES; +} + + Once a connection has been established, it can be terminated for many +reasons. As these reasons include unexpected events, we have to +register another function that cleans up any resources that might have +been allocated for that connection by us, namely the post processor and +the greetings string. This cleanup function must take into account that +it will also be called for finished requests other than _POST_ requests. + +void request_completed (void *cls, struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct connection_info_struct *con_info = *con_cls; + + if (NULL == con_info) return; + if (con_info->connectiontype == POST) + { + MHD_destroy_post_processor (con_info->postprocessor); + if (con_info->answerstring) free (con_info->answerstring); + } + + free (con_info); + *con_cls = NULL; +} + + _GNU libmicrohttpd_ is informed that it shall call the above function +when the daemon is started in the main function. + +... +daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &request_completed, NULL, + MHD_OPTION_END); +... + +Request handling +================ + +With all other functions prepared, we can now discuss the actual request +handling. + + On the first iteration for a new request, we start by allocating a +new instance of a 'struct connection_info_struct' structure, which will +store all necessary information for later iterations and other +functions. + +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, + const char *method, const char *version, + const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + if(NULL == *con_cls) + { + struct connection_info_struct *con_info; + + con_info = malloc (sizeof (struct connection_info_struct)); + if (NULL == con_info) return MHD_NO; + con_info->answerstring = NULL; + + If the new request is a _POST_, the postprocessor must be created +now. In addition, the type of the request is stored for convenience. + if (0 == strcmp (method, "POST")) + { + con_info->postprocessor + = MHD_create_post_processor (connection, POSTBUFFERSIZE, + iterate_post, (void*) con_info); + + if (NULL == con_info->postprocessor) + { + free (con_info); + return MHD_NO; + } + con_info->connectiontype = POST; + } + else con_info->connectiontype = GET; + + The address of our structure will both serve as the indicator for +successive iterations and to remember the particular details about the +connection. + *con_cls = (void*) con_info; + return MHD_YES; + } + + The rest of the function will not be executed on the first iteration. +A _GET_ request is easily satisfied by sending the question form. + if (0 == strcmp (method, "GET")) + { + return send_page (connection, askpage); + } + + In case of _POST_, we invoke the post processor for as long as data +keeps incoming, setting '*upload_data_size' to zero in order to indicate +that we have processed--or at least have considered--all of it. + if (0 == strcmp (method, "POST")) + { + struct connection_info_struct *con_info = *con_cls; + + if (*upload_data_size != 0) + { + MHD_post_process (con_info->postprocessor, upload_data, + *upload_data_size); + *upload_data_size = 0; + + return MHD_YES; + } + else if (NULL != con_info->answerstring) + return send_page (connection, con_info->answerstring); + } + + Finally, if they are neither _GET_ nor _POST_ requests, the error +page is returned. + return send_page(connection, errorpage); +} + + These were the important parts of the program 'simplepost.c'. + + +File: libmicrohttpd-tutorial.info, Node: Improved processing of POST data, Next: Session management, Prev: Processing POST data, Up: Top + +7 Improved processing of POST data +********************************** + +The previous chapter introduced a way to upload data to the server, but +the developed example program has some shortcomings, such as not being +able to handle larger chunks of data. In this chapter, we are going to +discuss a more advanced server program that allows clients to upload a +file in order to have it stored on the server's filesystem. The server +shall also watch and limit the number of clients concurrently uploading, +responding with a proper busy message if necessary. + +Prepared answers +================ + +We choose to operate the server with the 'SELECT_INTERNALLY' method. +This makes it easier to synchronize the global states at the cost of +possible delays for other connections if the processing of a request is +too slow. One of these variables that needs to be shared for all +connections is the total number of clients that are uploading. + +#define MAXCLIENTS 2 +static unsigned int nr_of_uploading_clients = 0; + + If there are too many clients uploading, we want the server to +respond to all requests with a busy message. +const char* busypage = + "This server is busy, please try again later."; + + Otherwise, the server will send a _form_ that informs the user of the +current number of uploading clients, and ask her to pick a file on her +local filesystem which is to be uploaded. +const char* askpage = "\n\ + Upload a file, please!
\n\ + There are %u clients uploading at the moment.
\n\ + \n\ + \n\ + \n\ + "; + + If the upload has succeeded, the server will respond with a message +saying so. +const char* completepage = "The upload has been completed."; + + We want the server to report internal errors, such as memory shortage +or file access problems, adequately. +const char* servererrorpage + = "An internal server error has occured."; +const char* fileexistspage + = "This file already exists."; + + It would be tolerable to send all these responses undifferentiated +with a '200 HTTP_OK' status code but in order to improve the 'HTTP' +conformance of our server a bit, we extend the 'send_page' function so +that it accepts individual status codes. + +static int +send_page (struct MHD_Connection *connection, + const char* page, int status_code) +{ + int ret; + struct MHD_Response *response; + + response = MHD_create_response_from_buffer (strlen (page), (void*) page, + MHD_RESPMEM_MUST_COPY); + if (!response) return MHD_NO; + + ret = MHD_queue_response (connection, status_code, response); + MHD_destroy_response (response); + + return ret; +} + + Note how we ask _MHD_ to make its own copy of the message data. The +reason behind this will become clear later. + +Connection cycle +================ + +The decision whether the server is busy or not is made right at the +beginning of the connection. To do that at this stage is especially +important for _POST_ requests because if no response is queued at this +point, and 'MHD_YES' returned, _MHD_ will not sent any queued messages +until a postprocessor has been created and the post iterator is called +at least once. + +static int +answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, + const char *method, const char *version, + const char *upload_data, + size_t *upload_data_size, void **con_cls) +{ + if (NULL == *con_cls) + { + struct connection_info_struct *con_info; + + if (nr_of_uploading_clients >= MAXCLIENTS) + return send_page(connection, busypage, MHD_HTTP_SERVICE_UNAVAILABLE); + + If the server is not busy, the 'connection_info' structure is +initialized as usual, with the addition of a filepointer for each +connection. + + con_info = malloc (sizeof (struct connection_info_struct)); + if (NULL == con_info) return MHD_NO; + con_info->fp = 0; + + if (0 == strcmp (method, "POST")) + { + ... + } + else con_info->connectiontype = GET; + + *con_cls = (void*) con_info; + + return MHD_YES; + } + + For _POST_ requests, the postprocessor is created and we register a +new uploading client. From this point on, there are many possible +places for errors to occur that make it necessary to interrupt the +uploading process. We need a means of having the proper response +message ready at all times. Therefore, the 'connection_info' structure +is extended to hold the most current response message so that whenever a +response is sent, the client will get the most informative message. +Here, the structure is initialized to "no error". + if (0 == strcmp (method, "POST")) + { + con_info->postprocessor + = MHD_create_post_processor (connection, POSTBUFFERSIZE, + iterate_post, (void*) con_info); + + if (NULL == con_info->postprocessor) + { + free (con_info); + return MHD_NO; + } + + nr_of_uploading_clients++; + + con_info->connectiontype = POST; + con_info->answercode = MHD_HTTP_OK; + con_info->answerstring = completepage; + } + else con_info->connectiontype = GET; + + If the connection handler is called for the second time, _GET_ +requests will be answered with the _form_. We can keep the buffer under +function scope, because we asked _MHD_ to make its own copy of it for as +long as it is needed. + if (0 == strcmp (method, "GET")) + { + int ret; + char buffer[1024]; + + sprintf (buffer, askpage, nr_of_uploading_clients); + return send_page (connection, buffer, MHD_HTTP_OK); + } + + The rest of the 'answer_to_connection' function is very similar to +the 'simplepost.c' example, except the more flexible content of the +responses. The _POST_ data is processed until there is none left and +the execution falls through to return an error page if the connection +constituted no expected request method. + if (0 == strcmp (method, "POST")) + { + struct connection_info_struct *con_info = *con_cls; + + if (0 != *upload_data_size) + { + MHD_post_process (con_info->postprocessor, + upload_data, *upload_data_size); + *upload_data_size = 0; + + return MHD_YES; + } + else + return send_page (connection, con_info->answerstring, + con_info->answercode); + } + + return send_page(connection, errorpage, MHD_HTTP_BAD_REQUEST); +} + +Storing to data +=============== + +Unlike the 'simplepost.c' example, here it is to be expected that post +iterator will be called several times now. This means that for any +given connection (there might be several concurrent of them) the posted +data has to be written to the correct file. That is why we store a file +handle in every 'connection_info', so that the it is preserved between +successive iterations. +static int +iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, + const char *key, + const char *filename, const char *content_type, + const char *transfer_encoding, const char *data, + uint64_t off, size_t size) +{ + struct connection_info_struct *con_info = coninfo_cls; + + Because the following actions depend heavily on correct file +processing, which might be error prone, we default to reporting internal +errors in case anything will go wrong. + +con_info->answerstring = servererrorpage; +con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR; + + In the "askpage" _form_, we told the client to label its post data +with the "file" key. Anything else would be an error. + + if (0 != strcmp (key, "file")) return MHD_NO; + + If the iterator is called for the first time, no file will have been +opened yet. The 'filename' string contains the name of the file +(without any paths) the user selected on his system. We want to take +this as the name the file will be stored on the server and make sure no +file of that name exists (or is being uploaded) before we create one +(note that the code below technically contains a race between the two +"fopen" calls, but we will overlook this for portability sake). + if (!con_info->fp) + { + if (NULL != (fp = fopen (filename, "rb")) ) + { + fclose (fp); + con_info->answerstring = fileexistspage; + con_info->answercode = MHD_HTTP_FORBIDDEN; + return MHD_NO; + } + + con_info->fp = fopen (filename, "ab"); + if (!con_info->fp) return MHD_NO; + } + + Occasionally, the iterator function will be called even when there +are 0 new bytes to process. The server only needs to write data to the +file if there is some. +if (size > 0) + { + if (!fwrite (data, size, sizeof(char), con_info->fp)) + return MHD_NO; + } + + If this point has been reached, everything worked well for this +iteration and the response can be set to success again. If the upload +has finished, this iterator function will not be called again. + con_info->answerstring = completepage; + con_info->answercode = MHD_HTTP_OK; + + return MHD_YES; +} + + The new client was registered when the postprocessor was created. +Likewise, we unregister the client on destroying the postprocessor when +the request is completed. +void request_completed (void *cls, struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct connection_info_struct *con_info = *con_cls; + + if (NULL == con_info) return; + + if (con_info->connectiontype == POST) + { + if (NULL != con_info->postprocessor) + { + MHD_destroy_post_processor (con_info->postprocessor); + nr_of_uploading_clients--; + } + + if (con_info->fp) fclose (con_info->fp); + } + + free (con_info); + *con_cls = NULL; +} + + This is essentially the whole example 'largepost.c'. + +Remarks +======= + +Now that the clients are able to create files on the server, security +aspects are becoming even more important than before. Aside from proper +client authentication, the server should always make sure explicitly +that no files will be created outside of a dedicated upload directory. +In particular, filenames must be checked to not contain strings like +"../". + + +File: libmicrohttpd-tutorial.info, Node: Session management, Next: Adding a layer of security, Prev: Improved processing of POST data, Up: Top + +8 Session management +******************** + +This chapter discusses how one should manage sessions, that is, share +state between multiple HTTP requests from the same user. We use a +simple example where the user submits multiple forms and the server is +supposed to accumulate state from all of these forms. Naturally, as +this is a network protocol, our session mechanism must support having +many users with many concurrent sessions at the same time. + + In order to track users, we use a simple session cookie. A session +cookie expires when the user closes the browser. Changing from session +cookies to persistent cookies only requires adding an expiration time to +the cookie. The server creates a fresh session cookie whenever a +request without a cookie is received, or if the supplied session cookie +is not known to the server. + +Looking up the cookie +===================== + +Since MHD parses the HTTP cookie header for us, looking up an existing +cookie is straightforward: + +const char *value; + +value = MHD_lookup_connection_value (connection, + MHD_COOKIE_KIND, + "KEY"); + + Here, "KEY" is the name we chose for our session cookie. + +Setting the cookie header +========================= + +MHD requires the user to provide the full cookie format string in order +to set cookies. In order to generate a unique cookie, our example +creates a random 64-character text string to be used as the value of the +cookie: + +char value[128]; +char raw_value[65]; + +for (unsigned int i=0;i openssl genrsa -out server.key 1024 + + In addition to the key, a certificate describing the server in human +readable tokens is also needed. This certificate will be attested with +our aforementioned key. In this way, we obtain a self-signed +certificate, valid for one year. + +> openssl req -days 365 -out server.pem -new -x509 -key server.key + + To avoid unnecessary error messages in the browser, the certificate +needs to have a name that matches the _URI_, for example, "localhost" or +the domain. If you plan to have a publicly reachable server, you will +need to ask a trusted third party, called _Certificate Authority_, or +_CA_, to attest the certificate for you. This way, any visitor can make +sure the server's identity is real. + + Whether the server's certificate is signed by us or a third party, +once it has been accepted by the client, both sides will be +communicating over encrypted channels. From this point on, it is the +client's turn to authenticate itself. But this has already been +implemented in the basic authentication scheme. + +Changing the source code +======================== + +We merely have to extend the server program so that it loads the two +files into memory, + +int +main () +{ + struct MHD_Daemon *daemon; + char *key_pem; + char *cert_pem; + + key_pem = load_file (SERVERKEYFILE); + cert_pem = load_file (SERVERCERTFILE); + + if ((key_pem == NULL) || (cert_pem == NULL)) + { + printf ("The key/certificate files could not be read.\n"); + return 1; + } + + and then we point the _MHD_ daemon to it upon initalization. + + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL, + PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_HTTPS_MEM_KEY, key_pem, + MHD_OPTION_HTTPS_MEM_CERT, cert_pem, + MHD_OPTION_END); + + if (NULL == daemon) + { + printf ("%s\n", cert_pem); + + free (key_pem); + free (cert_pem); + + return 1; + } + + The rest consists of little new besides some additional memory +cleanups. + + getchar (); + + MHD_stop_daemon (daemon); + free (key_pem); + free (cert_pem); + + return 0; +} + + The rather unexciting file loader can be found in the complete +example 'tlsauthentication.c'. + +Remarks +======= + + * While the standard _HTTP_ port is 80, it is 443 for _HTTPS_. The + common internet browsers assume standard _HTTP_ if they are asked + to access other ports than these. Therefore, you will have to type + 'https://localhost:8888' explicitly when you test the example, or + the browser will not know how to handle the answer properly. + + * The remaining weak point is the question how the server will be + trusted initially. Either a _CA_ signs the certificate or the + client obtains the key over secure means. Anyway, the clients have + to be aware (or configured) that they should not accept + certificates of unknown origin. + + * The introduced method of certificates makes it mandatory to set an + expiration date--making it less feasible to hardcode certificates + in embedded devices. + + * The cryptographic facilities consume memory space and computing + time. For this reason, websites usually consists both of + uncritically _HTTP_ parts and secured _HTTPS_. + +Client authentication +===================== + +You can also use MHD to authenticate the client via SSL/TLS certificates +(as an alternative to using the password-based Basic or Digest +authentication). To do this, you will need to link your application +against _gnutls_. Next, when you start the MHD daemon, you must specify +the root CA that you're willing to trust: + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL, + PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_HTTPS_MEM_KEY, key_pem, + MHD_OPTION_HTTPS_MEM_CERT, cert_pem, + MHD_OPTION_HTTPS_MEM_TRUST, root_ca_pem, + MHD_OPTION_END); + + With this, you can then obtain client certificates for each session. +In order to obtain the identity of the client, you first need to obtain +the raw GnuTLS session handle from _MHD_ using +'MHD_get_connection_info'. + +#include +#include + +gnutls_session_t tls_session; +union MHD_ConnectionInfo *ci; + +ci = MHD_get_connection_info (connection, + MHD_CONNECTION_INFO_GNUTLS_SESSION); +tls_session = ci->tls_session; + + You can then extract the client certificate: + +/** + * Get the client's certificate + * + * @param tls_session the TLS session + * @return NULL if no valid client certificate could be found, a pointer + * to the certificate if found + */ +static gnutls_x509_crt_t +get_client_certificate (gnutls_session_t tls_session) +{ + unsigned int listsize; + const gnutls_datum_t * pcert; + gnutls_certificate_status_t client_cert_status; + gnutls_x509_crt_t client_cert; + + if (tls_session == NULL) + return NULL; + if (gnutls_certificate_verify_peers2(tls_session, + &client_cert_status)) + return NULL; + pcert = gnutls_certificate_get_peers(tls_session, + &listsize); + if ( (pcert == NULL) || + (listsize == 0)) + { + fprintf (stderr, + "Failed to retrieve client certificate chain\n"); + return NULL; + } + if (gnutls_x509_crt_init(&client_cert)) + { + fprintf (stderr, + "Failed to initialize client certificate\n"); + return NULL; + } + /* Note that by passing values between 0 and listsize here, you + can get access to the CA's certs */ + if (gnutls_x509_crt_import(client_cert, + &pcert[0], + GNUTLS_X509_FMT_DER)) + { + fprintf (stderr, + "Failed to import client certificate\n"); + gnutls_x509_crt_deinit(client_cert); + return NULL; + } + return client_cert; +} + + Using the client certificate, you can then get the client's +distinguished name and alternative names: + +/** + * Get the distinguished name from the client's certificate + * + * @param client_cert the client certificate + * @return NULL if no dn or certificate could be found, a pointer + * to the dn if found + */ +char * +cert_auth_get_dn(gnutls_x509_crt_c client_cert) +{ + char* buf; + size_t lbuf; + + lbuf = 0; + gnutls_x509_crt_get_dn(client_cert, NULL, &lbuf); + buf = malloc(lbuf); + if (buf == NULL) + { + fprintf (stderr, + "Failed to allocate memory for certificate dn\n"); + return NULL; + } + gnutls_x509_crt_get_dn(client_cert, buf, &lbuf); + return buf; +} + + +/** + * Get the alternative name of specified type from the client's certificate + * + * @param client_cert the client certificate + * @param nametype The requested name type + * @param index The position of the alternative name if multiple names are + * matching the requested type, 0 for the first matching name + * @return NULL if no matching alternative name could be found, a pointer + * to the alternative name if found + */ +char * +MHD_cert_auth_get_alt_name(gnutls_x509_crt_t client_cert, + int nametype, + unsigned int index) +{ + char* buf; + size_t lbuf; + unsigned int seq; + unsigned int subseq; + unsigned int type; + int result; + + subseq = 0; + for (seq=0;;seq++) + { + lbuf = 0; + result = gnutls_x509_crt_get_subject_alt_name2(client_cert, seq, NULL, &lbuf, + &type, NULL); + if (result == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) + return NULL; + if (nametype != (int) type) + continue; + if (subseq == index) + break; + subseq++; + } + buf = malloc(lbuf); + if (buf == NULL) + { + fprintf (stderr, + "Failed to allocate memory for certificate alt name\n"); + return NULL; + } + result = gnutls_x509_crt_get_subject_alt_name2(client_cert, + seq, + buf, + &lbuf, + NULL, NULL); + if (result != nametype) + { + fprintf (stderr, + "Unexpected return value from gnutls: %d\n", + result); + free (buf); + return NULL; + } + return buf; +} + + Finally, you should release the memory associated with the client +certificate: + +gnutls_x509_crt_deinit (client_cert); + +Using TLS Server Name Indication (SNI) +====================================== + +SNI enables hosting multiple domains under one IP address with TLS. So +SNI is the TLS-equivalent of virtual hosting. To use SNI with MHD, you +need at least GnuTLS 3.0. The main change compared to the simple +hosting of one domain is that you need to provide a callback instead of +the key and certificate. For example, when you start the MHD daemon, +you could do this: + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL, + PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_HTTPS_CERT_CALLBACK, &sni_callback, + MHD_OPTION_END); + Here, 'sni_callback' is the name of a function that you will have to +implement to retrieve the X.509 certificate for an incoming connection. +The callback has type 'gnutls_certificate_retrieve_function2' and is +documented in the GnuTLS API for the +'gnutls_certificate_set_retrieve_function2' as follows: + + -- Function Pointer: int *gnutls_certificate_retrieve_function2 + (gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, + const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, + gnutls_pcert_st** pcert, unsigned int *pcert_length, + gnutls_privkey_t * pkey) + + REQ_CA_CERT + is only used in X.509 certificates. Contains a list with the + CA names that the server considers trusted. Normally we + should send a certificate that is signed by one of these CAs. + These names are DER encoded. To get a more meaningful value + use the function 'gnutls_x509_rdn_get()'. + + PK_ALGOS + contains a list with server’s acceptable signature algorithms. + The certificate returned should support the server’s given + algorithms. + + PCERT + should contain a single certificate and public or a list of + them. + + PCERT_LENGTH + is the size of the previous list. + + PKEY + is the private key. + + A possible implementation of this callback would look like this: + +struct Hosts +{ + struct Hosts *next; + const char *hostname; + gnutls_pcert_st pcrt; + gnutls_privkey_t key; +}; + +static struct Hosts *hosts; + +int +sni_callback (gnutls_session_t session, + const gnutls_datum_t* req_ca_dn, + int nreqs, + const gnutls_pk_algorithm_t* pk_algos, + int pk_algos_length, + gnutls_pcert_st** pcert, + unsigned int *pcert_length, + gnutls_privkey_t * pkey) +{ + char name[256]; + size_t name_len; + struct Hosts *host; + unsigned int type; + + name_len = sizeof (name); + if (GNUTLS_E_SUCCESS != + gnutls_server_name_get (session, + name, + &name_len, + &type, + 0 /* index */)) + return -1; + for (host = hosts; NULL != host; host = host->next) + if (0 == strncmp (name, host->hostname, name_len)) + break; + if (NULL == host) + { + fprintf (stderr, + "Need certificate for %.*s\n", + (int) name_len, + name); + return -1; + } + fprintf (stderr, + "Returning certificate for %.*s\n", + (int) name_len, + name); + *pkey = host->key; + *pcert_length = 1; + *pcert = &host->pcrt; + return 0; +} + + Note that MHD cannot offer passing a closure or any other additional +information to this callback, as the GnuTLS API unfortunately does not +permit this at this point. + + The 'hosts' list can be initialized by loading the private keys and +X.509 certificats from disk as follows: + +static void +load_keys(const char *hostname, + const char *CERT_FILE, + const char *KEY_FILE) +{ + int ret; + gnutls_datum_t data; + struct Hosts *host; + + host = malloc (sizeof (struct Hosts)); + host->hostname = hostname; + host->next = hosts; + hosts = host; + + ret = gnutls_load_file (CERT_FILE, &data); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading certificate file %s.\n", + CERT_FILE); + exit(1); + } + ret = + gnutls_pcert_import_x509_raw (&host->pcrt, &data, GNUTLS_X509_FMT_PEM, + 0); + if (ret < 0) + { + fprintf(stderr, + "*** Error loading certificate file: %s\n", + gnutls_strerror (ret)); + exit(1); + } + gnutls_free (data.data); + + ret = gnutls_load_file (KEY_FILE, &data); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading key file %s.\n", + KEY_FILE); + exit(1); + } + + gnutls_privkey_init (&host->key); + ret = + gnutls_privkey_import_x509_raw (host->key, + &data, GNUTLS_X509_FMT_PEM, + NULL, 0); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading key file: %s\n", + gnutls_strerror (ret)); + exit(1); + } + gnutls_free (data.data); +} + + The code above was largely lifted from GnuTLS. You can find other +methods for initializing certificates and keys in the GnuTLS manual and +source code. + + +File: libmicrohttpd-tutorial.info, Node: Bibliography, Next: License text, Prev: Adding a layer of security, Up: Top + +Appendix A Bibliography +*********************** + +API reference +============= + + * The _GNU libmicrohttpd_ manual by Marco Maggi and Christian + Grothoff 2008 + + * All referenced RFCs can be found on the website of _The Internet + Engineering Task Force_ + + * _RFC 2616_: Fielding, R., Gettys, J., Mogul, J., Frystyk, H., and + T. Berners-Lee, "Hypertext Transfer Protocol - HTTP/1.1", RFC 2016, + January 1997. + + * _RFC 2617_: Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, + S., Leach, P., Luotonen, A., and L. Stewart, "HTTP Authentication: + Basic and Digest Access Authentication", RFC 2617, June 1999. + + * A well-structured _HTML_ reference can be found on + + + For those readers understanding German or French, there is an + excellent document both for learning _HTML_ and for reference, + whose English version unfortunately has been discontinued. + and + + +File: libmicrohttpd-tutorial.info, Node: License text, Next: Example programs, Prev: Bibliography, Up: Top + +Appendix B GNU Free Documentation License +***************************************** + + Version 1.3, 3 November 2008 + + Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 0. PREAMBLE + + The purpose of this License is to make a manual, textbook, or other + functional and useful document "free" in the sense of freedom: to + assure everyone the effective freedom to copy and redistribute it, + with or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the + author and publisher a way to get credit for their work, while not + being considered responsible for modifications made by others. + + This License is a kind of "copyleft", which means that derivative + works of the document must themselves be free in the same sense. + It complements the GNU General Public License, which is a copyleft + license designed for free software. + + We have designed this License in order to use it for manuals for + free software, because free software needs free documentation: a + free program should come with manuals providing the same freedoms + that the software does. But this License is not limited to + software manuals; it can be used for any textual work, regardless + of subject matter or whether it is published as a printed book. We + recommend this License principally for works whose purpose is + instruction or reference. + + 1. APPLICABILITY AND DEFINITIONS + + This License applies to any manual or other work, in any medium, + that contains a notice placed by the copyright holder saying it can + be distributed under the terms of this License. Such a notice + grants a world-wide, royalty-free license, unlimited in duration, + to use that work under the conditions stated herein. The + "Document", below, refers to any such manual or work. Any member + of the public is a licensee, and is addressed as "you". You accept + the license if you copy, modify or distribute the work in a way + requiring permission under copyright law. + + A "Modified Version" of the Document means any work containing the + Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. + + A "Secondary Section" is a named appendix or a front-matter section + of the Document that deals exclusively with the relationship of the + publishers or authors of the Document to the Document's overall + subject (or to related matters) and contains nothing that could + fall directly within that overall subject. (Thus, if the Document + is in part a textbook of mathematics, a Secondary Section may not + explain any mathematics.) The relationship could be a matter of + historical connection with the subject or with related matters, or + of legal, commercial, philosophical, ethical or political position + regarding them. + + The "Invariant Sections" are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in the + notice that says that the Document is released under this License. + If a section does not fit the above definition of Secondary then it + is not allowed to be designated as Invariant. The Document may + contain zero Invariant Sections. If the Document does not identify + any Invariant Sections then there are none. + + The "Cover Texts" are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice + that says that the Document is released under this License. A + Front-Cover Text may be at most 5 words, and a Back-Cover Text may + be at most 25 words. + + A "Transparent" copy of the Document means a machine-readable copy, + represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images composed + of pixels) generic paint programs or (for drawings) some widely + available drawing editor, and that is suitable for input to text + formatters or for automatic translation to a variety of formats + suitable for input to text formatters. A copy made in an otherwise + Transparent file format whose markup, or absence of markup, has + been arranged to thwart or discourage subsequent modification by + readers is not Transparent. An image format is not Transparent if + used for any substantial amount of text. A copy that is not + "Transparent" is called "Opaque". + + Examples of suitable formats for Transparent copies include plain + ASCII without markup, Texinfo input format, LaTeX input format, + SGML or XML using a publicly available DTD, and standard-conforming + simple HTML, PostScript or PDF designed for human modification. + Examples of transparent image formats include PNG, XCF and JPG. + Opaque formats include proprietary formats that can be read and + edited only by proprietary word processors, SGML or XML for which + the DTD and/or processing tools are not generally available, and + the machine-generated HTML, PostScript or PDF produced by some word + processors for output purposes only. + + The "Title Page" means, for a printed book, the title page itself, + plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For + works in formats which do not have any title page as such, "Title + Page" means the text near the most prominent appearance of the + work's title, preceding the beginning of the body of the text. + + The "publisher" means any person or entity that distributes copies + of the Document to the public. + + A section "Entitled XYZ" means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ + stands for a specific section name mentioned below, such as + "Acknowledgements", "Dedications", "Endorsements", or "History".) + To "Preserve the Title" of such a section when you modify the + Document means that it remains a section "Entitled XYZ" according + to this definition. + + The Document may include Warranty Disclaimers next to the notice + which states that this License applies to the Document. These + Warranty Disclaimers are considered to be included by reference in + this License, but only as regards disclaiming warranties: any other + implication that these Warranty Disclaimers may have is void and + has no effect on the meaning of this License. + + 2. VERBATIM COPYING + + You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the + copyright notices, and the license notice saying this License + applies to the Document are reproduced in all copies, and that you + add no other conditions whatsoever to those of this License. You + may not use technical measures to obstruct or control the reading + or further copying of the copies you make or distribute. However, + you may accept compensation in exchange for copies. If you + distribute a large enough number of copies you must also follow the + conditions in section 3. + + You may also lend copies, under the same conditions stated above, + and you may publicly display copies. + + 3. COPYING IN QUANTITY + + If you publish printed copies (or copies in media that commonly + have printed covers) of the Document, numbering more than 100, and + the Document's license notice requires Cover Texts, you must + enclose the copies in covers that carry, clearly and legibly, all + these Cover Texts: Front-Cover Texts on the front cover, and + Back-Cover Texts on the back cover. Both covers must also clearly + and legibly identify you as the publisher of these copies. The + front cover must present the full title with all words of the title + equally prominent and visible. You may add other material on the + covers in addition. Copying with changes limited to the covers, as + long as they preserve the title of the Document and satisfy these + conditions, can be treated as verbatim copying in other respects. + + If the required texts for either cover are too voluminous to fit + legibly, you should put the first ones listed (as many as fit + reasonably) on the actual cover, and continue the rest onto + adjacent pages. + + If you publish or distribute Opaque copies of the Document + numbering more than 100, you must either include a machine-readable + Transparent copy along with each Opaque copy, or state in or with + each Opaque copy a computer-network location from which the general + network-using public has access to download using public-standard + network protocols a complete Transparent copy of the Document, free + of added material. If you use the latter option, you must take + reasonably prudent steps, when you begin distribution of Opaque + copies in quantity, to ensure that this Transparent copy will + remain thus accessible at the stated location until at least one + year after the last time you distribute an Opaque copy (directly or + through your agents or retailers) of that edition to the public. + + It is requested, but not required, that you contact the authors of + the Document well before redistributing any large number of copies, + to give them a chance to provide you with an updated version of the + Document. + + 4. MODIFICATIONS + + You may copy and distribute a Modified Version of the Document + under the conditions of sections 2 and 3 above, provided that you + release the Modified Version under precisely this License, with the + Modified Version filling the role of the Document, thus licensing + distribution and modification of the Modified Version to whoever + possesses a copy of it. In addition, you must do these things in + the Modified Version: + + A. Use in the Title Page (and on the covers, if any) a title + distinct from that of the Document, and from those of previous + versions (which should, if there were any, be listed in the + History section of the Document). You may use the same title + as a previous version if the original publisher of that + version gives permission. + + B. List on the Title Page, as authors, one or more persons or + entities responsible for authorship of the modifications in + the Modified Version, together with at least five of the + principal authors of the Document (all of its principal + authors, if it has fewer than five), unless they release you + from this requirement. + + C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. + + D. Preserve all the copyright notices of the Document. + + E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + + F. Include, immediately after the copyright notices, a license + notice giving the public permission to use the Modified + Version under the terms of this License, in the form shown in + the Addendum below. + + G. Preserve in that license notice the full lists of Invariant + Sections and required Cover Texts given in the Document's + license notice. + + H. Include an unaltered copy of this License. + + I. Preserve the section Entitled "History", Preserve its Title, + and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on the + Title Page. If there is no section Entitled "History" in the + Document, create one stating the title, year, authors, and + publisher of the Document as given on its Title Page, then add + an item describing the Modified Version as stated in the + previous sentence. + + J. Preserve the network location, if any, given in the Document + for public access to a Transparent copy of the Document, and + likewise the network locations given in the Document for + previous versions it was based on. These may be placed in the + "History" section. You may omit a network location for a work + that was published at least four years before the Document + itself, or if the original publisher of the version it refers + to gives permission. + + K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section + all the substance and tone of each of the contributor + acknowledgements and/or dedications given therein. + + L. Preserve all the Invariant Sections of the Document, unaltered + in their text and in their titles. Section numbers or the + equivalent are not considered part of the section titles. + + M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. + + N. Do not retitle any existing section to be Entitled + "Endorsements" or to conflict in title with any Invariant + Section. + + O. Preserve any Warranty Disclaimers. + + If the Modified Version includes new front-matter sections or + appendices that qualify as Secondary Sections and contain no + material copied from the Document, you may at your option designate + some or all of these sections as invariant. To do this, add their + titles to the list of Invariant Sections in the Modified Version's + license notice. These titles must be distinct from any other + section titles. + + You may add a section Entitled "Endorsements", provided it contains + nothing but endorsements of your Modified Version by various + parties--for example, statements of peer review or that the text + has been approved by an organization as the authoritative + definition of a standard. + + You may add a passage of up to five words as a Front-Cover Text, + and a passage of up to 25 words as a Back-Cover Text, to the end of + the list of Cover Texts in the Modified Version. Only one passage + of Front-Cover Text and one of Back-Cover Text may be added by (or + through arrangements made by) any one entity. If the Document + already includes a cover text for the same cover, previously added + by you or by arrangement made by the same entity you are acting on + behalf of, you may not add another; but you may replace the old + one, on explicit permission from the previous publisher that added + the old one. + + The author(s) and publisher(s) of the Document do not by this + License give permission to use their names for publicity for or to + assert or imply endorsement of any Modified Version. + + 5. COMBINING DOCUMENTS + + You may combine the Document with other documents released under + this License, under the terms defined in section 4 above for + modified versions, provided that you include in the combination all + of the Invariant Sections of all of the original documents, + unmodified, and list them all as Invariant Sections of your + combined work in its license notice, and that you preserve all + their Warranty Disclaimers. + + The combined work need only contain one copy of this License, and + multiple identical Invariant Sections may be replaced with a single + copy. If there are multiple Invariant Sections with the same name + but different contents, make the title of each such section unique + by adding at the end of it, in parentheses, the name of the + original author or publisher of that section if known, or else a + unique number. Make the same adjustment to the section titles in + the list of Invariant Sections in the license notice of the + combined work. + + In the combination, you must combine any sections Entitled + "History" in the various original documents, forming one section + Entitled "History"; likewise combine any sections Entitled + "Acknowledgements", and any sections Entitled "Dedications". You + must delete all sections Entitled "Endorsements." + + 6. COLLECTIONS OF DOCUMENTS + + You may make a collection consisting of the Document and other + documents released under this License, and replace the individual + copies of this License in the various documents with a single copy + that is included in the collection, provided that you follow the + rules of this License for verbatim copying of each of the documents + in all other respects. + + You may extract a single document from such a collection, and + distribute it individually under this License, provided you insert + a copy of this License into the extracted document, and follow this + License in all other respects regarding verbatim copying of that + document. + + 7. AGGREGATION WITH INDEPENDENT WORKS + + A compilation of the Document or its derivatives with other + separate and independent documents or works, in or on a volume of a + storage or distribution medium, is called an "aggregate" if the + copyright resulting from the compilation is not used to limit the + legal rights of the compilation's users beyond what the individual + works permit. When the Document is included in an aggregate, this + License does not apply to the other works in the aggregate which + are not themselves derivative works of the Document. + + If the Cover Text requirement of section 3 is applicable to these + copies of the Document, then if the Document is less than one half + of the entire aggregate, the Document's Cover Texts may be placed + on covers that bracket the Document within the aggregate, or the + electronic equivalent of covers if the Document is in electronic + form. Otherwise they must appear on printed covers that bracket + the whole aggregate. + + 8. TRANSLATION + + Translation is considered a kind of modification, so you may + distribute translations of the Document under the terms of section + 4. Replacing Invariant Sections with translations requires special + permission from their copyright holders, but you may include + translations of some or all Invariant Sections in addition to the + original versions of these Invariant Sections. You may include a + translation of this License, and all the license notices in the + Document, and any Warranty Disclaimers, provided that you also + include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of + this License or a notice or disclaimer, the original version will + prevail. + + If a section in the Document is Entitled "Acknowledgements", + "Dedications", or "History", the requirement (section 4) to + Preserve its Title (section 1) will typically require changing the + actual title. + + 9. TERMINATION + + You may not copy, modify, sublicense, or distribute the Document + except as expressly provided under this License. Any attempt + otherwise to copy, modify, sublicense, or distribute it is void, + and will automatically terminate your rights under this License. + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the + copyright holder fails to notify you of the violation by some + reasonable means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from + that copyright holder, and you cure the violation prior to 30 days + after your receipt of the notice. + + Termination of your rights under this section does not terminate + the licenses of parties who have received copies or rights from you + under this License. If your rights have been terminated and not + permanently reinstated, receipt of a copy of some or all of the + same material does not give you any rights to use it. + + 10. FUTURE REVISIONS OF THIS LICENSE + + The Free Software Foundation may publish new, revised versions of + the GNU Free Documentation License from time to time. Such new + versions will be similar in spirit to the present version, but may + differ in detail to address new problems or concerns. See + . + + Each version of the License is given a distinguishing version + number. If the Document specifies that a particular numbered + version of this License "or any later version" applies to it, you + have the option of following the terms and conditions either of + that specified version or of any later version that has been + published (not as a draft) by the Free Software Foundation. If the + Document does not specify a version number of this License, you may + choose any version ever published (not as a draft) by the Free + Software Foundation. If the Document specifies that a proxy can + decide which future versions of this License can be used, that + proxy's public statement of acceptance of a version permanently + authorizes you to choose that version for the Document. + + 11. RELICENSING + + "Massive Multiauthor Collaboration Site" (or "MMC Site") means any + World Wide Web server that publishes copyrightable works and also + provides prominent facilities for anybody to edit those works. A + public wiki that anybody can edit is an example of such a server. + A "Massive Multiauthor Collaboration" (or "MMC") contained in the + site means any set of copyrightable works thus published on the MMC + site. + + "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 + license published by Creative Commons Corporation, a not-for-profit + corporation with a principal place of business in San Francisco, + California, as well as future copyleft versions of that license + published by that same organization. + + "Incorporate" means to publish or republish a Document, in whole or + in part, as part of another Document. + + An MMC is "eligible for relicensing" if it is licensed under this + License, and if all works that were first published under this + License somewhere other than this MMC, and subsequently + incorporated in whole or in part into the MMC, (1) had no cover + texts or invariant sections, and (2) were thus incorporated prior + to November 1, 2008. + + The operator of an MMC Site may republish an MMC contained in the + site under CC-BY-SA on the same site at any time before August 1, + 2009, provided the MMC is eligible for relicensing. + +ADDENDUM: How to use this License for your documents +==================================================== + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and license +notices just after the title page: + + Copyright (C) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. + + If you have Invariant Sections, Front-Cover Texts and Back-Cover +Texts, replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with + the Front-Cover Texts being LIST, and with the Back-Cover Texts + being LIST. + + If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + + If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of free +software license, such as the GNU General Public License, to permit +their use in free software. + + +File: libmicrohttpd-tutorial.info, Node: Example programs, Prev: License text, Up: Top + +Appendix C Example programs +*************************** + +* Menu: + +* hellobrowser.c:: +* logging.c:: +* responseheaders.c:: +* basicauthentication.c:: +* simplepost.c:: +* largepost.c:: +* sessions.c:: +* tlsauthentication.c:: + + +File: libmicrohttpd-tutorial.info, Node: hellobrowser.c, Next: logging.c, Up: Example programs + +C.1 hellobrowser.c +================== + + /* Feel free to use this example code in any way + you see fit (Public Domain) */ + + #include + #ifndef _WIN32 + #include + #include + #else + #include + #endif + #include + #include + #include + + #define PORT 8888 + + static int + answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) + { + const char *page = "Hello, browser!"; + struct MHD_Response *response; + int ret; + + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + + return ret; + } + + + int + main () + { + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + &answer_to_connection, NULL, MHD_OPTION_END); + if (NULL == daemon) + return 1; + + (void) getchar (); + + MHD_stop_daemon (daemon); + return 0; + } + + +File: libmicrohttpd-tutorial.info, Node: logging.c, Next: responseheaders.c, Prev: hellobrowser.c, Up: Example programs + +C.2 logging.c +============= + + /* Feel free to use this example code in any way + you see fit (Public Domain) */ + + #include + #ifndef _WIN32 + #include + #include + #else + #include + #endif + #include + #include + + #define PORT 8888 + + + static int + print_out_key (void *cls, enum MHD_ValueKind kind, const char *key, + const char *value) + { + printf ("%s: %s\n", key, value); + return MHD_YES; + } + + + static int + answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) + { + printf ("New %s request for %s using version %s\n", method, url, version); + + MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key, + NULL); + + return MHD_NO; + } + + + int + main () + { + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + &answer_to_connection, NULL, MHD_OPTION_END); + if (NULL == daemon) + return 1; + + (void) getchar (); + + MHD_stop_daemon (daemon); + return 0; + } + + +File: libmicrohttpd-tutorial.info, Node: responseheaders.c, Next: basicauthentication.c, Prev: logging.c, Up: Example programs + +C.3 responseheaders.c +===================== + + /* Feel free to use this example code in any way + you see fit (Public Domain) */ + + #include + #ifndef _WIN32 + #include + #include + #else + #include + #endif + #include + #include + #include + #include + #include + #include + + #define PORT 8888 + #define FILENAME "picture.png" + #define MIMETYPE "image/png" + + static int + answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) + { + struct MHD_Response *response; + int fd; + int ret; + struct stat sbuf; + + if (0 != strcmp (method, "GET")) + return MHD_NO; + + if ( (-1 == (fd = open (FILENAME, O_RDONLY))) || + (0 != fstat (fd, &sbuf)) ) + { + const char *errorstr = + "An internal server error has occured!\ + "; + /* error accessing file */ + if (fd != -1) + (void) close (fd); + response = + MHD_create_response_from_buffer (strlen (errorstr), + (void *) errorstr, + MHD_RESPMEM_PERSISTENT); + if (NULL != response) + { + ret = + MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, + response); + MHD_destroy_response (response); + + return ret; + } + else + return MHD_NO; + } + response = + MHD_create_response_from_fd_at_offset64 (sbuf.st_size, fd, 0); + MHD_add_response_header (response, "Content-Type", MIMETYPE); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + + return ret; + } + + + int + main () + { + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + &answer_to_connection, NULL, MHD_OPTION_END); + if (NULL == daemon) + return 1; + + (void) getchar (); + + MHD_stop_daemon (daemon); + + return 0; + } + + +File: libmicrohttpd-tutorial.info, Node: basicauthentication.c, Next: simplepost.c, Prev: responseheaders.c, Up: Example programs + +C.4 basicauthentication.c +========================= + + /* Feel free to use this example code in any way + you see fit (Public Domain) */ + + #include + #ifndef _WIN32 + #include + #include + #else + #include + #endif + #include + #include + #include + #include + #include + + #define PORT 8888 + + + static int + answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) + { + char *user; + char *pass; + int fail; + int ret; + struct MHD_Response *response; + + if (0 != strcmp (method, "GET")) + return MHD_NO; + if (NULL == *con_cls) + { + *con_cls = connection; + return MHD_YES; + } + pass = NULL; + user = MHD_basic_auth_get_username_password (connection, &pass); + fail = ( (user == NULL) || + (0 != strcmp (user, "root")) || + (0 != strcmp (pass, "pa$$w0rd") ) ); + if (user != NULL) free (user); + if (pass != NULL) free (pass); + if (fail) + { + const char *page = "Go away."; + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_basic_auth_fail_response (connection, + "my realm", + response); + } + else + { + const char *page = "A secret."; + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + } + MHD_destroy_response (response); + return ret; + } + + + int + main () + { + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + &answer_to_connection, NULL, MHD_OPTION_END); + if (NULL == daemon) + return 1; + + (void) getchar (); + + MHD_stop_daemon (daemon); + return 0; + } + + +File: libmicrohttpd-tutorial.info, Node: simplepost.c, Next: largepost.c, Prev: basicauthentication.c, Up: Example programs + +C.5 simplepost.c +================ + + /* Feel free to use this example code in any way + you see fit (Public Domain) */ + + #include + #ifndef _WIN32 + #include + #include + #else + #include + #endif + #include + #include + #include + #include + + #if defined(_MSC_VER) && _MSC_VER+0 <= 1800 + /* Substitution is OK while return value is not used */ + #define snprintf _snprintf + #endif + + #define PORT 8888 + #define POSTBUFFERSIZE 512 + #define MAXNAMESIZE 20 + #define MAXANSWERSIZE 512 + + #define GET 0 + #define POST 1 + + struct connection_info_struct + { + int connectiontype; + char *answerstring; + struct MHD_PostProcessor *postprocessor; + }; + + const char *askpage = "\ + What's your name, Sir?
\ +
\ + \ + \ + "; + + const char *greetingpage = + "

Welcome, %s!

"; + + const char *errorpage = + "This doesn't seem to be right."; + + + static int + send_page (struct MHD_Connection *connection, const char *page) + { + int ret; + struct MHD_Response *response; + + + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + if (!response) + return MHD_NO; + + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + + return ret; + } + + + static int + iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, + const char *filename, const char *content_type, + const char *transfer_encoding, const char *data, uint64_t off, + size_t size) + { + struct connection_info_struct *con_info = coninfo_cls; + + if (0 == strcmp (key, "name")) + { + if ((size > 0) && (size <= MAXNAMESIZE)) + { + char *answerstring; + answerstring = malloc (MAXANSWERSIZE); + if (!answerstring) + return MHD_NO; + + snprintf (answerstring, MAXANSWERSIZE, greetingpage, data); + con_info->answerstring = answerstring; + } + else + con_info->answerstring = NULL; + + return MHD_NO; + } + + return MHD_YES; + } + + static void + request_completed (void *cls, struct MHD_Connection *connection, + void **con_cls, enum MHD_RequestTerminationCode toe) + { + struct connection_info_struct *con_info = *con_cls; + + if (NULL == con_info) + return; + + if (con_info->connectiontype == POST) + { + MHD_destroy_post_processor (con_info->postprocessor); + if (con_info->answerstring) + free (con_info->answerstring); + } + + free (con_info); + *con_cls = NULL; + } + + + static int + answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) + { + if (NULL == *con_cls) + { + struct connection_info_struct *con_info; + + con_info = malloc (sizeof (struct connection_info_struct)); + if (NULL == con_info) + return MHD_NO; + con_info->answerstring = NULL; + + if (0 == strcmp (method, "POST")) + { + con_info->postprocessor = + MHD_create_post_processor (connection, POSTBUFFERSIZE, + iterate_post, (void *) con_info); + + if (NULL == con_info->postprocessor) + { + free (con_info); + return MHD_NO; + } + + con_info->connectiontype = POST; + } + else + con_info->connectiontype = GET; + + *con_cls = (void *) con_info; + + return MHD_YES; + } + + if (0 == strcmp (method, "GET")) + { + return send_page (connection, askpage); + } + + if (0 == strcmp (method, "POST")) + { + struct connection_info_struct *con_info = *con_cls; + + if (*upload_data_size != 0) + { + MHD_post_process (con_info->postprocessor, upload_data, + *upload_data_size); + *upload_data_size = 0; + + return MHD_YES; + } + else if (NULL != con_info->answerstring) + return send_page (connection, con_info->answerstring); + } + + return send_page (connection, errorpage); + } + + int + main () + { + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_NOTIFY_COMPLETED, request_completed, + NULL, MHD_OPTION_END); + if (NULL == daemon) + return 1; + + (void) getchar (); + + MHD_stop_daemon (daemon); + + return 0; + } + + +File: libmicrohttpd-tutorial.info, Node: largepost.c, Next: sessions.c, Prev: simplepost.c, Up: Example programs + +C.6 largepost.c +=============== + + /* Feel free to use this example code in any way + you see fit (Public Domain) */ + + #include + #ifndef _WIN32 + #include + #include + #else + #include + #endif + #include + #include + #include + #include + + #ifdef _MSC_VER + #ifndef strcasecmp + #define strcasecmp(a,b) _stricmp((a),(b)) + #endif /* !strcasecmp */ + #endif /* _MSC_VER */ + + #if defined(_MSC_VER) && _MSC_VER+0 <= 1800 + /* Substitution is OK while return value is not used */ + #define snprintf _snprintf + #endif + + #define PORT 8888 + #define POSTBUFFERSIZE 512 + #define MAXCLIENTS 2 + + enum ConnectionType + { + GET = 0, + POST = 1 + }; + + static unsigned int nr_of_uploading_clients = 0; + + struct connection_info_struct + { + enum ConnectionType connectiontype; + struct MHD_PostProcessor *postprocessor; + FILE *fp; + const char *answerstring; + int answercode; + }; + + const char *askpage = "\n\ + Upload a file, please!
\n\ + There are %u clients uploading at the moment.
\n\ +
\n\ + \n\ + \n\ + "; + + const char *busypage = + "This server is busy, please try again later."; + + const char *completepage = + "The upload has been completed."; + + const char *errorpage = + "This doesn't seem to be right."; + const char *servererrorpage = + "An internal server error has occured."; + const char *fileexistspage = + "This file already exists."; + const char* const postprocerror = + "ErrorError processing POST data"; + + + static int + send_page (struct MHD_Connection *connection, + const char *page, + int status_code) + { + int ret; + struct MHD_Response *response; + + response = + MHD_create_response_from_buffer (strlen (page), + (void *) page, + MHD_RESPMEM_MUST_COPY); + if (!response) + return MHD_NO; + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + "text/html"); + ret = MHD_queue_response (connection, + status_code, + response); + MHD_destroy_response (response); + + return ret; + } + + + static int + iterate_post (void *coninfo_cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, + uint64_t off, + size_t size) + { + struct connection_info_struct *con_info = coninfo_cls; + FILE *fp; + + con_info->answerstring = servererrorpage; + con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR; + + if (0 != strcmp (key, "file")) + return MHD_NO; + + if (! con_info->fp) + { + if (NULL != (fp = fopen (filename, "rb"))) + { + fclose (fp); + con_info->answerstring = fileexistspage; + con_info->answercode = MHD_HTTP_FORBIDDEN; + return MHD_NO; + } + + con_info->fp = fopen (filename, "ab"); + if (!con_info->fp) + return MHD_NO; + } + + if (size > 0) + { + if (! fwrite (data, sizeof (char), size, con_info->fp)) + return MHD_NO; + } + + con_info->answerstring = completepage; + con_info->answercode = MHD_HTTP_OK; + + return MHD_YES; + } + + + static void + request_completed (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) + { + struct connection_info_struct *con_info = *con_cls; + + if (NULL == con_info) + return; + + if (con_info->connectiontype == POST) + { + if (NULL != con_info->postprocessor) + { + MHD_destroy_post_processor (con_info->postprocessor); + nr_of_uploading_clients--; + } + + if (con_info->fp) + fclose (con_info->fp); + } + + free (con_info); + *con_cls = NULL; + } + + + static int + answer_to_connection (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) + { + if (NULL == *con_cls) + { + struct connection_info_struct *con_info; + + if (nr_of_uploading_clients >= MAXCLIENTS) + return send_page (connection, + busypage, + MHD_HTTP_SERVICE_UNAVAILABLE); + + con_info = malloc (sizeof (struct connection_info_struct)); + if (NULL == con_info) + return MHD_NO; + + con_info->fp = NULL; + + if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) + { + con_info->postprocessor = + MHD_create_post_processor (connection, + POSTBUFFERSIZE, + &iterate_post, + (void *) con_info); + + if (NULL == con_info->postprocessor) + { + free (con_info); + return MHD_NO; + } + + nr_of_uploading_clients++; + + con_info->connectiontype = POST; + con_info->answercode = MHD_HTTP_OK; + con_info->answerstring = completepage; + } + else + con_info->connectiontype = GET; + + *con_cls = (void *) con_info; + + return MHD_YES; + } + + if (0 == strcasecmp (method, MHD_HTTP_METHOD_GET)) + { + char buffer[1024]; + + snprintf (buffer, + sizeof (buffer), + askpage, + nr_of_uploading_clients); + return send_page (connection, + buffer, + MHD_HTTP_OK); + } + + if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) + { + struct connection_info_struct *con_info = *con_cls; + + if (0 != *upload_data_size) + { + if (MHD_post_process (con_info->postprocessor, + upload_data, + *upload_data_size) != MHD_YES) + { + return send_page (connection, + postprocerror, + MHD_HTTP_BAD_REQUEST); + } + *upload_data_size = 0; + + return MHD_YES; + } + else + { + if (NULL != con_info->fp) + { + fclose (con_info->fp); + con_info->fp = NULL; + } + /* Now it is safe to open and inspect the file before + calling send_page with a response */ + return send_page (connection, + con_info->answerstring, + con_info->answercode); + } + + } + + return send_page (connection, + errorpage, + MHD_HTTP_BAD_REQUEST); + } + + + int + main () + { + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, + PORT, NULL, NULL, + &answer_to_connection, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &request_completed, NULL, + MHD_OPTION_END); + if (NULL == daemon) + return 1; + (void) getchar (); + MHD_stop_daemon (daemon); + return 0; + } + + +File: libmicrohttpd-tutorial.info, Node: sessions.c, Next: tlsauthentication.c, Prev: largepost.c, Up: Example programs + +C.7 sessions.c +============== + + /* Feel free to use this example code in any way + you see fit (Public Domain) */ + + /* needed for asprintf */ + #define _GNU_SOURCE + + #include + #include + #include + #include + #include + #include + + #if defined _WIN32 && !defined(__MINGW64_VERSION_MAJOR) + static int + asprintf (char **resultp, const char *format, ...) + { + va_list argptr; + char *result = NULL; + int len = 0; + + if (format == NULL) + return -1; + + va_start (argptr, format); + + len = _vscprintf ((char *) format, argptr); + if (len >= 0) + { + len += 1; + result = (char *) malloc (sizeof (char *) * len); + if (result != NULL) + { + int len2 = _vscprintf ((char *) format, argptr); + if (len2 != len - 1 || len2 <= 0) + { + free (result); + result = NULL; + len = -1; + } + else + { + len = len2; + if (resultp) + *resultp = result; + } + } + } + va_end (argptr); + return len; + } + #endif + + /** + * Invalid method page. + */ + #define METHOD_ERROR "Illegal requestGo away." + + /** + * Invalid URL page. + */ + #define NOT_FOUND_ERROR "Not foundGo away." + + /** + * Front page. (/) + */ + #define MAIN_PAGE "Welcome
What is your name? " + + /** + * Second page. (/2) + */ + #define SECOND_PAGE "Tell me moreprevious %s, what is your job? " + + /** + * Second page (/S) + */ + #define SUBMIT_PAGE "Ready to submit?previous " + + /** + * Last page. + */ + #define LAST_PAGE "Thank youThank you." + + /** + * Name of our cookie. + */ + #define COOKIE_NAME "session" + + + /** + * State we keep for each user/session/browser. + */ + struct Session + { + /** + * We keep all sessions in a linked list. + */ + struct Session *next; + + /** + * Unique ID for this session. + */ + char sid[33]; + + /** + * Reference counter giving the number of connections + * currently using this session. + */ + unsigned int rc; + + /** + * Time when this session was last active. + */ + time_t start; + + /** + * String submitted via form. + */ + char value_1[64]; + + /** + * Another value submitted via form. + */ + char value_2[64]; + + }; + + + /** + * Data kept per request. + */ + struct Request + { + + /** + * Associated session. + */ + struct Session *session; + + /** + * Post processor handling form data (IF this is + * a POST request). + */ + struct MHD_PostProcessor *pp; + + /** + * URL to serve in response to this POST (if this request + * was a 'POST') + */ + const char *post_url; + + }; + + + /** + * Linked list of all active sessions. Yes, O(n) but a + * hash table would be overkill for a simple example... + */ + static struct Session *sessions; + + + + + /** + * Return the session handle for this connection, or + * create one if this is a new user. + */ + static struct Session * + get_session (struct MHD_Connection *connection) + { + struct Session *ret; + const char *cookie; + + cookie = MHD_lookup_connection_value (connection, + MHD_COOKIE_KIND, + COOKIE_NAME); + if (cookie != NULL) + { + /* find existing session */ + ret = sessions; + while (NULL != ret) + { + if (0 == strcmp (cookie, ret->sid)) + break; + ret = ret->next; + } + if (NULL != ret) + { + ret->rc++; + return ret; + } + } + /* create fresh session */ + ret = calloc (1, sizeof (struct Session)); + if (NULL == ret) + { + fprintf (stderr, "calloc error: %s\n", strerror (errno)); + return NULL; + } + /* not a super-secure way to generate a random session ID, + but should do for a simple example... */ + snprintf (ret->sid, + sizeof (ret->sid), + "%X%X%X%X", + (unsigned int) rand (), + (unsigned int) rand (), + (unsigned int) rand (), + (unsigned int) rand ()); + ret->rc++; + ret->start = time (NULL); + ret->next = sessions; + sessions = ret; + return ret; + } + + + /** + * Type of handler that generates a reply. + * + * @param cls content for the page (handler-specific) + * @param mime mime type to use + * @param session session information + * @param connection connection to process + * @param MHD_YES on success, MHD_NO on failure + */ + typedef int (*PageHandler)(const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection); + + + /** + * Entry we generate for each page served. + */ + struct Page + { + /** + * Acceptable URL for this page. + */ + const char *url; + + /** + * Mime type to set for the page. + */ + const char *mime; + + /** + * Handler to call to generate response. + */ + PageHandler handler; + + /** + * Extra argument to handler. + */ + const void *handler_cls; + }; + + + /** + * Add header to response to set a session cookie. + * + * @param session session to use + * @param response response to modify + */ + static void + add_session_cookie (struct Session *session, + struct MHD_Response *response) + { + char cstr[256]; + snprintf (cstr, + sizeof (cstr), + "%s=%s", + COOKIE_NAME, + session->sid); + if (MHD_NO == + MHD_add_response_header (response, + MHD_HTTP_HEADER_SET_COOKIE, + cstr)) + { + fprintf (stderr, + "Failed to set session cookie header!\n"); + } + } + + + /** + * Handler that returns a simple static HTTP page that + * is passed in via 'cls'. + * + * @param cls a 'const char *' with the HTML webpage to return + * @param mime mime type to use + * @param session session handle + * @param connection connection to use + */ + static int + serve_simple_form (const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection) + { + int ret; + const char *form = cls; + struct MHD_Response *response; + + /* return static form */ + response = MHD_create_response_from_buffer (strlen (form), + (void *) form, + MHD_RESPMEM_PERSISTENT); + add_session_cookie (session, response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_ENCODING, + mime); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; + } + + + /** + * Handler that adds the 'v1' value to the given HTML code. + * + * @param cls a 'const char *' with the HTML webpage to return + * @param mime mime type to use + * @param session session handle + * @param connection connection to use + */ + static int + fill_v1_form (const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection) + { + int ret; + const char *form = cls; + char *reply; + struct MHD_Response *response; + + if (-1 == asprintf (&reply, + form, + session->value_1)) + { + /* oops */ + return MHD_NO; + } + /* return static form */ + response = MHD_create_response_from_buffer (strlen (reply), + (void *) reply, + MHD_RESPMEM_MUST_FREE); + add_session_cookie (session, response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_ENCODING, + mime); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; + } + + + /** + * Handler that adds the 'v1' and 'v2' values to the given HTML code. + * + * @param cls a 'const char *' with the HTML webpage to return + * @param mime mime type to use + * @param session session handle + * @param connection connection to use + */ + static int + fill_v1_v2_form (const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection) + { + int ret; + const char *form = cls; + char *reply; + struct MHD_Response *response; + + if (-1 == asprintf (&reply, + form, + session->value_1, + session->value_2)) + { + /* oops */ + return MHD_NO; + } + /* return static form */ + response = MHD_create_response_from_buffer (strlen (reply), + (void *) reply, + MHD_RESPMEM_MUST_FREE); + add_session_cookie (session, response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_ENCODING, + mime); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; + } + + + /** + * Handler used to generate a 404 reply. + * + * @param cls a 'const char *' with the HTML webpage to return + * @param mime mime type to use + * @param session session handle + * @param connection connection to use + */ + static int + not_found_page (const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection) + { + int ret; + struct MHD_Response *response; + + /* unsupported HTTP method */ + response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR), + (void *) NOT_FOUND_ERROR, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, + MHD_HTTP_NOT_FOUND, + response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_ENCODING, + mime); + MHD_destroy_response (response); + return ret; + } + + + /** + * List of all pages served by this HTTP server. + */ + static struct Page pages[] = + { + { "/", "text/html", &fill_v1_form, MAIN_PAGE }, + { "/2", "text/html", &fill_v1_v2_form, SECOND_PAGE }, + { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE }, + { "/F", "text/html", &serve_simple_form, LAST_PAGE }, + { NULL, NULL, ¬_found_page, NULL } /* 404 */ + }; + + + + /** + * Iterator over key-value pairs where the value + * maybe made available in increments and/or may + * not be zero-terminated. Used for processing + * POST data. + * + * @param cls user-specified closure + * @param kind type of the value + * @param key 0-terminated key for the value + * @param filename name of the uploaded file, NULL if not known + * @param content_type mime-type of the data, NULL if not known + * @param transfer_encoding encoding of the data, NULL if not known + * @param data pointer to size bytes of data at the + * specified offset + * @param off offset of data in the overall value + * @param size number of bytes in data available + * @return MHD_YES to continue iterating, + * MHD_NO to abort the iteration + */ + static int + post_iterator (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, uint64_t off, size_t size) + { + struct Request *request = cls; + struct Session *session = request->session; + + if (0 == strcmp ("DONE", key)) + { + fprintf (stdout, + "Session `%s' submitted `%s', `%s'\n", + session->sid, + session->value_1, + session->value_2); + return MHD_YES; + } + if (0 == strcmp ("v1", key)) + { + if (size + off > sizeof(session->value_1)) + size = sizeof (session->value_1) - off; + memcpy (&session->value_1[off], + data, + size); + if (size + off < sizeof (session->value_1)) + session->value_1[size+off] = '\0'; + return MHD_YES; + } + if (0 == strcmp ("v2", key)) + { + if (size + off > sizeof(session->value_2)) + size = sizeof (session->value_2) - off; + memcpy (&session->value_2[off], + data, + size); + if (size + off < sizeof (session->value_2)) + session->value_2[size+off] = '\0'; + return MHD_YES; + } + fprintf (stderr, "Unsupported form value `%s'\n", key); + return MHD_YES; + } + + + /** + * Main MHD callback for handling requests. + * + * + * @param cls argument given together with the function + * pointer when the handler was registered with MHD + * @param connection handle to connection which is being processed + * @param url the requested url + * @param method the HTTP method used ("GET", "PUT", etc.) + * @param version the HTTP version string (i.e. "HTTP/1.1") + * @param upload_data the data being uploaded (excluding HEADERS, + * for a POST that fits into memory and that is encoded + * with a supported encoding, the POST data will NOT be + * given in upload_data and is instead available as + * part of MHD_get_connection_values; very large POST + * data *will* be made available incrementally in + * upload_data) + * @param upload_data_size set initially to the size of the + * upload_data provided; the method must update this + * value to the number of bytes NOT processed; + * @param ptr pointer that the callback can set to some + * address and that will be preserved by MHD for future + * calls for this request; since the access handler may + * be called many times (i.e., for a PUT/POST operation + * with plenty of upload data) this allows the application + * to easily associate some request-specific state. + * If necessary, this state can be cleaned up in the + * global "MHD_RequestCompleted" callback (which + * can be set with the MHD_OPTION_NOTIFY_COMPLETED). + * Initially, *con_cls will be NULL. + * @return MHS_YES if the connection was handled successfully, + * MHS_NO if the socket must be closed due to a serios + * error while handling the request + */ + static int + create_response (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **ptr) + { + struct MHD_Response *response; + struct Request *request; + struct Session *session; + int ret; + unsigned int i; + + request = *ptr; + if (NULL == request) + { + request = calloc (1, sizeof (struct Request)); + if (NULL == request) + { + fprintf (stderr, "calloc error: %s\n", strerror (errno)); + return MHD_NO; + } + *ptr = request; + if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) + { + request->pp = MHD_create_post_processor (connection, 1024, + &post_iterator, request); + if (NULL == request->pp) + { + fprintf (stderr, "Failed to setup post processor for `%s'\n", + url); + return MHD_NO; /* internal error */ + } + } + return MHD_YES; + } + if (NULL == request->session) + { + request->session = get_session (connection); + if (NULL == request->session) + { + fprintf (stderr, "Failed to setup session for `%s'\n", + url); + return MHD_NO; /* internal error */ + } + } + session = request->session; + session->start = time (NULL); + if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) + { + /* evaluate POST data */ + MHD_post_process (request->pp, + upload_data, + *upload_data_size); + if (0 != *upload_data_size) + { + *upload_data_size = 0; + return MHD_YES; + } + /* done with POST data, serve response */ + MHD_destroy_post_processor (request->pp); + request->pp = NULL; + method = MHD_HTTP_METHOD_GET; /* fake 'GET' */ + if (NULL != request->post_url) + url = request->post_url; + } + + if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || + (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) + { + /* find out which page to serve */ + i=0; + while ( (pages[i].url != NULL) && + (0 != strcmp (pages[i].url, url)) ) + i++; + ret = pages[i].handler (pages[i].handler_cls, + pages[i].mime, + session, connection); + if (ret != MHD_YES) + fprintf (stderr, "Failed to create page for `%s'\n", + url); + return ret; + } + /* unsupported HTTP method */ + response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), + (void *) METHOD_ERROR, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, + MHD_HTTP_NOT_ACCEPTABLE, + response); + MHD_destroy_response (response); + return ret; + } + + + /** + * Callback called upon completion of a request. + * Decrements session reference counter. + * + * @param cls not used + * @param connection connection that completed + * @param con_cls session handle + * @param toe status code + */ + static void + request_completed_callback (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) + { + struct Request *request = *con_cls; + + if (NULL == request) + return; + if (NULL != request->session) + request->session->rc--; + if (NULL != request->pp) + MHD_destroy_post_processor (request->pp); + free (request); + } + + + /** + * Clean up handles of sessions that have been idle for + * too long. + */ + static void + expire_sessions () + { + struct Session *pos; + struct Session *prev; + struct Session *next; + time_t now; + + now = time (NULL); + prev = NULL; + pos = sessions; + while (NULL != pos) + { + next = pos->next; + if (now - pos->start > 60 * 60) + { + /* expire sessions after 1h */ + if (NULL == prev) + sessions = pos->next; + else + prev->next = next; + free (pos); + } + else + prev = pos; + pos = next; + } + } + + + /** + * Call with the port number as the only argument. + * Never terminates (other than by signals, such as CTRL-C). + */ + int + main (int argc, char *const *argv) + { + struct MHD_Daemon *d; + struct timeval tv; + struct timeval *tvp; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max; + MHD_UNSIGNED_LONG_LONG mhd_timeout; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + /* initialize PRNG */ + srand ((unsigned int) time (NULL)); + d = MHD_start_daemon (MHD_USE_DEBUG, + atoi (argv[1]), + NULL, NULL, + &create_response, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15, + MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, + MHD_OPTION_END); + if (NULL == d) + return 1; + while (1) + { + expire_sessions (); + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + break; /* fatal internal error */ + if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES) + { + tv.tv_sec = mhd_timeout / 1000; + tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000; + tvp = &tv; + } + else + tvp = NULL; + if (-1 == select (max + 1, &rs, &ws, &es, tvp)) + { + if (EINTR != errno) + fprintf (stderr, + "Aborting due to error during select: %s\n", + strerror (errno)); + break; + } + MHD_run (d); + } + MHD_stop_daemon (d); + return 0; + } + + +File: libmicrohttpd-tutorial.info, Node: tlsauthentication.c, Prev: sessions.c, Up: Example programs + +C.8 tlsauthentication.c +======================= + + /* Feel free to use this example code in any way + you see fit (Public Domain) */ + + #include + #ifndef _WIN32 + #include + #include + #else + #include + #endif + #include + #include + #include + #include + + #define PORT 8888 + + #define REALM "\"Maintenance\"" + #define USER "a legitimate user" + #define PASSWORD "and his password" + + #define SERVERKEYFILE "server.key" + #define SERVERCERTFILE "server.pem" + + + static char * + string_to_base64 (const char *message) + { + const char *lookup = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + unsigned long l; + int i; + char *tmp; + size_t length = strlen (message); + + tmp = malloc (length * 2); + if (NULL == tmp) + return tmp; + + tmp[0] = 0; + + for (i = 0; i < length; i += 3) + { + l = (((unsigned long) message[i]) << 16) + | (((i + 1) < length) ? (((unsigned long) message[i + 1]) << 8) : 0) + | (((i + 2) < length) ? ((unsigned long) message[i + 2]) : 0); + + + strncat (tmp, &lookup[(l >> 18) & 0x3F], 1); + strncat (tmp, &lookup[(l >> 12) & 0x3F], 1); + + if (i + 1 < length) + strncat (tmp, &lookup[(l >> 6) & 0x3F], 1); + if (i + 2 < length) + strncat (tmp, &lookup[l & 0x3F], 1); + } + + if (length % 3) + strncat (tmp, "===", 3 - length % 3); + + return tmp; + } + + + static long + get_file_size (const char *filename) + { + FILE *fp; + + fp = fopen (filename, "rb"); + if (fp) + { + long size; + + if ((0 != fseek (fp, 0, SEEK_END)) || (-1 == (size = ftell (fp)))) + size = 0; + + fclose (fp); + + return size; + } + else + return 0; + } + + + static char * + load_file (const char *filename) + { + FILE *fp; + char *buffer; + long size; + + size = get_file_size (filename); + if (0 == size) + return NULL; + + fp = fopen (filename, "rb"); + if (! fp) + return NULL; + + buffer = malloc (size + 1); + if (! buffer) + { + fclose (fp); + return NULL; + } + buffer[size] = '\0'; + + if (size != fread (buffer, 1, size, fp)) + { + free (buffer); + buffer = NULL; + } + + fclose (fp); + return buffer; + } + + + static int + ask_for_authentication (struct MHD_Connection *connection, const char *realm) + { + int ret; + struct MHD_Response *response; + char *headervalue; + const char *strbase = "Basic realm="; + + response = MHD_create_response_from_buffer (0, NULL, + MHD_RESPMEM_PERSISTENT); + if (!response) + return MHD_NO; + + headervalue = malloc (strlen (strbase) + strlen (realm) + 1); + if (!headervalue) + return MHD_NO; + + strcpy (headervalue, strbase); + strcat (headervalue, realm); + + ret = MHD_add_response_header (response, "WWW-Authenticate", headervalue); + free (headervalue); + if (!ret) + { + MHD_destroy_response (response); + return MHD_NO; + } + + ret = MHD_queue_response (connection, MHD_HTTP_UNAUTHORIZED, response); + + MHD_destroy_response (response); + + return ret; + } + + static int + is_authenticated (struct MHD_Connection *connection, + const char *username, const char *password) + { + const char *headervalue; + char *expected_b64, *expected; + const char *strbase = "Basic "; + int authenticated; + + headervalue = + MHD_lookup_connection_value (connection, MHD_HEADER_KIND, + "Authorization"); + if (NULL == headervalue) + return 0; + if (0 != strncmp (headervalue, strbase, strlen (strbase))) + return 0; + + expected = malloc (strlen (username) + 1 + strlen (password) + 1); + if (NULL == expected) + return 0; + + strcpy (expected, username); + strcat (expected, ":"); + strcat (expected, password); + + expected_b64 = string_to_base64 (expected); + free (expected); + if (NULL == expected_b64) + return 0; + + authenticated = + (strcmp (headervalue + strlen (strbase), expected_b64) == 0); + + free (expected_b64); + + return authenticated; + } + + + static int + secret_page (struct MHD_Connection *connection) + { + int ret; + struct MHD_Response *response; + const char *page = "A secret."; + + response = + MHD_create_response_from_buffer (strlen (page), (void *) page, + MHD_RESPMEM_PERSISTENT); + if (!response) + return MHD_NO; + + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + + return ret; + } + + + static int + answer_to_connection (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **con_cls) + { + if (0 != strcmp (method, "GET")) + return MHD_NO; + if (NULL == *con_cls) + { + *con_cls = connection; + return MHD_YES; + } + + if (!is_authenticated (connection, USER, PASSWORD)) + return ask_for_authentication (connection, REALM); + + return secret_page (connection); + } + + + int + main () + { + struct MHD_Daemon *daemon; + char *key_pem; + char *cert_pem; + + key_pem = load_file (SERVERKEYFILE); + cert_pem = load_file (SERVERCERTFILE); + + if ((key_pem == NULL) || (cert_pem == NULL)) + { + printf ("The key/certificate files could not be read.\n"); + return 1; + } + + daemon = + MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_TLS, PORT, NULL, + NULL, &answer_to_connection, NULL, + MHD_OPTION_HTTPS_MEM_KEY, key_pem, + MHD_OPTION_HTTPS_MEM_CERT, cert_pem, MHD_OPTION_END); + if (NULL == daemon) + { + printf ("%s\n", cert_pem); + + free (key_pem); + free (cert_pem); + + return 1; + } + + (void) getchar (); + + MHD_stop_daemon (daemon); + free (key_pem); + free (cert_pem); + + return 0; + } + + + +Tag Table: +Node: Top858 +Node: Introduction1906 +Node: Hello browser example3211 +Node: Exploring requests14460 +Node: Response headers19876 +Node: Supporting basic authentication27782 +Node: Processing POST data35190 +Node: Improved processing of POST data43853 +Node: Session management54564 +Node: Adding a layer of security58078 +Node: Bibliography72643 +Node: License text73837 +Node: Example programs98993 +Node: hellobrowser.c99306 +Node: logging.c100849 +Node: responseheaders.c102432 +Node: basicauthentication.c105058 +Node: simplepost.c107597 +Node: largepost.c113433 +Node: sessions.c122430 +Node: tlsauthentication.c144775 + +End Tag Table diff --git a/doc/libmicrohttpd-tutorial.texi b/doc/libmicrohttpd-tutorial.texi new file mode 100644 index 0000000..8fd7b56 --- /dev/null +++ b/doc/libmicrohttpd-tutorial.texi @@ -0,0 +1,181 @@ +\input texinfo @c -*-texinfo-*- +@finalout +@setfilename libmicrohttpd-tutorial.info +@set UPDATED 2 April 2016 +@set UPDATED-MONTH April 2016 +@set EDITION 0.9.48 +@set VERSION 0.9.48 +@settitle A tutorial for GNU libmicrohttpd +@c Unify all the indices into concept index. +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp + +@dircategory Software libraries +@direntry +* libmicrohttpdtutorial: (libmicrohttpd). A tutorial for GNU libmicrohttpd. +@end direntry + +@copying +This tutorial documents GNU libmicrohttpd version @value{VERSION}, last +updated @value{UPDATED}. + +Copyright (c) 2008 Sebastian Gerhardt. + +Copyright (c) 2010, 2011, 2012, 2013, 2016 Christian Grothoff. +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 +or any later version published by the Free Software Foundation; +with no Invariant Sections, no Front-Cover Texts, and no Back-Cover +Texts. A copy of the license is included in the section entitled "GNU +Free Documentation License". +@end quotation +@end copying + +@titlepage +@title A Tutorial for GNU libmicrohttpd +@subtitle Version @value{VERSION} +@subtitle @value{UPDATED} +@author Sebastian Gerhardt (@email{sebgerhardt@@gmx.net}) +@author Christian Grothoff (@email{christian@@grothoff.org}) +@author Matthieu Speder (@email{mspeder@@users.sourceforge.net}) + +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage + + + +@contents + +@ifnottex +@node Top +@top A Tutorial for GNU libmicrohttpd +@insertcopying +@end ifnottex + +@menu +* Introduction:: +* Hello browser example:: +* Exploring requests:: +* Response headers:: +* Supporting basic authentication:: +* Processing POST data:: +* Improved processing of POST data:: +* Session management:: +* Adding a layer of security:: +* Bibliography:: +* License text:: +* Example programs:: +@end menu + +@node Introduction +@chapter Introduction +@include chapters/introduction.inc + +@node Hello browser example +@chapter Hello browser example +@include chapters/hellobrowser.inc + +@node Exploring requests +@chapter Exploring requests +@include chapters/exploringrequests.inc + +@node Response headers +@chapter Response headers +@include chapters/responseheaders.inc + +@node Supporting basic authentication +@chapter Supporting basic authentication +@include chapters/basicauthentication.inc + +@node Processing POST data +@chapter Processing POST data +@include chapters/processingpost.inc + +@node Improved processing of POST data +@chapter Improved processing of POST data +@include chapters/largerpost.inc + +@node Session management +@chapter Session management +@include chapters/sessions.inc + +@node Adding a layer of security +@chapter Adding a layer of security +@include chapters/tlsauthentication.inc + +@node Bibliography +@appendix Bibliography +@include chapters/bibliography.inc + +@node License text +@appendix GNU Free Documentation License +@include fdl-1.3.texi + +@node Example programs +@appendix Example programs +@menu +* hellobrowser.c:: +* logging.c:: +* responseheaders.c:: +* basicauthentication.c:: +* simplepost.c:: +* largepost.c:: +* sessions.c:: +* tlsauthentication.c:: +@end menu + +@node hellobrowser.c +@section hellobrowser.c +@smalldisplay +@verbatiminclude examples/hellobrowser.c +@end smalldisplay + +@node logging.c +@section logging.c +@smalldisplay +@verbatiminclude examples/logging.c +@end smalldisplay + +@node responseheaders.c +@section responseheaders.c +@smalldisplay +@verbatiminclude examples/responseheaders.c +@end smalldisplay + +@node basicauthentication.c +@section basicauthentication.c +@smalldisplay +@verbatiminclude examples/basicauthentication.c +@end smalldisplay + +@node simplepost.c +@section simplepost.c +@smalldisplay +@verbatiminclude examples/simplepost.c +@end smalldisplay + +@node largepost.c +@section largepost.c +@smalldisplay +@verbatiminclude examples/largepost.c +@end smalldisplay + +@node sessions.c +@section sessions.c +@smalldisplay +@verbatiminclude examples/sessions.c +@end smalldisplay + +@node tlsauthentication.c +@section tlsauthentication.c +@smalldisplay +@verbatiminclude examples/tlsauthentication.c +@end smalldisplay + +@bye diff --git a/doc/libmicrohttpd.3 b/doc/libmicrohttpd.3 new file mode 100644 index 0000000..7dd81eb --- /dev/null +++ b/doc/libmicrohttpd.3 @@ -0,0 +1,35 @@ +.TH LIBMICROHTTPD "3" "21 Jun 2013 "libmicrohttpd" +.SH "NAME" +libmicrohttpd \- library for embedding HTTP servers +.SH "SYNOPSIS" + + \fB#include + +.SH "DESCRIPTION" +.P +GNU libmicrohttpd (short MHD) allows applications to easily integrate the functionality of a simple HTTP server. MHD is a GNU package. +.P +The details of the API are described in comments in the header file, a detailed reference documentation, a tutorial, and in brief on the MHD webpage. +.P +.SH "SEE ALSO" +\fBcurl\fP(1), \fBlibcurl\fP(3) + +.SH "LEGAL NOTICE" +libmicrohttpd is released under both the LGPL Version 2.1 or higher and the GNU GPL with eCos extension. For details on both licenses please read the respective appendix in the manual. + +.SH "FILES" +.TP +microhttpd.h +libmicrohttpd include file +.TP +libmicrohttpd.so +libmicrohttpd library + +.SH "REPORTING BUGS" +Report bugs by using mantis . + +.SH "AUTHORS" +GNU libmicrohttpd was originally designed by Christian Grothoff and Chris GauthierDickey . The original implementation was done by Daniel Pittman and Christian Grothoff. SSL/TLS support was added by Sagie Amir using code from GnuTLS. See the AUTHORS file in the distribution for a more detailed list of contributors. + +.SH "AVAILABILITY" +You can obtain the latest version from http://www.gnu.org/software/libmicrohttpd/. diff --git a/doc/libmicrohttpd.info b/doc/libmicrohttpd.info new file mode 100644 index 0000000..22668b3 Binary files /dev/null and b/doc/libmicrohttpd.info differ diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi new file mode 100644 index 0000000..cac5dd2 --- /dev/null +++ b/doc/libmicrohttpd.texi @@ -0,0 +1,3081 @@ +\input texinfo +@setfilename libmicrohttpd.info +@documentencoding UTF-8 +@include version.texi +@settitle The GNU libmicrohttpd Reference Manual +@c Unify all the indices into concept index. +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@copying +This manual is for GNU libmicrohttpd +(version @value{VERSION}, @value{UPDATED}), a library for embedding +an HTTP(S) server into C applications. + +Copyright @copyright{} 2007--2017 Christian Grothoff + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 +or any later version published by the Free Software Foundation; +with no Invariant Sections, no Front-Cover Texts, and no Back-Cover +Texts. A copy of the license is included in the section entitled "GNU +Free Documentation License". +@end quotation +@end copying + +@dircategory Software libraries +@direntry +* libmicrohttpd: (libmicrohttpd). Embedded HTTP server library. +@end direntry + +@c +@c Titlepage +@c +@titlepage +@title The GNU libmicrohttpd Reference Manual +@subtitle Version @value{VERSION} +@subtitle @value{UPDATED} +@author Marco Maggi (@email{marco.maggi-ipsu@@poste.it}) +@author Christian Grothoff (@email{christian@@grothoff.org}) +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage + +@summarycontents +@contents + +@c ------------------------------------------------------------ +@ifnottex +@node Top +@top The GNU libmicrohttpd Library +@insertcopying +@end ifnottex + +@menu +* microhttpd-intro:: Introduction. +* microhttpd-const:: Constants. +* microhttpd-struct:: Structures type definition. +* microhttpd-cb:: Callback functions definition. +* microhttpd-init:: Starting and stopping the server. +* microhttpd-inspect:: Implementing external @code{select}. +* microhttpd-requests:: Handling requests. +* microhttpd-responses:: Building responses to requests. +* microhttpd-flow:: Flow control. +* microhttpd-dauth:: Utilizing Authentication. +* microhttpd-post:: Adding a @code{POST} processor. +* microhttpd-info:: Obtaining and modifying status information. +* microhttpd-util:: Utilities. + +Appendices + +* GNU-LGPL:: The GNU Lesser General Public License says how you + can copy and share almost all of `libmicrohttpd'. +* GNU GPL with eCos Extension:: The GNU General Public License with eCos extension says how you + can copy and share some parts of `libmicrohttpd'. +* GNU-FDL:: The GNU Free Documentation License says how you + can copy and share the documentation of `libmicrohttpd'. + +Indices + +* Concept Index:: Index of concepts and programs. +* Function and Data Index:: Index of functions, variables and data types. +* Type Index:: Index of data types. +@end menu + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-intro +@chapter Introduction + + +@noindent +All symbols defined in the public API start with @code{MHD_}. MHD +is a small HTTP daemon library. As such, it does not have any API +for logging errors (you can only enable or disable logging to stderr). +Also, it may not support all of the HTTP features directly, where +applicable, portions of HTTP may have to be handled by clients of the +library. + +The library is supposed to handle everything that it must handle +(because the API would not allow clients to do this), such as basic +connection management. However, detailed interpretations of headers, +such as range requests, are left to the main application. In +particular, if an application developer wants to support range +requests, he needs to explicitly indicate support in responses and +also explicitly parse the range header and generate a response (for +example, using the @code{MHD_create_response_from_fd_at_offset} call +to serve ranges from a file). MHD does understands headers that +control connection management (specifically, @code{Connection: close} +and @code{Expect: 100 continue} are understood and handled +automatically). @code{Connection: upgrade} is supported by passing +control over the socket (or something that behaves like the real +socket in the case of TLS) to the application (after sending the +desired HTTP response header). + +MHD largely ignores the semantics of the different HTTP methods, +so clients are left to handle those. One exception is that MHD does +understand @code{HEAD} and will only send the headers of the response +and not the body, even if the client supplied a body. (In fact, +clients do need to construct a response with the correct length, even +for @code{HEAD} request.) + +MHD understands @code{POST} data and is able to decode certain +formats (at the moment only @code{application/x-www-form-urlencoded} +and @code{multipart/form-data}) using the post processor API. The +data stream of a POST is also provided directly to the main +application, so unsupported encodings could still be processed, just +not conveniently by MHD. + +The header file defines various constants used by the HTTP protocol. +This does not mean that MHD actually interprets all of these values. +The provided constants are exported as a convenience for users of the +library. MHD does not verify that transmitted HTTP headers are +part of the standard specification; users of the library are free to +define their own extensions of the HTTP standard and use those with +MHD. + +All functions are guaranteed to be completely reentrant and +thread-safe. MHD checks for allocation failures and tries to +recover gracefully (for example, by closing the connection). +Additionally, clients can specify resource limits on the overall +number of connections, number of connections per IP address and memory +used per connection to avoid resource exhaustion. + +@section Scope + +MHD is currently used in a wide range of implementations. +Examples based on reports we've received from developers include: +@itemize +@item Embedded HTTP server on a cortex M3 (128 KB code space) +@item Large-scale multimedia server (reportedly serving at the + simulator limit of 7.5 GB/s) +@item Administrative console (via HTTP/HTTPS) for network appliances +@c If you have other interesting examples, please let us know +@end itemize + +@section Thread modes and event loops +@cindex poll +@cindex epoll +@cindex select + +MHD supports four basic thread modes and up to three event loop +styles. + +The four basic thread modes are external sockets polling (MHD creates +no threads, event loop is fully managed by the application), internal +polling (MHD creates one thread for all connections), polling in +thread pool (MHD creates a thread pool which is used to process all +connections) and thread-per-connection (MHD creates one thread for +listen sockets and then one thread per accepted connection). + +These thread modes are then combined with the evet loop styles +(polling function type). MHD support select, poll and epoll. select +is available on all platforms, epoll and poll may not be available on +some platforms. Note that it is possible to combine MHD using epoll +with an external select-based event loop. + +The default (if no other option is passed) is ``external select''. +The highest performance can typically be obtained with a thread pool +using @code{epoll}. Apache Benchmark (ab) was used to compare the +performance of @code{select} and @code{epoll} when using a thread pool +and a large number of connections. @ref{fig:performance} shows the +resulting plot from the @code{benchmark.c} example, which measures the +latency between an incoming request and the completion of the +transmission of the response. In this setting, the @code{epoll} +thread pool with four threads was able to handle more than 45,000 +connections per second on loopback (with Apache Benchmark running +three processes on the same machine). +@cindex performance + + +@float Figure,fig:performance +@image{libmicrohttpd_performance_data,400pt,300pt,Data,.png} +@caption{Performance measurements for select vs. epoll (with thread-pool).} +@end float + + +Not all combinations of thread modes and event loop styles are +supported. This is partially to keep the API simple, and partially +because some combinations simply make no sense as others are strictly +superior. Note that the choice of style depends first of all on the +application logic, and then on the performance requirements. +Applications that perform a blocking operation while handling a +request within the callbacks from MHD must use a thread per +connection. This is typically rather costly. Applications that do +not support threads or that must run on embedded devices without +thread-support must use the external mode. Using @code{epoll} is only +supported on some platform, thus portable applications must at least +have a fallback option available. @ref{tbl:supported} lists the sane +combinations. + +@float Table,tbl:supported +@multitable {@b{thread-per-connection}} {@b{select}} {@b{poll}} {@b{epoll}} +@item @tab @b{select} @tab @b{poll} @tab @b{epoll} +@item @b{external} @tab yes @tab no @tab yes +@item @b{internal} @tab yes @tab yes @tab yes +@item @b{thread pool} @tab yes @tab yes @tab yes +@item @b{thread-per-connection} @tab yes @tab yes @tab no +@end multitable +@caption{Supported combinations of event styles and thread modes.} +@end float + + +@section Compiling GNU libmicrohttpd +@cindex compilation +@cindex embedded systems +@cindex portability + +MHD uses the standard GNU system where the usual build process +involves running +@verbatim +$ ./configure +$ make +$ make install +@end verbatim + +MHD supports various options to be given to configure to tailor the +binary to a specific situation. Note that some of these options will +remove portions of the MHD code that are required for +binary-compatibility. They should only be used on embedded systems +with tight resource constraints and no concerns about library +versioning. Standard distributions including MHD are expected to +always ship with all features enabled, otherwise unexpected +incompatibilities can arise! + +Here is a list of MHD-specific options that can be given to configure +(canonical configure options such as ``--prefix'' are also supported, for a +full list of options run ``./configure --help''): + +@table @code +@item ``--disable-curl'' +disable running testcases using libcurl + +@item ``--disable-largefile'' +disable support for 64-bit files + +@item ``--disable-messages'' +disable logging of error messages (smaller binary size, not so much fun for debugging) + +@item ``--disable-https'' +disable HTTPS support, even if GNUtls is found; this option must be used if eCOS license is desired as an option (in all cases the resulting binary falls under a GNU LGPL-only license) + +@item ``--disable-postprocessor'' +do not include the post processor API (results in binary incompatibility) + +@item ``--disable-dauth'' +do not include the authentication APIs (results in binary incompatibility) + +@item ``--disable-httpupgrade'' +do not build code for HTTP ``Upgrade'' (smaller binary size, binary incompatible library) + +@item ``--disable-epoll'' +do not include epoll support, even if it supported (minimally smaller binary size, good for portability testing) + +@item ``--enable-coverage'' +set flags for analysis of code-coverage with gcc/gcov (results in slow, large binaries) + +@item ``--with-gcrypt=PATH'' +specifies path to libgcrypt installation + +@item ``--with-gnutls=PATH'' +specifies path to libgnutls installation + + +@end table + +@section Validity of pointers + +MHD will give applications access to its internal data structures +via pointers via arguments and return values from its API. This +creates the question as to how long those pointers are assured to +stay valid. + +Most MHD data structures are associated with the connection of an +HTTP client. Thus, pointers associated with a connection are +typically valid until the connection is finished, at which point +MHD will call the @code{MHD_RequestCompletedCallback} if one is +registered. Applications that have such a callback registered +may assume that keys and values from the +@code{MHD_KeyValueIterator}, return values from +@code{MHD_lookup_connection_value} and the @code{url}, +@code{method} and @code{version} arguments to the +@code{MHD_AccessHandlerCallback} will remain valid until the +respective @code{MHD_RequestCompletedCallback} is invoked. + +In contrast, the @code{upload_data} argument of +@code{MHD_RequestCompletedCallback} as well as all pointers +from the @code{MHD_PostDataIterator} are only valid for the +duration of the callback. + +Pointers returned from @code{MHD_get_response_header} are +valid as long as the response itself is valid. + + +@section Including the microhttpd.h header +@cindex portability +@cindex microhttpd.h + +Ideally, before including "microhttpd.h" you should add the necessary +includes to define the @code{uint64_t}, @code{size_t}, @code{fd_set}, +@code{socklen_t} and @code{struct sockaddr} data types. Which +specific headers are needed may depend on your platform and your build +system might include some tests to provide you with the necessary +conditional operations. For possible suggestions consult +@code{platform.h} and @code{configure.ac} in the MHD distribution. + +Once you have ensured that you manually (!) included the right headers +for your platform before "microhttpd.h", you should also add a line +with @code{#define MHD_PLATFORM_H} which will prevent the +"microhttpd.h" header from trying (and, depending on your platform, +failing) to include the right headers. + +If you do not define MHD_PLATFORM_H, the "microhttpd.h" header will +automatically include headers needed on GNU/Linux systems (possibly +causing problems when porting to other platforms). + +@section SIGPIPE +@cindex signals +MHD does not install a signal handler for SIGPIPE. On platforms where +this is possible (such as GNU/Linux), it disables SIGPIPE for its I/O +operations (by passing MSG_NOSIGNAL or similar). On other platforms, +SIGPIPE signals may be generated from network operations by MHD and +will cause the process to die unless the developer explicitly installs +a signal handler for SIGPIPE. + +Hence portable code using MHD must install a SIGPIPE handler or +explicitly block the SIGPIPE signal. MHD does not do so in order to +avoid messing with other parts of the application that may need to +handle SIGPIPE in a particular way. You can make your application +handle SIGPIPE by calling the following function in @code{main}: + +@verbatim +static void +catcher (int sig) +{ +} + +static void +ignore_sigpipe () +{ + struct sigaction oldsig; + struct sigaction sig; + + sig.sa_handler = &catcher; + sigemptyset (&sig.sa_mask); +#ifdef SA_INTERRUPT + sig.sa_flags = SA_INTERRUPT; /* SunOS */ +#else + sig.sa_flags = SA_RESTART; +#endif + if (0 != sigaction (SIGPIPE, &sig, &oldsig)) + fprintf (stderr, + "Failed to install SIGPIPE handler: %s\n", strerror (errno)); +} +@end verbatim + +@section MHD_UNSIGNED_LONG_LONG +@cindex long long +@cindex MHD_LONG_LONG +@cindex IAR +@cindex ARM +@cindex cortex m3 +@cindex embedded systems + +Some platforms do not support @code{long long}. Hence MHD defines a +macro @code{MHD_UNSIGNED LONG_LONG} which will default to +@code{unsigned long long}. For standard desktop operating systems, +this is all you need to know. + +However, if your platform does not support @code{unsigned long long}, +you should change "platform.h" to define @code{MHD_LONG_LONG} and +@code{MHD_UNSIGNED_LONG_LONG} to an appropriate alternative type and +also define @code{MHD_LONG_LONG_PRINTF} and +@code{MHD_UNSIGNED_LONG_LONG_PRINTF} to the corresponding format +string for printing such a data type. Note that the ``signed'' +versions are deprecated. Also, for historical reasons, +@code{MHD_LONG_LONG_PRINTF} is without the percent sign, whereas +@code{MHD_UNSIGNED_LONG_LONG_PRINTF} is with the percent sign. Newly +written code should only use the unsigned versions. However, you need +to define both in "platform.h" if you need to change the definition +for the specific platform. + + +@section Portability to W32 + +libmicrohttpd in general ported well to W32. Most libmicrohttpd features +are supported. W32 do not support some functions, like epoll and +corresponding MHD features are not available on W32. + + +@section Portability to z/OS + +To compile MHD on z/OS, extract the archive and run + +@verbatim +iconv -f UTF-8 -t IBM-1047 contrib/ascebc > /tmp/ascebc.sh +chmod +x /tmp/ascebc.sh +for n in `find * -type f` +do + /tmp/ascebc.sh $n +done +@end verbatim +to convert all source files to EBCDIC. Note that you must run +@code{configure} from the directory where the configure script is +located. Otherwise, configure will fail to find the +@code{contrib/xcc} script (which is a wrapper around the z/OS c89 +compiler). + + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-const +@chapter Constants + + +@deftp {Enumeration} MHD_FLAG +Options for the MHD daemon. + +Note that MHD will run automatically in background thread(s) only if +@code{MHD_USE_INTERNAL_POLLING_THREAD} is used. Otherwise caller +(application) must use @code{MHD_run} or @code{MHD_run_from_select} to +have MHD processed network connections and data. + +Starting the daemon may also fail if a particular option is not +implemented or not supported on the target platform (i.e. no support +for @acronym{TLS}, threads or IPv6). TLS support generally depends on +options given during MHD compilation. + +@table @code +@item MHD_NO_FLAG +No options selected. + +@item MHD_USE_ERROR_LOG +If this flag is used, the library should print error messages and +warnings to stderr (or to custom error printer if it's specified by +options). Note that for this run-time option to have any effect, MHD +needs to be compiled with messages enabled. This is done by default +except you ran configure with the @code{--disable-messages} flag set. + +@item MHD_USE_DEBUG +@cindex debugging +Currently the same as @code{MHD_USE_ERROR_LOG}. + +@item MHD_USE_TLS +@cindex TLS +@cindex SSL +Run in HTTPS-mode. If you specify @code{MHD_USE_TLS} and MHD was +compiled without SSL support, @code{MHD_start_daemon} will return +NULL. + +@item MHD_USE_THREAD_PER_CONNECTION +Run using one thread per connection. + +@item MHD_USE_INTERNAL_POLLING_THREAD +Run using an internal thread doing @code{SELECT}. + +@item MHD_USE_IPv6 +@cindex IPv6 +Run using the IPv6 protocol (otherwise, MHD will just support IPv4). +If you specify @code{MHD_USE_IPV6} and the local platform does not +support it, @code{MHD_start_daemon} will return NULL. + +If you want MHD to support IPv4 and IPv6 using a single socket, pass +MHD_USE_DUAL_STACK, otherwise, if you only pass this option, MHD will +try to bind to IPv6-only (resulting in no IPv4 support). + +@item MHD_USE_DUAL_STACK +@cindex IPv6 +Use a single socket for IPv4 and IPv6. Note that this will mean +that IPv4 addresses are returned by MHD in the IPv6-mapped format +(the 'struct sockaddr_in6' format will be used for IPv4 and IPv6). + +@item MHD_USE_PEDANTIC_CHECKS +@cindex deprecated +Deprecated (use @code{MHD_OPTION_STRICT_FOR_CLIENT}). +Be pedantic about the protocol. +Specifically, at the moment, this flag causes MHD to reject HTTP +1.1 connections without a @code{Host} header. This is required by the +standard, but of course in violation of the ``be as liberal as possible +in what you accept'' norm. It is recommended to turn this @strong{ON} +if you are testing clients against MHD, and @strong{OFF} in +production. + +@item MHD_USE_POLL +@cindex FD_SETSIZE +@cindex poll +@cindex select +Use @code{poll()} instead of @code{select()}. This allows sockets with +descriptors @code{>= FD_SETSIZE}. This option currently only works in +conjunction with @code{MHD_USE_INTERNAL_POLLING_THREAD} (at this point). +If you specify @code{MHD_USE_POLL} and the local platform does not +support it, @code{MHD_start_daemon} will return NULL. + +@item MHD_USE_EPOLL +@cindex FD_SETSIZE +@cindex epoll +@cindex select +Use @code{epoll()} instead of @code{poll()} or @code{select()}. This +allows sockets with descriptors @code{>= FD_SETSIZE}. This option is +only available on some systems and does not work in conjunction with +@code{MHD_USE_THREAD_PER_CONNECTION} (at this point). If you specify +@code{MHD_USE_EPOLL} and the local platform does not support it, +@code{MHD_start_daemon} will return NULL. Using @code{epoll()} +instead of @code{select()} or @code{poll()} can in some situations +result in significantly higher performance as the system call has +fundamentally lower complexity (O(1) for @code{epoll()} vs. O(n) for +@code{select()}/@code{poll()} where n is the number of open +connections). + +@item MHD_USE_TURBO +@cindex performance +Enable optimizations to aggressively improve performance. + +Currently, the optimizations this option enables are based on +opportunistic reads and writes. Bascially, MHD will simply try to +read or write or accept on a socket before checking that the socket is +ready for IO using the event loop mechanism. As the sockets are +non-blocking, this may fail (at a loss of performance), but generally +MHD does this in situations where the operation is likely to succeed, +in which case performance is improved. Setting the flag should generally +be safe (even though the code is slightly more experimental). You may +want to benchmark your application to see if this makes any difference +for you. + + +@item MHD_USE_SUPPRESS_DATE_NO_CLOCK +@cindex date +@cindex clock +@cindex embedded systems +Suppress (automatically) adding the 'Date:' header to HTTP responses. +This option should ONLY be used on systems that do not have a clock +and that DO provide other mechanisms for cache control. See also +RFC 2616, section 14.18 (exception 3). + + +@item MHD_USE_NO_LISTEN_SOCKET +@cindex listen +@cindex proxy +@cindex embedded systems +Run the HTTP server without any listen socket. This option only makes +sense if @code{MHD_add_connection} is going to be used exclusively to +connect HTTP clients to the HTTP server. This option is incompatible +with using a thread pool; if it is used, +@code{MHD_OPTION_THREAD_POOL_SIZE} is ignored. + + +@item MHD_USE_ITC +@cindex quiesce +Force MHD to use a signal inter-thread communication channel to notify +the event loop (of threads) of our shutdown and other events. This is +required if an application uses @code{MHD_USE_INTERNAL_POLLING_THREAD} +and then performs @code{MHD_quiesce_daemon} (which eliminates our +ability to signal termination via the listen socket). In these modes, +@code{MHD_quiesce_daemon} will fail if this option was not set. Also, +use of this option is automatic (as in, you do not even have to +specify it), if @code{MHD_USE_NO_LISTEN_SOCKET} is specified. In +"external" select mode, this option is always simply ignored. + +Using this option also guarantees that MHD will not call +@code{shutdown()} on the listen socket, which means a parent +process can continue to use the socket. + +@item MHD_ALLOW_SUSPEND_RESUME +Enables using @code{MHD_suspend_connection} and +@code{MHD_resume_connection}, as performing these calls requires some +additional inter-thred communication channels to be created, and code +not using these calls should not pay the cost. + +@item MHD_USE_TCP_FASTOPEN +@cindex listen +Enable TCP_FASTOPEN on the listen socket. TCP_FASTOPEN is currently +supported on Linux >= 3.6. On other systems using this option with +cause @code{MHD_start_daemon} to fail. + + +@item MHD_ALLOW_UPGRADE +@cindex upgrade +This option must be set if you want to upgrade connections +(via ``101 Switching Protocols'' responses). This requires MHD to +allocate additional resources, and hence we require this +special flag so we only use the resources that are really needed. + + +@item MHD_USE_AUTO +Automatically select best event loop style (polling function) +depending on requested mode by other MHD flags and functions available +on platform. If application doesn't have requirements for any +specific polling function, it's recommended to use this flag. This +flag is very convenient for multiplatform applications. + +@end table +@end deftp + + +@deftp {Enumeration} MHD_OPTION +MHD options. Passed in the varargs portion of +@code{MHD_start_daemon()}. + +@table @code +@item MHD_OPTION_END +No more options / last option. This is used to terminate the VARARGs +list. + +@item MHD_OPTION_CONNECTION_MEMORY_LIMIT +@cindex memory, limiting memory utilization +Maximum memory size per connection (followed by a @code{size_t}). The +default is 32 kB (32*1024 bytes) as defined by the internal constant +@code{MHD_POOL_SIZE_DEFAULT}. Values above 128k are unlikely to +result in much benefit, as half of the memory will be typically used +for IO, and TCP buffers are unlikely to support window sizes above 64k +on most systems. + +@item MHD_OPTION_CONNECTION_MEMORY_INCREMENT +@cindex memory +Increment to use for growing the read buffer (followed by a +@code{size_t}). The default is 1024 (bytes). Increasing this value +will make MHD use memory for reading more aggressively, which can +reduce the number of @code{recvfrom} calls but may increase the number +of @code{sendto} calls. The given value must fit within +MHD_OPTION_CONNECTION_MEMORY_LIMIT. + +@item MHD_OPTION_CONNECTION_LIMIT +@cindex connection, limiting number of connections +Maximum number of concurrent connections to accept (followed by an +@code{unsigned int}). The default is @code{FD_SETSIZE - 4} (the +maximum number of file descriptors supported by @code{select} minus +four for @code{stdin}, @code{stdout}, @code{stderr} and the server +socket). In other words, the default is as large as possible. + +If the connection limit is reached, MHD's behavior depends a bit on +other options. If @code{MHD_USE_ITC} was given, MHD +will stop accepting connections on the listen socket. This will cause +the operating system to queue connections (up to the @code{listen()} +limit) above the connection limit. Those connections will be held +until MHD is done processing at least one of the active connections. +If @code{MHD_USE_ITC} is not set, then MHD will continue +to @code{accept()} and immediately @code{close()} these connections. + +Note that if you set a low connection limit, you can easily get into +trouble with browsers doing request pipelining. For example, if your +connection limit is ``1'', a browser may open a first connection to +access your ``index.html'' file, keep it open but use a second +connection to retrieve CSS files, images and the like. In fact, modern +browsers are typically by default configured for up to 15 parallel +connections to a single server. If this happens, MHD will refuse to +even accept the second connection until the first connection is +closed --- which does not happen until timeout. As a result, the +browser will fail to render the page and seem to hang. If you expect +your server to operate close to the connection limit, you should +first consider using a lower timeout value and also possibly add +a ``Connection: close'' header to your response to ensure that +request pipelining is not used and connections are closed immediately +after the request has completed: +@example +MHD_add_response_header (response, + MHD_HTTP_HEADER_CONNECTION, + "close"); +@end example + +@item MHD_OPTION_CONNECTION_TIMEOUT +@cindex timeout +After how many seconds of inactivity should a connection automatically +be timed out? (followed by an @code{unsigned int}; use zero for no +timeout). The default is zero (no timeout). + +@item MHD_OPTION_NOTIFY_COMPLETED +Register a function that should be called whenever a request has been +completed (this can be used for application-specific clean up). +Requests that have never been presented to the application (via +@code{MHD_AccessHandlerCallback()}) will not result in +notifications. + +This option should be followed by @strong{TWO} pointers. First a +pointer to a function of type @code{MHD_RequestCompletedCallback()} +and second a pointer to a closure to pass to the request completed +callback. The second pointer maybe @code{NULL}. + +@item MHD_OPTION_NOTIFY_CONNECTION +Register a function that should be called when the TCP connection to a +client is opened or closed. Note that +@code{MHD_OPTION_NOTIFY_COMPLETED} and the @code{con_cls} argument to +the @code{MHD_AccessHandlerCallback} are per HTTP request (and there +can be multiple HTTP requests per TCP connection). The registered +callback is called twice per TCP connection, with +@code{MHD_CONNECTION_NOTIFY_STARTED} and +@code{MHD_CONNECTION_NOTIFY_CLOSED} respectively. An additional +argument can be used to store TCP connection specific information, +which can be retrieved using @code{MHD_CONNECTION_INFO_SOCKET_CONTEXT} +during the lifetime of the TCP connection. The respective location is +not the same as the HTTP-request-specific @code{con_cls} from the +@code{MHD_AccessHandlerCallback}. + +This option should be followed by @strong{TWO} pointers. First a +pointer to a function of type @code{MHD_NotifyConnectionCallback()} +and second a pointer to a closure to pass to the request completed +callback. The second pointer maybe @code{NULL}. + +@item MHD_OPTION_PER_IP_CONNECTION_LIMIT +Limit on the number of (concurrent) connections made to the +server from the same IP address. Can be used to prevent one +IP from taking over all of the allowed connections. If the +same IP tries to establish more than the specified number of +connections, they will be immediately rejected. The option +should be followed by an @code{unsigned int}. The default is +zero, which means no limit on the number of connections +from the same IP address. + +@item MHD_OPTION_LISTEN_BACKLOG_SIZE +Set the size of the @code{listen()} back log queue of the TCP socket. +Takes an @code{unsigned int} as the argument. Default is the +platform-specific value of @code{SOMAXCONN}. + +@item MHD_OPTION_STRICT_FOR_CLIENT +Specify how strict we should enforce the HTTP protocol. +Takes an @code{int} as the argument. Default is zero. + +If set to 1, MHD will be strict about the protocol. Specifically, at +the moment, this flag uses MHD to reject HTTP 1.1 connections without +a "Host" header. This is required by the standard, but of course in +violation of the "be as liberal as possible in what you accept" norm. +It is recommended to set this to 1 if you are testing clients against +MHD, and 0 in production. + +If set to -1 MHD will be permissive about the protocol, allowing +slight deviations that are technically not allowed by the +RFC. Specifically, at the moment, this flag causes MHD to allow spaces +in header field names. This is disallowed by the standard. + +It is not recommended to set it to -1 on publicly available servers as +it may potentially lower level of protection. + + +@item MHD_OPTION_SOCK_ADDR +@cindex bind, restricting bind +Bind daemon to the supplied socket address. This option should be followed by a +@code{struct sockaddr *}. If @code{MHD_USE_IPv6} is specified, +the @code{struct sockaddr*} should point to a @code{struct sockaddr_in6}, +otherwise to a @code{struct sockaddr_in}. If this option is not specified, +the daemon will listen to incoming connections from anywhere. If you use this +option, the 'port' argument from @code{MHD_start_daemon} is ignored and the port +from the given @code{struct sockaddr *} will be used instead. + +@item MHD_OPTION_URI_LOG_CALLBACK +@cindex debugging +@cindex logging +@cindex query string +Specify a function that should be called before parsing the URI from +the client. The specified callback function can be used for processing +the URI (including the options) before it is parsed. The URI after +parsing will no longer contain the options, which maybe inconvenient for +logging. This option should be followed by two arguments, the first +one must be of the form +@example + void * my_logger(void * cls, const char * uri, struct MHD_Connection *con) +@end example +where the return value will be passed as +@code{*con_cls} in calls to the @code{MHD_AccessHandlerCallback} +when this request is processed later; returning a +value of @code{NULL} has no special significance; (however, +note that if you return non-@code{NULL}, you can no longer +rely on the first call to the access handler having +@code{NULL == *con_cls} on entry) +@code{cls} will be set to the second argument following +MHD_OPTION_URI_LOG_CALLBACK. Finally, @code{uri} will +be the 0-terminated URI of the request. + +Note that during the time of this call, most of the connection's state +is not initialized (as we have not yet parsed he headers). However, +information about the connecting client (IP, socket) is available. + +@item MHD_OPTION_HTTPS_MEM_KEY +@cindex SSL +@cindex TLS +Memory pointer to the private key to be used by the +HTTPS daemon. This option should be followed by an +"const char*" argument. +This should be used in conjunction with 'MHD_OPTION_HTTPS_MEM_CERT'. + +@item MHD_OPTION_HTTPS_KEY_PASSWORD +@cindex SSL +@cindex TLS +Memory pointer to the password that decrypts the +private key to be used by the HTTPS daemon. +This option should be followed by an +"const char*" argument. +This should be used in conjunction with 'MHD_OPTION_HTTPS_MEM_KEY'. + +The password (or passphrase) is only used immediately during +@code{MHD_start_daemon()}. Thus, the application may want to +erase it from memory afterwards for additional security. + +@item MHD_OPTION_HTTPS_MEM_CERT +@cindex SSL +@cindex TLS +Memory pointer to the certificate to be used by the +HTTPS daemon. This option should be followed by an +"const char*" argument. +This should be used in conjunction with 'MHD_OPTION_HTTPS_MEM_KEY'. + +@item MHD_OPTION_HTTPS_MEM_TRUST +@cindex SSL +@cindex TLS +Memory pointer to the CA certificate to be used by the +HTTPS daemon to authenticate and trust clients certificates. +This option should be followed by an "const char*" argument. +The presence of this option activates the request of certificate +to the client. The request to the client is marked optional, and +it is the responsibility of the server to check the presence +of the certificate if needed. +Note that most browsers will only present a client certificate +only if they have one matching the specified CA, not sending +any certificate otherwise. + +@item MHD_OPTION_HTTPS_CRED_TYPE +@cindex SSL +@cindex TLS +Daemon credentials type. Either certificate or anonymous, +this option should be followed by one of the values listed in +"enum gnutls_credentials_type_t". + +@item MHD_OPTION_HTTPS_PRIORITIES +@cindex SSL +@cindex TLS +@cindex cipher +SSL/TLS protocol version and ciphers. +This option must be followed by an "const char *" argument +specifying the SSL/TLS protocol versions and ciphers that +are acceptable for the application. The string is passed +unchanged to gnutls_priority_init. If this option is not +specified, ``NORMAL'' is used. + +@item MHD_OPTION_HTTPS_CERT_CALLBACK +@cindex SSL +@cindex TLS +@cindex SNI +Use a callback to determine which X.509 certificate should be used for +a given HTTPS connection. This option should be followed by a +argument of type "gnutls_certificate_retrieve_function2 *". This +option provides an alternative to MHD_OPTION_HTTPS_MEM_KEY and +MHD_OPTION_HTTPS_MEM_CERT. You must use this version if multiple +domains are to be hosted at the same IP address using TLS's Server +Name Indication (SNI) extension. In this case, the callback is +expected to select the correct certificate based on the SNI +information provided. The callback is expected to access the SNI data +using gnutls_server_name_get(). Using this option requires GnuTLS 3.0 +or higher. + +@item MHD_OPTION_DIGEST_AUTH_RANDOM +@cindex digest auth +@cindex random +Digest Authentication nonce's seed. + +This option should be followed by two arguments. First an integer of +type "size_t" which specifies the size of the buffer pointed to by the +second argument in bytes. Note that the application must ensure that +the buffer of the second argument remains allocated and unmodified +while the daemon is running. For security, you SHOULD provide a fresh +random nonce when using MHD with Digest Authentication. + +@item MHD_OPTION_NONCE_NC_SIZE +@cindex digest auth +@cindex replay attack + +Size of an array of nonce and nonce counter map. This option must be +followed by an "unsigned int" argument that have the size (number of +elements) of a map of a nonce and a nonce-counter. If this option +is not specified, a default value of 4 will be used (which might be +too small for servers handling many requests). If you do not use +digest authentication at all, you can specify a value of zero to +save some memory. + +You should calculate the value of NC_SIZE based on the number of +connections per second multiplied by your expected session duration +plus a factor of about two for hash table collisions. For example, if +you expect 100 digest-authenticated connections per second and the +average user to stay on your site for 5 minutes, then you likely need +a value of about 60000. On the other hand, if you can only expect +only 10 digest-authenticated connections per second, tolerate browsers +getting a fresh nonce for each request and expect a HTTP request +latency of 250 ms, then a value of about 5 should be fine. + + +@item MHD_OPTION_LISTEN_SOCKET +@cindex systemd +Listen socket to use. Pass a listen socket for MHD to use +(systemd-style). If this option is used, MHD will not open its own +listen socket(s). The argument passed must be of type "int" and refer +to an existing socket that has been bound to a port and is listening. + +@item MHD_OPTION_EXTERNAL_LOGGER +@cindex logging +Use the given function for logging error messages. +This option must be followed by two arguments; the +first must be a pointer to a function +of type 'void fun(void * arg, const char * fmt, va_list ap)' +and the second a pointer of type 'void*' which will +be passed as the "arg" argument to "fun". + +Note that MHD will not generate any log messages without +the MHD_USE_ERROR_LOG flag set and if MHD was compiled +with the "--disable-messages" flag. + +@item MHD_OPTION_THREAD_POOL_SIZE +@cindex performance +Number (unsigned int) of threads in thread pool. Enable +thread pooling by setting this value to to something +greater than 1. Currently, thread model must be +MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled +(@code{MHD_start_daemon} returns @code{NULL} for an unsupported thread +model). + +@item MHD_OPTION_ARRAY +@cindex options +@cindex foreign-function interface +This option can be used for initializing MHD using options from an +array. A common use for this is writing an FFI for MHD. The actual +options given are in an array of 'struct MHD_OptionItem', so this +option requires a single argument of type 'struct MHD_OptionItem'. +The array must be terminated with an entry @code{MHD_OPTION_END}. + +An example for code using MHD_OPTION_ARRAY is: +@example +struct MHD_OptionItem ops[] = @{ + @{ MHD_OPTION_CONNECTION_LIMIT, 100, NULL @}, + @{ MHD_OPTION_CONNECTION_TIMEOUT, 10, NULL @}, + @{ MHD_OPTION_END, 0, NULL @} +@}; +d = MHD_start_daemon(0, 8080, NULL, NULL, dh, NULL, + MHD_OPTION_ARRAY, ops, + MHD_OPTION_END); +@end example +For options that expect a single pointer argument, the +second member of the @code{struct MHD_OptionItem} is ignored. +For options that expect two pointer arguments, the first +argument must be cast to @code{intptr_t}. + +@item MHD_OPTION_UNESCAPE_CALLBACK +@cindex internationalization +@cindex escaping + +Specify a function that should be called for unescaping escape +sequences in URIs and URI arguments. Note that this function will NOT +be used by the MHD_PostProcessor. If this option is not specified, +the default method will be used which decodes escape sequences of the +form "%HH". This option should be followed by two arguments, the +first one must be of the form + +@example + size_t my_unescaper(void * cls, struct MHD_Connection *c, char *s) +@end example + +where the return value must be @code{strlen(s)} and @code{s} should be +updated. Note that the unescape function must not lengthen @code{s} +(the result must be shorter than the input and still be 0-terminated). +@code{cls} will be set to the second argument following +MHD_OPTION_UNESCAPE_CALLBACK. + + +@item MHD_OPTION_THREAD_STACK_SIZE +@cindex stack +@cindex thread +@cindex pthread +@cindex embedded systems +Maximum stack size for threads created by MHD. This option must be +followed by a @code{size_t}). Not specifying this option or using +a value of zero means using the system default (which is likely to +differ based on your platform). + +@item MHD_OPTION_TCP_FASTQUEUE_QUEUE_SIZE +@cindex listen +When the flag @code{MHD_USE_TCP_FASTOPEN} is used, this option sets the +connection handshake queue size for the TCP FASTOPEN connections. Note +that a TCP FASTOPEN connection handshake occupies more resources than a +TCP handshake as the SYN packets also contain DATA which is kept in the +associate state until handshake is completed. If this option is not +given the queue size is set to a default value of 10. This option must +be followed by a @code{unsigned int}. + +@item MHD_OPTION_HTTPS_MEM_DHPARAMS +@cindex TLS +@cindex SSL +@cindex DH +Memory pointer for the Diffie-Hellman parameters (dh.pem) to be used +by the HTTPS daemon for key exchange. This option must be followed by +a @code{const char *} argument. The argument would be a zero-terminated +string with a PEM encoded PKCS3 DH parameters structure suitable +for passing to @code{gnutls_dh_parms_import_pkcs3}. + +@item MHD_OPTION_LISTENING_ADDRESS_REUSE +@cindex bind, restricting bind +@cindex reusing listening address +This option must be followed by a @code{unsigned int} argument. +If this option is present and true (nonzero) parameter is given, allow reusing +the address:port of the listening socket (using @code{SO_REUSEPORT} on most +platforms, and @code{SO_REUSEADDR} on Windows). If a false (zero) parameter is +given, disallow reusing the the address:port of the listening socket (this +usually requires no special action, but @code{SO_EXCLUSIVEADDRUSE} is needed on +Windows). If this option is not present @code{SO_REUSEADDR} is used on all +platforms except Windows so reusing of address:port is disallowed. + +@end table +@end deftp + + +@deftp {C Struct} MHD_OptionItem +Entry in an MHD_OPTION_ARRAY. See the @code{MHD_OPTION_ARRAY} option +argument for its use. + +The @code{option} member is used to specify which option is specified +in the array. The other members specify the respective argument. + +Note that for options taking only a single pointer, the +@code{ptr_value} member should be set. For options taking two pointer +arguments, the first pointer must be cast to @code{intptr_t} and both +the @code{value} and the @code{ptr_value} members should be used to +pass the two pointers. +@end deftp + + +@deftp {Enumeration} MHD_ValueKind +The @code{MHD_ValueKind} specifies the source of the key-value pairs in +the HTTP protocol. + +@table @code +@item MHD_HEADER_KIND +HTTP header. + +@item MHD_COOKIE_KIND +@cindex cookie +Cookies. Note that the original HTTP header containing the cookie(s) +will still be available and intact. + +@item MHD_POSTDATA_KIND +@cindex POST method +@code{POST} data. This is available only if a content encoding +supported by MHD is used (currently only @acronym{URL} encoding), and +only if the posted content fits within the available memory pool. Note +that in that case, the upload data given to the +@code{MHD_AccessHandlerCallback()} will be empty (since it has +already been processed). + +@item MHD_GET_ARGUMENT_KIND +@code{GET} (URI) arguments. + +@item MHD_FOOTER_KIND +HTTP footer (only for http 1.1 chunked encodings). + +@end table +@end deftp + + +@deftp {Enumeration} MHD_RequestTerminationCode +The @code{MHD_RequestTerminationCode} specifies reasons why a request +has been terminated (or completed). + +@table @code +@item MHD_REQUEST_TERMINATED_COMPLETED_OK +We finished sending the response. + +@item MHD_REQUEST_TERMINATED_WITH_ERROR +Error handling the connection (resources exhausted, other side closed +connection, application error accepting request, etc.) + +@item MHD_REQUEST_TERMINATED_TIMEOUT_REACHED +No activity on the connection for the number of seconds specified using +@code{MHD_OPTION_CONNECTION_TIMEOUT}. + +@item MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN +We had to close the session since MHD was being shut down. +@end table +@end deftp + + +@deftp {Enumeration} MHD_ResponseMemoryMode +The @code{MHD_ResponeMemoryMode} specifies how MHD should treat +the memory buffer given for the response in +@code{MHD_create_response_from_buffer}. + +@table @code +@item MHD_RESPMEM_PERSISTENT +Buffer is a persistent (static/global) buffer that won't change +for at least the lifetime of the response, MHD should just use +it, not free it, not copy it, just keep an alias to it. + +@item MHD_RESPMEM_MUST_FREE +Buffer is heap-allocated with @code{malloc} (or equivalent) and +should be freed by MHD after processing the response has +concluded (response reference counter reaches zero). + +@item MHD_RESPMEM_MUST_COPY +Buffer is in transient memory, but not on the heap (for example, +on the stack or non-malloc allocated) and only valid during the +call to @code{MHD_create_response_from_buffer}. MHD must make its +own private copy of the data for processing. + +@end table +@end deftp + + +@deftp {Enumeration} MHD_ResponseFlags +Response-specific flags. Passed as an argument to +@code{MHD_set_response_options()}. + +@table @code +@item MHD_RF_NONE +No special handling. + +@item MHD_RF_HTTP_VERSION_1_0_ONLY +Only respond in conservative HTTP 1.0-mode. In particular, +do not (automatically) sent "Connection" headers and always +close the connection after generating the response. + +@end table +@end deftp + + +@deftp {Enumeration} MHD_ResponseOptions +Response-specific options. Passed in the varargs portion of +@code{MHD_set_response_options()}. + +@table @code +@item MHD_RO_END +No more options / last option. This is used to terminate the VARARGs +list. +@end table +@end deftp + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-struct +@chapter Structures type definition + + +@deftp {C Struct} MHD_Daemon +Handle for the daemon (listening on a socket for HTTP traffic). +@end deftp + + +@deftp {C Struct} MHD_Connection +Handle for a connection / HTTP request. With HTTP/1.1, multiple +requests can be run over the same connection. However, MHD will only +show one request per TCP connection to the client at any given time. +@end deftp + + +@deftp {C Struct} MHD_Response +Handle for a response. +@end deftp + + +@deftp {C Struct} MHD_PostProcessor +@cindex POST method +Handle for @code{POST} processing. +@end deftp + + +@deftp {C Union} MHD_ConnectionInfo +Information about a connection. +@end deftp + + +@deftp {C Union} MHD_DaemonInfo +Information about an MHD daemon. +@end deftp + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-cb +@chapter Callback functions definition + + +@deftypefn {Function Pointer} int {*MHD_AcceptPolicyCallback} (void *cls, const struct sockaddr * addr, socklen_t addrlen) +Invoked in the context of a connection to allow or deny a client to +connect. This callback return @code{MHD_YES} if connection is allowed, +@code{MHD_NO} if not. + +@table @var +@item cls +custom value selected at callback registration time; +@item addr +address information from the client; +@item addrlen +length of the address information. +@end table +@end deftypefn + + +@deftypefn {Function Pointer} int {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) +Invoked in the context of a connection to answer a request from the +client. This callback must call MHD functions (example: the +@code{MHD_Response} ones) to provide content to give back to the client +and return an HTTP status code (i.e. @code{200} for OK, @code{404}, +etc.). + +@ref{microhttpd-post}, for details on how to code this callback. + +Must return @code{MHD_YES} if the connection was handled successfully, +@code{MHD_NO} if the socket must be closed due to a serious error while +handling the request + +@table @var +@item cls +custom value selected at callback registration time; + +@item url +the URL requested by the client; + +@item method +the HTTP method used by the client (@code{GET}, @code{PUT}, +@code{DELETE}, @code{POST}, etc.); + +@item version +the HTTP version string (i.e. @code{HTTP/1.1}); + +@item upload_data +the data being uploaded (excluding headers): +@cindex POST method +@cindex PUT method + +@code{POST} data @strong{will} be made available +incrementally in @var{upload_data}; even if @code{POST} +data is available, the first time the callback is +invoked there won't be upload data, as this is done +just after MHD parses the headers. If supported by +the client and the HTTP version, the application can +at this point queue an error response to possibly +avoid the upload entirely. If no response is generated, +MHD will (if required) automatically send a 100 CONTINUE +reply to the client. + +Afterwards, POST data will be passed to the callback +to be processed incrementally by the application. The +application may return @code{MHD_NO} to forcefully +terminate the TCP connection without generating a +proper HTTP response. Once all of the upload data has +been provided to the application, the application +will be called again with 0 bytes of upload data. +At this point, a response should be queued to complete +the handling of the request. + +@item upload_data_size +set initially to the size of the @var{upload_data} provided; this +callback must update this value to the number of bytes @strong{NOT} +processed; unless external select is used, the callback maybe +required to process at least some data. If the callback fails to +process data in multi-threaded or internal-select mode and if the +read-buffer is already at the maximum size that MHD is willing to +use for reading (about half of the maximum amount of memory allowed +for the connection), then MHD will abort handling the connection +and return an internal server error to the client. In order to +avoid this, clients must be able to process upload data incrementally +and reduce the value of @code{upload_data_size}. + +@item con_cls +reference to a pointer, initially set to @code{NULL}, that this callback can +set to some address and that will be preserved by MHD for future +calls for this request; + +since the access handler may be called many times (i.e., for a +@code{PUT}/@code{POST} operation with plenty of upload data) this allows +the application to easily associate some request-specific state; + +if necessary, this state can be cleaned up in the global +@code{MHD_RequestCompletedCallback} (which can be set with the +@code{MHD_OPTION_NOTIFY_COMPLETED}). +@end table +@end deftypefn + + +@deftypefn {Function Pointer} void {*MHD_RequestCompletedCallback} (void *cls, struct MHD_Connectionconnection, void **con_cls, enum MHD_RequestTerminationCode toe) +Signature of the callback used by MHD to notify the application about +completed requests. + +@table @var +@item cls +custom value selected at callback registration time; + +@item connection +connection handle; + +@item con_cls +value as set by the last call to the +@code{MHD_AccessHandlerCallback}; + +@item toe +reason for request termination see @code{MHD_OPTION_NOTIFY_COMPLETED}. +@end table +@end deftypefn + + +@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value) +Iterator over key-value pairs. This iterator can be used to iterate +over all of the cookies, headers, or @code{POST}-data fields of a +request, and also to iterate over the headers that have been added to a +response. + +@table @var +@item cls +custom value specified when iteration was triggered; + +@item kind +kind of the header we are looking at + +@item key +key for the value, can be an empty string + +@item value +value corresponding value, can be NULL + +@end table + +Return @code{MHD_YES} to continue iterating, @code{MHD_NO} to abort the +iteration. +@end deftypefn + + +@deftypefn {Function Pointer} int {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max) +Callback used by MHD in order to obtain content. The callback has to +copy at most @var{max} bytes of content into @var{buf}. The total +number of bytes that has been placed into @var{buf} should be returned. + +Note that returning zero will cause MHD to try again. +Thus, returning zero should only be used in conjunction +with @code{MHD_suspend_connection()} to avoid busy waiting. + +While usually the callback simply returns the number of bytes written +into @var{buf}, there are two special return value: + +@code{MHD_CONTENT_READER_END_OF_STREAM} (-1) should be returned +for the regular end of transmission (with chunked encoding, MHD will then +terminate the chunk and send any HTTP footers that might be +present; without chunked encoding and given an unknown +response size, MHD will simply close the connection; note +that while returning @code{MHD_CONTENT_READER_END_OF_STREAM} is not technically +legal if a response size was specified, MHD accepts this +and treats it just as @code{MHD_CONTENT_READER_END_WITH_ERROR}. + +@code{MHD_CONTENT_READER_END_WITH_ERROR} (-2) is used to indicate a server +error generating the response; this will cause MHD to simply +close the connection immediately. If a response size was +given or if chunked encoding is in use, this will indicate +an error to the client. Note, however, that if the client +does not know a response size and chunked encoding is not in +use, then clients will not be able to tell the difference between +@code{MHD_CONTENT_READER_END_WITH_ERROR} and +@code{MHD_CONTENT_READER_END_OF_STREAM}. +This is not a limitation of MHD but rather of the HTTP protocol. + +@table @var +@item cls +custom value selected at callback registration time; + +@item pos +position in the datastream to access; note that if an +@code{MHD_Response} object is re-used, it is possible for the same +content reader to be queried multiple times for the same data; however, +if an @code{MHD_Response} is not re-used, MHD guarantees that +@var{pos} will be the sum of all non-negative return values obtained +from the content reader so far. +@end table + +Return @code{-1} on error (MHD will no longer try to read content and +instead close the connection with the client). +@end deftypefn + + +@deftypefn {Function Pointer} void {*MHD_ContentReaderFreeCallback} (void *cls) +This method is called by MHD if we are done with a content reader. +It should be used to free resources associated with the content reader. +@end deftypefn + + +@deftypefn {Function Pointer} int {*MHD_PostDataIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size) +Iterator over key-value pairs where the value maybe made available in +increments and/or may not be zero-terminated. Used for processing +@code{POST} data. + +@table @var +@item cls +custom value selected at callback registration time; + +@item kind +type of the value; + +@item key +zero-terminated key for the value; + +@item filename +name of the uploaded file, @code{NULL} if not known; + +@item content_type +mime-type of the data, @code{NULL} if not known; + +@item transfer_encoding +encoding of the data, @code{NULL} if not known; + +@item data +pointer to size bytes of data at the specified offset; + +@item off +offset of data in the overall value; + +@item size +number of bytes in data available. +@end table + +Return @code{MHD_YES} to continue iterating, @code{MHD_NO} to abort the +iteration. +@end deftypefn + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-init +@chapter Starting and stopping the server + +@deftypefun {void} MHD_set_panic_func (MHD_PanicCallback cb, void *cls) +Set a handler for fatal errors. + +@table @var +@item cb +function to call if MHD encounters a fatal internal error. If no handler was set explicitly, MHD will call @code{abort}. + +@item cls +closure argument for cb; the other arguments are the name of the source file, line number and a string describing the nature of the fatal error (which can be @code{NULL}) +@end table +@end deftypefun + +@deftypefun {struct MHD_Daemon *} MHD_start_daemon (unsigned int flags, unsigned short port, MHD_AcceptPolicyCallback apc, void *apc_cls, MHD_AccessHandlerCallback dh, void *dh_cls, ...) +Start a webserver on the given port. + +@table @var +@item flags +OR-ed combination of @code{MHD_FLAG} values; + +@item port +port to bind to; + +@item apc +callback to call to check which clients will be allowed to connect; you +can pass @code{NULL} in which case connections from any @acronym{IP} will be +accepted; + +@item apc_cls +extra argument to @var{apc}; + +@item dh +default handler for all URIs; + +@item dh_cls +extra argument to @var{dh}. +@end table + +Additional arguments are a list of options (type-value pairs, +terminated with @code{MHD_OPTION_END}). It is mandatory to use +@code{MHD_OPTION_END} as last argument, even when there are no +additional arguments. + +Return @code{NULL} on error, handle to daemon on success. +@end deftypefun + + +@deftypefun int MHD_quiesce_daemon (struct MHD_Daemon *daemon) +@cindex quiesce +Stop accepting connections from the listening socket. Allows clients +to continue processing, but stops accepting new connections. Note +that the caller is responsible for closing the returned socket; +however, if MHD is run using threads (anything but external select +mode), it must not be closed until AFTER @code{MHD_stop_daemon} has +been called (as it is theoretically possible that an existing thread +is still using it). + +This function is useful in the special case that a listen socket +is to be migrated to another process (i.e. a newer version of the +HTTP server) while existing connections should continue to be +processed until they are finished. + +Return @code{-1} on error (daemon not listening), the handle to the +listen socket otherwise. + +@end deftypefun + + +@deftypefun void MHD_stop_daemon (struct MHD_Daemon *daemon) +Shutdown an HTTP daemon. +@end deftypefun + + +@deftypefun int MHD_run (struct MHD_Daemon *daemon) +Run webserver operations (without blocking unless in client callbacks). +This method should be called by clients in combination with +@code{MHD_get_fdset()} if the client-controlled @code{select}-method is used. +@cindex select +@cindex poll + +This function will work for external @code{poll} and @code{select} mode. +However, if using external @code{select} mode, you may want to +instead use @code{MHD_run_from_select}, as it is more efficient. + +@table @var +@item daemon +daemon to process connections of +@end table + +Return @code{MHD_YES} on success, @code{MHD_NO} if this daemon was not +started with the right options for this call. +@end deftypefun + + +@deftypefun int MHD_run_from_select (struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, const fd_set *except_fd_set) +Run webserver operations given sets of ready socket handles. +@cindex select + +This method should be called by clients in combination with +@code{MHD_get_fdset} if the client-controlled (external) +select method is used. + +You can use this function instead of @code{MHD_run} if you called +@code{select} on the result from @code{MHD_get_fdset}. File descriptors in +the sets that are not controlled by MHD will be ignored. Calling +this function instead of @code{MHD_run} is more efficient as MHD will +not have to call @code{select} again to determine which operations are +ready. + +@table @var +@item daemon +daemon to process connections of +@item read_fd_set +set of descriptors that must be ready for reading without blocking +@item write_fd_set +set of descriptors that must be ready for writing without blocking +@item except_fd_set +ignored, can be NULL +@end table + +Return @code{MHD_YES} on success, @code{MHD_NO} on serious internal +errors. + +@end deftypefun + + + +@deftypefun void MHD_add_connection (struct MHD_Daemon *daemon, int client_socket, const struct sockaddr *addr, socklen_t addrlen) +Add another client connection to the set of connections +managed by MHD. This API is usually not needed (since +MHD will accept inbound connections on the server socket). +Use this API in special cases, for example if your HTTP +server is behind NAT and needs to connect out to the +HTTP client, or if you are building a proxy. + +If you use this API in conjunction with a internal select or a thread +pool, you must set the option @code{MHD_USE_ITC} to +ensure that the freshly added connection is immediately processed by +MHD. + +The given client socket will be managed (and closed!) by MHD after +this call and must no longer be used directly by the application +afterwards. + +@table @var +@item daemon +daemon that manages the connection +@item client_socket +socket to manage (MHD will expect to receive an HTTP request from this socket next). +@item addr +IP address of the client +@item addrlen +number of bytes in addr +@end table + +This function will return @code{MHD_YES} on success, +@code{MHD_NO} if this daemon could +not handle the connection (i.e. malloc failed, etc). +The socket will be closed in any case; 'errno' is set +to indicate further details about the error. +@end deftypefun + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ----------------------------------------------------------- +@node microhttpd-inspect +@chapter Implementing external @code{select} + + +@deftypefun int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd) +Obtain the @code{select()} sets for this daemon. The daemon's socket +is added to @var{read_fd_set}. The list of currently existent +connections is scanned and their file descriptors added to the correct +set. + +When calling this function, FD_SETSIZE is assumed to be platform's +default. If you changed FD_SETSIZE for your application, +you should use @code{MHD_get_fdset2()} instead. + +This function should only be called in when MHD is configured to use +external select with @code{select()} or with @code{epoll()}. In +the latter case, it will only add the single @code{epoll()} file +descriptor used by MHD to the sets. + +After the call completed successfully: the variable referenced by +@var{max_fd} references the file descriptor with highest integer +identifier. The variable must be set to zero before invoking this +function. + +Return @code{MHD_YES} on success, @code{MHD_NO} if: the arguments are +invalid (example: @code{NULL} pointers); this daemon was not started with +the right options for this call. +@end deftypefun + + +@deftypefun int MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, unsigned int fd_setsize) +Like @code{MHD_get_fdset()}, except that you can manually specify the value of FD_SETSIZE used by your application. +@end deftypefun + + +@deftypefun int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) +@cindex timeout +Obtain timeout value for select for this daemon (only needed if +connection timeout is used). The returned value is how many +milliseconds @code{select} should at most block, not the timeout value +set for connections. This function must not be called if the +@code{MHD_USE_THREAD_PER_CONNECTION} mode is in use (since then it is +not meaningful to ask for a timeout, after all, there is concurrenct +activity). The function must also not be called by user-code if +@code{MHD_USE_INTERNAL_POLLING_THREAD} is in use. In the latter case, the +behavior is undefined. + +@table @var +@item daemon +which daemon to obtain the timeout from. +@item timeout +will be set to the timeout (in milliseconds). +@end table + +Return @code{MHD_YES} on success, @code{MHD_NO} if timeouts are not used +(or no connections exist that would necessiate the use of a timeout +right now). +@end deftypefun + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ----------------------------------------------------------- +@node microhttpd-requests +@chapter Handling requests + + +@deftypefun int MHD_get_connection_values (struct MHD_Connection *connection, enum MHD_ValueKind kind, MHD_KeyValueIterator iterator, void *iterator_cls) +Get all the headers matching @var{kind} from the request. The @var{kind} +argument can be a bitmask, ORing the various header kinds that are +requested. + +The @var{iterator} callback is invoked once for each header, with +@var{iterator_cls} as first argument. After version 0.9.19, the +headers are iterated in the same order as they were received from +the network; previous versions iterated over the headers in reverse +order. + +@code{MHD_get_connection_values} returns the number of entries +iterated over; this can be less than the number of headers if, while +iterating, @var{iterator} returns @code{MHD_NO}. + +@var{iterator} can be @code{NULL}: in this case this function just counts +and returns the number of headers. + +In the case of @code{MHD_GET_ARGUMENT_KIND}, the @var{value} argument +will be @code{NULL} if the URL contained a key without an equals operator. +For example, for a HTTP request to the URL ``http://foo/bar?key'', the +@var{value} argument is @code{NULL}; in contrast, a HTTP request to the URL +``http://foo/bar?key='', the @var{value} argument is the empty string. +The normal case is that the URL contains ``http://foo/bar?key=value'' +in which case @var{value} would be the string ``value'' and @var{key} +would contain the string ``key''. +@end deftypefun + + +@deftypefun int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value) +This function can be used to append an entry to +the list of HTTP headers of a connection (so that the +@code{MHD_get_connection_values function} will return +them -- and the MHD PostProcessor will also +see them). This maybe required in certain +situations (see Mantis #1399) where (broken) +HTTP implementations fail to supply values needed +by the post processor (or other parts of the +application). + +This function MUST only be called from within +the MHD_AccessHandlerCallback (otherwise, access +maybe improperly synchronized). Furthermore, +the client must guarantee that the key and +value arguments are 0-terminated strings that +are NOT freed until the connection is closed. +(The easiest way to do this is by passing only +arguments to permanently allocated strings.). + +@var{connection} is the connection for which +the entry for @var{key} of the given @var{kind} +should be set to the given @var{value}. + +The function returns @code{MHD_NO} if the operation +could not be performed due to insufficient memory +and @code{MHD_YES} on success. +@end deftypefun + + +@deftypefun {const char *} MHD_lookup_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key) +Get a particular header value. If multiple values match the +@var{kind}, return one of them (the ``first'', whatever that means). +@var{key} must reference a zero-terminated ASCII-coded string +representing the header to look for: it is compared against the +headers using @code{strcasecmp()}, so case is ignored. A value of +@code{NULL} for @var{key} can be used to lookup 'trailing' values without a +key, for example if a URI is of the form +``http://example.com/?trailer'', a @var{key} of @code{NULL} can be used to +access ``tailer" The function returns @code{NULL} if no matching item +was found. +@end deftypefun + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-responses +@chapter Building responses to requests + + +@noindent +Response objects handling by MHD is asynchronous with respect to the +application execution flow. Instances of the @code{MHD_Response} +structure are not associated to a daemon and neither to a client +connection: they are managed with reference counting. + +In the simplest case: we allocate a new @code{MHD_Response} structure +for each response, we use it once and finally we destroy it. + +MHD allows more efficient resources usages. + +Example: we allocate a new @code{MHD_Response} structure for each +response @strong{kind}, we use it every time we have to give that +response and we finally destroy it only when the daemon shuts down. + +@menu +* microhttpd-response enqueue:: Enqueuing a response. +* microhttpd-response create:: Creating a response object. +* microhttpd-response headers:: Adding headers to a response. +* microhttpd-response options:: Setting response options. +* microhttpd-response inspect:: Inspecting a response object. +* microhttpd-response upgrade:: Creating a response for protocol upgrades. +@end menu + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-response enqueue +@section Enqueuing a response + + +@deftypefun int MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response) +Queue a response to be transmitted to the client as soon as possible +but only after MHD_AccessHandlerCallback returns. This function +checks that it is legal to queue a response at this time for the +given connection. It also increments the internal reference +counter for the response object (the counter will be decremented +automatically once the response has been transmitted). + +@table @var +@item connection +the connection identifying the client; + +@item status_code +HTTP status code (i.e. @code{200} for OK); + +@item response +response to transmit. +@end table + +Return @code{MHD_YES} on success or if message has been queued. Return +@code{MHD_NO}: if arguments are invalid (example: @code{NULL} pointer); on +error (i.e. reply already sent). +@end deftypefun + + +@deftypefun void MHD_destroy_response (struct MHD_Response *response) +Destroy a response object and associated resources (decrement the +reference counter). Note that MHD may keep some of the resources +around if the response is still in the queue for some clients, so the +memory may not necessarily be freed immediately. +@end deftypefun + + +An explanation of reference counting@footnote{Note to readers acquainted +to the Tcl API: reference counting on @code{MHD_Connection} +structures is handled in the same way as Tcl handles @code{Tcl_Obj} +structures through @code{Tcl_IncrRefCount()} and +@code{Tcl_DecrRefCount()}.}: + +@enumerate +@item +a @code{MHD_Response} object is allocated: + +@example +struct MHD_Response * response = MHD_create_response_from_buffer(...); +/* here: reference counter = 1 */ +@end example + +@item +the @code{MHD_Response} object is enqueued in a @code{MHD_Connection}: + +@example +MHD_queue_response(connection, , response); +/* here: reference counter = 2 */ +@end example + +@item +the creator of the response object discharges responsibility for it: + +@example +MHD_destroy_response(response); +/* here: reference counter = 1 */ +@end example + +@item +the daemon handles the connection sending the response's data to the +client then decrements the reference counter by calling +@code{MHD_destroy_response()}: the counter's value drops to zero and +the @code{MHD_Response} object is released. +@end enumerate + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-response create +@section Creating a response object + + +@deftypefun {struct MHD_Response *} MHD_create_response_from_callback (uint64_t size, size_t block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback crfc) +Create a response object. The response object can be extended with +header information and then it can be used any number of times. + +@table @var +@item size +size of the data portion of the response, @code{-1} for unknown; + +@item block_size +preferred block size for querying @var{crc} (advisory only, MHD may +still call @var{crc} using smaller chunks); this is essentially the +buffer size used for @acronym{IO}, clients should pick a value that is +appropriate for @acronym{IO} and memory performance requirements; + +@item crc +callback to use to obtain response data; + +@item crc_cls +extra argument to @var{crc}; + +@item crfc +callback to call to free @var{crc_cls} resources. +@end table + +Return @code{NULL} on error (i.e. invalid arguments, out of memory). +@end deftypefun + + + +@deftypefun {struct MHD_Response *} MHD_create_response_from_fd (uint64_t size, int fd) +Create a response object. The response object can be extended with +header information and then it can be used any number of times. + +@table @var +@item size +size of the data portion of the response (should be smaller or equal to the +size of the file) + +@item fd +file descriptor referring to a file on disk with the data; will be +closed when response is destroyed; note that 'fd' must be an actual +file descriptor (not a pipe or socket) since MHD might use 'sendfile' +or 'seek' on it. The descriptor should be in blocking-IO mode. +@end table + +Return @code{NULL} on error (i.e. invalid arguments, out of memory). +@end deftypefun + + +@deftypefun {struct MHD_Response *} MHD_create_response_from_fd_at_offset (size_t size, int fd, off_t offset) +Create a response object. The response object can be extended with +header information and then it can be used any number of times. +Note that you need to be a bit careful about @code{off_t} when +writing this code. Depending on your platform, MHD is likely +to have been compiled with support for 64-bit files. When you +compile your own application, you must make sure that @code{off_t} +is also a 64-bit value. If not, your compiler may pass a 32-bit +value as @code{off_t}, which will result in 32-bits of garbage. + +If you use the autotools, use the @code{AC_SYS_LARGEFILE} autoconf +macro and make sure to include the generated @file{config.h} file +before @file{microhttpd.h} to avoid problems. If you do not have a +build system and only want to run on a GNU/Linux system, you could +also use +@verbatim +#define _FILE_OFFSET_BITS 64 +#include +#include +#include +#include +@end verbatim +to ensure 64-bit @code{off_t}. Note that if your operating system +does not support 64-bit files, MHD will be compiled with a 32-bit +@code{off_t} (in which case the above would be wrong). + +@table @var +@item size +size of the data portion of the response (number of bytes to transmit from the +file starting at offset). + +@item fd +file descriptor referring to a file on disk with the data; will be +closed when response is destroyed; note that 'fd' must be an actual +file descriptor (not a pipe or socket) since MHD might use 'sendfile' +or 'seek' on it. The descriptor should be in blocking-IO mode. + +@item offset +offset to start reading from in the file +@end table + +Return @code{NULL} on error (i.e. invalid arguments, out of memory). +@end deftypefun + + +@deftypefun {struct MHD_Response *} MHD_create_response_from_buffer (size_t size, void *data, enum MHD_ResponseMemoryMode mode) +Create a response object. The response object can be extended with +header information and then it can be used any number of times. + +@table @var +@item size +size of the data portion of the response; + +@item buffer +the data itself; + +@item mode +memory management options for buffer; use +MHD_RESPMEM_PERSISTENT if the buffer is static/global memory, +use MHD_RESPMEM_MUST_FREE if the buffer is heap-allocated and +should be freed by MHD and MHD_RESPMEM_MUST_COPY if the +buffer is in transient memory (i.e. on the stack) and must +be copied by MHD; +@end table + +Return @code{NULL} on error (i.e. invalid arguments, out of memory). +@end deftypefun + + +@deftypefun {struct MHD_Response *} MHD_create_response_from_data (size_t size, void *data, int must_free, int must_copy) +Create a response object. The response object can be extended with +header information and then it can be used any number of times. +This function is deprecated, use @code{MHD_create_response_from_buffer} instead. + +@table @var +@item size +size of the data portion of the response; + +@item data +the data itself; + +@item must_free +if true: MHD should free data when done; + +@item must_copy +if true: MHD allocates a block of memory and use it to make a copy of +@var{data} embedded in the returned @code{MHD_Response} structure; +handling of the embedded memory is responsibility of MHD; @var{data} +can be released anytime after this call returns. +@end table + +Return @code{NULL} on error (i.e. invalid arguments, out of memory). +@end deftypefun + + +Example: create a response from a statically allocated string: + +@example +const char * data = "

Error!

"; + +struct MHD_Connection * connection = ...; +struct MHD_Response * response; + +response = MHD_create_response_from_buffer (strlen(data), data, + MHD_RESPMEM_PERSISTENT); +MHD_queue_response(connection, 404, response); +MHD_destroy_response(response); +@end example + + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-response headers +@section Adding headers to a response + + +@deftypefun int MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content) +Add a header line to the response. The strings referenced by +@var{header} and @var{content} must be zero-terminated and they are +duplicated into memory blocks embedded in @var{response}. + +Notice that the strings must not hold newlines, carriage returns or tab +chars. + +Return @code{MHD_NO} on error (i.e. invalid header or content format or +memory allocation error). +@end deftypefun + + +@deftypefun int MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content) +Add a footer line to the response. The strings referenced by +@var{footer} and @var{content} must be zero-terminated and they are +duplicated into memory blocks embedded in @var{response}. + +Notice that the strings must not hold newlines, carriage returns or tab +chars. You can add response footers at any time before signalling the +end of the response to MHD (not just before calling 'MHD_queue_response'). +Footers are useful for adding cryptographic checksums to the reply or to +signal errors encountered during data generation. This call was introduced +in MHD 0.9.3. + +Return @code{MHD_NO} on error (i.e. invalid header or content format or +memory allocation error). +@end deftypefun + + + +@deftypefun int MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) +Delete a header (or footer) line from the response. Return @code{MHD_NO} on error +(arguments are invalid or no such header known). +@end deftypefun + + +@c ------------------------------------------------------------ +@node microhttpd-response options +@section Setting response options + + +@deftypefun int MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...) +Set special flags and options for a response. + +Calling this functions sets the given flags and options for the response. + +@table @var +@item response +which response should be modified; + +@item flags +flags to set for the response; + +@end table + +Additional arguments are a list of options (type-value pairs, +terminated with @code{MHD_RO_END}). It is mandatory to use +@code{MHD_RO_END} as last argument, even when there are no +additional arguments. + +Return @code{MHD_NO} on error, @code{MHD_YES} on success. +@end deftypefun + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-response inspect +@section Inspecting a response object + + +@deftypefun int MHD_get_response_headers (struct MHD_Response *response, MHD_KeyValueIterator iterator, void *iterator_cls) +Get all of the headers added to a response. + +Invoke the @var{iterator} callback for each header in the response, +using @var{iterator_cls} as first argument. Return number of entries +iterated over. @var{iterator} can be @code{NULL}: in this case the function +just counts headers. + +@var{iterator} should not modify the its key and value arguments, unless +we know what we are doing. +@end deftypefun + + +@deftypefun {const char *} MHD_get_response_header (struct MHD_Response *response, const char *key) +Find and return a pointer to the value of a particular header from the +response. @var{key} must reference a zero-terminated string +representing the header to look for. The search is case sensitive. +Return @code{NULL} if header does not exist or @var{key} is @code{NULL}. + +We should not modify the value, unless we know what we are doing. +@end deftypefun + + +@c ------------------------------------------------------------ +@node microhttpd-response upgrade +@section Creating a response for protocol upgrades +@cindex WebSockets +@cindex Upgrade +@cindex HTTP2 +@cindex RFC2817 + +With RFC 2817 a mechanism to switch protocols within HTTP was +introduced. Here, a client sends a request with a ``Connection: +Upgrade'' header. The server responds with a ``101 Switching +Protocols'' response header, after which the two parties begin to +speak a different (non-HTTP) protocol over the TCP connection. + +This mechanism is used for upgrading HTTP 1.1 connections to HTTP2 or +HTTPS, as well as for implementing WebSockets. Which protocol +upgrade is performed is negotiated between server and client in +additional headers, in particular the ``Upgrade'' header. + +MHD supports switching protocols using this mechanism only if the +@code{MHD_ALLOW_SUSPEND_RESUME} flag has been set when starting +the daemon. If this flag has been set, applications can upgrade +a connection by queueing a response (using the +@code{MHD_HTTP_SWITCHING_PROTOCOLS} status code) which must +have been created with the following function: + + +@deftypefun int MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls) +Create a response suitable for switching protocols. Returns @code{MHD_YES} on success. @code{upgrade_handler} must not be @code{NULL}. + +When creating this type of response, the ``Connection: Upgrade'' +header will be set automatically for you. MHD requires that you +additionally set an ``Upgrade:'' header. The ``Upgrade'' header +must simply exist, the specific value is completely up to the +application. + +@end deftypefun + +The @code{upgrade_handler} argument to the above has the following type: + + +@deftypefn {Function Pointer} void {*MHD_UpgradeHandler} (void *cls, struct MHD_Connection *connection, const char *extra_in, size_t extra_in_size, MHD_socket sock, struct MHD_UpgradeResponseHandle *urh) +This function will be called once MHD has transmitted the header of the response to the connection that is being upgraded. At this point, the application is expected to take over the socket @code{sock} and speak the non-HTTP protocol to which the connection was upgraded. MHD will no longer use the socket; this includes handling timeouts. The application must call @code{MHD_upgrade_action} with an upgrade action of @code{MHD_UPGRADE_ACTION_CLOSE} when it is done processing the connection to close the socket. The application must not call @code{MHD_stop_daemon} on the respective daemon as long as it is still handling the connection. The arguments given to the @code{upgrade_handler} have the following meaning: + +@table @var +@item cls +matches the @code{upgrade_handler_cls} that was given to @code{MHD_create_response_for_upgrade} +@item connection +identifies the connection that is being upgraded; + +@item con_cls +last value left in `*con_cls` in the `MHD_AccessHandlerCallback` + +@item extra_in +buffer of bytes MHD read ``by accident'' from the socket already. This can happen if the client eagerly transmits more than just the HTTP request. The application should treat these as if it had read them from the socket. + +@item extra_in_size +number of bytes in @code{extra_in} + +@item sock +the socket which the application can now use directly for some bi-directional communication with the client. The application can henceforth use @code{recv()} and @code{send()} or @code{read()} and @code{write()} system calls on the socket. However, @code{ioctl()} and @code{setsockopt()} functions will not work as expected when using HTTPS. Such operations may be supported in the future via @code{MHD_upgrade_action}. Most importantly, the application must never call @code{close()} on this socket. Closing the socket must be done using @code{MHD_upgrade_action}. However, while close is forbidden, the application may call @code{shutdown()} on the socket. + +@item urh +argument for calls to @code{MHD_upgrade_action}. Applications must eventually use this function to perform the @code{close()} action on the socket. +@end table + +@end deftypefn + +@deftypefun int MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...) +Perform special operations related to upgraded connections. + +@table @var +@item urh +identifies the upgraded connection to perform an action on + +@item action +specifies the action to perform; further arguments to the function depend on the specifics of the action. +@end table + +@end deftypefun + + +@deftp {Enumeration} MHD_UpgradeAction +Set of actions to be performed on upgraded connections. Passed as an argument to +@code{MHD_upgrade_action()}. + +@table @code +@item MHD_UPGRADE_ACTION_CLOSE +Closes the connection. Must be called once the application is done with the client. Takes no additional arguments. + +@end table +@end deftp + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-flow +@chapter Flow control. + +@noindent +Sometimes it may be possible that clients upload data faster +than an application can process it, or that an application +needs an extended period of time to generate a response. +If @code{MHD_USE_THREAD_PER_CONNECTION} is used, applications +can simply deal with this by performing their logic within the +thread and thus effectively blocking connection processing +by MHD. In all other modes, blocking logic must not be +placed within the callbacks invoked by MHD as this would also +block processing of other requests, as a single thread may be +responsible for tens of thousands of connections. + +Instead, applications using thread modes other than +@code{MHD_USE_THREAD_PER_CONNECTION} should use the +following functions to perform flow control. + +@deftypefun int MHD_suspend_connection (struct MHD_Connection *connection) +Suspend handling of network data for a given connection. This can +be used to dequeue a connection from MHD's event loop (external +select, internal select or thread pool; not applicable to +thread-per-connection!) for a while. + +If you use this API in conjunction with a internal select or a +thread pool, you must set the option @code{MHD_ALLOW_SUSPEND_RESUME} to +ensure that a resumed connection is immediately processed by MHD. + +Suspended connections continue to count against the total number of +connections allowed (per daemon, as well as per IP, if such limits +are set). Suspended connections will NOT time out; timeouts will +restart when the connection handling is resumed. While a +connection is suspended, MHD will not detect disconnects by the +client. + +The only safe time to suspend a connection is from the +@code{MHD_AccessHandlerCallback} or from the respective +@code{MHD_ContentReaderCallback} (but in this case the +response object must not be shared among multiple +connections). + +Finally, it is an API violation to call @code{MHD_stop_daemon} while +having suspended connections (this will at least create memory and +socket leaks or lead to undefined behavior). You must explicitly +resume all connections before stopping the daemon. + +@table @var +@item connection +the connection to suspend +@end table +@end deftypefun + +@deftypefun int MHD_resume_connection (struct MHD_Connection *connection) +Resume handling of network data for suspended connection. It is safe +to resume a suspended connection at any time. Calling this function +on a connection that was not previously suspended will result in +undefined behavior. + +If you are using this function in ``external'' select mode, you must +make sure to run @code{MHD_run} afterwards (before again calling +@code{MHD_get_fdset}), as otherwise the change may not be reflected in +the set returned by @code{MHD_get_fdset} and you may end up with a +connection that is stuck until the next network activity. + +You can check whether a connection is currently suspended using +@code{MHD_get_connection_info} by querying for +@code{MHD_CONNECTION_INFO_CONNECTION_SUSPENDED}. + +@table @var +@item connection +the connection to resume +@end table +@end deftypefun + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-dauth +@chapter Utilizing Authentication + +@noindent +MHD support three types of client authentication. + +Basic authentication uses a simple authentication method based +on BASE64 algorithm. Username and password are exchanged in clear +between the client and the server, so this method must only be used +for non-sensitive content or when the session is protected with https. +When using basic authentication MHD will have access to the clear +password, possibly allowing to create a chained authentication +toward an external authentication server. + +Digest authentication uses a one-way authentication method based +on MD5 hash algorithm. Only the hash will transit over the network, +hence protecting the user password. The nonce will prevent replay +attacks. This method is appropriate for general use, especially +when https is not used to encrypt the session. + +Client certificate authentication uses a X.509 certificate from +the client. This is the strongest authentication mechanism but it +requires the use of HTTPS. Client certificate authentication can +be used simultaneously with Basic or Digest Authentication in order +to provide a two levels authentication (like for instance separate +machine and user authentication). A code example for using +client certificates is presented in the MHD tutorial. + +@menu +* microhttpd-dauth basic:: Using Basic Authentication. +* microhttpd-dauth digest:: Using Digest Authentication. +@end menu + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-dauth basic +@section Using Basic Authentication + +@deftypefun {void} MHD_free (void *ptr) +Free the memory given at @code{ptr}. Used to free data structures allocated by MHD. Calls @code{free(ptr)}. +@end deftypefun + +@deftypefun {char *} MHD_basic_auth_get_username_password (struct MHD_Connection *connection, char** password) +Get the username and password from the basic authorization header sent by the client. +Return @code{NULL} if no username could be found, a pointer to the username if found. +If returned value is not @code{NULL}, the value must be @code{MHD_free()}'ed. + +@var{password} reference a buffer to store the password. It can be @code{NULL}. +If returned value is not @code{NULL}, the value must be @code{MHD_free()}'ed. +@end deftypefun + +@deftypefun {int} MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, const char *realm, struct MHD_Response *response) +Queues a response to request basic authentication from the client. +Return @code{MHD_YES} if successful, otherwise @code{MHD_NO}. + +@var{realm} must reference to a zero-terminated string representing the realm. + +@var{response} a response structure to specify what shall be presented to the +client with a 401 HTTP status. +@end deftypefun + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-dauth digest +@section Using Digest Authentication + +@deftypefun {char *} MHD_digest_auth_get_username (struct MHD_Connection *connection) +Find and return a pointer to the username value from the request header. +Return @code{NULL} if the value is not found or header does not exist. +If returned value is not @code{NULL}, the value must be @code{MHD_free()}'ed. +@end deftypefun + +@deftypefun int MHD_digest_auth_check (struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout) +Checks if the provided values in the WWW-Authenticate header are valid +and sound according to RFC2716. If valid return @code{MHD_YES}, otherwise return @code{MHD_NO}. + +@var{realm} must reference to a zero-terminated string representing the realm. + +@var{username} must reference to a zero-terminated string representing the username, +it is usually the returned value from MHD_digest_auth_get_username. + +@var{password} must reference to a zero-terminated string representing the password, +most probably it will be the result of a lookup of the username against a local database. + +@var{nonce_timeout} is the amount of time in seconds for a nonce to be invalid. +Most of the time it is sound to specify 300 seconds as its values. +@end deftypefun + +@deftypefun int MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale) +Queues a response to request authentication from the client, +return @code{MHD_YES} if successful, otherwise @code{MHD_NO}. + +@var{realm} must reference to a zero-terminated string representing the realm. + +@var{opaque} must reference to a zero-terminated string representing a value +that gets passed to the client and expected to be passed again to the server +as-is. This value can be a hexadecimal or base64 string. + +@var{response} a response structure to specify what shall be presented to the +client with a 401 HTTP status. + +@var{signal_stale} a value that signals "stale=true" in the response header to +indicate the invalidity of the nonce and no need to ask for authentication +parameters and only a new nonce gets generated. @code{MHD_YES} to generate a new +nonce, @code{MHD_NO} to ask for authentication parameters. +@end deftypefun + +Example: handling digest authentication requests and responses. + +@example +#define PAGE "libmicrohttpd demoAccess granted" +#define DENIED "libmicrohttpd demoAccess denied" +#define OPAQUE "11733b200778ce33060f31c9af70a870ba96ddd4" + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +@{ + struct MHD_Response *response; + char *username; + const char *password = "testpass"; + const char *realm = "test@@example.com"; + int ret; + + username = MHD_digest_auth_get_username(connection); + if (username == NULL) + @{ + response = MHD_create_response_from_buffer(strlen (DENIED), + DENIED, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_auth_fail_response(connection, realm, + OPAQUE, + response, + MHD_NO); + MHD_destroy_response(response); + return ret; + @} + ret = MHD_digest_auth_check(connection, realm, + username, + password, + 300); + free(username); + if ( (ret == MHD_INVALID_NONCE) || + (ret == MHD_NO) ) + @{ + response = MHD_create_response_from_buffer(strlen (DENIED), + DENIED, + MHD_RESPMEM_PERSISTENT); + if (NULL == response) + return MHD_NO; + ret = MHD_queue_auth_fail_response(connection, realm, + OPAQUE, + response, + (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); + MHD_destroy_response(response); + return ret; + @} + response = MHD_create_response_from_buffer (strlen(PAGE), PAGE, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + MHD_destroy_response(response); + return ret; +@} +@end example + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-post +@chapter Adding a @code{POST} processor +@cindex POST method + +@menu +* microhttpd-post api:: Programming interface for the + @code{POST} processor. +@end menu + + +@noindent +MHD provides the post processor API to make it easier for applications to +parse the data of a client's @code{POST} request: the +@code{MHD_AccessHandlerCallback} will be invoked multiple times to +process data as it arrives; at each invocation a new chunk of data must +be processed. The arguments @var{upload_data} and @var{upload_data_size} +are used to reference the chunk of data. + +When @code{MHD_AccessHandlerCallback} is invoked for a new connection: +its @code{*@var{con_cls}} argument is set to @code{NULL}. When @code{POST} +data comes in the upload buffer it is @strong{mandatory} to use the +@var{con_cls} to store a reference to per-connection data. The fact +that the pointer was initially @code{NULL} can be used to detect that +this is a new request. + +One method to detect that a new connection was established is +to set @code{*con_cls} to an unused integer: + +@example +int +access_handler (void *cls, + struct MHD_Connection * connection, + const char *url, + const char *method, const char *version, + const char *upload_data, size_t *upload_data_size, + void **con_cls) +@{ + static int old_connection_marker; + int new_connection = (NULL == *con_cls); + + if (new_connection) + @{ + /* new connection with POST */ + *con_cls = &old_connection_marker; + @} + + ... +@} +@end example + +@noindent +In contrast to the previous example, for @code{POST} requests in particular, +it is more common to use the value of @code{*con_cls} to keep track of +actual state used during processing, such as the post processor (or a +struct containing a post processor): + +@example +int +access_handler (void *cls, + struct MHD_Connection * connection, + const char *url, + const char *method, const char *version, + const char *upload_data, size_t *upload_data_size, + void **con_cls) +@{ + struct MHD_PostProcessor * pp = *con_cls; + + if (pp == NULL) + @{ + pp = MHD_create_post_processor(connection, ...); + *con_cls = pp; + return MHD_YES; + @} + if (*upload_data_size) + @{ + MHD_post_process(pp, upload_data, *upload_data_size); + *upload_data_size = 0; + return MHD_YES; + @} + else + @{ + MHD_destroy_post_processor(pp); + return MHD_queue_response(...); + @} +@} +@end example + +Note that the callback from @code{MHD_OPTION_NOTIFY_COMPLETED} +should be used to destroy the post processor. This cannot be +done inside of the access handler since the connection may not +always terminate normally. + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-post api +@section Programming interface for the @code{POST} processor +@cindex POST method + +@deftypefun {struct MHD_PostProcessor *} MHD_create_post_processor (struct MHD_Connection *connection, size_t buffer_size, MHD_PostDataIterator iterator, void *iterator_cls) +Create a PostProcessor. A PostProcessor can be used to (incrementally) +parse the data portion of a @code{POST} request. + +@table @var +@item connection +the connection on which the @code{POST} is happening (used to determine +the @code{POST} format); + +@item buffer_size +maximum number of bytes to use for internal buffering (used only for the +parsing, specifically the parsing of the keys). A tiny value (256-1024) +should be sufficient; do @strong{NOT} use a value smaller than 256; +for good performance, use 32k or 64k (i.e. 65536). + +@item iterator +iterator to be called with the parsed data; must @strong{NOT} be +@code{NULL}; + +@item iterator_cls +custom value to be used as first argument to @var{iterator}. +@end table + +Return @code{NULL} on error (out of memory, unsupported encoding), otherwise +a PP handle. +@end deftypefun + + +@deftypefun int MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len) +Parse and process @code{POST} data. Call this function when @code{POST} +data is available (usually during an @code{MHD_AccessHandlerCallback}) +with the @var{upload_data} and @var{upload_data_size}. Whenever +possible, this will then cause calls to the +@code{MHD_IncrementalKeyValueIterator}. + +@table @var +@item pp +the post processor; + +@item post_data +@var{post_data_len} bytes of @code{POST} data; + +@item post_data_len +length of @var{post_data}. +@end table + +Return @code{MHD_YES} on success, @code{MHD_NO} on error +(out-of-memory, iterator aborted, parse error). +@end deftypefun + + +@deftypefun int MHD_destroy_post_processor (struct MHD_PostProcessor *pp) +Release PostProcessor resources. After this function is being called, +the PostProcessor is guaranteed to no longer call its iterator. There +is no special call to the iterator to indicate the end of the post processing +stream. After destroying the PostProcessor, the programmer should +perform any necessary work to complete the processing of the iterator. + +Return @code{MHD_YES} if processing completed nicely, @code{MHD_NO} +if there were spurious characters or formatting problems with +the post request. It is common to ignore the return value +of this function. + + +@end deftypefun + + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-info +@chapter Obtaining and modifying status information. + + +@menu +* microhttpd-info daemon:: State information about an MHD daemon +* microhttpd-info conn:: State information about a connection +* microhttpd-option conn:: Modify per-connection options +@end menu + + +@c ------------------------------------------------------------ +@node microhttpd-info daemon +@section Obtaining state information about an MHD daemon + +@deftypefun {const union MHD_DaemonInfo *} MHD_get_daemon_info (struct MHD_Daemon *daemon, enum MHD_DaemonInfoType infoType, ...) +Obtain information about the given daemon. This function +is currently not fully implemented. + +@table @var +@item daemon +the daemon about which information is desired; + +@item infoType +type of information that is desired + +@item ... +additional arguments about the desired information (depending on +infoType) +@end table + +Returns a union with the respective member (depending on +infoType) set to the desired information), or @code{NULL} +in case the desired information is not available or +applicable. +@end deftypefun + + +@deftp {Enumeration} MHD_DaemonInfoType +Values of this enum are used to specify what +information about a daemon is desired. +@table @code +@item MHD_DAEMON_INFO_KEY_SIZE +Request information about the key size for a particular cipher +algorithm. The cipher algorithm should be passed as an extra argument +(of type 'enum MHD_GNUTLS_CipherAlgorithm'). No longer supported, +using this value will cause @code{MHD_get_daemon_info} to return NULL. + +@item MHD_DAEMON_INFO_MAC_KEY_SIZE +Request information about the key size for a particular cipher +algorithm. The cipher algorithm should be passed as an extra argument +(of type 'enum MHD_GNUTLS_HashAlgorithm'). No longer supported, +using this value will cause @code{MHD_get_daemon_info} to return NULL. + +@item MHD_DAEMON_INFO_LISTEN_FD +@cindex listen +Request the file-descriptor number that MHD is using to listen to the +server socket. This can be useful if no port +was specified and a client needs to learn what port +is actually being used by MHD. +No extra arguments should be passed. + +@item MHD_DAEMON_INFO_EPOLL_FD +@cindex epoll +Request the file-descriptor number that MHD is using for epoll. If +the build is not supporting epoll, NULL is returned; if we are using a +thread pool or this daemon was not started with +@code{MHD_USE_EPOLL}, (a pointer to) -1 is returned. If we are +using @code{MHD_USE_INTERNAL_POLLING_THREAD} or are in 'external' select mode, the +internal epoll FD is returned. This function must be used in external +select mode with epoll to obtain the FD to call epoll on. No extra +arguments should be passed. + +@item MHD_DAEMON_INFO_CURRENT_CONNECTIONS +@cindex connection, limiting number of connections +Request the number of current connections handled by the daemon. No +extra arguments should be passed and a pointer to a @code{union +MHD_DaemonInfo} value is returned, with the @code{num_connections} +member of type @code{unsigned int} set to the number of active +connections. + +Note that in multi-threaded or internal-select mode, the real number of current +connections may already be different when @code{MHD_get_daemon_info} returns. +The number of current connections can be used (even in multi-threaded and +internal-select mode) after @code{MHD_quiesce_daemon} to detect whether all +connections have been handled. + +@end table +@end deftp + + + +@c ------------------------------------------------------------ +@node microhttpd-info conn +@section Obtaining state information about a connection + + +@deftypefun {const union MHD_ConnectionInfo *} MHD_get_connection_info (struct MHD_Connection *daemon, enum MHD_ConnectionInfoType infoType, ...) +Obtain information about the given connection. + +@table @var +@item connection +the connection about which information is desired; + +@item infoType +type of information that is desired + +@item ... +additional arguments about the desired information (depending on +infoType) +@end table + +Returns a union with the respective member (depending on +infoType) set to the desired information), or @code{NULL} +in case the desired information is not available or +applicable. +@end deftypefun + +@deftp {Enumeration} MHD_ConnectionInfoType +Values of this enum are used to specify what information about a +connection is desired. + +@table @code + +@item MHD_CONNECTION_INFO_CIPHER_ALGO +What cipher algorithm is being used (HTTPS connections only). +@code{NULL} is returned for non-HTTPS connections. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_PROTOCOL, +Allows finding out the TLS/SSL protocol used +(HTTPS connections only). +@code{NULL} is returned for non-HTTPS connections. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_CLIENT_ADDRESS +Returns information about the address of the client. Returns +essentially a @code{struct sockaddr **} (since the API returns +a @code{union MHD_ConnectionInfo *} and that union contains +a @code{struct sockaddr *}). + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_GNUTLS_SESSION, +Takes no extra arguments. Allows access to the underlying GNUtls session, +including access to the underlying GNUtls client certificate +(HTTPS connections only). Takes no extra arguments. +@code{NULL} is returned for non-HTTPS connections. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT, +Dysfunctional (never implemented, deprecated). Use +MHD_CONNECTION_INFO_GNUTLS_SESSION to get the @code{gnutls_session_t} +and then call @code{gnutls_certificate_get_peers()}. + +@item MHD_CONNECTION_INFO_DAEMON +Returns information about @code{struct MHD_Daemon} which manages +this connection. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_CONNECTION_FD +Returns the file descriptor (usually a TCP socket) associated with +this connection (in the ``connect-fd'' member of the returned struct). +Note that manipulating the descriptor directly can have problematic +consequences (as in, break HTTP). Applications might use this access +to manipulate TCP options, for example to set the ``TCP-NODELAY'' +option for COMET-like applications. Note that MHD will set TCP-CORK +after sending the HTTP header and clear it after finishing the footers +automatically (if the platform supports it). As the connection +callbacks are invoked in between, those might be used to set different +values for TCP-CORK and TCP-NODELAY in the meantime. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_CONNECTION_SUSPENDED +Returns pointer to an integer that is @code{MHD_YES} if the connection +is currently suspended (and thus can be safely resumed) and +@code{MHD_NO} otherwise. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_SOCKET_CONTEXT +Returns the client-specific pointer to a @code{void *} that was +(possibly) set during a @code{MHD_NotifyConnectionCallback} when the +socket was first accepted. Note that this is NOT the same as the +@code{con_cls} argument of the @code{MHD_AccessHandlerCallback}. The +@code{con_cls} is fresh for each HTTP request, while the +@code{socket_context} is fresh for each socket. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_CONNECTION_TIMEOUT +Returns pointer to an @code{unsigned int} that is the current timeout +used for the connection (in seconds, 0 for no timeout). Note that +while suspended connections will not timeout, the timeout value +returned for suspended connections will be the timeout that the +connection will use after it is resumed, and thus might not be zero. + +Takes no extra arguments. + +@item MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE +@cindex performance +Returns pointer to an @code{size_t} that represents the size of the +HTTP header received from the client. Only valid after the first callback +to the access handler. + +Takes no extra arguments. + +@end table +@end deftp + + + +@c ------------------------------------------------------------ +@node microhttpd-option conn +@section Setting custom options for an individual connection +@cindex timeout + + + +@deftypefun {int} MHD_set_connection_option (struct MHD_Connection *daemon, enum MHD_CONNECTION_OPTION option, ...) +Set a custom option for the given connection. + +@table @var +@item connection +the connection for which an option should be set or modified; + +@item option +option to set + +@item ... +additional arguments for the option (depending on option) +@end table + +Returns @code{MHD_YES} on success, @code{MHD_NO} for errors +(i.e. option argument invalid or option unknown). +@end deftypefun + + +@deftp {Enumeration} MHD_CONNECTION_OPTION +Values of this enum are used to specify which option for a +connection should be changed. + +@table @code + +@item MHD_CONNECTION_OPTION_TIMEOUT +Set a custom timeout for the given connection. Specified +as the number of seconds, given as an @code{unsigned int}. Use +zero for no timeout. + +@end table +@end deftp + + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +@c ------------------------------------------------------------ +@node microhttpd-util +@chapter Utility functions. + + +@menu +* microhttpd-util feature:: Test supported MHD features +* microhttpd-util unescape:: Unescape strings +@end menu + + +@c ------------------------------------------------------------ +@node microhttpd-util feature +@section Testing for supported MHD features + + +@deftp {Enumeration} MHD_FEATURE +Values of this enum are used to specify what +information about a daemon is desired. +@table @code +@item MHD_FEATURE_MESSAGES +Get whether messages are supported. If supported then in debug +mode messages can be printed to stderr or to external logger. + +@item MHD_FEATURE_SSL +Get whether HTTPS is supported. If supported then flag +MHD_USE_SSL and options MHD_OPTION_HTTPS_MEM_KEY, +MHD_OPTION_HTTPS_MEM_CERT, MHD_OPTION_HTTPS_MEM_TRUST, +MHD_OPTION_HTTPS_MEM_DHPARAMS, MHD_OPTION_HTTPS_CRED_TYPE, +MHD_OPTION_HTTPS_PRIORITIES can be used. + +@item MHD_FEATURE_HTTPS_CERT_CALLBACK +Get whether option #MHD_OPTION_HTTPS_CERT_CALLBACK is +supported. + +@item MHD_FEATURE_IPv6 +Get whether IPv6 is supported. If supported then flag +MHD_USE_IPv6 can be used. + +@item MHD_FEATURE_IPv6_ONLY +Get whether IPv6 without IPv4 is supported. If not supported +then IPv4 is always enabled in IPv6 sockets and +flag MHD_USE_DUAL_STACK if always used when MHD_USE_IPv6 is +specified. + +@item MHD_FEATURE_POLL +Get whether @code{poll()} is supported. If supported then flag +MHD_USE_POLL can be used. + +@item MHD_FEATURE_EPOLL +Get whether @code{epoll()} is supported. If supported then Flags +MHD_USE_EPOLL and +MHD_USE_EPOLL_INTERNAL_THREAD can be used. + +@item MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET +Get whether shutdown on listen socket to signal other +threads is supported. If not supported flag +MHD_USE_ITC is automatically forced. + +@item MHD_FEATURE_SOCKETPAIR +Get whether a @code{socketpair()} is used internally instead of +a @code{pipe()} to signal other threads. + +@item MHD_FEATURE_TCP_FASTOPEN +Get whether TCP Fast Open is supported. If supported then +flag MHD_USE_TCP_FASTOPEN and option +MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE can be used. + +@item MHD_FEATURE_BASIC_AUTH +Get whether HTTP Basic authorization is supported. If supported +then functions @code{MHD_basic_auth_get_username_password()} and +@code{MHD_queue_basic_auth_fail_response()} can be used. + +@item MHD_FEATURE_DIGEST_AUTH +Get whether HTTP Digest authorization is supported. If +supported then options MHD_OPTION_DIGEST_AUTH_RANDOM, +MHD_OPTION_NONCE_NC_SIZE and functions @code{MHD_digest_auth_check()}, +can be used. + +@item MHD_FEATURE_POSTPROCESSOR +Get whether postprocessor is supported. If supported then +functions @code{MHD_create_post_processor()}, +@code{MHD_post_process()}, @code{MHD_destroy_post_processor()} +can be used. + +@item MHD_FEATURE_SENDFILE +Get whether @code{sendfile()} is supported. + +@end table +@end deftp + + + +@deftypefun {int} MHD_is_feature_supported (enum MHD_FEATURE feature) +Get information about supported MHD features. Indicate that MHD was +compiled with or without support for particular feature. Some features +require additional support by the kernel. However, kernel support is not +checked by this function. + +@table @var +@item feature +type of requested information +@end table + +Returns @code{MHD_YES} if the feature is supported, +and @code{MHD_NO} if not. +@end deftypefun + + +@c ------------------------------------------------------------ +@node microhttpd-util unescape +@section Unescape strings + +@deftypefun {size_t} MHD_http_unescape (char *val) +Process escape sequences ('%HH') Updates val in place; the result +should be UTF-8 encoded and cannot be larger than the input. The +result must also still be 0-terminated. + +@table @var +@item val +value to unescape (modified in the process), must be +a 0-terminated UTF-8 string. +@end table + +Returns length of the resulting val (@code{strlen(val)} may be +shorter afterwards due to elimination of escape sequences). + +@end deftypefun + + + + +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + +@c ********************************************************** +@c ******************* Appendices ************************* +@c ********************************************************** + +@node GNU-LGPL +@unnumbered GNU-LGPL +@cindex license +@include lgpl.texi + +@node GNU GPL with eCos Extension +@unnumbered GNU GPL with eCos Extension +@cindex license +@include ecos.texi + +@node GNU-FDL +@unnumbered GNU-FDL +@cindex license +@include fdl-1.3.texi + +@node Concept Index +@unnumbered Concept Index + +@printindex cp + +@node Function and Data Index +@unnumbered Function and Data Index + +@printindex fn + +@node Type Index +@unnumbered Type Index + +@printindex tp + +@bye diff --git a/doc/libmicrohttpd_performance_data.eps b/doc/libmicrohttpd_performance_data.eps new file mode 100644 index 0000000..6014f9f --- /dev/null +++ b/doc/libmicrohttpd_performance_data.eps @@ -0,0 +1,8468 @@ +%!PS-Adobe-3.0 EPSF-3.0 +%%Creator: (ImageMagick) +%%Title: (libmicrohttpd_performance_data.eps) +%%CreationDate: (2014-02-19T07:16:22+01:00) +%%BoundingBox: -0 -0 640 480 +%%HiResBoundingBox: 0 0 640 480 +%%DocumentData: Clean7Bit +%%LanguageLevel: 1 +%%Pages: 1 +%%EndComments + +%%BeginDefaults +%%EndDefaults + +%%BeginProlog +% +% Display a color image. The image is displayed in color on +% Postscript viewers or printers that support color, otherwise +% it is displayed as grayscale. +% +/DirectClassPacket +{ + % + % Get a DirectClass packet. + % + % Parameters: + % red. + % green. + % blue. + % length: number of pixels minus one of this color (optional). + % + currentfile color_packet readhexstring pop pop + compression 0 eq + { + /number_pixels 3 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add 3 mul def + } ifelse + 0 3 number_pixels 1 sub + { + pixels exch color_packet putinterval + } for + pixels 0 number_pixels getinterval +} bind def + +/DirectClassImage +{ + % + % Display a DirectClass image. + % + systemdict /colorimage known + { + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { DirectClassPacket } false 3 colorimage + } + { + % + % No colorimage operator; convert to grayscale. + % + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { GrayDirectClassPacket } image + } ifelse +} bind def + +/GrayDirectClassPacket +{ + % + % Get a DirectClass packet; convert to grayscale. + % + % Parameters: + % red + % green + % blue + % length: number of pixels minus one of this color (optional). + % + currentfile color_packet readhexstring pop pop + color_packet 0 get 0.299 mul + color_packet 1 get 0.587 mul add + color_packet 2 get 0.114 mul add + cvi + /gray_packet exch def + compression 0 eq + { + /number_pixels 1 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add def + } ifelse + 0 1 number_pixels 1 sub + { + pixels exch gray_packet put + } for + pixels 0 number_pixels getinterval +} bind def + +/GrayPseudoClassPacket +{ + % + % Get a PseudoClass packet; convert to grayscale. + % + % Parameters: + % index: index into the colormap. + % length: number of pixels minus one of this color (optional). + % + currentfile byte readhexstring pop 0 get + /offset exch 3 mul def + /color_packet colormap offset 3 getinterval def + color_packet 0 get 0.299 mul + color_packet 1 get 0.587 mul add + color_packet 2 get 0.114 mul add + cvi + /gray_packet exch def + compression 0 eq + { + /number_pixels 1 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add def + } ifelse + 0 1 number_pixels 1 sub + { + pixels exch gray_packet put + } for + pixels 0 number_pixels getinterval +} bind def + +/PseudoClassPacket +{ + % + % Get a PseudoClass packet. + % + % Parameters: + % index: index into the colormap. + % length: number of pixels minus one of this color (optional). + % + currentfile byte readhexstring pop 0 get + /offset exch 3 mul def + /color_packet colormap offset 3 getinterval def + compression 0 eq + { + /number_pixels 3 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add 3 mul def + } ifelse + 0 3 number_pixels 1 sub + { + pixels exch color_packet putinterval + } for + pixels 0 number_pixels getinterval +} bind def + +/PseudoClassImage +{ + % + % Display a PseudoClass image. + % + % Parameters: + % class: 0-PseudoClass or 1-Grayscale. + % + currentfile buffer readline pop + token pop /class exch def pop + class 0 gt + { + currentfile buffer readline pop + token pop /depth exch def pop + /grays columns 8 add depth sub depth mul 8 idiv string def + columns rows depth + [ + columns 0 0 + rows neg 0 rows + ] + { currentfile grays readhexstring pop } image + } + { + % + % Parameters: + % colors: number of colors in the colormap. + % colormap: red, green, blue color packets. + % + currentfile buffer readline pop + token pop /colors exch def pop + /colors colors 3 mul def + /colormap colors string def + currentfile colormap readhexstring pop pop + systemdict /colorimage known + { + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { PseudoClassPacket } false 3 colorimage + } + { + % + % No colorimage operator; convert to grayscale. + % + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { GrayPseudoClassPacket } image + } ifelse + } ifelse +} bind def + +/DisplayImage +{ + % + % Display a DirectClass or PseudoClass image. + % + % Parameters: + % x & y translation. + % x & y scale. + % label pointsize. + % image label. + % image columns & rows. + % class: 0-DirectClass or 1-PseudoClass. + % compression: 0-none or 1-RunlengthEncoded. + % hex color packets. + % + gsave + /buffer 512 string def + /byte 1 string def + /color_packet 3 string def + /pixels 768 string def + + currentfile buffer readline pop + token pop /x exch def + token pop /y exch def pop + x y translate + currentfile buffer readline pop + token pop /x exch def + token pop /y exch def pop + currentfile buffer readline pop + token pop /pointsize exch def pop + /Times-Roman findfont pointsize scalefont setfont + x y scale + currentfile buffer readline pop + token pop /columns exch def + token pop /rows exch def pop + currentfile buffer readline pop + token pop /class exch def pop + currentfile buffer readline pop + token pop /compression exch def pop + class 0 gt { PseudoClassImage } { DirectClassImage } ifelse + grestore +} bind def +%%EndProlog +%%Page: 1 1 +%%PageBoundingBox: 0 0 640 480 +userdict begin +DisplayImage +0 0 +640 480 +12 +640 480 +1 +0 +0 +102 +FFFFFF +000000 +A0A0A0 +FF0000 +00C000 +0080FF +C000FF +00EEEE +C04000 +C8C800 +4169E1 +FFC020 +008040 +C080FF +306080 +8B0000 +408000 +FF80FF +7FFFD4 +A52A2A +FFFF00 +40E0D0 +000000 +1A1A1A +333333 +4D4D4D +666666 +7F7F7F +999999 +B3B3B3 +C0C0C0 +CCCCCC +E5E5E5 +FFFFFF +F03232 +90EE90 +ADD8E6 +F055F0 +E0FFFF +EEDD82 +FFB6C1 +AFEEEE +FFD700 +00FF00 +006400 +00FF7F +228B22 +2E8B57 +0000FF +00008B +191970 +000080 +0000CD +87CEEB +00FFFF +FF00FF +00CED1 +FF1493 +FF7F50 +F08080 +FF4500 +FA8072 +E9967A +F0E68C +BDB76B +B8860B +F5F5DC +A08020 +FFA500 +EE82EE +9400D3 +DDA0DD +905040 +556B2F +801400 +801414 +804014 +804080 +8060C0 +8060FF +808000 +FF8040 +FFA040 +FFA060 +FFA070 +FFC0C0 +FFFF80 +FFFFC0 +CDB79E +F0FFF0 +A0B6CD +C1FFC1 +CDC0B0 +7CFF40 +A0FF20 +BEBEBE +BFBFBF +5F5F5F +1F1F1F +DFDFDF +9F9F9F +3F3F3F +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001010101010101010100010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000606101010000000000006361010161630000000000636101016163000000 +0063610101616300000000000000000000000000000000000000000000000000606101010000 +0000000000636101016163000000006361010161630000000063610101616300000000636101 +0161630000000063610101616300000000006361010161630000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000161000000000000006101 +0000010000000000000000010000000101010162651B63000000000100000000000000000000 +0000000000000001000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000010000000001010101010101010000 +0000000000000060650162616300000000010101010101000000006361010161630000000000 +00631B6562016261600000000000606162016265640000000000006361620101626160000001 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000621B6301000000000000621B63631B620000000000621B63631B6200000000621B63631B +6200000000000000000000000000000000000000000000000000621B63010000000000000062 +1B63631B6200000000621B63631B6200000000621B63631B6200000000621B63631B62000000 +00621B63631B620000000000621B63631B620000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000162630000000000636501000001000000 +0000000000010000000100000063601B62640000000100000000000000000000000000000000 +0001000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000010000000000000000000000000000000000 +000000000000000000000000000000000001000000000000000000001B610000000000000000 +606264636364650000000001000000000000000000621B63631B620000000000606261606300 +631B621B00000000656463006360651B00000000646264630063646501000001000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000001 +00000000001B610000000061640000001B6100000000616400001B6100000000616400000000 +0000000000000000000000000000000000000000000000010000000000001B61000000006164 +00001B6100000000616400001B6100000000616400001B6100000000616400001B6100000000 +61640000001B6100000000616400000100000000000000000000000000000000000000000000 +000000000000000000000000000000011B610000000000616401000001000000000000000001 +0000000100000000000060626300000100000000000000000000000000000000000100000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000062600000000000000000656400000000 +64640000000100000000000000001B6100000000616400000064626000000000000000656100 +000000000000000063010000006362630000000000001B000001000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000001000000000001001B620162640000000001006162010000606501 +626400000000006065016264000000000000000000010000000000636101621B000000010061 +6201656300000000000000000000000000000000636162016264000000000001000000000065 +6000000000606500000065600000000060650000656000000000606500000000000000000000 +00000001001B6201626400000000000000010000000000006560000000006065000065600000 +0000606500006560000000006065000065600000000060650000656000000000606500000065 +60000000006065000001000000000000006362000000000000006260001B6201016560000000 +0000000000000000000163626300000063620001000001000000000000000001000000010000 +00000000001B6100000100000000001B62010165600000000000000100000000010061620165 +630000000060650162640000000001001B6201626400000000636162016264000001001B6201 +626400000001006162621B00006162016100000000636101621B000000000100616201000001 +0000000060626400010000000000000000000060650101656000000001001B62016264000000 +0000000000010000000000000000006065000000000000000000016300000000636500000001 +0000000000000000656000000000606500006362600060650101656001006260000000000000 +0000636200000061640000000000000000000001000000000000000001000001010101010101 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000001000000000001611B630060626400000001616400000063626400606260000000 +63626400606260000000000000000000000000000062640063611B0000016164636364626300 +0000000000000000000000000063621B63006061000000000001000000000062630000000063 +620000006263000000006362000062630000000063620000000000000000000000000001611B +6300606264000000000000010000000000006263000000006362000062630000000063620000 +6263000000006362000062630000000063620000626300000000636200000062630000000063 +62000000000000000000000061640000000000646500611B6300636065000000000000000000 +0000000100611B0000001B1B0001000001000000000000000001000000010000000000000063 +6200000000000000611B63006360650000000000000000000000016164636364626300006362 +640060626000000001611B6300606264000063621B63006061000001611B6300606264000001 +61646363651B61646363656400000062640063611B0000000161640000000001000000606260 +0000000000000000000000006062646363646260000001611B63006062640000000000000001 +0000000000000000006564000000000000000000016300000000636200000001620162616300 +0000626300000000636200001B610060626463636401010064610000000000000060651B0000 +0062630000000000000000000001000000000000000001000000000000001B62000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000011B000000006065000000011B00000000611B0000006065000000611B00000060 +6500000000000000000000000000000000000063620000011B000000001B6100000000000000 +00000000000000611B0000000000000000000001000000000001000000000000010000000100 +0000000000010000010000000000000100000000000000000000000000011B00000000606500 +0000000000010000000000000100000000000001000001000000000000010000010000000000 +0001000001000000000000010000010000000000000100000001000000000000010000000000 +0000000000006062000000000062600001000000000000000000000000000000000000010063 +6200000062630001000001010101010101010101000000010000000000000000010000000000 +0000010000000000000000000000000000000000011B000000001B610000611B000000606500 +0000011B0000000060650000611B00000000000000011B000000006065000001640000006001 +640000006065000000000000006362000000011B000000000001000064656300000000000000 +00000000000061640000000064610000011B0000000060650000000000000001000000000000 +00006362000000000000000000006564000000006401000000656000631B6260000001000000 +0000000100006260006564000000006401006362000000000101010165000000000100000000 +0000000000000001010101010101010101000000000000646263000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000001 +6300000000636200000001630000000062630000006362000000626300000063620000000000 +0000000000000000001B62010101010000016300000000636200000000000000000000000000 +0062630000000000000000000001000000000001000000000000010000000100000000000001 +0000010000000000000100000000000000000000000000016300000000636200000000000001 +0000000000000100000000000001000001000000000000010000010000000000000100000100 +0000000000010000010000000000000100000001000000000000010000000000000000000000 +0065640000001B65000065616300000000000000000000000000000000010000656400646100 +0001000001000000000000000001000000010000000000000000010000000000000065616300 +0000000000000000000000000000016300000000636200006263000000636200000001630000 +0000636200006263000000000000000163000000006362000001630000000001630000000001 +0000001B62010101010000000163000000000001001B61000000000000000000000000000000 +62630000000063620000016300000000636200000000000000010000000000000000611B0000 +0000000000000000606264636364620100000000000000006465000001000000000000010000 +01000001630000000063010000010000000000006364621B0000000100000000000101010100 +0001000000000000000001000000000060626300000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000001000000000000 +0100000001000000000001010101010101000000010101010101010000000000000000000000 +0000616560000000010000010000000000000100000000000000000101010100000100000000 +0000000000000001000000000062630000000063620000006263000000006362000062630000 +0000636200000000000000010101010000010000000000000100000000000001000000000000 +6263000000006362000062630000000063620000626300000000636200006263000000006362 +0000626300000000636200000062630000000063620000000000000000000000006062000000 +6264000063610162616000000000000000000000000000010000606200626000000100000100 +0000000000000001000000010000000000000063620000000000000063610162616000000000 +0000000000000000010000000000000100000101010101010100000001000000000000010000 +0100000000000000000100000000000001000001000000000001000000000001000061656000 +0000010000000100000000000001006263000000000000000000000000000000010000000000 +0001000001000000000000010000000000000001000000000000006362630000000001010101 +0000006065010165646200000000000000006301000062630000000063620000010000016300 +0000006301006362000000000000000060620000006263000000000000000100000100000000 +0000000001000000006062600000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000001000000000000010000000100 +0000000062630000000000000000626300000000000000000000000000000000000062630000 +0063010000016300000000636200000000000000000000000000006263000000000000000000 +0001000000000065600000000060650000006560000000006065000065600000000060650000 +0000000000000000000000010000000000000100000000000001000000000000656000000000 +6065000065600000000060650000656000000000606500006560000000006065000065600000 +00006065000000656000000000606500000000000000000000000000651B001B620000000000 +006364656100000000000000000000000001000000621B620000000100000100000000000000 +000100000001000000000000001B610000000000000000000063646561000000000000000000 +0000016300000000636200006263000000000000000001000000000000010000626300000000 +0000000100000000000001000001000000000001000000000001000062630000006301000000 +0100000000000001006462630000000000000000000000000000626300000000636200000100 +0000000000010000000000000001000000000000001B61000000000000000000000000000000 +0000606100000000000000006301000065600000000060650000626000656400000000640100 +646100000000000000000001000000611B000000000000000100000100000000000000000100 +0000636260000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000001000000000000010000000100000000006164 +0000000000000000616400000000000000000000000000000000000062630000001B01000001 +1B000000001B610000000000000000000000000000611B000000000000000000000100000000 +001B610000000061640000001B6100000000616400001B610000000061640000000000000000 +00000000000100000000000001000000000000010000000000001B6100000000616400001B61 +00000000616400001B6100000000616400001B6100000000616400001B610000000061640000 +001B610000000061640000000000000000000000000064016301640000000000000000630100 +0000000000000000000000010000006401640000000100000100000000000000000100000001 +00000000000063626300000000000000000000000063010000000000000000000000011B0000 +00001B6100006164000000000000000001000000000000010000611B00000000000000010000 +0000000001000001000000000001000000000001000062630000001B01000000010000000000 +0001000060626000000000000000000000000000616400000000646100000100000000000001 +0000000000000001000000000000006263000000000000000000000000000000000065600000 +000000000000646500001B6100000000616400001B6100606264636364620160626300000000 +0000000060620000006362630000000000000100000100000000000000000100006362640000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000001000000000000010000000100000000006362646300606500 +00006362646300606500000000000000000000000000616163631B6101000001616463636462 +63000000000000000000000000000063621B63006061000000000001000000000000621B6363 +1B620000000000621B63631B6200000000621B63631B62000000000000000000000000000001 +000000000000010000000000000100000000000000621B63631B6200000000621B63631B6200 +000000621B63631B6200000000621B63631B6200000000621B63631B620000000000621B6363 +1B620000000000000000000000000000006262620000000065646300631B6500000100000000 +000000000001000000000000000000010000010000000000000000010000000100000063601B +6264000000000000000065646300631B65000000000000000000000001616463636462630000 +636264630060650000000100000000000001000063621B630060610000010000000000000100 +00010000000000010000000000010000616163631B6101000000010000000000000100000060 +6264000000000000000000000000606264636364626000000100000000000001000000000000 +000100000000000064650000000000000000000000000065600063616100000065646300631B +6260000000621B63631B62000000636260006065010165600165630000006560630063646260 +0000000064621B630000631B010000010000000000000000010000621B000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000001000000000000010000000100000000000060650101656000000000606501 +0165600000000000000000000000000063616201610001000001006162016563000000000000 +0000000000000000000063616201656400000101010101010100000063610101616300000000 +0063610101616300000000636101016163000000000000000000000000000001000000000000 +0100000001010101010101000000006361010161630000000063610101616300000000636101 +0161630000000063610101616300000000636101016163000000000063610101616300000000 +00000000000000000000006401640000000060616201621B0000000100000000000000000001 +000000000000000000010000010000000000000000010000000101010162651B630000000000 +0000000060616201621B00000000000000000000000001006162016563000000006065010165 +6000000001000000000000010000006361620165640000010000000000000100000100000000 +000100000000000100006361620161000100000001000000000000010000000063621B000000 +0000000000000000006465010165600000000100000000000001000000000000000100000000 +0000656000000000000000000000000000646201626400000000606162016261630000000063 +6101016163000000006462600000000000000000000000006061620162616000000000000060 +6162010162616300000100000000000000000100000101010101010100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000060626160630063606165000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +1B65620101651B63000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000606101010000000000000000000000 +0000000000000000000000000000000000006361010161630000000000646201626400000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000621B63010000000000000000000000000000000000 +000000000000000000000000621B63631B620000000061616300606500000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +00000000001B6100000000616400006065000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000006065016264000000000000000000010000000000000065 +6000000000606500006160000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000636264006062600000000000000000010000000000000062630000000063 +6200006264650101656000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000611B00000060650000000000000000010000000000000001000000000000010000016264 +6363646260000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000062630000 +0063620000000000000000010000000000000001000000000000010000016400000000646500 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000001010101010101000000 +0001010101010101010100000062630000000063620000626300000000630100000000000000 +0000000000000000000101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000062630000000000000000000000000001 +0000000000000065600000000060650000656300000000630100000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000010000000000000000000100000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000010000 +0000000000000100000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000010000000000000000000100000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0100000000000000000100000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000100000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000061640000000000000000000000000001000000000000 +001B610000000061640000646400000000646500000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000010000000000000000000100000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000010000000000000000 +0100000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000010000000000000000000100000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000010000000000 +0000000100000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000100000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000010000000000636264630060650000000000000000010000000000000000621B6363 +1B62000000006564636364626000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000101010101 +0101000000606501016560000000000000000001000000000000000063610101616300000000 +6361620165600000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010101000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000016263000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000101 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +6465000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001006564000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001006362630000000001000060 +6501016560000000000000000000606501626400000000010061620165630000000000606501 +0165600000010000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000100001B610000000001006062646363646260 +0000000000000063626400606260000000016164636364626300000060626463636462600001 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000656000000001006164000000006461000000000000 +00611B0000006065000000011B000000001B6100000061640000000064610001000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000636200000001006263000000006362000000000000006263000000 +6362000000016300000000636200000062630000000063620001000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000001B1B000001000100000000000001000000000000000101010101010100000001 +0000000000000100000001000000000000010001000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000030303030303030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0065630001006263000000006362000000000000006263000000000000000001630000000063 +6200000062630000000063620001000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000006065000100 +61640000000064610000000000000061640000000000000000011B000000001B610000006164 +0000000064610001000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000030000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000010000000000001B640100606264636364 +6260000000000000006362646300606500000001616463636462630000006062646363646260 +0001000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000650100006465010165600000000000 +0000000060650101656000000001006162016563000000000064650101656000000100000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000101010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010101000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004000000000004000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040000000400000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000400040000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0004000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000006200000000006301630000 +0000006201000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000040004000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000006164000000006401640000000064650100 +0000010000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000004000000040000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000606100000000611B610000000061640000000001000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000400000400000400000400000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000006200000000626362000000636200010000010101010100000001001B +6201626400000000000000000060650162640000000001006162016563000000006065010165 +6000000001000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004000000040004000000000004000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000001B64000063650065630000646100010000000100000000000001611B630060626400 +0000000000006362640060626000000001616463636462630000606264636364626000000100 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000400000000000400000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000040004000000040000000400000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000006065 +00006461001B6400006560000100000001000000000000011B00000000606500000000000000 +611B0000006065000000011B000000001B610000616400000000646100000100000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000400 +0000040000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0400000000000400040000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000062630061640060 +6100636200000100000001000000000000016300000000636200000000000000626300000063 +6200000001630000000063620000626300000000636200000100000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000004000400000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000004000400000000 +0004000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000001B1B006263006362001B1B0000 +0100000001000000000000010000000000000100000000000000010101010101010000000100 +0000000000010000010000000000000100000100000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000400000004000000040004000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000063656362000000626362630000010000000100 +0000000000010000000000000100000000000000626300000000000000000163000000006362 +0000626300000000636200000100000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000004000400000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000040000000000040004000000040000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000651B61000000611B65000000010000000100000000000001 +000000000000010000000000000061640000000000000000011B000000001B61000061640000 +0000646100000100000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000400000004000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000400000000000400000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000064016400000064011B000000010000006264000000000001000000000000 +0100000000000000636264630060650000000161646363646263000060626463636462600000 +0100000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000040000000000040000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000630163000000630163000000010000006062010100000001000000000000010000000000 +0000006065010165600000000100616201656300000000646501016560000000010000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040000000000040000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010101000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000400000004000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001010100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040000 +0000000400000000000000000004000400000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000400000004000000 +0000000000000000040000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000004000400000000000000000000 +0004000400000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000040000000000000000000000040000000400 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000004000400000000000000000004000000000004000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000400000004000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0000000000040000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000040000000000040000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000400000004000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000606101 +0100000000000063610101616300000000636101016163000000006361010161630000000000 +6361010161630000000063610101616300000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004000400000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000621B63010000000000 +00621B63631B6200000000621B63631B6200000000621B63631B620000000000621B63631B62 +00000000621B63631B6200000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000040000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000100000000001B6100000000 +616400001B6100000000616400001B610000000061640000001B6100000000616400001B6100 +0000006164000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000400 +0400000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000656000000000606500006560 +0000000060650000656000000000606500000065600000000060650000656000000000606500 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000040000000400000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000626300000000636200006263000000006362 +0000626300000000636200000062630000000063620000626300000000636200000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000004000000000004000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000010000000000000100000100000000000001000001000000 +0000000100000001000000000000010000010000000000000100000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000400000000000400000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000010000000000000100000100000000000001000001000000000000010000 +0001000000000000010000010000000000000100000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004000000040000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000626300000000636200006263000000006362000062630000000063620000006263000000 +0063620000626300000000636200000000000000000000000000000000010101010100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000040004000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010101010100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000065600000 +0000606500006560000000006065000065600000000060650000006560000000006065000065 +6000000000606500000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000004000000000004 +0000000000000000000000000000000000000000000000000000000000000000000004040000 +0000040000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000100000000001B610000000061640000 +1B6100000000616400001B610000000061640000001B6100000000616400001B610000000061 +6400000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040000000400000000000000 +0000000000000000000000000000000000000000000000000000000004040400000400000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000621B63631B6200000000621B63631B +6200000000621B63631B620000000000621B63631B6200000000621B63631B62000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000400040000000000000000000000000000 +0000000000000000000000000000000000000400000400000404040000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001010101010101000000636101016163000000006361010161630000000063 +6101016163000000000063610101616300000000636101016163000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004000000000000000000000000000000000000000000 +0000000000000000000000000004040000040004040000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000400040000000000000000000000000000000000000000000004000000 +0000040000000000040004000400040000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001010100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000040000000400000000000000000000000000000000000000000000040000000400000000 +0000000400040000000400000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000101010000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000621B6300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004000000000404000000 +0004000000000000000000000000000000000000000000000400040000000000000004000400 +0000000004000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000063610161600000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040000000400000000000000000000 +0000000000000000000000000000000000000004000000000000000400000004000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000631B626564000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000400040000000000000000000000000000000000 +0000000000000000000000000400040000000000040000000000040000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000006465621B63000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000004000000000000000000000000000000000000000000000000 +0000000000040000000400000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000001B0101610000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000400040000000000000000000000000000000000000000000000000000000400 +0000000004000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000063 +1B626560001B6100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0000000400000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000636162616300000063 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000400000000000400 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000006065621B63000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000004000000000004000004000000 +0000040000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000006564000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000040000000400000000040000000400000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000400040000000000000400040000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000006461000000000061640000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004000000000000000004000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000626000 +0000000060650000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010101 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000400040000000000000400040000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001010100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000004000000 +0400000000040000000400000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000626300000000006362000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000400000000000400000400 +0000000004000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000611B00000000001B61000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +000000000000000000000063621B6300631B6263000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000006361620162616300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000400 +0000000004000000000000000000000000000000000004000000000004000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000004000000040000 +0000000000000000000000000000000000040000000400040000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000646562010101010100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040004000000000000000000 +0000000000000000000000000400040004000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000064626063000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000400000000000400000000000000000000 +0000000000000004000400000004000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000062600000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000040004000000040000000000000000000000000004000000 +0400040000000400000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004000000040004000000000000000000000000000000040004000400040004 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0062630000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0400000000000400000000000000000000000000000000000400040000000400000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000001B1B000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0004000000000000000004000000000004000004000000040004000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000611B6300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000400000004000000 +0000000000040000000400000400040004000000040000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000101010101010101010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040000000000040000000000000000 +0400040000040000000400000000000400000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000400000400 +0000000004000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040004000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000004000000040000000000000400000000000400 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000006065 +6201000065600000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000400000000000400000000000004000000040000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000646260630100006065 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040000000000040000040004000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000626000000100000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000400000004000000000400000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000100006301000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0004000400000000040004000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000656400000100006465000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000004000000 +0004000000040004000000000004000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +000000000060621B630163646263000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000400000000000400040000040000000000 +0400040000000400000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +6361620162616300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0101000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000400000000 +0004000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004000000040000000400000000000000040000040004 +0400000400000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000101010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004000000040000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040004000000000004000000000000000400000404000004000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040004000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000040400000000040000000000000000000004040404000400000400000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000400000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0404000004000000000000000000000004040004040000040000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000030003030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040004000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000400000404040000 +0000000400000004000404000404040404000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000303030303030303000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000004000000040000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040000000004040000000000000400 +0000040400000404000404000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000030303 +0303030303030303030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000646200000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040000 +0000000400000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000400040000000000000004000404040004 +0004040004040004000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000003030303030303030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001010101010101 +0101626000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000040000000400000000000000040000000400000404000004 +0400000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000303030303030303030303030303030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004000000000004000000000004040400040004040000040004040000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000030303030303030303030303030303030303000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000400000404000004040000000400000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000003030303030303030303030303030303030303030000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000001B620101010101010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000040004000404040404000400040004000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030303030303030303030303030300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000001B61630100631B61000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000060610101000000000000636101016163 +0000000063610101616300000000636101016163000000000063610101616300000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000040000040400000004000000040000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000030303030303 +0303030000000000030303030303030300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000006263000100000064610000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000621B6301000000000000621B63631B6200000000621B +63631B6200000000621B63631B620000000000621B63631B6200000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040404 +0400000400000000000400000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000003030303030303030000000000 +0000000003030303030303000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0100000000620000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000100000000001B6100000000616400001B6100000000616400 +001B610000000061640000001B61000000006164000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000040400000400000400 +0000040404000000040404000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000303030303030300000000000000000000000303 +0303030303030000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000616400626000006362 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000065600000000060650000656000000000606500006560000000 +0060650000006560000000006065000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000004040004000004000004000400040404 +0004040404000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000303030303030300000000000000000000000003030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +00000000000000000000000000000000000000000000006362001B6563636161000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000062630000000063620000626300000000636200006263000000006362000000 +6263000000006362000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004000000040000000004040004000404040404040000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000030303030303030000000000000000000000000000030303030303030300000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000006162626163000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0001000000000000010000010000000000000100000100000000000001000000010000000000 +0001000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000400000000000400000000040400040404040404000004000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000303 +0303030303000000000000000000000000000000000303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000100000000 +0000010000010000000000000100000100000000000001000000010000000000000100000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000040404040404040404000400000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000303030303030300 +0000000000000000000000000000000303030303030303000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000006263000000006362000062 +6300000000636200006263000000006362000000626300000000636200000000000000000000 +0000000000010101010100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004000004040404040404040000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000030303030303030000000000000000 +0000000000000000000003030303030303030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001010101010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000006560000000006065000065600000000060 +6500006560000000006065000000656000000000606500000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0400000404040404040004040400040000000000000000000000000000000000000000000000 +0000000000000000000000000000000003030303030303000000000000000000000000000000 +0000000000030303030303030000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000001B6100000000616400001B6100000000616400001B6100 +00000061640000001B6100000000616400000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000004040000 +0404000400040404000000000000000000000000000000000000000000000000000000000000 +0000000000000000000003030303030303000000000000000000000000000000000000000003 +0303030303030300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000001010101010101010101010100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000001000000000000621B63631B6200000000621B63631B6200000000621B63631B620000 +000000621B63631B620000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000404000000000404000400 +0400000000000000000000000000000000000000000000000000000000000000000000000000 +0000000303030303030300000000000000000000000000000000000000000000030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010101010101 +0100000063610101616300000000636101016163000000006361010161630000000000636101 +0161630000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000400040004000400040000 +0004000000000000000000000000000000000000000000000000000000000000000003030303 +0303030300000000000000000000000000000000000000000000030303030303030300000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000400040004000400040004000000 +0000000000000000000000000000000000000000000000000000000000000303030300000000 +0000000000000000000000000000000000000000000303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001010100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000040004040404040004040404000000000000000000 +0000000000000000000000000000000000000000000003030303030303000000000000000000 +0000000000000000000000000000000303030303030303000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010101000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004000000040404040404040400000000000000000000000000000000 +0000000000000000000000000000000303030303030303000000000000000000000000000000 +0000000000000000000003030303030303000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004000404040404040000040000000000000000000000000000000000000000 +0000000000000000000303030303030300000000000000000000000000000000000000000000 +0000000003030303030303030000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0400040004040404040004000000000000000000000000000000000000000000000000000000 +0000030303030303030000000000000000000000000000000000000000000000000000000003 +0303030303030000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000004000400040404 +0404040400000000000000000000000000000000000000000000000000000000000003030303 +0303030000000000000000000000000000000000000000000000000000000000030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000064656201010101010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040004040404040404040400 +0400000000000000000000000000000000000000000000000000000303030303030303000000 +0000000000000000000000000000000000000000000000000000030303030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000006462606300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000404000400000404040404000000040000 +0000000000000000000000000000000000000000000303030303030300000000000000000000 +0000000000000000000000000000000000000000000303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000006260000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000040004000400040004000400000000000000 +0000000000000000000000000000000303030303030300000000000000000000000000000000 +0000000000000000000000000000000303030303030300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000004000404040404000404040400000000000000000000000000 +0000000000000000000003030303000000000000000000000000000000000000000000000000 +0000000000000000000303030303030303000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000626300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004040404040404040000000000000000000000000000000000000000 +0000030303030303030000000000000000000000000000000000000000000000000000000000 +0000000003030303030303030000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +00000000000000000000000000000000000000000000001B1B00000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000400040404040404000004000000000000000000000000000000000000000003030303 +0303030000000000000000000000000000000000000000000000000000000000000000000303 +0303030303030000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000611B630000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000004000400 +0404040404000400000000000000000000000000000000000000000303030303030300000000 +0000000000000000000000000000000000000000000000000000000000000003030303030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010101010101010101000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010101000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000040004040404040404 +0000040000000000000000000000000000000000000303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000003030303030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000101 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000004000404040404040404040404000004 +0000000000000000000000000000030303030303030000000000000000000000000000000000 +0000000000000000000000000000000000000000030303030303030000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000040400040000040404040400040404040000000000 +0000000000000000030303030303030000000000000000000000000000000000000000000000 +0000000000000000000000000000030303030303030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004040404040404040404000000000000000000000000 +0003030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000030303030303030300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000606562010000656000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000400000404040404040400000000000000000000000000000000030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000303030303030300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000064626063010000606500000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000040404040404040000040000000000000000000000030303030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000062600000010000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000404 +0004040404040404000400000000000000000000000003030300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000303030303030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000010000630100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000400040404040404 +0404040000000000000000000000030303030303030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000303030303030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0065640000010000646500000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000004040404040404040404040004 +0000000000000003030303030303000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000003030303030303000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000060621B6301 +6364626300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000004000000000404040004000404040000000000 +0003030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000003030303030303000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000063616201626163000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000040004040400040404000000000000030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000003030303030303000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004000400040404040400000400000000000003030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0003030303030303030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000006000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000040004000404040000040400000000030303030303030000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000003030303 +0303030000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000006265600000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0400040404040404040004000000000303030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000003030303030303030000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000064626564000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000004000404040004 +0404000400040403030303030303000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000030303030303030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +1B62626400000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040404000004040404000404 +0404030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000030303030303030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000001B016264 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000404040404040404040403030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000030303030303030300000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000636201000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000040400040404040404040403030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000303030303030300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000001B016264000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040004000404040404040304030303000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000646265640000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000400040404040404030403040403030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000030303030303 +0303000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000006462656000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0004040404040404040304040404000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000030303030303030300000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000062 +6160000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000404040404 +0004040404040404000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000063000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000040400040304040404 +0400000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000303030303030303000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040004030404040404030004000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000003030303030303000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000001010001010101010101010100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001010100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000400040404040404000404000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000003030303030303000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000101010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000004040404040404040400040400000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000303 +0303030303030000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000003040404030404040404040400000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000303030303030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030403030404040404040004000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000003030303030303000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000101010101 +0101010162640000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000003030304 +0400040404000400000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000303030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000611B6300631B61636062 +6400000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000003030303030404030404040404 +0000040000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000003030303030303030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000006164000000000064610064650000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000003030400040404040404000404040400 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000030303030303030000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000006263000000000063620063010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000003030303030304040400040404040404040400000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000030303030303030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000163000000000063010000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000003030303030303040004000404040404040000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000003030303 +0303030000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000006564000000000064650060650000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000303000000000400000404040404000004000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000003030303030303030000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +000000000000000000000000000000000000000000000000000000000000000000000060621B +6300631B62630065640000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000030303030303 +0300000000040404040404000404000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000030303030303030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000006361620162616300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000606101010000000000006361010161630000000063610101 +6163000000006361010161630000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000030303030303030000000404 +0404040404040400040000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000030303030303030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000621B6301000000000000621B63631B6200000000621B63631B6200000000 +621B63631B620000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000303030000000000000404040404040404 +0404040400000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000303030303030300000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000100000000001B6100000000616400001B6100000000616400001B610000000061 +6400000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000003030303030303000000000004040000040404040404000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000303030303030300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000656000000000606500006560000000006065000065600000000060650000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000303030303030300000000000000000004040404040400040004000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000062 +6300000000636200006263000000006362000062630000000063620000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000030303000000000000000000000404000404040404000404000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000030303030303 +0303000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000001000000000000 +0100000100000000000001000001000000000000010000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000030303030303 +0300000000000000040400040404040400040404040000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000303030303030300000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000001000000000000010000010000 +0000000001000001000000000000010000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000003030303030303000000000000 +0000000004040400040404040404040000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000062630000000063620000626300000000636200 +0062630000000063620000000000000000000000000000000001010101010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000303030000000000000000000000000404 +0004000404040404000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000303030303030303000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001010101010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000062000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000065600000000060650000656000000000606500006560000000 +0060650000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000303030303030303000000000000000000000000040004040404 +0400000404000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000003030303030303030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000061640000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000100000000001B6100000000616400001B6100000000616400001B61000000006164000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000303030303030300000000000000000000000004000404040404040404040404 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000003030303030303030000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000611B63000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000621B63631B6200000000621B63631B6200000000621B63631B6200000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000030303000000000000000000000000000000040404040404040404040400000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000303 +0303030303030000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001010101010101010100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000101010101010100000063610101 +6163000000006361010161630000000063610101616300000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000003030303030303 +0000000000000000000000000000000404040404040404040404000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000003030303030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000303030000000000000000 +0000000000000000000004000004040404040404040400000000000000000000000000000000 +0000000000000000000000000000000000000000000000000003030303030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000101010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000030303000000000000000000000000000000 +0000000000000404040404040404040400000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000030303030303030000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010101000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000060616201626160000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000303030303030303000000000000000000000000000000000004 +0404040404040404040400000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000030303030303030300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000006062646300636462600000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000003030303000000000000000000000000000000000000000000040404040404 +0404040004040000000000000000000000000000000000000000000000000000000000000000 +0000000000000000030303030303030300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000006564000000000064650000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000003 +0303030303030000000000000000000000000000000000000000000404040404040400040404 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000030303030303030300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000163000000000063010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000003030303030303 +0000000000000000000000000000000000000000040404040404040404040400000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000003 +0303000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000016300 +0000000063010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000303030303030300000000000000 +0000000000000000000000000000000404040404040404040004040400000000000000000000 +0000000000000000000000000000000000000000000000000000000000030303030303030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000656400000000006465 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000030303000000000000000000000000000000 +0000000000000000000004040400040404040404040000000000000000000000000000000000 +0000000000000000000000000000000000000000000000030303030303030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000646264630063646260000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000303030303030300000000000000000000000000000000000000 +0000000004040004040404040404040404000000000000000000000000000000000000000000 +0000000000000000000000000000000000030303030303030300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000006061620162616000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000030303030303030000000000000000000000000000000000000000000000000000 +0404040404040404040400000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000030303030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0300030300000000000000000000000000000000000000000000000000000004040400040404 +0404040004000000000000000000000000000000000000000000000000000000000000000000 +0000000000000303030303030303030000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000030003030000 +0000000000000000000000000000000000000000000000000000040004040404040404040404 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000003030303000000000000000000 +0000000000000000000000000000000000000000000404040404040404040404000000000000 +0000000000000000000000000000000000000000000000000000000000000000030303030303 +0303030000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000062600001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001010100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000030303030303030000000000000000000000000000 +0000000000000000000000000000000000040404040404040400040000000000000000000000 +0000000000000000000000000000000000000000000000000000000303030303030303000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000101010000000000000000000000000000000000 +0000000000000000000000000000000000000000000064620101010101010101010100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000030303030303030000000000000000000000000000000000000000 +0000000000000000000004040404040404040404040400000000000000000000000000000000 +0000000000000000000000000000000000000000000003030303030303000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000003030303030303030300000000000000000000000000000000000000000000000000 +0000000000000004040404040404040404000000000000000000000000000000000000000000 +0000000000000000000000000000000003030303030303030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000003 +0003030300000000000000000000000000000000000000000000000000000000000000000000 +0404040404040404040404040400000000000000000000000000000000000000000000000000 +0000000000000000000003030303030303030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000003030303030000 +0000000000000000000000000000000000000000000000000000000000000000040404000404 +0404040404040400000000000000000000000000000000000000000000000000000000000000 +0000000000030303030303030000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000303030303030300000000000000 +0000000000000000000000000000000000000000000000000000000400040404040404040404 +0400000000000000000000000000000000000000000000000000000000000000000000000003 +0303030303030300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000003030303030303000000000000000000000000000000 +0000000000000000000000000000000000000000000004040404040404040404040000000000 +0000000000000000000000000000000000000000000000000000000000000003030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000030303030303030000000000000000000000000000000000000000 +0000000000000000000000000000000404040404040404040404000000000000000000000000 +0000000000000000000000000000000000000000000000000000030303030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000030303030300000000000000000000000000000000000000000000000000000000 +0000000000000000000000040404040404040404040004000000000000000000000000000000 +0000000000000000000000000000000000000000030303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000040404040404040404040400040404000000000000000000000000000000000000 +0000000000000000000000000000030303030303030300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000006065000000610165000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000003030303030303030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0400040404040404040404040400000000000000000000000000000000000000000000000000 +0000000000000000030303030303030300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000656000006465631B1B0000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000404040404 +0404040404040404000000000000000000000000000000000000000000000000000000000000 +0000000303030303030303000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000016300 +0061640063620000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000303030300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004000404040404040404 +0404040000000000000000000000000000000000000000000000000000000000000000030303 +0303030303000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000006263000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000303030303030300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040404040404040404040404000000 +0000000000000000000000000000000000000000000000000000000000030303030303030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000626300630100006362000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000003030303030303000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004000404040404040404040404040000000000000000 +0000000000000000000000000000000000000000000000000303030303030303000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +00000000000000000000000000000000001B1B00616100006461000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000030303 +0303000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040404040404040404040404040004000000000000000000000000 +0000000000000000000000000000000000000303030303030303030000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000006101656300006560000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000003030303030303000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000040404040404040404040404000404000000000000000000000000000000000000 +0000000000000000000000000003030303030303000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000303030303030303000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0404040404040404040404040400000000000000000000000000000000000000000000000000 +0000000000000303030303030303030000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000030303030303030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000404040404 +0404040404040004000000000000000000000000000000000000000000000000000000000000 +0303030303030303030300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000303030303000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040000040404040404040404 +0404040000000000000000000000000000000000000000000000000000000000000303030303 +0303030303000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040404040404040404040404000000 +0000000000000000000000000000000000000000000000000000000003030303030303030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000646200000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000030000000003030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000004040404040404040400040000000000000000 +0000000000000000000000000000000000000000000003030303030303030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010101010101010101626000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000030003000003030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000404040404040404040404040000000000000000000000000000 +0000000000000000000000000000000000030303030303030303000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000030303030303030303000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000404040004040404040404000400000000000000000000000000000000000000 +0000000000000000000003030303030303030303000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0060650000006101650000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001010100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000030303030303030303000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0004000404040404040400040400000000000000000000000000000000000000000000000000 +0000000303030303030303030303030000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010101000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000006560000064 +65631B1B00000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000003030303030303000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000004040404 +0404040404040400040000000000000000000000000000000000000000000000000000000000 +0303030303030303030300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000163000061640063620000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000003030303 +0303030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004000404040404040404 +0004000000000000000000000000000000000000000000000000000000000000030303030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000062630000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000030303030303030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000004040404040404040404040000 +0000000000000000000000000000000000000000000000000000030303030303030303030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000006263006301000063620000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000300 +0000000000000000000000000000000000000000000303030303030303030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000404000404040404040404040400000000000000 +0000000000000000000000000000000000000000000303030303030303030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000001B1B006161000064610000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000300000000000000 +0000000000000000000000000000030003030303030303030303000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000400040404040404040404040400000000000000000000000000 +0000000000000000000000000000000003030303030303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000061016563000065600000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000300000000000000000300000000 +0000000000000000030303030303030003000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004040404040404040404040000040000000000000000000000000000000000 +0000000000000000000303030303030303030303030303000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000303030303030300000000000303000300000300000300 +0003030303030303000003000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0404040004040404040404040004000000000000000000000000000000000000000000000000 +0000000000030303030303030303030303030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000003000000000300000300000300030303000300000300000303030303030303 +0000000003000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040404 +0404040404000404000000000000000000000000000000000000000000000000000000000303 +0303030303030303030303030300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0003000000000300000300000303030303030300000300000303030303030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004040404040404040404 +0404000000000000000000000000000000000000000000000000000000000003030303030303 +0303030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000006065620100006560000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000300030000 +0303030303030303030303030303030303030303030303030300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040404040404040404040400000000 +0000000000000000000000000000000000000000000000000000030303030303030303030303 +0303000300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000646260630100006065000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000006061010100000000000063610101616300000000636101016163000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000030303030303030300000003030303 +0303030303030300030303030303030303030300000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000040404040404040404040404000400000000000000 +0000000000000000000000000000000000000000000303030303030303030303030000030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000626000000100000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +621B6301000000000000621B63631B6200000000621B63631B62000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000030000000000000000000000000000030003000300030300000003030003030003030300 +0300030303030303030303030000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000400040404040404040404040000000000000000000000000000 +0000000000000000000000000000000003030303030303030303030300030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000100006301000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000001B6100000000616400001B610000000061640000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000003000000 +0003000000000000000000030003030303030303030303030303030003000303030303030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004000404040404040404040004000400000000000000000000000000000000 +0000000000000000000000030303030303030303030303030303030000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000065640000010000 +6465000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000656000 +0000006065000065600000000060650000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000300000000000003000000000300000000 +0300030303030303030303030300000003030303030303000000000303000300000303030000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000040404040404040404040400040000000000000000000000000000000000000000000000 +0000000000030303030303030303030303030303030300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000060621B63016364626300000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000626300000000636200 +0062630000000063620000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000300000003030303030303000300000000030000030003 +0003000303030303030303000003000000000000000303000300000003000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040404 +0404040404040404040400000000000000000000000000000000000000000000000000000303 +0303030303030303030303030303030300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000636162016261630000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000010000000000000100000100000000 +0000010000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000300000003000003000303030303030300030000030003000300000003 +0300000003000003000000000303030303030300000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004040404040404040404 +0404040000000000000000000000000000000000000000000000000000000000030303030303 +0303030303030303030300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000010000000000000100000100000000000001000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0303030303030303000003000003000300030303030303030303030300000000030000000000 +0003000000000000000300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000004040404040404040404040400040400 +0000000000000000000000000000000000000000000000000000000303030303030303030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000626300000000636200006263000000006362000000000000000000 +0000000000000001010101010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000030000 +0003000003000003000300000000030000030000000000000000030000000000000000000000 +0000000300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000404040404040404040404040004000400000000 +0000000000000000000000000000000000000000000303030303030303030303030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000101010101000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001010101010101010100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000656000000000606500006560000000006065000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000030303030303030303 +0303030303000300030000030000000000000000000000000000000000000000000000030000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000404040404040404040404040400040000000000000000000000 +0000000000000000000000000000000003030303030303030303030303030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +631B610000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000100000000001B +6100000000616400001B61000000006164000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000030000000300000000000300000000 +0300030000030000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000404040404040404040404040404000004000000000000000000000000000000 +0000000000000000000000000303030303030303030303030300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000001B1B0000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000621B63631B62 +00000000621B63631B6200000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000300000000000300000000030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0404040404040404040404040404000400000000000000000000000000000000000000000000 +0000000000000303030303030303030303030303030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000063620000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001010101010101000000636101016163000000006361 +0101616300000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000300000000000300030303030303030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000400040404 +0404040404040404040000000000000000000000000000000000000000000000000000000000 +0003030303030303030303030303030000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004040404040404040404 +0404040404000000000000000000000000000000000000000000000000000000030303030303 +0303030303030303030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000060620000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000101010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000030000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000004040004040404040404040404040404 +0404000000000000000000000000000000000000000000000000000303030303030303030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001010100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000636062640000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000003000000000000000000 +0000000000000000030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000400000404040404040404040404040404040000000000 +0000000000000000000000000000000000000000000303030303030303030303030303000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010101 +0101016564000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000003000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000404040404040404040404040404000000000000000000000000 +0000000000000000000000000000000303030303030303030303030303030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000003000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000404040404040404040404040404040000040000000000000000000000000000 +0000000000000000000003030303030303030303030303000003000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000003030303030303000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0004040404040404040404040404040004000000000000000000000000000000000000000000 +0000000000000303030303030303030303030303000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000003000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000040000040404 +0404040404040404040400000400000000000000000000000000000000000000000000000303 +0303030303030303030303030303000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010101010101010101010101000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004040404040404040404 +0404040400040400000000000000000000000000000000000000000000000000000303030303 +0303030303030303030303000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000611B6300631B6100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000004040404040404040404040404040404 +0404000000000000000000000000000000000000000000000000000303030303030303030303 +0303000003000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000061 +6400000000001B61000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004000004040404040404040404040404040000000004 +0000000000000000000000000000000000000303030303030303030303030303030303030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000062630000000000 +6362000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000004040404040404040404040404040400040404000000000000 +0000000000000000000000000000000300000003030303030303030303030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001630000000000630100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000404000404040404040404040404040404040400000000000000000000000000 +0000000000000000000300000003030303030303030303030303030300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000065640000000000646500000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0400040404040404040404040404040404040400000000000000000000000000000000000000 +0000000300000003030303030303030303030300000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000063621B6300631B626300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001010100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000404040404 +0404040404040404040404040404000000000000000000000000000000000000000000000000 +0000000303030303030303030300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0101010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000636162016261630000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040404040404040404040404 +0404040404040404000400000000000000000000000000000000000000000000000003030303 +0303030303030300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000404040404040404040404040404 +0404040000000400000000000000000000000000000000000000000003030303030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000404040404040404040404040404040404040404 +0000000000000000000000000000000000000000000303030303030303030303030300000300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040004040404040404040404040404040404040400040000000000 +0000000000000000000000000000000000030303030303030303030303030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000060656201000065600000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000404040404040404040404040404040404040004000004000000000000000000 +0000000000000000000000030303030303030303030303030300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000006462606301000060650000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000040404040404040404040404040404040400000400000000000000000000000000000000 +0000000003030303030303030303030303030303030300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000006260000001000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040404 +0404040404040404040404040404040000000000000000000000000000000000000000000003 +0303030303030303030303030300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000001000063010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000040404040404040404 +0404040404040404040404000000000000000000000000000000000000000003030303030303 +0303030303030303030300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000656400 +0001000064650000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000004040404040404040404040404040404 +0404040400000000000000000000000000000000000000000000030303030303030303030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +000000000000000000000000000000000000000000000000000000000060621B630163646263 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000040004040404040404040404040404040404040004 +0000000000040000000000000000000000000003030303030303030303030303030303030000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000006361620162616300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004000004040404040404040404040404040404000400040000000400 +0000000000000000000000000000030303030303030303030303030303030303030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000400040404040404040404040404040404040400000400040400000000000000 +0000000000000000030303030303030303030303030303030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0000040404040404040404040404040404040404040004040004000000000000000000000000 +0000030303030303030303030303030303030300000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000620000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000404040404 +0404040404040404040404040404040404040400000000000000000000000000000003030303 +0303030303030303030303030000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000061 +6400000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004040004040404040404 +0404040404040404040400040400000000000000000000000000000000000003030303030303 +0303030303030300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000611B63000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000004040404040404040404040404040404 +0404040404000004000000000000000000000000000000030303030303030303030303030303 +0303030000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001010101010101010100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000400000404040404040404040404040404040404040004 +0000000000000000000000000000000003030303030303030303030303030303030303000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040404040404040404040404040404040404040404040400000000 +0000000000000000000000000003030303030303030303030303030303000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000004040000040400040404040404040404040404040404040400000000000000000000 +0000000000000003030303030303030303030303030303000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040400 +0000000404040404040404040404040404040404000400000000000000000000000000000000 +0003030303030303030303030303030303030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000404 +0004040404040404040404040400040000000000000000000000000000000000000003030303 +0303030303030303030303030300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000040400000404040404 +0404040404040404000404000000000004000000000000000000000303030303030303030303 +0303030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000003000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040404040404040404040404 +0404040400040000000400000000000000000000000303030303030303030303030303030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000003000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000004000004040404040404040404040404040000 +0400040000000000000000000000000000000303030303030303030303030300000300000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000030000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000101010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000400040404040404040404040404000000000400000000 +0000000000000000000000000303030303030303030303030303000300000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000003000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010101000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000630000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000303030303030300000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004040404040404040404040404040400040004000000000000000000 +0000000000030303030303030303030303030303030303030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000003000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0060000001000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000404040404040404040404040404040400040404040000000004000000000303 +0303030303030303030303030303030303030300000000000000000000000000000000000000 +0000000000000000000000000000000000000003030303030303000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000101610163 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000300000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0404040404040404040404040404040400040404040000000400000000000000000303030303 +0303030303030300030303030000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000003000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000060610101626501630000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000404040404040404 +0404040404040404040004000400000400040000000000000000030303030303030303030303 +0303030303030303030000000000000000000000000000000000000000000000000000000000 +0000000000000000000003000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000163641B01016261000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000404040404040404040404040404 +0404000400040000000004000000000000000000000303030303030303030303030303030303 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0003030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000006164630100000001636461000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000004040404040404040404040404040404000400 +0404040400040004000000000000000000030303000303030303030003030303000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000006162010161646301000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000004040404040404040404040404040404040004000404000000 +0400000000000000000000030303030303030303030303030303030303000000000000000000 +0000000000000000000000000000000000000000000000000000000000000300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000630165620101616463000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004040404040404040404040404040404040400040404040004000400000000 +0000000000000300000303030303030003030303030300030000000000030000000000000000 +0000000000000000000000000000000000000000000000000300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100006301616201000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0004040404040404040404040404040404040004040000000400000000000000000000000000 +0303030303030303030303030303030303030000000000030000000000000000000000000000 +0000000000000000000000000000000303030303030300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000100 +0060000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000040004040404 +0404040404040404040404040404040404040004000400000000000000000000000000030303 +0303030303030303030303030000000300030000000000000000000000000000000000000000 +0000000000000000000000000300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000630000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000006061010100000000 +0000636101016163000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004000404040404040404 +0404040404040400040404000000040000000000000000000000000303030303030303030303 +0303030303030303030303030303030000000000000000000000000000000000000000000000 +0000000000000300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000621B6301000000000000621B6363 +1B62000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000400040404040404040404040404040404 +0404040404040004000400000000000000000000000000030303030303030303030303030303 +0000000300030000000000000000000000000000000000000000000000000000000000000000 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000001B61000000006164000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004040404040404040404040404040404040404040000 +0400000000000000000000000000000303030303030303030303030303030303030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000006560000000006065000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000404040404040404040404040404040404040404040004000400000000 +0000000000000000000000000303030303030303030303030303000000030003000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000006263000000006362000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000040404040404040404040404040404040400000404040400000000000000 +0000000303030303030303030303030303030303030000030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000100000000000001000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0004040404040404040404040404040404040404040004040000000000000000000000000000 +0303030303030303030303030300030000030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000100000000000001000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000400040404 +0404040404040404040404040004040404000000000000000000000000000000030303030303 +0303030303030303030000030003030000000300000000000000000000000000000300000000 +0000000000000000030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000626300 +0000006362000000000000000000000000000000000101010101000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040004040404040404040404 +0404040004040400040400000000000000000000000000030303030303030303030303030303 +0303030303030003030000000300000000000000000000000000000300000000000000000000 +0000030000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000101010101000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000656000000000606500 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000004040404040400040004000004 +0004040404000000000000000000000000000000030303030303030303030303030303000003 +0003030000000300000000000000000000000000000300000000000000000000000003000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000100000000001B6100000000616400000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000404040404040404000000040400040404000404 +0000000000000000000000030303030303030303030303030303030303030303030303030303 +0303030300000000000000000303030303030300000000000003030303030303000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000001000000000000621B63631B620000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040404040404040404040404040404040404040004040400040004 +0000000000000000030303030303030303040303030303040303030303000000030000000000 +0000000000000000000300000000000300000000000003000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010101010101010000006361010161630000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000004040404040404040404040404040404000404040004000400000000000000 +0000030003030303030303030403030304000303030303000000030000000000000000000000 +0000000300000000000300000000000003000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0404040404040404040404040400040404040404000400040000000000000000000003000303 +0303030303030304030403000303030303000000030000000000000000000000000000030000 +0000000300000000000003000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010101000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000004000404040404 +0404040404040404040404040404040404000000040000000000000303030303030403030304 +0304040303040303030303030303000000000000000000030000000003030000030303030303 +0300000000000000000000000000000000000000000003000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001010100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000040004040404040404040404 +0404040404040404040400040004000000000000000003030303030304030303040403040400 +0303030303000300000000000000000000030000000003030000000000030000000000000000 +0000000000000000000000000000000003000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000404040404040404040404040404040404 +0404040004000400000000000000000003030303030303040304040403040400030303030300 +0300000000000000000000030000000003030000000000030000000000000000000000000000 +0000000000000000000003000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000040404040404040404040404000404040404040404040004 +0004000000000003030303030303030303030404030304030304030303030303030303030000 +0000030303030303030303030303030000030000000000000000000000000000000000000000 +0003030303030303000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000404040404040404040404040404040404040404040404040004000000 +0000000003030000030303040304030403040300030303030300030300000000000000000003 +0000000003030003000000030000000000000300000000000000000000000000000000000300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000040004040404040404040404040404040404040404040400000400000000000000000303 +0000030304030303040303030400030303030300030300000000000000000003000000000303 +0003000000030000000000000300000000000000000000000000000000000300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000400040404 +0404040404040404040404040404040404040400040004000000000000000303000003040303 +0304030403030304030303030300030300000000000000000003000000000303000300000003 +0000000000000300000000000000000000000000000000000300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000030303030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000040404040404 +0404040404040404040404000004000000000000000000000003030303030303030303030303 +0303030303030303030303030300000000000000000000000303030303030303030303030303 +0303030300000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000004040404040404040404040404 +0404040404040400040000000000000000000000000003030303030303030303030003030303 +0300030300000000000000000000000000000000000300000003000000000000030000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000004000404040404040404040404040404040404040404 +0404000404000004000000000004000003040303030304040303030304040303030003030300 +0300000300000300000000030003000303000003030000000000030000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000040404040404040404040404040404040404040404040404040400 +0000040000000400000003030403030304040403030404030303030003030300030000030000 +0300000000030003000303000003030000000000030000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000400040404040404040404040404040404040404040404000000000000040004 +0000000003030304030403030404040403030303030000030300030000030000030000000003 +0003000303000000030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000101010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0004000004040404040404040404040404040400040400000000000000000400000303030303 +0303040303030304040303030303030303030303030303030303030303030303030303030303 +0303030303030000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010101000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000040004040404 +0404040404040404040404040404040404000000000000040004000000000303030403040303 +0404040403030303030000030300030000030000030000000003000300030300000003000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000004000004040404040404040404 +0404040404040404040004040000000004000000040000000303040303030404040303040403 +0303030000030300030000030000030000000003000300030300000003000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000404000404040404040404040404040404040404 +0404040404040400000400000000000400040404040403040404040403040404030303030303 +0300030303030000030300030003030303030303030303030300030303000000000000000000 +0000000000000003000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000040004000404040404040404040404040404040404040404 +0000040004000000040000000404030404040404040304040403030303030303030003030303 +0000000300030000030303000303030303030300030303000000000000000000000000000000 +0003000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000400040004040404040404040404040404040404040404000400000004 +0004000000000304040404040404040404040303030303030303030003030303000000030003 +0000030303000303030303030300030303000000000000000000000000000000000300000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000004000400040400040404040404040404040404040000040000000000040000030303 +0303040403040403040404030303030303030303030303030303030303030303030303030303 +0303030303030303030303030303000000000000000000000303030303030300000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040004 +0004040404040404040404040404040404040404000400000004000400000000030404040404 +0404040404040303030303030303030003030303000000030003000003030300030303030303 +0300030303000000000000000000000000000000000300000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004000400040404040404 +0404040404040404040404040404000004000400000004000000040403040404040404030404 +0403030303030303030003030303000000030003000003030300030303030303030003030300 +0000000000000000000000000000000300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000400040004040404040404040404040404 +0404040404040404040000040000000000040004040304040304040404040304040403030303 +0303030003030303000000030003000003030300030303030303030003030300000000000000 +0000000000000000000300000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000400040404040404040404040404040404040404040404 +0404040000040404000003040404040404040304040404040304040403040303030303030303 +0303000003030003030303030303030303030303030303030300000303000000000000000000 +0000000000000000030000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000004000404040404040404040404040404040404040404040404000000 +0404000004040000040404040404040404030404040304030303030303030303030300000303 +0003030303030303030303030303030303030300000303000000000000000000000000000000 +0000030000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000040004040404040404040404040404040404040404040000040004000404040400 +0000000404040404040404040404030403030303030303030303030300000303000303030303 +0303030303030303030303030300000303000000000000000000000000000000000003000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0400040404040404040404040404040404040404000000000400000304040303030303030404 +0404040304040403040303030303030303030303030303030303030303030303030303030303 +0303030303030303030303030303000000000000000000000003030303030303000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000004000404040404 +0404040404040404040404040404040000040004000404040400000000040404040404040404 +0404030403030303030303030303030300000303000303030303030303030303030303030303 +0300000303000000000000000000000000000000000003000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000400040404040404040404040404 +0404040404040404040404000000040400000404000004040404040404040403040404030403 +0303030303030303030300000303000303030303030303030303030303030303030000030300 +0000000000000000000000000000000003000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000040004040404040404040404040404040404040404 +0404040404000004040400000304040404040404030404040404030404040304030303030303 +0303030300000303000303030303030303030303030303030303030000030300000000000000 +0000000000000000000003000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000004040004040404040404 +0404040404040404040404040404040404040404040404040404040403040404040403040404 +0403030303030303030303030303030303030303030303030303030303030303030303030303 +0300030303000000030003000303030000000300000000000000000000030000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000040400040404000404040404040404 +0404040404040404040404040404040404000404040404040404040404040404030303030303 +0303030303030303030303030303030303030303030303030303030303030303030003030300 +0000030003000303030000000300000000000000000000030000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000404040404040404040404040404040404040404 +0404040404040404040400000004040404040404040404040403030303030303030303030303 +0303030303030303030303030303030303030303030303030303030003030300000003000300 +0303030000000300000000000000000000030000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010101 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000004040004040400040404040404040404040004040404040404 +0404040000000003040404040403040404040303030303030303030303030303030303030303 +0303030303030303030303030303030303030303030303030303030303030303030303030303 +0303030300000000030303030303030000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001010100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000404040404040404040404040404040404040404040404040404040404040000 +0004040404040404040404040403030303030303030303030303030303030303030303030303 +0303030303030303030303030303030003030300000003000300030303000000030000000000 +0000000000030000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0400040404000404040404040404040404040404040404040404040404040400040404040404 +0404040404040404030303030303030303030303030303030303030303030303030303030303 +0303030303030303030003030300000003000300030303000000030000000000000000000003 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000404000404040404 +0404040404040404040404040404040404040404040404040404040404040304040404040304 +0404040303030303030303030303030303030303030303030303030303030303030303030303 +0303030003030300000003000300030303000000030000000000000000000003000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000606101010000000000000000000000 +0000000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000621B63010000000000000000000000000000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000040400 +0404000404040404040404040404040404040404040404040404040404040404040404040404 +0404040404040404040303040303030303040303030303030303030303030303030303030303 +0303030303030303030303030303030303000303030000030303030303000000000303030300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000100000000000000000000000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000010000000000000000000100 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000000000000000 +0000000000000000000100000000000000000100000000000000000000000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000010404000404040404 +0401040404040404040404040404040404040404040404040404040404040404040404040404 +0404030304030403030304030303030303030303030303030303030303030303030303030303 +0303030303030303030303000303030000030303030303000000000303030300000000000000 +0000000000000000000000000100000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000000000000000000000000000000000100000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000100000000000000000000000000000000000000000000000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000000000000000000000000000010000000000000000000100000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000000000000000000000000000 +0000000100000000000000000100000000000000000000000000000000000000000000000000 +0000000100000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000010004040404040404040404040404 +0404040404040404040404040404040404040404040404040404040404040404040403040303 +0304030403030303030303030303030303030303030303030303030303030303030303030303 +0303030303000303030000030303030303000000000303030300000000000000000000000000 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000000000000000000000000000000000100000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010101010101010101 +0101010101010101010101010101010101010101010101010101010101010100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000004040404040404040404040404040404040404040404040404 +0404040404040404040404040404040404040404040403040303030403040303030303030303 +0303030303030303030303030303030303030303030303030303030303030300030303000003 +0303030303000000000303030300000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000404000404040404040004040404040404040404040404040404040404040404 +0404040404040404040404040404040403030403040303030403030303030303030303030303 +0303030303030303030303030303030303030303030303030300030303000003030303030300 +0000000303030300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000004 +0400040400040404040404040404040404040404040404040404040404040404040404040404 +0404040404040404040404030304030303030304030303030303030303030303030303030303 +0303030303030303030303030303030303030300030303000003030303030300000000030303 +0300000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000101010101 +0101000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000606101010000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000606101010000000000006361010161630000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000606101 +0100000000000063610101616300000000636101016163000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000060610101000000000000636101016163000000006361010161 +6300000000636101016163000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000060610101000000000000 +6361010161630000000063610101616300000000636101016163000000000063610101616300 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000006061010100000000000063610101616300000000636101016163000000006361 +0101616300000000006361010161630000000063610101616300000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000062 +1B63010000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000621B6301000000000000621B63631B620000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000621B63010000000000 +00621B63631B6200000000621B63631B62000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000621B6301000000000000621B63631B6200000000621B63631B620000000062 +1B63631B62000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000621B6301000000000000621B63631B62 +00000000621B63631B6200000000621B63631B620000000000621B63631B6200000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +621B6301000000000000621B63631B6200000000621B63631B6200000000621B63631B620000 +000000621B63631B6200000000621B63631B6200000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000100000000001B6100000000616400000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000100000000001B6100000000 +616400001B610000000061640000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000100000000001B6100000000616400001B6100000000616400001B61000000006164 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000100000000001B6100000000616400001B6100 +000000616400001B610000000061640000001B61000000006164000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000001B6100000000616400001B6100000000616400001B610000000061640000001B610000 +0000616400001B61000000006164000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000656000000000606500000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000000000656000000000606500006560 +0000000060650000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000065600000000060650000656000000000606500006560000000006065000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000065600000000060650000656000000000606500 +0065600000000060650000006560000000006065000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000656000 +0000006065000065600000000060650000656000000000606500000065600000000060650000 +6560000000006065000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000001000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000626300000000636200000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000000000626300000000636200006263000000006362 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000006263 +0000000063620000626300000000636200006263000000006362000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001000000000062630000000063620000626300000000636200006263000000 +0063620000006263000000006362000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010000000000626300000000636200 +0062630000000063620000626300000000636200000062630000000063620000626300000000 +6362000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000001000000000001 +0000000000000100000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000010000000000010000000000000100000100000000000001000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000100000000000001 +0000010000000000000100000100000000000001000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000001000000000000010000010000000000000100000100000000000001000000 +0100000000000001000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000010000000000010000000000000100000100000000 +0000010000010000000000000100000001000000000000010000010000000000000100000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000001000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000001000000000000 +0100000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000010000000000010000000000000100000100000000000001000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000100000000000001000001000000 +0000000100000100000000000001000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000100000000 +0001000000000000010000010000000000000100000100000000000001000000010000000000 +0001000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000010000000000010000000000000100000100000000000001000001 +0000000000000100000001000000000000010000010000000000000100000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000001000000000062630000000063620000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +0000626300000000636200006263000000006362000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000006263000000006362000062630000000063620000 +6263000000006362000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000100000000006263000000 +0063620000626300000000636200006263000000006362000000626300000000636200000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000010000000000626300000000636200006263000000006362000062630000000063 +6200000062630000000063620000626300000000636200000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000100 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000001000000000065600000000060650000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000001000000000065600000 +0000606500006560000000006065000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000006560000000006065000065600000000060650000656000000000 +6065000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000100000000006560000000006065000065 +6000000000606500006560000000006065000000656000000000606500000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000001 +0000000000656000000000606500006560000000006065000065600000000060650000006560 +0000000060650000656000000000606500000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000100000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000100000000001B610000000061640000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000100000000001B610000000061640000 +1B61000000006164000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0100000000001B6100000000616400001B6100000000616400001B6100000000616400000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000100000000001B6100000000616400001B610000000061 +6400001B610000000061640000001B6100000000616400000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000100000000001B +6100000000616400001B6100000000616400001B610000000061640000001B61000000006164 +00001B6100000000616400000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0001000000000000621B63631B62000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001000000000000621B63631B6200000000621B63631B +6200000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +00621B63631B6200000000621B63631B6200000000621B63631B620000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000001000000000000621B63631B6200000000621B63631B6200000000621B +63631B620000000000621B63631B620000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000001000000000000621B63631B62 +00000000621B63631B6200000000621B63631B620000000000621B63631B6200000000621B63 +631B620000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000101010101010100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000101010101010100 +0000636101016163000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000001010101010101000000636101016163000000006361010161630000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000010101010101010000006361010161 +6300000000636101016163000000006361010161630000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0101010101010100000063610101616300000000636101016163000000006361010161630000 +0000006361010161630000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000001010101010101000000636101016163000000006361 +0101616300000000636101016163000000000063610101616300000000636101016163000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000100000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000063016100000000000000000000000000000000000001000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000100000000000000000000006101630000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000100000000000000000000000000010000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000061620000000000000000000000000000000000000001000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000010000 +0000000000000000000062610000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000100000000000000000000000000010000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +6301600000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000010000000000000000 +0000000060016300000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000100000000636101621B00000001010101010000006065016264000000000100 +1B62016264000000006361620162640065600000000000636200000000000000646500000000 +01006162621B0000616201610000000001000000006361620162640000010061620100006065 +01016560000000001B6201016560000000606501626400000000006361620162640000606501 +01656000000001001B620162640000000063650162610001000000001B620101656000000065 +6400000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +010000000062640063611B0000000100000000006362640060626000000001611B6300606264 +000063621B630060610064650000000000611B00000000000000656400000000016164636365 +1B6164636365640000000100000063621B630060610000016164000000606264636364626000 +00611B630063606500006362640060626000000063621B630060610060626463636462600000 +01611B6300606264000063626463631B6101000000611B630063606500000064610000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000010000000000 +0000006362000000010000000000611B0000006065000000011B0000000060650000611B0000 +0000000000626300000063016300000000000000626300000000016400000060016400000060 +6500000001000000611B00000000000000011B00000000616400000000646100000100000000 +00000000611B0000006065000000611B00000000000061640000000064610000011B00000000 +60650000611B000000001B010000000100000000000000000063620000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000001000000001B620101010100 +000001000000000062630000006362000000016300000000636200006263000000000000001B +610000001B610000000000000000010000000000016300000000016300000000010000000100 +0000626300000000000000016300000000626300000000636200006561630000000000006263 +0000006362000000626300000000000062630000000063620000016300000000636200006263 +0000000063010000006561630000000000000000010000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000010000006165600000000100000001000000 +0000010101010101010000000100000000000001000001000000000000000063626300006260 +0000000000000000010000000000010000000000010000000000010000000100000001000000 +0000000000010000000000010000000000000100006361016261600000000101010101010100 +0000010000000000000001000000000000010000010000000000000100000100000000000001 +0000006361016261600000000000010000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000010000006263000000630100000001000000000062630000 +0000000000000100000000000001000062630000000000000000611B00646500000000000000 +0000626300000000010000000000010000000000010000000100000062630000000000000001 +0000000000626300000000636200000000006364656100006263000000000000000062630000 +0000000062630000000063620000010000000000000100006263000000006301000000000000 +6364656100000063620000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000100000062630000001B0100000001000000000061640000000000000000 +01000000000000010000611B0000000000000000636200656400000000000000000061640000 +00000100000000000100000000000100000001000000611B0000000000000001000000000061 +64000000006461000000000000006301000061640000000000000000611B0000000000006164 +000000006461000001000000000000010000611B000000001B01000000000000000063010000 +0064610000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +000001000000616163631B610100000062640000000063626463006065000000010000000000 +0001000063621B6300606100000000651B620000000000000000000064650000000001000000 +0000010000000000010000000100000063621B63006061000001000000000060626463636462 +60000065646300631B6500006362646300606500000063621B63006061006062646363646260 +000001000000000000010000636264636364610100000065646300631B650000006564000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000001000000 +6361620161000100000060620101000000606501016560000000010000000000000100000063 +61620165640000000060011B0000000000000000000063016000000001000000000001000000 +0000010000000100000000636162016564000001000000000000646501016560000000606162 +01621B0000000060650101656000000000636162016564000064650101656000000001000000 +000000010000006365016261000100000060616201621B000000600163000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001630000000000000000000000616200000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000626100000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000631B6100 +0000000000000000000000630161000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000061016300000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000101610000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000 + +end +%%PageTrailer +%%Trailer +%%EOF diff --git a/doc/libmicrohttpd_performance_data.png b/doc/libmicrohttpd_performance_data.png new file mode 100644 index 0000000..0e447c2 Binary files /dev/null and b/doc/libmicrohttpd_performance_data.png differ diff --git a/doc/mdate-sh b/doc/mdate-sh new file mode 100755 index 0000000..9e2c0c9 --- /dev/null +++ b/doc/mdate-sh @@ -0,0 +1,228 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2015-04-09.19; # UTC + +# Copyright (C) 1995-2014 Free Software Foundation, Inc. +# written by Ulrich Drepper , June 1995 +# +# 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, see . + +# 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. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +fi + +case $1 in + '') + echo "$0: No file. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification day of FILE, in the format: +1 January 1970 + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +error () +{ + echo "$0: $1" >&2 + exit 1 +} + + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# Use UTC to get reproducible result +TZ=UTC +export TZ + +# GNU ls changes its time format in response to the TIME_STYLE +# variable. Since we cannot assume 'unset' works, revert this +# variable to its documented default. +if test "${TIME_STYLE+set}" = set; then + TIME_STYLE=posix-long-iso + export TIME_STYLE +fi + +save_arg1=$1 + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi +# Avoid user/group names that might have spaces, when possible. +if ls -n /dev/null 1>/dev/null 2>&1; then + ls_command="$ls_command -n" +fi + +# A 'ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named "Jan", or "Feb", etc. However, it's unlikely that '/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`$ls_command /` + +# Find which argument is the month. +month= +command= +until test $month +do + test $# -gt 0 || error "failed parsing '$ls_command /' output" + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +test -n "$month" || error "failed parsing '$ls_command /' output" + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\\\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# 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-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/doc/stamp-vti b/doc/stamp-vti new file mode 100644 index 0000000..72da5d7 --- /dev/null +++ b/doc/stamp-vti @@ -0,0 +1,4 @@ +@set UPDATED 9 December 2017 +@set UPDATED-MONTH December 2017 +@set EDITION 0.9.59 +@set VERSION 0.9.59 diff --git a/doc/texinfo.tex b/doc/texinfo.tex new file mode 100644 index 0000000..85f184c --- /dev/null +++ b/doc/texinfo.tex @@ -0,0 +1,10079 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2013-02-01.11} +% +% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, +% 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +% +% This texinfo.tex 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 3 of the +% License, or (at your option) any later version. +% +% This texinfo.tex file 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, see . +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. This Exception is an additional permission under section 7 +% of the GNU General Public License, version 3 ("GPLv3"). +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or +% http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or +% http://www.gnu.org/software/texinfo/ (the Texinfo home page) +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexraggedright=\raggedright +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t +\let\ptextop=\top +{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putworderror\undefined \gdef\putworderror{error}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\ampChar = `\& +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dashChar = `\- +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\hashChar = `\# +\chardef\lquoteChar= `\` +\chardef\questChar = `\? +\chardef\rquoteChar= `\' +\chardef\semiChar = `\; +\chardef\slashChar = `\/ +\chardef\underChar = `\_ + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt } + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\thisisundefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% @errormsg{MSG}. Do the index-like expansions on MSG, but if things +% aren't perfect, it's not the end of the world, being an error message, +% after all. +% +\def\errormsg{\begingroup \indexnofonts \doerrormsg} +\def\doerrormsg#1{\errmessage{#1}} + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Output a mark which sets \thischapter, \thissection and \thiscolor. +% We dump everything together because we only have one kind of mark. +% This works because we only use \botmark / \topmark, not \firstmark. +% +% A mark contains a subexpression of the \ifcase ... \fi construct. +% \get*marks macros below extract the needed part using \ifcase. +% +% Another complication is to let the user choose whether \thischapter +% (\thissection) refers to the chapter (section) in effect at the top +% of a page, or that at the bottom of a page. The solution is +% described on page 260 of The TeXbook. It involves outputting two +% marks for the sectioning macros, one before the section break, and +% one after. I won't pretend I can describe this better than DEK... +\def\domark{% + \toks0=\expandafter{\lastchapterdefs}% + \toks2=\expandafter{\lastsectiondefs}% + \toks4=\expandafter{\prevchapterdefs}% + \toks6=\expandafter{\prevsectiondefs}% + \toks8=\expandafter{\lastcolordefs}% + \mark{% + \the\toks0 \the\toks2 + \noexpand\or \the\toks4 \the\toks6 + \noexpand\else \the\toks8 + }% +} +% \topmark doesn't work for the very first chapter (after the title +% page or the contents), so we use \firstmark there -- this gets us +% the mark with the chapter defs, unless the user sneaks in, e.g., +% @setcolor (or @url, or @link, etc.) between @contents and the very +% first @chapter. +\def\gettopheadingmarks{% + \ifcase0\topmark\fi + \ifx\thischapter\empty \ifcase0\firstmark\fi \fi +} +\def\getbottomheadingmarks{\ifcase1\botmark\fi} +\def\getcolormarks{\ifcase2\topmark\fi} + +% Avoid "undefined control sequence" errors. +\def\lastchapterdefs{} +\def\lastsectiondefs{} +\def\prevchapterdefs{} +\def\prevsectiondefs{} +\def\lastcolordefs{} + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingyyy.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 24pt + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \indexdummies + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1\relax \unvbox#1\relax +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\argtorun{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \argtorun. +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as environments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At run-time, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Environment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + outside of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal. + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\unskip\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=\endofsentencespacefactor\space} + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=\endofsentencespacefactor\space} + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% + \fi\fi +} + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. Not documented, written for gawk manual. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). This command +% is not documented, not supported, and doesn't work. +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% @include FILE -- \input text of FILE. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable % we want to expand any @value in FILE. + \turnoffactive % and allow special characters in the expansion + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @include of #1^^J}% + \edef\temp{\noexpand\input #1 }% + % + % This trickery is to read FILE outside of a group, in case it makes + % definitions, etc. + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other + \catcode`\`=\other + \catcode`\'=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} +% +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\centersub\centerH + \else + \let\centersub\centerV + \fi + \centersub{\hfil \ignorespaces#1\unskip \hfil}% + \let\centersub\relax % don't let the definition persist, just in case +} +\def\centerH#1{{% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break +}} +% +\newcount\centerpenalty +\def\centerV#1{% + % The idea here is the same as in \startdefun, \cartouche, etc.: if + % @center is the first thing after a section heading, we need to wipe + % out the negative parskip inserted by \sectionheading, but still + % prevent a page break here. + \centerpenalty = \lastpenalty + \ifnum\centerpenalty>10000 \vskip\parskip \fi + \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi + \line{\kern\leftskip #1\kern\rightskip}% +} + +% @sp n outputs n lines of vertical space +% +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment +% +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} +% +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as being undefined. +\ifx\pdfoutput\thisisundefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% +% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and +% related messages. The final outcome is that it is up to the TeX user +% to double the backslashes and otherwise make the string valid, so +% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to +% do this reliably, so we use it. + +% #1 is a control sequence in which to do the replacements, +% which we \xdef. +\def\txiescapepdf#1{% + \ifx\pdfescapestring\thisisundefined + % No primitive available; should we give a warning or log? + % Many times it won't matter. + \else + % The expandable \pdfescapestring primitive escapes parentheses, + % backslashes, and other special chars. + \xdef#1{\pdfescapestring{#1}}% + \fi +} + +\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images +with PDF output, and none of those formats could be found. (.eps cannot +be supported due to the design of the PDF format; use regular TeX (DVI +output) for that.)} + +\ifpdf + % + % Color manipulation macros based on pdfcolor.tex, + % except using rgb instead of cmyk; the latter is said to render as a + % very dark gray on-screen and a very dark halftone in print, instead + % of actual black. + \def\rgbDarkRed{0.50 0.09 0.12} + \def\rgbBlack{0 0 0} + % + % k sets the color for filling (usual text, etc.); + % K sets the color for stroking (thin rules, e.g., normal _'s). + \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} + % + % Set color, and create a mark which defines \thiscolor accordingly, + % so that \makeheadline knows which color to restore. + \def\setcolor#1{% + \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% + \domark + \pdfsetcolor{#1}% + } + % + \def\maincolor{\rgbBlack} + \pdfsetcolor{\maincolor} + \edef\thiscolor{\maincolor} + \def\lastcolordefs{} + % + \def\makefootline{% + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}% + } + % + \def\makeheadline{% + \vbox to 0pt{% + \vskip-22.5pt + \line{% + \vbox to8.5pt{}% + % Extract \thiscolor definition from the marks. + \getcolormarks + % Typeset the headline with \maincolor, then restore the color. + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% + }% + \vss + }% + \nointerlineskip + } + % + % + \pdfcatalog{/PageMode /UseOutlines} + % + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). + \def\dopdfimage#1#2#3{% + \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % + % pdftex (and the PDF format) support .pdf, .png, .jpg (among + % others). Let's try in that order, PDF first since if + % someone has a scalable image, presumably better to use that than a + % bitmap. + \let\pdfimgext=\empty + \begingroup + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 + \errhelp = \nopdfimagehelp + \errmessage{Could not find image file #1 for pdf}% + \else \gdef\pdfimgext{JPG}% + \fi + \else \gdef\pdfimgext{jpeg}% + \fi + \else \gdef\pdfimgext{jpg}% + \fi + \else \gdef\pdfimgext{png}% + \fi + \else \gdef\pdfimgext{PDF}% + \fi + \else \gdef\pdfimgext{pdf}% + \fi + \closein 1 + \endgroup + % + % without \immediate, ancient pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifdim \wd0 >0pt width \pdfimagewidth \fi + \ifdim \wd2 >0pt height \pdfimageheight \fi + \ifnum\pdftexversion<13 + #1.\pdfimgext + \else + {#1.\pdfimgext}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + % + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \indexnofonts + \turnoffactive + \makevalueexpandable + \def\pdfdestname{#1}% + \txiescapepdf\pdfdestname + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% + }} + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1} + % + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\rgbDarkRed} + \def\linkcolor{\rgbDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} + % + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \edef\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + \txiescapepdf\pdfoutlinedest + \fi + % + % Also escape PDF chars in the display string. + \edef\pdfoutlinetext{#1}% + \txiescapepdf\pdfoutlinetext + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\partentry##1##2##3##4{}% ignore parts in the outlines + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % TODO this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Too + % much work for too little return. Just use the ASCII equivalents + % we use for the index sort strings. + % + \indexnofonts + \setupdatafile + % We can have normal brace characters in the PDF outlines, unlike + % Texinfo index files. So set that up. + \def\{{\lbracecharliteral}% + \def\}{\rbracecharliteral}% + \catcode`\\=\active \otherbackslash + \input \tocreadfilename + \endgroup + } + {\catcode`[=1 \catcode`]=2 + \catcode`{=\other \catcode`}=\other + \gdef\lbracecharliteral[{]% + \gdef\rbracecharliteral[}]% + ] + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \nextsp} + \def\getfilename#1{% + \filenamelength=0 + % If we don't expand the argument now, \skipspaces will get + % snagged on things like "@value{foo}". + \edef\temp{#1}% + \expandafter\skipspaces\temp|\relax + } + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + % do we want to go so far as to use \indexnofonts instead of just + % special-casing \var here? + \def\var##1{##1}% + % + \leavevmode\setcolor{\urlcolor}% + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \setcolor{\linkcolor}#1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + % non-pdf mode + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Unfortunately, we have to override this for titles and the like, since +% in those cases "rm" is bold. Sigh. +\def\rmisbold{\rm\def\curfontstyle{bf}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +% can get a sort of poor man's double spacing by redefining this. +\def\baselinefactor{1} +% +\newdimen\textleading +\def\setleading#1{% + \dimen0 = #1\relax + \normalbaselineskip = \baselinefactor\dimen0 + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% PDF CMaps. See also LaTeX's t1.cmap. +% +% do nothing with this by default. +\expandafter\let\csname cmapOT1\endcsname\gobble +\expandafter\let\csname cmapOT1IT\endcsname\gobble +\expandafter\let\csname cmapOT1TT\endcsname\gobble + +% if we are producing pdf, and we have \pdffontattr, then define cmaps. +% (\pdffontattr was introduced many years ago, but people still run +% older pdftex's; it's easy to conditionalize, so we do.) +\ifpdf \ifx\pdffontattr\thisisundefined \else + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\fi\fi + + +% Set the font macro #1 to the font named \fontprefix#2. +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). +% Example: +% #1 = \textrm +% #2 = \rmshape +% #3 = 10 +% #4 = \mainmagstep +% #5 = OT1 +% +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble +% +% (end of cmaps) + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\thisisundefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} % where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Definitions for a main text size of 11pt. (The default in Texinfo.) +% +\def\definetextfontsizexi{% +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1095} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 +\def\chapecsize{1728} + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2}{OT1} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 +\def\sececsize{1440} + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315}{OT1} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 +\def\ssececsize{1200} + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 +\def\reducedecsize{1000} + +\textleading = 13.2pt % line spacing for 11pt CM +\textfonts % reset the current fonts +\rm +} % end of 11pt text font size definitions, \definetextfontsizexi + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep +\def\textecsize{1000} + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 +\def\smallecsize{0900} + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 +\def\smallerecsize{0800} + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\titleecsize{2074} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 +\def\chapecsize{1440} + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1}{OT1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 +\def\sececsize{1200} + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000}{OT1} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 +\def\ssececsize{1000} + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 +\def\reducedecsize{0900} + +\divide\parskip by 2 % reduce space between paragraphs +\textleading = 12pt % line spacing for 10pt CM +\textfonts % reset the current fonts +\rm +} % end of 10pt text font size definitions, \definetextfontsizex + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xiword{11} +\def\xword{10} +\def\xwordpt{10pt} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + %\wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{27pt}} +\def\titlefont#1{{\titlefonts\rmisbold #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} + +% Define these just so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% --karl, 24jan03. + +% Set up the default fonts, so we can use them for creating boxes. +% +\definetextfontsizexi + + +\message{markup,} + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will +% define and register \INITMACRO to be called on markup style changes. +% \INITMACRO can check \currentmarkupstyle for the innermost +% style and the set of \ifmarkupSTYLE switches for all styles +% currently in effect. +\newif\ifmarkupvar +\newif\ifmarkupsamp +\newif\ifmarkupkey +%\newif\ifmarkupfile % @file == @samp. +%\newif\ifmarkupoption % @option == @samp. +\newif\ifmarkupcode +\newif\ifmarkupkbd +%\newif\ifmarkupenv % @env == @code. +%\newif\ifmarkupcommand % @command == @code. +\newif\ifmarkuptex % @tex (and part of @math, for now). +\newif\ifmarkupexample +\newif\ifmarkupverb +\newif\ifmarkupverbatim + +\let\currentmarkupstyle\empty + +\def\setupmarkupstyle#1{% + \csname markup#1true\endcsname + \def\currentmarkupstyle{#1}% + \markupstylesetup +} + +\let\markupstylesetup\empty + +\def\defmarkupstylesetup#1{% + \expandafter\def\expandafter\markupstylesetup + \expandafter{\markupstylesetup #1}% + \def#1% +} + +% Markup style setup for left and right quotes. +\defmarkupstylesetup\markupsetuplq{% + \expandafter\let\expandafter \temp + \csname markupsetuplq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuplqdefault \else \temp \fi +} + +\defmarkupstylesetup\markupsetuprq{% + \expandafter\let\expandafter \temp + \csname markupsetuprq\currentmarkupstyle\endcsname + \ifx\temp\relax \markupsetuprqdefault \else \temp \fi +} + +{ +\catcode`\'=\active +\catcode`\`=\active + +\gdef\markupsetuplqdefault{\let`\lq} +\gdef\markupsetuprqdefault{\let'\rq} + +\gdef\markupsetcodequoteleft{\let`\codequoteleft} +\gdef\markupsetcodequoteright{\let'\codequoteright} +} + +\let\markupsetuplqcode \markupsetcodequoteleft +\let\markupsetuprqcode \markupsetcodequoteright +% +\let\markupsetuplqexample \markupsetcodequoteleft +\let\markupsetuprqexample \markupsetcodequoteright +% +\let\markupsetuplqkbd \markupsetcodequoteleft +\let\markupsetuprqkbd \markupsetcodequoteright +% +\let\markupsetuplqsamp \markupsetcodequoteleft +\let\markupsetuprqsamp \markupsetcodequoteright +% +\let\markupsetuplqverb \markupsetcodequoteleft +\let\markupsetuprqverb \markupsetcodequoteright +% +\let\markupsetuplqverbatim \markupsetcodequoteleft +\let\markupsetuprqverbatim \markupsetcodequoteright + +% Allow an option to not use regular directed right quote/apostrophe +% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). +% The undirected quote is ugly, so don't make it the default, but it +% works for pasting with more pdf viewers (at least evince), the +% lilypond developers report. xpdf does work with the regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + % [Knuth] pp. 380,381,391 + % \relax disables Spanish ligatures ?` and !` of \tt font. + \relax`% + \else \char'22 \fi + \else \char'22 \fi +} + +% Commands to set the quote options. +% +\parseargdef\codequoteundirected{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% + \fi\fi +} +% +\parseargdef\codequotebacktick{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% + \fi\fi +} + +% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. +\def\noligaturesquoteleft{\relax\lq} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Font commands. + +% #1 is the font command (\sl or \it), #2 is the text to slant. +% If we are in a monospaced environment, however, 1) always use \ttsl, +% and 2) do not add an italic correction. +\def\dosmartslant#1#2{% + \ifusingtt + {{\ttsl #2}\let\next=\relax}% + {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% + \next +} +\def\smartslanted{\dosmartslant\sl} +\def\smartitalic{\dosmartslant\it} + +% Output an italic correction unless \next (presumed to be the following +% character) is such as not to need one. +\def\smartitaliccorrection{% + \ifx\next,% + \else\ifx\next-% + \else\ifx\next.% + \else\ptexslash + \fi\fi\fi + \aftersmartic +} + +% Unconditional use \ttsl, and no ic. @var is set to this for defuns. +\def\ttslanted#1{{\ttsl #1}} + +% @cite is like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} + +\def\aftersmartic{} +\def\var#1{% + \let\saveaftersmartic = \aftersmartic + \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% + \smartslanted{#1}% +} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @b, explicit bold. Also @strong. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +% @t, explicit typewriter. +\def\t#1{% + {\tt \rawbackslash \plainfrenchspacing #1}% + \null +} + +% @samp. +\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} + +% @indicateurl is \samp, that is, with quotes. +\let\indicateurl=\samp + +% @code (and similar) prints in typewriter, but with spaces the same +% size as normal in the surrounding text, without hyphenation, etc. +% This is a subroutine for that. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \plainfrenchspacing + #1% + }% + \null % reset spacefactor to 1000 +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. +% +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + \global\let'=\rq \global\let`=\lq % default definitions + % + \global\def\code{\begingroup + \setupmarkupstyle{code}% + % The following should really be moved into \setupmarkupstyle handlers. + \catcode\dashChar=\active \catcode\underChar=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\normaldash + \let_\realunder + \fi + \codex + } +} + +\def\codex #1{\tclose{#1}\endgroup} + +\def\normaldash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is bad. +% @allowcodebreaks provides a document-level way to turn breaking at - +% and _ on and off. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% + \fi\fi +} + +% For @command, @env, @file, @option quotes seem unnecessary, +% so use \code rather than \samp. +\let\command=\code +\let\env=\code +\let\file=\code +\let\option=\code + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. +% (This \urefnobreak definition isn't used now, leaving it for a while +% for comparison.) +\def\urefnobreak#1{\dourefnobreak #1,,,\finish} +\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% This \urefbreak definition is the active one. +\def\urefbreak{\begingroup \urefcatcodes \dourefbreak} +\let\uref=\urefbreak +\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} +\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \urefcode{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% Allow line breaks around only a few characters (only). +\def\urefcatcodes{% + \catcode\ampChar=\active \catcode\dotChar=\active + \catcode\hashChar=\active \catcode\questChar=\active + \catcode\slashChar=\active +} +{ + \urefcatcodes + % + \global\def\urefcode{\begingroup + \setupmarkupstyle{code}% + \urefcatcodes + \let&\urefcodeamp + \let.\urefcodedot + \let#\urefcodehash + \let?\urefcodequest + \let/\urefcodeslash + \codex + } + % + % By default, they are just regular characters. + \global\def&{\normalamp} + \global\def.{\normaldot} + \global\def#{\normalhash} + \global\def?{\normalquest} + \global\def/{\normalslash} +} + +% we put a little stretch before and after the breakable chars, to help +% line breaking of long url's. The unequal skips make look better in +% cmtt at least, especially for dots. +\def\urefprestretch{\urefprebreak \hskip0pt plus.13em } +\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } +% +\def\urefcodeamp{\urefprestretch \&\urefpoststretch} +\def\urefcodedot{\urefprestretch .\urefpoststretch} +\def\urefcodehash{\urefprestretch \#\urefpoststretch} +\def\urefcodequest{\urefprestretch ?\urefpoststretch} +\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} +{ + \catcode`\/=\active + \global\def\urefcodeslashfinish{% + \urefprestretch \slashChar + % Allow line break only after the final / in a sequence of + % slashes, to avoid line break between the slashes in http://. + \ifx\next/\else \urefpoststretch \fi + } +} + +% One more complication: by default we'll break after the special +% characters, but some people like to break before the special chars, so +% allow that. Also allow no breaking at all, for manual control. +% +\parseargdef\urefbreakstyle{% + \def\txiarg{#1}% + \ifx\txiarg\wordnone + \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordbefore + \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordafter + \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} + \else + \errhelp = \EMsimple + \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\wordafter{after} +\def\wordbefore{before} +\def\wordnone{none} + +\urefbreakstyle after + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct'. +\kbdinputstyle distinct + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. +\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}} + +\def\xkey{\key} +\def\kbdsub#1#2#3\par{% + \def\one{#1}\def\three{#3}\def\threex{??}% + \ifx\one\xkey\ifx\threex\three \key{#2}% + \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi + \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi +} + +% definition of @key that produces a lozenge. Doesn't adjust to text size. +%\setfont\keyrm\rmshape{8}{1000}{OT1} +%\font\keysy=cmsy9 +%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% +% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% +% \vbox{\hrule\kern-0.4pt +% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% +% \kern-0.4pt\hrule}% +% \kern-.06em\raise0.4pt\hbox{\angleright}}}} + +% definition of @key with no lozenge. If the current font is already +% monospace, don't change it; that way, we respect @kbdinputstyle. But +% if it isn't monospace, then use \tt. +% +\def\key#1{{\setupmarkupstyle{key}% + \nohyphenation + \ifmonospace\else\tt\fi + #1}\null} + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi + \null % reset \spacefactor=1000 +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi + \null % reset \spacefactor=1000 +} + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a math (or tt) \. +% FYI, plain.tex uses \\ as a temporary control sequence (for no +% particular reason), but this is not advertised and we don't care. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + % make the texinfo accent commands work in math mode + \let\"=\ddot + \let\'=\acute + \let\==\bar + \let\^=\hat + \let\`=\grave + \let\u=\breve + \let\v=\check + \let\~=\tilde + \let\dotaccent=\dot + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \catcode`' = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + \let' = \ptexquoteright + } +} + +% ctrl is no longer a Texinfo command, but leave this definition for fun. +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. +% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, +% except specified as a normal braced arg, so no newlines to worry about. +% +\def\outfmtnametex{tex} +% +\long\def\inlinefmt#1{\doinlinefmt #1,\finish} +\long\def\doinlinefmt#1,#2,\finish{% + \def\inlinefmtname{#1}% + \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi +} +% For raw, must switch into @tex before parsing the argument, to avoid +% setting catcodes prematurely. Doing it this way means that, for +% example, @inlineraw{html, foo{bar} gets a parse error instead of being +% ignored. But this isn't important because if people want a literal +% *right* brace they would have to use a command anyway, so they may as +% well use a command to get a left brace too. We could re-use the +% delimiter character idea from \verb, but it seems like overkill. +% +\long\def\inlineraw{\tex \doinlineraw} +\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} +\def\doinlinerawtwo#1,#2,\finish{% + \def\inlinerawname{#1}% + \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi + \endgroup % close group opened by \tex. +} + + +\message{glyphs,} +% and logos. + +% @@ prints an @, as does @atchar{}. +\def\@{\char64 } +\let\atchar=\@ + +% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. +% Unless we're in typewriter, use \ecfont because the CM text fonts do +% not have braces, and we don't want to switch into math. +\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} +\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} +\let\{=\mylbrace \let\lbracechar=\{ +\let\}=\myrbrace \let\rbracechar=\} +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \ptexc +\let\dotaccent = \ptexdot +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \ptext +\let\ubaraccent = \ptexb +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi + \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{% + \ifx\textnominalsize\xwordpt + % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. + % Revert to plain's \scriptsize, which is 7pt. + \count255=\the\fam $\fam\count255 \scriptstyle A$% + \else + % For 11pt, we can use our lllsize. + \selectfonts\lllsize A% + \fi + }% + \vss + }}% + \kern-.15em + \TeX +} + +% Some math mode symbols. +\def\bullet{$\ptexbullet$} +\def\geq{\ifmmode \ge\else $\ge$\fi} +\def\leq{\ifmmode \le\else $\le$\fi} +\def\minus{\ifmmode -\else $-$\fi} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, they should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} +\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% Glyphs from the EC fonts. We don't use \let for the aliases, because +% sometimes we redefine the original macro, and the alias should reflect +% the redefinition. +% +% Use LaTeX names for the Icelandic letters. +\def\DH{{\ecfont \char"D0}} % Eth +\def\dh{{\ecfont \char"F0}} % eth +\def\TH{{\ecfont \char"DE}} % Thorn +\def\th{{\ecfont \char"FE}} % thorn +% +\def\guillemetleft{{\ecfont \char"13}} +\def\guillemotleft{\guillemetleft} +\def\guillemetright{{\ecfont \char"14}} +\def\guillemotright{\guillemetright} +\def\guilsinglleft{{\ecfont \char"0E}} +\def\guilsinglright{{\ecfont \char"0F}} +\def\quotedblbase{{\ecfont \char"12}} +\def\quotesinglbase{{\ecfont \char"0D}} +% +% This positioning is not perfect (see the ogonek LaTeX package), but +% we have the precomposed glyphs for the most common cases. We put the +% tests to use those glyphs in the single \ogonek macro so we have fewer +% dummy definitions to worry about for index entries, etc. +% +% ogonek is also used with other letters in Lithuanian (IOU), but using +% the precomposed glyphs for those is not so easy since they aren't in +% the same EC font. +\def\ogonek#1{{% + \def\temp{#1}% + \ifx\temp\macrocharA\Aogonek + \else\ifx\temp\macrochara\aogonek + \else\ifx\temp\macrocharE\Eogonek + \else\ifx\temp\macrochare\eogonek + \else + \ecfont \setbox0=\hbox{#1}% + \ifdim\ht0=1ex\accent"0C #1% + \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% + \fi + \fi\fi\fi\fi + }% +} +\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} +\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} +\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} +\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} +% +% Use the ec* fonts (cm-super in outline format) for non-CM glyphs. +\def\ecfont{% + % We can't distinguish serif/sans and italic/slanted, but this + % is used for crude hacks anyway (like adding French and German + % quotes to documents typeset with CM, where we lose kerning), so + % hopefully nobody will notice/care. + \edef\ecsize{\csname\curfontsize ecsize\endcsname}% + \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% + \ifmonospace + % typewriter: + \font\thisecfont = ectt\ecsize \space at \nominalsize + \else + \ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi + \fi + \thisecfont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\thisisundefined +\def\Orb{\mathhexbox20D} +\fi + +% Quotes. +\chardef\quotedblleft="5C +\chardef\quotedblright=`\" +\chardef\quoteleft=`\` +\chardef\quoteright=`\' + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{% + \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +% Settings used for typesetting titles: no hyphenation, no indentation, +% don't worry much about spacing, ragged right. This should be used +% inside a \vbox, and fonts need to be set appropriately first. Because +% it is always used for titles, nothing else, we call \rmisbold. \par +% should be specified before the end of the \vbox, since a vbox is a group. +% +\def\raggedtitlesettings{% + \rmisbold + \hyphenpenalty=10000 + \parindent=0pt + \tolerance=5000 + \ptexraggedright +} + +% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\parseargdef\title{% + \checkenv\titlepage + \vbox{\titlefonts \raggedtitlesettings #1\par}% + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\secfonts\rmisbold \leftline{#1}}% + \fi +} + + +% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + +% @evenheadingmarks top \thischapter <- chapter at the top of a page +% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page +% +% The same set of arguments for: +% +% @oddheadingmarks +% @evenfootingmarks +% @oddfootingmarks +% @everyheadingmarks +% @everyfootingmarks + +\def\evenheadingmarks{\headingmarks{even}{heading}} +\def\oddheadingmarks{\headingmarks{odd}{heading}} +\def\evenfootingmarks{\headingmarks{even}{footing}} +\def\oddfootingmarks{\headingmarks{odd}{footing}} +\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} + \headingmarks{odd}{heading}{#1} } +\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} + \headingmarks{odd}{footing}{#1} } +% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. +\def\headingmarks#1#2#3 {% + \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname + \global\expandafter\let\csname get#1#2marks\endcsname \temp +} + +\everyheadingmarks bottom +\everyfootingmarks bottom + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\headingsoff{% non-global headings elimination + \evenheadline={\hfil}\evenfootline={\hfil}% + \oddheadline={\hfil}\oddfootline={\hfil}% +} + +\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting +\HEADINGSoff % it's the default + +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\thisisundefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil\relax + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + % + % Try typesetting the item mark that if the document erroneously says + % something like @itemize @samp (intending @table), there's an error + % right away at the @itemize. It's not the best error message in the + % world, but it's better than leaving it to the @item. This means if + % the user wants an empty mark, they have to say @w{} not just @w. + \def\itemcontents{#1}% + \setbox0 = \hbox{\itemcontents}% + % + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + % + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + % + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a . + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. \everycr resets \everytab so we don't have to +% undo it ourselves. +\def\headitemfont{\b}% for people to use in the template row; not changeable +\def\headitem{% + \checkenv\multitable + \crcr + \global\everytab={\bf}% can't use \headitemfont since the parsing differs + \the\everytab % for the first item +}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we again encounter the problem the 1sp was intended to solve. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +% Test to see if parskip is larger than space between lines of +% table. If not, do nothing. +% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \obeylines + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M@end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\normaldash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end executes the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written +% without the @) is in fact defined. We can only feasibly check at the +% TeX level, so something like `mathcode' is going to considered +% defined even though it is not a Texinfo command. +% +\makecond{ifcommanddefined} +\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} +% +\def\doifcmddefined#1#2{{% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname #2\endcsname\relax + #1% If not defined, \let\next as above. + \fi + \expandafter + }\next +} +\def\ifcmddefinedfail{\doignore{ifcommanddefined}} + +% @ifcommandnotdefined CMD ... handled similar to @ifclear above. +\makecond{ifcommandnotdefined} +\def\ifcommandnotdefined{% + \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} +\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} + +% Set the `txicommandconditionals' variable, so documents have a way to +% test if the @ifcommand...defined conditionals are available. +\set txicommandconditionals + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \relax + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % + % Need these unexpandable (because we define \tt as a dummy) + % definitions when @{ or @} appear in index entry text. Also, more + % complicated, when \tex is in effect and \{ is a \delimiter again. + % We can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. Perhaps we + % should define @lbrace and @rbrace commands a la @comma. + \def\{{{\tt\char123}}% + \def\}{{\tt\char125}}% + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} + % + % So: + \let\endinput = \empty + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies + \otherbackslash +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + \definedummyletter\-% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\DH + \definedummyword\L + \definedummyword\O + \definedummyword\OE + \definedummyword\TH + \definedummyword\aa + \definedummyword\ae + \definedummyword\dh + \definedummyword\exclamdown + \definedummyword\l + \definedummyword\o + \definedummyword\oe + \definedummyword\ordf + \definedummyword\ordm + \definedummyword\questiondown + \definedummyword\ss + \definedummyword\th + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\arrow + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\entrybreak + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\expansion + \definedummyword\geq + \definedummyword\guillemetleft + \definedummyword\guillemetright + \definedummyword\guilsinglleft + \definedummyword\guilsinglright + \definedummyword\lbracechar + \definedummyword\leq + \definedummyword\minus + \definedummyword\ogonek + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\quotedblbase + \definedummyword\quotedblleft + \definedummyword\quotedblright + \definedummyword\quoteleft + \definedummyword\quoteright + \definedummyword\quotesinglbase + \definedummyword\rbracechar + \definedummyword\result + \definedummyword\textdegree + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ogonek + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sansserif + \definedummyword\sc + \definedummyword\slanted + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\abbr + \definedummyword\acronym + \definedummyword\anchor + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\dmn + \definedummyword\email + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\image + \definedummyword\indicateurl + \definedummyword\inforef + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % All control words become @asis by default; overrides below. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + \def\_{\normalunderscore}% + \def\-{}% @- shouldn't affect sorting + % + % Unfortunately, texindex is not prepared to handle braces in the + % content at all. So for index sorting, we map @{ and @} to strings + % starting with |, since that ASCII character is between ASCII { and }. + \def\{{|a}% + \def\lbracechar{|a}% + % + \def\}{|b}% + \def\rbracechar{|b}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\DH{DZZ}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\TH{ZZZ}% + \def\aa{aa}% + \def\ae{ae}% + \def\dh{dzz}% + \def\exclamdown{!}% + \def\l{l}% + \def\oe{oe}% + \def\ordf{a}% + \def\ordm{o}% + \def\o{o}% + \def\questiondown{?}% + \def\ss{ss}% + \def\th{zzz}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\arrow{->}% + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\geq{>=}% + \def\guillemetleft{<<}% + \def\guillemetright{>>}% + \def\guilsinglleft{<}% + \def\guilsinglright{>}% + \def\leq{<=}% + \def\minus{-}% + \def\point{.}% + \def\pounds{pounds}% + \def\print{-|}% + \def\quotedblbase{"}% + \def\quotedblleft{"}% + \def\quotedblright{"}% + \def\quoteleft{`}% + \def\quoteright{'}% + \def\quotesinglbase{,}% + \def\registeredsymbol{R}% + \def\result{=>}% + \def\textdegree{o}% + % + \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax + \else \indexlquoteignore \fi + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us +% ignore left quotes in the sort term. +{\catcode`\`=\active + \gdef\indexlquoteignore{\let`=\empty}} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \safewhatsit\dosubindwrite + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks/skips around a whatsit: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +\newskip\whatsitskip +\newcount\whatsitpenalty +% +% ..., ready, GO: +% +\def\safewhatsit#1{\ifhmode + #1% + \else + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \whatsitskip = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \whatsitpenalty = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\whatsitskip glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\whatsitskip + \fi + % + #1% + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\whatsitskip + \fi +\fi} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \plainfrenchspacing + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this freezes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % When reading the text of entry, convert explicit line breaks + % from @* into spaces. The user might give these in long section + % titles, for instance. + \def\*{\unskip\space\ignorespaces}% + \def\entrybreak{\hfil\break}% + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\entrybreak{\unskip\space\ignorespaces}% +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like plain.tex's \dotfill, except uses up at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + % The following penalty ensures that the page builder is exercised + % _before_ we change the output routine. This is necessary in the + % following situation: + % + % The last section of the index consists only of a single entry. + % Before this section, \pagetotal is less than \pagegoal, so no + % break occurs before the last section starts. However, the last + % section, consisting of \initial and the single \entry, does not + % fit on the page and has to be broken off. Without the following + % penalty the page builder will not be exercised until \eject + % below, and by that time we'll already have changed the output + % routine to the \balancecolumns version, so the next-to-last + % double-column page will be processed with \balancecolumns, which + % is wrong: The two columns will go to the main vertical list, with + % the broken-off section in the recent contributions. As soon as + % the output routine finishes, TeX starts reconsidering the page + % break. The two columns and the broken-off section both fit on the + % page, because the two columns now take up only half of the page + % goal. When TeX sees \eject from below which follows the final + % section, it invokes the new output routine that we've set after + % \balancecolumns below; \onepageout will try to fit the two columns + % and the final section into the vbox of \pageheight (see + % \pagebody), causing an overfull box. + % + % Note that glue won't work here, because glue does not exercise the + % page builder, unlike penalties (see The TeXbook, pp. 280-281). + \penalty0 + % + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% Let's start with @part. +\outer\parseargdef\part{\partzzz{#1}} +\def\partzzz#1{% + \chapoddpage + \null + \vskip.3\vsize % move it down on the page a bit + \begingroup + \noindent \titlefonts\rmisbold #1\par % the text + \let\lastnode=\empty % no node to associate with + \writetocentry{part}{#1}{}% but put it in the toc + \headingsoff % no headline or footline on the part page + \chapoddpage + \endgroup +} + +% \unnumberedno is an oxymoron. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines these (using marks) as the number+name, number +% and name of the chapter. Page headings and footings can use +% these. @section does likewise. +\def\thischapter{} +\def\thischapternum{} +\def\thischaptername{} +\def\thissection{} +\def\thissectionnum{} +\def\thissectionname{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achieve this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unnlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unnlevel + \chardef\unnlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unnlevel + \def\headtype{U}% + \else + \chardef\unnlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + % \putwordChapter can contain complex things in translations. + \toks0=\expandafter{\putwordChapter}% + \message{\the\toks0 \space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz +% +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + % \putwordAppendix can contain complex things in translations. + \toks0=\expandafter{\putwordAppendix}% + \message{\the\toks0 \space \appendixletter}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +% normally unnmhead0 calls unnumberedzzz: +\outer\parseargdef\unnumbered{\unnmhead0{#1}} +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +% +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +% normally calls appendixsectionzzz: +\outer\parseargdef\appendixsection{\apphead1{#1}} +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +% normally calls unnumberedseczzz: +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +% +% normally calls numberedsubseczzz: +\outer\parseargdef\numberedsubsec{\numhead2{#1}} +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +% normally calls appendixsubseczzz: +\outer\parseargdef\appendixsubsec{\apphead2{#1}} +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +% normally calls unnumberedsubseczzz: +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +% +% normally numberedsubsubseczzz: +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% normally appendixsubsubseczzz: +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% normally unnumberedsubsubseczzz: +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + \vbox{\chapfonts \raggedtitlesettings #1\par}% + \nobreak\bigskip \nobreak + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +% Parameter controlling skip before chapter headings (if needed) +\newskip\chapheadingskip + +% Define plain chapter starts, and page on/off switching for it. +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +% Because \domark is called before \chapoddpage, the filler page will +% get the headings for the next chapter, which is wrong. But we don't +% care -- we just disable all headings on the filler page. +\def\chapoddpage{% + \chappager + \ifodd\pageno \else + \begingroup + \headingsoff + \null + \chappager + \endgroup + \fi +} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + % Insert the first mark before the heading break (see notes for \domark). + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% + \gdef\thissection{}}% + % + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{\thischaptername}}% + \else\ifx\temptype\Yomitfromtockeyword + \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% + \gdef\thischapter{}}% + \else\ifx\temptype\Yappendixkeyword + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\appendixletter}% + % \noexpand\putwordAppendix avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \else + \toks0={#1}% + \xdef\lastchapterdefs{% + \gdef\noexpand\thischaptername{\the\toks0}% + \gdef\noexpand\thischapternum{\the\chapno}% + % \noexpand\putwordChapter avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thischapter{\noexpand\putwordChapter{} + \noexpand\thischapternum: + \noexpand\thischaptername}% + }% + \fi\fi\fi + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert the chapter heading break. + \pchapsepmacro + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevchapterdefs=\lastchapterdefs + \let\prevsectiondefs=\lastsectiondefs + \domark + % + {% + \chapfonts \rmisbold + % + % Have to define \lastsection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\lastsection{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \nobreak % Avoid page breaks at the interline glue. + \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% + \chapoddpage + \vbox{\chapfonts \raggedtitlesettings #1\par}% + \nobreak\bigskip\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% + \chapoddpage + \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}% + \nobreak\bigskip \nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\seckeyword{sec} +% +\def\sectionheading#1#2#3#4{% + {% + \checkenv{}% should not be in an environment. + % + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rmisbold + % + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + % Insert first mark before the heading break (see notes for \domark). + \let\prevsectiondefs=\lastsectiondefs + \ifx\temptype\Ynothingkeyword + \ifx\sectionlevel\seckeyword + \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% + \gdef\thissection{\thissectionname}}% + \fi + \else\ifx\temptype\Yomitfromtockeyword + % Don't redefine \thissection. + \else\ifx\temptype\Yappendixkeyword + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \else + \ifx\sectionlevel\seckeyword + \toks0={#1}% + \xdef\lastsectiondefs{% + \gdef\noexpand\thissectionname{\the\toks0}% + \gdef\noexpand\thissectionnum{#4}% + % \noexpand\putwordSection avoids expanding indigestible + % commands in some of the translations. + \gdef\noexpand\thissection{\noexpand\putwordSection{} + \noexpand\thissectionnum: + \noexpand\thissectionname}% + }% + \fi + \fi\fi\fi + % + % Go into vertical mode. Usually we'll already be there, but we + % don't want the following whatsit to end up in a preceding paragraph + % if the document didn't happen to have a blank line. + \par + % + % Output the mark. Pass it through \safewhatsit, to take care of + % the preceding space. + \safewhatsit\domark + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Now the second mark, after the heading break. No break points + % between here and the heading. + \let\prevsectiondefs=\lastsectiondefs + \domark + % + % Only insert the space after the number if we have a section number. + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\lastsection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \lastsection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\lastsection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\lastsection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chapmacro. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chapmacro. + \donoderef{#3}% + % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) However, when a paragraph is not started next + % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out + % or the negative glue will cause weirdly wrong output, typically + % obscuring the section heading with something else. + \vskip-\parskip + % + % This is so the last item on the main vertical list is a known + % \penalty > 10000, so \startdefun, etc., can recognize the situation + % and do the needful. + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + }% + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \tocreadfilename +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} + +% Normal (long) toc. +% +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\partentry = \shortpartentry + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \tocreadfilename\space + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Parts, in the main contents. Replace the part number, which doesn't +% exist, with an empty box. Let's hope all the numbers have the same width. +% Also ignore the page number, which is conventionally not printed. +\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} +\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} +% +% Parts, in the short toc. +\def\shortpartentry#1#2#3#4{% + \penalty-300 + \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip + \shortchapentry{{\bf #1}}{\numeralbox}{}{}% +} + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @tex ... @end tex escapes into raw TeX temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain @ character. + +\envdef\tex{% + \setupmarkupstyle{tex}% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \catcode`\`=\other + \catcode`\'=\other + \escapechar=`\\ + % + % ' is active in math mode (mathcode"8000). So reset it, and all our + % other math active characters (just in case), to plain's definitions. + \mathactive + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + \expandafter \let\csname top\endcsname=\ptextop % outer + \let\frenchspacing=\plainfrenchspacing + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + % + % If this cartouche directly follows a sectioning command, we need the + % \parskip glue (backspaced over by default) or the cartouche can + % collide with the section heading. + \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi + % + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\newdimen\nonfillparindent +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + % Turn off paragraph indentation but redefine \indent to emulate + % the normal \indent. + \nonfillparindent=\parindent + \parindent = 0pt + \let\indent\nonfillindent + % + \emergencystretch = 0pt % don't try to avoid overfull boxes + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +\begingroup +\obeyspaces +% We want to swallow spaces (but not other tokens) after the fake +% @indent in our nonfill-environments, where spaces are normally +% active and set to @tie, resulting in them not being ignored after +% @indent. +\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% +\gdef\nonfillindentcheck{% +\ifx\temp % +\expandafter\nonfillindentgobble% +\else% +\leavevmode\nonfillindentbox% +\fi% +}% +\endgroup +\def\nonfillindentgobble#1{\nonfillindent} +\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + % end paragraph for sake of leading, in case document has no blank + % line. This is redundant with what happens in \aboveenvbreak, but + % we need to do it before changing the fonts, and it's inconvenient + % to change the fonts afterward. + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \ifnum \lastpenalty=10000 \else \endgraf \fi + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it in one command. #1 is the env name, #2 the definition. +\def\makedispenvdef#1#2{% + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two environment synonyms (#1 and #2) for an environment. +\def\maketwodispenvdef#1#2#3{% + \makedispenvdef{#1}{#3}% + \makedispenvdef{#2}{#3}% +} +% +% @lisp: indented, narrowed, typewriter font; +% @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvdef{lisp}{example}{% + \nonfillstart + \tt\setupmarkupstyle{example}% + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenvdef{display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenvdef{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill\relax + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @raggedright does more-or-less normal line breaking but no right +% justification. From plain.tex. +\envdef\raggedright{% + \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax +} +\let\Eraggedright\par + +\envdef\raggedleft{% + \parindent=0pt \leftskip0pt plus2em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedleft\par + +\envdef\raggedcenter{% + \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em + \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt + \hbadness=10000 % Last line will usually be underfull, so turn off + % badness reporting. +} +\let\Eraggedcenter\par + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\makedispenvdef{quotation}{\quotationstart} +% +\def\quotationstart{% + \indentedblockstart % same as \indentedblock, but increase right margin too. + \ifx\nonarrowing\relax + \advance\rightskip by \lispnarrowing + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\thisisundefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} +\def\Esmallquotation{\Equotation} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + +% @indentedblock is like @quotation, but indents only on the left and +% has no optional argument. +% +\makedispenvdef{indentedblock}{\indentedblockstart} +% +\def\indentedblockstart{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \exdentamount = \lispnarrowing + \else + \let\nonarrowing = \relax + \fi +} + +% Keep a nonzero parskip for the environment, since we're doing normal filling. +% +\def\Eindentedblock{% + \par + {\parskip=0pt \afterenvbreak}% +} +\def\Esmallindentedblock{\Eindentedblock} + + +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% + % Don't do the quotes -- if we do, @set txicodequoteundirected and + % @set txicodequotebacktick will not have effect on @verb and + % @verbatim, and ?` and !` ligatures won't get disabled. + %\do\`\do\'% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \setupmarkupstyle{verb}% + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion. +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +% We typeset each line of the verbatim in an \hbox, so we can handle +% tabs. The \global is in case the verbatim line starts with an accent, +% or some other command that starts with a begin-group. Otherwise, the +% entire \verbbox would disappear at the corresponding end-group, before +% it is typeset. Meanwhile, we can't have nested verbatim commands +% (can we?), so the \global won't be overwriting itself. +\newbox\verbbox +\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} +% +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab + \divide\dimen\verbbox by\tabw + \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw + \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw + \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox + }% + } +\endgroup + +% start the verbatim environment. +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + \tt % easiest (and conventionally used) font for verbatim + % The \leavevmode here is for blank lines. Otherwise, we would + % never \starttabox and the \egroup would end verbatim mode. + \def\par{\leavevmode\egroup\box\verbbox\endgraf}% + \tabexpand + \setupmarkupstyle{verbatim}% + % Respect line breaks, + % print special symbols as themselves, and + % make each space count. + % Must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \printdefunline, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + % As a further refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil\relax + \endgraf + \nobreak\vskip -\parskip + \penalty\defunpenalty % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remaining is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \doingtypefnfalse % distinguish typed functions from all else + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +\newif\ifdoingtypefn % doing typed function? +\newif\ifrettypeownline % typeset return type on its own line? + +% @deftypefnnewline on|off says whether the return type of typed functions +% are printed on their own line. This affects @deftypefn, @deftypefun, +% @deftypeop, and @deftypemethod. +% +\parseargdef\deftypefnnewline{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @txideftypefnnl value `\temp', + must be on|off}% + \fi\fi +} + +% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \doingtypefntrue + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +% Types: + +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + \par + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % Determine if we are typesetting the return type of a typed function + % on a line by itself. + \rettypeownlinefalse + \ifdoingtypefn % doing a typed function specifically? + % then check user option for putting return type on its own line: + \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else + \rettypeownlinetrue + \fi + \fi + % + % How we'll format the category name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. We'll always have at + % least two. + \tempnum = 2 + % + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % + % If doing a return type on its own line, we'll have another line. + \ifrettypeownline + \advance\tempnum by 1 + \def\maybeshapeline{0in \hsize}% + \else + \def\maybeshapeline{}% + \fi + % + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % + % The final paragraph shape: + \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 + % + % Put the category name at the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% text of the return type + \ifx\temp\empty\else + \tclose{\temp}% typeset the return type + \ifrettypeownline + % put return type on its own line; prohibit line break following: + \hfil\vadjust{\nobreak}\break + \else + \space % type on same line, so just followed by a space + \fi + \fi % no return type + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. We used to recommend @var for that, so + % leave the code in, but it's strange for @var to lead to typewriter. + % Nowadays we recommend @code, since the difference between a ttsl hyphen + % and a tt hyphen is pretty tiny. @code also disables ?` !`. + \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +% these should not use \errmessage; the glibc manual, at least, actually +% has such constructs (when documenting function pointers). +\def\badparencount{% + \message{Warning: unbalanced parentheses in @def...}% + \global\parencount=0 +} +\def\badbrackcount{% + \message{Warning: unbalanced square brackets in @def...}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\thisisundefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{\begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % + % ... and for \example: + \spaceisspace + % + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and + % line-oriented commands. + % + \scantokens{#1\empty}% +\endgroup} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \ +% to recognize macro arguments; this is the job of \mbodybackslash. +% +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. +% +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. +% +\def\scanctxt{% used as subroutine + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi +} + +\def\scanargctxt{% used for copying and captions, not macros. + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% used for @macro definitions + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% used when scanning invocations + \scanctxt + \catcode`\\=0 +} +% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" +% for the single characters \ { }. Thus, we end up with the "commands" +% that would be written @\ @{ @} in a Texinfo document. +% +% We already have @{ and @}. For @\, we define it here, and only for +% this purpose, to produce a typewriter backslash (so, the @\ that we +% define for @math can't be used with @macro calls): +% +\def\\{\normalbackslash}% +% +% We would like to do this for \, too, since that is what makeinfo does. +% But it is not possible, because Texinfo already has a command @, for a +% cedilla accent. Documents must use @comma{} instead. +% +% \anythingelse will almost certainly be an error of some kind. + + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. +% +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\margbackslash#1{\char`\#1 } + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0\relax + \else + \expandafter\parsemargdef \argl;% + \if\paramno>256\relax + \ifx\eTeXversion\thisisundefined + \errhelp = \EMsimple + \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} + \fi + \fi + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + \addtomacrolist{\the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname#1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% For macro processing make @ a letter so that we can make Texinfo private macro names. +\edef\texiatcatcode{\the\catcode`\@} +\catcode `@=11\relax + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH +% in the params list to some hook where the argument si to be expanded. If +% there are less than 10 arguments that hook is to be replaced by ##N where N +% is the position in that list, that is to say the macro arguments are to be +% defined `a la TeX in the macro body. +% +% That gets used by \mbodybackslash (above). +% +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. +% +% If there are 10 or more arguments, a different technique is used, where the +% hook remains in the body, and when macro is to be expanded the body is +% processed again to replace the arguments. +% +% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the +% argument N value and then \edef the body (nothing else will expand because of +% the catcode regime underwhich the body was input). +% +% If you compile with TeX (not eTeX), and you have macros with 10 or more +% arguments, you need that no macro has more than 256 arguments, otherwise an +% error is produced. +\def\parsemargdef#1;{% + \paramno=0\def\paramlist{}% + \let\hash\relax + \let\xeatspaces\relax + \parsemargdefxxx#1,;,% + % In case that there are 10 or more arguments we parse again the arguments + % list to set new definitions for the \macarg.BLAH macros corresponding to + % each BLAH argument. It was anyhow needed to parse already once this list + % in order to count the arguments, and as macros with at most 9 arguments + % are by far more frequent than macro with 10 or more arguments, defining + % twice the \macarg.BLAH macros does not cost too much processing power. + \ifnum\paramno<10\relax\else + \paramno0\relax + \parsemmanyargdef@@#1,;,% 10 or more arguments + \fi +} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1 + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +\def\parsemmanyargdef@@#1,{% + \if#1;\let\next=\relax + \else + \let\next=\parsemmanyargdef@@ + \edef\tempb{\eatspaces{#1}}% + \expandafter\def\expandafter\tempa + \expandafter{\csname macarg.\tempb\endcsname}% + % Note that we need some extra \noexpand\noexpand, this is because we + % don't want \the to be expanded in the \parsermacbody as it uses an + % \xdef . + \expandafter\edef\tempa + {\noexpand\noexpand\noexpand\the\toks\the\paramno}% + \advance\paramno by 1\relax + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) +% + +\catcode `\@\texiatcatcode +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\catcode `\@=11\relax + +\let\endargs@\relax +\let\nil@\relax +\def\nilm@{\nil@}% +\long\def\nillm@{\nil@}% + +% This macro is expanded during the Texinfo macro expansion, not during its +% definition. It gets all the arguments values and assigns them to macros +% macarg.ARGNAME +% +% #1 is the macro name +% #2 is the list of argument names +% #3 is the list of argument values +\def\getargvals@#1#2#3{% + \def\macargdeflist@{}% + \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. + \def\paramlist{#2,\nil@}% + \def\macroname{#1}% + \begingroup + \macroargctxt + \def\argvaluelist{#3,\nil@}% + \def\@tempa{#3}% + \ifx\@tempa\empty + \setemptyargvalues@ + \else + \getargvals@@ + \fi +} + +% +\def\getargvals@@{% + \ifx\paramlist\nilm@ + % Some sanity check needed here that \argvaluelist is also empty. + \ifx\argvaluelist\nillm@ + \else + \errhelp = \EMsimple + \errmessage{Too many arguments in macro `\macroname'!}% + \fi + \let\next\macargexpandinbody@ + \else + \ifx\argvaluelist\nillm@ + % No more arguments values passed to macro. Set remaining named-arg + % macros to empty. + \let\next\setemptyargvalues@ + \else + % pop current arg name into \@tempb + \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% + \expandafter\@tempa\expandafter{\paramlist}% + % pop current argument value into \@tempc + \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% + \expandafter\@tempa\expandafter{\argvaluelist}% + % Here \@tempb is the current arg name and \@tempc is the current arg value. + % First place the new argument macro definition into \@tempd + \expandafter\macname\expandafter{\@tempc}% + \expandafter\let\csname macarg.\@tempb\endcsname\relax + \expandafter\def\expandafter\@tempe\expandafter{% + \csname macarg.\@tempb\endcsname}% + \edef\@tempd{\long\def\@tempe{\the\macname}}% + \push@\@tempd\macargdeflist@ + \let\next\getargvals@@ + \fi + \fi + \next +} + +\def\push@#1#2{% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter#1#2}% +} + +% Replace arguments by their values in the macro body, and place the result +% in macro \@tempa +\def\macvalstoargs@{% + % To do this we use the property that token registers that are \the'ed + % within an \edef expand only once. So we are going to place all argument + % values into respective token registers. + % + % First we save the token context, and initialize argument numbering. + \begingroup + \paramno0\relax + % Then, for each argument number #N, we place the corresponding argument + % value into a new token list register \toks#N + \expandafter\putargsintokens@\saveparamlist@,;,% + % Then, we expand the body so that argument are replaced by their + % values. The trick for values not to be expanded themselves is that they + % are within tokens and that tokens expand only once in an \edef . + \edef\@tempc{\csname mac.\macroname .body\endcsname}% + % Now we restore the token stack pointer to free the token list registers + % which we have used, but we make sure that expanded body is saved after + % group. + \expandafter + \endgroup + \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% + } + +\def\macargexpandinbody@{% + %% Define the named-macro outside of this group and then close this group. + \expandafter + \endgroup + \macargdeflist@ + % First the replace in body the macro arguments by their values, the result + % is in \@tempa . + \macvalstoargs@ + % Then we point at the \norecurse or \gobble (for recursive) macro value + % with \@tempb . + \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname + % Depending on whether it is recursive or not, we need some tailing + % \egroup . + \ifx\@tempb\gobble + \let\@tempc\relax + \else + \let\@tempc\egroup + \fi + % And now we do the real job: + \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% + \@tempd +} + +\def\putargsintokens@#1,{% + \if#1;\let\next\relax + \else + \let\next\putargsintokens@ + % First we allocate the new token list register, and give it a temporary + % alias \@tempb . + \toksdef\@tempb\the\paramno + % Then we place the argument value into that token list register. + \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname + \expandafter\@tempb\expandafter{\@tempa}% + \advance\paramno by 1\relax + \fi + \next +} + +% Save the token stack pointer into macro #1 +\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} +% Restore the token stack pointer from number in macro #1 +\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} +% newtoks that can be used non \outer . +\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} + +% Tailing missing arguments are set to empty +\def\setemptyargvalues@{% + \ifx\paramlist\nilm@ + \let\next\macargexpandinbody@ + \else + \expandafter\setemptyargvaluesparser@\paramlist\endargs@ + \let\next\setemptyargvalues@ + \fi + \next +} + +\def\setemptyargvaluesparser@#1,#2\endargs@{% + \expandafter\def\expandafter\@tempa\expandafter{% + \expandafter\def\csname macarg.#1\endcsname{}}% + \push@\@tempa\macargdeflist@ + \def\paramlist{#2}% +} + +% #1 is the element target macro +% #2 is the list macro +% #3,#4\endargs@ is the list value +\def\pop@#1#2#3,#4\endargs@{% + \def#1{#3}% + \def#2{#4}% +} +\long\def\longpop@#1#2#3,#4\endargs@{% + \long\def#1{#3}% + \long\def#2{#4}% +} + +% This defines a Texinfo @macro. There are eight cases: recursive and +% nonrecursive macros of zero, one, up to nine, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +% +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else + \ifnum\paramno<10\relax % at most 9 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else % 10 or more + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble + \fi + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % at most 9 + \ifnum\paramno<10\relax + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % 10 or more: + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse + \fi + \fi + \fi} + +\catcode `\@\texiatcatcode\relax + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg). +% +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \macnamexxx} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Make them active and then expand them all to nothing. +% +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{% + \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \lastsection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\lastsection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout + }% + \fi +} + +% @xrefautosectiontitle on|off says whether @section(ing) names are used +% automatically in xrefs, if the third arg is not explicitly specified. +% This was provided as a "secret" @set xref-automatic-section-title +% variable, now it's official. +% +\parseargdef\xrefautomaticsectiontitle{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', + must be on|off}% + \fi\fi +} + +% +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +% +\newbox\toprefbox +\newbox\printedrefnamebox +\newbox\infofilenamebox +\newbox\printedmanualbox +% +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + % + % Get args without leading/trailing spaces. + \def\printedrefname{\ignorespaces #3}% + \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% + % + \def\infofilename{\ignorespaces #4}% + \setbox\infofilenamebox = \hbox{\infofilename\unskip}% + % + \def\printedmanual{\ignorespaces #5}% + \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% + % + % If the printed reference name (arg #3) was not explicitly given in + % the @xref, figure out what we want to use. + \ifdim \wd\printedrefnamebox = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax + % Not auto section-title: use node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Auto section-title: use chapter/section title inside + % the square brackets if we have it. + \ifdim \wd\printedmanualbox > 0pt + % It is in another manual, so we don't have it; use node name. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We (should) know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + {\indexnofonts + \turnoffactive + \makevalueexpandable + % This expands tokens, so do it after making catcode changes, so _ + % etc. don't get their TeX definitions. This ignores all spaces in + % #4, including (wrongly) those in the middle of the filename. + \getfilename{#4}% + % + % This (wrongly) does not take account of leading or trailing + % spaces in #1, which should be ignored. + \edef\pdfxrefdest{#1}% + \ifx\pdfxrefdest\empty + \def\pdfxrefdest{Top}% no empty targets + \else + \txiescapepdf\pdfxrefdest % escape PDF special chars + \fi + % + \leavevmode + \startlink attr{/Border [0 0 0]}% + \ifnum\filenamelength>0 + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \setcolor{\linkcolor}% + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd\printedrefnamebox = 0pt + \refx{#1-snt}{}% + \else + \printedrefname + \fi + % + % If the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd\printedmanualbox > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox to print the node names, TeX does not insert + % empty discretionaries after hyphens, which means that it will not + % find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, + % this is a loss. Therefore, we give the text of the node name + % again, so it is as if TeX is seeing it for the first time. + % + \ifdim \wd\printedmanualbox > 0pt + % Cross-manual reference with a printed manual name. + % + \crossmanualxref{\cite{\printedmanual\unskip}}% + % + \else\ifdim \wd\infofilenamebox > 0pt + % Cross-manual reference with only an info filename (arg 4), no + % printed manual name (arg 5). This is essentially the same as + % the case above; we output the filename, since we have nothing else. + % + \crossmanualxref{\code{\infofilename\unskip}}% + % + \else + % Reference within this manual. + % + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via the macro below so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi\fi + \fi + \endlink +\endgroup} + +% Output a cross-manual xref to #1. Used just above (twice). +% +% Only include the text "Section ``foo'' in" if the foo is neither +% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply +% "see The Foo Manual", the idea being to refer to the whole manual. +% +% But, this being TeX, we can't easily compare our node name against the +% string "Top" while ignoring the possible spaces before and after in +% the input. By adding the arbitrary 7sp below, we make it much less +% likely that a real node name would have the same width as "Top" (e.g., +% in a monospaced font). Hopefully it will never happen in practice. +% +% For the same basic reason, we retypeset the "Top" at every +% reference, since the current font is indeterminate. +% +\def\crossmanualxref#1{% + \setbox\toprefbox = \hbox{Top\kern7sp}% + \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% + \ifdim \wd2 > 7sp % nonempty? + \ifdim \wd2 = \wd\toprefbox \else % same as Top? + \putwordSection{} ``\printedrefname'' \putwordin{}\space + \fi + \fi + #1% +} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + {\toks0 = {#1}% avoid expansion of possibly-complex value + \message{\linenumber Undefined cross reference `\the\toks0'.}}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + {% The node name might contain 8-bit characters, which in our current + % implementation are changed to commands like @'e. Don't let these + % mess up the control sequence name. + \indexnofonts + \turnoffactive + \xdef\safexrefname{#1}% + }% + % + \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR\safexrefname\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 + {\safexrefname}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count1=128 + \def\loop{% + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 +\endgroup} + + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for Info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + % + % Invoke rest of plain TeX footnote routine. + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarly, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\thisisundefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \else \ifx\centersub\centerV + % for @center @image, we need a vbox so we can have our vertical space + \imagevmodetrue + \vbox\bgroup % vbox has better behavior than vtop herev + \fi\fi + % + \ifimagevmode + \nobreak\medskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \fi + % + % Leave vertical mode so that indentation from an enclosing + % environment such as @quotation is respected. + % However, if we're at the top level, we don't want the + % normal paragraph indentation. + % On the other hand, if we are in the case of @center @image, we don't + % want to start a paragraph, which will create a hsize-width box and + % eradicate the centering. + \ifx\centersub\centerV\else \noindent \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode + \medskip % space after a standalone image + \fi + \ifx\centersub\centerV \egroup \fi +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \lastsection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\lastsection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \lastsection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + + +\message{localization,} + +% For single-language documents, @documentlanguage is usually given very +% early, just after @documentencoding. Single argument is the language +% (de) or locale (de_DE) abbreviation. +% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames + \tex % read txi-??.tex file in plain TeX. + % Read the file by the name they passed if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \documentlanguagetrywithoutunderscore{#1_\finish}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 + \endgroup % end raw TeX +\endgroup} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \globaldefs = 1 % everything in the txi-LL files needs to persist + \input txi-#1.tex + \fi + \closein 1 +} +}% end of special _ catcode +% +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? Putting it in the current +directory should work if nowhere else does.} + +% This macro is called from txi-??.tex files; the first argument is the +% \language name to set (without the "\lang@" prefix), the second and +% third args are \{left,right}hyphenmin. +% +% The language names to pass are determined when the format is built. +% See the etex.log file created at that time, e.g., +% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. +% +% With TeX Live 2008, etex now includes hyphenation patterns for all +% available languages. This means we can support hyphenation in +% Texinfo, at least to some extent. (This still doesn't solve the +% accented characters problem.) +% +\catcode`@=11 +\def\txisetlanguage#1#2#3{% + % do not set the language if the name is undefined in the current TeX. + \expandafter\ifx\csname lang@#1\endcsname \relax + \message{no patterns for #1}% + \else + \global\language = \csname lang@#1\endcsname + \fi + % but there is no harm in adjusting the hyphenmin values regardless. + \global\lefthyphenmin = #2\relax + \global\righthyphenmin = #3\relax +} + +% Helpers for encodings. +% Set the catcode of characters 128 through 255 to the specified number. +% +\def\setnonasciicharscatcode#1{% + \count255=128 + \loop\ifnum\count255<256 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +% @documentencoding sets the definition of non-ASCII characters +% according to the specified encoding. +% +\parseargdef\documentencoding{% + % Encoding being declared for the document. + \def\declaredencoding{\csname #1.enc\endcsname}% + % + % Supported encodings: names converted to tokens in order to be able + % to compare them with \ifx. + \def\ascii{\csname US-ASCII.enc\endcsname}% + \def\latnine{\csname ISO-8859-15.enc\endcsname}% + \def\latone{\csname ISO-8859-1.enc\endcsname}% + \def\lattwo{\csname ISO-8859-2.enc\endcsname}% + \def\utfeight{\csname UTF-8.enc\endcsname}% + % + \ifx \declaredencoding \ascii + \asciichardefs + % + \else \ifx \declaredencoding \lattwo + \setnonasciicharscatcode\active + \lattwochardefs + % + \else \ifx \declaredencoding \latone + \setnonasciicharscatcode\active + \latonechardefs + % + \else \ifx \declaredencoding \latnine + \setnonasciicharscatcode\active + \latninechardefs + % + \else \ifx \declaredencoding \utfeight + \setnonasciicharscatcode\active + \utfeightchardefs + % + \else + \message{Unknown document encoding #1, ignoring.}% + % + \fi % utfeight + \fi % latnine + \fi % latone + \fi % lattwo + \fi % ascii +} + +% A message to be logged when using a character that isn't available +% the default font encoding (OT1). +% +\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} + +% Take account of \c (plain) vs. \, (Texinfo) difference. +\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} + +% First, make active non-ASCII characters in order for them to be +% correctly categorized when TeX reads the replacement text of +% macros containing the character definitions. +\setnonasciicharscatcode\active +% +% Latin1 (ISO-8859-1) character definitions. +\def\latonechardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\exclamdown} + \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a3{{\pounds}} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\missingcharmsg{YEN SIGN}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} + \gdef^^aa{\ordf} + \gdef^^ab{\guillemetleft} + \gdef^^ac{$\lnot$} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} + \gdef^^af{\={}} + % + \gdef^^b0{\textdegree} + \gdef^^b1{$\pm$} + \gdef^^b2{$^2$} + \gdef^^b3{$^3$} + \gdef^^b4{\'{}} + \gdef^^b5{$\mu$} + \gdef^^b6{\P} + % + \gdef^^b7{$^.$} + \gdef^^b8{\cedilla\ } + \gdef^^b9{$^1$} + \gdef^^ba{\ordm} + % + \gdef^^bb{\guillemetright} + \gdef^^bc{$1\over4$} + \gdef^^bd{$1\over2$} + \gdef^^be{$3\over4$} + \gdef^^bf{\questiondown} + % + \gdef^^c0{\`A} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\~A} + \gdef^^c4{\"A} + \gdef^^c5{\ringaccent A} + \gdef^^c6{\AE} + \gdef^^c7{\cedilla C} + \gdef^^c8{\`E} + \gdef^^c9{\'E} + \gdef^^ca{\^E} + \gdef^^cb{\"E} + \gdef^^cc{\`I} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\"I} + % + \gdef^^d0{\DH} + \gdef^^d1{\~N} + \gdef^^d2{\`O} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\~O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\O} + \gdef^^d9{\`U} + \gdef^^da{\'U} + \gdef^^db{\^U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\TH} + \gdef^^df{\ss} + % + \gdef^^e0{\`a} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\~a} + \gdef^^e4{\"a} + \gdef^^e5{\ringaccent a} + \gdef^^e6{\ae} + \gdef^^e7{\cedilla c} + \gdef^^e8{\`e} + \gdef^^e9{\'e} + \gdef^^ea{\^e} + \gdef^^eb{\"e} + \gdef^^ec{\`{\dotless i}} + \gdef^^ed{\'{\dotless i}} + \gdef^^ee{\^{\dotless i}} + \gdef^^ef{\"{\dotless i}} + % + \gdef^^f0{\dh} + \gdef^^f1{\~n} + \gdef^^f2{\`o} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\~o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\o} + \gdef^^f9{\`u} + \gdef^^fa{\'u} + \gdef^^fb{\^u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\th} + \gdef^^ff{\"y} +} + +% Latin9 (ISO-8859-15) encoding character definitions. +\def\latninechardefs{% + % Encoding is almost identical to Latin1. + \latonechardefs + % + \gdef^^a4{\euro} + \gdef^^a6{\v S} + \gdef^^a8{\v s} + \gdef^^b4{\v Z} + \gdef^^b8{\v z} + \gdef^^bc{\OE} + \gdef^^bd{\oe} + \gdef^^be{\"Y} +} + +% Latin2 (ISO-8859-2) character definitions. +\def\lattwochardefs{% + \gdef^^a0{\tie} + \gdef^^a1{\ogonek{A}} + \gdef^^a2{\u{}} + \gdef^^a3{\L} + \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} + \gdef^^a5{\v L} + \gdef^^a6{\'S} + \gdef^^a7{\S} + \gdef^^a8{\"{}} + \gdef^^a9{\v S} + \gdef^^aa{\cedilla S} + \gdef^^ab{\v T} + \gdef^^ac{\'Z} + \gdef^^ad{\-} + \gdef^^ae{\v Z} + \gdef^^af{\dotaccent Z} + % + \gdef^^b0{\textdegree} + \gdef^^b1{\ogonek{a}} + \gdef^^b2{\ogonek{ }} + \gdef^^b3{\l} + \gdef^^b4{\'{}} + \gdef^^b5{\v l} + \gdef^^b6{\'s} + \gdef^^b7{\v{}} + \gdef^^b8{\cedilla\ } + \gdef^^b9{\v s} + \gdef^^ba{\cedilla s} + \gdef^^bb{\v t} + \gdef^^bc{\'z} + \gdef^^bd{\H{}} + \gdef^^be{\v z} + \gdef^^bf{\dotaccent z} + % + \gdef^^c0{\'R} + \gdef^^c1{\'A} + \gdef^^c2{\^A} + \gdef^^c3{\u A} + \gdef^^c4{\"A} + \gdef^^c5{\'L} + \gdef^^c6{\'C} + \gdef^^c7{\cedilla C} + \gdef^^c8{\v C} + \gdef^^c9{\'E} + \gdef^^ca{\ogonek{E}} + \gdef^^cb{\"E} + \gdef^^cc{\v E} + \gdef^^cd{\'I} + \gdef^^ce{\^I} + \gdef^^cf{\v D} + % + \gdef^^d0{\DH} + \gdef^^d1{\'N} + \gdef^^d2{\v N} + \gdef^^d3{\'O} + \gdef^^d4{\^O} + \gdef^^d5{\H O} + \gdef^^d6{\"O} + \gdef^^d7{$\times$} + \gdef^^d8{\v R} + \gdef^^d9{\ringaccent U} + \gdef^^da{\'U} + \gdef^^db{\H U} + \gdef^^dc{\"U} + \gdef^^dd{\'Y} + \gdef^^de{\cedilla T} + \gdef^^df{\ss} + % + \gdef^^e0{\'r} + \gdef^^e1{\'a} + \gdef^^e2{\^a} + \gdef^^e3{\u a} + \gdef^^e4{\"a} + \gdef^^e5{\'l} + \gdef^^e6{\'c} + \gdef^^e7{\cedilla c} + \gdef^^e8{\v c} + \gdef^^e9{\'e} + \gdef^^ea{\ogonek{e}} + \gdef^^eb{\"e} + \gdef^^ec{\v e} + \gdef^^ed{\'{\dotless{i}}} + \gdef^^ee{\^{\dotless{i}}} + \gdef^^ef{\v d} + % + \gdef^^f0{\dh} + \gdef^^f1{\'n} + \gdef^^f2{\v n} + \gdef^^f3{\'o} + \gdef^^f4{\^o} + \gdef^^f5{\H o} + \gdef^^f6{\"o} + \gdef^^f7{$\div$} + \gdef^^f8{\v r} + \gdef^^f9{\ringaccent u} + \gdef^^fa{\'u} + \gdef^^fb{\H u} + \gdef^^fc{\"u} + \gdef^^fd{\'y} + \gdef^^fe{\cedilla t} + \gdef^^ff{\dotaccent{}} +} + +% UTF-8 character definitions. +% +% This code to support UTF-8 is based on LaTeX's utf8.def, with some +% changes for Texinfo conventions. It is included here under the GPL by +% permission from Frank Mittelbach and the LaTeX team. +% +\newcount\countUTFx +\newcount\countUTFy +\newcount\countUTFz + +\gdef\UTFviiiTwoOctets#1#2{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\endcsname} +% +\gdef\UTFviiiThreeOctets#1#2#3{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} +% +\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter + \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} + +\gdef\UTFviiiDefined#1{% + \ifx #1\relax + \message{\linenumber Unicode char \string #1 not defined for Texinfo}% + \else + \expandafter #1% + \fi +} + +\begingroup + \catcode`\~13 + \catcode`\"12 + + \def\UTFviiiLoop{% + \global\catcode\countUTFx\active + \uccode`\~\countUTFx + \uppercase\expandafter{\UTFviiiTmp}% + \advance\countUTFx by 1 + \ifnum\countUTFx < \countUTFy + \expandafter\UTFviiiLoop + \fi} + + \countUTFx = "C2 + \countUTFy = "E0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiTwoOctets\string~}} + \UTFviiiLoop + + \countUTFx = "E0 + \countUTFy = "F0 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiThreeOctets\string~}} + \UTFviiiLoop + + \countUTFx = "F0 + \countUTFy = "F4 + \def\UTFviiiTmp{% + \xdef~{\noexpand\UTFviiiFourOctets\string~}} + \UTFviiiLoop +\endgroup + +\begingroup + \catcode`\"=12 + \catcode`\<=12 + \catcode`\.=12 + \catcode`\,=12 + \catcode`\;=12 + \catcode`\!=12 + \catcode`\~=13 + + \gdef\DeclareUnicodeCharacter#1#2{% + \countUTFz = "#1\relax + %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + \begingroup + \parseXMLCharref + \def\UTFviiiTwoOctets##1##2{% + \csname u8:##1\string ##2\endcsname}% + \def\UTFviiiThreeOctets##1##2##3{% + \csname u8:##1\string ##2\string ##3\endcsname}% + \def\UTFviiiFourOctets##1##2##3##4{% + \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter + \gdef\UTFviiiTmp{#2}% + \endgroup} + + \gdef\parseXMLCharref{% + \ifnum\countUTFz < "A0\relax + \errhelp = \EMsimple + \errmessage{Cannot define Unicode char value < 00A0}% + \else\ifnum\countUTFz < "800\relax + \parseUTFviiiA,% + \parseUTFviiiB C\UTFviiiTwoOctets.,% + \else\ifnum\countUTFz < "10000\relax + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% + \else + \parseUTFviiiA;% + \parseUTFviiiA,% + \parseUTFviiiA!% + \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% + \fi\fi\fi + } + + \gdef\parseUTFviiiA#1{% + \countUTFx = \countUTFz + \divide\countUTFz by 64 + \countUTFy = \countUTFz + \multiply\countUTFz by 64 + \advance\countUTFx by -\countUTFz + \advance\countUTFx by 128 + \uccode `#1\countUTFx + \countUTFz = \countUTFy} + + \gdef\parseUTFviiiB#1#2#3#4{% + \advance\countUTFz by "#10\relax + \uccode `#3\countUTFz + \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} +\endgroup + +\def\utfeightchardefs{% + \DeclareUnicodeCharacter{00A0}{\tie} + \DeclareUnicodeCharacter{00A1}{\exclamdown} + \DeclareUnicodeCharacter{00A3}{\pounds} + \DeclareUnicodeCharacter{00A8}{\"{ }} + \DeclareUnicodeCharacter{00A9}{\copyright} + \DeclareUnicodeCharacter{00AA}{\ordf} + \DeclareUnicodeCharacter{00AB}{\guillemetleft} + \DeclareUnicodeCharacter{00AD}{\-} + \DeclareUnicodeCharacter{00AE}{\registeredsymbol} + \DeclareUnicodeCharacter{00AF}{\={ }} + + \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} + \DeclareUnicodeCharacter{00B4}{\'{ }} + \DeclareUnicodeCharacter{00B8}{\cedilla{ }} + \DeclareUnicodeCharacter{00BA}{\ordm} + \DeclareUnicodeCharacter{00BB}{\guillemetright} + \DeclareUnicodeCharacter{00BF}{\questiondown} + + \DeclareUnicodeCharacter{00C0}{\`A} + \DeclareUnicodeCharacter{00C1}{\'A} + \DeclareUnicodeCharacter{00C2}{\^A} + \DeclareUnicodeCharacter{00C3}{\~A} + \DeclareUnicodeCharacter{00C4}{\"A} + \DeclareUnicodeCharacter{00C5}{\AA} + \DeclareUnicodeCharacter{00C6}{\AE} + \DeclareUnicodeCharacter{00C7}{\cedilla{C}} + \DeclareUnicodeCharacter{00C8}{\`E} + \DeclareUnicodeCharacter{00C9}{\'E} + \DeclareUnicodeCharacter{00CA}{\^E} + \DeclareUnicodeCharacter{00CB}{\"E} + \DeclareUnicodeCharacter{00CC}{\`I} + \DeclareUnicodeCharacter{00CD}{\'I} + \DeclareUnicodeCharacter{00CE}{\^I} + \DeclareUnicodeCharacter{00CF}{\"I} + + \DeclareUnicodeCharacter{00D0}{\DH} + \DeclareUnicodeCharacter{00D1}{\~N} + \DeclareUnicodeCharacter{00D2}{\`O} + \DeclareUnicodeCharacter{00D3}{\'O} + \DeclareUnicodeCharacter{00D4}{\^O} + \DeclareUnicodeCharacter{00D5}{\~O} + \DeclareUnicodeCharacter{00D6}{\"O} + \DeclareUnicodeCharacter{00D8}{\O} + \DeclareUnicodeCharacter{00D9}{\`U} + \DeclareUnicodeCharacter{00DA}{\'U} + \DeclareUnicodeCharacter{00DB}{\^U} + \DeclareUnicodeCharacter{00DC}{\"U} + \DeclareUnicodeCharacter{00DD}{\'Y} + \DeclareUnicodeCharacter{00DE}{\TH} + \DeclareUnicodeCharacter{00DF}{\ss} + + \DeclareUnicodeCharacter{00E0}{\`a} + \DeclareUnicodeCharacter{00E1}{\'a} + \DeclareUnicodeCharacter{00E2}{\^a} + \DeclareUnicodeCharacter{00E3}{\~a} + \DeclareUnicodeCharacter{00E4}{\"a} + \DeclareUnicodeCharacter{00E5}{\aa} + \DeclareUnicodeCharacter{00E6}{\ae} + \DeclareUnicodeCharacter{00E7}{\cedilla{c}} + \DeclareUnicodeCharacter{00E8}{\`e} + \DeclareUnicodeCharacter{00E9}{\'e} + \DeclareUnicodeCharacter{00EA}{\^e} + \DeclareUnicodeCharacter{00EB}{\"e} + \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} + \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} + \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} + \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} + + \DeclareUnicodeCharacter{00F0}{\dh} + \DeclareUnicodeCharacter{00F1}{\~n} + \DeclareUnicodeCharacter{00F2}{\`o} + \DeclareUnicodeCharacter{00F3}{\'o} + \DeclareUnicodeCharacter{00F4}{\^o} + \DeclareUnicodeCharacter{00F5}{\~o} + \DeclareUnicodeCharacter{00F6}{\"o} + \DeclareUnicodeCharacter{00F8}{\o} + \DeclareUnicodeCharacter{00F9}{\`u} + \DeclareUnicodeCharacter{00FA}{\'u} + \DeclareUnicodeCharacter{00FB}{\^u} + \DeclareUnicodeCharacter{00FC}{\"u} + \DeclareUnicodeCharacter{00FD}{\'y} + \DeclareUnicodeCharacter{00FE}{\th} + \DeclareUnicodeCharacter{00FF}{\"y} + + \DeclareUnicodeCharacter{0100}{\=A} + \DeclareUnicodeCharacter{0101}{\=a} + \DeclareUnicodeCharacter{0102}{\u{A}} + \DeclareUnicodeCharacter{0103}{\u{a}} + \DeclareUnicodeCharacter{0104}{\ogonek{A}} + \DeclareUnicodeCharacter{0105}{\ogonek{a}} + \DeclareUnicodeCharacter{0106}{\'C} + \DeclareUnicodeCharacter{0107}{\'c} + \DeclareUnicodeCharacter{0108}{\^C} + \DeclareUnicodeCharacter{0109}{\^c} + \DeclareUnicodeCharacter{0118}{\ogonek{E}} + \DeclareUnicodeCharacter{0119}{\ogonek{e}} + \DeclareUnicodeCharacter{010A}{\dotaccent{C}} + \DeclareUnicodeCharacter{010B}{\dotaccent{c}} + \DeclareUnicodeCharacter{010C}{\v{C}} + \DeclareUnicodeCharacter{010D}{\v{c}} + \DeclareUnicodeCharacter{010E}{\v{D}} + + \DeclareUnicodeCharacter{0112}{\=E} + \DeclareUnicodeCharacter{0113}{\=e} + \DeclareUnicodeCharacter{0114}{\u{E}} + \DeclareUnicodeCharacter{0115}{\u{e}} + \DeclareUnicodeCharacter{0116}{\dotaccent{E}} + \DeclareUnicodeCharacter{0117}{\dotaccent{e}} + \DeclareUnicodeCharacter{011A}{\v{E}} + \DeclareUnicodeCharacter{011B}{\v{e}} + \DeclareUnicodeCharacter{011C}{\^G} + \DeclareUnicodeCharacter{011D}{\^g} + \DeclareUnicodeCharacter{011E}{\u{G}} + \DeclareUnicodeCharacter{011F}{\u{g}} + + \DeclareUnicodeCharacter{0120}{\dotaccent{G}} + \DeclareUnicodeCharacter{0121}{\dotaccent{g}} + \DeclareUnicodeCharacter{0124}{\^H} + \DeclareUnicodeCharacter{0125}{\^h} + \DeclareUnicodeCharacter{0128}{\~I} + \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} + \DeclareUnicodeCharacter{012A}{\=I} + \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} + \DeclareUnicodeCharacter{012C}{\u{I}} + \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} + + \DeclareUnicodeCharacter{0130}{\dotaccent{I}} + \DeclareUnicodeCharacter{0131}{\dotless{i}} + \DeclareUnicodeCharacter{0132}{IJ} + \DeclareUnicodeCharacter{0133}{ij} + \DeclareUnicodeCharacter{0134}{\^J} + \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} + \DeclareUnicodeCharacter{0139}{\'L} + \DeclareUnicodeCharacter{013A}{\'l} + + \DeclareUnicodeCharacter{0141}{\L} + \DeclareUnicodeCharacter{0142}{\l} + \DeclareUnicodeCharacter{0143}{\'N} + \DeclareUnicodeCharacter{0144}{\'n} + \DeclareUnicodeCharacter{0147}{\v{N}} + \DeclareUnicodeCharacter{0148}{\v{n}} + \DeclareUnicodeCharacter{014C}{\=O} + \DeclareUnicodeCharacter{014D}{\=o} + \DeclareUnicodeCharacter{014E}{\u{O}} + \DeclareUnicodeCharacter{014F}{\u{o}} + + \DeclareUnicodeCharacter{0150}{\H{O}} + \DeclareUnicodeCharacter{0151}{\H{o}} + \DeclareUnicodeCharacter{0152}{\OE} + \DeclareUnicodeCharacter{0153}{\oe} + \DeclareUnicodeCharacter{0154}{\'R} + \DeclareUnicodeCharacter{0155}{\'r} + \DeclareUnicodeCharacter{0158}{\v{R}} + \DeclareUnicodeCharacter{0159}{\v{r}} + \DeclareUnicodeCharacter{015A}{\'S} + \DeclareUnicodeCharacter{015B}{\'s} + \DeclareUnicodeCharacter{015C}{\^S} + \DeclareUnicodeCharacter{015D}{\^s} + \DeclareUnicodeCharacter{015E}{\cedilla{S}} + \DeclareUnicodeCharacter{015F}{\cedilla{s}} + + \DeclareUnicodeCharacter{0160}{\v{S}} + \DeclareUnicodeCharacter{0161}{\v{s}} + \DeclareUnicodeCharacter{0162}{\cedilla{t}} + \DeclareUnicodeCharacter{0163}{\cedilla{T}} + \DeclareUnicodeCharacter{0164}{\v{T}} + + \DeclareUnicodeCharacter{0168}{\~U} + \DeclareUnicodeCharacter{0169}{\~u} + \DeclareUnicodeCharacter{016A}{\=U} + \DeclareUnicodeCharacter{016B}{\=u} + \DeclareUnicodeCharacter{016C}{\u{U}} + \DeclareUnicodeCharacter{016D}{\u{u}} + \DeclareUnicodeCharacter{016E}{\ringaccent{U}} + \DeclareUnicodeCharacter{016F}{\ringaccent{u}} + + \DeclareUnicodeCharacter{0170}{\H{U}} + \DeclareUnicodeCharacter{0171}{\H{u}} + \DeclareUnicodeCharacter{0174}{\^W} + \DeclareUnicodeCharacter{0175}{\^w} + \DeclareUnicodeCharacter{0176}{\^Y} + \DeclareUnicodeCharacter{0177}{\^y} + \DeclareUnicodeCharacter{0178}{\"Y} + \DeclareUnicodeCharacter{0179}{\'Z} + \DeclareUnicodeCharacter{017A}{\'z} + \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} + \DeclareUnicodeCharacter{017C}{\dotaccent{z}} + \DeclareUnicodeCharacter{017D}{\v{Z}} + \DeclareUnicodeCharacter{017E}{\v{z}} + + \DeclareUnicodeCharacter{01C4}{D\v{Z}} + \DeclareUnicodeCharacter{01C5}{D\v{z}} + \DeclareUnicodeCharacter{01C6}{d\v{z}} + \DeclareUnicodeCharacter{01C7}{LJ} + \DeclareUnicodeCharacter{01C8}{Lj} + \DeclareUnicodeCharacter{01C9}{lj} + \DeclareUnicodeCharacter{01CA}{NJ} + \DeclareUnicodeCharacter{01CB}{Nj} + \DeclareUnicodeCharacter{01CC}{nj} + \DeclareUnicodeCharacter{01CD}{\v{A}} + \DeclareUnicodeCharacter{01CE}{\v{a}} + \DeclareUnicodeCharacter{01CF}{\v{I}} + + \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} + \DeclareUnicodeCharacter{01D1}{\v{O}} + \DeclareUnicodeCharacter{01D2}{\v{o}} + \DeclareUnicodeCharacter{01D3}{\v{U}} + \DeclareUnicodeCharacter{01D4}{\v{u}} + + \DeclareUnicodeCharacter{01E2}{\={\AE}} + \DeclareUnicodeCharacter{01E3}{\={\ae}} + \DeclareUnicodeCharacter{01E6}{\v{G}} + \DeclareUnicodeCharacter{01E7}{\v{g}} + \DeclareUnicodeCharacter{01E8}{\v{K}} + \DeclareUnicodeCharacter{01E9}{\v{k}} + + \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} + \DeclareUnicodeCharacter{01F1}{DZ} + \DeclareUnicodeCharacter{01F2}{Dz} + \DeclareUnicodeCharacter{01F3}{dz} + \DeclareUnicodeCharacter{01F4}{\'G} + \DeclareUnicodeCharacter{01F5}{\'g} + \DeclareUnicodeCharacter{01F8}{\`N} + \DeclareUnicodeCharacter{01F9}{\`n} + \DeclareUnicodeCharacter{01FC}{\'{\AE}} + \DeclareUnicodeCharacter{01FD}{\'{\ae}} + \DeclareUnicodeCharacter{01FE}{\'{\O}} + \DeclareUnicodeCharacter{01FF}{\'{\o}} + + \DeclareUnicodeCharacter{021E}{\v{H}} + \DeclareUnicodeCharacter{021F}{\v{h}} + + \DeclareUnicodeCharacter{0226}{\dotaccent{A}} + \DeclareUnicodeCharacter{0227}{\dotaccent{a}} + \DeclareUnicodeCharacter{0228}{\cedilla{E}} + \DeclareUnicodeCharacter{0229}{\cedilla{e}} + \DeclareUnicodeCharacter{022E}{\dotaccent{O}} + \DeclareUnicodeCharacter{022F}{\dotaccent{o}} + + \DeclareUnicodeCharacter{0232}{\=Y} + \DeclareUnicodeCharacter{0233}{\=y} + \DeclareUnicodeCharacter{0237}{\dotless{j}} + + \DeclareUnicodeCharacter{02DB}{\ogonek{ }} + + \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} + \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} + \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} + \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} + \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} + \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} + \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} + \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} + \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} + \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} + \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} + \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} + + \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} + \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} + + \DeclareUnicodeCharacter{1E20}{\=G} + \DeclareUnicodeCharacter{1E21}{\=g} + \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} + \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} + \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} + \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} + \DeclareUnicodeCharacter{1E26}{\"H} + \DeclareUnicodeCharacter{1E27}{\"h} + + \DeclareUnicodeCharacter{1E30}{\'K} + \DeclareUnicodeCharacter{1E31}{\'k} + \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} + \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} + \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} + \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} + \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} + \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} + \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} + \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} + \DeclareUnicodeCharacter{1E3E}{\'M} + \DeclareUnicodeCharacter{1E3F}{\'m} + + \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} + \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} + \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} + \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} + \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} + \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} + \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} + \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} + \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} + \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} + + \DeclareUnicodeCharacter{1E54}{\'P} + \DeclareUnicodeCharacter{1E55}{\'p} + \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} + \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} + \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} + \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} + \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} + \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} + \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} + \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} + + \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} + \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} + \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} + \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} + \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} + \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} + \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} + \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} + \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} + \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} + + \DeclareUnicodeCharacter{1E7C}{\~V} + \DeclareUnicodeCharacter{1E7D}{\~v} + \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} + \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} + + \DeclareUnicodeCharacter{1E80}{\`W} + \DeclareUnicodeCharacter{1E81}{\`w} + \DeclareUnicodeCharacter{1E82}{\'W} + \DeclareUnicodeCharacter{1E83}{\'w} + \DeclareUnicodeCharacter{1E84}{\"W} + \DeclareUnicodeCharacter{1E85}{\"w} + \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} + \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} + \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} + \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} + \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} + \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} + \DeclareUnicodeCharacter{1E8C}{\"X} + \DeclareUnicodeCharacter{1E8D}{\"x} + \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} + \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} + + \DeclareUnicodeCharacter{1E90}{\^Z} + \DeclareUnicodeCharacter{1E91}{\^z} + \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} + \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} + \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} + \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} + \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} + \DeclareUnicodeCharacter{1E97}{\"t} + \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} + \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} + + \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} + \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} + + \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} + \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} + \DeclareUnicodeCharacter{1EBC}{\~E} + \DeclareUnicodeCharacter{1EBD}{\~e} + + \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} + \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} + \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} + \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} + + \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} + \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} + + \DeclareUnicodeCharacter{1EF2}{\`Y} + \DeclareUnicodeCharacter{1EF3}{\`y} + \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} + + \DeclareUnicodeCharacter{1EF8}{\~Y} + \DeclareUnicodeCharacter{1EF9}{\~y} + + \DeclareUnicodeCharacter{2013}{--} + \DeclareUnicodeCharacter{2014}{---} + \DeclareUnicodeCharacter{2018}{\quoteleft} + \DeclareUnicodeCharacter{2019}{\quoteright} + \DeclareUnicodeCharacter{201A}{\quotesinglbase} + \DeclareUnicodeCharacter{201C}{\quotedblleft} + \DeclareUnicodeCharacter{201D}{\quotedblright} + \DeclareUnicodeCharacter{201E}{\quotedblbase} + \DeclareUnicodeCharacter{2022}{\bullet} + \DeclareUnicodeCharacter{2026}{\dots} + \DeclareUnicodeCharacter{2039}{\guilsinglleft} + \DeclareUnicodeCharacter{203A}{\guilsinglright} + \DeclareUnicodeCharacter{20AC}{\euro} + + \DeclareUnicodeCharacter{2192}{\expansion} + \DeclareUnicodeCharacter{21D2}{\result} + + \DeclareUnicodeCharacter{2212}{\minus} + \DeclareUnicodeCharacter{2217}{\point} + \DeclareUnicodeCharacter{2261}{\equiv} +}% end of \utfeightchardefs + + +% US-ASCII character definitions. +\def\asciichardefs{% nothing need be done + \relax +} + +% Make non-ASCII characters printable again for compatibility with +% existing Texinfo documents that may use them, even without declaring a +% document encoding. +% +\setnonasciicharscatcode \other + + +\message{formatting,} + +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be very finicky about underfull hboxes, either. +\hbadness = 6666 + +% Following George Bush, get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{607.2pt}{6in}% that's 46 lines + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.25 trim size. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {-.2in}{0in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{673.2pt}{160mm}% that's 51 lines + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1\relax + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +\def^^L{\par} % remove \outer, so ^L can appear in an @comment + +% DEL is a comment character, in case @c does not suffice. +\catcode`\^^? = 14 + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other \def\normaldoublequote{"} +\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix +\catcode`\+=\other \def\normalplus{+} +\catcode`\<=\other \def\normalless{<} +\catcode`\>=\other \def\normalgreater{>} +\catcode`\^=\other \def\normalcaret{^} +\catcode`\_=\other \def\normalunderscore{_} +\catcode`\|=\other \def\normalverticalbar{|} +\catcode`\~=\other \def\normaltilde{~} + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active % @ for escape char from now on. + +% The story here is that in math mode, the \char of \backslashcurfont +% ends up printing the roman \ from the math symbol font (because \char +% in math mode uses the \mathcode, and plain.tex sets +% \mathcode`\\="026E). It seems better for @backslashchar{} to always +% print a typewriter backslash, hence we use an explicit \mathchar, +% which is the decimal equivalent of "715c (class 7, e.g., use \fam; +% ignored family value; char position "5C). We can't use " for the +% usual hex value because it has already been made active. +@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} +@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. + +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. We switch back and forth between these. +@gdef@rawbackslash{@let\=@backslashcurfont} +@gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. Also revert - to its normal character, in +% case the active - from code has slipped in. +% +{@catcode`- = @active + @gdef@normalturnoffactive{% + @let-=@normaldash + @let"=@normaldoublequote + @let$=@normaldollar %$ font-lock fix + @let+=@normalplus + @let<=@normalless + @let>=@normalgreater + @let\=@normalbackslash + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let~=@normaltilde + @markupsetuplqdefault + @markupsetuprqdefault + @unsepspaces + } +} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\' in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These (along with & and #) are made active for url-breaking, so need +% active definitions as the normal characters. +@def@normaldot{.} +@def@normalquest{?} +@def@normalslash{/} + +% These look ok in all fonts, so just make them not special. +% @hashchar{} gets its own user-level command, because of #line. +@catcode`@& = @other @def@normalamp{&} +@catcode`@# = @other @def@normalhash{#} +@catcode`@% = @other @def@normalpercent{%} + +@let @hashchar = @normalhash + +@c Finally, make ` and ' active, so that txicodequoteundirected and +@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we +@c don't make ` and ' active, @code will not get them as active chars. +@c Do this last of all since we use ` in the previous @catcode assignments. +@catcode`@'=@active +@catcode`@`=@active +@markupsetuplqdefault +@markupsetuprqdefault + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff --git a/doc/version.texi b/doc/version.texi new file mode 100644 index 0000000..72da5d7 --- /dev/null +++ b/doc/version.texi @@ -0,0 +1,4 @@ +@set UPDATED 9 December 2017 +@set UPDATED-MONTH December 2017 +@set EDITION 0.9.59 +@set VERSION 0.9.59 diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..59990a1 --- /dev/null +++ b/install-sh @@ -0,0 +1,508 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2014-09-12.12; # UTC + +# 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. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# 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_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 +is_target_a_directory=possibly + +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 + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +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 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + 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 + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 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 problematic for 'test' and other utilities. + 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 + + # 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 "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + dstdir=`dirname "$dst"` + 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. + ;; + *) + # $RANDOM is not portable (e.g. dash); use it when possible to + # lower collision chance + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 + + # As "mkdir -p" follows symlinks and we work in /tmp possibly; so + # create the $tmpdir first (and fail if unsuccessful) to make sure + # that nobody tries to guess the $tmpdir name. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 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 + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && 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` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + 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-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/libmicrohttpd.pc.in b/libmicrohttpd.pc.in new file mode 100644 index 0000000..c1e628b --- /dev/null +++ b/libmicrohttpd.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libmicrohttpd +Description: A library for creating an embedded HTTP server +Version: @VERSION@ +Requires: +Requires.private: @MHD_REQ_PRIVATE@ +Conflicts: +Libs: -L${libdir} -lmicrohttpd +Libs.private: @MHD_LIBDEPS_PKGCFG@ +Cflags: -I${includedir} diff --git a/ltmain.sh b/ltmain.sh new file mode 100644 index 0000000..a736cf9 --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,11156 @@ +#! /bin/sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2014-01-03.01 + +# libtool (GNU libtool) 2.4.6 +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996-2015 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. + +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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, see . + + +PROGRAM=libtool +PACKAGE=libtool +VERSION="2.4.6 Debian-2.4.6-2" +package_revision=2.4.6 + + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2015-01-20.17; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# Copyright (C) 2004-2015 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. + +# 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 3 of the License, or +# (at your option) any later version. + +# As a special exception to the GNU General Public License, if you distribute +# this file as part of a program or library that is built using GNU Libtool, +# you may include this file under the same distribution terms that you use +# for the rest of that program. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNES 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, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do 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 + +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + fi" +done + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" + +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >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 + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + +: ${CP="cp -f"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} + + +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## + +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' + +# Same as above, but do not quote variable references. +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' + +# Sed substitution that converts a w32 file name or path +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_double_quote_subst, that '$' was protected from +# expansion. Since each input '\' is now two '\'s, look for any number +# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" + + +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: + +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath=$0 + +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` + +# Make sure we have an absolute progpath for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` + progdir=`cd "$progdir" && pwd` + progpath=$progdir/$progname + ;; + *) + _G_IFS=$IFS + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS=$_G_IFS + test -x "$progdir/$progname" && break + done + IFS=$_G_IFS + test -n "$progdir" || progdir=`pwd` + progpath=$progdir/$progname + ;; +esac + + +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. + +opt_dry_run=false +opt_quiet=false +opt_verbose=false + +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='' + tc_bold=''; tc_standout='' + tc_red=''; tc_green='' + tc_blue=''; tc_cyan='' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: +} + + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # We should try to minimise forks, especially on Windows where they are + # unreasonably slow, so skip the feature probes when bash or zsh are + # being used: + if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then + : ${_G_HAVE_ARITH_OP="yes"} + : ${_G_HAVE_XSI_OPS="yes"} + # The += operator was introduced in bash 3.1 + case $BASH_VERSION in + [12].* | 3.0 | 3.0*) ;; + *) + : ${_G_HAVE_PLUSEQ_OP="yes"} + ;; + esac + fi + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + test -z "$_G_HAVE_PLUSEQ_OP" \ + && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ + && _G_HAVE_PLUSEQ_OP=yes + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () +{ + $debug_cmd + + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT +# -------------------------------------------------------- +# Perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_echo_all ARG... +# -------------------- +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- +# Echo program name prefixed message to standard error. +func_error () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 +} + + +# func_fatal_error ARG... +# ----------------------- +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + $debug_cmd + + func_error "$*" + exit $EXIT_FAILURE +} + + +# func_grep EXPRESSION FILENAME +# ----------------------------- +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $debug_cmd + + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= + + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then + + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$_G_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + _G_dir_list=$_G_directory_path:$_G_dir_list + + # If the last portion added has no slash in it, the list is done + case $_G_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` + done + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` + + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_mkdir_p_IFS + # mkdir can fail with a 'File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$_G_dir" 2>/dev/null || : + done + IFS=$func_mkdir_p_IFS + + # Bail out if we (or some other process) failed to create a directory. + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" + fi +} + + +# func_mktempdir [BASENAME] +# ------------------------- +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, BASENAME is the basename for that directory. +func_mktempdir () +{ + $debug_cmd + + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then + # Return a directory name, but don't create it in dry-run mode + _G_tmpdir=$_G_template-$$ + else + + # If mktemp works, use that first and foremost + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` + + if test ! -d "$_G_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + _G_tmpdir=$_G_template-${RANDOM-0}$$ + + func_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + fi + + $ECHO "$_G_tmpdir" +} + + +# func_normal_abspath PATH +# ------------------------ +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +func_normal_abspath () +{ + $debug_cmd + + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` + while :; do + # Processed it all yet? + if test / = "$func_normal_abspath_tpath"; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result"; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + + +# func_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + + +# func_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=$func_dirname_result + if test -z "$func_relative_path_tlibdir"; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : +} + + +# func_quote_for_eval ARG... +# -------------------------- +# Aesthetically quote ARGs to be evaled later. +# This function returns two values: +# i) func_quote_for_eval_result +# double-quoted, suitable for a subsequent eval +# ii) func_quote_for_eval_unquoted_result +# has all characters that are still active within double +# quotes backslashified. +func_quote_for_eval () +{ + $debug_cmd + + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in + *[\\\`\"\$]*) + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; + *) + _G_unquoted_arg=$1 ;; + esac + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + fi + + case $_G_unquoted_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; + *) + _G_quoted_arg=$_G_unquoted_arg + ;; + esac + + if test -n "$func_quote_for_eval_result"; then + func_append func_quote_for_eval_result " $_G_quoted_arg" + else + func_append func_quote_for_eval_result "$_G_quoted_arg" + fi + shift + done +} + + +# func_quote_for_expand ARG +# ------------------------- +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + $debug_cmd + + case $1 in + *[\\\`\"]*) + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + *) + _G_arg=$1 ;; + esac + + case $_G_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_arg=\"$_G_arg\" + ;; + esac + + func_quote_for_expand_result=$_G_arg +} + + +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" + + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + $opt_quiet || { + func_quote_for_expand "$_G_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_tr_sh +# ---------- +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $debug_cmd + + $opt_verbose && func_echo "$*" + + : +} + + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# Set a version string for this script. +scriptversion=2014-01-07.03; # UTC + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# Copyright (C) 2010-2015 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. + +# 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 3 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, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# warranty; '. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# to the main code. A hook is just a named list of of function, that can +# be run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" +} + + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It is assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook funcions.n" ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + eval $_G_hook '"$@"' + + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + done + + func_quote_for_eval ${1+"$@"} + func_run_hooks_result=$func_quote_for_eval_result +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list in your hook function, remove any +# options that you action, and then pass back the remaining unprocessed +# options in '_result', escaped suitably for +# 'eval'. Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# +# func_quote_for_eval ${1+"$@"} +# my_options_prep_result=$func_quote_for_eval_result +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# # Note that for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# ;; +# *) set dummy "$_G_opt" "$*"; shift; break ;; +# esac +# done +# +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# +# func_quote_for_eval ${1+"$@"} +# my_option_validation_result=$func_quote_for_eval_result +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll alse need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + func_options_prep ${1+"$@"} + eval func_parse_options \ + ${func_options_prep_result+"$func_options_prep_result"} + eval func_validate_options \ + ${func_parse_options_result+"$func_parse_options_result"} + + eval func_run_hooks func_options \ + ${func_validate_options_result+"$func_validate_options_result"} + + # save modified positional parameters for caller + func_options_result=$func_run_hooks_result +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propogate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before +# returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + func_parse_options_result= + + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + + # Adjust func_parse_options positional parameters to match + eval set dummy "$func_run_hooks_result"; shift + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + test $# = 0 && func_missing_arg $_G_opt && break + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE + + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message" + exit 0 +} + + +# func_missing_arg ARGNAME +# ------------------------ +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $debug_cmd + + func_error "Missing argument for '$1'." + exit_cmd=exit +} + + +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables after +# splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + test "x$func_split_equals_lhs" = "x$1" \ + && func_split_equals_rhs= + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# func_split_short_opt SHORTOPT +# ----------------------------- +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () +{ + $debug_cmd + + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} + + +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} + + +# func_version +# ------------ +# Echo version message to standard output and exit. +func_version () +{ + $debug_cmd + + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /(C)/!b go + :more + /\./!{ + N + s|\n# | | + b more + } + :go + /^# Written by /,/# warranty; / { + s|^# || + s|^# *$|| + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + p + } + /^# Written by / { + s|^# || + p + } + /^warranty; /q' < "$progpath" + + exit $? +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string. +scriptversion='(GNU libtool) 2.4.6' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} + + +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" + +# Additional text appended to 'usage_message' in response to '--help'. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. +Try '$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname $scriptversion Debian-2.4.6-2 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to . +GNU libtool home page: . +General help using GNU software: ." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' + + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func__fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." +} + + +# func_config +# ----------- +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + + +# func_features +# ------------- +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test yes = "$build_libtool_libs"; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test yes = "$build_old_libs"; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + + +# func_enable_tag TAGNAME +# ----------------------- +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname=$1 + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + + +# func_check_version_match +# ------------------------ +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + + nonopt= + preserve_args= + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep libtool_options_prep + + +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift + fi + + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; then + func_error "unrecognized option '-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help=$help + help="Try '$progname --help --mode=$opt_mode' for more information." + } + + # Pass back the unparsed argument list + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + + + +## ----------- ## +## Main. ## +## ----------- ## + +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if 'file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case $lalib_p_line in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test yes = "$lalib_p" +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $debug_cmd + + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# 'FILE.' does not work on cygwin managed mounts. +func_source () +{ + $debug_cmd + + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case $lt_sysroot:$1 in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result='='$func_stripname_result + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $debug_cmd + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with '--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=$1 + if test yes = "$build_libtool_libs"; then + write_lobj=\'$2\' + else + write_lobj=none + fi + + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $debug_cmd + + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result= + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result"; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $debug_cmd + + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $debug_cmd + + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $debug_cmd + + if test -z "$2" && test -n "$1"; then + func_error "Could not determine host file name corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result=$1 + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $debug_cmd + + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " '$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result=$3 + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $debug_cmd + + case $4 in + $1 ) func_to_host_path_result=$3$func_to_host_path_result + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via '$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $debug_cmd + + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $debug_cmd + + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result=$1 +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result=$func_convert_core_msys_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result=$func_convert_core_file_wine_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via '$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $debug_cmd + + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd=func_convert_path_$func_stripname_result + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $debug_cmd + + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result=$1 +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_msys_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_path_wine_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + +# func_mode_compile arg... +func_mode_compile () +{ + $debug_cmd + + # Get the compilation command and the source file. + base_compile= + srcfile=$nonopt # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg=$arg + arg_mode=normal + ;; + + target ) + libobj=$arg + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify '-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs=$IFS; IFS=, + for arg in $args; do + IFS=$save_ifs + func_append_quoted lastarg "$arg" + done + IFS=$save_ifs + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg=$srcfile + srcfile=$arg + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with '-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj=$func_basename_result + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from '$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name '$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname=$func_basename_result + xdir=$func_dirname_result + lobj=$xdir$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test yes = "$build_old_libs"; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test no = "$compiler_c_o"; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext + lockfile=$output_obj.lock + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test yes = "$need_locks"; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test warn = "$need_locks"; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test yes = "$build_libtool_libs"; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test no != "$pic_mode"; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test yes = "$suppress_opt"; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test yes = "$compiler_c_o"; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test no != "$need_locks"; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test compile = "$opt_mode" && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a '.o' file suitable for static linking + -static only build a '.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a 'standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix '.c' with the +library object suffix, '.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to '-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the '--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the 'install' or 'cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE use a list of object files found in FILE to specify objects + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with '-') are ignored. + +Every other argument is treated as a filename. Files ending in '.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in '.la', then a libtool library is created, +only library objects ('.lo' files) may be specified, and '-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created +using 'ar' and 'ranlib', or on Windows using 'lib'. + +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode '$opt_mode'" + ;; + esac + + echo + $ECHO "Try '$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test : = "$opt_help"; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | $SED -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + $SED '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $debug_cmd + + # The first argument is the command name. + cmd=$nonopt + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "'$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "'$file' was not linked with '-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir=$func_dirname_result + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir=$func_dirname_result + ;; + + *) + func_warning "'-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir=$absdir + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic=$magic + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file=$progdir/$program + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file=$progdir/$program + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if $opt_dry_run; then + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + else + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd=\$cmd$args + fi +} + +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $debug_cmd + + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "'$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument '$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and '=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_quiet && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the '-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the '$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the '$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the '$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test finish = "$opt_mode" && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $debug_cmd + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac + then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=false + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=: ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test X-m = "X$prev" && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the '$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=: + if $isdir; then + destdir=$dest + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir=$func_dirname_result + destname=$func_basename_result + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "'$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "'$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir=$func_dirname_result + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking '$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname=$1 + shift + + srcname=$realname + test -n "$relink_command" && srcname=${realname}T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme=$stripme + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme= + ;; + esac + ;; + os2*) + case $realname in + *_dll.a) + tstripme= + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try 'ln -sf' first, because the 'ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib=$destdir/$realname + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name=$func_basename_result + instname=$dir/${name}i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest=$destfile + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to '$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test yes = "$build_old_libs"; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext= + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=.exe + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script '$wrapper'" + + finalize=: + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test no = "$fast_install" && test -n "$relink_command"; then + $opt_dry_run || { + if $finalize; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file=$func_basename_result + outputname=$tmpdir/$file + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_quiet || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink '$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file=$outputname + else + func_warning "cannot relink '$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name=$func_basename_result + + # Set up the ranlib parameters. + oldlib=$destdir/$name + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run '$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test install = "$opt_mode" && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms=${my_outputname}S.c + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist=$output_objdir/$my_outputname.nm + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* External symbol declarations for the compiler. */\ +" + + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols=$output_objdir/$outputname.exp + $opt_dry_run || { + $RM $export_symbols + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from '$dlprefile'" + func_basename "$dlprefile" + name=$func_basename_result + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename= + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname"; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename=$func_basename_result + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename"; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + $my_pic_p && pic_flag_for_symtable=" $pic_flag" + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' + + # Transform the symbol file into the correct name. + symfileobj=$output_objdir/${my_outputname}S.$objext + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for '$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $debug_cmd + + win32_libid_type=unknown + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s|.*|import| + p + q + } + }'` + ;; + esac + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $debug_cmd + + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $debug_cmd + + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive that possess that section. Heuristic: eliminate + # all those that have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $debug_cmd + + if func_cygming_gnu_implib_p "$1"; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1"; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result= + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test yes = "$lock_old_archive_extraction"; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $debug_cmd + + my_gentop=$1; shift + my_oldlibs=${1+"$@"} + my_oldobjs= + my_xlib= + my_xabs= + my_xdir= + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib=$func_basename_result + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir=$my_gentop/$my_xlib_u + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches; do + func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" + $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" + cd "unfat-$$/$darwin_base_archive-$darwin_arch" + func_extract_an_archive "`pwd`" "$darwin_base_archive" + cd "$darwin_curdir" + $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result=$my_oldobjs +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory where it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +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 +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ that is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options that match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test yes = "$fast_install"; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + \$ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* declarations of non-ANSI functions */ +#if defined __MINGW32__ +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined __CYGWIN__ +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined other_platform || defined ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined _MSC_VER +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +#elif defined __MINGW32__ +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined __CYGWIN__ +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined other platforms ... */ +#endif + +#if defined PATH_MAX +# define LT_PATHMAX PATH_MAX +#elif defined MAXPATHLEN +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ + defined __OS2__ +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free (stale); stale = 0; } \ +} while (0) + +#if defined LT_DEBUGWRAPPER +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + size_t tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined HAVE_DOS_BASED_FILE_SYSTEM + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined HAVE_DOS_BASED_FILE_SYSTEM + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = (size_t) (q - p); + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (STREQ (str, pat)) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + size_t len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + size_t orig_value_len = strlen (orig_value); + size_t add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[--len] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $debug_cmd + + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $debug_cmd + + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # what system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll that has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + os2dllname= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=false + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module=$wl-single_module + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg=$1 + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir=$arg + prev= + continue + ;; + dlfiles|dlprefiles) + $preload || { + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=: + } + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test no = "$dlself"; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test dlprefiles = "$prev"; then + dlself=yes + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test dlfiles = "$prev"; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols=$arg + test -f "$arg" \ + || func_fatal_error "symbol file '$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex=$arg + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir=$arg + prev= + continue + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + if test none != "$pic_object"; then + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + fi + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file '$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + os2dllname) + os2dllname=$arg + prev= + continue + ;; + precious_regex) + precious_files_regex=$arg + prev= + continue + ;; + release) + release=-$arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test rpath = "$prev"; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds=$arg + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg=$arg + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "'-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test X-export-symbols = "X$arg"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between '-L' and '$1'" + else + func_fatal_error "need path for '-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of '$dir'" + dir=$absdir + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test X-lc = "X$arg" || test X-lm = "X$arg"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test X-lc = "X$arg" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + # Do not include libc due to us having libc/libc_r. + test X-lc = "X$arg" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test X-lc = "X$arg" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test X-lc = "X$arg" && continue + ;; + esac + elif test X-lc_r = "X$arg"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -mllvm) + prev=mllvm + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module=$wl-multi_module + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "'-no-install' is ignored for $host" + func_warning "assuming '-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -os2dllname) + prev=os2dllname + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # -fstack-protector* stack protector flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*|-fsanitize=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + fi + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + test none = "$pic_object" || { + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + } + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test dlfiles = "$prev"; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test dlprefiles = "$prev"; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the '$prevarg' option requires an argument" + + if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname=$func_basename_result + libobjs_save=$libobjs + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + + func_dirname "$output" "/" "" + output_objdir=$func_dirname_result$objdir + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test lib = "$linkmode"; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=false + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test lib,link = "$linkmode,$pass"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs=$tmp_deplibs + fi + + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs + deplibs= + fi + if test prog = "$linkmode"; then + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs=$dlprefiles + fi + if test dlopen = "$pass"; then + # Collect dlpreopened libraries + save_deplibs=$deplibs + deplibs= + fi + + for deplib in $libs; do + lib= + found=false + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test lib = "$linkmode"; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib=$searchdir/lib$name$search_ext + if test -f "$lib"; then + if test .la = "$search_ext"; then + found=: + else + found=false + fi + break 2 + fi + done + done + if $found; then + # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll=$l + done + if test "X$ll" = "X$old_library"; then # only static version available + found=false + func_dirname "$lib" "" "." + ladir=$func_dirname_result + lib=$ladir/$old_library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + *.ltframework) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test conv = "$pass" && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + if test scan = "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "'-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test link = "$pass"; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=false + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=: + fi + ;; + pass_all) + valid_a_lib=: + ;; + esac + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + fi + ;; + esac + continue + ;; + prog) + if test link != "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=: + continue + ;; + esac # case $deplib + + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "'$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir=$func_dirname_result + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test conv = "$pass"; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib=$l + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + + # This library was specified with -dlopen. + if test dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test -z "$dlname" || + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of '$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir=$ladir + fi + ;; + esac + func_basename "$lib" + laname=$func_basename_result + + # Find the relevant object directory and library name. + if test yes = "$installed"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library '$lib' was moved." + dir=$ladir + absdir=$abs_ladir + libdir=$abs_ladir + else + dir=$lt_sysroot$libdir + absdir=$lt_sysroot$libdir + fi + test yes = "$hardcode_automatic" && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir=$ladir + absdir=$abs_ladir + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir=$ladir/$objdir + absdir=$abs_ladir/$objdir + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; then + func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" + fi + case $host in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test lib = "$linkmode"; then + deplibs="$dir/$old_library $deplibs" + elif test prog,link = "$linkmode,$pass"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test prog = "$linkmode" && test link != "$pass"; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if $linkalldeplibs; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test prog,link = "$linkmode,$pass"; then + if test -n "$library_names" && + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then + # Make sure the rpath contains only unique directories. + case $temp_rpath: in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test built = "$use_static_libs" && test yes = "$installed"; then + use_static_libs=no + fi + if test -n "$library_names" && + { test no = "$use_static_libs" || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc* | *os2*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test no = "$installed"; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule= + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule=$dlpremoduletest + break + fi + done + if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then + echo + if test prog = "$linkmode"; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test lib = "$linkmode" && + test yes = "$hardcode_into_libs"; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname=$1 + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname=$dlname + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc* | *os2*) + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + esac + eval soname=\"$soname_spec\" + else + soname=$realname + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot=$soname + func_basename "$soroot" + soname=$func_basename_result + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from '$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for '$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test prog = "$linkmode" || test relink != "$opt_mode"; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test no = "$hardcode_direct"; then + add=$dir/$linklib + case $host in + *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; + *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir=-L$dir ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we cannot + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library"; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add=$dir/$old_library + fi + elif test -n "$old_library"; then + add=$dir/$old_library + fi + fi + esac + elif test no = "$hardcode_minus_L"; then + case $host in + *-*-sunos*) add_shlibpath=$dir ;; + esac + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + relink) + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$absdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test yes != "$lib_linked"; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test prog = "$linkmode"; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test prog = "$linkmode" || test relink = "$opt_mode"; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add=-l$name + elif test yes = "$hardcode_automatic"; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib"; then + add=$inst_prefix_dir$libdir/$linklib + else + add=$libdir/$linklib + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir=-L$libdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + fi + + if test prog = "$linkmode"; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test prog = "$linkmode"; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test unsupported != "$hardcode_direct"; then + test -n "$old_library" && linklib=$old_library + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test yes = "$build_libtool_libs"; then + # Not a shared library + if test pass_all != "$deplibs_check_method"; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system cannot link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test yes = "$module"; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test lib = "$linkmode"; then + if test -n "$dependency_libs" && + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs=$temp_deplibs + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test no != "$link_all_deplibs"; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path=$deplib ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of '$dir'" + absdir=$dir + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names"; then + for tmp in $deplibrary_names; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl"; then + depdepl=$absdir/$objdir/$depdepl + darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" + func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" + path= + fi + fi + ;; + *) + path=-L$absdir/$objdir + ;; + esac + else + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "'$deplib' seems to be moved" + + path=-L$absdir + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test link = "$pass"; then + if test prog = "$linkmode"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs=$newdependency_libs + if test dlpreopen = "$pass"; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test dlopen != "$pass"; then + test conv = "$pass" || { + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + } + + if test prog,link = "$linkmode,$pass"; then + vars="compile_deplibs finalize_deplibs" + else + vars=deplibs + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i= + ;; + esac + if test -n "$i"; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test prog = "$linkmode"; then + dlfiles=$newdlfiles + fi + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "'-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "'-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs=$output + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form 'libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" + + if test no != "$need_lib_prefix"; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test pass_all != "$deplibs_check_method"; then + func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" + + install_libdir=$1 + + oldlibs= + if test -z "$rpath"; then + if test yes = "$build_libtool_libs"; then + # Building a libtool convenience library. + # Some compilers have problems with a '.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "'-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs=$IFS; IFS=: + set dummy $vinfo 0 0 0 + shift + IFS=$save_ifs + + test -n "$7" && \ + func_fatal_help "too many parameters to '-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major=$1 + number_minor=$2 + number_revision=$3 + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # that has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|freebsd-elf|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_revision + ;; + freebsd-aout|qnx|sunos) + current=$number_major + revision=$number_minor + age=0 + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_minor + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type '$version_type'" + ;; + esac + ;; + no) + current=$1 + revision=$2 + age=$3 + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT '$current' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION '$revision' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE '$age' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE '$age' is greater than the current interface number '$current'" + func_fatal_error "'$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers + case $CC in + nagfor*) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac + ;; + + freebsd-aout) + major=.$current + versuffix=.$current.$revision + ;; + + freebsd-elf) + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + irix | nonstopux) + if test no = "$lt_irix_increment"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring=$verstring_prefix$major.$revision + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test 0 -ne "$loop"; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring_prefix$major.$iface:$verstring + done + + # Before this point, $major must not contain '.'. + major=.$major + versuffix=$major.$revision + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=.$current.$age.$revision + verstring=$current.$age.$revision + + # Add in all the interfaces that we are compatible with. + loop=$age + while test 0 -ne "$loop"; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring:$iface.0 + done + + # Make executables depend on our current version. + func_append verstring ":$current.0" + ;; + + qnx) + major=.$current + versuffix=.$current + ;; + + sco) + major=.$current + versuffix=.$current + ;; + + sunos) + major=.$current + versuffix=.$current.$revision + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 file systems. + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + + *) + func_fatal_configuration "unknown library version type '$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring=0.0 + ;; + esac + if test no = "$need_version"; then + versuffix= + else + versuffix=.0.0 + fi + fi + + # Remove version info from name if versioning should be avoided + if test yes,no = "$avoid_version,$need_version"; then + major= + versuffix= + verstring= + fi + + # Check to see if the archive will have undefined symbols. + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi + fi + else + # Don't allow undefined symbols. + allow_undefined_flag=$no_undefined_flag + fi + + fi + + func_generate_dlsyms "$libname" "$libname" : + func_append libobjs " $symfileobj" + test " " = "$libobjs" && libobjs= + + if test relink != "$opt_mode"; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) + if test -n "$precious_files_regex"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles=$dlfiles + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles=$dlprefiles + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test yes = "$build_libtool_libs"; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test yes = "$build_libtool_need_lc"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release= + versuffix= + major= + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib=$potent_lib + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib= + ;; + esac + fi + if test -n "$a_deplib"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib=$potent_lib # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs= + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + for i in $predeps $postdeps; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test none = "$deplibs_check_method"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test yes = "$droppeddeps"; then + if test yes = "$module"; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test no = "$allow_undefined"; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs=$new_libs + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test yes = "$hardcode_into_libs"; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath=$finalize_rpath + test relink = "$opt_mode" || rpath=$compile_rpath$rpath + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath=$finalize_shlibpath + test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname=$1 + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname=$realname + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib=$output_objdir/$realname + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols=$output_objdir/$libname.uexp + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + func_dll_def_p "$export_symbols" || { + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols=$export_symbols + export_symbols= + always_export_symbols=yes + } + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs=$IFS; IFS='~' + for cmd1 in $cmds; do + IFS=$save_ifs + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test yes = "$try_normal_branch" \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=$output_objdir/$output_la.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS=$save_ifs + if test -n "$export_symbols_regex" && test : != "$skipped_export"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test : != "$skipped_export" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs=$tmp_deplibs + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test yes = "$compiler_needs_object" && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test : != "$skipped_export" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test yes = "$compiler_needs_object"; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-$k.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test -z "$objlist" || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test 1 -eq "$k"; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-$k.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-$k.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + ${skipped_export-false} && { + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + } + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs=$IFS; IFS='~' + for cmd in $concat_cmds; do + IFS=$save_ifs + $opt_quiet || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + ${skipped_export-false} && { + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + } + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs=$IFS; IFS='~' + for cmd in $cmds; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + $opt_quiet || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test yes = "$module" || test yes = "$export_dynamic"; then + # On all known operating systems, these are identical. + dlname=$soname + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "'-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object '$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj=$output + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + else + gentop=$output_objdir/${obj}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test yes = "$build_libtool_libs" || libobjs=$non_pic_objects + + # Create the old-style object. + reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs + + output=$obj + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + test yes = "$build_libtool_libs" || { + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + } + + if test -n "$pic_flag" || test default != "$pic_mode"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output=$libobj + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "'-release' is ignored for programs" + + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test CXX = "$tagname"; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " $wl-bind_at_load" + func_append finalize_command " $wl-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs=$new_libs + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath=$rpath + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath=$rpath + + if test -n "$libobjs" && test yes = "$build_old_libs"; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" false + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=: + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=false + ;; + *cygwin* | *mingw* ) + test yes = "$build_libtool_libs" || wrappers_required=false + ;; + *) + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false + fi + ;; + esac + $wrappers_required || { + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command=$compile_command$compile_rpath + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.$objext"; then + func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' + fi + + exit $exit_status + } + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test yes = "$no_install"; then + # We don't need to create a wrapper script. + link_command=$compile_var$compile_command$compile_rpath + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + case $hardcode_action,$fast_install in + relink,*) + # Fast installation is not supported + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "'$output' will be relinked during installation" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource=$output_path/$objdir/lt-$output_name.c + cwrapper=$output_path/$output_name.exe + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host"; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience + build_libtool_libs=no + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) + oldobjs="$old_deplibs $non_pic_objects" + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac + + if test -n "$addlibs"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase=$func_basename_result + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj"; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test -z "$oldobjs"; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test yes = "$build_old_libs" && old_library=$libname.$libext + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test yes = "$hardcode_automatic"; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test yes = "$installed"; then + if test -z "$install_libdir"; then + break + fi + output=$output_objdir/${outputname}i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name=$func_basename_result + func_resolve_sysroot "$deplib" + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs=$newdependency_libs + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles=$newdlprefiles + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles=$newdlprefiles + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test -n "$bindir"; then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result/$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test no,yes = "$installed,$need_relink"; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $debug_cmd + + RM=$nonopt + files= + rmforce=false + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=: ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir=$func_dirname_result + if test . = "$dir"; then + odir=$objdir + else + odir=$dir/$objdir + fi + func_basename "$file" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir + + # Remember odir for removal later, being careful to avoid duplicates + if test clean = "$opt_mode"; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif $rmforce; then + continue + fi + + rmfiles=$file + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case $opt_mode in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && test none != "$pic_object"; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && test none != "$non_pic_object"; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test clean = "$opt_mode"; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.$objext" + if test yes = "$fast_install" && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the $objdir's in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi + +test -z "$opt_mode" && { + help=$generic_help + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode '$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# where we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 0000000..165d247 --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1,2 @@ +# This Makefile.am is in the public domain +EXTRA_DIST = libcurl.m4 diff --git a/m4/Makefile.in b/m4/Makefile.in new file mode 100644 index 0000000..40c4033 --- /dev/null +++ b/m4/Makefile.in @@ -0,0 +1,495 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +subdir = m4 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +EXTRA_DIST = libcurl.m4 +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu m4/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu m4/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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: diff --git a/m4/ax_append_compile_flags.m4 b/m4/ax_append_compile_flags.m4 new file mode 100644 index 0000000..5b6f1af --- /dev/null +++ b/m4/ax_append_compile_flags.m4 @@ -0,0 +1,67 @@ +# ============================================================================ +# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the compiler works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. During the check the flag is always added to the +# current language's flags. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and +# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with +# AX_APPEND_LINK_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AC_DEFUN([AX_APPEND_COMPILE_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) +done +])dnl AX_APPEND_COMPILE_FLAGS diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4 new file mode 100644 index 0000000..e8c5312 --- /dev/null +++ b/m4/ax_append_flag.m4 @@ -0,0 +1,71 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AC_DEFUN([AX_APPEND_FLAG], +[dnl +AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) +AS_VAR_SET_IF(FLAGS,[ + AS_CASE([" AS_VAR_GET(FLAGS) "], + [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], + [ + AS_VAR_APPEND(FLAGS,[" $1"]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) + ], + [ + AS_VAR_SET(FLAGS,[$1]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 new file mode 100644 index 0000000..dcabb92 --- /dev/null +++ b/m4/ax_check_compile_flag.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4 new file mode 100644 index 0000000..819409a --- /dev/null +++ b/m4/ax_check_link_flag.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the linker or gives an error. +# (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_LINK_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AC_DEFUN([AX_CHECK_LINK_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS $4 $1" + AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + LDFLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_LINK_FLAGS diff --git a/m4/ax_count_cpus.m4 b/m4/ax_count_cpus.m4 new file mode 100644 index 0000000..5db8925 --- /dev/null +++ b/m4/ax_count_cpus.m4 @@ -0,0 +1,101 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED]) +# +# DESCRIPTION +# +# Attempt to count the number of logical processor cores (including +# virtual and HT cores) currently available to use on the machine and +# place detected value in CPU_COUNT variable. +# +# On successful detection, ACTION-IF-DETECTED is executed if present. If +# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The +# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1. +# +# LICENSE +# +# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) +# Copyright (c) 2012 Brian Aker +# Copyright (c) 2008 Michael Paul Bailey +# Copyright (c) 2008 Christophe Tournayre +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 22 + + AC_DEFUN([AX_COUNT_CPUS],[dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_EGREP])dnl + AC_MSG_CHECKING([the number of available CPUs]) + CPU_COUNT="0" + + # Try generic methods + + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl + # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl + [[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl + )dnl + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl + # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl + [[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl + [[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl + [[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl + [[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl + )dnl + ])dnl + + AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl + AC_MSG_RESULT([[$CPU_COUNT]]) + m4_ifvaln([$1],[$1],)dnl + ],[dnl + m4_ifval([$2],[dnl + AS_UNSET([[CPU_COUNT]]) + AC_MSG_RESULT([[unable to detect]]) + $2 + ], [dnl + CPU_COUNT="1" + AC_MSG_RESULT([[unable to detect (assuming 1)]]) + ])dnl + ])dnl + ])dnl diff --git a/m4/ax_have_epoll.m4 b/m4/ax_have_epoll.m4 new file mode 100644 index 0000000..9d9bc87 --- /dev/null +++ b/m4/ax_have_epoll.m4 @@ -0,0 +1,104 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_have_epoll.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_HAVE_EPOLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# AX_HAVE_EPOLL_PWAIT([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# DESCRIPTION +# +# This macro determines whether the system supports the epoll I/O event +# interface. A neat usage example would be: +# +# AX_HAVE_EPOLL( +# [AX_CONFIG_FEATURE_ENABLE(epoll)], +# [AX_CONFIG_FEATURE_DISABLE(epoll)]) +# AX_CONFIG_FEATURE( +# [epoll], [This platform supports epoll(7)], +# [HAVE_EPOLL], [This platform supports epoll(7).]) +# +# The epoll interface was added to the Linux kernel in version 2.5.45, and +# the macro verifies that a kernel newer than this is installed. This +# check is somewhat unreliable if doesn't match the +# running kernel, but it is necessary regardless, because glibc comes with +# stubs for the epoll_create(), epoll_wait(), etc. that allow programs to +# compile and link even if the kernel is too old; the problem would then +# be detected only at runtime. +# +# Linux kernel version 2.6.19 adds the epoll_pwait() call in addition to +# epoll_wait(). The availability of that function can be tested with the +# second macro. Generally speaking, it is safe to assume that +# AX_HAVE_EPOLL would succeed if AX_HAVE_EPOLL_PWAIT has, but not the +# other way round. +# +# LICENSE +# +# Copyright (c) 2008 Peter Simons +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 11 + +AC_DEFUN([AX_HAVE_EPOLL], [dnl + ax_have_epoll_cppflags="${CPPFLAGS}" + AC_CHECK_HEADER([linux/version.h], [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"]) + AC_MSG_CHECKING([for Linux epoll(7) interface]) + AC_CACHE_VAL([ax_cv_have_epoll], [dnl + AC_LINK_IFELSE([dnl + AC_LANG_PROGRAM([dnl +#include +#ifdef HAVE_LINUX_VERSION_H +# include +# if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,45) +# error linux kernel version is too old to have epoll +# endif +#endif +], [dnl +int fd, rc; +struct epoll_event ev; +fd = epoll_create(128); +rc = epoll_wait(fd, &ev, 1, 0);])], + [ax_cv_have_epoll=yes], + [ax_cv_have_epoll=no])]) + CPPFLAGS="${ax_have_epoll_cppflags}" + AS_IF([test "${ax_cv_have_epoll}" = "yes"], + [AC_MSG_RESULT([yes]) +$1],[AC_MSG_RESULT([no]) +$2]) +])dnl + +AC_DEFUN([AX_HAVE_EPOLL_PWAIT], [dnl + ax_have_epoll_cppflags="${CPPFLAGS}" + AC_CHECK_HEADER([linux/version.h], + [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"]) + AC_MSG_CHECKING([for Linux epoll(7) interface with signals extension]) + AC_CACHE_VAL([ax_cv_have_epoll_pwait], [dnl + AC_LINK_IFELSE([dnl + AC_LANG_PROGRAM([dnl +#ifdef HAVE_LINUX_VERSION_H +# include +# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) +# error linux kernel version is too old to have epoll_pwait +# endif +#endif +#include +#include +], [dnl +int fd, rc; +struct epoll_event ev; +fd = epoll_create(128); +rc = epoll_wait(fd, &ev, 1, 0); +rc = epoll_pwait(fd, &ev, 1, 0, (sigset_t const *)(0));])], + [ax_cv_have_epoll_pwait=yes], + [ax_cv_have_epoll_pwait=no])]) + CPPFLAGS="${ax_have_epoll_cppflags}" + AS_IF([test "${ax_cv_have_epoll_pwait}" = "yes"], + [AC_MSG_RESULT([yes]) +$1],[AC_MSG_RESULT([no]) +$2]) +])dnl diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 new file mode 100644 index 0000000..5fbf9fe --- /dev/null +++ b/m4/ax_pthread.m4 @@ -0,0 +1,485 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also to link with them as well. For example, you might link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threaded programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to +# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# 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 3 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 24 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_SED]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) + AC_MSG_RESULT([$ax_pthread_ok]) + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], + [ +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + ], + [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) + ;; + + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; +esac + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +AS_IF([test "x$GCC" = "xyes"], + [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; + + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +AS_IF([test "x$ax_pthread_check_macro" = "x--"], + [ax_pthread_check_cond=0], + [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) + +# Are we compiling with Clang? + +AC_CACHE_CHECK([whether $CC is Clang], + [ax_cv_PTHREAD_CLANG], + [ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) + fi + ]) +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + +ax_pthread_clang_warning=no + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [ac_link="$ax_pthread_2step_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [break]) + ]) + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + ]) + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -mt,pthread) + AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + AC_MSG_RESULT([$ax_pthread_ok]) + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_CACHE_CHECK([for joinable pthread attribute], + [ax_cv_PTHREAD_JOINABLE_ATTR], + [ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $ax_pthread_attr; return attr /* ; */])], + [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], + []) + done + ]) + AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"], + [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], + [$ax_cv_PTHREAD_JOINABLE_ATTR], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + ax_pthread_joinable_attr_defined=yes + ]) + + AC_CACHE_CHECK([whether more special flags are required for pthreads], + [ax_cv_PTHREAD_SPECIAL_FLAGS], + [ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + ]) + AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"], + [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes]) + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + [ax_cv_PTHREAD_PRIO_INHERIT], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) + ax_pthread_prio_inherit_defined=yes + ]) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST([PTHREAD_LIBS]) +AC_SUBST([PTHREAD_CFLAGS]) +AC_SUBST([PTHREAD_CC]) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4 new file mode 100644 index 0000000..17c3eab --- /dev/null +++ b/m4/ax_require_defined.m4 @@ -0,0 +1,37 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_REQUIRE_DEFINED(MACRO) +# +# DESCRIPTION +# +# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have +# been defined and thus are available for use. This avoids random issues +# where a macro isn't expanded. Instead the configure script emits a +# non-fatal: +# +# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found +# +# It's like AC_REQUIRE except it doesn't expand the required macro. +# +# Here's an example: +# +# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +# +# LICENSE +# +# Copyright (c) 2014 Mike Frysinger +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([AX_REQUIRE_DEFINED], [dnl + m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) +])dnl AX_REQUIRE_DEFINED diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 new file mode 100644 index 0000000..53d694d --- /dev/null +++ b/m4/libcurl.m4 @@ -0,0 +1,272 @@ +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2006, David Shaw +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], +# [ACTION-IF-YES], [ACTION-IF-NO]) +# ---------------------------------------------------------- +# David Shaw May-09-2006 +# +# Checks for libcurl. DEFAULT-ACTION is the string yes or no to +# specify whether to default to --with-libcurl or --without-libcurl. +# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the +# minimum version of libcurl to accept. Pass the version as a regular +# version number like 7.10.1. If not supplied, any version is +# accepted. ACTION-IF-YES is a list of shell commands to run if +# libcurl was successfully found and passed the various tests. +# ACTION-IF-NO is a list of shell commands that are run otherwise. +# Note that using --without-libcurl does run ACTION-IF-NO. +# +# This macro #defines HAVE_LIBCURL if a working libcurl setup is +# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary +# values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are +# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy +# where yyy are the various protocols supported by libcurl. Both xxx +# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of +# the macro for the complete list of possible defines. Shell +# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also +# defined to 'yes' for those features and protocols that were found. +# Note that xxx and yyy keep the same capitalization as in the +# curl-config list (e.g. it's "HTTP" and not "http"). +# +# Users may override the detected values by doing something like: +# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure +# +# For the sake of sanity, this macro assumes that any libcurl that is +# found is after version 7.7.2, the first version that included the +# curl-config script. Note that it is very important for people +# packaging binary versions of libcurl to include this script! +# Without curl-config, we can only guess what protocols are available, +# or use curl_version_info to figure it out at runtime. + +AC_DEFUN([LIBCURL_CHECK_CONFIG], +[ + AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL]) + AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4]) + AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) + AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) + AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) + AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN]) + AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI]) + AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM]) + + AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) + AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) + AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) + AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) + AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) + AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3]) + AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP]) + + AC_ARG_WITH(libcurl, + AS_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), + [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) + + if test "$_libcurl_with" != "no" ; then + + AC_PROG_AWK + + _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'" + + _libcurl_try_link=yes + + if test -d "$_libcurl_with" ; then + LIBCURL_CPPFLAGS="-I$withval/include" + _libcurl_ldflags="-L$withval/lib" + AC_PATH_PROG([_libcurl_config],[curl-config],[], + ["$withval/bin"]) + else + AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH]) + fi + + if test x$_libcurl_config != "x" ; then + AC_CACHE_CHECK([for the version of libcurl], + [libcurl_cv_lib_curl_version], + [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) + + _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` + _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` + + if test $_libcurl_wanted -gt 0 ; then + AC_CACHE_CHECK([for libcurl >= version $2], + [libcurl_cv_lib_version_ok], + [ + if test $_libcurl_version -ge $_libcurl_wanted ; then + libcurl_cv_lib_version_ok=yes + else + libcurl_cv_lib_version_ok=no + fi + ]) + fi + + if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then + if test x"$LIBCURL_CPPFLAGS" = "x" ; then + LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` + fi + if test x"$LIBCURL" = "x" ; then + LIBCURL=`$_libcurl_config --libs` + + # This is so silly, but Apple actually has a bug in their + # curl-config script. Fixed in Tiger, but there are still + # lots of Panther installs around. + case "${host}" in + powerpc-apple-darwin7*) + LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` + ;; + esac + fi + + # All curl-config scripts support --feature + _libcurl_features=`$_libcurl_config --feature` + + # Is it modern enough to have --protocols? (7.12.4) + if test $_libcurl_version -ge 461828 ; then + _libcurl_protocols=`$_libcurl_config --protocols` + fi + else + _libcurl_try_link=no + fi + + unset _libcurl_wanted + fi + + if test $_libcurl_try_link = yes ; then + + # we didn't find curl-config, so let's see if the user-supplied + # link line (or failing that, "-lcurl") is enough. + LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} + + AC_CACHE_CHECK([whether libcurl is usable], + [libcurl_cv_lib_curl_usable], + [ + _libcurl_save_cppflags=$CPPFLAGS + CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" + _libcurl_save_libs=$LIBS + LIBS="$LIBCURL $LIBS" + + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[ +/* Try and use a few common options to force a failure if we are + missing symbols or can't link. */ +int x; +curl_easy_setopt(NULL,CURLOPT_URL,NULL); +x=CURL_ERROR_SIZE; +x=CURLOPT_WRITEFUNCTION; +x=CURLOPT_WRITEDATA; +x=CURLOPT_ERRORBUFFER; +x=CURLOPT_STDERR; +x=CURLOPT_VERBOSE; +if (x) {;} +]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) + + CPPFLAGS=$_libcurl_save_cppflags + LIBS=$_libcurl_save_libs + unset _libcurl_save_cppflags + unset _libcurl_save_libs + ]) + + if test $libcurl_cv_lib_curl_usable = yes ; then + + # Does curl_free() exist in this version of libcurl? + # If not, fake it with free() + + _libcurl_save_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" + _libcurl_save_libs=$LIBS + LIBS="$LIBS $LIBCURL" + + AC_CHECK_FUNC(curl_free,, + AC_DEFINE(curl_free,free, + [Define curl_free() as free() if our version of curl lacks curl_free.])) + + CPPFLAGS=$_libcurl_save_cppflags + LIBS=$_libcurl_save_libs + unset _libcurl_save_cppflags + unset _libcurl_save_libs + + AC_DEFINE(HAVE_LIBCURL,1, + [Define to 1 if you have a functional curl library.]) + AC_SUBST(LIBCURL_CPPFLAGS) + AC_SUBST(LIBCURL) + + for _libcurl_feature in $_libcurl_features ; do + AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) + eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes + done + + if test "x$_libcurl_protocols" = "x" ; then + + # We don't have --protocols, so just assume that all + # protocols are available + _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" + + if test x$libcurl_feature_SSL = xyes ; then + _libcurl_protocols="$_libcurl_protocols HTTPS" + + # FTPS wasn't standards-compliant until version + # 7.11.0 (0x070b00 == 461568) + if test $_libcurl_version -ge 461568; then + _libcurl_protocols="$_libcurl_protocols FTPS" + fi + fi + + # RTSP, IMAP, POP3 and SMTP were added in + # 7.20.0 (0x071400 == 463872) + if test $_libcurl_version -ge 463872; then + _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP" + fi + fi + + for _libcurl_protocol in $_libcurl_protocols ; do + AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) + eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes + done + else + unset LIBCURL + unset LIBCURL_CPPFLAGS + fi + fi + + unset _libcurl_try_link + unset _libcurl_version_parse + unset _libcurl_config + unset _libcurl_feature + unset _libcurl_features + unset _libcurl_protocol + unset _libcurl_protocols + unset _libcurl_version + unset _libcurl_ldflags + fi + + if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then + # This is the IF-NO path + ifelse([$4],,:,[$4]) + else + # This is the IF-YES path + ifelse([$3],,:,[$3]) + fi + + unset _libcurl_with +])dnl diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 new file mode 100644 index 0000000..d89fe11 --- /dev/null +++ b/m4/libgcrypt.m4 @@ -0,0 +1,143 @@ +# libgcrypt.m4 - Autoconf macros to detect libgcrypt +# Copyright (C) 2002, 2003, 2004, 2011, 2014 g10 Code GmbH +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file 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. +# +# Last-changed: 2014-10-02 + + +dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. +dnl MINIMUM-VERSION is a string with the version number optionalliy prefixed +dnl with the API version to also check the API compatibility. Example: +dnl a MINIMUM-VERSION of 1:1.2.5 won't pass the test unless the installed +dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using +dnl this feature prevents building against newer versions of libgcrypt +dnl with a changed API. +dnl +dnl If a prefix option is not used, the config script is first +dnl searched in $SYSROOT/bin and then along $PATH. If the used +dnl config script does not match the host specification the script +dnl is added to the gpg_config_script_warn variable. +dnl +AC_DEFUN([AM_PATH_LIBGCRYPT], +[ AC_REQUIRE([AC_CANONICAL_HOST]) + AC_ARG_WITH(libgcrypt-prefix, + AC_HELP_STRING([--with-libgcrypt-prefix=PFX], + [prefix where LIBGCRYPT is installed (optional)]), + libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") + if test x"${LIBGCRYPT_CONFIG}" = x ; then + if test x"${libgcrypt_config_prefix}" != x ; then + LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config" + else + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/libgcrypt-config" ; then + LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac + fi + fi + + AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no) + tmp=ifelse([$1], ,1:1.2.0,$1) + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` + else + req_libgcrypt_api=0 + min_libgcrypt_version="$tmp" + fi + + AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version) + ok=no + if test "$LIBGCRYPT_CONFIG" != "no" ; then + req_major=`echo $min_libgcrypt_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` + req_minor=`echo $min_libgcrypt_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` + req_micro=`echo $min_libgcrypt_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` + libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` + major=`echo $libgcrypt_config_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` + minor=`echo $libgcrypt_config_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` + micro=`echo $libgcrypt_config_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` + if test "$major" -gt "$req_major"; then + ok=yes + else + if test "$major" -eq "$req_major"; then + if test "$minor" -gt "$req_minor"; then + ok=yes + else + if test "$minor" -eq "$req_minor"; then + if test "$micro" -ge "$req_micro"; then + ok=yes + fi + fi + fi + fi + fi + fi + if test $ok = yes; then + AC_MSG_RESULT([yes ($libgcrypt_config_version)]) + else + AC_MSG_RESULT(no) + fi + if test $ok = yes; then + # If we have a recent libgcrypt, we should also check that the + # API is compatible + if test "$req_libgcrypt_api" -gt 0 ; then + tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` + if test "$tmp" -gt 0 ; then + AC_MSG_CHECKING([LIBGCRYPT API version]) + if test "$req_libgcrypt_api" -eq "$tmp" ; then + AC_MSG_RESULT([okay]) + else + ok=no + AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp]) + fi + fi + fi + fi + if test $ok = yes; then + LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` + LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` + ifelse([$2], , :, [$2]) + libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none` + if test x"$libgcrypt_config_host" != xnone ; then + if test x"$libgcrypt_config_host" != x"$host" ; then + AC_MSG_WARN([[ +*** +*** The config script $LIBGCRYPT_CONFIG was +*** built for $libgcrypt_config_host and thus may not match the +*** used host $host. +*** You may want to use the configure option --with-libgcrypt-prefix +*** to specify a matching config script or use \$SYSROOT. +***]]) + gpg_config_script_warn="$gpg_config_script_warn libgcrypt" + fi + fi + else + LIBGCRYPT_CFLAGS="" + LIBGCRYPT_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(LIBGCRYPT_CFLAGS) + AC_SUBST(LIBGCRYPT_LIBS) +]) diff --git a/m4/libtool.m4 b/m4/libtool.m4 new file mode 100644 index 0000000..ee80844 --- /dev/null +++ b/m4/libtool.m4 @@ -0,0 +1,8387 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# 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. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 2014 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. + +# GNU Libtool 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 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool 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, see . +]) + +# serial 58 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + +# _LT_CC_BASENAME(CC) +# ------------------- +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. +m4_defun([_LT_CC_BASENAME], +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl +m4_require([_LT_CMD_TRUNCATE])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from 'configure', and 'config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain=$ac_aux_dir/ltmain.sh +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the 'libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags='_LT_TAGS'dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# '#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test 0 = "$lt_write_fail" && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +_LT_COPYING +_LT_LIBTOOL_TAGS + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS=$save_LDFLAGS + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[[012]][[,.]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test yes = "$lt_cv_ld_force_load"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + m4_if([$1], [CXX], +[ if test yes != "$lt_cv_apple_cc_single_mod"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script that will find a shell with a builtin +# printf (that we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case $ECHO in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([$with_sysroot]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and where our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test yes = "[$]$2"; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS +]) + +if test yes = "[$]$2"; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n "$lt_cv_sys_max_cmd_len"; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes = "$cross_compiling"; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen=shl_load], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen=dlopen], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links=nottested +if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test no = "$hard_links"; then + AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", + [Define to the sub-directory where libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + + # We can hardcode non-existent directories. + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program that can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac]) +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program that can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + +# _LT_CHECK_MAGIC_METHOD +# ---------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_MAGIC_METHOD], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi]) +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM=-lm) + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test yes = "$GCC"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS=$save_LDFLAGS]) + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + _LT_TAGVAR(link_all_deplibs, $1)=no + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + osf3*) + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting $shlibpath_var if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC=$CC +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report what library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC=$lt_save_CC +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + + _LT_TAGVAR(GCC, $1)=$GXX + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)=$prev$p + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)=$p + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)=$p + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test no = "$F77"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_F77"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$G77 + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test no = "$FC"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_FC"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_FC" + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code=$lt_simple_compile_test_code + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f "$lt_ac_sed" && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test 10 -lt "$lt_ac_count" && break + lt_ac_count=`expr $lt_ac_count + 1` + if test "$lt_ac_count" -gt "$lt_ac_max"; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine what file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 new file mode 100644 index 0000000..94b0829 --- /dev/null +++ b/m4/ltoptions.m4 @@ -0,0 +1,437 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# 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 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option '$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl 'shared' nor 'disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the 'shared' and +# 'disable-shared' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the 'static' and +# 'disable-static' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the 'fast-install' +# and 'disable-fast-install' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# LT_INIT options. +# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [pic_mode=m4_default([$1], [default])]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 new file mode 100644 index 0000000..48bc934 --- /dev/null +++ b/m4/ltsugar.m4 @@ -0,0 +1,124 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# 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 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59, which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 new file mode 100644 index 0000000..fa04b52 --- /dev/null +++ b/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# 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. + +# @configure_input@ + +# serial 4179 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.6' +macro_revision='2.4.6' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 new file mode 100644 index 0000000..c6b26f8 --- /dev/null +++ b/m4/lt~obsolete.m4 @@ -0,0 +1,99 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# 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 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/m4/mhd_shutdown_socket_trigger.m4 b/m4/mhd_shutdown_socket_trigger.m4 new file mode 100644 index 0000000..12b88b7 --- /dev/null +++ b/m4/mhd_shutdown_socket_trigger.m4 @@ -0,0 +1,378 @@ +# SYNOPSIS +# +# MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER([ACTION-IF-TRIGGER], [ACTION-IF-NOT], +# [ACTION-IF-UNKNOWN]) +# +# DESCRIPTION +# +# Check whether shutdown of listen socket triggers waiting select(). +# If cross-compiling, result may be unknown (third action). +# Result is cached in $mhd_cv_host_shtdwn_trgr_select variable. +# +# LICENSE +# +# Copyright (c) 2017 Karlson2k (Evgeny Grin) +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER],[dnl + AC_PREREQ([2.64])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AX_PTHREAD])dnl + AC_CHECK_HEADERS([sys/time.h],[AC_CHECK_FUNCS([gettimeofday])],[], [AC_INCLUDES_DEFAULT]) + AC_CHECK_HEADERS([time.h],[AC_CHECK_FUNCS([[nanosleep]])],[], [AC_INCLUDES_DEFAULT]) + AC_CHECK_HEADERS([unistd.h],[AC_CHECK_FUNCS([usleep])],[], [AC_INCLUDES_DEFAULT]) + AC_CHECK_HEADERS([string.h sys/types.h sys/socket.h netinet/in.h time.h sys/select.h netinet/tcp.h],[],[], [AC_INCLUDES_DEFAULT]) + AC_CACHE_CHECK([[whether shutdown of listen socket trigger select()]], + [[mhd_cv_host_shtdwn_trgr_select]], [dnl + _MHD_OS_KNOWN_SOCKET_SHUTDOWN_TRIGGER([[mhd_cv_host_shtdwn_trgr_select]]) + AS_VAR_IF([mhd_cv_host_shtdwn_trgr_select], [["maybe"]], + [_MHD_RUN_CHECK_SOCKET_SHUTDOWN_TRIGGER([[mhd_cv_host_shtdwn_trgr_select]])]) + ] + ) + AS_IF([[test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"]], [$1], + [[test "x$mhd_cv_host_shtdwn_trgr_select" = "xno"]], [$2], [$3]) + ] +) + +# +# _MHD_OS_KNOWN_SOCKET_SHUTDOWN_TRIGGER(VAR) +# +# Sets VAR to 'yes', 'no' or 'maybe'. + +AC_DEFUN([_MHD_OS_KNOWN_SOCKET_SHUTDOWN_TRIGGER],[dnl +[#] On Linux shutdown of listen socket always trigger select(). +[#] On Windows select() always ignore shutdown of listen socket. +[#] On other paltforms result may vary depending on platform version. + AS_CASE([[$host_os]], + [[linux | linux-* | *-linux | *-linux-*]], [$1='yes'], + [[mingw*]], [$1='no'], + [[cygwin* | msys*]], [$1='no'], + [[winnt* | interix*]], [$1='no'], + [[mks]], [$1='no'], + [[uwin]], [$1='no'], + [$1='maybe'] + ) + ] +) + +# +# _MHD_RUN_CHECK_SOCKET_SHUTDOWN_TRIGGER(VAR) +# +# Sets VAR to 'yes', 'no' or 'guessing no'. + +AC_DEFUN([_MHD_RUN_CHECK_SOCKET_SHUTDOWN_TRIGGER],[dnl + AC_LANG_PUSH([C]) + MHD_CST_SAVE_CC="$CC" + MHD_CST_SAVE_CFLAGS="$CFLAGS" + MHD_CST_SAVE_LIBS="$LIBS" + CC="$PTHREAD_CC" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_TIME_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif + +#if !defined(_WIN32) || defined(__CYGWIN__) +# ifdef HAVE_SYS_TYPES_H +# include +# endif +# ifdef HAVE_SYS_SOCKET_H +# include +# endif +# ifdef HAVE_NETINET_IN_H +# include +# endif +# ifdef HAVE_SYS_TIME_H +# include +# endif +# ifdef HAVE_SYS_SELECT_H +# include +# endif +# ifdef HAVE_NETINET_TCP_H +# include +# endif + typedef int MHD_socket; +# define MHD_INVALID_SOCKET (-1) +# define MHD_POSIX_SOCKETS 1 +#else +# include +# include +# include + typedef SOCKET MHD_socket; +# define MHD_INVALID_SOCKET (INVALID_SOCKET) +# define MHD_WINSOCK_SOCKETS 1 +#endif + +#include + + #ifndef SHUT_RD +# define SHUT_RD 0 +#endif +#ifndef SHUT_WR +# define SHUT_WR 1 +#endif +#ifndef SHUT_RDWR +# define SHUT_RDWR 2 +#endif + +#ifndef NULL +# define NULL ((void*)0) +#endif + +#ifdef HAVE_GETTIMEOFDAY +# if defined(_WIN32) && !defined(__CYGWIN__) +# undef HAVE_GETTIMEOFDAY +# endif +#endif + + +#ifdef HAVE_NANOSLEEP +static const struct timespec sm_tmout = {0, 1000}; +# define short_sleep() nanosleep(&sm_tmout, NULL) +#elif defined(HAVE_USLEEP) +# define short_sleep() usleep(1) +#else +# define short_sleep() (void)0 +#endif + +static volatile int going_select = 0; +static volatile int select_ends = 0; +static volatile int gerror = 0; +static int timeout_mils; + +#ifndef HAVE_GETTIMEOFDAY +static volatile long long select_elapsed_time = 0; + +static long long time_chk(void) +{ + long long ret = time(NULL); + if (-1 == ret) + gerror = 4; + return ret; +} +#endif + + +static void* select_thrd_func(void* param) +{ +#ifndef HAVE_GETTIMEOFDAY + long long start, stop; +#endif + fd_set rs; + struct timeval tmot = {0, 0}; + MHD_socket fd = *((MHD_socket*)param); + + FD_ZERO(&rs); + FD_SET(fd, &rs); + tmot.tv_usec = timeout_mils * 1000; +#ifndef HAVE_GETTIMEOFDAY + start = time_chk(); +#endif + going_select = 1; + if (0 > select ((int)(fd) + 1, &rs, NULL, NULL, &tmot)) + gerror = 5; +#ifndef HAVE_GETTIMEOFDAY + stop = time_chk(); + select_elapsed_time = stop - start; +#endif + select_ends = 1; + return NULL; +} + + +static MHD_socket create_socket(void) +{ return socket (AF_INET, SOCK_STREAM, 0); } + +static void close_socket(MHD_socket fd) +{ +#ifdef MHD_POSIX_SOCKETS + close(fd); +#else + closesocket(fd); +#endif +} + +static MHD_socket +create_socket_listen(int port) +{ + MHD_socket fd; + struct sockaddr_in sock_addr; + fd = create_socket(); + if (MHD_INVALID_SOCKET == fd) + return fd; + + memset (&sock_addr, 0, sizeof (struct sockaddr_in)); + sock_addr.sin_family = AF_INET; + sock_addr.sin_port = htons(port); + sock_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + + if (bind (fd, (const struct sockaddr*) &sock_addr, sizeof(sock_addr)) < 0 || + listen(fd, SOMAXCONN) < 0) + { + close_socket(fd); + return MHD_INVALID_SOCKET; + } + return fd; +} + +#ifdef HAVE_GETTIMEOFDAY +#define diff_time(tv1, tv2) ((long long)(tv1.tv_sec-tv2.tv_sec)*10000 + (long long)(tv1.tv_usec-tv2.tv_usec)/100) +#else +#define diff_time(tv1, tv2) ((long long)(tv1-tv2)) +#endif + +static long long test_run_select(int timeout_millsec, int use_shutdown, long long delay_before_shutdown) +{ + pthread_t select_thrd; + MHD_socket fd; +#ifdef HAVE_GETTIMEOFDAY + struct timeval start, stop; +#else + long long start; +#endif + + fd = create_socket_listen(0); + if (MHD_INVALID_SOCKET == fd) + return -7; + going_select = 0; + select_ends = 0; + gerror = 0; + timeout_mils = timeout_millsec; + if (0 != pthread_create (&select_thrd, NULL, select_thrd_func, (void*)&fd)) + return -8; + while (!going_select) {short_sleep();} +#ifdef HAVE_GETTIMEOFDAY + gettimeofday (&start, NULL); +#else + start = time_chk(); +#endif + if (use_shutdown) + { +#ifdef HAVE_GETTIMEOFDAY + struct timeval current; + do {short_sleep(); gettimeofday(¤t, NULL); } while (delay_before_shutdown > diff_time(current, start)); +#else + while (delay_before_shutdown > time_chk() - start) {short_sleep();} +#endif + shutdown(fd, SHUT_RDWR); + } +#ifdef HAVE_GETTIMEOFDAY + while (!select_ends) {short_sleep();} + gettimeofday (&stop, NULL); +#endif + if (0 != pthread_join(select_thrd, NULL)) + return -9; + close_socket(fd); + if (gerror) + return -10; +#ifdef HAVE_GETTIMEOFDAY + return (long long)diff_time(stop, start); +#else + return select_elapsed_time; +#endif +} + +static int test_it(void) +{ + long long duration2; +#ifdef HAVE_GETTIMEOFDAY + long long duration0, duration1; + duration0 = test_run_select(0, 0, 0); + if (0 > duration0) + return -duration0; + + duration1 = test_run_select(50, 0, 0); + if (0 > duration1) + return -duration1 + 20; + + duration2 = test_run_select(500, 1, (duration0 + duration1) / 2); + if (0 > duration2) + return -duration2 + 40; + + if (duration1 * 2 > duration2) + { /* Check second time to be sure. */ + duration2 = test_run_select(500, 1, (duration0 + duration1) / 2); + if (0 > duration2) + return -duration2 + 60; + if (duration1 * 2 > duration2) + return 0; + } +#else + duration2 = test_run_select(5000, 1, 2); + if (0 > duration2) + return -duration2 + 80; + + if (4 > duration2) + { /* Check second time to be sure. */ + duration2 = test_run_select(5000, 1, 2); + if (0 > duration2) + return -duration2 + 100; + if (4 > duration2) + return 0; + } +#endif + return 1; +} + + +static int init(void) +{ +#ifdef MHD_WINSOCK_SOCKETS + WSADATA wsa_data; + + if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion) + { + WSACleanup(); + return 0; + } +#endif /* MHD_WINSOCK_SOCKETS */ + return 1; +} + +static void cleanup(void) +{ +#ifdef MHD_WINSOCK_SOCKETS + WSACleanup(); +#endif /* MHD_WINSOCK_SOCKETS */ +} + +int main(void) +{ + int res; + if (!init()) + return 19; + + res = test_it(); + + cleanup(); + if (gerror) + return gerror; + + return res; +} +]])], [$1='yes'], [$1='no'], [$1='guessing no']) + CC="$MHD_CST_SAVE_CC" + CFLAGS="$MHD_CST_SAVE_CFLAGS" + LIBS="$MHD_CST_SAVE_LIBS" + AS_UNSET([[MHD_CST_SAVE_CC]]) + AS_UNSET([[MHD_CST_SAVE_CFLAGS]]) + AS_UNSET([[MHD_CST_SAVE_LIBS]]) + AC_LANG_POP([C]) + ] +) diff --git a/m4/mhd_sys_extentions.m4 b/m4/mhd_sys_extentions.m4 new file mode 100644 index 0000000..51b8aec --- /dev/null +++ b/m4/mhd_sys_extentions.m4 @@ -0,0 +1,1324 @@ +# SYNOPSIS +# +# MHD_SYS_EXT([VAR-ADD-CPPFLAGS]) +# +# DESCRIPTION +# +# This macro checks system headers and add defines that enable maximum +# number of exposed system interfaces. Macro verifies that added defines +# will not break basic headers, some defines are also checked against +# real recognition by headers. +# If VAR-ADD-CPPFLAGS is specified, defines will be added to this variable +# in form suitable for CPPFLAGS. Otherwise defines will be added to +# configuration header (usually 'config.h'). +# +# Example usage: +# +# MHD_SYS_EXT +# +# or +# +# MHD_SYS_EXT([CPPFLAGS]) +# +# Macro is not enforced to be called before AC_COMPILE_IFELSE, but it +# advisable to call macro before any compile and header tests since +# additional defines can change results of those tests. +# +# Defined in command line macros are always honored and cache variables +# used in all checks so if any test will not work correctly on some +# platform, user may simply fix it by giving correct defines in CPPFLAGS +# or by giving cache variable in configure parameters, for example: +# +# ./configure CPPFLAGS='-D_XOPEN_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED' +# +# or +# +# ./configure mhd_cv_define__xopen_source_sevenh_works=no +# +# This simplify building from source on exotic platforms as patching +# of configure.ac is not required to change results of tests. +# +# LICENSE +# +# Copyright (c) 2016, 2017 Karlson2k (Evgeny Grin) +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([MHD_SYS_EXT],[dnl + AC_PREREQ([2.64])dnl for AS_VAR_IF, AS_VAR_SET_IF, m4_ifnblank + AC_LANG_PUSH([C])dnl Use C language for simplicity + mhd_mse_sys_ext_defines="" + mhd_mse_sys_ext_flags="" + + dnl Check platform-specific extensions. + dnl Use compiler-based test for determinig target. + + dnl Always add _GNU_SOURCE if headers allow. + MHD_CHECK_DEF_AND_ACCEPT([[_GNU_SOURCE]], [], + [[${mhd_mse_sys_ext_defines}]], [mhd_cv_macro_add__gnu_source="no"], + [mhd_cv_macro_add__gnu_source="yes"], + [mhd_cv_macro_add__gnu_source="no"] + ) + AS_VAR_IF([mhd_cv_macro_add__gnu_source], ["yes"], + [ + _MHD_SYS_EXT_VAR_ADD_FLAG([[mhd_mse_sys_ext_defines]], [[mhd_mse_sys_ext_flags]], [[_GNU_SOURCE]]) + ] + ) + + dnl __BSD_VISIBLE is actually a small hack for FreeBSD. + dnl Funny that it's used in some Android versions too. + AC_CACHE_CHECK([[whether to try __BSD_VISIBLE macro]], + [[mhd_cv_macro_try___bsd_visible]], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +/* Warning: test with inverted logic! */ +#ifdef __FreeBSD__ +#error Target FreeBSD +choke me now; +#endif /* __FreeBSD__ */ + +#ifdef __ANDROID__ +#include +#ifndef __ANDROID_API_O__ +#error Target is Android NDK before R14 +choke me now; +#endif /* ! __ANDROID_API_O__ */ +#endif /* __ANDROID__ */ + ]],[])], + [[mhd_cv_macro_try___bsd_visible="no"]], + [[mhd_cv_macro_try___bsd_visible="yes"]] + ) + ]) + AS_VAR_IF([[mhd_cv_macro_try___bsd_visible]], [["yes"]], + [dnl + AC_CACHE_CHECK([[whether __BSD_VISIBLE is already defined]], + [[mhd_cv_macro___bsd_visible_defined]], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +${mhd_mse_sys_ext_defines} +/* Warning: test with inverted logic! */ +#ifdef __BSD_VISIBLE +#error __BSD_VISIBLE is defined +choke me now; +#endif + ]],[]) + ], + [[mhd_cv_macro___bsd_visible_defined="no"]], + [[mhd_cv_macro___bsd_visible_defined="yes"]] + ) + ]) + AS_VAR_IF([[mhd_cv_macro___bsd_visible_defined]], [["yes"]], [[:]], + [dnl + MHD_CHECK_ACCEPT_DEFINE( + [[__BSD_VISIBLE]], [], [[${mhd_mse_sys_ext_defines}]], + [ + _MHD_SYS_EXT_VAR_ADD_FLAG([[mhd_mse_sys_ext_defines]], [[mhd_mse_sys_ext_flags]], [[__BSD_VISIBLE]]) + ] + )dnl + ]) + ]) + + + dnl _DARWIN_C_SOURCE enables additional functionality on Darwin. + MHD_CHECK_DEFINED_MSG([[__APPLE__]], [[${mhd_mse_sys_ext_defines}]], + [[whether to try _DARWIN_C_SOURCE macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_DARWIN_C_SOURCE]], [], [[${mhd_mse_sys_ext_defines}]], [], + [ + _MHD_SYS_EXT_VAR_ADD_FLAG([[mhd_mse_sys_ext_defines]], [[mhd_mse_sys_ext_flags]], [[_DARWIN_C_SOURCE]]) + ] + )dnl + ]) + + dnl __EXTENSIONS__ unlocks almost all interfaces on Solaris. + MHD_CHECK_DEFINED_MSG([[__sun]], [[${mhd_mse_sys_ext_defines}]], + [[whether to try __EXTENSIONS__ macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[__EXTENSIONS__]], [], [[${mhd_mse_sys_ext_defines}]], [], + [ + _MHD_SYS_EXT_VAR_ADD_FLAG([[mhd_mse_sys_ext_defines]], [[mhd_mse_sys_ext_flags]], [[__EXTENSIONS__]]) + ] + )dnl + ]) + + dnl _NETBSD_SOURCE switch on almost all headers definitions on NetBSD. + MHD_CHECK_DEFINED_MSG([[__NetBSD__]], [[${mhd_mse_sys_ext_defines}]], + [[whether to try _NETBSD_SOURCE macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_NETBSD_SOURCE]], [], [[${mhd_mse_sys_ext_defines}]], [], + [ + _MHD_SYS_EXT_VAR_ADD_FLAG([[mhd_mse_sys_ext_defines]], [[mhd_mse_sys_ext_flags]], [[_NETBSD_SOURCE]]) + ] + )dnl + ]) + + dnl _BSD_SOURCE currently used only on OpenBSD to unhide functions. + MHD_CHECK_DEFINED_MSG([[__OpenBSD__]], [[${mhd_mse_sys_ext_defines}]], + [[whether to try _BSD_SOURCE macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_BSD_SOURCE]], [], [[${mhd_mse_sys_ext_defines}]], [], + [ + _MHD_SYS_EXT_VAR_ADD_FLAG([[mhd_mse_sys_ext_defines]], [[mhd_mse_sys_ext_flags]], [[_BSD_SOURCE]]) + ] + )dnl + ]) + + dnl _TANDEM_SOURCE unhides most functions on NonStop OS + dnl (which comes from Tandem Computers decades ago). + MHD_CHECK_DEFINED_MSG([[__TANDEM]], [[${mhd_mse_sys_ext_defines}]], + [[whether to try _TANDEM_SOURCE macro]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_TANDEM_SOURCE]], [], [[${mhd_mse_sys_ext_defines}]], [], + [ + _MHD_SYS_EXT_VAR_ADD_FLAG([[mhd_mse_sys_ext_defines]], [[mhd_mse_sys_ext_flags]], [[_TANDEM_SOURCE]]) + ] + )dnl + ]) + + dnl _ALL_SOURCE makes visible POSIX and non-POSIX symbols + dnl on z/OS, AIX and Interix. + AC_CACHE_CHECK([[whether to try _ALL_SOURCE macro]], + [[mhd_cv_macro_try__all_source]], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if !defined(__TOS_MVS__) && !defined (__INTERIX) +#error Target is not z/OS, AIX or Interix +choke me now; +#endif + ]],[])], + [[mhd_cv_macro_try__all_source="yes"]], + [[mhd_cv_macro_try__all_source="no"]] + ) + ]) + AS_VAR_IF([[mhd_cv_macro_try__all_source]], [["yes"]], + [dnl + MHD_CHECK_DEF_AND_ACCEPT( + [[_ALL_SOURCE]], [], [[${mhd_mse_sys_ext_defines}]], [], + [ + _MHD_SYS_EXT_VAR_ADD_FLAG([[mhd_mse_sys_ext_defines]], [[mhd_mse_sys_ext_flags]], [[_ALL_SOURCE]]) + ] + )dnl + ]) + + mhd_mse_xopen_features="" + mhd_mse_xopen_defines="" + mhd_mse_xopen_flags="" + + AC_CACHE_CHECK([[whether _XOPEN_SOURCE is already defined]], + [[mhd_cv_macro__xopen_source_defined]], [ + _MHD_CHECK_DEFINED([[_XOPEN_SOURCE]], [[${mhd_mse_sys_ext_defines}]], + [[mhd_cv_macro__xopen_source_defined="yes"]], + [[mhd_cv_macro__xopen_source_defined="no"]] + ) + ] + ) + AS_VAR_IF([[mhd_cv_macro__xopen_source_defined]], [["no"]], + [ + dnl Some platforms (namely: Solaris) use '==' checks instead of '>=' + dnl for _XOPEN_SOURCE, resulting that unknown for platform values are + dnl interpreted as oldest and platform expose reduced number of + dnl interfaces. Next checks will ensure that platform recognise + dnl requested mode instead of blindly define high number that can + dnl be simply ignored by platform. + _MHD_CHECK_POSIX2008([[mhd_mse_xopen_defines]], + [[mhd_mse_xopen_flags]], + [[${mhd_mse_sys_ext_defines}]], + [mhd_mse_xopen_features="${mhd_cv_headers_posix2008}"], + [ + _MHD_CHECK_POSIX2001([[mhd_mse_xopen_defines]], + [[mhd_mse_xopen_flags]], + [[${mhd_mse_sys_ext_defines}]], + [mhd_mse_xopen_features="${mhd_cv_headers_posix2001}"], + [ + _MHD_CHECK_SUSV2([[mhd_mse_xopen_defines]], + [[mhd_mse_xopen_flags]], + [[${mhd_mse_sys_ext_defines}]], + [mhd_mse_xopen_features="${mhd_cv_headers_susv2}"], + [mhd_mse_xopen_features="${mhd_cv_headers_susv2}"] + ) + ] + ) + ] + ) + ] + ) + + AS_IF([[test "x${mhd_cv_macro__xopen_source_defined}" = "xno" && \ + test "x${mhd_cv_macro__xopen_source_def_fiveh}" = "xno" || \ + test "x${mhd_mse_xopen_features}" = "xnot available" ]], + [ + _MHD_XOPEN_VAR_ADD([mhd_mse_xopen_defines], [mhd_mse_xopen_flags], [${mhd_mse_sys_ext_defines}]) + ] + ) + + mhd_mse_sys_features_src=" +#ifdef __APPLE__ +#include +#else +#error No useful system features. +choke me now; +#endif + +int main() +{ +#ifdef __APPLE__ +#ifndef sendfile + (void) sendfile; +#endif +#endif + return 0; +} +" + AC_CACHE_CHECK([[for useful system-specific features]], + [[mhd_cv_headers_useful_features_present]], [dnl + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +${mhd_mse_sys_ext_defines} +${mhd_mse_sys_features_src} + ]])], + [[mhd_cv_headers_useful_features_present="yes"]], + [[mhd_cv_headers_useful_features_present="no"]] + )dnl + ]) + AS_VAR_IF([[mhd_cv_headers_useful_features_present]], [["yes"]], + [ + AS_IF([[test "x${mhd_mse_xopen_flags}" = "x"]], [[:]], + [ + AC_CACHE_CHECK([[whether useful system-specific features works with ${mhd_mse_xopen_flags}]], + [[mhd_cv_headers_useful_features_works_xopen]], [dnl + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +${mhd_mse_sys_ext_defines} +${mhd_mse_xopen_defines} +${mhd_mse_sys_features_src} + ]])], + [[mhd_cv_headers_useful_features_works_xopen="yes"]], + [[mhd_cv_headers_useful_features_works_xopen="no"]] + )dnl + ])dnl + ] + )dnl + ] + ) + + + AS_IF([[test "x${mhd_cv_headers_useful_features_present}" = "xyes" && \ + test "x${mhd_cv_headers_useful_features_works_xopen}" = "xno" && \ + test "x${mhd_mse_xopen_flags}" != "x"]], + [ + _MHD_VAR_CONTAIN([[mhd_mse_xopen_features]], [[, activated by _XOPEN_SOURCE]], + [ + AC_MSG_WARN([[_XOPEN_SOURCE macro is required to activate all headers symbols, however some useful system-specific features does not work with _XOPEN_SOURCE. ]dnl + [_XOPEN_SOURCE macro will not be used.]]) + ] + ) + AS_UNSET([[mhd_mse_xopen_defines]]) + AS_UNSET([[mhd_mse_xopen_flags]]) + AS_UNSET([[mhd_mse_xopen_values]]) + ] + ) + + dnl Discard temporal source variables + AS_UNSET([[mhd_mse_sys_features_src]]) + AS_UNSET([[mhd_mse_xopen_defines]]) + AS_UNSET([[mhd_mse_sys_ext_defines]]) + + dnl Determined all required defines. + AC_MSG_CHECKING([[for final set of defined symbols]]) + m4_ifblank([$1], [dnl + AH_TEMPLATE([[_XOPEN_SOURCE]], [Define to maximum value supported by system headers])dnl + AH_TEMPLATE([[_XOPEN_SOURCE_EXTENDED]], [Define to 1 if _XOPEN_SOURCE is defined to value less than 500 ]dnl + [and system headers requre this symbol])dnl + AH_TEMPLATE([[_XOPEN_VERSION]], [Define to maximum value supported by system headers if _XOPEN_SOURCE ]dnl + [is defined to value less than 500 and headers do not support _XOPEN_SOURCE_EXTENDED])dnl + AH_TEMPLATE([[_GNU_SOURCE]], [Define to 1 to enable GNU-related header features])dnl + AH_TEMPLATE([[__BSD_VISIBLE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_DARWIN_C_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[__EXTENSIONS__]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_NETBSD_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_BSD_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_TANDEM_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + AH_TEMPLATE([[_ALL_SOURCE]], [Define to 1 if it is required by headers to expose additional symbols])dnl + ]) + for mhd_mse_Flag in ${mhd_mse_sys_ext_flags} ${mhd_mse_xopen_flags} + do + m4_ifnblank([$1], [dnl + AS_VAR_APPEND([$1],[[" -D$mhd_mse_Flag"]]) + ], [dnl + AS_CASE([[$mhd_mse_Flag]], [[*=*]], + [dnl + AC_DEFINE_UNQUOTED([[`echo $mhd_mse_Flag | cut -f 1 -d =`]], + [[`echo $mhd_mse_Flag | cut -f 2 -d = -s`]]) + ], [dnl + AC_DEFINE_UNQUOTED([[$mhd_mse_Flag]]) + ]) + ]) + done + AS_UNSET([[mhd_mse_Flag]]) + dnl Trim whitespaces + mhd_mse_result=`echo ${mhd_mse_sys_ext_flags} ${mhd_mse_xopen_flags}` + AC_MSG_RESULT([[${mhd_mse_result}]]) + AS_UNSET([[mhd_mse_result]]) + AS_UNSET([[mhd_mse_xopen_flags]]) + AS_UNSET([[mhd_mse_sys_ext_flags]]) + AC_LANG_POP([C]) +]) + + +# +# _MHD_SYS_EXT_VAR_ADD_FLAG(DEFINES_VAR, FLAGS_VAR, +# FLAG, [FLAG-VALUE = 1]) +# +# Internal macro, only to be used from MHD_SYS_EXT, _MHD_XOPEN_VAR_ADD + +m4_define([_MHD_SYS_EXT_VAR_ADD_FLAG], [dnl + m4_ifnblank([$4],[dnl + ]m4_normalize([$1])[="[$]{]m4_normalize([$1])[}[#define ]m4_normalize($3) ]m4_normalize([$4])[ +" + AS_IF([test "x[$]{]m4_normalize([$2])[}" = "x"], + []m4_normalize([$2])[="]m4_normalize([$3])[=]m4_normalize([$4])["], + []m4_normalize([$2])[="[$]{]m4_normalize([$2])[} ]m4_normalize([$3])[=]m4_normalize([$4])["] + )dnl + ], [dnl + ]m4_normalize([$1])[="[$]{]m4_normalize([$1])[}[#define ]m4_normalize($3) 1 +" + AS_IF([test "x[$]{]m4_normalize([$2])[}" = "x"], + []m4_normalize([$2])[="]m4_normalize([$3])["], + []m4_normalize([$2])[="[$]{]m4_normalize([$2])[} ]m4_normalize([$3])["] + )dnl + ])dnl +]) + +# +# _MHD_VAR_IF(VAR, VALUE, [IF-EQ], [IF-NOT-EQ]) +# +# Same as AS_VAR_IF, except that it expands to nothing if +# both IF-EQ and IF-NOT-EQ are empty. + +m4_define([_MHD_VAR_IF],[dnl +m4_ifnblank([$3$4],[dnl +AS_VAR_IF([$1],[$2],[$3],[$4])])]) + +# +# _MHD_STRING_CONTAIN(VAR, MATCH, [IF-MATCH], [IF-NOT-MATCH]) +# + +AC_DEFUN([_MHD_VAR_CONTAIN],[dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +AS_IF([[`echo "${]$1[}" | $FGREP ']$2[' >/dev/null 2>&1`]], [$3], [$4]) +]) + +# +# _MHD_STRING_CONTAIN_BRE(VAR, BRE, [IF-MATCH], [IF-NOT-MATCH]) +# + +AC_DEFUN([_MHD_VAR_CONTAIN_BRE],[dnl +AC_REQUIRE([AC_PROG_GREP])dnl +AS_IF([[`echo "${]$1[}" | $GREP ']$2[' >/dev/null 2>&1`]], [$3], [$4]) +]) + +# SYNOPSIS +# +# _MHD_CHECK_POSIX2008(DEFINES_VAR, FLAGS_VAR, +# [EXT_DEFINES], +# [ACTION-IF-AVAILABLE], +# [ACTION-IF-NOT-AVAILABLE]) +# +# +AC_DEFUN([_MHD_CHECK_POSIX2008], [dnl + AC_CACHE_CHECK([headers for POSIX.1-2008/SUSv4 features], + [[mhd_cv_headers_posix2008]], [dnl + _MHD_CHECK_POSIX_FEATURES_SINGLE([ +_MHD_BASIC_INCLUDES +[ +/* Check will be passed if ALL features are avalable + * and failed if ANY feature is not avalable. */ +int main() +{ + +#ifndef stpncpy + (void) stpncpy; +#endif +#ifndef strnlen + (void) strnlen; +#endif + +#if !defined(__NetBSD__) && !defined(__OpenBSD__) +/* NetBSD and OpenBSD didn't implement wcsnlen() for some reason. */ +#ifndef wcsnlen + (void) wcsnlen; +#endif +#endif + +#ifdef __CYGWIN__ +/* The only depend function on Cygwin, but missing on some other platforms */ +#ifndef strndup + (void) strndup; +#endif +#endif + +#ifndef __sun +/* illumos forget to uncomment some _XPG7 macros. */ +#ifndef renameat + (void) renameat; +#endif + +#ifndef getline + (void) getline; +#endif +#endif /* ! __sun */ + +/* gmtime_r() becomes mandatory only in POSIX.1-2008. */ +#ifndef gmtime_r + (void) gmtime_r; +#endif + +/* unsetenv() actually defined in POSIX.1-2001 so it + * must be present with _XOPEN_SOURCE == 700 too. */ +#ifndef unsetenv + (void) unsetenv; +#endif + + return 0; +} + ]], + [$3], [[700]], + [[mhd_cv_headers_posix2008]]dnl + ) + ] + ) + _MHD_VAR_CONTAIN_BRE([[mhd_cv_headers_posix2008]], [[^available]], + [ + _MHD_VAR_CONTAIN([[mhd_cv_headers_posix2008]], [[does not work with _XOPEN_SOURCE]], [[:]], + [_MHD_SYS_EXT_VAR_ADD_FLAG([$1],[$2],[[_XOPEN_SOURCE]],[[700]])] + ) + $4 + ], + [$5] + ) +]) + + +# SYNOPSIS +# +# _MHD_CHECK_POSIX2001(DEFINES_VAR, FLAGS_VAR, +# [EXT_DEFINES], +# [ACTION-IF-AVAILABLE], +# [ACTION-IF-NOT-AVAILABLE]) +# +# +AC_DEFUN([_MHD_CHECK_POSIX2001], [dnl + AC_CACHE_CHECK([headers for POSIX.1-2001/SUSv3 features], + [[mhd_cv_headers_posix2001]], [ + _MHD_CHECK_POSIX_FEATURES_SINGLE([ +_MHD_BASIC_INCLUDES +[ +/* Check will be passed if ALL features are available + * and failed if ANY feature is not available. */ +int main() +{ + +#ifndef setenv + (void) setenv; +#endif + +#ifndef __NetBSD__ +#ifndef vsscanf + (void) vsscanf; +#endif +#endif + +/* Availability of next features varies, but they all must be present + * on platform with support for _XOPEN_SOURCE = 600. */ + +/* vsnprintf() should be available with _XOPEN_SOURCE >= 500, but some platforms + * provide it only with _POSIX_C_SOURCE >= 200112 (autodefined when + * _XOPEN_SOURCE >= 600) where specification of vsnprintf() is aligned with + * ISO C99 while others platforms defined it with even earlier standards. */ +#ifndef vsnprintf + (void) vsnprintf; +#endif + +/* On platforms that prefer POSIX over X/Open, fseeko() is available + * with _POSIX_C_SOURCE >= 200112 (autodefined when _XOPEN_SOURCE >= 600). + * On other platforms it should be available with _XOPEN_SOURCE >= 500. */ +#ifndef fseeko + (void) fseeko; +#endif + +/* F_GETOWN must be defined with _XOPEN_SOURCE >= 600, but some platforms + * define it with _XOPEN_SOURCE >= 500. */ +#ifndef F_GETOWN +#error F_GETOWN is not defined +choke me now; +#endif + return 0; +} + ]], + [$3],[[600]],[[mhd_cv_headers_posix2001]]dnl + ) + ] + ) + _MHD_VAR_CONTAIN_BRE([[mhd_cv_headers_posix2001]], [[^available]], + [ + _MHD_VAR_CONTAIN([[mhd_cv_headers_posix2001]], [[does not work with _XOPEN_SOURCE]], [[:]], + [_MHD_SYS_EXT_VAR_ADD_FLAG([$1],[$2],[[_XOPEN_SOURCE]],[[600]])] + ) + $4 + ], + [$5] + ) +]) + + +# SYNOPSIS +# +# _MHD_CHECK_SUSV2(DEFINES_VAR, FLAGS_VAR, +# [EXT_DEFINES], +# [ACTION-IF-AVAILABLE], +# [ACTION-IF-NOT-AVAILABLE]) +# +# +AC_DEFUN([_MHD_CHECK_SUSV2], [dnl + AC_CACHE_CHECK([headers for SUSv2/XPG5 features], + [[mhd_cv_headers_susv2]], [ + _MHD_CHECK_POSIX_FEATURES_SINGLE([ +_MHD_BASIC_INCLUDES +[ +/* Check will be passed if ALL features are available + * and failed if ANY feature is not available. */ +int main() +{ +/* It's not easy to write reliable test for _XOPEN_SOURCE = 500 as + * platforms not always precisely follow this standard and some + * functions are already deprecated in later standards. */ + +/* Availability of next features varies, but they all must be present + * on platform with correct support for _XOPEN_SOURCE = 500. */ + +/* Mandatory with _XOPEN_SOURCE >= 500 but as XSI extension available + * with much older standards. */ +#ifndef ftruncate + (void) ftruncate; +#endif + +/* Added with _XOPEN_SOURCE >= 500 but was available in some standards + * before. XSI extension. */ +#ifndef pread + (void) pread; +#endif + +#ifndef __APPLE__ +/* Actually comes from XPG4v2 and must be available + * with _XOPEN_SOURCE >= 500 as well. */ +#ifndef symlink + (void) symlink; +#endif + +/* Actually comes from XPG4v2 and must be available + * with _XOPEN_SOURCE >= 500 as well. XSI extension. */ +#ifndef strdup + (void) strdup; +#endif +#endif /* ! __APPLE__ */ + return 0; +} + ]], + [$3],[[500]],[[mhd_cv_headers_susv2]]dnl + ) + ] + ) + _MHD_VAR_CONTAIN_BRE([[mhd_cv_headers_susv2]], [[^available]], + [ + _MHD_VAR_CONTAIN([[mhd_cv_headers_susv2]], [[does not work with _XOPEN_SOURCE]], [[:]], + [_MHD_SYS_EXT_VAR_ADD_FLAG([$1],[$2],[[_XOPEN_SOURCE]],[[500]])] + ) + $4 + ], + [$5] + ) +]) + + +# SYNOPSIS +# +# _MHD_CHECK_POSIX_FEATURES_SINGLE(FEATURES_TEST, +# EXT_DEFINES, +# _XOPEN_SOURCE-VALUE, +# VAR-RESULT) + +AC_DEFUN([_MHD_CHECK_POSIX_FEATURES_SINGLE], [dnl + AS_VAR_PUSHDEF([avail_Var], [mhd_cpsxfs_tmp_features_available])dnl + AS_VAR_PUSHDEF([ext_Var], [mhd_cpsxfs_tmp_extentions_allowed])dnl + AS_VAR_PUSHDEF([xopen_Var], [mhd_cpsxfs_tmp_src_xopen_allowed])dnl + AS_VAR_PUSHDEF([dislb_Var], [mhd_cpsxfs_tmp_features_disableable])dnl + AS_UNSET([avail_Var]) + AS_UNSET([ext_Var]) + AS_UNSET([xopen_Var]) + AS_UNSET([dislb_Var]) + _MHD_CHECK_POSIX_FEATURES([$1], [$2], [$3], [avail_Var], [ext_Var], [xopen_Var], [dislb_Var]) + AS_VAR_IF([avail_Var], ["yes"], + [ + AS_VAR_IF([dislb_Var], ["yes"], + [ + AS_VAR_IF([ext_Var], ["required"], + [ + AS_VAR_IF([xopen_Var], ["allowed"], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, activated by extension macro, works with _XOPEN_SOURCE=]m4_normalize([$3])["]) + ], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, activated by extension macro, does not work with _XOPEN_SOURCE=]m4_normalize([$3])["]) + ] + ) + ], + [ + AS_VAR_IF([ext_Var], ["allowed"], + [ + AS_VAR_IF([xopen_Var], ["required"], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, activated by _XOPEN_SOURCE=]m4_normalize([$3])[, works with extension macro"]) + ], + [ + AS_VAR_IF([xopen_Var], ["allowed"], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, works with _XOPEN_SOURCE=]m4_normalize([$3])[, works with extension macro"]) + ], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, works with extension macro, does not work with _XOPEN_SOURCE=]m4_normalize([$3])["]) + ] + ) + ] + ) + ], + [ + AS_VAR_IF([xopen_Var], ["required"], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, activated by _XOPEN_SOURCE=]m4_normalize([$3])[, does not work with extension macro"]) + ], + [ + AS_VAR_IF([xopen_Var], ["allowed"], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, works with _XOPEN_SOURCE=]m4_normalize([$3])[, does not work with extension macro"]) + ], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, does not work with _XOPEN_SOURCE=]m4_normalize([$3])[, does not work with extension macro"]) + ] + ) + ] + ) + ] + ) + ] + ) + ], + [ + AS_VAR_SET(m4_normalize([$4]), ["available, works always"]) + ] + ) + ], + [ + AS_VAR_SET(m4_normalize([$4]), ["not available"]) + ] + ) + AS_UNSET([dislb_Var]) + AS_UNSET([xopen_Var]) + AS_UNSET([ext_Var]) + AS_UNSET([avail_Var]) + AS_VAR_POPDEF([dislb_Var])dnl + AS_VAR_POPDEF([xopen_Var])dnl + AS_VAR_POPDEF([ext_Var])dnl + AS_VAR_POPDEF([avail_Var])dnl +]) + +# SYNOPSIS +# +# _MHD_CHECK_POSIX_FEATURES(FEATURES_TEST, EXT_DEFINES, _XOPEN_SOURCE-VALUE, +# [VAR-FEATURES-AVAILABLE-YES_NO], +# [VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED], +# [VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED], +# [VAR-FEATURES-DISABLEABLE-YES_NO]) + +AC_DEFUN([_MHD_CHECK_POSIX_FEATURES], [dnl + AS_VAR_PUSHDEF([src_Var], [mhd_cpsxf_tmp_src_variable])dnl + AS_VAR_PUSHDEF([defs_Var], [mhd_cpsxf_tmp_defs_variable])dnl + AS_VAR_SET([src_Var],[" +$1 +"]) + dnl To reduce 'configure' size + AS_VAR_SET([defs_Var],[" +$2 +"]) + dnl To reduce 'configure' size + + dnl Some platforms enable most features when no + dnl specific mode is requested by macro. + dnl Check whether features test works without _XOPEN_SOURCE and + dnl with disabled extensions (undefined most of + dnl predefined macros for specific requested mode). + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with undefined all extensions and without _XOPEN_SOURCE]]) + AS_VAR_SET(m4_normalize([$4]),["yes"]) # VAR-FEATURES-AVAILABLE-YES_NO + + dnl Check whether features will work extensions + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$defs_Var +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with extensions]]) + AS_VAR_SET(m4_normalize([$5]),["allowed"]) # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + dnl Check whether features will work with _XOPEN_SOURCE + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$defs_Var +[#define _XOPEN_SOURCE ]]m4_normalize([$3])[ +$src_Var + ])], + [dnl + _AS_ECHO_LOG([Checked features work with extensions and with _XOPEN_SOURCE=]m4_normalize([$3])[]) + AS_VAR_SET(m4_normalize([$6]),["allowed"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + dnl Check whether features could be disabled + dnl Request oldest POSIX mode and strict ANSI mode + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +_MHD_UNDEF_ALL_EXT +[#define _POSIX_C_SOURCE 1] +[#define _ANSI_SOURCE 1] +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with disabled extensions, with _POSIX_C_SOURCE=1 and _ANSI_SOURCE=1]]) + AS_VAR_SET(m4_normalize([$7]),["no"]) # VAR-FEATURES-DISABLEABLE-YES_NO + ], + [dnl + _AS_ECHO_LOG([[Checked features DO NOT work with disabled extensions, with _POSIX_C_SOURCE=1 and _ANSI_SOURCE=1]]) + AS_VAR_SET(m4_normalize([$7]),["yes"]) # VAR-FEATURES-DISABLEABLE-YES_NO + ] + ) + ], + [dnl + _AS_ECHO_LOG([Checked features DO NOT work with extensions and with _XOPEN_SOURCE=]m4_normalize([$3])[]) + AS_VAR_SET(m4_normalize([$6]),["not allowed"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + AS_VAR_SET(m4_normalize([$7]),["yes"]) # VAR-FEATURES-DISABLEABLE-YES_NO + ] + ) + ], + [dnl + _AS_ECHO_LOG([[Checked features DO NOT work with extensions]]) + AS_VAR_SET(m4_normalize([$7]),["yes"]) # VAR-FEATURES-DISABLEABLE-YES_NO + dnl Check whether features work with _XOPEN_SOURCE + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +[#define _XOPEN_SOURCE ]m4_normalize($3) +$src_Var + ])], + [dnl + _AS_ECHO_LOG([Checked features work with _XOPEN_SOURCE=]m4_normalize([$3])[]) + dnl Check default state (without enabling/disabling) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work by default]]) + AS_VAR_SET(m4_normalize([$6]),["allowed"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + ], + [dnl + _AS_ECHO_LOG([[Checked features DO NOT by default]]) + AS_VAR_SET(m4_normalize([$6]),["required"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + ] + ) + dnl Check whether features work with _XOPEN_SOURCE and extensions + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$defs_Var +[#define _XOPEN_SOURCE] ]m4_normalize([$3])[ +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with _XOPEN_SOURCE and extensions]]) + AS_VAR_SET(m4_normalize([$5]),["allowed"]) # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + ], + [dnl + _AS_ECHO_LOG([[Checked features DO NOT work with _XOPEN_SOURCE and extensions]]) + AS_VAR_SET(m4_normalize([$5]),["not allowed"]) # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + ] + ) + ], + [dnl + _AS_ECHO_LOG([Checked features DO NOT work with _XOPEN_SOURCE=]m4_normalize([$3])[]) + AS_VAR_SET(m4_normalize([$5]),["not allowed"]) # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + AS_VAR_SET(m4_normalize([$6]),["not allowed"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + ] + ) + ] + ) + ], + [dnl + _AS_ECHO_LOG([[Checked features DO NOT work with undefined all extensions and without _XOPEN_SOURCE]]) + dnl Let's find the way to enable POSIX features + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$defs_Var +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work with extensions]]) + AS_VAR_SET(m4_normalize([$4]),["yes"]) # VAR-FEATURES-AVAILABLE-YES_NO + AS_VAR_SET(m4_normalize([$7]),["yes"]) # VAR-FEATURES-DISABLEABLE-YES_NO + dnl Check default state (without enabling/disabling) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work by default]]) + AS_VAR_SET(m4_normalize([$5]),["allowed"]) # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + ], + [dnl + _AS_ECHO_LOG([[Checked features DO NOT by default]]) + AS_VAR_SET(m4_normalize([$5]),["required"]) # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + ] + ) + dnl Check whether features work with extensions and _XOPEN_SOURCE + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$defs_Var +[#define _XOPEN_SOURCE] ]m4_normalize([$3])[ +$src_Var + ])], + [dnl + _AS_ECHO_LOG([Checked features work with extensions and _XOPEN_SOURCE=]m4_normalize([$3])[]) + AS_VAR_SET(m4_normalize([$6]),["allowed"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + ], + [dnl + _AS_ECHO_LOG([Checked features DO NOT work with extensions and _XOPEN_SOURCE=]m4_normalize([$3])[]) + AS_VAR_SET(m4_normalize([$6]),["not allowed"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + ] + ) + ], + [dnl + _AS_ECHO_LOG([[Checked features DO NOT work with extensions]]) + dnl Check whether features work with _XOPEN_SOURCE + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +[#define _XOPEN_SOURCE] ]m4_normalize([$3])[ +$src_Var + ])], + [dnl + _AS_ECHO_LOG([Checked features work with _XOPEN_SOURCE=]m4_normalize([$3])[]) + AS_VAR_SET(m4_normalize([$4]),["yes"]) # VAR-FEATURES-AVAILABLE-YES_NO + dnl Check default state (without enabling/disabling) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$src_Var + ])], + [dnl + _AS_ECHO_LOG([[Checked features work by default]]) + AS_VAR_SET(m4_normalize([$6]),["allowed"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + ], + [dnl + _AS_ECHO_LOG([[Checked features DO NOT by default]]) + AS_VAR_SET(m4_normalize([$6]),["required"]) # VAR-XOPEN-REQUIRED_NOT-ALLOWED_ALLOWED + ] + ) + dnl Check whether features work with _XOPEN_SOURCE and extensions + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +$defs_Var +[#define _XOPEN_SOURCE] ]m4_normalize([$3])[ +$src_Var + ])], + [dnl + _AS_ECHO_LOG([Checked features work with _XOPEN_SOURCE=]m4_normalize([$3])[ and extensions]) + AS_VAR_SET(m4_normalize([$5]),["allowed"]) # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + ], + [dnl + _AS_ECHO_LOG([Checked features DO NOT work with _XOPEN_SOURCE=]m4_normalize([$3])[ and extensions]) + AS_VAR_SET(m4_normalize([$5]),["not allowed"]) # VAR-EXTENSIONS-REQUIRED_NOT-ALLOWED_ALLOWED + ] + ) + ], + [dnl + _AS_ECHO_LOG([Checked features DO NOT work with _XOPEN_SOURCE=]m4_normalize([$3])[]) + AS_VAR_SET(m4_normalize([$4]),["no"]) # VAR-FEATURES-AVAILABLE-YES_NO + ] + ) + ] + ) + ] + ) + AS_UNSET([defs_Var]) + AS_UNSET([src_Var]) + AS_VAR_POPDEF([defs_Var])dnl + AS_VAR_POPDEF([src_Var])dnl +]) + + +# +# MHD_CHECK_HEADER_PRESENCE(headername.h) +# +# Check only by preprocessor whether header file is present. + +AC_DEFUN([MHD_CHECK_HEADER_PRESENCE], [dnl + AC_PREREQ([2.64])dnl for AS_VAR_PUSHDEF, AS_VAR_SET + AS_VAR_PUSHDEF([mhd_cache_Var],[mhd_cv_header_[]$1[]_present])dnl + AC_CACHE_CHECK([for presence of $1], [mhd_cache_Var], [dnl + dnl Hack autoconf to get pure result of only single header presence + cat > conftest.$ac_ext <<_ACEOF +@%:@include <[]$1[]> +_ACEOF + AC_PREPROC_IFELSE([], + [AS_VAR_SET([mhd_cache_Var],[["yes"]])], + [AS_VAR_SET([mhd_cache_Var],[["no"]])] + ) + rm -f conftest.$ac_ext + ]) + AS_VAR_POPDEF([mhd_cache_Var])dnl +]) + + +# +# MHD_CHECK_HEADERS_PRESENCE(oneheader.h otherheader.h ...) +# +# Check each specified header in whitespace-separated list for presence. + +AC_DEFUN([MHD_CHECK_HEADERS_PRESENCE], [dnl + AC_PREREQ([2.60])dnl for m4_foreach_w + m4_foreach_w([mhd_chk_Header], [$1], + [MHD_CHECK_HEADER_PRESENCE(m4_defn([mhd_chk_Header]))] + )dnl +]) + + +# +# MHD_CHECK_HEADERS_PRESENCE_COMPACT(oneheader.h otherheader.h ...) +# +# Same as MHD_CHECK_HEADERS_PRESENCE, but a bit slower and produce more compact 'configure'. + +AC_DEFUN([MHD_CHECK_HEADERS_PRESENCE_COMPACT], [dnl + for mhd_chk_Header in $1 ; do + MHD_CHECK_HEADER_PRESENCE([[${mhd_chk_Header}]]) + done +]) + + +# +# MHD_CHECK_BASIC_HEADERS_PRESENCE +# +# Check basic headers for presence. + +AC_DEFUN([MHD_CHECK_BASIC_HEADERS_PRESENCE], [dnl + MHD_CHECK_HEADERS_PRESENCE([stdio.h wchar.h stdlib.h string.h strings.h stdint.h fcntl.h sys/types.h time.h unistd.h]) +]) + + +# +# _MHD_SET_BASIC_INCLUDES +# +# Internal preparatory macro. + +AC_DEFUN([_MHD_SET_BASIC_INCLUDES], [dnl + AC_REQUIRE([MHD_CHECK_BASIC_HEADERS_PRESENCE])dnl + AS_IF([[test -z "$mhd_basic_headers_includes"]], [dnl + AS_VAR_IF([mhd_cv_header_stdio_h_present], [["yes"]], + [[mhd_basic_headers_includes="\ +#include +" ]],[[mhd_basic_headers_includes=""]] + ) + AS_VAR_IF([mhd_cv_header_sys_types_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_wchar_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_stdlib_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_string_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_strings_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_stdint_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_fcntl_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_time_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + AS_VAR_IF([mhd_cv_header_unistd_h_present], [["yes"]], + [[mhd_basic_headers_includes="${mhd_basic_headers_includes}\ +#include +" ]] + ) + ])dnl +]) + + +# +# _MHD_BASIC_INCLUDES +# +# Internal macro. Output set of basic includes. + +AC_DEFUN([_MHD_BASIC_INCLUDES], [AC_REQUIRE([_MHD_SET_BASIC_INCLUDES])dnl +[ /* Start of MHD basic test includes */ +$mhd_basic_headers_includes /* End of MHD basic test includes */ +]]) + + +# +# MHD_CHECK_BASIC_HEADERS([PROLOG], [ACTION-IF-OK], [ACTION-IF-FAIL]) +# +# Check whether basic headers can be compiled with specified prolog. + +AC_DEFUN([MHD_CHECK_BASIC_HEADERS], [dnl + AC_COMPILE_IFELSE([dnl + AC_LANG_PROGRAM([m4_n([$1])dnl +_MHD_BASIC_INCLUDES + ], [[int i = 1; i++; if(i) return i]]) + ], [$2], [$3]) +]) + + +# +# _MHD_SET_UNDEF_ALL_EXT +# +# Internal preparatory macro. + +AC_DEFUN([_MHD_SET_UNDEF_ALL_EXT], [m4_divert_text([INIT_PREPARE],[dnl +[mhd_undef_all_extensions=" +#ifdef _GNU_SOURCE +#undef _GNU_SOURCE +#endif +#ifdef _XOPEN_SOURCE +#undef _XOPEN_SOURCE +#endif +#ifdef _XOPEN_SOURCE_EXTENDED +#undef _XOPEN_SOURCE_EXTENDED +#endif +#ifdef _XOPEN_VERSION +#undef _XOPEN_VERSION +#endif +#ifdef _POSIX_C_SOURCE +#undef _POSIX_C_SOURCE +#endif +#ifdef _POSIX_SOURCE +#undef _POSIX_SOURCE +#endif +#ifdef _DEFAULT_SOURCE +#undef _DEFAULT_SOURCE +#endif +#ifdef _BSD_SOURCE +#undef _BSD_SOURCE +#endif +#ifdef _SVID_SOURCE +#undef _SVID_SOURCE +#endif +#ifdef __EXTENSIONS__ +#undef __EXTENSIONS__ +#endif +#ifdef _ALL_SOURCE +#undef _ALL_SOURCE +#endif +#ifdef _TANDEM_SOURCE +#undef _TANDEM_SOURCE +#endif +#ifdef _DARWIN_C_SOURCE +#undef _DARWIN_C_SOURCE +#endif +#ifdef __BSD_VISIBLE +#undef __BSD_VISIBLE +#endif +#ifdef _NETBSD_SOURCE +#undef _NETBSD_SOURCE +#endif +" +]])]) + + +# +# _MHD_UNDEF_ALL_EXT +# +# Output prolog that undefine all known extension and visibility macros. + +AC_DEFUN([_MHD_UNDEF_ALL_EXT], [dnl +AC_REQUIRE([_MHD_SET_UNDEF_ALL_EXT])dnl +$mhd_undef_all_extensions +]) + + +# +# _MHD_CHECK_DEFINED(SYMBOL, [PROLOG], +# [ACTION-IF-DEFINED], [ACTION-IF-NOT-DEFINED]) +# +# Silently checks for defined symbols. + +AC_DEFUN([_MHD_CHECK_DEFINED], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +m4_n([$2])dnl +[#ifndef ]$1[ +#error ]$1[ is not defined +choke me now; +#endif + ]],[]) + ], [m4_default_nblank([$3])], [m4_default_nblank([$4])] + ) +]) + + +# +# MHD_CHECK_DEFINED(SYMBOL, [PROLOG], +# [ACTION-IF-DEFINED], [ACTION-IF-NOT-DEFINED], +# [MESSAGE]) +# +# Cache-check for defined symbols with printing results. + +AC_DEFUN([MHD_CHECK_DEFINED], [dnl + AS_VAR_PUSHDEF([mhd_cache_Var],[mhd_cv_macro_[]m4_tolower(m4_normalize($1))_defined])dnl + AC_CACHE_CHECK([dnl +m4_ifnblank([$5], [$5], [whether ]m4_normalize([$1])[ is already defined])], + [mhd_cache_Var], [dnl + _MHD_CHECK_DEFINED(m4_normalize([$1]), [$2], + [mhd_cache_Var="yes"], + [mhd_cache_Var="no"] + ) + ]) + _MHD_VAR_IF([mhd_cache_Var], [["yes"]], [$3], [$4]) + AS_VAR_POPDEF([mhd_cache_Var])dnl +]) + + +# +# MHD_CHECK_DEFINED_MSG(SYMBOL, [PROLOG], [MESSAGE] +# [ACTION-IF-DEFINED], [ACTION-IF-NOT-DEFINED]) +# +# Cache-check for defined symbols with printing results. +# Reordered arguments for better readability. + +AC_DEFUN([MHD_CHECK_DEFINED_MSG],[dnl +MHD_CHECK_DEFINED([$1],[$2],[$4],[$5],[$3])]) + +# +# MHD_CHECK_ACCEPT_DEFINE(DEFINE-SYMBOL, [DEFINE-VALUE = 1], [PROLOG], +# [ACTION-IF-ACCEPTED], [ACTION-IF-NOT-ACCEPTED], +# [MESSAGE]) +# +# Cache-check whether specific defined symbol do not break basic headers. + +AC_DEFUN([MHD_CHECK_ACCEPT_DEFINE], [dnl + AC_PREREQ([2.64])dnl for AS_VAR_PUSHDEF, AS_VAR_SET, m4_ifnblank + AS_VAR_PUSHDEF([mhd_cache_Var], + [mhd_cv_define_[]m4_tolower(m4_normalize($1))[]_accepted[]m4_ifnblank([$2],[_[]$2])])dnl + AC_CACHE_CHECK([dnl +m4_ifnblank([$6],[$6],[whether headers accept $1[]m4_ifnblank([$2],[[ with value ]$2])])], + [mhd_cache_Var], [dnl + MHD_CHECK_BASIC_HEADERS([ +m4_n([$3])[#define ]$1 m4_default_nblank($2,[[1]])], + [mhd_cache_Var="yes"], [mhd_cache_Var="no"] + ) + ]) + _MHD_VAR_IF([mhd_cache_Var], [["yes"]], [$4], [$5]) + AS_VAR_POPDEF([mhd_cache_Var])dnl +]) + + +# +# MHD_CHECK_DEF_AND_ACCEPT(DEFINE-SYMBOL, [DEFINE-VALUE = 1], [PROLOG], +# [ACTION-IF-DEFINED], +# [ACTION-IF-ACCEPTED], [ACTION-IF-NOT-ACCEPTED]) +# +# Combination of MHD_CHECK_DEFINED_ECHO and MHD_CHECK_ACCEPT_DEFINE. +# First check whether symbol is already defined and, if not defined, +# checks whether it can be defined. + +AC_DEFUN([MHD_CHECK_DEF_AND_ACCEPT], [dnl + MHD_CHECK_DEFINED([$1], [$3], [$4], [dnl + MHD_CHECK_ACCEPT_DEFINE([$1], [$2], [$3], [$5], [$6])dnl + ])dnl +]) + +# +# _MHD_XOPEN_VAR_ADD(DEFINES_VAR, FLAGS_VAR, [PROLOG]) +# +# Internal macro. Only to be used in MHD_SYS_EXT. + +AC_DEFUN([_MHD_XOPEN_VAR_ADD], [dnl + MHD_CHECK_DEF_AND_ACCEPT([[_XOPEN_SOURCE]], [[1]], [$3], + [ + AC_CACHE_CHECK([[whether predefined value of _XOPEN_SOURCE is more or equal 500]], + [[mhd_cv_macro__xopen_source_def_fiveh]], [dnl + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +m4_n([$3])dnl +[#if _XOPEN_SOURCE+0 < 500 +#error Value of _XOPEN_SOURCE is less than 500 +choke me now; +#endif + ]],[[int i = 0; i++; if(i) return i]])], + [[mhd_cv_macro__xopen_source_def_fiveh="yes"]], + [[mhd_cv_macro__xopen_source_def_fiveh="no"]] + )dnl + ] + )dnl + ], + [_MHD_SYS_EXT_VAR_ADD_FLAG([$1], [$2], [[_XOPEN_SOURCE]], [[1]])] + ) + AS_IF([[test "x${mhd_cv_define__xopen_source_accepted_1}" = "xyes" || \ + test "x${mhd_cv_macro__xopen_source_def_fiveh}" = "xno"]], + [ + MHD_CHECK_DEF_AND_ACCEPT([[_XOPEN_SOURCE_EXTENDED]], [], + [ +m4_n([$3])], [], + [dnl + _MHD_SYS_EXT_VAR_ADD_FLAG([$1],[$2],[[_XOPEN_SOURCE_EXTENDED]]) + ], [dnl + MHD_CHECK_DEFINED([[_XOPEN_VERSION]], + [ +m4_n([$3])], [], + [dnl + AC_CACHE_CHECK([[for value of _XOPEN_VERSION accepted by headers]], + [mhd_cv_define__xopen_version_accepted], [dnl + MHD_CHECK_BASIC_HEADERS([ +m4_n([$3]) +[#define _XOPEN_VERSION 4]], + [[mhd_cv_define__xopen_version_accepted="4"]], + [ + MHD_CHECK_BASIC_HEADERS([ +m4_n([$3]) +[#define _XOPEN_VERSION 3]], + [[mhd_cv_define__xopen_version_accepted="3"]], + [[mhd_cv_define__xopen_version_accepted="no"]] + ) + ]) + ]) + AS_VAR_IF([mhd_cv_define__xopen_version_accepted], [["no"]], + [[:]], + [dnl + _MHD_SYS_EXT_VAR_ADD_FLAG([$1],[$2],[[_XOPEN_VERSION]], + [[${mhd_cv_define__xopen_version_accepted}]]dnl + ) + ]) + ]) + ]) + ] + )dnl +]) + diff --git a/m4/pkg.m4 b/m4/pkg.m4 new file mode 100644 index 0000000..13a8890 --- /dev/null +++ b/m4/pkg.m4 @@ -0,0 +1,275 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.2]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $2]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR diff --git a/m4/search_h.m4 b/m4/search_h.m4 new file mode 100644 index 0000000..6aaaf36 --- /dev/null +++ b/m4/search_h.m4 @@ -0,0 +1,60 @@ +# search_h.m4 serial 9 +dnl Copyright (C) 2007-2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SEARCH_H], +[ + AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([search.h]) + if test $ac_cv_header_search_h = yes; then + HAVE_SEARCH_H=1 + else + HAVE_SEARCH_H=0 + fi + AC_SUBST([HAVE_SEARCH_H]) + + if test $HAVE_SEARCH_H = 1; then + AC_CACHE_CHECK([for type VISIT], [gl_cv_type_VISIT], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#if HAVE_SEARCH_H + #include + #endif + ]], + [[static VISIT x; x = postorder;]])], + [gl_cv_type_VISIT=yes], + [gl_cv_type_VISIT=no])]) + else + gl_cv_type_VISIT=no + fi + if test $gl_cv_type_VISIT = yes; then + HAVE_TYPE_VISIT=1 + else + HAVE_TYPE_VISIT=0 + fi + AC_SUBST([HAVE_TYPE_VISIT]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include + ]], [tdelete tfind tsearch twalk]) +]) + +AC_DEFUN([gl_SEARCH_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SEARCH_H_DEFAULTS], +[ + GNULIB_TSEARCH=0; AC_SUBST([GNULIB_TSEARCH]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_TSEARCH=1; AC_SUBST([HAVE_TSEARCH]) + REPLACE_TSEARCH=0; AC_SUBST([REPLACE_TSEARCH]) +]) diff --git a/m4/tsearch.m4 b/m4/tsearch.m4 new file mode 100644 index 0000000..24b35ce --- /dev/null +++ b/m4/tsearch.m4 @@ -0,0 +1,59 @@ +# tsearch.m4 serial 6 +dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_TSEARCH], +[ + AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) + AC_CHECK_FUNCS([tsearch]) + if test $ac_cv_func_tsearch = yes; then + dnl On OpenBSD 4.0, the return value of tdelete() is incorrect. + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether tdelete works], [gl_cv_func_tdelete_works], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include +static int +cmp_fn (const void *a, const void *b) +{ + return *(const int *) a - *(const int *) b; +} +int +main () +{ + int result = 0; + int x = 0; + void *root = NULL; + if (!(tfind (&x, &root, cmp_fn) == NULL)) + result |= 1; + tsearch (&x, &root, cmp_fn); + if (!(tfind (&x, &root, cmp_fn) != NULL)) + result |= 2; + if (!(tdelete (&x, &root, cmp_fn) != NULL)) + result |= 4; + return result; +}]])], [gl_cv_func_tdelete_works=yes], [gl_cv_func_tdelete_works=no], + [case "$host_os" in + openbsd*) gl_cv_func_tdelete_works="guessing no";; + *) gl_cv_func_tdelete_works="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_tdelete_works" in + *no) + REPLACE_TSEARCH=1 + ;; + esac + else + HAVE_TSEARCH=0 + fi +]) + +# Prerequisites of lib/tsearch.c. +AC_DEFUN([gl_PREREQ_TSEARCH], [ + : +]) diff --git a/missing b/missing new file mode 100755 index 0000000..f62bbae --- /dev/null +++ b/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2013-10-28.13; # UTC + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 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, see . + +# 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 + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + 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 + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=http://www.perl.org/ +flex_URL=http://flex.sourceforge.net/ +gnu_software_URL=http://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'autom4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/po/ABOUT-NLS b/po/ABOUT-NLS new file mode 100644 index 0000000..3cc8286 --- /dev/null +++ b/po/ABOUT-NLS @@ -0,0 +1,1379 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is a +way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this 'ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU 'gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU 'gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + +1.1 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU 'gettext'. Other packages have their own ways to +internationalization, predating GNU 'gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU 'gettext' functions. Installers may use special +options at configuration time for changing the default behaviour. The +command: + + ./configure --disable-nls + +will _totally_ disable translation of messages. + + When you already have GNU 'gettext' installed on your system and run +configure without an option for your new package, 'configure' will +probably detect the previously built and installed 'libintl' library and +will decide to use it. If not, you may have to to use the +'--with-libintl-prefix' option to tell 'configure' where to look for it. + + Internationalized packages usually have many 'po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at 'configure' time by using the +'--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable 'LINGUAS' +may be set, prior to configuration, to limit the installed set. +'LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.2 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the 'LANG' environment variable to the appropriate +'LL_CC' combination. If you happen to have the 'LC_ALL' or some other +'LC_xxx' environment variables set, you should unset them before setting +'LANG', otherwise the setting of 'LANG' will not have the desired +effect. Here 'LL' is an ISO 639 two-letter language code, and 'CC' is +an ISO 3166 two-letter country code. For example, let's suppose that +you speak German and live in Germany. At the shell prompt, merely +execute 'setenv LANG de_DE' (in 'csh'), 'export LANG; LANG=de_DE' (in +'sh') or 'export LANG=de_DE' (in 'bash'). This can be done from your +'.login' or '.profile' file, once and for all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, 'de_AT' is used for Austria, and 'pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of 'LL_CC', with 'LL' denoting the +language and 'CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are used, +such as 'LL' or 'LL_CC.ENCODING'. You can get the list of locales +supported by your system for your language by running the command +'locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +'LANGUAGE'. GNU 'gettext' gives preference to 'LANGUAGE' over 'LANG' +for the purpose of message handling, but you still need to have 'LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather read +translations in German than English for when Swedish is not available, +set 'LANGUAGE' to 'sv:de' while leaving 'LANG' to 'sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from 'no' to 'nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under 'nb' and some older ones under 'no', it's recommended +for Norwegian users to set 'LANGUAGE' to 'nb:no' so that both newer and +older translations are used. + + In the 'LANGUAGE' environment variable, but not in the 'LANG' +environment variable, 'LL_CC' combinations can be abbreviated as 'LL' to +denote the language's main dialect. For example, 'de' is equivalent to +'de_DE' (German as spoken in Germany), and 'pt' to 'pt_PT' (Portuguese +as spoken in Portugal) in this context. + +1.3 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +'http://translationproject.org/', in the "Teams" area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +'-request' appended. For example, speakers of Swedish can send a +message to 'sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate _actively_ +in translations, or at solving translational difficulties, rather than +merely lurking around. If your team does not exist yet and you want to +start one, or if you are unsure about what to do or how to get started, +please write to 'coordinator@translationproject.org' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skills are praised more than +programming skills, here. + +1.4 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of Jun 2014. +The matrix shows, in regard of each package, for which languages PO +files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am an ar as ast az be bg bn bn_IN bs ca crh cs + +---------------------------------------------------+ + a2ps | [] [] [] | + aegis | | + anubis | | + aspell | [] [] [] | + bash | [] [] [] | + bfd | | + binutils | [] | + bison | | + bison-runtime | [] | + buzztrax | [] | + ccd2cue | | + ccide | | + cflow | | + clisp | | + coreutils | [] [] | + cpio | | + cppi | | + cpplib | [] | + cryptsetup | [] | + datamash | | + denemo | [] [] | + dfarc | [] | + dialog | [] [] [] | + dico | | + diffutils | [] | + dink | [] | + direvent | | + doodle | [] | + dos2unix | | + dos2unix-man | | + e2fsprogs | [] [] | + enscript | [] | + exif | [] | + fetchmail | [] [] | + findutils | [] | + flex | [] | + freedink | [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | [] | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gjay | | + glunarclock | [] [] [] | + gnubiff | [] | + gnubik | [] | + gnucash | () () [] | + gnuchess | | + gnulib | [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] | + gprof | [] | + gramadoir | | + grep | [] [] [] | + grub | [] | + gsasl | | + gss | | + gst-plugins-bad | [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] | + gst-plugins-ugly | [] [] [] | + gstreamer | [] [] [] [] | + gtick | [] | + gtkam | [] [] | + gtkspell | [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] | + hello | [] | + help2man | | + help2man-texi | | + hylafax | | + idutils | | + iso_15924 | [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] | + iso_639 | [] [] [] [] [] [] [] [] [] | + iso_639_3 | [] [] | + iso_639_5 | | + jwhois | | + kbd | [] | + klavaro | [] [] [] [] [] | + ld | [] | + leafpad | [] [] [] [] | + libc | [] [] [] | + libexif | () | + libextractor | | + libgnutls | [] | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | | + libiconv | [] [] | + libidn | [] | + liferea | [] [] [] [] | + lilypond | [] [] | + lordsawar | [] | + lprng | | + lynx | [] [] | + m4 | [] | + mailfromd | | + mailutils | | + make | [] | + man-db | [] [] | + man-db-manpages | | + midi-instruments | [] [] [] | + minicom | [] | + mkisofs | [] | + myserver | [] | + nano | [] [] [] | + opcodes | | + parted | [] | + pies | | + pnmixer | | + popt | [] | + procps-ng | | + procps-ng-man | | + psmisc | [] | + pspp | [] | + pushover | [] | + pwdutils | | + pyspread | | + radius | [] | + recode | [] [] [] | + recutils | | + rpm | | + rush | | + sarg | | + sed | [] [] [] [] | + sharutils | [] | + shishi | | + skribilo | | + solfege | [] [] | + solfege-manual | | + spotmachine | | + sudo | [] [] | + sudoers | [] [] | + sysstat | [] | + tar | [] [] [] | + texinfo | [] [] | + texinfo_document | [] [] | + tigervnc | [] | + tin | | + tin-man | | + tracgoogleappsa... | | + trader | | + util-linux | [] | + ve | | + vice | | + vmm | | + vorbis-tools | [] | + wastesedge | | + wcd | | + wcd-man | | + wdiff | [] [] | + wget | [] | + wyslij-po | | + xboard | | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +---------------------------------------------------+ + af am an ar as ast az be bg bn bn_IN bs ca crh cs + 4 0 2 5 3 11 0 8 25 3 3 1 55 4 74 + + da de el en en_GB en_ZA eo es et eu fa fi fr + +--------------------------------------------------+ + a2ps | [] [] [] [] [] [] [] [] [] | + aegis | [] [] [] [] | + anubis | [] [] [] [] [] | + aspell | [] [] [] [] [] [] [] | + bash | [] [] [] | + bfd | [] [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | [] [] [] [] | + ccd2cue | [] [] [] [] | + ccide | [] [] [] [] [] [] | + cflow | [] [] [] [] [] | + clisp | [] [] [] [] [] | + coreutils | [] [] [] [] [] | + cpio | [] [] [] [] [] | + cppi | [] [] [] [] [] | + cpplib | [] [] [] [] [] [] | + cryptsetup | [] [] [] [] [] | + datamash | [] [] [] [] | + denemo | [] | + dfarc | [] [] [] [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] | + dico | [] [] [] [] | + diffutils | [] [] [] [] [] [] | + dink | [] [] [] [] [] [] | + direvent | [] [] [] [] | + doodle | [] [] [] [] | + dos2unix | [] [] [] [] [] | + dos2unix-man | [] [] [] | + e2fsprogs | [] [] [] [] [] | + enscript | [] [] [] [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] () [] [] [] [] [] | + findutils | [] [] [] [] [] [] [] [] | + flex | [] [] [] [] [] [] | + freedink | [] [] [] [] [] [] [] [] | + fusionforge | [] [] [] | + gas | [] [] [] | + gawk | [] [] [] [] [] | + gcal | [] [] [] [] | + gcc | [] | + gdbm | [] [] [] [] [] | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] | + gjay | [] [] [] [] | + glunarclock | [] [] [] [] [] | + gnubiff | () [] [] () | + gnubik | [] [] [] [] [] | + gnucash | [] () () () () () () | + gnuchess | [] [] [] [] | + gnulib | [] [] [] [] [] [] [] | + gnunet | [] | + gnunet-gtk | [] | + gold | [] [] [] | + gphoto2 | [] () [] [] | + gprof | [] [] [] [] [] [] | + gramadoir | [] [] [] [] [] | + grep | [] [] [] [] [] [] [] | + grub | [] [] [] [] [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] [] [] | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] () [] [] [] | + gtkam | [] () [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] | + guix | [] [] | + guix-packages | | + gutenprint | [] [] [] [] | + hello | [] [] [] [] [] [] [] [] | + help2man | [] [] [] [] [] [] [] | + help2man-texi | [] [] [] | + hylafax | [] [] | + idutils | [] [] [] [] [] | + iso_15924 | [] () [] [] () [] () | + iso_3166 | [] () [] [] [] [] () [] () | + iso_3166_2 | [] () () () | + iso_4217 | [] () [] [] [] () [] () | + iso_639 | [] () [] [] () [] () | + iso_639_3 | () () () | + iso_639_5 | () () () | + jwhois | [] [] [] [] [] | + kbd | [] [] [] [] [] [] | + klavaro | [] [] [] [] [] [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] [] () [] [] | + libextractor | [] | + libgnutls | [] [] [] [] | + libgphoto2 | [] () [] | + libgphoto2_port | [] () [] [] [] [] | + libgsasl | [] [] [] [] [] | + libiconv | [] [] [] [] [] [] [] | + libidn | [] [] [] [] [] | + liferea | [] () [] [] [] [] [] | + lilypond | [] [] [] [] [] [] | + lordsawar | [] [] | + lprng | | + lynx | [] [] [] [] [] [] | + m4 | [] [] [] [] [] [] | + mailfromd | [] | + mailutils | [] [] [] [] | + make | [] [] [] [] [] | + man-db | [] [] [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] [] [] [] | + minicom | [] [] [] [] [] | + mkisofs | [] [] [] | + myserver | [] [] [] [] | + nano | [] [] [] [] [] [] [] | + opcodes | [] [] [] [] [] | + parted | [] [] [] | + pies | [] | + pnmixer | [] [] | + popt | [] [] [] [] [] [] | + procps-ng | [] [] | + procps-ng-man | [] [] | + psmisc | [] [] [] [] [] [] [] | + pspp | [] [] [] | + pushover | () [] [] [] | + pwdutils | [] [] [] | + pyspread | [] [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + recutils | [] [] [] [] | + rpm | [] [] [] [] [] | + rush | [] [] [] | + sarg | [] [] | + sed | [] [] [] [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] [] [] | + skribilo | [] [] [] | + solfege | [] [] [] [] [] [] [] [] | + solfege-manual | [] [] [] [] [] | + spotmachine | [] [] [] [] [] | + sudo | [] [] [] [] [] [] | + sudoers | [] [] [] [] [] [] | + sysstat | [] [] [] [] [] [] | + tar | [] [] [] [] [] [] [] | + texinfo | [] [] [] [] [] | + texinfo_document | [] [] [] [] | + tigervnc | [] [] [] [] [] [] | + tin | [] [] [] [] | + tin-man | [] | + tracgoogleappsa... | [] [] [] [] [] | + trader | [] [] [] [] [] [] | + util-linux | [] [] [] [] | + ve | [] [] [] [] [] | + vice | () () () | + vmm | [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | [] | + wcd | [] [] [] [] | + wcd-man | [] | + wdiff | [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] | + wyslij-po | [] [] [] [] | + xboard | [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] [] [] | + +--------------------------------------------------+ + da de el en en_GB en_ZA eo es et eu fa fi fr + 119 131 32 1 6 0 94 95 22 13 4 102 139 + + ga gd gl gu he hi hr hu hy ia id is it ja ka kk + +-------------------------------------------------+ + a2ps | [] [] [] [] | + aegis | [] | + anubis | [] [] [] [] | + aspell | [] [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] | + binutils | [] [] [] | + bison | [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | | + ccd2cue | [] | + ccide | [] [] | + cflow | [] [] [] | + clisp | | + coreutils | [] [] | + cpio | [] [] [] [] [] [] | + cppi | [] [] [] [] [] | + cpplib | [] [] | + cryptsetup | [] | + datamash | | + denemo | [] | + dfarc | [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] [] | + dico | | + diffutils | [] [] [] [] | + dink | [] | + direvent | [] | + doodle | [] [] | + dos2unix | [] [] | + dos2unix-man | | + e2fsprogs | [] [] | + enscript | [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] [] [] | + findutils | [] [] [] [] [] [] [] | + flex | [] | + freedink | [] [] [] [] | + fusionforge | | + gas | [] | + gawk | [] () [] | + gcal | | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] | + gettext-tools | [] [] [] | + gjay | [] | + glunarclock | [] [] [] [] [] [] | + gnubiff | [] [] () | + gnubik | [] [] [] | + gnucash | () () () () () | + gnuchess | | + gnulib | [] [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] [] | + grep | [] [] [] [] [] [] [] | + grub | [] [] [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] [] [] | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] [] | + hello | [] [] [] [] [] | + help2man | [] [] [] | + help2man-texi | | + hylafax | [] | + idutils | [] [] | + iso_15924 | [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | [] [] | + iso_4217 | [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] [] [] [] | + iso_639_3 | [] [] | + iso_639_5 | | + jwhois | [] [] [] [] | + kbd | [] [] [] | + klavaro | [] [] [] [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] [] () | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | | + libgnutls | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] [] [] | + libidn | [] [] [] [] | + liferea | [] [] [] [] [] | + lilypond | [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] [] | + m4 | [] [] [] [] [] | + mailfromd | | + mailutils | | + make | [] [] [] [] | + man-db | [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] [] [] [] | + minicom | [] [] [] | + mkisofs | [] [] | + myserver | [] | + nano | [] [] [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] [] [] | + pies | | + pnmixer | [] [] | + popt | [] [] [] [] [] [] [] [] [] [] | + procps-ng | | + procps-ng-man | | + psmisc | [] [] [] [] | + pspp | [] [] | + pushover | [] | + pwdutils | [] | + pyspread | | + radius | [] | + recode | [] [] [] [] [] [] [] | + recutils | | + rpm | [] | + rush | [] | + sarg | | + sed | [] [] [] [] [] [] [] | + sharutils | | + shishi | | + skribilo | [] | + solfege | [] [] | + solfege-manual | | + spotmachine | | + sudo | [] [] [] [] | + sudoers | [] [] [] | + sysstat | [] [] [] [] | + tar | [] [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] [] [] | + tigervnc | | + tin | | + tin-man | | + tracgoogleappsa... | [] [] [] [] | + trader | [] [] | + util-linux | [] | + ve | [] | + vice | () () | + vmm | | + vorbis-tools | [] [] | + wastesedge | [] | + wcd | | + wcd-man | | + wdiff | [] [] [] | + wget | [] [] [] [] | + wyslij-po | [] [] [] | + xboard | | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] [] | + +-------------------------------------------------+ + ga gd gl gu he hi hr hu hy ia id is it ja ka kk + 35 2 47 4 8 2 60 71 2 6 81 11 87 57 0 3 + + kn ko ku ky lg lt lv mk ml mn mr ms mt nb ne nl + +--------------------------------------------------+ + a2ps | [] [] | + aegis | [] | + anubis | [] [] [] | + aspell | [] [] | + bash | [] [] | + bfd | | + binutils | | + bison | [] | + bison-runtime | [] [] [] [] [] [] | + buzztrax | | + ccd2cue | | + ccide | [] [] | + cflow | [] | + clisp | [] | + coreutils | [] [] | + cpio | [] | + cppi | | + cpplib | [] | + cryptsetup | [] | + datamash | [] [] | + denemo | | + dfarc | [] [] | + dialog | [] [] [] [] [] [] | + dico | | + diffutils | [] [] [] | + dink | [] | + direvent | [] | + doodle | [] | + dos2unix | [] [] | + dos2unix-man | [] | + e2fsprogs | [] | + enscript | [] | + exif | [] [] [] | + fetchmail | [] | + findutils | [] [] | + flex | [] | + freedink | [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | | + gcc | | + gdbm | | + gettext-examples | [] [] [] [] [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] | + gjay | | + glunarclock | [] [] | + gnubiff | [] | + gnubik | [] [] | + gnucash | () () () () () () () [] | + gnuchess | [] [] | + gnulib | [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] | + gprof | [] [] | + gramadoir | [] | + grep | [] [] | + grub | [] [] [] | + gsasl | [] | + gss | | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] | + gtkam | [] [] | + gtkspell | [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] | + hello | [] [] [] | + help2man | [] | + help2man-texi | | + hylafax | [] | + idutils | [] | + iso_15924 | () [] [] | + iso_3166 | [] [] [] () [] [] [] [] [] [] | + iso_3166_2 | () [] | + iso_4217 | () [] [] [] | + iso_639 | [] [] () [] [] [] [] | + iso_639_3 | [] () [] | + iso_639_5 | () | + jwhois | [] [] | + kbd | [] | + klavaro | [] [] | + ld | | + leafpad | [] [] [] [] [] | + libc | [] [] | + libexif | [] | + libextractor | [] | + libgnutls | [] [] | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | [] [] | + libidn | [] | + liferea | [] [] [] | + lilypond | [] | + lordsawar | | + lprng | | + lynx | [] | + m4 | [] | + mailfromd | | + mailutils | | + make | [] [] | + man-db | [] | + man-db-manpages | [] | + midi-instruments | [] [] [] [] [] [] [] | + minicom | [] | + mkisofs | [] | + myserver | | + nano | [] [] [] | + opcodes | [] | + parted | [] [] | + pies | | + pnmixer | [] | + popt | [] [] [] [] [] | + procps-ng | | + procps-ng-man | | + psmisc | [] | + pspp | [] [] | + pushover | | + pwdutils | [] | + pyspread | | + radius | [] | + recode | [] [] | + recutils | [] | + rpm | [] | + rush | [] | + sarg | | + sed | [] [] | + sharutils | [] | + shishi | | + skribilo | | + solfege | [] [] | + solfege-manual | [] | + spotmachine | [] | + sudo | [] [] [] | + sudoers | [] [] [] | + sysstat | [] [] | + tar | [] [] [] | + texinfo | [] | + texinfo_document | [] | + tigervnc | [] | + tin | | + tin-man | | + tracgoogleappsa... | [] [] [] | + trader | [] | + util-linux | [] | + ve | [] | + vice | [] | + vmm | [] | + vorbis-tools | [] | + wastesedge | [] | + wcd | [] | + wcd-man | [] | + wdiff | [] | + wget | [] [] | + wyslij-po | [] | + xboard | [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +--------------------------------------------------+ + kn ko ku ky lg lt lv mk ml mn mr ms mt nb ne nl + 5 15 4 6 0 13 23 3 3 3 4 11 2 42 1 125 + + nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + +------------------------------------------------+ + a2ps | [] [] [] [] [] [] [] | + aegis | [] [] | + anubis | [] [] [] | + aspell | [] [] [] [] [] [] [] | + bash | [] [] [] [] [] [] | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] | + bison-runtime | [] [] [] [] [] [] [] [] | + buzztrax | [] | + ccd2cue | [] [] | + ccide | [] [] [] | + cflow | [] [] [] | + clisp | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cppi | [] [] [] | + cpplib | [] [] [] | + cryptsetup | [] [] [] | + datamash | [] [] | + denemo | | + dfarc | [] [] [] | + dialog | [] [] [] [] [] [] [] | + dico | [] | + diffutils | [] [] [] | + dink | | + direvent | [] [] [] | + doodle | [] [] | + dos2unix | [] [] [] [] | + dos2unix-man | [] [] | + e2fsprogs | [] | + enscript | [] [] [] [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + freedink | [] [] [] [] [] | + fusionforge | | + gas | | + gawk | [] | + gcal | | + gcc | | + gdbm | [] [] [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gjay | [] | + glunarclock | [] [] [] [] [] [] | + gnubiff | [] | + gnubik | [] [] [] [] | + gnucash | () () () () () [] | + gnuchess | [] [] | + gnulib | [] [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + grub | [] [] [] [] [] | + gsasl | [] [] [] | + gss | [] [] [] [] | + gst-plugins-bad | [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] | + hello | [] [] [] [] [] [] | + help2man | [] [] [] [] | + help2man-texi | [] | + hylafax | | + idutils | [] [] [] | + iso_15924 | [] () [] [] [] [] | + iso_3166 | [] [] [] [] () [] [] [] [] [] [] [] [] | + iso_3166_2 | [] () [] | + iso_4217 | [] [] () [] [] [] [] [] | + iso_639 | [] [] [] () [] [] [] [] [] [] | + iso_639_3 | [] () | + iso_639_5 | () [] | + jwhois | [] [] [] [] | + kbd | [] [] | + klavaro | [] [] [] [] [] | + ld | | + leafpad | [] [] [] [] [] [] [] [] | + libc | [] [] [] | + libexif | [] () [] | + libextractor | [] | + libgnutls | [] | + libgphoto2 | [] | + libgphoto2_port | [] [] [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] | + libidn | [] [] [] | + liferea | [] [] [] [] () [] [] | + lilypond | | + lordsawar | | + lprng | [] | + lynx | [] [] | + m4 | [] [] [] [] [] | + mailfromd | [] | + mailutils | [] | + make | [] [] [] | + man-db | [] [] [] | + man-db-manpages | [] [] [] | + midi-instruments | [] [] [] [] [] [] [] [] | + minicom | [] [] [] [] | + mkisofs | [] [] [] | + myserver | [] [] | + nano | [] [] [] [] [] [] | + opcodes | | + parted | [] [] [] [] [] [] | + pies | [] | + pnmixer | [] | + popt | [] [] [] [] [] [] | + procps-ng | [] | + procps-ng-man | [] | + psmisc | [] [] [] [] | + pspp | [] [] | + pushover | | + pwdutils | [] | + pyspread | [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + recutils | [] [] | + rpm | [] | + rush | [] [] [] | + sarg | [] [] | + sed | [] [] [] [] [] [] [] [] | + sharutils | [] [] [] | + shishi | [] [] | + skribilo | [] | + solfege | [] [] [] | + solfege-manual | [] [] | + spotmachine | [] [] | + sudo | [] [] [] [] [] [] | + sudoers | [] [] [] [] | + sysstat | [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] [] | + tigervnc | [] [] [] | + tin | [] | + tin-man | | + tracgoogleappsa... | [] [] [] [] | + trader | [] [] | + util-linux | [] [] | + ve | [] [] [] | + vice | | + vmm | | + vorbis-tools | [] [] [] | + wastesedge | | + wcd | | + wcd-man | | + wdiff | [] [] [] [] [] | + wget | [] [] [] [] [] | + wyslij-po | [] [] [] [] | + xboard | [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + +------------------------------------------------+ + nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + 7 3 6 114 1 12 88 32 82 3 40 45 7 101 + + sv sw ta te tg th tr uk ur vi wa wo zh_CN + +----------------------------------------------+ + a2ps | [] [] [] [] [] | + aegis | [] | + anubis | [] [] [] [] | + aspell | [] [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] | + bison-runtime | [] [] [] [] [] [] | + buzztrax | [] [] [] | + ccd2cue | [] [] [] | + ccide | [] [] [] [] | + cflow | [] [] [] [] | + clisp | | + coreutils | [] [] [] | + cpio | [] [] [] [] [] | + cppi | [] [] [] [] | + cpplib | [] [] [] [] [] | + cryptsetup | [] [] [] | + datamash | [] [] [] | + denemo | [] | + dfarc | [] [] | + dialog | [] [] [] [] [] [] | + dico | [] | + diffutils | [] [] [] [] [] | + dink | [] | + direvent | [] [] | + doodle | [] [] | + dos2unix | [] [] [] [] | + dos2unix-man | [] [] [] | + e2fsprogs | [] [] [] [] | + enscript | [] [] [] [] | + exif | [] [] [] [] [] | + fetchmail | [] [] [] [] | + findutils | [] [] [] [] [] | + flex | [] [] [] [] | + freedink | [] [] [] | + fusionforge | | + gas | [] | + gawk | [] [] [] | + gcal | [] [] [] | + gcc | [] | + gdbm | [] [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] [] [] [] | + gjay | [] [] [] | + glunarclock | [] [] [] [] | + gnubiff | [] [] | + gnubik | [] [] [] [] | + gnucash | () () () () [] | + gnuchess | [] [] [] | + gnulib | [] [] [] [] | + gnunet | | + gnunet-gtk | | + gold | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] [] [] | + gramadoir | [] [] [] | + grep | [] [] [] [] [] | + grub | [] [] [] [] | + gsasl | [] [] [] [] | + gss | [] [] [] | + gst-plugins-bad | [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] | + guix | | + guix-packages | | + gutenprint | [] [] [] [] | + hello | [] [] [] [] [] [] | + help2man | [] [] [] | + help2man-texi | [] | + hylafax | [] | + idutils | [] [] [] | + iso_15924 | [] () [] [] () [] | + iso_3166 | [] [] () [] [] () [] [] | + iso_3166_2 | () [] [] () [] | + iso_4217 | [] () [] [] () [] | + iso_639 | [] [] [] () [] [] () [] [] | + iso_639_3 | [] () [] [] () | + iso_639_5 | () [] () | + jwhois | [] [] [] [] | + kbd | [] [] [] [] | + klavaro | [] [] [] [] [] [] | + ld | [] [] [] [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] [] () | + libextractor | [] [] | + libgnutls | [] [] [] [] | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] [] [] | + libidn | () [] [] [] | + liferea | [] [] [] [] [] | + lilypond | [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] [] | + m4 | [] [] [] | + mailfromd | [] [] | + mailutils | [] | + make | [] [] [] [] | + man-db | [] [] [] | + man-db-manpages | [] [] | + midi-instruments | [] [] [] [] [] [] | + minicom | [] [] | + mkisofs | [] [] [] | + myserver | [] | + nano | [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] [] [] | + pies | [] [] | + pnmixer | [] [] [] | + popt | [] [] [] [] [] [] [] | + procps-ng | [] [] | + procps-ng-man | [] | + psmisc | [] [] [] [] | + pspp | [] [] [] | + pushover | [] | + pwdutils | [] [] | + pyspread | [] | + radius | [] [] | + recode | [] [] [] [] | + recutils | [] [] [] | + rpm | [] [] [] [] | + rush | [] [] | + sarg | | + sed | [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] [] | + skribilo | [] [] | + solfege | [] [] [] [] | + solfege-manual | [] | + spotmachine | [] [] [] | + sudo | [] [] [] [] [] | + sudoers | [] [] [] [] | + sysstat | [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + texinfo_document | [] | + tigervnc | [] [] [] | + tin | [] | + tin-man | | + tracgoogleappsa... | [] [] [] [] [] | + trader | [] | + util-linux | [] [] [] [] | + ve | [] [] [] [] | + vice | () () | + vmm | | + vorbis-tools | [] [] | + wastesedge | | + wcd | [] [] [] | + wcd-man | [] | + wdiff | [] [] [] [] | + wget | [] [] [] | + wyslij-po | [] [] | + xboard | [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + +----------------------------------------------+ + sv sw ta te tg th tr uk ur vi wa wo zh_CN + 106 1 4 3 0 13 51 115 1 125 7 1 100 + + zh_HK zh_TW + +-------------+ + a2ps | | 30 + aegis | | 9 + anubis | | 19 + aspell | | 29 + bash | [] | 23 + bfd | | 11 + binutils | | 12 + bison | [] | 18 + bison-runtime | [] | 38 + buzztrax | | 9 + ccd2cue | | 10 + ccide | | 17 + cflow | | 16 + clisp | | 10 + coreutils | | 18 + cpio | | 20 + cppi | | 17 + cpplib | [] | 19 + cryptsetup | | 14 + datamash | | 11 + denemo | | 5 + dfarc | | 17 + dialog | [] | 42 + dico | | 6 + diffutils | | 22 + dink | | 10 + direvent | | 11 + doodle | | 12 + dos2unix | [] | 18 + dos2unix-man | | 9 + e2fsprogs | | 15 + enscript | | 21 + exif | | 27 + fetchmail | | 19 + findutils | | 29 + flex | [] | 19 + freedink | | 24 + fusionforge | | 3 + gas | | 5 + gawk | | 13 + gcal | | 8 + gcc | | 2 + gdbm | | 10 + gettext-examples | [] [] | 40 + gettext-runtime | [] [] | 35 + gettext-tools | [] | 24 + gjay | | 9 + glunarclock | [] | 27 + gnubiff | | 9 + gnubik | | 19 + gnucash | () | 6 + gnuchess | | 11 + gnulib | | 23 + gnunet | | 1 + gnunet-gtk | | 1 + gold | | 7 + gphoto2 | [] | 19 + gprof | | 21 + gramadoir | | 14 + grep | [] | 31 + grub | | 21 + gsasl | [] | 19 + gss | | 17 + gst-plugins-bad | | 21 + gst-plugins-base | | 27 + gst-plugins-good | | 32 + gst-plugins-ugly | | 34 + gstreamer | [] | 32 + gtick | | 19 + gtkam | | 24 + gtkspell | [] [] | 48 + guix | | 2 + guix-packages | | 0 + gutenprint | | 15 + hello | [] | 30 + help2man | | 18 + help2man-texi | | 5 + hylafax | | 5 + idutils | | 14 + iso_15924 | [] | 23 + iso_3166 | [] [] | 58 + iso_3166_2 | | 9 + iso_4217 | [] [] | 28 + iso_639 | [] [] | 46 + iso_639_3 | | 10 + iso_639_5 | | 2 + jwhois | [] | 20 + kbd | | 17 + klavaro | | 30 + ld | [] | 15 + leafpad | [] | 39 + libc | [] | 24 + libexif | | 10 + libextractor | | 5 + libgnutls | | 13 + libgphoto2 | | 10 + libgphoto2_port | [] | 19 + libgsasl | | 18 + libiconv | [] | 29 + libidn | | 17 + liferea | | 29 + lilypond | | 11 + lordsawar | | 3 + lprng | | 3 + lynx | | 19 + m4 | [] | 22 + mailfromd | | 4 + mailutils | | 6 + make | | 19 + man-db | | 15 + man-db-manpages | | 10 + midi-instruments | [] | 43 + minicom | [] | 17 + mkisofs | | 13 + myserver | | 9 + nano | [] | 30 + opcodes | | 12 + parted | [] | 23 + pies | | 4 + pnmixer | | 9 + popt | [] | 36 + procps-ng | | 5 + procps-ng-man | | 4 + psmisc | [] | 22 + pspp | | 13 + pushover | | 6 + pwdutils | | 8 + pyspread | | 6 + radius | | 9 + recode | | 31 + recutils | | 10 + rpm | [] | 13 + rush | | 10 + sarg | | 4 + sed | [] | 35 + sharutils | | 13 + shishi | | 7 + skribilo | | 7 + solfege | | 21 + solfege-manual | | 9 + spotmachine | | 11 + sudo | | 26 + sudoers | | 22 + sysstat | | 23 + tar | [] | 30 + texinfo | | 17 + texinfo_document | | 13 + tigervnc | | 14 + tin | [] | 7 + tin-man | | 1 + tracgoogleappsa... | [] | 22 + trader | | 12 + util-linux | | 13 + ve | | 14 + vice | | 1 + vmm | | 3 + vorbis-tools | | 13 + wastesedge | | 3 + wcd | | 8 + wcd-man | | 3 + wdiff | [] | 23 + wget | | 21 + wyslij-po | | 14 + xboard | | 10 + xdg-user-dirs | [] [] | 68 + xkeyboard-config | [] | 28 + +-------------+ + 89 teams zh_HK zh_TW + 166 domains 7 42 2809 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and distributed +as such by its maintainer. There might be an observable lag between the +mere existence a PO file and its wide availability in a distribution. + + If Jun 2014 seems to be old, you may fetch a more recent copy of this +'ABOUT-NLS' file on most GNU archive sites. The most up-to-date matrix +with full percentage details can be found at +'http://translationproject.org/extra/matrix.html'. + +1.5 Using 'gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU 'gettext' in your +package. Of course you have to respect the GNU Lesser General Public +License which covers the use of the GNU 'gettext' library. This means +in particular that even non-free programs can use 'libintl' as a shared +library, whereas only free software can use 'libintl' as a static +library or use modified versions of 'libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of 'gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +'coordinator@translationproject.org' to make the '.pot' files available +to the translation teams. diff --git a/po/ChangeLog b/po/ChangeLog new file mode 100644 index 0000000..47e3fc0 --- /dev/null +++ b/po/ChangeLog @@ -0,0 +1,5 @@ +2016-09-05 gettextize + + * Makefile.in.in: Upgrade to gettext-0.19.8.1. + * Rules-quot: Upgrade to gettext-0.19.8.1. + diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..4e5c700 --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,516 @@ +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. +# +# Origin: gettext-0.19.8 +GETTEXT_MACRO_VERSION = 0.19 + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + +SED = @SED@ +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +# Modified to fit MHD needs +top_po_srcdir = @top_srcdir@ +top_srcdir = @top_srcdir@/.. +top_po_builddir = $(top_builddir)/po +# See '$(POTFILES):' rule +VPATH = @srcdir@:@srcdir@/po + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +localedir = @localedir@ +gettextsrcdir = $(datadir)/gettext/po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +# We use $(mkdir_p). +# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as +# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, +# @install_sh@ does not start with $(SHELL), so we add it. +# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined +# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake +# versions, $(mkinstalldirs) and $(install_sh) are unused. +mkinstalldirs = $(SHELL) @install_sh@ -d +install_sh = $(SHELL) @install_sh@ +MKDIR_P = @MKDIR_P@ +mkdir_p = @mkdir_p@ + +# When building gettext-tools, we prefer to use the built programs +# rather than installed programs. However, we can't do that when we +# are cross compiling. +CROSS_COMPILING = @CROSS_COMPILING@ + +GMSGFMT_ = @GMSGFMT@ +GMSGFMT_no = @GMSGFMT@ +GMSGFMT_yes = @GMSGFMT_015@ +GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) +MSGFMT_ = @MSGFMT@ +MSGFMT_no = @MSGFMT@ +MSGFMT_yes = @MSGFMT_015@ +MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) +XGETTEXT_ = @XGETTEXT@ +XGETTEXT_no = @XGETTEXT@ +XGETTEXT_yes = @XGETTEXT_015@ +XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) +MSGMERGE = msgmerge +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter + +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) + +POTFILES = \ + +CATALOGS = @CATALOGS@ + +POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot +POFILESDEPS_yes = $(POFILESDEPS_) +POFILESDEPS_no = +POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT)) + +DISTFILESDEPS_ = update-po +DISTFILESDEPS_yes = $(DISTFILESDEPS_) +DISTFILESDEPS_no = +DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO)) + +# Makevars gets inserted here. (Don't remove this line!) + +.SUFFIXES: +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update + +.po.mo: + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +.po.gmo: + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ + + +all: all-@USE_NLS@ + +all-yes: stamp-po +all-no: + +# Ensure that the gettext macros and this Makefile.in.in are in sync. +CHECK_MACRO_VERSION = \ + test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ + || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ + exit 1; \ + } + +# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no +# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because +# we don't want to bother translators with empty POT files). We assume that +# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. +# In this case, stamp-po is a nop (i.e. a phony target). + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + @$(CHECK_MACRO_VERSION) + test ! -f $(srcdir)/$(DOMAIN).pot || \ + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @test ! -f $(srcdir)/$(DOMAIN).pot || { \ + echo "touch stamp-po" && \ + echo timestamp > stamp-poT && \ + mv stamp-poT stamp-po; \ + } + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +# The determination of whether the package xyz is a GNU one is based on the +# heuristic whether some file in the top level directory mentions "GNU xyz". +# If GNU 'find' is available, we avoid grepping through monster files. +# Modified to fit MHD needs +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + package_gnu="$(PACKAGE_GNU)"; \ + test -n "$$package_gnu" || { \ + if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \ + LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f \ + -size -10000000c -exec grep 'GNU @PACKAGE@' \ + /dev/null '{}' ';' 2>/dev/null; \ + else \ + LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \ + fi; \ + } | grep -v 'libtool:' >/dev/null; then \ + package_gnu=yes; \ + else \ + package_gnu=no; \ + fi; \ + }; \ + if test "$$package_gnu" = "yes"; then \ + package_prefix='GNU '; \ + else \ + package_prefix=''; \ + fi; \ + if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ + msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ + else \ + msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ + fi; \ + case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_po_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + *) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_po_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --package-name="$${package_prefix}@PACKAGE@" \ + --package-version='$(VERSION)' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + esac + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot-header; then \ + sed -e '1,/^#$$/d' < $(DOMAIN).po > $(DOMAIN).1po && \ + cat $(srcdir)/$(DOMAIN).pot-header $(DOMAIN).1po > $(DOMAIN).po; \ + rm -f $(DOMAIN).1po; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(POFILESDEPS) + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + if test -f "$(srcdir)/$${lang}.po"; then \ + test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) \ + && { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \ + esac; \ + }; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +install-data-no: all +install-data-yes: all + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done + +check: all + +info dvi ps pdf html tags TAGS ctags CTAGS ID: + +# Modified for MHD +mostlyclean: + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po + rm -fr *.o + rm -fr po + +clean: mostlyclean + +# Modified to fit MHD needs +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo + rm -f config.status config.cache config.log configure.lineno config.status.lineno stamp-po + +# Modified to fit MHD needs +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f $(GMOFILES) + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +# Added for MHD +# If source path is in absolute form, POTFILES generated with correct path, +# but if source path in relative form (forced by 'configure' for inplace builds) +# then POTFILES is generated with extra '..' ('po-directories' in config.status +# think that '.' is subdirectory and add additional '..' to path to source files) +# This rule create additional 'po' subdirectory which is included in VPATH. +$(POTFILES): + @ case "$(srcdir)" in \ + /* ) : ;; \ + * ) @mkdir_p@ po ;; \ + esac + +# Modified to fit MHD needs +mkdistdir: + @ $(mkdir_p) $(distdir) + @ case "$(srcdir)" in \ + /* ) : ;; \ + * ) @mkdir_p@ po ;; \ + esac + +# Modified to fit MHD needs +dist distdir: mkdistdir + test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS) + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: stamp-po $(DISTFILES) + dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + dists="$$dists $(DOMAIN).pot stamp-po"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ + for file in $$dists; do \ + if test -f $$file; then \ + cp -p $$file $(distdir) || exit 1; \ + else \ + cp -p $(srcdir)/$$file $(distdir) || exit 1; \ + fi; \ + done + +update-po: Makefile + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) + $(MAKE) update-gmo + +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + esac; \ + }; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + +update-gmo: Makefile $(GMOFILES) + @: + +# Recreate Makefile by invoking config.status. Explicitly invoke the shell, +# because execution permission bits may not work on the current file system. +# Use @SHELL@, which is the shell determined by autoconf for the use by its +# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient. +# Note: Fixed missging 'srcdir', Modified to fit MHD needs +Makefile: $(srcdir)/Makefile.in.in $(srcdir)/Makevars $(top_po_builddir)/config.status @POMAKEFILEDEPS@ + cd $(top_po_builddir) \ + && @SHELL@ ./config.status ./$@.in po-directories + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..47e8415 --- /dev/null +++ b/po/Makevars @@ -0,0 +1,78 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Christian Grothoff + +# This tells whether or not to prepend "GNU " prefix to the package +# name that gets inserted into the header of the $(DOMAIN).pot file. +# Possible values are "yes", "no", or empty. If it is empty, try to +# detect it automatically by scanning the files in $(top_srcdir) for +# "GNU packagename" string. +PACKAGE_GNU = yes + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = libmicrohttpd@gnu.org + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = + +# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' +# context. Possible values are "yes" and "no". Set this to yes if the +# package uses functions taking also a message context, like pgettext(), or +# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. +USE_MSGCTXT = no + +# These options get passed to msgmerge. +# Useful options are in particular: +# --previous to keep previous msgids of translated messages, +# --quiet to reduce the verbosity. +MSGMERGE_OPTIONS = + +# These options get passed to msginit. +# If you want to disable line wrapping when writing PO files, add +# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and +# MSGINIT_OPTIONS. +MSGINIT_OPTIONS = + +# This tells whether or not to regenerate a PO file when $(DOMAIN).pot +# has changed. Possible values are "yes" and "no". Set this to no if +# the POT file is checked in the repository and the version control +# program ignores timestamps. +PO_DEPENDS_ON_POT = yes + +# This tells whether or not to forcibly update $(DOMAIN).pot and +# regenerate PO files on "make dist". Possible values are "yes" and +# "no". Set this to no if the POT file and PO files are maintained +# externally. +DIST_DEPENDS_ON_UPDATE_PO = yes diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..6d39578 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,44 @@ +../src/include/platform.h +../src/include/microhttpd2.h +../src/include/microhttpd.h +../src/include/autoinit_funcs.h +../src/microhttpd/base64.h +../src/microhttpd/mhd_mono_clock.h +../src/microhttpd/tsearch.h +../src/microhttpd/connection_https.c +../src/microhttpd/reason_phrase.c +../src/microhttpd/mhd_itc_types.h +../src/microhttpd/sysfdsetsize.h +../src/microhttpd/mhd_threads.h +../src/microhttpd/mhd_sockets.c +../src/microhttpd/mhd_threads.c +../src/microhttpd/mhd_str.h +../src/microhttpd/mhd_compat.c +../src/microhttpd/tsearch.c +../src/microhttpd/internal.c +../src/microhttpd/mhd_byteorder.h +../src/microhttpd/mhd_locks.h +../src/microhttpd/memorypool.h +../src/microhttpd/memorypool.c +../src/microhttpd/connection.h +../src/microhttpd/internal.h +../src/microhttpd/digestauth.c +../src/microhttpd/sysfdsetsize.c +../src/microhttpd/md5.h +../src/microhttpd/postprocessor.c +../src/microhttpd/response.h +../src/microhttpd/mhd_str.c +../src/microhttpd/daemon.c +../src/microhttpd/mhd_assert.h +../src/microhttpd/mhd_mono_clock.c +../src/microhttpd/base64.c +../src/microhttpd/md5.c +../src/microhttpd/mhd_sockets.h +../src/microhttpd/mhd_compat.h +../src/microhttpd/connection.c +../src/microhttpd/response.c +../src/microhttpd/mhd_itc.h +../src/microhttpd/connection_https.h +../src/microhttpd/mhd_limits.h +../src/microhttpd/mhd_itc.c +../src/microhttpd/basicauth.c diff --git a/po/Rules-quot b/po/Rules-quot new file mode 100644 index 0000000..baf6528 --- /dev/null +++ b/po/Rules-quot @@ -0,0 +1,58 @@ +# This file, Rules-quot, can be copied and used freely without restrictions. +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) $(MSGINIT_OPTIONS) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null \ + | $(SED) -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | \ + { case `$(MSGFILTER) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-8] | 0.1[0-8].*) \ + $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed \ + ;; \ + *) \ + $(MSGFILTER) `echo $$lang | sed -e 's/.*@//'` \ + ;; \ + esac } 2>/dev/null > $$tmpdir/$$lang.new.po \ + ; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/po/boldquot.sed b/po/boldquot.sed new file mode 100644 index 0000000..4b937aa --- /dev/null +++ b/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g +s/“/“/g +s/”/”/g +s/‘/‘/g +s/’/’/g diff --git a/po/configure b/po/configure new file mode 100755 index 0000000..5b57288 --- /dev/null +++ b/po/configure @@ -0,0 +1,7615 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for GNU Libmicrohttpd 0.9.59. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 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=: + # Pre-4.2 versions of Zsh do 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_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +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.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do 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_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: libmicrohttpd@gnu.org about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_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 || +$as_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" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # 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" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # 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 +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +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 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + 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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +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='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/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= + +# Identity of this package. +PACKAGE_NAME='GNU Libmicrohttpd' +PACKAGE_TARNAME='libmicrohttpd' +PACKAGE_VERSION='0.9.59' +PACKAGE_STRING='GNU Libmicrohttpd 0.9.59' +PACKAGE_BUGREPORT='libmicrohttpd@gnu.org' +PACKAGE_URL='http://www.gnu.org/software/libmicrohttpd/' + +ac_unique_file="Makevars" +gt_needs= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +POSUB +LTLIBINTL +LIBINTL +INTLLIBS +LTLIBICONV +LIBICONV +INTL_MACOSX_LIBS +EGREP +GREP +CPP +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +XGETTEXT_EXTRA_OPTIONS +MSGMERGE +XGETTEXT_015 +XGETTEXT +GMSGFMT_015 +MSGFMT_015 +GMSGFMT +MSGFMT +GETTEXT_MACRO_VERSION +USE_NLS +SED +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_nls +enable_dependency_tracking +with_gnu_ld +enable_rpath +with_libiconv_prefix +with_libintl_prefix +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# 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' +runstatedir='${localstatedir}/run' +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= ;; + *) 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_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=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_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_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'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +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 runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +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 + 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 .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + 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 .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + 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 GNU Libmicrohttpd 0.9.59 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] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --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/libmicrohttpd] + --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 + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of GNU Libmicrohttpd 0.9.59:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --disable-nls do not use Native Language Support + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --disable-rpath do not hardcode runtime library paths + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + 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 . +GNU Libmicrohttpd home page: . +General help using GNU software: . +_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" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && 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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_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 + $as_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 +GNU Libmicrohttpd configure 0.9.59 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 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 + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run +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 GNU Libmicrohttpd $as_me 0.9.59, which was +generated by GNU Autoconf 2.69. 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=. + $as_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=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append 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 + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset 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 + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + 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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; 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 + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_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'; as_fn_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 + +$as_echo "/* confdefs.h */" > 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 + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + 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. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +gt_needs="$gt_needs " +# 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,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_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 + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_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. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +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 + + + + + +ac_aux_dir= +for ac_dir in .. "$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 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in .. \"$srcdir\"/.." "$LINENO" 5 +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. + + +am__api_version='1.15' + +# 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. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$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' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# 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 ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + 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 + 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". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +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 $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&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 + as_fn_executable_p "$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 + + test -d ./--version && rmdir ./--version + 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. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +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 + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + 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='libmicrohttpd' + VERSION='0.9.59' + + +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"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_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 +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_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_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then : + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + + GETTEXT_MACRO_VERSION=0.19 + + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GMSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac + + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_XGETTEXT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + rm -f messages.po + + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGMERGE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 +$as_echo "$MSGMERGE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$localedir" || localedir='${datadir}/locale' + + + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + + + ac_config_commands="$ac_config_commands po-directories" + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_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='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$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" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM 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. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 | *.dSYM | *.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 +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* 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" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +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) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +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 + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +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 + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&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". + rm -rf conftest.dir + 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 + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + 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 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # 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. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + 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 + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj 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 $am__obj 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$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 + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&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 to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$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 to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +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 + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + 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" + as_fn_executable_p "$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 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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 + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + 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" + as_fn_executable_p "$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 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_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 + as_fn_arith $ac_count + 1 && ac_count=$as_val + 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 + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 +$as_echo_n "checking for ld... " >&6; } +elif test "$GCC" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test -n "$LD"; then + # Let the user override the test with a path. + : +else + if ${acl_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + + acl_cv_path_LD= # Final result of this test + ac_prog=ld # Program to search in $PATH + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + acl_output=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $acl_output in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` + while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do + acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` + done + # Got the pathname. No search in PATH is needed. + acl_cv_path_LD="$acl_output" + ac_prog= + ;; + "") + # If it fails, then pretend we aren't using GCC. + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + fi + if test -n "$ac_prog"; then + # Search for $ac_prog in $PATH. + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 conftest.$ac_ext +/* end confdefs.h. */ +#if defined __powerpc64__ || defined _ARCH_PPC64 + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + # The compiler produces 64-bit code. Add option '-b64' so that the + # linker groks 64-bit object files. + case "$acl_cv_path_LD " in + *" -b64 "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; + esac + +fi +rm -f conftest* + + ;; + esac + +fi + + LD="$acl_cv_path_LD" +fi +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${acl_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$acl_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 +$as_echo_n "checking for shared library run path origin... " >&6; } +if ${acl_cv_rpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 +$as_echo "$acl_cv_rpath" >&6; } + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; : +else + enable_rpath=yes +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 +$as_echo_n "checking for the common suffixes of directories in the library search path... " >&6; } +if ${acl_cv_libdirstems+:} false; then : + $as_echo_n "(cached) " >&6 +else + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 +$as_echo_n "checking for 64-bit host... " >&6; } +if ${gl_cv_solaris_64bit+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _LP64 +sixtyfour bits +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sixtyfour bits" >/dev/null 2>&1; then : + gl_cv_solaris_64bit=yes +else + gl_cv_solaris_64bit=no +fi +rm -f conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 +$as_echo "$gl_cv_solaris_64bit" >&6; } + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(if test -f /usr/bin/gcc \ + && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ + LC_ALL=C /usr/bin/gcc -print-search-dirs; \ + else \ + LC_ALL=C $CC -print-search-dirs; \ + fi) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 +$as_echo "$acl_cv_libdirstems" >&6; } + # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. + acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` + + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then : + withval=$with_libiconv_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBICONV= + LTLIBICONV= + INCICONV= + LIBICONV_PREFIX= + HAVE_LIBICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 +$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } +if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFPreferencesCopyAppValue(NULL, NULL) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFPreferencesCopyAppValue=yes +else + gt_cv_func_CFPreferencesCopyAppValue=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + +$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 +$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } +if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFLocaleCopyCurrent(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFLocaleCopyCurrent=yes +else + gt_cv_func_CFLocaleCopyCurrent=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + +$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h + + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + + + + + + + LIBINTL= + LTLIBINTL= + POSUB= + + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 +$as_echo_n "checking for GNU gettext in libc... " >&6; } +if eval \${$gt_func_gnugettext_libc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libc=yes" +else + eval "$gt_func_gnugettext_libc=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$gt_func_gnugettext_libc + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if ${am_cv_func_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +$as_echo_n "checking for working iconv... " >&6; } +if ${am_cv_func_iconv_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + if test "$cross_compiling" = yes; then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + +int +main () +{ +int result = 0; + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\263"; + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 2; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + ICONV_CONST char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 4; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + result |= 16; + return result; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + am_cv_func_iconv_works=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + test "$am_cv_func_iconv_works" = no || break + done + LIBS="$am_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +$as_echo "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + +$as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then : + withval=$with_libintl_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBINTL= + LTLIBINTL= + INCINTL= + LIBINTL_PREFIX= + HAVE_LIBINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 +$as_echo_n "checking for GNU gettext in libintl... " >&6; } +if eval \${$gt_func_gnugettext_libintl+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libintl=yes" +else + eval "$gt_func_gnugettext_libintl=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + +int +main () +{ + +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +eval ac_res=\$$gt_func_gnugettext_libintl + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + fi + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +$as_echo "#define ENABLE_NLS 1" >>confdefs.h + + else + USE_NLS=no + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 +$as_echo_n "checking whether to use NLS... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + if test "$USE_NLS" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 +$as_echo_n "checking where the gettext function comes from... " >&6; } + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 +$as_echo "$gt_source" >&6; } + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 +$as_echo_n "checking how to link with libintl... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 +$as_echo "$LIBINTL" >&6; } + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h + + +$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h + + fi + + POSUB=po + fi + + + + INTLLIBS="$LIBINTL" + + + + + + + +# gettext expect that 'po' files will stay in subdirectory. +# Form './Makefile.in' is accepted by gettext as subdirectory but caused some +# troubles with in-place build (with relative path to source files). To workaround +# this, some hack are used in Makefile. +ac_config_files="$ac_config_files ./Makefile.in" + +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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; 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 + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_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}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +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=`$as_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. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $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} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## 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=: + # Pre-4.2 versions of Zsh do 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_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +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.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +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 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + 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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_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 || +$as_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" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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 GNU Libmicrohttpd $as_me 0.9.59, which was +generated by GNU Autoconf 2.69. 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 + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + 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 + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to . +GNU Libmicrohttpd home page: . +General help using GNU software: ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +GNU Libmicrohttpd config.status 0.9.59 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 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' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +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=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + 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 ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_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. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append 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 || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "./Makefile.in") CONFIG_FILES="$CONFIG_FILES ./Makefile.in" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + 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_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= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[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="$ac_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 || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append 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 '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + 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 || +$as_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"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_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 || ac_write_fail=1 +# 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= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + 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 || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;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 +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_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 "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "po-directories":C) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + gt_tab=`printf '\t'` + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assignment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assignment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + 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 || +$as_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"` + # 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'`; 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 || +$as_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; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# 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 || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/po/configure.ac b/po/configure.ac new file mode 100644 index 0000000..37c40c8 --- /dev/null +++ b/po/configure.ac @@ -0,0 +1,17 @@ +# This configure.ac.in is in the public domain + +# Use versions from parent configure +AC_INIT([GNU Libmicrohttpd], [0.9.59], [libmicrohttpd@gnu.org]) + +AC_CONFIG_SRCDIR([Makevars]) +AC_CONFIG_MACRO_DIR([../m4]) +AC_CONFIG_AUX_DIR([..]) +AM_INIT_AUTOMAKE([silent-rules]) + +AM_GNU_GETTEXT([external]) + +# gettext expect that 'po' files will stay in subdirectory. +# Form './Makefile.in' is accepted by gettext as subdirectory but caused some +# troubles with in-place build (with relative path to source files). To workaround +# this, some hack are used in Makefile. +AC_OUTPUT([./Makefile.in]) diff --git a/po/configure.ac.in b/po/configure.ac.in new file mode 100644 index 0000000..c0b9866 --- /dev/null +++ b/po/configure.ac.in @@ -0,0 +1,17 @@ +# This configure.ac.in is in the public domain + +# Use versions from parent configure +AC_INIT([@PACKAGE_NAME@], [@PACKAGE_VERSION@], [@PACKAGE_BUGREPORT@]) + +AC_CONFIG_SRCDIR([Makevars]) +AC_CONFIG_MACRO_DIR([../m4]) +AC_CONFIG_AUX_DIR([..]) +AM_INIT_AUTOMAKE([silent-rules]) + +AM_GNU_GETTEXT([external]) + +# gettext expect that 'po' files will stay in subdirectory. +# Form './Makefile.in' is accepted by gettext as subdirectory but caused some +# troubles with in-place build (with relative path to source files). To workaround +# this, some hack are used in Makefile. +AC_OUTPUT([./Makefile.in]) diff --git a/po/en@boldquot.header b/po/en@boldquot.header new file mode 100644 index 0000000..fedb6a0 --- /dev/null +++ b/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/po/en@quot.header b/po/en@quot.header new file mode 100644 index 0000000..a9647fc --- /dev/null +++ b/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/po/insert-header.sin b/po/insert-header.sin new file mode 100644 index 0000000..b26de01 --- /dev/null +++ b/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/libmicrohttpd.pot b/po/libmicrohttpd.pot new file mode 100644 index 0000000..5b455a8 --- /dev/null +++ b/po/libmicrohttpd.pot @@ -0,0 +1,746 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Christian Grothoff +# This file is distributed under the same license as the GNU libmicrohttpd package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: GNU libmicrohttpd 0.9.59\n" +"Report-Msgid-Bugs-To: libmicrohttpd@gnu.org\n" +"POT-Creation-Date: 2018-02-01 20:17+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../src/microhttpd/connection_https.c:174 +msgid "Error: received handshake message out of context\n" +msgstr "" + +#: ../src/microhttpd/mhd_locks.h:120 +msgid "Failed to destroy mutex.\n" +msgstr "" + +#: ../src/microhttpd/mhd_locks.h:153 +msgid "Failed to lock mutex.\n" +msgstr "" + +#: ../src/microhttpd/mhd_locks.h:179 +msgid "Failed to unlock mutex.\n" +msgstr "" + +#: ../src/microhttpd/internal.h:80 +msgid "Failed to close FD.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:444 +msgid "" +"Stale nonce received. If this happens a lot, you should probably increase " +"the size of the nonce array.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:632 +msgid "Failed to allocate memory for copy of URI arguments\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:761 +msgid "Authentication failed, invalid timestamp format.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:822 +msgid "Authentication failed, invalid format.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:832 +msgid "Authentication failed, invalid nc format.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:858 +msgid "Failed to allocate memory for auth header processing\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:898 +msgid "Authentication failed, URI does not match.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:918 +msgid "Authentication failed, arguments do not match.\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:973 +msgid "Could not register nonce (is the nonce array size zero?).\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:996 +msgid "Failed to allocate memory for auth response header\n" +msgstr "" + +#: ../src/microhttpd/digestauth.c:1030 +msgid "Failed to add Digest auth header\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:136 +#, c-format +msgid "Fatal error in GNU libmicrohttpd %s:%u: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:397 +msgid "Failed to add IP connection count node\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:455 +msgid "Failed to find previously-added IP address\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:461 +msgid "Previously-added IP address had counter of zero\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:538 +msgid "" +"Failed to setup x509 certificate/key: pre 3.X.X version of GnuTLS does not " +"support setting key password" +msgstr "" + +#: ../src/microhttpd/daemon.c:588 +#, c-format +msgid "Error: invalid credentials type %d specified.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:986 +#, c-format +msgid "Maximum socket in select set: %d\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1047 +msgid "" +"MHD_get_fdset2() called with except_fd_set set to NULL. Such behavior is " +"unsupported.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1253 ../src/microhttpd/daemon.c:6187 +msgid "" +"Initiated daemon shutdown while \"upgraded\" connection was not closed.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1267 ../src/microhttpd/daemon.c:1502 +msgid "Failed to forward to application " +msgstr "" + +#: ../src/microhttpd/daemon.c:1434 ../src/microhttpd/daemon.c:1556 +msgid "Failed to forward to remote client " +msgstr "" + +#: ../src/microhttpd/daemon.c:1621 +msgid "Error preparing select\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1655 ../src/microhttpd/daemon.c:1806 +#: ../src/microhttpd/daemon.c:1950 +#, c-format +msgid "Error during select (%d): `%s'\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1704 ../src/microhttpd/daemon.c:1827 +#: ../src/microhttpd/daemon.c:2019 +#, c-format +msgid "Error during poll: `%s'\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:1790 ../src/microhttpd/daemon.c:1932 +msgid "Failed to add FD to fd_set\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2073 +msgid "Processing thread terminating. Closing connection\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2212 ../src/microhttpd/daemon.c:5855 +#, c-format +msgid "Socket descriptor larger than FD_SETSIZE: %d > %d\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2228 +#, c-format +msgid "Failed to set SO_NOSIGPIPE on accepted socket: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2245 ../src/microhttpd/daemon.c:3000 +#, c-format +msgid "Accepted connection on socket %d\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2257 ../src/microhttpd/daemon.c:2422 +msgid "Server reached connection limit. Closing inbound connection.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2275 +msgid "Connection rejected by application. Closing connection.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2308 ../src/microhttpd/daemon.c:2328 +#: ../src/microhttpd/daemon.c:3574 +#, c-format +msgid "Error allocating memory: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2381 +#, c-format +msgid "Failed to setup TLS credentials: unknown credential type %d\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2390 +msgid "Unknown credential type" +msgstr "" + +#: ../src/microhttpd/daemon.c:2484 ../src/microhttpd/daemon.c:4064 +#: ../src/microhttpd/daemon.c:4095 ../src/microhttpd/daemon.c:5188 +#: ../src/microhttpd/daemon.c:5205 ../src/microhttpd/connection.c:3772 +#: ../src/microhttpd/response.c:912 ../src/microhttpd/response.c:938 +#, c-format +msgid "Call to epoll_ctl failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2509 +msgid "Failed to signal new connection via inter-thread communication channel." +msgstr "" + +#: ../src/microhttpd/daemon.c:2606 ../src/microhttpd/daemon.c:3081 +#: ../src/microhttpd/daemon.c:6089 ../src/microhttpd/connection.c:989 +#: ../src/microhttpd/connection.c:1008 +msgid "Failed to remove FD from epoll set\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2653 +msgid "Cannot suspend connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2659 +msgid "Error: connection scheduled for \"upgrade\" cannot be suspended" +msgstr "" + +#: ../src/microhttpd/daemon.c:2683 +msgid "Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2693 +msgid "Failed to signal resume via inter-thread communication channel." +msgstr "" + +#: ../src/microhttpd/daemon.c:2810 +msgid "" +"Failed to signal resume of connection via inter-thread communication channel." +msgstr "" + +#: ../src/microhttpd/daemon.c:2856 +#, c-format +msgid "Failed to set nonblocking mode on new client socket: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2869 +msgid "Failed to set noninheritable mode on new client socket.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2942 +#, c-format +msgid "Error accepting connection: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2959 +msgid "" +"Hit process or system resource limit at FIRST connection. This is really bad " +"as there is no sane way to proceed. Will try busy waiting for system " +"resources to become magically available.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2969 +#, c-format +msgid "" +"Hit process or system resource limit at %u connections, temporarily " +"suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2981 +#, c-format +msgid "Failed to set nonblocking mode on incoming connection socket: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:2993 +msgid "Failed to set noninheritable mode on incoming connection socket.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3039 ../src/microhttpd/daemon.c:6228 +#: ../src/microhttpd/daemon.c:6258 ../src/microhttpd/daemon.c:6355 +msgid "Failed to join a thread\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3138 +msgid "Illegal call to MHD_get_timeout\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3334 +msgid "" +"MHD_run_from_select() called with except_fd_set set to NULL. Such behavior " +"is deprecated.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3411 +msgid "Could not obtain daemon fdsets" +msgstr "" + +#: ../src/microhttpd/daemon.c:3428 +msgid "Could not add listen socket to fdset" +msgstr "" + +#: ../src/microhttpd/daemon.c:3456 +msgid "Could not add control inter-thread communication channel FD to fdset" +msgstr "" + +#: ../src/microhttpd/daemon.c:3512 +#, c-format +msgid "select failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3656 ../src/microhttpd/daemon.c:3802 +#, c-format +msgid "poll failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:3935 ../src/microhttpd/daemon.c:4162 +#, c-format +msgid "Call to epoll_wait failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4114 ../src/microhttpd/daemon.c:4562 +msgid "Failed to remove listen FD from epoll set\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4570 +msgid "Failed to signal quiesce via inter-thread communication channel" +msgstr "" + +#: ../src/microhttpd/daemon.c:4589 +msgid "failed to signal quiesce via inter-thread communication channel" +msgstr "" + +#: ../src/microhttpd/daemon.c:4694 +msgid "Warning: Too large timeout value, ignored.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4734 +msgid "" +"Warning: Zero size, specified for thread pool size, is ignored. Thread pool " +"is not used.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4742 +msgid "" +"Warning: \"1\", specified for thread pool size, is ignored. Thread pool is " +"not used.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4754 +#, c-format +msgid "Specified thread pool size (%u) too big\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4765 +msgid "" +"MHD_OPTION_THREAD_POOL_SIZE option is specified but " +"MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4774 +msgid "" +"Both MHD_OPTION_THREAD_POOL_SIZE option and MHD_USE_THREAD_PER_CONNECTION " +"flag are specified.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4789 ../src/microhttpd/daemon.c:4800 +#: ../src/microhttpd/daemon.c:4811 ../src/microhttpd/daemon.c:4822 +#: ../src/microhttpd/daemon.c:4864 +#, c-format +msgid "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4841 +msgid "Error initializing DH parameters\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4853 +msgid "Bad Diffie-Hellman parameters format\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4881 +#, c-format +msgid "Setting priorities to `%s' failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4894 +msgid "" +"MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4921 +msgid "" +"MHD_OPTION_LISTEN_SOCKET specified for daemon with MHD_USE_NO_LISTEN_SOCKET " +"flag set.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:4968 +msgid "" +"Flag MHD_USE_PEDANTIC_CHECKS is ignored because another behavior is " +"specified by MHD_OPTION_STRICT_CLIENT.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5096 +#, c-format +msgid "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5102 +#, c-format +msgid "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5132 +#, c-format +msgid "Call to epoll_create1 failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5142 +msgid "Failed to set noninheritable mode on epoll FD.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5383 +msgid "" +"Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with " +"MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD was " +"added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5425 +msgid "Using debug build of libmicrohttpd.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5435 +#, c-format +msgid "Failed to create inter-thread communication channel: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5451 +msgid "" +"file descriptor for inter-thread communication channel exceeds maximum " +"value\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5471 +msgid "Specified value for NC_SIZE too large\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5485 +#, c-format +msgid "Failed to allocate memory for nonce-nc map: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5501 +msgid "MHD failed to initialize nonce-nc mutex\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5519 +msgid "MHD thread pooling only works with MHD_USE_INTERNAL_POLLING_THREAD\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5533 +#, c-format +msgid "Failed to create socket for listening: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5554 ../src/microhttpd/daemon.c:5573 +#: ../src/microhttpd/daemon.c:5596 ../src/microhttpd/daemon.c:5633 +#: ../src/microhttpd/daemon.c:5710 ../src/microhttpd/daemon.c:5741 +#, c-format +msgid "setsockopt failed: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5606 +msgid "Cannot allow listening address reuse: SO_REUSEPORT not defined\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5641 +msgid "" +"Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5721 +#, c-format +msgid "Failed to bind to port %u: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5752 +#, c-format +msgid "Failed to listen for connections: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5779 +#, c-format +msgid "Failed to get listen port number: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5789 +msgid "" +"Failed to get listen port number (`struct sockaddr_storage` too small!?)\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5822 +msgid "Unknown address family!\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5835 +#, c-format +msgid "Failed to set nonblocking mode on listening socket: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5872 +msgid "" +"Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5885 ../src/microhttpd/daemon.c:5898 +msgid "MHD failed to initialize IP connection limit mutex\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5914 +msgid "Failed to initialize TLS support\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5938 +#, c-format +msgid "Failed to create listen thread: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5986 +#, c-format +msgid "Failed to create worker inter-thread communication channel: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:5997 +msgid "" +"File descriptor for worker inter-thread communication channel exceeds " +"maximum value\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6022 +msgid "MHD failed to initialize cleanup connection mutex\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6036 +#, c-format +msgid "Failed to create pool thread: %s\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6174 ../src/microhttpd/daemon.c:6205 +msgid "MHD_stop_daemon() called while we have suspended connections.\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6214 ../src/microhttpd/daemon.c:6337 +msgid "Failed to signal shutdown via inter-thread communication channel" +msgstr "" + +#: ../src/microhttpd/daemon.c:6298 +msgid "Failed to signal shutdown via inter-thread communication channel." +msgstr "" + +#: ../src/microhttpd/daemon.c:6752 +msgid "Failed to initialize winsock\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6755 +msgid "Winsock version 2.2 is not available\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6763 ../src/microhttpd/daemon.c:6767 +msgid "Failed to initialise multithreading in libgcrypt\n" +msgstr "" + +#: ../src/microhttpd/daemon.c:6772 +msgid "libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n" +msgstr "" + +#: ../src/microhttpd/mhd_sockets.h:248 +msgid "Close socket failed.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1112 +msgid "Closing connection (application reported error generating data)\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1161 +msgid "Closing connection (out of memory)\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1206 +msgid "Closing connection (application error generating response)\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1764 +#, c-format +msgid "" +"Error processing request (HTTP response code is %u (`%s')). Closing " +"connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1787 ../src/microhttpd/connection.c:3495 +#: ../src/microhttpd/connection.c:3606 +msgid "Closing connection (failed to create response header)\n" +msgstr "" + +#: ../src/microhttpd/connection.c:1833 ../src/microhttpd/connection.c:2881 +#: ../src/microhttpd/connection.c:2949 ../src/microhttpd/connection.c:3260 +#, c-format +msgid "In function %s handling connection at state: %s\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2048 +msgid "Not enough memory in pool to allocate header record!\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2090 +msgid "Not enough memory in pool to parse cookies!\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2295 ../src/microhttpd/connection.c:2480 +msgid "Application reported internal error, closing connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2348 ../src/microhttpd/connection.c:2425 +msgid "" +"Received malformed HTTP request (bad chunked encoding). Closing connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2488 +msgid "libmicrohttpd API violation" +msgstr "" + +#: ../src/microhttpd/connection.c:2503 +msgid "" +"WARNING: incomplete upload processing and connection not suspended may " +"result in hung connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2573 +msgid "Received malformed line (no colon). Closing connection.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2725 +msgid "Received HTTP 1.1 request without `Host' header.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2860 +msgid "Socket disconnected while reading request.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2866 +msgid "Connection socket is closed due to error when reading request.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2975 +#, c-format +msgid "Failed to send data in request for %s.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:2984 +#, c-format +msgid "Sent 100 continue response: `%.*s'\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3008 +msgid "Connection was closed while sending response headers.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3047 +msgid "Data offset exceeds limit" +msgstr "" + +#: ../src/microhttpd/connection.c:3056 +#, c-format +msgid "Sent %d-byte DATA response: `%.*s'\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3071 +#, c-format +msgid "Failed to send data in request for `%s'.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3099 ../src/microhttpd/connection.c:3127 +msgid "Connection was closed while sending response body.\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3153 +msgid "Internal error\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3222 +msgid "" +"Failed to signal end of connection via inter-thread communication channel" +msgstr "" + +#: ../src/microhttpd/connection.c:3955 +msgid "Attempted to queue response on wrong thread!\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3965 +msgid "" +"Attempted 'upgrade' connection on daemon without MHD_ALLOW_UPGRADE option!\n" +msgstr "" + +#: ../src/microhttpd/connection.c:3974 +msgid "Application used invalid status code for 'upgrade' response!\n" +msgstr "" + +#: ../src/microhttpd/response.c:774 +msgid "" +"Invalid response for upgrade: application failed to set the 'Upgrade' " +"header!\n" +msgstr "" + +#: ../src/microhttpd/response.c:815 +msgid "Failed to make loopback sockets non-blocking.\n" +msgstr "" + +#: ../src/microhttpd/response.c:834 +msgid "Failed to set SO_NOSIGPIPE on loopback sockets.\n" +msgstr "" + +#: ../src/microhttpd/response.c:854 +#, c-format +msgid "Socketpair descriptor larger than FD_SETSIZE: %d > %d\n" +msgstr "" + +#: ../src/microhttpd/response.c:935 +msgid "Error cleaning up while handling epoll error" +msgstr "" + +#: ../src/microhttpd/mhd_itc.h:347 +msgid "Failed to destroy ITC.\n" +msgstr "" + +#: ../src/microhttpd/basicauth.c:67 +msgid "Error decoding basic authentication\n" +msgstr "" + +#: ../src/microhttpd/basicauth.c:77 +msgid "Basic authentication doesn't contain ':' separator\n" +msgstr "" + +#: ../src/microhttpd/basicauth.c:95 +msgid "Failed to allocate memory for password\n" +msgstr "" + +#: ../src/microhttpd/basicauth.c:158 +msgid "Failed to add Basic auth header\n" +msgstr "" diff --git a/po/quot.sed b/po/quot.sed new file mode 100644 index 0000000..0122c46 --- /dev/null +++ b/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1”/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“”/""/g diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin new file mode 100644 index 0000000..2436c49 --- /dev/null +++ b/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/stamp-po b/po/stamp-po new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..09af041 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,19 @@ +# This Makefile.am is in the public domain +if HAVE_CURL +curltests = testcurl +if HAVE_ZZUF +if HAVE_SOCAT +zzuftests = testzzuf +endif +endif +endif + +SUBDIRS = include microhttpd $(curltests) $(zzuftests) . + +if BUILD_EXAMPLES +SUBDIRS += examples +endif + +EXTRA_DIST = \ + datadir/cert-and-key.pem \ + datadir/cert-and-key-for-wireshark.pem diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..ee4a753 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,683 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_EXAMPLES_TRUE@am__append_1 = examples +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = include microhttpd testcurl testzzuf . examples +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +@HAVE_CURL_TRUE@curltests = testcurl +@HAVE_CURL_TRUE@@HAVE_SOCAT_TRUE@@HAVE_ZZUF_TRUE@zzuftests = testzzuf +SUBDIRS = include microhttpd $(curltests) $(zzuftests) . \ + $(am__append_1) +EXTRA_DIST = \ + datadir/cert-and-key.pem \ + datadir/cert-and-key-for-wireshark.pem + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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: diff --git a/src/datadir/cert-and-key-for-wireshark.pem b/src/datadir/cert-and-key-for-wireshark.pem new file mode 100644 index 0000000..eacd4b4 --- /dev/null +++ b/src/datadir/cert-and-key-for-wireshark.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDc1k7EFEspRcr6PdPmvAd02hBDUG2O5dDkoRK+6tgEBvQxsTxz +50TGwJ8RbSV+qUOnncZBwhnI4i71QSEezMP6I6liRA+fUtdh3cZFvdDpxgU6P15y +5JxfnnDeZJR5O4tfMxN99t34EOEMruZZ0CNYJJgbmIteE0hLI418oUs7cwIDAQAB +AoGAW3WOLXrSHge/pp/QkLCyzdw5/AblONdJCkcDQnp0eEaA/8uNY9sWCtJfjpIL +g0eKs3KOV1GR6DZ0iDIvC1h2mO6pwyrJhRYHKPO9pnx7xpv1T9zYTuVwoMfVjPfO +UCWFedSsSKR76+oP0TrwPDqp3JoMFcAyAqZKMg2JrRUpL3ECQQD92cVSYxSEKwX3 +cHWXVp1mSkuRMR/KX70NC/9XpYr8FEjvtXBTkmp7oG3TaDwd6nhSAodtY+Zkseyj +k5NXM6sNAkEA3rT6opc1YK0pL3uweg+AFP4lRUYrrft1bDELhLmVm9Nf4xEdTnDO +IotiX4GYQ64Bm8J+yxVU204soGynVXbgfwJBALQLCqq+X0TGhvrSpnRqGET+mM4n +u1Z7xMhGJBpz7TmQ4ZIya7K6fA+m3347xbeqHyB7brYlTrlIgIAcITqOCNkCQQDE +3tuJC34mHi0ASqkw3a7t39R2rpdCT733jEuQYrY8b9id061CgDnZE7o8j0VY3uOR +G5gWUp8W1r5gemxaAqJlAkEAwVImBKyKy3oIMsd3WsoqYCMBM+cpX8H2JAEEISPT +Y5zSPZ7kT9JgY2zJwXf3qL+uG1oKZ6f0wn4BYujctTbXwQ== +-----END RSA PRIVATE KEY----- diff --git a/src/datadir/cert-and-key.pem b/src/datadir/cert-and-key.pem new file mode 100644 index 0000000..e33608c --- /dev/null +++ b/src/datadir/cert-and-key.pem @@ -0,0 +1,34 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDc1k7EFEspRcr6PdPmvAd02hBDUG2O5dDkoRK+6tgEBvQxsTxz +50TGwJ8RbSV+qUOnncZBwhnI4i71QSEezMP6I6liRA+fUtdh3cZFvdDpxgU6P15y +5JxfnnDeZJR5O4tfMxN99t34EOEMruZZ0CNYJJgbmIteE0hLI418oUs7cwIDAQAB +AoGAW3WOLXrSHge/pp/QkLCyzdw5/AblONdJCkcDQnp0eEaA/8uNY9sWCtJfjpIL +g0eKs3KOV1GR6DZ0iDIvC1h2mO6pwyrJhRYHKPO9pnx7xpv1T9zYTuVwoMfVjPfO +UCWFedSsSKR76+oP0TrwPDqp3JoMFcAyAqZKMg2JrRUpL3ECQQD92cVSYxSEKwX3 +cHWXVp1mSkuRMR/KX70NC/9XpYr8FEjvtXBTkmp7oG3TaDwd6nhSAodtY+Zkseyj +k5NXM6sNAkEA3rT6opc1YK0pL3uweg+AFP4lRUYrrft1bDELhLmVm9Nf4xEdTnDO +IotiX4GYQ64Bm8J+yxVU204soGynVXbgfwJBALQLCqq+X0TGhvrSpnRqGET+mM4n +u1Z7xMhGJBpz7TmQ4ZIya7K6fA+m3347xbeqHyB7brYlTrlIgIAcITqOCNkCQQDE +3tuJC34mHi0ASqkw3a7t39R2rpdCT733jEuQYrY8b9id061CgDnZE7o8j0VY3uOR +G5gWUp8W1r5gemxaAqJlAkEAwVImBKyKy3oIMsd3WsoqYCMBM+cpX8H2JAEEISPT +Y5zSPZ7kT9JgY2zJwXf3qL+uG1oKZ6f0wn4BYujctTbXwQ== +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIIDJTCCAo6gAwIBAgIJAIjfJkuxM1pAMA0GCSqGSIb3DQEBBQUAMGsxCzAJBgNV +BAYTAkJHMQ4wDAYDVQQIEwVTb2ZpYTEOMAwGA1UEBxMFU29maWExCzAJBgNVBAoT +AkFVMQ8wDQYDVQQDEwZBbmRyZXkxHjAcBgkqhkiG9w0BCQEWD3Jvb3RAZ29vZ2xl +LmNvbTAeFw0xMjA5MDgxMTU2MzNaFw0xMzA5MDgxMTU2MzNaMGsxCzAJBgNVBAYT +AkJHMQ4wDAYDVQQIEwVTb2ZpYTEOMAwGA1UEBxMFU29maWExCzAJBgNVBAoTAkFV +MQ8wDQYDVQQDEwZBbmRyZXkxHjAcBgkqhkiG9w0BCQEWD3Jvb3RAZ29vZ2xlLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA3NZOxBRLKUXK+j3T5rwHdNoQ +Q1BtjuXQ5KESvurYBAb0MbE8c+dExsCfEW0lfqlDp53GQcIZyOIu9UEhHszD+iOp +YkQPn1LXYd3GRb3Q6cYFOj9ecuScX55w3mSUeTuLXzMTffbd+BDhDK7mWdAjWCSY +G5iLXhNISyONfKFLO3MCAwEAAaOB0DCBzTAdBgNVHQ4EFgQUPp4dR3IT0t6bSE3Y +b91MyHJU2+8wgZ0GA1UdIwSBlTCBkoAUPp4dR3IT0t6bSE3Yb91MyHJU2++hb6Rt +MGsxCzAJBgNVBAYTAkJHMQ4wDAYDVQQIEwVTb2ZpYTEOMAwGA1UEBxMFU29maWEx +CzAJBgNVBAoTAkFVMQ8wDQYDVQQDEwZBbmRyZXkxHjAcBgkqhkiG9w0BCQEWD3Jv +b3RAZ29vZ2xlLmNvbYIJAIjfJkuxM1pAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN +AQEFBQADgYEAeBPoIRueOJ+SwpVniE2gmnvogWH9+irJnapDKGZrC/JsTA7ArqRd +EHO1xZxqF+v+v128LmwWAdaazgMUHjR7e7B0xo4Tcp+9+voczc/GBTO0wnp6HT76 +2kUB6rPwwg9bycW8hAJiJJtr3IW5eYMtXDqM4RrbxhA1n2EAaZPVa5s= +-----END CERTIFICATE----- diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am new file mode 100644 index 0000000..58f4b4a --- /dev/null +++ b/src/examples/Makefile.am @@ -0,0 +1,188 @@ +# This Makefile.am is in the public domain +SUBDIRS = . + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/include \ + -DDATA_DIR=\"$(top_srcdir)/src/datadir/\" + +AM_CFLAGS = @LIBGCRYPT_CFLAGS@ + +CPU_COUNT_DEF = -DCPU_COUNT=$(CPU_COUNT) + +if USE_COVERAGE + AM_CFLAGS += --coverage +endif + + +# example programs +noinst_PROGRAMS = \ + benchmark \ + benchmark_https \ + chunked_example \ + minimal_example \ + dual_stack_example \ + minimal_example_comet \ + querystring_example \ + timeout \ + fileserver_example \ + fileserver_example_dirs \ + fileserver_example_external_select \ + refuse_post_example + +EXTRA_DIST = msgs_i18n.c +noinst_EXTRA_DIST = msgs_i18n.c + +if ENABLE_HTTPS +noinst_PROGRAMS += https_fileserver_example +endif +if HAVE_POSTPROCESSOR +noinst_PROGRAMS += \ + post_example +if HAVE_POSIX_THREADS +noinst_PROGRAMS += demo +if ENABLE_HTTPS +noinst_PROGRAMS += demo_https +endif +endif +endif + +if ENABLE_DAUTH +noinst_PROGRAMS += \ + digest_auth_example +endif + +if ENABLE_BAUTH +noinst_PROGRAMS += \ + authorization_example +endif + +if HAVE_POSIX_THREADS +if ENABLE_UPGRADE +noinst_PROGRAMS += \ + upgrade_example +endif +endif + +if HAVE_W32 +AM_CFLAGS += -DWINDOWS +endif + +minimal_example_SOURCES = \ + minimal_example.c +minimal_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +upgrade_example_SOURCES = \ + upgrade_example.c +upgrade_example_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +upgrade_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + +timeout_SOURCES = \ + timeout.c +timeout_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +chunked_example_SOURCES = \ + chunked_example.c +chunked_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +demo_SOURCES = \ + demo.c +demo_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +demo_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) +demo_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) +if HAVE_LIBMAGIC +demo_LDADD += -lmagic +endif + +demo_https_SOURCES = \ + demo_https.c +demo_https_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +demo_https_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) +demo_https_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) +if HAVE_LIBMAGIC +demo_https_LDADD += -lmagic +endif + +benchmark_SOURCES = \ + benchmark.c +benchmark_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) +benchmark_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +benchmark_https_SOURCES = \ + benchmark_https.c +benchmark_https_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) +benchmark_https_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +dual_stack_example_SOURCES = \ + dual_stack_example.c +dual_stack_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +post_example_SOURCES = \ + post_example.c +post_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +minimal_example_comet_SOURCES = \ + minimal_example_comet.c +minimal_example_comet_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +authorization_example_SOURCES = \ + authorization_example.c +authorization_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +digest_auth_example_SOURCES = \ + digest_auth_example.c +digest_auth_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +refuse_post_example_SOURCES = \ + refuse_post_example.c +refuse_post_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +querystring_example_SOURCES = \ + querystring_example.c +querystring_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +fileserver_example_SOURCES = \ + fileserver_example.c +fileserver_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +fileserver_example_dirs_SOURCES = \ + fileserver_example_dirs.c +fileserver_example_dirs_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +fileserver_example_external_select_SOURCES = \ + fileserver_example_external_select.c +fileserver_example_external_select_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +https_fileserver_example_SOURCES = \ +https_fileserver_example.c +https_fileserver_example_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +https_fileserver_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la diff --git a/src/examples/Makefile.in b/src/examples/Makefile.in new file mode 100644 index 0000000..388c12f --- /dev/null +++ b/src/examples/Makefile.in @@ -0,0 +1,1227 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +@USE_COVERAGE_TRUE@am__append_1 = --coverage +noinst_PROGRAMS = benchmark$(EXEEXT) benchmark_https$(EXEEXT) \ + chunked_example$(EXEEXT) minimal_example$(EXEEXT) \ + dual_stack_example$(EXEEXT) minimal_example_comet$(EXEEXT) \ + querystring_example$(EXEEXT) timeout$(EXEEXT) \ + fileserver_example$(EXEEXT) fileserver_example_dirs$(EXEEXT) \ + fileserver_example_external_select$(EXEEXT) \ + refuse_post_example$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \ + $(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_5) \ + $(am__EXEEXT_6) $(am__EXEEXT_7) +@ENABLE_HTTPS_TRUE@am__append_2 = https_fileserver_example +@HAVE_POSTPROCESSOR_TRUE@am__append_3 = \ +@HAVE_POSTPROCESSOR_TRUE@ post_example + +@HAVE_POSIX_THREADS_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__append_4 = demo +@ENABLE_HTTPS_TRUE@@HAVE_POSIX_THREADS_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__append_5 = demo_https +@ENABLE_DAUTH_TRUE@am__append_6 = \ +@ENABLE_DAUTH_TRUE@ digest_auth_example + +@ENABLE_BAUTH_TRUE@am__append_7 = \ +@ENABLE_BAUTH_TRUE@ authorization_example + +@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_8 = \ +@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@ upgrade_example + +@HAVE_W32_TRUE@am__append_9 = -DWINDOWS +@HAVE_LIBMAGIC_TRUE@am__append_10 = -lmagic +@HAVE_LIBMAGIC_TRUE@am__append_11 = -lmagic +subdir = src/examples +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@ENABLE_HTTPS_TRUE@am__EXEEXT_1 = https_fileserver_example$(EXEEXT) +@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_2 = post_example$(EXEEXT) +@HAVE_POSIX_THREADS_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_3 = demo$(EXEEXT) +@ENABLE_HTTPS_TRUE@@HAVE_POSIX_THREADS_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_4 = demo_https$(EXEEXT) +@ENABLE_DAUTH_TRUE@am__EXEEXT_5 = digest_auth_example$(EXEEXT) +@ENABLE_BAUTH_TRUE@am__EXEEXT_6 = authorization_example$(EXEEXT) +@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_7 = upgrade_example$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am_authorization_example_OBJECTS = authorization_example.$(OBJEXT) +authorization_example_OBJECTS = $(am_authorization_example_OBJECTS) +authorization_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am_benchmark_OBJECTS = benchmark-benchmark.$(OBJEXT) +benchmark_OBJECTS = $(am_benchmark_OBJECTS) +benchmark_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_benchmark_https_OBJECTS = \ + benchmark_https-benchmark_https.$(OBJEXT) +benchmark_https_OBJECTS = $(am_benchmark_https_OBJECTS) +benchmark_https_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_chunked_example_OBJECTS = chunked_example.$(OBJEXT) +chunked_example_OBJECTS = $(am_chunked_example_OBJECTS) +chunked_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_demo_OBJECTS = demo-demo.$(OBJEXT) +demo_OBJECTS = $(am_demo_OBJECTS) +am__DEPENDENCIES_1 = +demo_DEPENDENCIES = $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +demo_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(demo_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_demo_https_OBJECTS = demo_https-demo_https.$(OBJEXT) +demo_https_OBJECTS = $(am_demo_https_OBJECTS) +demo_https_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +demo_https_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(demo_https_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_digest_auth_example_OBJECTS = digest_auth_example.$(OBJEXT) +digest_auth_example_OBJECTS = $(am_digest_auth_example_OBJECTS) +digest_auth_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_dual_stack_example_OBJECTS = dual_stack_example.$(OBJEXT) +dual_stack_example_OBJECTS = $(am_dual_stack_example_OBJECTS) +dual_stack_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_fileserver_example_OBJECTS = fileserver_example.$(OBJEXT) +fileserver_example_OBJECTS = $(am_fileserver_example_OBJECTS) +fileserver_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_fileserver_example_dirs_OBJECTS = \ + fileserver_example_dirs.$(OBJEXT) +fileserver_example_dirs_OBJECTS = \ + $(am_fileserver_example_dirs_OBJECTS) +fileserver_example_dirs_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_fileserver_example_external_select_OBJECTS = \ + fileserver_example_external_select.$(OBJEXT) +fileserver_example_external_select_OBJECTS = \ + $(am_fileserver_example_external_select_OBJECTS) +fileserver_example_external_select_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_https_fileserver_example_OBJECTS = \ + https_fileserver_example-https_fileserver_example.$(OBJEXT) +https_fileserver_example_OBJECTS = \ + $(am_https_fileserver_example_OBJECTS) +https_fileserver_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_minimal_example_OBJECTS = minimal_example.$(OBJEXT) +minimal_example_OBJECTS = $(am_minimal_example_OBJECTS) +minimal_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_minimal_example_comet_OBJECTS = minimal_example_comet.$(OBJEXT) +minimal_example_comet_OBJECTS = $(am_minimal_example_comet_OBJECTS) +minimal_example_comet_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_post_example_OBJECTS = post_example.$(OBJEXT) +post_example_OBJECTS = $(am_post_example_OBJECTS) +post_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_querystring_example_OBJECTS = querystring_example.$(OBJEXT) +querystring_example_OBJECTS = $(am_querystring_example_OBJECTS) +querystring_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_refuse_post_example_OBJECTS = refuse_post_example.$(OBJEXT) +refuse_post_example_OBJECTS = $(am_refuse_post_example_OBJECTS) +refuse_post_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_timeout_OBJECTS = timeout.$(OBJEXT) +timeout_OBJECTS = $(am_timeout_OBJECTS) +timeout_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_upgrade_example_OBJECTS = \ + upgrade_example-upgrade_example.$(OBJEXT) +upgrade_example_OBJECTS = $(am_upgrade_example_OBJECTS) +upgrade_example_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +upgrade_example_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(upgrade_example_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(authorization_example_SOURCES) $(benchmark_SOURCES) \ + $(benchmark_https_SOURCES) $(chunked_example_SOURCES) \ + $(demo_SOURCES) $(demo_https_SOURCES) \ + $(digest_auth_example_SOURCES) $(dual_stack_example_SOURCES) \ + $(fileserver_example_SOURCES) \ + $(fileserver_example_dirs_SOURCES) \ + $(fileserver_example_external_select_SOURCES) \ + $(https_fileserver_example_SOURCES) $(minimal_example_SOURCES) \ + $(minimal_example_comet_SOURCES) $(post_example_SOURCES) \ + $(querystring_example_SOURCES) $(refuse_post_example_SOURCES) \ + $(timeout_SOURCES) $(upgrade_example_SOURCES) +DIST_SOURCES = $(authorization_example_SOURCES) $(benchmark_SOURCES) \ + $(benchmark_https_SOURCES) $(chunked_example_SOURCES) \ + $(demo_SOURCES) $(demo_https_SOURCES) \ + $(digest_auth_example_SOURCES) $(dual_stack_example_SOURCES) \ + $(fileserver_example_SOURCES) \ + $(fileserver_example_dirs_SOURCES) \ + $(fileserver_example_external_select_SOURCES) \ + $(https_fileserver_example_SOURCES) $(minimal_example_SOURCES) \ + $(minimal_example_comet_SOURCES) $(post_example_SOURCES) \ + $(querystring_example_SOURCES) $(refuse_post_example_SOURCES) \ + $(timeout_SOURCES) $(upgrade_example_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +SUBDIRS = . +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/include \ + -DDATA_DIR=\"$(top_srcdir)/src/datadir/\" + +AM_CFLAGS = @LIBGCRYPT_CFLAGS@ $(am__append_1) $(am__append_9) +CPU_COUNT_DEF = -DCPU_COUNT=$(CPU_COUNT) +EXTRA_DIST = msgs_i18n.c +noinst_EXTRA_DIST = msgs_i18n.c +minimal_example_SOURCES = \ + minimal_example.c + +minimal_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +upgrade_example_SOURCES = \ + upgrade_example.c + +upgrade_example_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +upgrade_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + +timeout_SOURCES = \ + timeout.c + +timeout_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +chunked_example_SOURCES = \ + chunked_example.c + +chunked_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +demo_SOURCES = \ + demo.c + +demo_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +demo_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) + +demo_LDADD = $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) $(am__append_10) +demo_https_SOURCES = \ + demo_https.c + +demo_https_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +demo_https_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) + +demo_https_LDADD = $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) $(am__append_11) +benchmark_SOURCES = \ + benchmark.c + +benchmark_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) + +benchmark_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +benchmark_https_SOURCES = \ + benchmark_https.c + +benchmark_https_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) + +benchmark_https_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +dual_stack_example_SOURCES = \ + dual_stack_example.c + +dual_stack_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +post_example_SOURCES = \ + post_example.c + +post_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +minimal_example_comet_SOURCES = \ + minimal_example_comet.c + +minimal_example_comet_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +authorization_example_SOURCES = \ + authorization_example.c + +authorization_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +digest_auth_example_SOURCES = \ + digest_auth_example.c + +digest_auth_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +refuse_post_example_SOURCES = \ + refuse_post_example.c + +refuse_post_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +querystring_example_SOURCES = \ + querystring_example.c + +querystring_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +fileserver_example_SOURCES = \ + fileserver_example.c + +fileserver_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +fileserver_example_dirs_SOURCES = \ + fileserver_example_dirs.c + +fileserver_example_dirs_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +fileserver_example_external_select_SOURCES = \ + fileserver_example_external_select.c + +fileserver_example_external_select_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +https_fileserver_example_SOURCES = \ +https_fileserver_example.c + +https_fileserver_example_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +https_fileserver_example_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/examples/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +authorization_example$(EXEEXT): $(authorization_example_OBJECTS) $(authorization_example_DEPENDENCIES) $(EXTRA_authorization_example_DEPENDENCIES) + @rm -f authorization_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(authorization_example_OBJECTS) $(authorization_example_LDADD) $(LIBS) + +benchmark$(EXEEXT): $(benchmark_OBJECTS) $(benchmark_DEPENDENCIES) $(EXTRA_benchmark_DEPENDENCIES) + @rm -f benchmark$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(benchmark_OBJECTS) $(benchmark_LDADD) $(LIBS) + +benchmark_https$(EXEEXT): $(benchmark_https_OBJECTS) $(benchmark_https_DEPENDENCIES) $(EXTRA_benchmark_https_DEPENDENCIES) + @rm -f benchmark_https$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(benchmark_https_OBJECTS) $(benchmark_https_LDADD) $(LIBS) + +chunked_example$(EXEEXT): $(chunked_example_OBJECTS) $(chunked_example_DEPENDENCIES) $(EXTRA_chunked_example_DEPENDENCIES) + @rm -f chunked_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(chunked_example_OBJECTS) $(chunked_example_LDADD) $(LIBS) + +demo$(EXEEXT): $(demo_OBJECTS) $(demo_DEPENDENCIES) $(EXTRA_demo_DEPENDENCIES) + @rm -f demo$(EXEEXT) + $(AM_V_CCLD)$(demo_LINK) $(demo_OBJECTS) $(demo_LDADD) $(LIBS) + +demo_https$(EXEEXT): $(demo_https_OBJECTS) $(demo_https_DEPENDENCIES) $(EXTRA_demo_https_DEPENDENCIES) + @rm -f demo_https$(EXEEXT) + $(AM_V_CCLD)$(demo_https_LINK) $(demo_https_OBJECTS) $(demo_https_LDADD) $(LIBS) + +digest_auth_example$(EXEEXT): $(digest_auth_example_OBJECTS) $(digest_auth_example_DEPENDENCIES) $(EXTRA_digest_auth_example_DEPENDENCIES) + @rm -f digest_auth_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(digest_auth_example_OBJECTS) $(digest_auth_example_LDADD) $(LIBS) + +dual_stack_example$(EXEEXT): $(dual_stack_example_OBJECTS) $(dual_stack_example_DEPENDENCIES) $(EXTRA_dual_stack_example_DEPENDENCIES) + @rm -f dual_stack_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(dual_stack_example_OBJECTS) $(dual_stack_example_LDADD) $(LIBS) + +fileserver_example$(EXEEXT): $(fileserver_example_OBJECTS) $(fileserver_example_DEPENDENCIES) $(EXTRA_fileserver_example_DEPENDENCIES) + @rm -f fileserver_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fileserver_example_OBJECTS) $(fileserver_example_LDADD) $(LIBS) + +fileserver_example_dirs$(EXEEXT): $(fileserver_example_dirs_OBJECTS) $(fileserver_example_dirs_DEPENDENCIES) $(EXTRA_fileserver_example_dirs_DEPENDENCIES) + @rm -f fileserver_example_dirs$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fileserver_example_dirs_OBJECTS) $(fileserver_example_dirs_LDADD) $(LIBS) + +fileserver_example_external_select$(EXEEXT): $(fileserver_example_external_select_OBJECTS) $(fileserver_example_external_select_DEPENDENCIES) $(EXTRA_fileserver_example_external_select_DEPENDENCIES) + @rm -f fileserver_example_external_select$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(fileserver_example_external_select_OBJECTS) $(fileserver_example_external_select_LDADD) $(LIBS) + +https_fileserver_example$(EXEEXT): $(https_fileserver_example_OBJECTS) $(https_fileserver_example_DEPENDENCIES) $(EXTRA_https_fileserver_example_DEPENDENCIES) + @rm -f https_fileserver_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(https_fileserver_example_OBJECTS) $(https_fileserver_example_LDADD) $(LIBS) + +minimal_example$(EXEEXT): $(minimal_example_OBJECTS) $(minimal_example_DEPENDENCIES) $(EXTRA_minimal_example_DEPENDENCIES) + @rm -f minimal_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(minimal_example_OBJECTS) $(minimal_example_LDADD) $(LIBS) + +minimal_example_comet$(EXEEXT): $(minimal_example_comet_OBJECTS) $(minimal_example_comet_DEPENDENCIES) $(EXTRA_minimal_example_comet_DEPENDENCIES) + @rm -f minimal_example_comet$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(minimal_example_comet_OBJECTS) $(minimal_example_comet_LDADD) $(LIBS) + +post_example$(EXEEXT): $(post_example_OBJECTS) $(post_example_DEPENDENCIES) $(EXTRA_post_example_DEPENDENCIES) + @rm -f post_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(post_example_OBJECTS) $(post_example_LDADD) $(LIBS) + +querystring_example$(EXEEXT): $(querystring_example_OBJECTS) $(querystring_example_DEPENDENCIES) $(EXTRA_querystring_example_DEPENDENCIES) + @rm -f querystring_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(querystring_example_OBJECTS) $(querystring_example_LDADD) $(LIBS) + +refuse_post_example$(EXEEXT): $(refuse_post_example_OBJECTS) $(refuse_post_example_DEPENDENCIES) $(EXTRA_refuse_post_example_DEPENDENCIES) + @rm -f refuse_post_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(refuse_post_example_OBJECTS) $(refuse_post_example_LDADD) $(LIBS) + +timeout$(EXEEXT): $(timeout_OBJECTS) $(timeout_DEPENDENCIES) $(EXTRA_timeout_DEPENDENCIES) + @rm -f timeout$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(timeout_OBJECTS) $(timeout_LDADD) $(LIBS) + +upgrade_example$(EXEEXT): $(upgrade_example_OBJECTS) $(upgrade_example_DEPENDENCIES) $(EXTRA_upgrade_example_DEPENDENCIES) + @rm -f upgrade_example$(EXEEXT) + $(AM_V_CCLD)$(upgrade_example_LINK) $(upgrade_example_OBJECTS) $(upgrade_example_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/authorization_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark-benchmark.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark_https-benchmark_https.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunked_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo-demo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_https-demo_https.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/digest_auth_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dual_stack_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileserver_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileserver_example_dirs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileserver_example_external_select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/https_fileserver_example-https_fileserver_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minimal_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minimal_example_comet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/post_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/querystring_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/refuse_post_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeout.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upgrade_example-upgrade_example.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +benchmark-benchmark.o: benchmark.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT benchmark-benchmark.o -MD -MP -MF $(DEPDIR)/benchmark-benchmark.Tpo -c -o benchmark-benchmark.o `test -f 'benchmark.c' || echo '$(srcdir)/'`benchmark.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/benchmark-benchmark.Tpo $(DEPDIR)/benchmark-benchmark.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='benchmark.c' object='benchmark-benchmark.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o benchmark-benchmark.o `test -f 'benchmark.c' || echo '$(srcdir)/'`benchmark.c + +benchmark-benchmark.obj: benchmark.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT benchmark-benchmark.obj -MD -MP -MF $(DEPDIR)/benchmark-benchmark.Tpo -c -o benchmark-benchmark.obj `if test -f 'benchmark.c'; then $(CYGPATH_W) 'benchmark.c'; else $(CYGPATH_W) '$(srcdir)/benchmark.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/benchmark-benchmark.Tpo $(DEPDIR)/benchmark-benchmark.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='benchmark.c' object='benchmark-benchmark.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o benchmark-benchmark.obj `if test -f 'benchmark.c'; then $(CYGPATH_W) 'benchmark.c'; else $(CYGPATH_W) '$(srcdir)/benchmark.c'; fi` + +benchmark_https-benchmark_https.o: benchmark_https.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_https_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT benchmark_https-benchmark_https.o -MD -MP -MF $(DEPDIR)/benchmark_https-benchmark_https.Tpo -c -o benchmark_https-benchmark_https.o `test -f 'benchmark_https.c' || echo '$(srcdir)/'`benchmark_https.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/benchmark_https-benchmark_https.Tpo $(DEPDIR)/benchmark_https-benchmark_https.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='benchmark_https.c' object='benchmark_https-benchmark_https.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_https_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o benchmark_https-benchmark_https.o `test -f 'benchmark_https.c' || echo '$(srcdir)/'`benchmark_https.c + +benchmark_https-benchmark_https.obj: benchmark_https.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_https_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT benchmark_https-benchmark_https.obj -MD -MP -MF $(DEPDIR)/benchmark_https-benchmark_https.Tpo -c -o benchmark_https-benchmark_https.obj `if test -f 'benchmark_https.c'; then $(CYGPATH_W) 'benchmark_https.c'; else $(CYGPATH_W) '$(srcdir)/benchmark_https.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/benchmark_https-benchmark_https.Tpo $(DEPDIR)/benchmark_https-benchmark_https.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='benchmark_https.c' object='benchmark_https-benchmark_https.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_https_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o benchmark_https-benchmark_https.obj `if test -f 'benchmark_https.c'; then $(CYGPATH_W) 'benchmark_https.c'; else $(CYGPATH_W) '$(srcdir)/benchmark_https.c'; fi` + +demo-demo.o: demo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(demo_CPPFLAGS) $(CPPFLAGS) $(demo_CFLAGS) $(CFLAGS) -MT demo-demo.o -MD -MP -MF $(DEPDIR)/demo-demo.Tpo -c -o demo-demo.o `test -f 'demo.c' || echo '$(srcdir)/'`demo.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/demo-demo.Tpo $(DEPDIR)/demo-demo.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='demo.c' object='demo-demo.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(demo_CPPFLAGS) $(CPPFLAGS) $(demo_CFLAGS) $(CFLAGS) -c -o demo-demo.o `test -f 'demo.c' || echo '$(srcdir)/'`demo.c + +demo-demo.obj: demo.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(demo_CPPFLAGS) $(CPPFLAGS) $(demo_CFLAGS) $(CFLAGS) -MT demo-demo.obj -MD -MP -MF $(DEPDIR)/demo-demo.Tpo -c -o demo-demo.obj `if test -f 'demo.c'; then $(CYGPATH_W) 'demo.c'; else $(CYGPATH_W) '$(srcdir)/demo.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/demo-demo.Tpo $(DEPDIR)/demo-demo.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='demo.c' object='demo-demo.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(demo_CPPFLAGS) $(CPPFLAGS) $(demo_CFLAGS) $(CFLAGS) -c -o demo-demo.obj `if test -f 'demo.c'; then $(CYGPATH_W) 'demo.c'; else $(CYGPATH_W) '$(srcdir)/demo.c'; fi` + +demo_https-demo_https.o: demo_https.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(demo_https_CPPFLAGS) $(CPPFLAGS) $(demo_https_CFLAGS) $(CFLAGS) -MT demo_https-demo_https.o -MD -MP -MF $(DEPDIR)/demo_https-demo_https.Tpo -c -o demo_https-demo_https.o `test -f 'demo_https.c' || echo '$(srcdir)/'`demo_https.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/demo_https-demo_https.Tpo $(DEPDIR)/demo_https-demo_https.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='demo_https.c' object='demo_https-demo_https.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(demo_https_CPPFLAGS) $(CPPFLAGS) $(demo_https_CFLAGS) $(CFLAGS) -c -o demo_https-demo_https.o `test -f 'demo_https.c' || echo '$(srcdir)/'`demo_https.c + +demo_https-demo_https.obj: demo_https.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(demo_https_CPPFLAGS) $(CPPFLAGS) $(demo_https_CFLAGS) $(CFLAGS) -MT demo_https-demo_https.obj -MD -MP -MF $(DEPDIR)/demo_https-demo_https.Tpo -c -o demo_https-demo_https.obj `if test -f 'demo_https.c'; then $(CYGPATH_W) 'demo_https.c'; else $(CYGPATH_W) '$(srcdir)/demo_https.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/demo_https-demo_https.Tpo $(DEPDIR)/demo_https-demo_https.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='demo_https.c' object='demo_https-demo_https.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(demo_https_CPPFLAGS) $(CPPFLAGS) $(demo_https_CFLAGS) $(CFLAGS) -c -o demo_https-demo_https.obj `if test -f 'demo_https.c'; then $(CYGPATH_W) 'demo_https.c'; else $(CYGPATH_W) '$(srcdir)/demo_https.c'; fi` + +https_fileserver_example-https_fileserver_example.o: https_fileserver_example.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(https_fileserver_example_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT https_fileserver_example-https_fileserver_example.o -MD -MP -MF $(DEPDIR)/https_fileserver_example-https_fileserver_example.Tpo -c -o https_fileserver_example-https_fileserver_example.o `test -f 'https_fileserver_example.c' || echo '$(srcdir)/'`https_fileserver_example.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/https_fileserver_example-https_fileserver_example.Tpo $(DEPDIR)/https_fileserver_example-https_fileserver_example.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='https_fileserver_example.c' object='https_fileserver_example-https_fileserver_example.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(https_fileserver_example_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o https_fileserver_example-https_fileserver_example.o `test -f 'https_fileserver_example.c' || echo '$(srcdir)/'`https_fileserver_example.c + +https_fileserver_example-https_fileserver_example.obj: https_fileserver_example.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(https_fileserver_example_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT https_fileserver_example-https_fileserver_example.obj -MD -MP -MF $(DEPDIR)/https_fileserver_example-https_fileserver_example.Tpo -c -o https_fileserver_example-https_fileserver_example.obj `if test -f 'https_fileserver_example.c'; then $(CYGPATH_W) 'https_fileserver_example.c'; else $(CYGPATH_W) '$(srcdir)/https_fileserver_example.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/https_fileserver_example-https_fileserver_example.Tpo $(DEPDIR)/https_fileserver_example-https_fileserver_example.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='https_fileserver_example.c' object='https_fileserver_example-https_fileserver_example.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(https_fileserver_example_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o https_fileserver_example-https_fileserver_example.obj `if test -f 'https_fileserver_example.c'; then $(CYGPATH_W) 'https_fileserver_example.c'; else $(CYGPATH_W) '$(srcdir)/https_fileserver_example.c'; fi` + +upgrade_example-upgrade_example.o: upgrade_example.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(upgrade_example_CFLAGS) $(CFLAGS) -MT upgrade_example-upgrade_example.o -MD -MP -MF $(DEPDIR)/upgrade_example-upgrade_example.Tpo -c -o upgrade_example-upgrade_example.o `test -f 'upgrade_example.c' || echo '$(srcdir)/'`upgrade_example.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/upgrade_example-upgrade_example.Tpo $(DEPDIR)/upgrade_example-upgrade_example.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='upgrade_example.c' object='upgrade_example-upgrade_example.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(upgrade_example_CFLAGS) $(CFLAGS) -c -o upgrade_example-upgrade_example.o `test -f 'upgrade_example.c' || echo '$(srcdir)/'`upgrade_example.c + +upgrade_example-upgrade_example.obj: upgrade_example.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(upgrade_example_CFLAGS) $(CFLAGS) -MT upgrade_example-upgrade_example.obj -MD -MP -MF $(DEPDIR)/upgrade_example-upgrade_example.Tpo -c -o upgrade_example-upgrade_example.obj `if test -f 'upgrade_example.c'; then $(CYGPATH_W) 'upgrade_example.c'; else $(CYGPATH_W) '$(srcdir)/upgrade_example.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/upgrade_example-upgrade_example.Tpo $(DEPDIR)/upgrade_example-upgrade_example.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='upgrade_example.c' object='upgrade_example-upgrade_example.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(upgrade_example_CFLAGS) $(CFLAGS) -c -o upgrade_example-upgrade_example.obj `if test -f 'upgrade_example.c'; then $(CYGPATH_W) 'upgrade_example.c'; else $(CYGPATH_W) '$(srcdir)/upgrade_example.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool \ + clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +# 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: diff --git a/src/examples/authorization_example.c b/src/examples/authorization_example.c new file mode 100644 index 0000000..d8a8820 --- /dev/null +++ b/src/examples/authorization_example.c @@ -0,0 +1,125 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2008 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file authorization_example.c + * @brief example for how to use libmicrohttpd with HTTP authentication + * @author Christian Grothoff + */ + +#include "platform.h" +#include +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +#define PAGE "libmicrohttpd demolibmicrohttpd demo" + +#define DENIED "Access deniedAccess denied" + + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + char *user; + char *pass; + int fail; + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + + /* require: "Aladdin" with password "open sesame" */ + pass = NULL; + user = MHD_basic_auth_get_username_password (connection, + &pass); + fail = ( (NULL == user) || + (0 != strcmp (user, "Aladdin")) || + (0 != strcmp (pass, "open sesame") ) ); + if (fail) + { + response = MHD_create_response_from_buffer (strlen (DENIED), + (void *) DENIED, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_basic_auth_fail_response (connection,"TestRealm",response); + } + else + { + response = MHD_create_response_from_buffer (strlen (me), + (void *) me, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + } + if (NULL != user) + MHD_free (user); + if (NULL != pass) + MHD_free (pass); + MHD_destroy_response (response); + return ret; +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + unsigned int port; + + if ( (argc != 2) || + (1 != sscanf (argv[1], "%u", &port)) || + (UINT16_MAX < port) ) + { + fprintf (stderr, + "%s PORT\n", argv[0]); + return 1; + } + + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); + if (d == NULL) + return 1; + fprintf (stderr, "HTTP server running. Press ENTER to stop the server\n"); + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c new file mode 100644 index 0000000..9512b9b --- /dev/null +++ b/src/examples/benchmark.c @@ -0,0 +1,171 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2013 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file benchmark.c + * @brief minimal code to benchmark MHD GET performance + * @author Christian Grothoff + */ + +#include "platform.h" +#include + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +#define PAGE "libmicrohttpd demolibmicrohttpd demo" + + +#define SMALL (1024 * 128) + +/** + * Number of threads to run in the thread pool. Should (roughly) match + * the number of cores on your system. + */ +#define NUMBER_OF_THREADS CPU_COUNT + +static unsigned int small_deltas[SMALL]; + +static struct MHD_Response *response; + + + +/** + * Signature of the callback used by MHD to notify the + * application about completed requests. + * + * @param cls client-defined closure + * @param connection connection handle + * @param con_cls value as set by the last call to + * the MHD_AccessHandlerCallback + * @param toe reason for request termination + * @see MHD_OPTION_NOTIFY_COMPLETED + */ +static void +completed_callback (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct timeval *tv = *con_cls; + struct timeval tve; + uint64_t delta; + (void)cls; /* Unused. Silent compiler warning. */ + (void)connection; /* Unused. Silent compiler warning. */ + (void)toe; /* Unused. Silent compiler warning. */ + + if (NULL == tv) + return; + gettimeofday (&tve, NULL); + + delta = 0; + if (tve.tv_usec >= tv->tv_usec) + delta += (tve.tv_sec - tv->tv_sec) * 1000000LL + + (tve.tv_usec - tv->tv_usec); + else + delta += (tve.tv_sec - tv->tv_sec) * 1000000LL + - tv->tv_usec + tve.tv_usec; + if (delta < SMALL) + small_deltas[delta]++; + else + fprintf (stdout, "D: %llu 1\n", (unsigned long long) delta); + free (tv); +} + + +static void * +uri_logger_cb (void *cls, + const char *uri) +{ + struct timeval *tv = malloc (sizeof (struct timeval)); + (void)cls; /* Unused. Silent compiler warning. */ + (void)uri; /* Unused. Silent compiler warning. */ + + if (NULL != tv) + gettimeofday (tv, NULL); + return tv; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + (void)cls; /* Unused. Silent compiler warning. */ + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + (void)ptr; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + return MHD_queue_response (connection, MHD_HTTP_OK, response); +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + unsigned int i; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + response = MHD_create_response_from_buffer (strlen (PAGE), + (void *) PAGE, + MHD_RESPMEM_PERSISTENT); +#if 0 + (void) MHD_add_response_header (response, + MHD_HTTP_HEADER_CONNECTION, + "close"); +#endif + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_SUPPRESS_DATE_NO_CLOCK +#ifdef EPOLL_SUPPORT + | MHD_USE_EPOLL | MHD_USE_TURBO +#endif + , + atoi (argv[1]), + NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS, + MHD_OPTION_URI_LOG_CALLBACK, &uri_logger_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_callback, NULL, + MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 1000, + MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + MHD_destroy_response (response); + for (i=0;i + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +#define PAGE "libmicrohttpd demolibmicrohttpd demo" + + +#define SMALL (1024 * 128) + +/** + * Number of threads to run in the thread pool. Should (roughly) match + * the number of cores on your system. + */ +#define NUMBER_OF_THREADS CPU_COUNT + +static unsigned int small_deltas[SMALL]; + +static struct MHD_Response *response; + + + +/** + * Signature of the callback used by MHD to notify the + * application about completed requests. + * + * @param cls client-defined closure + * @param connection connection handle + * @param con_cls value as set by the last call to + * the MHD_AccessHandlerCallback + * @param toe reason for request termination + * @see MHD_OPTION_NOTIFY_COMPLETED + */ +static void +completed_callback (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct timeval *tv = *con_cls; + struct timeval tve; + uint64_t delta; + (void)cls; /* Unused. Silent compiler warning. */ + (void)connection; /* Unused. Silent compiler warning. */ + (void)toe; /* Unused. Silent compiler warning. */ + + if (NULL == tv) + return; + gettimeofday (&tve, NULL); + + delta = 0; + if (tve.tv_usec >= tv->tv_usec) + delta += (tve.tv_sec - tv->tv_sec) * 1000000LL + + (tve.tv_usec - tv->tv_usec); + else + delta += (tve.tv_sec - tv->tv_sec) * 1000000LL + - tv->tv_usec + tve.tv_usec; + if (delta < SMALL) + small_deltas[delta]++; + else + fprintf (stdout, "D: %llu 1\n", (unsigned long long) delta); + free (tv); +} + + +static void * +uri_logger_cb (void *cls, + const char *uri) +{ + struct timeval *tv = malloc (sizeof (struct timeval)); + (void)cls; /* Unused. Silent compiler warning. */ + (void)uri; /* Unused. Silent compiler warning. */ + + if (NULL != tv) + gettimeofday (tv, NULL); + return tv; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + (void)cls; /* Unused. Silent compiler warning. */ + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + (void)ptr; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + return MHD_queue_response (connection, MHD_HTTP_OK, response); +} + + +/* test server key */ +const char srv_signed_key_pem[] = "-----BEGIN RSA PRIVATE KEY-----\n" + "MIIEowIBAAKCAQEAvfTdv+3fgvVTKRnP/HVNG81cr8TrUP/iiyuve/THMzvFXhCW\n" + "+K03KwEku55QvnUndwBfU/ROzLlv+5hotgiDRNFT3HxurmhouySBrJNJv7qWp8IL\n" + "q4sw32vo0fbMu5BZF49bUXK9L3kW2PdhTtSQPWHEzNrCxO+YgCilKHkY3vQNfdJ0\n" + "20Q5EAAEseD1YtWCIpRvJzYlZMpjYB1ubTl24kwrgOKUJYKqM4jmF4DVQp4oOK/6\n" + "QYGGh1QmHRPAy3CBII6sbb+sZT9cAqU6GYQVB35lm4XAgibXV6KgmpVxVQQ69U6x\n" + "yoOl204xuekZOaG9RUPId74Rtmwfi1TLbBzo2wIDAQABAoIBADu09WSICNq5cMe4\n" + "+NKCLlgAT1NiQpLls1gKRbDhKiHU9j8QWNvWWkJWrCya4QdUfLCfeddCMeiQmv3K\n" + "lJMvDs+5OjJSHFoOsGiuW2Ias7IjnIojaJalfBml6frhJ84G27IXmdz6gzOiTIer\n" + "DjeAgcwBaKH5WwIay2TxIaScl7AwHBauQkrLcyb4hTmZuQh6ArVIN6+pzoVuORXM\n" + "bpeNWl2l/HSN3VtUN6aCAKbN/X3o0GavCCMn5Fa85uJFsab4ss/uP+2PusU71+zP\n" + "sBm6p/2IbGvF5k3VPDA7X5YX61sukRjRBihY8xSnNYx1UcoOsX6AiPnbhifD8+xQ\n" + "Tlf8oJUCgYEA0BTfzqNpr9Wxw5/QXaSdw7S/0eP5a0C/nwURvmfSzuTD4equzbEN\n" + "d+dI/s2JMxrdj/I4uoAfUXRGaabevQIjFzC9uyE3LaOyR2zhuvAzX+vVcs6bSXeU\n" + "pKpCAcN+3Z3evMaX2f+z/nfSUAl2i4J2R+/LQAWJW4KwRky/m+cxpfUCgYEA6bN1\n" + "b73bMgM8wpNt6+fcmS+5n0iZihygQ2U2DEud8nZJL4Nrm1dwTnfZfJBnkGj6+0Q0\n" + "cOwj2KS0/wcEdJBP0jucU4v60VMhp75AQeHqidIde0bTViSRo3HWKXHBIFGYoU3T\n" + "LyPyKndbqsOObnsFXHn56Nwhr2HLf6nw4taGQY8CgYBoSW36FLCNbd6QGvLFXBGt\n" + "2lMhEM8az/K58kJ4WXSwOLtr6MD/WjNT2tkcy0puEJLm6BFCd6A6pLn9jaKou/92\n" + "SfltZjJPb3GUlp9zn5tAAeSSi7YMViBrfuFiHObij5LorefBXISLjuYbMwL03MgH\n" + "Ocl2JtA2ywMp2KFXs8GQWQKBgFyIVv5ogQrbZ0pvj31xr9HjqK6d01VxIi+tOmpB\n" + "4ocnOLEcaxX12BzprW55ytfOCVpF1jHD/imAhb3YrHXu0fwe6DXYXfZV4SSG2vB7\n" + "IB9z14KBN5qLHjNGFpMQXHSMek+b/ftTU0ZnPh9uEM5D3YqRLVd7GcdUhHvG8P8Q\n" + "C9aXAoGBAJtID6h8wOGMP0XYX5YYnhlC7dOLfk8UYrzlp3xhqVkzKthTQTj6wx9R\n" + "GtC4k7U1ki8oJsfcIlBNXd768fqDVWjYju5rzShMpo8OCTS6ipAblKjCxPPVhIpv\n" + "tWPlbSn1qj6wylstJ5/3Z+ZW5H4wIKp5jmLiioDhcP0L/Ex3Zx8O\n" + "-----END RSA PRIVATE KEY-----\n"; + +/* test server CA signed certificates */ +const char srv_signed_cert_pem[] = "-----BEGIN CERTIFICATE-----\n" + "MIIDGzCCAgWgAwIBAgIES0KCvTALBgkqhkiG9w0BAQUwFzEVMBMGA1UEAxMMdGVz\n" + "dF9jYV9jZXJ0MB4XDTEwMDEwNTAwMDcyNVoXDTQ1MDMxMjAwMDcyNVowFzEVMBMG\n" + "A1UEAxMMdGVzdF9jYV9jZXJ0MIIBHzALBgkqhkiG9w0BAQEDggEOADCCAQkCggEA\n" + "vfTdv+3fgvVTKRnP/HVNG81cr8TrUP/iiyuve/THMzvFXhCW+K03KwEku55QvnUn\n" + "dwBfU/ROzLlv+5hotgiDRNFT3HxurmhouySBrJNJv7qWp8ILq4sw32vo0fbMu5BZ\n" + "F49bUXK9L3kW2PdhTtSQPWHEzNrCxO+YgCilKHkY3vQNfdJ020Q5EAAEseD1YtWC\n" + "IpRvJzYlZMpjYB1ubTl24kwrgOKUJYKqM4jmF4DVQp4oOK/6QYGGh1QmHRPAy3CB\n" + "II6sbb+sZT9cAqU6GYQVB35lm4XAgibXV6KgmpVxVQQ69U6xyoOl204xuekZOaG9\n" + "RUPId74Rtmwfi1TLbBzo2wIDAQABo3YwdDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQM\n" + "MAoGCCsGAQUFBwMBMA8GA1UdDwEB/wQFAwMHIAAwHQYDVR0OBBYEFOFi4ilKOP1d\n" + "XHlWCMwmVKr7mgy8MB8GA1UdIwQYMBaAFP2olB4s2T/xuoQ5pT2RKojFwZo2MAsG\n" + "CSqGSIb3DQEBBQOCAQEAHVWPxazupbOkG7Did+dY9z2z6RjTzYvurTtEKQgzM2Vz\n" + "GQBA+3pZ3c5mS97fPIs9hZXfnQeelMeZ2XP1a+9vp35bJjZBBhVH+pqxjCgiUflg\n" + "A3Zqy0XwwVCgQLE2HyaU3DLUD/aeIFK5gJaOSdNTXZLv43K8kl4cqDbMeRpVTbkt\n" + "YmG4AyEOYRNKGTqMEJXJoxD5E3rBUNrVI/XyTjYrulxbNPcMWEHKNeeqWpKDYTFo\n" + "Bb01PCthGXiq/4A2RLAFosadzRa8SBpoSjPPfZ0b2w4MJpReHqKbR5+T2t6hzml6\n" + "4ToyOKPDmamiTuN5KzLN3cw7DQlvWMvqSOChPLnA3Q==\n" + "-----END CERTIFICATE-----\n"; + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + unsigned int i; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + response = MHD_create_response_from_buffer (strlen (PAGE), + (void *) PAGE, + MHD_RESPMEM_PERSISTENT); + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS +#ifdef EPOLL_SUPPORT + | MHD_USE_EPOLL | MHD_USE_TURBO +#endif + , + atoi (argv[1]), + NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS, + MHD_OPTION_URI_LOG_CALLBACK, &uri_logger_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_callback, NULL, + MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 1000, + MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, + MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + MHD_destroy_response (response); + for (i=0;i + +struct ResponseContentCallbackParam +{ + const char *response_data; + size_t response_size; +}; + + +static ssize_t +callback (void *cls, + uint64_t pos, + char *buf, + size_t buf_size) +{ + size_t size_to_copy; + struct ResponseContentCallbackParam * const param = + (struct ResponseContentCallbackParam *)cls; + + /* Note: 'pos' will never exceed size of transmitted data. */ + /* You can use 'pos == param->response_size' in next check. */ + if (pos >= param->response_size) + { /* Whole response was sent. Signal end of response. */ + return MHD_CONTENT_READER_END_OF_STREAM; + } + + /* Pseudo code. * + if (data_not_ready) + { + // Callback will be called again on next loop. + // Consider suspending connection until data will be ready. + return 0; + } + * End of pseudo code. */ + + if (buf_size < (param->response_size - pos)) + size_to_copy = buf_size; + else + size_to_copy = param->response_size - pos; + + memcpy (buf, param->response_data + pos, size_to_copy); + + /* Pseudo code. * + if (error_preparing_response) + { + // Close connection with error. + return MHD_CONTENT_READER_END_WITH_ERROR; + } + * End of pseudo code. */ + + /* Return amount of data copied to buffer. */ + return size_to_copy; +} + + +static void +free_callback_param (void *cls) +{ + free(cls); +} + + +static const char simple_response_text[] = "Simple response" + "Simple response text"; + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **ptr) +{ + static int aptr; + struct ResponseContentCallbackParam *callback_param; + struct MHD_Response *response; + int ret; + (void)cls; /* Unused. Silent compiler warning. */ + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + + callback_param = malloc (sizeof(struct ResponseContentCallbackParam)); + if (NULL == callback_param) + return MHD_NO; /* Not enough memory. */ + + callback_param->response_data = simple_response_text; + callback_param->response_size = (sizeof(simple_response_text)/sizeof(char)) - 1; + + *ptr = NULL; /* reset when done */ + response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, + 1024, + &callback, + callback_param, + &free_callback_param); + if (NULL == response) + { + free (callback_param); + return MHD_NO; + } + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + int port; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + port = atoi (argv[1]); + if ( (1 > port) || + (port > UINT16_MAX) ) + { + fprintf (stderr, + "Port must be a number between 1 and 65535\n"); + return 1; + } + d = MHD_start_daemon (/* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ + MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + /* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, */ + /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, */ + /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ + (uint16_t) port, + NULL, NULL, + &ahc_echo, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_END); + if (NULL == d) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/demo.c b/src/examples/demo.c new file mode 100644 index 0000000..6c9ad04 --- /dev/null +++ b/src/examples/demo.c @@ -0,0 +1,936 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2013 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file demo.c + * @brief complex demonstration site: create directory index, offer + * upload via form and HTTP POST, download with mime type detection + * and error reporting (403, etc.) --- and all of this with + * high-performance settings (large buffers, thread pool). + * If you want to benchmark MHD, this code should be used to + * run tests against. Note that the number of threads may need + * to be adjusted depending on the number of available cores. + * @author Christian Grothoff + */ +#include "platform.h" +#include +#include +#include +#include +#include +#include +#ifdef MHD_HAVE_LIBMAGIC +#include +#endif /* MHD_HAVE_LIBMAGIC */ +#include +#include + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +/** + * Number of threads to run in the thread pool. Should (roughly) match + * the number of cores on your system. + */ +#define NUMBER_OF_THREADS CPU_COUNT + +#ifdef MHD_HAVE_LIBMAGIC +/** + * How many bytes of a file do we give to libmagic to determine the mime type? + * 16k might be a bit excessive, but ought not hurt performance much anyway, + * and should definitively be on the safe side. + */ +#define MAGIC_HEADER_SIZE (16 * 1024) +#endif /* MHD_HAVE_LIBMAGIC */ + + +/** + * Page returned for file-not-found. + */ +#define FILE_NOT_FOUND_PAGE "File not foundFile not found" + + +/** + * Page returned for internal errors. + */ +#define INTERNAL_ERROR_PAGE "Internal errorInternal error" + + +/** + * Page returned for refused requests. + */ +#define REQUEST_REFUSED_PAGE "Request refusedRequest refused (file exists?)" + + +/** + * Head of index page. + */ +#define INDEX_PAGE_HEADER "\nWelcome\n\n"\ + "

Upload

\n"\ + "\n"\ + "
Content type:
"\ + "Book"\ + "Image"\ + "Music"\ + "Software"\ + "Videos\n"\ + "Other
"\ + "
Language:
"\ + "none"\ + "English"\ + "German"\ + "French"\ + "Spanish
\n"\ + "
File:
"\ + "
"\ + "\n"\ + "\n"\ + "

Download

\n"\ + "
    \n" + +/** + * Footer of index page. + */ +#define INDEX_PAGE_FOOTER "
\n\n" + + +/** + * NULL-terminated array of supported upload categories. Should match HTML + * in the form. + */ +static const char * const categories[] = + { + "books", + "images", + "music", + "software", + "videos", + "other", + NULL, + }; + + +/** + * Specification of a supported language. + */ +struct Language +{ + /** + * Directory name for the language. + */ + const char *dirname; + + /** + * Long name for humans. + */ + const char *longname; + +}; + +/** + * NULL-terminated array of supported upload categories. Should match HTML + * in the form. + */ +static const struct Language languages[] = + { + { "no-lang", "No language specified" }, + { "en", "English" }, + { "de", "German" }, + { "fr", "French" }, + { "es", "Spanish" }, + { NULL, NULL }, + }; + + +/** + * Response returned if the requested file does not exist (or is not accessible). + */ +static struct MHD_Response *file_not_found_response; + +/** + * Response returned for internal errors. + */ +static struct MHD_Response *internal_error_response; + +/** + * Response returned for '/' (GET) to list the contents of the directory and allow upload. + */ +static struct MHD_Response *cached_directory_response; + +/** + * Response returned for refused uploads. + */ +static struct MHD_Response *request_refused_response; + +/** + * Mutex used when we update the cached directory response object. + */ +static pthread_mutex_t mutex; + +#ifdef MHD_HAVE_LIBMAGIC +/** + * Global handle to MAGIC data. + */ +static magic_t magic; +#endif /* MHD_HAVE_LIBMAGIC */ + + +/** + * Mark the given response as HTML for the brower. + * + * @param response response to mark + */ +static void +mark_as_html (struct MHD_Response *response) +{ + (void) MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + "text/html"); +} + + +/** + * Replace the existing 'cached_directory_response' with the + * given response. + * + * @param response new directory response + */ +static void +update_cached_response (struct MHD_Response *response) +{ + (void) pthread_mutex_lock (&mutex); + if (NULL != cached_directory_response) + MHD_destroy_response (cached_directory_response); + cached_directory_response = response; + (void) pthread_mutex_unlock (&mutex); +} + + +/** + * Context keeping the data for the response we're building. + */ +struct ResponseDataContext +{ + /** + * Response data string. + */ + char *buf; + + /** + * Number of bytes allocated for 'buf'. + */ + size_t buf_len; + + /** + * Current position where we append to 'buf'. Must be smaller or equal to 'buf_len'. + */ + size_t off; + +}; + + +/** + * Create a listing of the files in 'dirname' in HTML. + * + * @param rdc where to store the list of files + * @param dirname name of the directory to list + * @return #MHD_YES on success, #MHD_NO on error + */ +static int +list_directory (struct ResponseDataContext *rdc, + const char *dirname) +{ + char fullname[PATH_MAX]; + struct stat sbuf; + DIR *dir; + struct dirent *de; + + if (NULL == (dir = opendir (dirname))) + return MHD_NO; + while (NULL != (de = readdir (dir))) + { + if ('.' == de->d_name[0]) + continue; + if (sizeof (fullname) <= (unsigned int) + snprintf (fullname, sizeof (fullname), + "%s/%s", + dirname, de->d_name)) + continue; /* ugh, file too long? how can this be!? */ + if (0 != stat (fullname, &sbuf)) + continue; /* ugh, failed to 'stat' */ + if (! S_ISREG (sbuf.st_mode)) + continue; /* not a regular file, skip */ + if (rdc->off + 1024 > rdc->buf_len) + { + void *r; + + if ( (2 * rdc->buf_len + 1024) < rdc->buf_len) + break; /* more than SIZE_T _index_ size? Too big for us */ + rdc->buf_len = 2 * rdc->buf_len + 1024; + if (NULL == (r = realloc (rdc->buf, rdc->buf_len))) + break; /* out of memory */ + rdc->buf = r; + } + rdc->off += snprintf (&rdc->buf[rdc->off], + rdc->buf_len - rdc->off, + "
  • %s
  • \n", + fullname, + de->d_name); + } + (void) closedir (dir); + return MHD_YES; +} + + +/** + * Re-scan our local directory and re-build the index. + */ +static void +update_directory () +{ + static size_t initial_allocation = 32 * 1024; /* initial size for response buffer */ + struct MHD_Response *response; + struct ResponseDataContext rdc; + unsigned int language_idx; + unsigned int category_idx; + const struct Language *language; + const char *category; + char dir_name[128]; + struct stat sbuf; + + rdc.buf_len = initial_allocation; + if (NULL == (rdc.buf = malloc (rdc.buf_len))) + { + update_cached_response (NULL); + return; + } + rdc.off = snprintf (rdc.buf, rdc.buf_len, + "%s", + INDEX_PAGE_HEADER); + for (language_idx = 0; NULL != languages[language_idx].dirname; language_idx++) + { + language = &languages[language_idx]; + + if (0 != stat (language->dirname, &sbuf)) + continue; /* empty */ + /* we ensured always +1k room, filenames are ~256 bytes, + so there is always still enough space for the header + without need for an additional reallocation check. */ + rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off, + "

    %s

    \n", + language->longname); + for (category_idx = 0; NULL != categories[category_idx]; category_idx++) + { + category = categories[category_idx]; + snprintf (dir_name, sizeof (dir_name), + "%s/%s", + language->dirname, + category); + if (0 != stat (dir_name, &sbuf)) + continue; /* empty */ + + /* we ensured always +1k room, filenames are ~256 bytes, + so there is always still enough space for the header + without need for an additional reallocation check. */ + rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off, + "

    %s

    \n", + category); + + if (MHD_NO == list_directory (&rdc, dir_name)) + { + free (rdc.buf); + update_cached_response (NULL); + return; + } + } + } + /* we ensured always +1k room, filenames are ~256 bytes, + so there is always still enough space for the footer + without need for a final reallocation check. */ + rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off, + "%s", + INDEX_PAGE_FOOTER); + initial_allocation = rdc.buf_len; /* remember for next time */ + response = MHD_create_response_from_buffer (rdc.off, + rdc.buf, + MHD_RESPMEM_MUST_FREE); + mark_as_html (response); +#if FORCE_CLOSE + (void) MHD_add_response_header (response, + MHD_HTTP_HEADER_CONNECTION, + "close"); +#endif + update_cached_response (response); +} + + +/** + * Context we keep for an upload. + */ +struct UploadContext +{ + /** + * Handle where we write the uploaded file to. + */ + int fd; + + /** + * Name of the file on disk (used to remove on errors). + */ + char *filename; + + /** + * Language for the upload. + */ + char *language; + + /** + * Category for the upload. + */ + char *category; + + /** + * Post processor we're using to process the upload. + */ + struct MHD_PostProcessor *pp; + + /** + * Handle to connection that we're processing the upload for. + */ + struct MHD_Connection *connection; + + /** + * Response to generate, NULL to use directory. + */ + struct MHD_Response *response; +}; + + +/** + * Append the 'size' bytes from 'data' to '*ret', adding + * 0-termination. If '*ret' is NULL, allocate an empty string first. + * + * @param ret string to update, NULL or 0-terminated + * @param data data to append + * @param size number of bytes in 'data' + * @return MHD_NO on allocation failure, MHD_YES on success + */ +static int +do_append (char **ret, + const char *data, + size_t size) +{ + char *buf; + size_t old_len; + + if (NULL == *ret) + old_len = 0; + else + old_len = strlen (*ret); + buf = malloc (old_len + size + 1); + if (NULL == buf) + return MHD_NO; + memcpy (buf, *ret, old_len); + if (NULL != *ret) + free (*ret); + memcpy (&buf[old_len], data, size); + buf[old_len + size] = '\0'; + *ret = buf; + return MHD_YES; +} + + +/** + * Iterator over key-value pairs where the value + * maybe made available in increments and/or may + * not be zero-terminated. Used for processing + * POST data. + * + * @param cls user-specified closure + * @param kind type of the value, always MHD_POSTDATA_KIND when called from MHD + * @param key 0-terminated key for the value + * @param filename name of the uploaded file, NULL if not known + * @param content_type mime-type of the data, NULL if not known + * @param transfer_encoding encoding of the data, NULL if not known + * @param data pointer to size bytes of data at the + * specified offset + * @param off offset of data in the overall value + * @param size number of bytes in data available + * @return MHD_YES to continue iterating, + * MHD_NO to abort the iteration + */ +static int +process_upload_data (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, + uint64_t off, + size_t size) +{ + struct UploadContext *uc = cls; + int i; + (void)kind; /* Unused. Silent compiler warning. */ + (void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding; /* Unused. Silent compiler warning. */ + (void)off; /* Unused. Silent compiler warning. */ + + if (0 == strcmp (key, "category")) + return do_append (&uc->category, data, size); + if (0 == strcmp (key, "language")) + return do_append (&uc->language, data, size); + if (0 != strcmp (key, "upload")) + { + fprintf (stderr, + "Ignoring unexpected form value `%s'\n", + key); + return MHD_YES; /* ignore */ + } + if (NULL == filename) + { + fprintf (stderr, "No filename, aborting upload\n"); + return MHD_NO; /* no filename, error */ + } + if ( (NULL == uc->category) || + (NULL == uc->language) ) + { + fprintf (stderr, + "Missing form data for upload `%s'\n", + filename); + uc->response = request_refused_response; + return MHD_NO; + } + if (-1 == uc->fd) + { + char fn[PATH_MAX]; + + if ( (NULL != strstr (filename, "..")) || + (NULL != strchr (filename, '/')) || + (NULL != strchr (filename, '\\')) ) + { + uc->response = request_refused_response; + return MHD_NO; + } + /* create directories -- if they don't exist already */ +#ifdef WINDOWS + (void) mkdir (uc->language); +#else + (void) mkdir (uc->language, S_IRWXU); +#endif + snprintf (fn, sizeof (fn), + "%s/%s", + uc->language, + uc->category); +#ifdef WINDOWS + (void) mkdir (fn); +#else + (void) mkdir (fn, S_IRWXU); +#endif + /* open file */ + snprintf (fn, sizeof (fn), + "%s/%s/%s", + uc->language, + uc->category, + filename); + for (i=strlen (fn)-1;i>=0;i--) + if (! isprint ((unsigned char) fn[i])) + fn[i] = '_'; + uc->fd = open (fn, + O_CREAT | O_EXCL +#if O_LARGEFILE + | O_LARGEFILE +#endif + | O_WRONLY, + S_IRUSR | S_IWUSR); + if (-1 == uc->fd) + { + fprintf (stderr, + "Error opening file `%s' for upload: %s\n", + fn, + strerror (errno)); + uc->response = request_refused_response; + return MHD_NO; + } + uc->filename = strdup (fn); + } + if ( (0 != size) && + (size != (size_t) write (uc->fd, data, size)) ) + { + /* write failed; likely: disk full */ + fprintf (stderr, + "Error writing to file `%s': %s\n", + uc->filename, + strerror (errno)); + uc->response = internal_error_response; + (void) close (uc->fd); + uc->fd = -1; + if (NULL != uc->filename) + { + unlink (uc->filename); + free (uc->filename); + uc->filename = NULL; + } + return MHD_NO; + } + return MHD_YES; +} + + +/** + * Function called whenever a request was completed. + * Used to clean up 'struct UploadContext' objects. + * + * @param cls client-defined closure, NULL + * @param connection connection handle + * @param con_cls value as set by the last call to + * the MHD_AccessHandlerCallback, points to NULL if this was + * not an upload + * @param toe reason for request termination + */ +static void +response_completed_callback (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct UploadContext *uc = *con_cls; + (void)cls; /* Unused. Silent compiler warning. */ + (void)connection; /* Unused. Silent compiler warning. */ + (void)toe; /* Unused. Silent compiler warning. */ + + if (NULL == uc) + return; /* this request wasn't an upload request */ + if (NULL != uc->pp) + { + MHD_destroy_post_processor (uc->pp); + uc->pp = NULL; + } + if (-1 != uc->fd) + { + (void) close (uc->fd); + if (NULL != uc->filename) + { + fprintf (stderr, + "Upload of file `%s' failed (incomplete or aborted), removing file.\n", + uc->filename); + (void) unlink (uc->filename); + } + } + if (NULL != uc->filename) + free (uc->filename); + free (uc); +} + + +/** + * Return the current directory listing. + * + * @param connection connection to return the directory for + * @return MHD_YES on success, MHD_NO on error + */ +static int +return_directory_response (struct MHD_Connection *connection) +{ + int ret; + + (void) pthread_mutex_lock (&mutex); + if (NULL == cached_directory_response) + ret = MHD_queue_response (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + internal_error_response); + else + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + cached_directory_response); + (void) pthread_mutex_unlock (&mutex); + return ret; +} + + +/** + * Main callback from MHD, used to generate the page. + * + * @param cls NULL + * @param connection connection handle + * @param url requested URL + * @param method GET, PUT, POST, etc. + * @param version HTTP version + * @param upload_data data from upload (PUT/POST) + * @param upload_data_size number of bytes in "upload_data" + * @param ptr our context + * @return MHD_YES on success, MHD_NO to drop connection + */ +static int +generate_page (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, void **ptr) +{ + struct MHD_Response *response; + int ret; + int fd; + struct stat buf; + (void)cls; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (url, "/")) + { + /* should be file download */ +#ifdef MHD_HAVE_LIBMAGIC + char file_data[MAGIC_HEADER_SIZE]; + ssize_t got; +#endif /* MHD_HAVE_LIBMAGIC */ + const char *mime; + + if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) && + (0 != strcmp (method, MHD_HTTP_METHOD_HEAD)) ) + return MHD_NO; /* unexpected method (we're not polite...) */ + fd = -1; + if ( (NULL == strstr (&url[1], "..")) && + ('/' != url[1]) ) + { + fd = open (&url[1], O_RDONLY); + if ( (-1 != fd) && + ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) ) + { + (void) close (fd); + fd = -1; + } + } + if (-1 == fd) + return MHD_queue_response (connection, + MHD_HTTP_NOT_FOUND, + file_not_found_response); +#ifdef MHD_HAVE_LIBMAGIC + /* read beginning of the file to determine mime type */ + got = read (fd, file_data, sizeof (file_data)); + (void) lseek (fd, 0, SEEK_SET); + if (-1 != got) + mime = magic_buffer (magic, file_data, got); + else +#endif /* MHD_HAVE_LIBMAGIC */ + mime = NULL; + + if (NULL == (response = MHD_create_response_from_fd (buf.st_size, + fd))) + { + /* internal error (i.e. out of memory) */ + (void) close (fd); + return MHD_NO; + } + + /* add mime type if we had one */ + if (NULL != mime) + (void) MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + mime); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; + } + + if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) + { + /* upload! */ + struct UploadContext *uc = *ptr; + + if (NULL == uc) + { + if (NULL == (uc = malloc (sizeof (struct UploadContext)))) + return MHD_NO; /* out of memory, close connection */ + memset (uc, 0, sizeof (struct UploadContext)); + uc->fd = -1; + uc->connection = connection; + uc->pp = MHD_create_post_processor (connection, + 64 * 1024 /* buffer size */, + &process_upload_data, uc); + if (NULL == uc->pp) + { + /* out of memory, close connection */ + free (uc); + return MHD_NO; + } + *ptr = uc; + return MHD_YES; + } + if (0 != *upload_data_size) + { + if (NULL == uc->response) + (void) MHD_post_process (uc->pp, + upload_data, + *upload_data_size); + *upload_data_size = 0; + return MHD_YES; + } + /* end of upload, finish it! */ + MHD_destroy_post_processor (uc->pp); + uc->pp = NULL; + if (-1 != uc->fd) + { + close (uc->fd); + uc->fd = -1; + } + if (NULL != uc->response) + { + return MHD_queue_response (connection, + MHD_HTTP_FORBIDDEN, + uc->response); + } + else + { + update_directory (); + return return_directory_response (connection); + } + } + if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || + (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) + { + return return_directory_response (connection); + } + + /* unexpected request, refuse */ + return MHD_queue_response (connection, + MHD_HTTP_FORBIDDEN, + request_refused_response); +} + + +#ifndef MINGW +/** + * Function called if we get a SIGPIPE. Does nothing. + * + * @param sig will be SIGPIPE (ignored) + */ +static void +catcher (int sig) +{ + (void)sig; /* Unused. Silent compiler warning. */ + /* do nothing */ +} + + +/** + * setup handlers to ignore SIGPIPE. + */ +static void +ignore_sigpipe () +{ + struct sigaction oldsig; + struct sigaction sig; + + sig.sa_handler = &catcher; + sigemptyset (&sig.sa_mask); +#ifdef SA_INTERRUPT + sig.sa_flags = SA_INTERRUPT; /* SunOS */ +#else + sig.sa_flags = SA_RESTART; +#endif + if (0 != sigaction (SIGPIPE, &sig, &oldsig)) + fprintf (stderr, + "Failed to install SIGPIPE handler: %s\n", strerror (errno)); +} +#endif + + +/** + * Entry point to demo. Note: this HTTP server will make all + * files in the current directory and its subdirectories available + * to anyone. Press ENTER to stop the server once it has started. + * + * @param argc number of arguments in argv + * @param argv first and only argument should be the port number + * @return 0 on success + */ +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + unsigned int port; + + if ( (argc != 2) || + (1 != sscanf (argv[1], "%u", &port)) || + (UINT16_MAX < port) ) + { + fprintf (stderr, + "%s PORT\n", argv[0]); + return 1; + } +#ifndef MINGW + ignore_sigpipe (); +#endif +#ifdef MHD_HAVE_LIBMAGIC + magic = magic_open (MAGIC_MIME_TYPE); + (void) magic_load (magic, NULL); +#endif /* MHD_HAVE_LIBMAGIC */ + + (void) pthread_mutex_init (&mutex, NULL); + file_not_found_response = MHD_create_response_from_buffer (strlen (FILE_NOT_FOUND_PAGE), + (void *) FILE_NOT_FOUND_PAGE, + MHD_RESPMEM_PERSISTENT); + mark_as_html (file_not_found_response); + request_refused_response = MHD_create_response_from_buffer (strlen (REQUEST_REFUSED_PAGE), + (void *) REQUEST_REFUSED_PAGE, + MHD_RESPMEM_PERSISTENT); + mark_as_html (request_refused_response); + internal_error_response = MHD_create_response_from_buffer (strlen (INTERNAL_ERROR_PAGE), + (void *) INTERNAL_ERROR_PAGE, + MHD_RESPMEM_PERSISTENT); + mark_as_html (internal_error_response); + update_directory (); + d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, + &generate_page, NULL, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (256 * 1024), +#if PRODUCTION + MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) (64), +#endif + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) (120 /* seconds */), + MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS, + MHD_OPTION_NOTIFY_COMPLETED, &response_completed_callback, NULL, + MHD_OPTION_END); + if (NULL == d) + return 1; + fprintf (stderr, "HTTP server running. Press ENTER to stop the server\n"); + (void) getc (stdin); + MHD_stop_daemon (d); + MHD_destroy_response (file_not_found_response); + MHD_destroy_response (request_refused_response); + MHD_destroy_response (internal_error_response); + update_cached_response (NULL); + (void) pthread_mutex_destroy (&mutex); +#ifdef MHD_HAVE_LIBMAGIC + magic_close (magic); +#endif /* MHD_HAVE_LIBMAGIC */ + return 0; +} + +/* end of demo.c */ diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c new file mode 100644 index 0000000..806464a --- /dev/null +++ b/src/examples/demo_https.c @@ -0,0 +1,987 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2013 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file demo_https.c + * @brief complex demonstration site: create directory index, offer + * upload via form and HTTP POST, download with mime type detection + * and error reporting (403, etc.) --- and all of this with + * high-performance settings (large buffers, thread pool). + * If you want to benchmark MHD, this code should be used to + * run tests against. Note that the number of threads may need + * to be adjusted depending on the number of available cores. + * Logic is identical to demo.c, just adds HTTPS support. + * @author Christian Grothoff + */ +#include "platform.h" +#include +#include +#include +#include +#include +#include +#ifdef MHD_HAVE_LIBMAGIC +#include +#endif /* MHD_HAVE_LIBMAGIC */ +#include +#include + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +/** + * Number of threads to run in the thread pool. Should (roughly) match + * the number of cores on your system. + */ +#define NUMBER_OF_THREADS CPU_COUNT + +#ifdef MHD_HAVE_LIBMAGIC +/** + * How many bytes of a file do we give to libmagic to determine the mime type? + * 16k might be a bit excessive, but ought not hurt performance much anyway, + * and should definitively be on the safe side. + */ +#define MAGIC_HEADER_SIZE (16 * 1024) +#endif /* MHD_HAVE_LIBMAGIC */ + + +/** + * Page returned for file-not-found. + */ +#define FILE_NOT_FOUND_PAGE "File not foundFile not found" + + +/** + * Page returned for internal errors. + */ +#define INTERNAL_ERROR_PAGE "Internal errorInternal error" + + +/** + * Page returned for refused requests. + */ +#define REQUEST_REFUSED_PAGE "Request refusedRequest refused (file exists?)" + + +/** + * Head of index page. + */ +#define INDEX_PAGE_HEADER "\nWelcome\n\n"\ + "

    Upload

    \n"\ + "
    \n"\ + "
    Content type:
    "\ + "Book"\ + "Image"\ + "Music"\ + "Software"\ + "Videos\n"\ + "Other
    "\ + "
    Language:
    "\ + "none"\ + "English"\ + "German"\ + "French"\ + "Spanish
    \n"\ + "
    File:
    "\ + "
    "\ + "\n"\ + "\n"\ + "

    Download

    \n"\ + "
      \n" + +/** + * Footer of index page. + */ +#define INDEX_PAGE_FOOTER "
    \n\n" + + +/** + * NULL-terminated array of supported upload categories. Should match HTML + * in the form. + */ +static const char * const categories[] = + { + "books", + "images", + "music", + "software", + "videos", + "other", + NULL, + }; + + +/** + * Specification of a supported language. + */ +struct Language +{ + /** + * Directory name for the language. + */ + const char *dirname; + + /** + * Long name for humans. + */ + const char *longname; + +}; + +/** + * NULL-terminated array of supported upload categories. Should match HTML + * in the form. + */ +static const struct Language languages[] = + { + { "no-lang", "No language specified" }, + { "en", "English" }, + { "de", "German" }, + { "fr", "French" }, + { "es", "Spanish" }, + { NULL, NULL }, + }; + + +/** + * Response returned if the requested file does not exist (or is not accessible). + */ +static struct MHD_Response *file_not_found_response; + +/** + * Response returned for internal errors. + */ +static struct MHD_Response *internal_error_response; + +/** + * Response returned for '/' (GET) to list the contents of the directory and allow upload. + */ +static struct MHD_Response *cached_directory_response; + +/** + * Response returned for refused uploads. + */ +static struct MHD_Response *request_refused_response; + +/** + * Mutex used when we update the cached directory response object. + */ +static pthread_mutex_t mutex; + +#ifdef MHD_HAVE_LIBMAGIC +/** + * Global handle to MAGIC data. + */ +static magic_t magic; +#endif /* MHD_HAVE_LIBMAGIC */ + + +/** + * Mark the given response as HTML for the brower. + * + * @param response response to mark + */ +static void +mark_as_html (struct MHD_Response *response) +{ + (void) MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + "text/html"); +} + + +/** + * Replace the existing 'cached_directory_response' with the + * given response. + * + * @param response new directory response + */ +static void +update_cached_response (struct MHD_Response *response) +{ + (void) pthread_mutex_lock (&mutex); + if (NULL != cached_directory_response) + MHD_destroy_response (cached_directory_response); + cached_directory_response = response; + (void) pthread_mutex_unlock (&mutex); +} + + +/** + * Context keeping the data for the response we're building. + */ +struct ResponseDataContext +{ + /** + * Response data string. + */ + char *buf; + + /** + * Number of bytes allocated for 'buf'. + */ + size_t buf_len; + + /** + * Current position where we append to 'buf'. Must be smaller or equal to 'buf_len'. + */ + size_t off; + +}; + + +/** + * Create a listing of the files in 'dirname' in HTML. + * + * @param rdc where to store the list of files + * @param dirname name of the directory to list + * @return MHD_YES on success, MHD_NO on error + */ +static int +list_directory (struct ResponseDataContext *rdc, + const char *dirname) +{ + char fullname[PATH_MAX]; + struct stat sbuf; + DIR *dir; + struct dirent *de; + + if (NULL == (dir = opendir (dirname))) + return MHD_NO; + while (NULL != (de = readdir (dir))) + { + if ('.' == de->d_name[0]) + continue; + if (sizeof (fullname) <= (size_t) + snprintf (fullname, sizeof (fullname), + "%s/%s", + dirname, de->d_name)) + continue; /* ugh, file too long? how can this be!? */ + if (0 != stat (fullname, &sbuf)) + continue; /* ugh, failed to 'stat' */ + if (! S_ISREG (sbuf.st_mode)) + continue; /* not a regular file, skip */ + if (rdc->off + 1024 > rdc->buf_len) + { + void *r; + + if ( (2 * rdc->buf_len + 1024) < rdc->buf_len) + break; /* more than SIZE_T _index_ size? Too big for us */ + rdc->buf_len = 2 * rdc->buf_len + 1024; + if (NULL == (r = realloc (rdc->buf, rdc->buf_len))) + break; /* out of memory */ + rdc->buf = r; + } + rdc->off += snprintf (&rdc->buf[rdc->off], + rdc->buf_len - rdc->off, + "
  • %s
  • \n", + fullname, + de->d_name); + } + (void) closedir (dir); + return MHD_YES; +} + + +/** + * Re-scan our local directory and re-build the index. + */ +static void +update_directory () +{ + static size_t initial_allocation = 32 * 1024; /* initial size for response buffer */ + struct MHD_Response *response; + struct ResponseDataContext rdc; + unsigned int language_idx; + unsigned int category_idx; + const struct Language *language; + const char *category; + char dir_name[128]; + struct stat sbuf; + + rdc.buf_len = initial_allocation; + if (NULL == (rdc.buf = malloc (rdc.buf_len))) + { + update_cached_response (NULL); + return; + } + rdc.off = snprintf (rdc.buf, rdc.buf_len, + "%s", + INDEX_PAGE_HEADER); + for (language_idx = 0; NULL != languages[language_idx].dirname; language_idx++) + { + language = &languages[language_idx]; + + if (0 != stat (language->dirname, &sbuf)) + continue; /* empty */ + /* we ensured always +1k room, filenames are ~256 bytes, + so there is always still enough space for the header + without need for an additional reallocation check. */ + rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off, + "

    %s

    \n", + language->longname); + for (category_idx = 0; NULL != categories[category_idx]; category_idx++) + { + category = categories[category_idx]; + snprintf (dir_name, sizeof (dir_name), + "%s/%s", + language->dirname, + category); + if (0 != stat (dir_name, &sbuf)) + continue; /* empty */ + + /* we ensured always +1k room, filenames are ~256 bytes, + so there is always still enough space for the header + without need for an additional reallocation check. */ + rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off, + "

    %s

    \n", + category); + + if (MHD_NO == list_directory (&rdc, dir_name)) + { + free (rdc.buf); + update_cached_response (NULL); + return; + } + } + } + /* we ensured always +1k room, filenames are ~256 bytes, + so there is always still enough space for the footer + without need for a final reallocation check. */ + rdc.off += snprintf (&rdc.buf[rdc.off], rdc.buf_len - rdc.off, + "%s", + INDEX_PAGE_FOOTER); + initial_allocation = rdc.buf_len; /* remember for next time */ + response = MHD_create_response_from_buffer (rdc.off, + rdc.buf, + MHD_RESPMEM_MUST_FREE); + mark_as_html (response); +#if FORCE_CLOSE + (void) MHD_add_response_header (response, + MHD_HTTP_HEADER_CONNECTION, + "close"); +#endif + update_cached_response (response); +} + + +/** + * Context we keep for an upload. + */ +struct UploadContext +{ + /** + * Handle where we write the uploaded file to. + */ + int fd; + + /** + * Name of the file on disk (used to remove on errors). + */ + char *filename; + + /** + * Language for the upload. + */ + char *language; + + /** + * Category for the upload. + */ + char *category; + + /** + * Post processor we're using to process the upload. + */ + struct MHD_PostProcessor *pp; + + /** + * Handle to connection that we're processing the upload for. + */ + struct MHD_Connection *connection; + + /** + * Response to generate, NULL to use directory. + */ + struct MHD_Response *response; +}; + + +/** + * Append the 'size' bytes from 'data' to '*ret', adding + * 0-termination. If '*ret' is NULL, allocate an empty string first. + * + * @param ret string to update, NULL or 0-terminated + * @param data data to append + * @param size number of bytes in 'data' + * @return MHD_NO on allocation failure, MHD_YES on success + */ +static int +do_append (char **ret, + const char *data, + size_t size) +{ + char *buf; + size_t old_len; + + if (NULL == *ret) + old_len = 0; + else + old_len = strlen (*ret); + buf = malloc (old_len + size + 1); + if (NULL == buf) + return MHD_NO; + memcpy (buf, *ret, old_len); + if (NULL != *ret) + free (*ret); + memcpy (&buf[old_len], data, size); + buf[old_len + size] = '\0'; + *ret = buf; + return MHD_YES; +} + + +/** + * Iterator over key-value pairs where the value + * maybe made available in increments and/or may + * not be zero-terminated. Used for processing + * POST data. + * + * @param cls user-specified closure + * @param kind type of the value, always MHD_POSTDATA_KIND when called from MHD + * @param key 0-terminated key for the value + * @param filename name of the uploaded file, NULL if not known + * @param content_type mime-type of the data, NULL if not known + * @param transfer_encoding encoding of the data, NULL if not known + * @param data pointer to size bytes of data at the + * specified offset + * @param off offset of data in the overall value + * @param size number of bytes in data available + * @return MHD_YES to continue iterating, + * MHD_NO to abort the iteration + */ +static int +process_upload_data (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, + uint64_t off, + size_t size) +{ + struct UploadContext *uc = cls; + int i; + (void)kind; /* Unused. Silent compiler warning. */ + (void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding; /* Unused. Silent compiler warning. */ + (void)off; /* Unused. Silent compiler warning. */ + + if (0 == strcmp (key, "category")) + return do_append (&uc->category, data, size); + if (0 == strcmp (key, "language")) + return do_append (&uc->language, data, size); + if (0 != strcmp (key, "upload")) + { + fprintf (stderr, + "Ignoring unexpected form value `%s'\n", + key); + return MHD_YES; /* ignore */ + } + if (NULL == filename) + { + fprintf (stderr, "No filename, aborting upload\n"); + return MHD_NO; /* no filename, error */ + } + if ( (NULL == uc->category) || + (NULL == uc->language) ) + { + fprintf (stderr, + "Missing form data for upload `%s'\n", + filename); + uc->response = request_refused_response; + return MHD_NO; + } + if (-1 == uc->fd) + { + char fn[PATH_MAX]; + + if ( (NULL != strstr (filename, "..")) || + (NULL != strchr (filename, '/')) || + (NULL != strchr (filename, '\\')) ) + { + uc->response = request_refused_response; + return MHD_NO; + } + /* create directories -- if they don't exist already */ +#ifdef WINDOWS + (void) mkdir (uc->language); +#else + (void) mkdir (uc->language, S_IRWXU); +#endif + snprintf (fn, sizeof (fn), + "%s/%s", + uc->language, + uc->category); +#ifdef WINDOWS + (void) mkdir (fn); +#else + (void) mkdir (fn, S_IRWXU); +#endif + /* open file */ + snprintf (fn, sizeof (fn), + "%s/%s/%s", + uc->language, + uc->category, + filename); + for (i=strlen (fn)-1;i>=0;i--) + if (! isprint ((int) fn[i])) + fn[i] = '_'; + uc->fd = open (fn, + O_CREAT | O_EXCL +#if O_LARGEFILE + | O_LARGEFILE +#endif + | O_WRONLY, + S_IRUSR | S_IWUSR); + if (-1 == uc->fd) + { + fprintf (stderr, + "Error opening file `%s' for upload: %s\n", + fn, + strerror (errno)); + uc->response = request_refused_response; + return MHD_NO; + } + uc->filename = strdup (fn); + } + if ( (0 != size) && + (size != (size_t) write (uc->fd, data, size)) ) + { + /* write failed; likely: disk full */ + fprintf (stderr, + "Error writing to file `%s': %s\n", + uc->filename, + strerror (errno)); + uc->response = internal_error_response; + close (uc->fd); + uc->fd = -1; + if (NULL != uc->filename) + { + unlink (uc->filename); + free (uc->filename); + uc->filename = NULL; + } + return MHD_NO; + } + return MHD_YES; +} + + +/** + * Function called whenever a request was completed. + * Used to clean up 'struct UploadContext' objects. + * + * @param cls client-defined closure, NULL + * @param connection connection handle + * @param con_cls value as set by the last call to + * the MHD_AccessHandlerCallback, points to NULL if this was + * not an upload + * @param toe reason for request termination + */ +static void +response_completed_callback (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct UploadContext *uc = *con_cls; + (void)cls; /* Unused. Silent compiler warning. */ + (void)connection; /* Unused. Silent compiler warning. */ + (void)toe; /* Unused. Silent compiler warning. */ + + if (NULL == uc) + return; /* this request wasn't an upload request */ + if (NULL != uc->pp) + { + MHD_destroy_post_processor (uc->pp); + uc->pp = NULL; + } + if (-1 != uc->fd) + { + (void) close (uc->fd); + if (NULL != uc->filename) + { + fprintf (stderr, + "Upload of file `%s' failed (incomplete or aborted), removing file.\n", + uc->filename); + (void) unlink (uc->filename); + } + } + if (NULL != uc->filename) + free (uc->filename); + free (uc); +} + + +/** + * Return the current directory listing. + * + * @param connection connection to return the directory for + * @return MHD_YES on success, MHD_NO on error + */ +static int +return_directory_response (struct MHD_Connection *connection) +{ + int ret; + + (void) pthread_mutex_lock (&mutex); + if (NULL == cached_directory_response) + ret = MHD_queue_response (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + internal_error_response); + else + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + cached_directory_response); + (void) pthread_mutex_unlock (&mutex); + return ret; +} + + +/** + * Main callback from MHD, used to generate the page. + * + * @param cls NULL + * @param connection connection handle + * @param url requested URL + * @param method GET, PUT, POST, etc. + * @param version HTTP version + * @param upload_data data from upload (PUT/POST) + * @param upload_data_size number of bytes in "upload_data" + * @param ptr our context + * @return #MHD_YES on success, #MHD_NO to drop connection + */ +static int +generate_page (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, void **ptr) +{ + struct MHD_Response *response; + int ret; + int fd; + struct stat buf; + (void)cls; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (url, "/")) + { + /* should be file download */ +#ifdef MHD_HAVE_LIBMAGIC + char file_data[MAGIC_HEADER_SIZE]; + ssize_t got; +#endif /* MHD_HAVE_LIBMAGIC */ + const char *mime; + + if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) + return MHD_NO; /* unexpected method (we're not polite...) */ + fd = -1; + if ( (NULL == strstr (&url[1], "..")) && + ('/' != url[1]) ) + { + fd = open (&url[1], O_RDONLY); + if ( (-1 != fd) && + ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) ) + { + (void) close (fd); + fd = -1; + } + } + if (-1 == fd) + return MHD_queue_response (connection, + MHD_HTTP_NOT_FOUND, + file_not_found_response); +#ifdef MHD_HAVE_LIBMAGIC + /* read beginning of the file to determine mime type */ + got = read (fd, file_data, sizeof (file_data)); + (void) lseek (fd, 0, SEEK_SET); + if (-1 != got) + mime = magic_buffer (magic, file_data, got); + else +#endif /* MHD_HAVE_LIBMAGIC */ + mime = NULL; + + if (NULL == (response = MHD_create_response_from_fd (buf.st_size, + fd))) + { + /* internal error (i.e. out of memory) */ + (void) close (fd); + return MHD_NO; + } + + /* add mime type if we had one */ + if (NULL != mime) + (void) MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + mime); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; + } + + if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) + { + /* upload! */ + struct UploadContext *uc = *ptr; + + if (NULL == uc) + { + if (NULL == (uc = malloc (sizeof (struct UploadContext)))) + return MHD_NO; /* out of memory, close connection */ + memset (uc, 0, sizeof (struct UploadContext)); + uc->fd = -1; + uc->connection = connection; + uc->pp = MHD_create_post_processor (connection, + 64 * 1024 /* buffer size */, + &process_upload_data, uc); + if (NULL == uc->pp) + { + /* out of memory, close connection */ + free (uc); + return MHD_NO; + } + *ptr = uc; + return MHD_YES; + } + if (0 != *upload_data_size) + { + if (NULL == uc->response) + (void) MHD_post_process (uc->pp, + upload_data, + *upload_data_size); + *upload_data_size = 0; + return MHD_YES; + } + /* end of upload, finish it! */ + MHD_destroy_post_processor (uc->pp); + uc->pp = NULL; + if (-1 != uc->fd) + { + close (uc->fd); + uc->fd = -1; + } + if (NULL != uc->response) + { + return MHD_queue_response (connection, + MHD_HTTP_FORBIDDEN, + uc->response); + } + else + { + update_directory (); + return return_directory_response (connection); + } + } + if (0 == strcmp (method, MHD_HTTP_METHOD_GET)) + { + return return_directory_response (connection); + } + + /* unexpected request, refuse */ + return MHD_queue_response (connection, + MHD_HTTP_FORBIDDEN, + request_refused_response); +} + + +#ifndef MINGW +/** + * Function called if we get a SIGPIPE. Does nothing. + * + * @param sig will be SIGPIPE (ignored) + */ +static void +catcher (int sig) +{ + (void)sig; /* Unused. Silent compiler warning. */ + /* do nothing */ +} + + +/** + * setup handlers to ignore SIGPIPE. + */ +static void +ignore_sigpipe (void) +{ + struct sigaction oldsig; + struct sigaction sig; + + sig.sa_handler = &catcher; + sigemptyset (&sig.sa_mask); +#ifdef SA_INTERRUPT + sig.sa_flags = SA_INTERRUPT; /* SunOS */ +#else + sig.sa_flags = SA_RESTART; +#endif + if (0 != sigaction (SIGPIPE, &sig, &oldsig)) + fprintf (stderr, + "Failed to install SIGPIPE handler: %s\n", strerror (errno)); +} +#endif + +/* test server key */ +const char srv_signed_key_pem[] = "-----BEGIN RSA PRIVATE KEY-----\n" + "MIIEowIBAAKCAQEAvfTdv+3fgvVTKRnP/HVNG81cr8TrUP/iiyuve/THMzvFXhCW\n" + "+K03KwEku55QvnUndwBfU/ROzLlv+5hotgiDRNFT3HxurmhouySBrJNJv7qWp8IL\n" + "q4sw32vo0fbMu5BZF49bUXK9L3kW2PdhTtSQPWHEzNrCxO+YgCilKHkY3vQNfdJ0\n" + "20Q5EAAEseD1YtWCIpRvJzYlZMpjYB1ubTl24kwrgOKUJYKqM4jmF4DVQp4oOK/6\n" + "QYGGh1QmHRPAy3CBII6sbb+sZT9cAqU6GYQVB35lm4XAgibXV6KgmpVxVQQ69U6x\n" + "yoOl204xuekZOaG9RUPId74Rtmwfi1TLbBzo2wIDAQABAoIBADu09WSICNq5cMe4\n" + "+NKCLlgAT1NiQpLls1gKRbDhKiHU9j8QWNvWWkJWrCya4QdUfLCfeddCMeiQmv3K\n" + "lJMvDs+5OjJSHFoOsGiuW2Ias7IjnIojaJalfBml6frhJ84G27IXmdz6gzOiTIer\n" + "DjeAgcwBaKH5WwIay2TxIaScl7AwHBauQkrLcyb4hTmZuQh6ArVIN6+pzoVuORXM\n" + "bpeNWl2l/HSN3VtUN6aCAKbN/X3o0GavCCMn5Fa85uJFsab4ss/uP+2PusU71+zP\n" + "sBm6p/2IbGvF5k3VPDA7X5YX61sukRjRBihY8xSnNYx1UcoOsX6AiPnbhifD8+xQ\n" + "Tlf8oJUCgYEA0BTfzqNpr9Wxw5/QXaSdw7S/0eP5a0C/nwURvmfSzuTD4equzbEN\n" + "d+dI/s2JMxrdj/I4uoAfUXRGaabevQIjFzC9uyE3LaOyR2zhuvAzX+vVcs6bSXeU\n" + "pKpCAcN+3Z3evMaX2f+z/nfSUAl2i4J2R+/LQAWJW4KwRky/m+cxpfUCgYEA6bN1\n" + "b73bMgM8wpNt6+fcmS+5n0iZihygQ2U2DEud8nZJL4Nrm1dwTnfZfJBnkGj6+0Q0\n" + "cOwj2KS0/wcEdJBP0jucU4v60VMhp75AQeHqidIde0bTViSRo3HWKXHBIFGYoU3T\n" + "LyPyKndbqsOObnsFXHn56Nwhr2HLf6nw4taGQY8CgYBoSW36FLCNbd6QGvLFXBGt\n" + "2lMhEM8az/K58kJ4WXSwOLtr6MD/WjNT2tkcy0puEJLm6BFCd6A6pLn9jaKou/92\n" + "SfltZjJPb3GUlp9zn5tAAeSSi7YMViBrfuFiHObij5LorefBXISLjuYbMwL03MgH\n" + "Ocl2JtA2ywMp2KFXs8GQWQKBgFyIVv5ogQrbZ0pvj31xr9HjqK6d01VxIi+tOmpB\n" + "4ocnOLEcaxX12BzprW55ytfOCVpF1jHD/imAhb3YrHXu0fwe6DXYXfZV4SSG2vB7\n" + "IB9z14KBN5qLHjNGFpMQXHSMek+b/ftTU0ZnPh9uEM5D3YqRLVd7GcdUhHvG8P8Q\n" + "C9aXAoGBAJtID6h8wOGMP0XYX5YYnhlC7dOLfk8UYrzlp3xhqVkzKthTQTj6wx9R\n" + "GtC4k7U1ki8oJsfcIlBNXd768fqDVWjYju5rzShMpo8OCTS6ipAblKjCxPPVhIpv\n" + "tWPlbSn1qj6wylstJ5/3Z+ZW5H4wIKp5jmLiioDhcP0L/Ex3Zx8O\n" + "-----END RSA PRIVATE KEY-----\n"; + +/* test server CA signed certificates */ +const char srv_signed_cert_pem[] = "-----BEGIN CERTIFICATE-----\n" + "MIIDGzCCAgWgAwIBAgIES0KCvTALBgkqhkiG9w0BAQUwFzEVMBMGA1UEAxMMdGVz\n" + "dF9jYV9jZXJ0MB4XDTEwMDEwNTAwMDcyNVoXDTQ1MDMxMjAwMDcyNVowFzEVMBMG\n" + "A1UEAxMMdGVzdF9jYV9jZXJ0MIIBHzALBgkqhkiG9w0BAQEDggEOADCCAQkCggEA\n" + "vfTdv+3fgvVTKRnP/HVNG81cr8TrUP/iiyuve/THMzvFXhCW+K03KwEku55QvnUn\n" + "dwBfU/ROzLlv+5hotgiDRNFT3HxurmhouySBrJNJv7qWp8ILq4sw32vo0fbMu5BZ\n" + "F49bUXK9L3kW2PdhTtSQPWHEzNrCxO+YgCilKHkY3vQNfdJ020Q5EAAEseD1YtWC\n" + "IpRvJzYlZMpjYB1ubTl24kwrgOKUJYKqM4jmF4DVQp4oOK/6QYGGh1QmHRPAy3CB\n" + "II6sbb+sZT9cAqU6GYQVB35lm4XAgibXV6KgmpVxVQQ69U6xyoOl204xuekZOaG9\n" + "RUPId74Rtmwfi1TLbBzo2wIDAQABo3YwdDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQM\n" + "MAoGCCsGAQUFBwMBMA8GA1UdDwEB/wQFAwMHIAAwHQYDVR0OBBYEFOFi4ilKOP1d\n" + "XHlWCMwmVKr7mgy8MB8GA1UdIwQYMBaAFP2olB4s2T/xuoQ5pT2RKojFwZo2MAsG\n" + "CSqGSIb3DQEBBQOCAQEAHVWPxazupbOkG7Did+dY9z2z6RjTzYvurTtEKQgzM2Vz\n" + "GQBA+3pZ3c5mS97fPIs9hZXfnQeelMeZ2XP1a+9vp35bJjZBBhVH+pqxjCgiUflg\n" + "A3Zqy0XwwVCgQLE2HyaU3DLUD/aeIFK5gJaOSdNTXZLv43K8kl4cqDbMeRpVTbkt\n" + "YmG4AyEOYRNKGTqMEJXJoxD5E3rBUNrVI/XyTjYrulxbNPcMWEHKNeeqWpKDYTFo\n" + "Bb01PCthGXiq/4A2RLAFosadzRa8SBpoSjPPfZ0b2w4MJpReHqKbR5+T2t6hzml6\n" + "4ToyOKPDmamiTuN5KzLN3cw7DQlvWMvqSOChPLnA3Q==\n" + "-----END CERTIFICATE-----\n"; + + +/** + * Entry point to demo. Note: this HTTP server will make all + * files in the current directory and its subdirectories available + * to anyone. Press ENTER to stop the server once it has started. + * + * @param argc number of arguments in argv + * @param argv first and only argument should be the port number + * @return 0 on success + */ +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + unsigned int port; + + if ( (argc != 2) || + (1 != sscanf (argv[1], "%u", &port)) || + (UINT16_MAX < port) ) + { + fprintf (stderr, + "%s PORT\n", argv[0]); + return 1; + } + #ifndef MINGW + ignore_sigpipe (); + #endif +#ifdef MHD_HAVE_LIBMAGIC + magic = magic_open (MAGIC_MIME_TYPE); + (void) magic_load (magic, NULL); +#endif /* MHD_HAVE_LIBMAGIC */ + + (void) pthread_mutex_init (&mutex, NULL); + file_not_found_response = MHD_create_response_from_buffer (strlen (FILE_NOT_FOUND_PAGE), + (void *) FILE_NOT_FOUND_PAGE, + MHD_RESPMEM_PERSISTENT); + mark_as_html (file_not_found_response); + request_refused_response = MHD_create_response_from_buffer (strlen (REQUEST_REFUSED_PAGE), + (void *) REQUEST_REFUSED_PAGE, + MHD_RESPMEM_PERSISTENT); + mark_as_html (request_refused_response); + internal_error_response = MHD_create_response_from_buffer (strlen (INTERNAL_ERROR_PAGE), + (void *) INTERNAL_ERROR_PAGE, + MHD_RESPMEM_PERSISTENT); + mark_as_html (internal_error_response); + update_directory (); + d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_TLS, + port, + NULL, NULL, + &generate_page, NULL, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (256 * 1024), +#if PRODUCTION + MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) (64), +#endif + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) (120 /* seconds */), + MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) NUMBER_OF_THREADS, + MHD_OPTION_NOTIFY_COMPLETED, &response_completed_callback, NULL, + MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, + MHD_OPTION_END); + if (NULL == d) + return 1; + fprintf (stderr, "HTTP server running. Press ENTER to stop the server\n"); + (void) getc (stdin); + MHD_stop_daemon (d); + MHD_destroy_response (file_not_found_response); + MHD_destroy_response (request_refused_response); + MHD_destroy_response (internal_error_response); + update_cached_response (NULL); + (void) pthread_mutex_destroy (&mutex); +#ifdef MHD_HAVE_LIBMAGIC + magic_close (magic); +#endif /* MHD_HAVE_LIBMAGIC */ + return 0; +} + +/* end of demo_https.c */ diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c new file mode 100644 index 0000000..889967f --- /dev/null +++ b/src/examples/digest_auth_example.c @@ -0,0 +1,148 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2010 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file digest_auth_example.c + * @brief minimal example for how to use digest auth with libmicrohttpd + * @author Amr Ali + */ + +#include "platform.h" +#include +#include + +#define PAGE "libmicrohttpd demoAccess granted" + +#define DENIED "libmicrohttpd demoAccess denied" + +#define MY_OPAQUE_STR "11733b200778ce33060f31c9af70a870ba96ddd4" + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + struct MHD_Response *response; + char *username; + const char *password = "testpass"; + const char *realm = "test@example.com"; + int ret; + (void)cls; /* Unused. Silent compiler warning. */ + (void)url; /* Unused. Silent compiler warning. */ + (void)method; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + (void)ptr; /* Unused. Silent compiler warning. */ + + username = MHD_digest_auth_get_username(connection); + if (NULL == username) + { + response = MHD_create_response_from_buffer(strlen (DENIED), + DENIED, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_auth_fail_response(connection, realm, + MY_OPAQUE_STR, + response, + MHD_NO); + MHD_destroy_response(response); + return ret; + } + ret = MHD_digest_auth_check(connection, realm, + username, + password, + 300); + MHD_free (username); + if ( (ret == MHD_INVALID_NONCE) || + (ret == MHD_NO) ) + { + response = MHD_create_response_from_buffer(strlen (DENIED), + DENIED, + MHD_RESPMEM_PERSISTENT); + if (NULL == response) + return MHD_NO; + ret = MHD_queue_auth_fail_response(connection, realm, + MY_OPAQUE_STR, + response, + (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); + MHD_destroy_response(response); + return ret; + } + response = MHD_create_response_from_buffer(strlen(PAGE), PAGE, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + MHD_destroy_response(response); + return ret; +} + + +int +main (int argc, char *const *argv) +{ + int fd; + char rnd[8]; + ssize_t len; + size_t off; + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + fd = open("/dev/urandom", O_RDONLY); + if (-1 == fd) + { + fprintf (stderr, "Failed to open `%s': %s\n", + "/dev/urandom", + strerror (errno)); + return 1; + } + off = 0; + while (off < 8) + { + len = read(fd, rnd, 8); + if (len == -1) + { + fprintf (stderr, "Failed to read `%s': %s\n", + "/dev/urandom", + strerror (errno)); + (void) close (fd); + return 1; + } + off += len; + } + (void) close(fd); + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, &ahc_echo, PAGE, + MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof(rnd), rnd, + MHD_OPTION_NONCE_NC_SIZE, 300, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} + +/* end of digest_auth_example.c */ diff --git a/src/examples/dual_stack_example.c b/src/examples/dual_stack_example.c new file mode 100644 index 0000000..31b2543 --- /dev/null +++ b/src/examples/dual_stack_example.c @@ -0,0 +1,83 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2012 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file dual_stack_example.c + * @brief how to use MHD with both IPv4 and IPv6 support (dual-stack) + * @author Christian Grothoff + */ + +#include "platform.h" +#include + +#define PAGE "libmicrohttpd demolibmicrohttpd demo" + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + response = MHD_create_response_from_buffer (strlen (me), + (void *) me, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_DUAL_STACK, + atoi (argv[1]), + NULL, NULL, &ahc_echo, PAGE, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_END); + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c new file mode 100644 index 0000000..b8935fa --- /dev/null +++ b/src/examples/fileserver_example.c @@ -0,0 +1,133 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file fileserver_example.c + * @brief minimal example for how to use libmicrohttpd to serve files + * @author Christian Grothoff + */ + +#include "platform.h" +#include +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#ifdef HAVE_SYS_STAT_H +#include +#endif /* HAVE_SYS_STAT_H */ +#ifdef HAVE_FCNTL_H +#include +#endif /* HAVE_FCNTL_H */ + +#define PAGE "File not foundFile not found" + +#ifndef S_ISREG +#define S_ISREG(x) (S_IFREG == (x & S_IFREG)) +#endif /* S_ISREG */ + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, void **ptr) +{ + static int aptr; + struct MHD_Response *response; + int ret; + int fd; + struct stat buf; + (void)cls; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if ( (0 != strcmp (method, MHD_HTTP_METHOD_GET)) && + (0 != strcmp (method, MHD_HTTP_METHOD_HEAD)) ) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + /* WARNING: direct usage of url as filename is for example only! + * NEVER pass received data directly as parameter to file manipulation + * functions. Always check validity of data before using. + */ + if (NULL != strstr(url, "../")) /* Very simplified check! */ + fd = -1; /* Do not allow usage of parent directories. */ + else + fd = open (url + 1, O_RDONLY); + if (-1 != fd) + { + if ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) + { + /* not a regular file, refuse to serve */ + if (0 != close (fd)) + abort (); + fd = -1; + } + } + if (-1 == fd) + { + response = MHD_create_response_from_buffer (strlen (PAGE), + (void *) PAGE, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response); + MHD_destroy_response (response); + } + else + { + response = MHD_create_response_from_fd64 (buf.st_size, fd); + if (NULL == response) + { + if (0 != close (fd)) + abort (); + return MHD_NO; + } + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + } + return ret; +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/fileserver_example_dirs.c b/src/examples/fileserver_example_dirs.c new file mode 100644 index 0000000..8c37f21 --- /dev/null +++ b/src/examples/fileserver_example_dirs.c @@ -0,0 +1,206 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file fileserver_example_dirs.c + * @brief example for how to use libmicrohttpd to serve files (with directory support) + * @author Christian Grothoff + */ + +#include "platform.h" +#include +#include +#include + +#define PAGE "File not foundFile not found" + + +static ssize_t +file_reader (void *cls, uint64_t pos, char *buf, size_t max) +{ + FILE *file = cls; + + (void) fseek (file, pos, SEEK_SET); + return fread (buf, 1, max, file); +} + + +static void +file_free_callback (void *cls) +{ + FILE *file = cls; + fclose (file); +} + + +static void +dir_free_callback (void *cls) +{ + DIR *dir = cls; + if (dir != NULL) + closedir (dir); +} + + +static ssize_t +dir_reader (void *cls, uint64_t pos, char *buf, size_t max) +{ + DIR *dir = cls; + struct dirent *e; + + if (max < 512) + return 0; + (void)pos; /* 'pos' is ignored as function return next one single entry per call. */ + do + { + e = readdir (dir); + if (e == NULL) + return MHD_CONTENT_READER_END_OF_STREAM; + } while (e->d_name[0] == '.'); + return snprintf (buf, max, + "%s
    ", + e->d_name, + e->d_name); +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, void **ptr) +{ + static int aptr; + struct MHD_Response *response; + int ret; + FILE *file; + int fd; + DIR *dir; + struct stat buf; + char emsg[1024]; + (void)cls; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + + file = fopen (&url[1], "rb"); + if (NULL != file) + { + fd = fileno (file); + if (-1 == fd) + { + (void) fclose (file); + return MHD_NO; /* internal error */ + } + if ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) + { + /* not a regular file, refuse to serve */ + fclose (file); + file = NULL; + } + } + + if (NULL == file) + { + dir = opendir ("."); + if (NULL == dir) + { + /* most likely cause: more concurrent requests than + available file descriptors / 2 */ + snprintf (emsg, + sizeof (emsg), + "Failed to open directory `.': %s\n", + strerror (errno)); + response = MHD_create_response_from_buffer (strlen (emsg), + emsg, + MHD_RESPMEM_MUST_COPY); + if (NULL == response) + return MHD_NO; + ret = MHD_queue_response (connection, + MHD_HTTP_SERVICE_UNAVAILABLE, + response); + MHD_destroy_response (response); + } + else + { + response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, + 32 * 1024, + &dir_reader, + dir, + &dir_free_callback); + if (NULL == response) + { + closedir (dir); + return MHD_NO; + } + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + } + } + else + { + response = MHD_create_response_from_callback (buf.st_size, 32 * 1024, /* 32k page size */ + &file_reader, + file, + &file_free_callback); + if (NULL == response) + { + fclose (file); + return MHD_NO; + } + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + } + return ret; +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); + if (NULL == d) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/fileserver_example_external_select.c b/src/examples/fileserver_example_external_select.c new file mode 100644 index 0000000..6aea6db --- /dev/null +++ b/src/examples/fileserver_example_external_select.c @@ -0,0 +1,175 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file fileserver_example_external_select.c + * @brief minimal example for how to use libmicrohttpd to server files + * @author Christian Grothoff + */ + +#include "platform.h" +#include +#include +#include + +#define PAGE "File not foundFile not found" + +static ssize_t +file_reader (void *cls, uint64_t pos, char *buf, size_t max) +{ + FILE *file = cls; + + (void) fseek (file, pos, SEEK_SET); + return fread (buf, 1, max, file); +} + + +static void +free_callback (void *cls) +{ + FILE *file = cls; + fclose (file); +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, void **ptr) +{ + static int aptr; + struct MHD_Response *response; + int ret; + FILE *file; + int fd; + struct stat buf; + (void)cls; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + + file = fopen (&url[1], "rb"); + if (NULL != file) + { + fd = fileno (file); + if (-1 == fd) + { + (void) fclose (file); + return MHD_NO; /* internal error */ + } + if ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) + { + /* not a regular file, refuse to serve */ + fclose (file); + file = NULL; + } + } + + if (NULL == file) + { + response = MHD_create_response_from_buffer (strlen (PAGE), + (void *) PAGE, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response); + MHD_destroy_response (response); + } + else + { + response = MHD_create_response_from_callback (buf.st_size, 32 * 1024, /* 32k page size */ + &file_reader, + file, + &free_callback); + if (NULL == response) + { + fclose (file); + return MHD_NO; + } + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + } + return ret; +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + time_t end; + time_t t; + struct timeval tv; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max; + MHD_UNSIGNED_LONG_LONG mhd_timeout; + + if (argc != 3) + { + printf ("%s PORT SECONDS-TO-RUN\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); + if (d == NULL) + return 1; + end = time (NULL) + atoi (argv[2]); + while ((t = time (NULL)) < end) + { + tv.tv_sec = end - t; + tv.tv_usec = 0; + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + break; /* fatal internal error */ + if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES) + { + if (((MHD_UNSIGNED_LONG_LONG)tv.tv_sec) < mhd_timeout / 1000LL) + { + tv.tv_sec = mhd_timeout / 1000LL; + tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000LL)) * 1000LL; + } + } + if (-1 == select (max + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } + MHD_run (d); + } + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/https_fileserver_example.c b/src/examples/https_fileserver_example.c new file mode 100644 index 0000000..e48a150 --- /dev/null +++ b/src/examples/https_fileserver_example.c @@ -0,0 +1,228 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file https_fileserver_example.c + * @brief a simple HTTPS file server using TLS. + * + * Usage : + * + * 'http_fileserver_example HTTP-PORT SECONDS-TO-RUN' + * + * The certificate & key are required by the server to operate, Omitting the + * path arguments will cause the server to use the hard coded example certificate & key. + * + * 'certtool' may be used to generate these if required. + * + * @author Sagie Amir + */ + +#include "platform.h" +#include +#include + +#define BUF_SIZE 1024 +#define MAX_URL_LEN 255 + +/* TODO remove if unused */ +#define CAFILE "ca.pem" +#define CRLFILE "crl.pem" + +#define EMPTY_PAGE "File not foundFile not found" + +/* Test Certificate */ +const char cert_pem[] = + "-----BEGIN CERTIFICATE-----\n" + "MIICpjCCAZCgAwIBAgIESEPtjjALBgkqhkiG9w0BAQUwADAeFw0wODA2MDIxMjU0\n" + "MzhaFw0wOTA2MDIxMjU0NDZaMAAwggEfMAsGCSqGSIb3DQEBAQOCAQ4AMIIBCQKC\n" + "AQC03TyUvK5HmUAirRp067taIEO4bibh5nqolUoUdo/LeblMQV+qnrv/RNAMTx5X\n" + "fNLZ45/kbM9geF8qY0vsPyQvP4jumzK0LOJYuIwmHaUm9vbXnYieILiwCuTgjaud\n" + "3VkZDoQ9fteIo+6we9UTpVqZpxpbLulBMh/VsvX0cPJ1VFC7rT59o9hAUlFf9jX/\n" + "GmKdYI79MtgVx0OPBjmmSD6kicBBfmfgkO7bIGwlRtsIyMznxbHu6VuoX/eVxrTv\n" + "rmCwgEXLWRZ6ru8MQl5YfqeGXXRVwMeXU961KefbuvmEPccgCxm8FZ1C1cnDHFXh\n" + "siSgAzMBjC/b6KVhNQ4KnUdZAgMBAAGjLzAtMAwGA1UdEwEB/wQCMAAwHQYDVR0O\n" + "BBYEFJcUvpjvE5fF/yzUshkWDpdYiQh/MAsGCSqGSIb3DQEBBQOCAQEARP7eKSB2\n" + "RNd6XjEjK0SrxtoTnxS3nw9sfcS7/qD1+XHdObtDFqGNSjGYFB3Gpx8fpQhCXdoN\n" + "8QUs3/5ZVa5yjZMQewWBgz8kNbnbH40F2y81MHITxxCe1Y+qqHWwVaYLsiOTqj2/\n" + "0S3QjEJ9tvklmg7JX09HC4m5QRYfWBeQLD1u8ZjA1Sf1xJriomFVyRLI2VPO2bNe\n" + "JDMXWuP+8kMC7gEvUnJ7A92Y2yrhu3QI3bjPk8uSpHea19Q77tul1UVBJ5g+zpH3\n" + "OsF5p0MyaVf09GTzcLds5nE/osTdXGUyHJapWReVmPm3Zn6gqYlnzD99z+DPIgIV\n" + "RhZvQx74NQnS6g==\n" "-----END CERTIFICATE-----\n"; + +const char key_pem[] = + "-----BEGIN RSA PRIVATE KEY-----\n" + "MIIEowIBAAKCAQEAtN08lLyuR5lAIq0adOu7WiBDuG4m4eZ6qJVKFHaPy3m5TEFf\n" + "qp67/0TQDE8eV3zS2eOf5GzPYHhfKmNL7D8kLz+I7psytCziWLiMJh2lJvb2152I\n" + "niC4sArk4I2rnd1ZGQ6EPX7XiKPusHvVE6VamacaWy7pQTIf1bL19HDydVRQu60+\n" + "faPYQFJRX/Y1/xpinWCO/TLYFcdDjwY5pkg+pInAQX5n4JDu2yBsJUbbCMjM58Wx\n" + "7ulbqF/3lca0765gsIBFy1kWeq7vDEJeWH6nhl10VcDHl1PetSnn27r5hD3HIAsZ\n" + "vBWdQtXJwxxV4bIkoAMzAYwv2+ilYTUOCp1HWQIDAQABAoIBAArOQv3R7gmqDspj\n" + "lDaTFOz0C4e70QfjGMX0sWnakYnDGn6DU19iv3GnX1S072ejtgc9kcJ4e8VUO79R\n" + "EmqpdRR7k8dJr3RTUCyjzf/C+qiCzcmhCFYGN3KRHA6MeEnkvRuBogX4i5EG1k5l\n" + "/5t+YBTZBnqXKWlzQLKoUAiMLPg0eRWh+6q7H4N7kdWWBmTpako7TEqpIwuEnPGx\n" + "u3EPuTR+LN6lF55WBePbCHccUHUQaXuav18NuDkcJmCiMArK9SKb+h0RqLD6oMI/\n" + "dKD6n8cZXeMBkK+C8U/K0sN2hFHACsu30b9XfdnljgP9v+BP8GhnB0nCB6tNBCPo\n" + "32srOwECgYEAxWh3iBT4lWqL6bZavVbnhmvtif4nHv2t2/hOs/CAq8iLAw0oWGZc\n" + "+JEZTUDMvFRlulr0kcaWra+4fN3OmJnjeuFXZq52lfMgXBIKBmoSaZpIh2aDY1Rd\n" + "RbEse7nQl9hTEPmYspiXLGtnAXW7HuWqVfFFP3ya8rUS3t4d07Hig8ECgYEA6ou6\n" + "OHiBRTbtDqLIv8NghARc/AqwNWgEc9PelCPe5bdCOLBEyFjqKiT2MttnSSUc2Zob\n" + "XhYkHC6zN1Mlq30N0e3Q61YK9LxMdU1vsluXxNq2rfK1Scb1oOlOOtlbV3zA3VRF\n" + "hV3t1nOA9tFmUrwZi0CUMWJE/zbPAyhwWotKyZkCgYEAh0kFicPdbABdrCglXVae\n" + "SnfSjVwYkVuGd5Ze0WADvjYsVkYBHTvhgRNnRJMg+/vWz3Sf4Ps4rgUbqK8Vc20b\n" + "AU5G6H6tlCvPRGm0ZxrwTWDHTcuKRVs+pJE8C/qWoklE/AAhjluWVoGwUMbPGuiH\n" + "6Gf1bgHF6oj/Sq7rv/VLZ8ECgYBeq7ml05YyLuJutuwa4yzQ/MXfghzv4aVyb0F3\n" + "QCdXR6o2IYgR6jnSewrZKlA9aPqFJrwHNR6sNXlnSmt5Fcf/RWO/qgJQGLUv3+rG\n" + "7kuLTNDR05azSdiZc7J89ID3Bkb+z2YkV+6JUiPq/Ei1+nDBEXb/m+/HqALU/nyj\n" + "P3gXeQKBgBusb8Rbd+KgxSA0hwY6aoRTPRt8LNvXdsB9vRcKKHUFQvxUWiUSS+L9\n" + "/Qu1sJbrUquKOHqksV5wCnWnAKyJNJlhHuBToqQTgKXjuNmVdYSe631saiI7PHyC\n" + "eRJ6DxULPxABytJrYCRrNqmXi5TCiqR2mtfalEMOPxz8rUU8dYyx\n" + "-----END RSA PRIVATE KEY-----\n"; + +static ssize_t +file_reader (void *cls, uint64_t pos, char *buf, size_t max) +{ + FILE *file = cls; + + (void) fseek (file, pos, SEEK_SET); + return fread (buf, 1, max, file); +} + +static void +file_free_callback (void *cls) +{ + FILE *file = cls; + fclose (file); +} + +/* HTTP access handler call back */ +static int +http_ahc (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, void **ptr) +{ + static int aptr; + struct MHD_Response *response; + int ret; + FILE *file; + int fd; + struct stat buf; + (void)cls; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + + file = fopen (&url[1], "rb"); + if (NULL != file) + { + fd = fileno (file); + if (-1 == fd) + { + (void) fclose (file); + return MHD_NO; /* internal error */ + } + if ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) + { + /* not a regular file, refuse to serve */ + fclose (file); + file = NULL; + } + } + + if (NULL == file) + { + response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE), + (void *) EMPTY_PAGE, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_NOT_FOUND, response); + MHD_destroy_response (response); + } + else + { + response = MHD_create_response_from_callback (buf.st_size, 32 * 1024, /* 32k PAGE_NOT_FOUND size */ + &file_reader, file, + &file_free_callback); + if (NULL == response) + { + fclose (file); + return MHD_NO; + } + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + } + return ret; +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *TLS_daemon; + int port; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + port = atoi (argv[1]); + if ( (1 > port) || + (port > UINT16_MAX) ) + { + fprintf (stderr, + "Port must be a number between 1 and 65535\n"); + return 1; + } + + TLS_daemon = + MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | + MHD_USE_TLS, + (uint16_t) port, + NULL, NULL, + &http_ahc, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, 256, + MHD_OPTION_HTTPS_MEM_KEY, key_pem, + MHD_OPTION_HTTPS_MEM_CERT, cert_pem, + MHD_OPTION_END); + if (NULL == TLS_daemon) + { + fprintf (stderr, "Error: failed to start TLS_daemon\n"); + return 1; + } + printf ("MHD daemon listening on port %u\n", + (unsigned int) port); + + (void) getc (stdin); + + MHD_stop_daemon (TLS_daemon); + return 0; +} diff --git a/src/examples/minimal_example.c b/src/examples/minimal_example.c new file mode 100644 index 0000000..4cf6401 --- /dev/null +++ b/src/examples/minimal_example.c @@ -0,0 +1,89 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file minimal_example.c + * @brief minimal example for how to use libmicrohttpd + * @author Christian Grothoff + */ + +#include "platform.h" +#include + +#define PAGE "libmicrohttpd demolibmicrohttpd demo" + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + response = MHD_create_response_from_buffer (strlen (me), + (void *) me, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (/* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ + MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + /* MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, */ + /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | MHD_USE_POLL, */ + /* MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, */ + atoi (argv[1]), + NULL, NULL, &ahc_echo, PAGE, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_STRICT_FOR_CLIENT, (int) 1, + MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/minimal_example_comet.c b/src/examples/minimal_example_comet.c new file mode 100644 index 0000000..c4a3395 --- /dev/null +++ b/src/examples/minimal_example_comet.c @@ -0,0 +1,92 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file minimal_example.c + * @brief minimal example for how to generate an infinite stream with libmicrohttpd + * @author Christian Grothoff + */ + +#include "platform.h" +#include + +static ssize_t +data_generator (void *cls, uint64_t pos, char *buf, size_t max) +{ + (void)cls; /* Unused. Silent compiler warning. */ + (void)pos; /* Unused. Silent compiler warning. */ + if (max < 80) + return 0; + memset (buf, 'A', max - 1); + buf[79] = '\n'; + return 80; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + struct MHD_Response *response; + int ret; + (void)cls; /* Unused. Silent compiler warning. */ + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, + 80, + &data_generator, NULL, NULL); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/msgs_i18n.c b/src/examples/msgs_i18n.c new file mode 100755 index 0000000..2d8eb56 --- /dev/null +++ b/src/examples/msgs_i18n.c @@ -0,0 +1,95 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2017 Christian Grothoff, Silvio Clecio (silvioprog) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file msgs_i18n.c + * @brief example for how to use translate libmicrohttpd messages + * @author Christian Grothoff + * @author Silvio Clecio (silvioprog) + */ + +/* + * suposing you are in Brazil: + * + * # generate the PO file + * $ msginit --input=po/libmicrohttpd.pot --locale=pt_BR --output=libmicrohttpd.po + * # open the generated .po in any program like Poedit and translate the MHD messages; once done, let's go to the test: + * mkdir -p src/examples/locale/pt_BR/LC_MESSAGES + * mv libmicrohttpd.mo libmicrohttpd.po src/examples/locale/pt_BR/LC_MESSAGES + * cd src/examples/ + * gcc -o msgs_i18n msgs_i18n.c -lmicrohttpd + * export LANGUAGE=pt_BR + * ./msgs_i18n + * # it may print: Opção inválida 4196490! (Você terminou a lista com MHD_OPTION_END?) + */ +#include +#include +#include +#include + + +static int +ahc_echo (void *cls, + struct MHD_Connection *cnc, + const char *url, + const char *mt, + const char *ver, + const char *upd, + size_t *upsz, + void **ptr) +{ + return MHD_NO; +} + + +static void +error_handler (void *cls, + const char *fm, + va_list ap) +{ + /* Here we do the translation using GNU gettext. + As the error message is from libmicrohttpd, we specify + "libmicrohttpd" as the translation domain here. */ + vprintf (dgettext ("libmicrohttpd", + fm), + ap); +} + + +int +main (int argc, + char **argv) +{ + setlocale(LC_ALL, ""); + + /* The example uses PO files in the directory + "libmicrohttpd/src/examples/locale". This + needs to be adapted to match + where the MHD PO files are installed. */ + bindtextdomain ("libmicrohttpd", + "locale"); + MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_FEATURE_MESSAGES | MHD_USE_ERROR_LOG, + 8080, + NULL, NULL, + &ahc_echo, NULL, + MHD_OPTION_EXTERNAL_LOGGER, &error_handler, NULL, + 99999 /* invalid option, to raise the error + "Invalid option ..." which we are going + to translate */); + return 1; /* This program won't "succeed"... */ +} diff --git a/src/examples/post_example.c b/src/examples/post_example.c new file mode 100644 index 0000000..6c9a3f4 --- /dev/null +++ b/src/examples/post_example.c @@ -0,0 +1,776 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2011 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file post_example.c + * @brief example for processing POST requests using libmicrohttpd + * @author Christian Grothoff + */ + +#include +#include +#include +#include +#include +#include + +/** + * Invalid method page. + */ +#define METHOD_ERROR "Illegal requestGo away." + +/** + * Invalid URL page. + */ +#define NOT_FOUND_ERROR "Not foundGo away." + +/** + * Front page. (/) + */ +#define MAIN_PAGE "Welcome
    What is your name? " + +/** + * Second page. (/2) + */ +#define SECOND_PAGE "Tell me moreprevious %s, what is your job? " + +/** + * Second page (/S) + */ +#define SUBMIT_PAGE "Ready to submit?previous " + +/** + * Last page. + */ +#define LAST_PAGE "Thank youThank you." + +/** + * Name of our cookie. + */ +#define COOKIE_NAME "session" + + +/** + * State we keep for each user/session/browser. + */ +struct Session +{ + /** + * We keep all sessions in a linked list. + */ + struct Session *next; + + /** + * Unique ID for this session. + */ + char sid[33]; + + /** + * Reference counter giving the number of connections + * currently using this session. + */ + unsigned int rc; + + /** + * Time when this session was last active. + */ + time_t start; + + /** + * String submitted via form. + */ + char value_1[64]; + + /** + * Another value submitted via form. + */ + char value_2[64]; + +}; + + +/** + * Data kept per request. + */ +struct Request +{ + + /** + * Associated session. + */ + struct Session *session; + + /** + * Post processor handling form data (IF this is + * a POST request). + */ + struct MHD_PostProcessor *pp; + + /** + * URL to serve in response to this POST (if this request + * was a 'POST') + */ + const char *post_url; + +}; + + +/** + * Linked list of all active sessions. Yes, O(n) but a + * hash table would be overkill for a simple example... + */ +static struct Session *sessions; + + + + +/** + * Return the session handle for this connection, or + * create one if this is a new user. + */ +static struct Session * +get_session (struct MHD_Connection *connection) +{ + struct Session *ret; + const char *cookie; + + cookie = MHD_lookup_connection_value (connection, + MHD_COOKIE_KIND, + COOKIE_NAME); + if (cookie != NULL) + { + /* find existing session */ + ret = sessions; + while (NULL != ret) + { + if (0 == strcmp (cookie, ret->sid)) + break; + ret = ret->next; + } + if (NULL != ret) + { + ret->rc++; + return ret; + } + } + /* create fresh session */ + ret = calloc (1, sizeof (struct Session)); + if (NULL == ret) + { + fprintf (stderr, "calloc error: %s\n", strerror (errno)); + return NULL; + } + /* not a super-secure way to generate a random session ID, + but should do for a simple example... */ + snprintf (ret->sid, + sizeof (ret->sid), + "%X%X%X%X", + (unsigned int) rand (), + (unsigned int) rand (), + (unsigned int) rand (), + (unsigned int) rand ()); + ret->rc++; + ret->start = time (NULL); + ret->next = sessions; + sessions = ret; + return ret; +} + + +/** + * Type of handler that generates a reply. + * + * @param cls content for the page (handler-specific) + * @param mime mime type to use + * @param session session information + * @param connection connection to process + * @param MHD_YES on success, MHD_NO on failure + */ +typedef int (*PageHandler)(const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection); + + +/** + * Entry we generate for each page served. + */ +struct Page +{ + /** + * Acceptable URL for this page. + */ + const char *url; + + /** + * Mime type to set for the page. + */ + const char *mime; + + /** + * Handler to call to generate response. + */ + PageHandler handler; + + /** + * Extra argument to handler. + */ + const void *handler_cls; +}; + + +/** + * Add header to response to set a session cookie. + * + * @param session session to use + * @param response response to modify + */ +static void +add_session_cookie (struct Session *session, + struct MHD_Response *response) +{ + char cstr[256]; + snprintf (cstr, + sizeof (cstr), + "%s=%s", + COOKIE_NAME, + session->sid); + if (MHD_NO == + MHD_add_response_header (response, + MHD_HTTP_HEADER_SET_COOKIE, + cstr)) + { + fprintf (stderr, + "Failed to set session cookie header!\n"); + } +} + + +/** + * Handler that returns a simple static HTTP page that + * is passed in via 'cls'. + * + * @param cls a 'const char *' with the HTML webpage to return + * @param mime mime type to use + * @param session session handle + * @param connection connection to use + */ +static int +serve_simple_form (const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection) +{ + int ret; + const char *form = cls; + struct MHD_Response *response; + + /* return static form */ + response = MHD_create_response_from_buffer (strlen (form), + (void *) form, + MHD_RESPMEM_PERSISTENT); + if (NULL == response) + return MHD_NO; + add_session_cookie (session, response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_ENCODING, + mime); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; +} + + +/** + * Handler that adds the 'v1' value to the given HTML code. + * + * @param cls unused + * @param mime mime type to use + * @param session session handle + * @param connection connection to use + */ +static int +fill_v1_form (const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection) +{ + int ret; + size_t slen; + char *reply; + struct MHD_Response *response; + (void)cls; /* Unused. Silent compiler warning. */ + + slen = strlen (MAIN_PAGE) + strlen (session->value_1); + reply = malloc (slen + 1); + if (NULL == reply) + return MHD_NO; + snprintf (reply, + slen + 1, + MAIN_PAGE, + session->value_1); + /* return static form */ + response = MHD_create_response_from_buffer (slen, + (void *) reply, + MHD_RESPMEM_MUST_FREE); + if (NULL == response) + { + free (reply); + return MHD_NO; + } + add_session_cookie (session, response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_ENCODING, + mime); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; +} + + +/** + * Handler that adds the 'v1' and 'v2' values to the given HTML code. + * + * @param cls unused + * @param mime mime type to use + * @param session session handle + * @param connection connection to use + */ +static int +fill_v1_v2_form (const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection) +{ + int ret; + char *reply; + struct MHD_Response *response; + size_t slen; + (void)cls; /* Unused. Silent compiler warning. */ + + slen = strlen (SECOND_PAGE) + strlen (session->value_1) + strlen (session->value_2); + reply = malloc (slen + 1); + if (NULL == reply) + return MHD_NO; + snprintf (reply, + slen + 1, + SECOND_PAGE, + session->value_1, + session->value_2); + /* return static form */ + response = MHD_create_response_from_buffer (slen, + (void *) reply, + MHD_RESPMEM_MUST_FREE); + if (NULL == response) + { + free (reply); + return MHD_NO; + } + add_session_cookie (session, response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_ENCODING, + mime); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; +} + + +/** + * Handler used to generate a 404 reply. + * + * @param cls a 'const char *' with the HTML webpage to return + * @param mime mime type to use + * @param session session handle + * @param connection connection to use + */ +static int +not_found_page (const void *cls, + const char *mime, + struct Session *session, + struct MHD_Connection *connection) +{ + int ret; + struct MHD_Response *response; + (void)cls; /* Unused. Silent compiler warning. */ + (void)session; /* Unused. Silent compiler warning. */ + + /* unsupported HTTP method */ + response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR), + (void *) NOT_FOUND_ERROR, + MHD_RESPMEM_PERSISTENT); + if (NULL == response) + return MHD_NO; + ret = MHD_queue_response (connection, + MHD_HTTP_NOT_FOUND, + response); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_ENCODING, + mime); + MHD_destroy_response (response); + return ret; +} + + +/** + * List of all pages served by this HTTP server. + */ +static struct Page pages[] = + { + { "/", "text/html", &fill_v1_form, NULL }, + { "/2", "text/html", &fill_v1_v2_form, NULL }, + { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE }, + { "/F", "text/html", &serve_simple_form, LAST_PAGE }, + { NULL, NULL, ¬_found_page, NULL } /* 404 */ + }; + + + +/** + * Iterator over key-value pairs where the value + * maybe made available in increments and/or may + * not be zero-terminated. Used for processing + * POST data. + * + * @param cls user-specified closure + * @param kind type of the value + * @param key 0-terminated key for the value + * @param filename name of the uploaded file, NULL if not known + * @param content_type mime-type of the data, NULL if not known + * @param transfer_encoding encoding of the data, NULL if not known + * @param data pointer to size bytes of data at the + * specified offset + * @param off offset of data in the overall value + * @param size number of bytes in data available + * @return MHD_YES to continue iterating, + * MHD_NO to abort the iteration + */ +static int +post_iterator (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, uint64_t off, size_t size) +{ + struct Request *request = cls; + struct Session *session = request->session; + (void)kind; /* Unused. Silent compiler warning. */ + (void)filename; /* Unused. Silent compiler warning. */ + (void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding; /* Unused. Silent compiler warning. */ + + if (0 == strcmp ("DONE", key)) + { + fprintf (stdout, + "Session `%s' submitted `%s', `%s'\n", + session->sid, + session->value_1, + session->value_2); + return MHD_YES; + } + if (0 == strcmp ("v1", key)) + { + if (size + off >= sizeof(session->value_1)) + size = sizeof (session->value_1) - off - 1; + memcpy (&session->value_1[off], + data, + size); + session->value_1[size+off] = '\0'; + return MHD_YES; + } + if (0 == strcmp ("v2", key)) + { + if (size + off >= sizeof(session->value_2)) + size = sizeof (session->value_2) - off - 1; + memcpy (&session->value_2[off], + data, + size); + session->value_2[size+off] = '\0'; + return MHD_YES; + } + fprintf (stderr, + "Unsupported form value `%s'\n", + key); + return MHD_YES; +} + + +/** + * Main MHD callback for handling requests. + * + * @param cls argument given together with the function + * pointer when the handler was registered with MHD + * @param connection handle identifying the incoming connection + * @param url the requested url + * @param method the HTTP method used ("GET", "PUT", etc.) + * @param version the HTTP version string (i.e. "HTTP/1.1") + * @param upload_data the data being uploaded (excluding HEADERS, + * for a POST that fits into memory and that is encoded + * with a supported encoding, the POST data will NOT be + * given in upload_data and is instead available as + * part of MHD_get_connection_values; very large POST + * data *will* be made available incrementally in + * upload_data) + * @param upload_data_size set initially to the size of the + * upload_data provided; the method must update this + * value to the number of bytes NOT processed; + * @param ptr pointer that the callback can set to some + * address and that will be preserved by MHD for future + * calls for this request; since the access handler may + * be called many times (i.e., for a PUT/POST operation + * with plenty of upload data) this allows the application + * to easily associate some request-specific state. + * If necessary, this state can be cleaned up in the + * global "MHD_RequestCompleted" callback (which + * can be set with the MHD_OPTION_NOTIFY_COMPLETED). + * Initially, *con_cls will be NULL. + * @return MHS_YES if the connection was handled successfully, + * MHS_NO if the socket must be closed due to a serios + * error while handling the request + */ +static int +create_response (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **ptr) +{ + struct MHD_Response *response; + struct Request *request; + struct Session *session; + int ret; + unsigned int i; + (void)cls; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + + request = *ptr; + if (NULL == request) + { + request = calloc (1, sizeof (struct Request)); + if (NULL == request) + { + fprintf (stderr, "calloc error: %s\n", strerror (errno)); + return MHD_NO; + } + *ptr = request; + if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) + { + request->pp = MHD_create_post_processor (connection, 1024, + &post_iterator, request); + if (NULL == request->pp) + { + fprintf (stderr, "Failed to setup post processor for `%s'\n", + url); + return MHD_NO; /* internal error */ + } + } + return MHD_YES; + } + if (NULL == request->session) + { + request->session = get_session (connection); + if (NULL == request->session) + { + fprintf (stderr, "Failed to setup session for `%s'\n", + url); + return MHD_NO; /* internal error */ + } + } + session = request->session; + session->start = time (NULL); + if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) + { + /* evaluate POST data */ + MHD_post_process (request->pp, + upload_data, + *upload_data_size); + if (0 != *upload_data_size) + { + *upload_data_size = 0; + return MHD_YES; + } + /* done with POST data, serve response */ + MHD_destroy_post_processor (request->pp); + request->pp = NULL; + method = MHD_HTTP_METHOD_GET; /* fake 'GET' */ + if (NULL != request->post_url) + url = request->post_url; + } + + if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || + (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) + { + /* find out which page to serve */ + i=0; + while ( (pages[i].url != NULL) && + (0 != strcmp (pages[i].url, url)) ) + i++; + ret = pages[i].handler (pages[i].handler_cls, + pages[i].mime, + session, connection); + if (ret != MHD_YES) + fprintf (stderr, "Failed to create page for `%s'\n", + url); + return ret; + } + /* unsupported HTTP method */ + response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), + (void *) METHOD_ERROR, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, + MHD_HTTP_NOT_ACCEPTABLE, + response); + MHD_destroy_response (response); + return ret; +} + + +/** + * Callback called upon completion of a request. + * Decrements session reference counter. + * + * @param cls not used + * @param connection connection that completed + * @param con_cls session handle + * @param toe status code + */ +static void +request_completed_callback (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct Request *request = *con_cls; + (void)cls; /* Unused. Silent compiler warning. */ + (void)connection; /* Unused. Silent compiler warning. */ + (void)toe; /* Unused. Silent compiler warning. */ + + if (NULL == request) + return; + if (NULL != request->session) + request->session->rc--; + if (NULL != request->pp) + MHD_destroy_post_processor (request->pp); + free (request); +} + + +/** + * Clean up handles of sessions that have been idle for + * too long. + */ +static void +expire_sessions () +{ + struct Session *pos; + struct Session *prev; + struct Session *next; + time_t now; + + now = time (NULL); + prev = NULL; + pos = sessions; + while (NULL != pos) + { + next = pos->next; + if (now - pos->start > 60 * 60) + { + /* expire sessions after 1h */ + if (NULL == prev) + sessions = pos->next; + else + prev->next = next; + free (pos); + } + else + prev = pos; + pos = next; + } +} + + +/** + * Call with the port number as the only argument. + * Never terminates (other than by signals, such as CTRL-C). + */ +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + struct timeval tv; + struct timeval *tvp; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max; + MHD_UNSIGNED_LONG_LONG mhd_timeout; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + /* initialize PRNG */ + srand ((unsigned int) time (NULL)); + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, + &create_response, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15, + MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, + MHD_OPTION_END); + if (NULL == d) + return 1; + while (1) + { + expire_sessions (); + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + break; /* fatal internal error */ + if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES) + { + tv.tv_sec = mhd_timeout / 1000; + tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000; + tvp = &tv; + } + else + tvp = NULL; + if (-1 == select (max + 1, &rs, &ws, &es, tvp)) + { + if (EINTR != errno) + abort (); + } + MHD_run (d); + } + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c new file mode 100644 index 0000000..3d91bce --- /dev/null +++ b/src/examples/querystring_example.c @@ -0,0 +1,94 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file querystring_example.c + * @brief example for how to get the query string from libmicrohttpd + * Call with an URI ending with something like "?q=QUERY" + * @author Christian Grothoff + */ + +#include "platform.h" +#include + +#define PAGE "libmicrohttpd demoQuery string for "%s" was "%s"" + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + const char *fmt = cls; + const char *val; + char *me; + struct MHD_Response *response; + int ret; + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + val = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "q"); + me = malloc (snprintf (NULL, 0, fmt, "q", val) + 1); + if (me == NULL) + return MHD_NO; + sprintf (me, fmt, "q", val); + response = MHD_create_response_from_buffer (strlen (me), me, + MHD_RESPMEM_MUST_FREE); + if (response == NULL) + { + free (me); + return MHD_NO; + } + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, &ahc_echo, PAGE, MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/examples/refuse_post_example.c b/src/examples/refuse_post_example.c new file mode 100644 index 0000000..dad3beb --- /dev/null +++ b/src/examples/refuse_post_example.c @@ -0,0 +1,105 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file refuse_post_example.c + * @brief example for how to refuse a POST request properly + * @author Christian Grothoff and Sebastian Gerhardt + */ +#include "platform.h" +#include + +const char *askpage = "\n\ + Upload a file, please!
    \n\ + \n\ + \n\ + \n\ + "; + +#define BUSYPAGE "Webserver busyWe are too busy to process POSTs right now." + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)cls; /* Unused. Silent compiler warning. */ + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if ((0 != strcmp (method, "GET")) && (0 != strcmp (method, "POST"))) + return MHD_NO; /* unexpected method */ + + if (&aptr != *ptr) + { + *ptr = &aptr; + + /* always to busy for POST requests */ + if (0 == strcmp (method, "POST")) + { + response = MHD_create_response_from_buffer (strlen (BUSYPAGE), + (void *) BUSYPAGE, + MHD_RESPMEM_PERSISTENT); + ret = + MHD_queue_response (connection, MHD_HTTP_SERVICE_UNAVAILABLE, + response); + MHD_destroy_response (response); + return ret; + } + } + + *ptr = NULL; /* reset when done */ + response = MHD_create_response_from_buffer (strlen (me), + (void *) me, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + +int +main (int argc, char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, &ahc_echo, (void *) askpage, + MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} + +/* end of refuse_post_example.c */ diff --git a/src/examples/timeout.c b/src/examples/timeout.c new file mode 100644 index 0000000..b956954 --- /dev/null +++ b/src/examples/timeout.c @@ -0,0 +1,84 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016, 2017 Christian Grothoff, + Silvio Clecio (silvioprog), Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file timeout.c + * @brief example for how to use libmicrohttpd request timeout + * @author Christian Grothoff, Silvio Clecio (silvioprog), Karlson2k (Evgeny Grin) + */ + +#include +#include +#include + +#define PORT 8080 + +static int +answer_to_connection(void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) +{ + const char *page = "Hello timeout!"; + struct MHD_Response *response; + int ret; + (void)cls; /* Unused. Silent compiler warning. */ + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)method; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + (void)con_cls; /* Unused. Silent compiler warning. */ + + response = MHD_create_response_from_buffer (strlen(page), + (void *) page, + MHD_RESPMEM_PERSISTENT); + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONTENT_TYPE, + "text/html"); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response(response); + return ret; +} + + +int +main (void) +{ + struct MHD_Daemon *daemon; + + daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, + PORT, + NULL, NULL, + &answer_to_connection, NULL, + /* 3 seconds */ + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 3, + MHD_OPTION_END); + if (NULL == daemon) + return 1; + getchar(); + MHD_stop_daemon(daemon); + return 0; +} diff --git a/src/examples/upgrade_example.c b/src/examples/upgrade_example.c new file mode 100644 index 0000000..73cfafb --- /dev/null +++ b/src/examples/upgrade_example.c @@ -0,0 +1,306 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file upgrade_example.c + * @brief example for how to use libmicrohttpd upgrade + * @author Christian Grothoff + * + * Telnet to the HTTP server, use this in the request: + * GET / http/1.1 + * Connection: Upgrade + * + * After this, whatever you type will be echo'ed back to you. + */ + +#include "platform.h" +#include +#include + +#define PAGE "libmicrohttpd demolibmicrohttpd demo" + + +/** + * Change socket to blocking. + * + * @param fd the socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +static void +make_blocking (MHD_socket fd) +{ +#if defined(MHD_POSIX_SOCKETS) + int flags; + + flags = fcntl (fd, F_GETFL); + if (-1 == flags) + return; + if ((flags & ~O_NONBLOCK) != flags) + if (-1 == fcntl (fd, F_SETFL, flags & ~O_NONBLOCK)) + abort (); +#elif defined(MHD_WINSOCK_SOCKETS) + unsigned long flags = 1; + + ioctlsocket (fd, FIONBIO, &flags); +#endif /* MHD_WINSOCK_SOCKETS */ + +} + + +static void +send_all (MHD_socket sock, + const char *buf, + size_t len) +{ + ssize_t ret; + size_t off; + + make_blocking (sock); + for (off = 0; off < len; off += ret) + { + ret = send (sock, + &buf[off], + len - off, + 0); + if (0 > ret) + { + if (EAGAIN == errno) + { + ret = 0; + continue; + } + break; + } + if (0 == ret) + break; + } +} + + +struct MyData +{ + struct MHD_UpgradeResponseHandle *urh; + char *extra_in; + size_t extra_in_size; + MHD_socket sock; +}; + + +/** + * Main function for the thread that runs the interaction with + * the upgraded socket. Writes what it reads. + * + * @param cls the `struct MyData` + */ +static void * +run_usock (void *cls) +{ + struct MyData *md = cls; + struct MHD_UpgradeResponseHandle *urh = md->urh; + char buf[128]; + ssize_t got; + + make_blocking (md->sock); + /* start by sending extra data MHD may have already read, if any */ + if (0 != md->extra_in_size) + { + send_all (md->sock, + md->extra_in, + md->extra_in_size); + free (md->extra_in); + } + /* now echo in a loop */ + while (1) + { + got = recv (md->sock, + buf, + sizeof (buf), + 0); + if (0 >= got) + break; + send_all (md->sock, + buf, + got); + } + free (md); + MHD_upgrade_action (urh, + MHD_UPGRADE_ACTION_CLOSE); + return NULL; +} + + +/** + * Function called after a protocol "upgrade" response was sent + * successfully and the socket should now be controlled by some + * protocol other than HTTP. + * + * Any data already received on the socket will be made available in + * @e extra_in. This can happen if the application sent extra data + * before MHD send the upgrade response. The application should + * treat data from @a extra_in as if it had read it from the socket. + * + * Note that the application must not close() @a sock directly, + * but instead use #MHD_upgrade_action() for special operations + * on @a sock. + * + * Data forwarding to "upgraded" @a sock will be started as soon + * as this function return. + * + * Except when in 'thread-per-connection' mode, implementations + * of this function should never block (as it will still be called + * from within the main event loop). + * + * @param cls closure, whatever was given to #MHD_create_response_for_upgrade(). + * @param connection original HTTP connection handle, + * giving the function a last chance + * to inspect the original HTTP request + * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param extra_in if we happened to have read bytes after the + * HTTP header already (because the client sent + * more than the HTTP header of the request before + * we sent the upgrade response), + * these are the extra bytes already read from @a sock + * by MHD. The application should treat these as if + * it had read them from @a sock. + * @param extra_in_size number of bytes in @a extra_in + * @param sock socket to use for bi-directional communication + * with the client. For HTTPS, this may not be a socket + * that is directly connected to the client and thus certain + * operations (TCP-specific setsockopt(), getsockopt(), etc.) + * may not work as expected (as the socket could be from a + * socketpair() or a TCP-loopback). The application is expected + * to perform read()/recv() and write()/send() calls on the socket. + * The application may also call shutdown(), but must not call + * close() directly. + * @param urh argument for #MHD_upgrade_action()s on this @a connection. + * Applications must eventually use this callback to (indirectly) + * perform the close() action on the @a sock. + */ +static void +uh_cb (void *cls, + struct MHD_Connection *connection, + void *con_cls, + const char *extra_in, + size_t extra_in_size, + MHD_socket sock, + struct MHD_UpgradeResponseHandle *urh) +{ + struct MyData *md; + pthread_t pt; + (void)cls; /* Unused. Silent compiler warning. */ + (void)connection; /* Unused. Silent compiler warning. */ + (void)con_cls; /* Unused. Silent compiler warning. */ + + md = malloc (sizeof (struct MyData)); + if (NULL == md) + abort (); + memset (md, 0, sizeof (struct MyData)); + if (0 != extra_in_size) + { + md->extra_in = malloc (extra_in_size); + if (NULL == md->extra_in) + abort (); + memcpy (md->extra_in, + extra_in, + extra_in_size); + } + md->extra_in_size = extra_in_size; + md->sock = sock; + md->urh = urh; + if (0 != pthread_create (&pt, + NULL, + &run_usock, + md)) + abort (); + /* Note that by detaching like this we make it impossible to ensure + a clean shutdown, as the we stop the daemon even if a worker thread + is still running. Alas, this is a simple example... */ + pthread_detach (pt); + + /* This callback must return as soon as possible. */ + + /* Data forwarding to "upgraded" socket will be started + * after return from this callback. */ +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **ptr) +{ + static int aptr; + struct MHD_Response *response; + int ret; + (void)cls; /* Unused. Silent compiler warning. */ + (void)url; /* Unused. Silent compiler warning. */ + (void)version; /* Unused. Silent compiler warning. */ + (void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, "GET")) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + response = MHD_create_response_for_upgrade (&uh_cb, + NULL); + + MHD_add_response_header (response, + MHD_HTTP_HEADER_UPGRADE, + "Echo Server"); + ret = MHD_queue_response (connection, + MHD_HTTP_SWITCHING_PROTOCOLS, + response); + MHD_destroy_response (response); + return ret; +} + + +int +main (int argc, + char *const *argv) +{ + struct MHD_Daemon *d; + + if (argc != 2) + { + printf ("%s PORT\n", argv[0]); + return 1; + } + d = MHD_start_daemon (MHD_ALLOW_UPGRADE | MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + atoi (argv[1]), + NULL, NULL, + &ahc_echo, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 120, + MHD_OPTION_END); + if (d == NULL) + return 1; + (void) getc (stdin); + MHD_stop_daemon (d); + return 0; +} diff --git a/src/include/Makefile.am b/src/include/Makefile.am new file mode 100644 index 0000000..a2222a7 --- /dev/null +++ b/src/include/Makefile.am @@ -0,0 +1,6 @@ +# This Makefile.am is in the public domain +SUBDIRS = . + +include_HEADERS = microhttpd.h + +EXTRA_DIST = platform.h autoinit_funcs.h mhd_options.h diff --git a/src/include/Makefile.in b/src/include/Makefile.in new file mode 100644 index 0000000..8f83c5c --- /dev/null +++ b/src/include/Makefile.in @@ -0,0 +1,733 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/include +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(include_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +SUBDIRS = . +include_HEADERS = microhttpd.h +EXTRA_DIST = platform.h autoinit_funcs.h mhd_options.h +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/include/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/include/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-includeHEADERS + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includeHEADERS install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-includeHEADERS + +.PRECIOUS: Makefile + + +# 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: diff --git a/src/include/autoinit_funcs.h b/src/include/autoinit_funcs.h new file mode 100644 index 0000000..d925c7b --- /dev/null +++ b/src/include/autoinit_funcs.h @@ -0,0 +1,247 @@ +/* + * AutoinitFuncs: Automatic Initialization and Deinitialization Functions + * Copyright(C) 2014-2017 Karlson2k (Evgeny Grin) + * + * This header is free software; you can redistribute it and / or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This header 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this header; if not, see + * . + */ + +/* + General usage is simple: include this header, declare or define two + functions with zero parameters (void) and any return type: one for + initialization and one for deinitialization, add + _SET_INIT_AND_DEINIT_FUNCS(FuncInitName, FuncDeInitName) to the code + and functions will be automatically called during application startup + and shutdown. + This is useful for libraries as libraries doesn't have direct access + to main() functions. + Example: + ------------------------------------------------- + #include + #include "autoinit_funcs.h" + + int someVar; + void* somePtr; + + void libInit(void) + { + someVar = 3; + somePtr = malloc(100); + } + + void libDeinit(void) + { + free(somePtr); + } + + _SET_INIT_AND_DEINIT_FUNCS(libInit,libDeinit); + ------------------------------------------------- + + If initializer or deinitializer function is not needed, just define + it as empty function. + + This header should work with GCC, clang, MSVC (2010 or later) and + SunPro / Sun Studio / Oracle Solaris Studio / Oracle Developer Studio + compiler. + Supported C and C++ languages; application, static and dynamic (DLL) + libraries; non-optimized (Debug) and optimized (Release) compilation + and linking. + + For more information see header code and comments in code. + */ +#ifndef AUTOINIT_FUNCS_INCLUDED +#define AUTOINIT_FUNCS_INCLUDED 1 + +/** +* Current version of the header. +* 0x01093001 = 1.9.30-1. +*/ +#define AUTOINIT_FUNCS_VERSION 0x01000100 + +#if defined(__GNUC__) + /* if possible - check for supported attribute */ +#ifdef __has_attribute +#if !__has_attribute(constructor) || !__has_attribute(destructor) +#define _GNUC_ATTR_CONSTR_NOT_SUPPORTED 1 +#endif /* !__has_attribute(constructor) || !__has_attribute(destructor) */ +#endif /* __has_attribute */ +#endif /* __GNUC__ */ + +/* "_attribute__ ((constructor))" is supported by GCC, clang and + Sun/Oracle compiler starting from version 12.1. */ +#if (defined(__GNUC__) && !defined(_GNUC_ATTR_CONSTR_NOT_SUPPORTED)) || \ + (defined(__SUNPRO_C) && __SUNPRO_C+0 >= 0x5100) + +#define GNUC_SET_INIT_AND_DEINIT(FI,FD) \ + void __attribute__ ((constructor)) _GNUC_init_helper_##FI(void) \ + { (void)(FI)(); } \ + void __attribute__ ((destructor)) _GNUC_deinit_helper_##FD(void) \ + { (void)(FD)(); } \ + struct _GNUC_dummy_str_##FI{int i;} + +#define _SET_INIT_AND_DEINIT_FUNCS(FI,FD) GNUC_SET_INIT_AND_DEINIT(FI,FD) +#define _AUTOINIT_FUNCS_ARE_SUPPORTED 1 + +#elif defined (_MSC_FULL_VER) && _MSC_VER+0 >= 1600 + +/* Make sure that your project/sources define: + _LIB if building a static library (_LIB is ignored if _CONSOLE is defined); + _USRDLL if building DLL-library; + not defined both _LIB and _USRDLL if building an application */ + +/* Define AUTOINIT_FUNCS_DECLARE_STATIC_REG if you need macro declaration + for registering static initialization functions even if you building DLL */ +/* Define AUTOINIT_FUNCS_FORCE_STATIC_REG if you want to set main macro + _SET_INIT_AND_DEINIT_FUNCS to static version even if building a DLL*/ + +/* Stringify macros */ +#define _INSTRMACRO(a) #a +#define _STRMACRO(a) _INSTRMACRO(a) + +#if !defined(_USRDLL) || defined(AUTOINIT_FUNCS_DECLARE_STATIC_REG) + +/* required for atexit() */ +#include + +/* Use "C" linkage for variable to simplify variable decoration */ +#ifdef __cplusplus +#define W32_INITVARDECL extern "C" +#else +#define W32_INITVARDECL extern +#endif + +/* How variable is decorated by compiler */ +#if defined(_M_X64) || defined(_M_AMD64) +#define W32_VARDECORPREFIX +#define W32_DECORVARNAME(v) v +#define W32_VARDECORPEFIXSTR "" +#elif defined(_M_IX86) || defined(_X86_) +#define W32_VARDECORPREFIX _ +#define W32_DECORVARNAME(v) _##v +#define W32_VARDECORPEFIXSTR "_" +#else +#error Do not know how to decorate symbols for this architecture +#endif + +/* Internal variable prefix (can be any) */ +#define W32_INITHELPERVARNAME(f) _initHelperDummy_##f +#define W32_INITHELPERVARNAMEDECORSTR(f) W32_VARDECORPEFIXSTR _STRMACRO(W32_INITHELPERVARNAME(f)) + +/* Declare section (segment), put variable pointing to init function to chosen segment, + force linker to include variable to avoid omitting by optimizer */ +/* Initialization function must be declared as + int __cdecl FuncName(void) */ +/* Return value is ignored for C++ initializers */ +/* For C initializers: startup process is aborted if initializer return non-zero */ +#define W32_FPTR_IN_SEG(S,F) \ + __pragma(section(S,long,read)) \ + __pragma(comment(linker, "/INCLUDE:" W32_INITHELPERVARNAMEDECORSTR(F))) \ + W32_INITVARDECL __declspec(allocate(S)) int(__cdecl *W32_INITHELPERVARNAME(F))(void) = &F + +/* Section (segment) names for pointers to initializers */ +#define W32_SEG_INIT_C_USER ".CRT$XCU" +#define W32_SEG_INIT_C_LIB ".CRT$XCL" +#define W32_SEG_INIT_CXX_USER ".CRT$XIU" +#define W32_SEG_INIT_CXX_LIB ".CRT$XIL" + +/* Declare macro for different initializers sections */ +/* Macro can be used several times to register several initializers */ +/* Once function is registered as initializer, it will be called automatically + during application startup */ +/* "lib" initializers are called before "user" initializers */ +/* "C" initializers are called before "C++" initializers */ +#define W32_REG_INIT_C_USER(F) W32_FPTR_IN_SEG(W32_SEG_INIT_C_USER,F) +#define W32_REG_INIT_C_LIB(F) W32_FPTR_IN_SEG(W32_SEG_INIT_C_LIB,F) +#define W32_REG_INIT_CXX_USER(F) W32_FPTR_IN_SEG(W32_SEG_INIT_CXX_USER,F) +#define W32_REG_INIT_CXX_LIB(F) W32_FPTR_IN_SEG(W32_SEG_INIT_CXX_LIB,F) + +/* Choose main register macro based on language and program type */ +/* Assuming that _LIB or _USRDLL is defined for static or DLL-library */ +/* Macro can be used several times to register several initializers */ +/* Once function is registered as initializer, it will be called automatically + during application startup */ +/* Define AUTOINIT_FUNCS_FORCE_USER_LVL_INIT to register initializers + at user level even if building library */ +#ifdef __cplusplus +#if ((defined(_LIB) && !defined(_CONSOLE)) || defined(_USRDLL)) && !defined(AUTOINIT_FUNCS_FORCE_USER_LVL_INIT) +#define W32_REGISTER_INIT(F) W32_REG_INIT_CXX_LIB(F) +#else /* ! _LIB && ! _DLL */ +#define W32_REGISTER_INIT(F) W32_REG_INIT_CXX_USER(F) +#endif /* ! _LIB && ! _DLL */ +#else /* !__cplusplus*/ +#if ((defined(_LIB) && !defined(_CONSOLE)) || defined(_USRDLL)) && !defined(AUTOINIT_FUNCS_FORCE_USER_LVL_INIT) +#define W32_REGISTER_INIT(F) W32_REG_INIT_C_LIB(F) +#else /* ! _LIB && ! _DLL */ +#define W32_REGISTER_INIT(F) W32_REG_INIT_C_USER(F) +#endif /* ! _LIB && ! _DLL */ +#endif /* !__cplusplus*/ + +#else /* _USRDLL */ + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* WIN32_LEAN_AND_MEAN */ +/* Required for DllMain */ +#include +#endif /* _USRDLL */ + + +#if !defined(_USRDLL) || defined(AUTOINIT_FUNCS_FORCE_STATIC_REG) +#define W32_SET_INIT_AND_DEINIT(FI,FD) \ + void __cdecl _W32_deinit_helper_##FD(void) \ + { (void)(FD)(); } \ + int __cdecl _W32_init_helper_##FI(void) \ + { (void)(FI)(); atexit(_W32_deinit_helper_##FD); return 0; } \ + W32_REGISTER_INIT(_W32_init_helper_##FI) +#else /* _USRDLL */ + +/* If DllMain is already present in code, define AUTOINIT_FUNCS_CALL_USR_DLLMAIN + and rename DllMain to usr_DllMain */ +#ifndef AUTOINIT_FUNCS_CALL_USR_DLLMAIN +#define W32_SET_INIT_AND_DEINIT(FI,FD) \ + BOOL WINAPI DllMain(HINSTANCE hinst,DWORD reason,LPVOID unused) \ + { if(DLL_PROCESS_ATTACH==reason) {(void)(FI)();} \ + else if(DLL_PROCESS_DETACH==reason) {(void)(FD)();} \ + return TRUE; \ + } struct _W32_dummy_strc_##FI{int i;} +#else /* AUTOINIT_FUNCS_CALL_USR_DLLMAIN */ +#define W32_SET_INIT_AND_DEINIT(FI,FD) \ + BOOL WINAPI usr_DllMain(HINSTANCE hinst,DWORD reason,LPVOID unused); \ + BOOL WINAPI DllMain(HINSTANCE hinst,DWORD reason,LPVOID unused) \ + { if(DLL_PROCESS_ATTACH==reason) {(void)(FI)();} \ + else if(DLL_PROCESS_DETACH==reason) {(void)(FD)();} \ + return usr_DllMain(hinst,reason,unused); \ + } struct _W32_dummy_strc_##FI{int i;} +#endif /* AUTOINIT_FUNCS_CALL_USR_DLLMAIN */ +#endif /* _USRDLL */ + +#define _SET_INIT_AND_DEINIT_FUNCS(FI,FD) W32_SET_INIT_AND_DEINIT(FI,FD) +/* Indicate that automatic initializers/deinitializers are supported */ +#define _AUTOINIT_FUNCS_ARE_SUPPORTED 1 + +#else /* !__GNUC__ && !_MSC_FULL_VER */ + +/* Define EMIT_ERROR_IF_AUTOINIT_FUNCS_ARE_NOT_SUPPORTED before inclusion of header to + abort compilation if automatic initializers/deinitializers are not supported */ +#ifdef EMIT_ERROR_IF_AUTOINIT_FUNCS_ARE_NOT_SUPPORTED +#error Compiler/platform don not support automatic calls of user-defined initializer and deinitializer +#endif /* EMIT_ERROR_IF_AUTOINIT_FUNCS_ARE_NOT_SUPPORTED */ + +/* Do nothing */ +#define _SET_INIT_AND_DEINIT_FUNCS(FI,FD) +/* Indicate that automatic initializers/deinitializers are not supported */ +#define _AUTOINIT_FUNCS_ARE_NOT_SUPPORTED 1 + +#endif /* !__GNUC__ && !_MSC_FULL_VER */ +#endif /* !AUTOINIT_FUNCS_INCLUDED */ diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h new file mode 100644 index 0000000..df45cf9 --- /dev/null +++ b/src/include/mhd_options.h @@ -0,0 +1,134 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file include/mhd_options.h + * @brief additional automatic macros for MHD_config.h + * @author Karlson2k (Evgeny Grin) + * + * This file includes MHD_config.h and adds automatic macros based on values + * in MHD_config.h, compiler built-in macros and commandline-defined macros + * (but not based on values defined in other headers). Works also as a guard + * to prevent double inclusion of MHD_config.h + */ + +#ifndef MHD_OPTIONS_H +#define MHD_OPTIONS_H 1 + +#include "MHD_config.h" + +/** + * Macro to make it easy to mark text for translation. Note that + * we do not actually call gettext() in MHD, but we do make it + * easy to create a ".po" file so that applications that do want + * to translate error messages can do so. + */ +#define _(String) (String) + + + +#ifndef _MHD_EXTERN +#if defined(BUILDING_MHD_LIB) && defined(_WIN32) && \ + (defined(DLL_EXPORT) || defined(MHD_W32DLL)) +#define _MHD_EXTERN __declspec(dllexport) extern +#else /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */ +#define _MHD_EXTERN extern +#endif /* !BUILDING_MHD_LIB || !_WIN32 || (!DLL_EXPORT && !MHD_W32DLL) */ +#endif /* ! _MHD_EXTERN */ + +/* Some platforms (FreeBSD, Solaris, W32) allow to override + default FD_SETSIZE by defining it before including + headers. */ +#ifdef FD_SETSIZE +/* FD_SETSIZE defined in command line or in MHD_config.h */ +#elif defined(_WIN32) || defined(__CYGWIN__) +/* Platform with WinSock and without overridden FD_SETSIZE */ +#define FD_SETSIZE 2048 /* Override default small value (64) */ +#else /* !FD_SETSIZE && !W32 */ +/* System default value of FD_SETSIZE is used */ +#define _MHD_FD_SETSIZE_IS_DEFAULT 1 +#endif /* !FD_SETSIZE && !W32 */ + +#if defined(HAVE_LINUX_SENDFILE) || defined(HAVE_FREEBSD_SENDFILE) || \ + defined(HAVE_DARWIN_SENDFILE) || defined(HAVE_SOLARIS_SENDFILE) +/* Have any supported sendfile() function. */ +#define _MHD_HAVE_SENDFILE +#endif /* HAVE_LINUX_SENDFILE || HAVE_FREEBSD_SENDFILE || + HAVE_DARWIN_SENDFILE || HAVE_SOLARIS_SENDFILE */ +#if defined(HAVE_LINUX_SENDFILE) || defined(HAVE_SOLARIS_SENDFILE) +#define MHD_LINUX_SOLARIS_SENDFILE 1 +#endif /* HAVE_LINUX_SENDFILE || HAVE_SOLARIS_SENDFILE */ + +#if OS390 +#define _OPEN_THREADS +#define _OPEN_SYS_SOCK_IPV6 +#define _OPEN_MSGQ_EXT +#define _LP64 +#endif + +#if defined(_WIN32) && ! defined(__CYGWIN__) +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#else /* _WIN32_WINNT */ +#if _WIN32_WINNT < 0x0501 +#error "Headers for Windows XP or later are required" +#endif /* _WIN32_WINNT < 0x0501 */ +#endif /* _WIN32_WINNT */ +#ifndef WIN32_LEAN_AND_MEAN +/* Do not include unneeded parts of W32 headers. */ +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#endif /* _WIN32 && ! __CYGWIN__ */ + +#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) +#define RESTRICT __restrict__ +#endif /* __VXWORKS__ || __vxworks || OS_VXWORKS */ + +#if LINUX+0 && (defined(HAVE_SENDFILE64) || defined(HAVE_LSEEK64)) && ! defined(_LARGEFILE64_SOURCE) +/* On Linux, special macro is required to enable definitions of some xxx64 functions */ +#define _LARGEFILE64_SOURCE 1 +#endif + +#ifdef HAVE_C11_GMTIME_S +/* Special macro is required to enable C11 definition of gmtime_s() function */ +#define __STDC_WANT_LIB_EXT1__ 1 +#endif /* HAVE_C11_GMTIME_S */ + +#if defined(MHD_FAVOR_FAST_CODE) && defined(MHD_FAVOR_SMALL_CODE) +#error MHD_FAVOR_FAST_CODE and MHD_FAVOR_SMALL_CODE are both defined. Cannot favor speed and size at the same time. +#endif /* MHD_FAVOR_FAST_CODE && MHD_FAVOR_SMALL_CODE */ + +/* Define MHD_FAVOR_FAST_CODE to force fast code path or + define MHD_FAVOR_SMALL_CODE to choose compact code path */ +#if !defined(MHD_FAVOR_FAST_CODE) && !defined(MHD_FAVOR_SMALL_CODE) +/* Try to detect user preferences */ +/* Defined by GCC and many compatible compilers */ +#if defined(__OPTIMIZE_SIZE__) +#define MHD_FAVOR_SMALL_CODE 1 +#elif defined(__OPTIMIZE__) +#define MHD_FAVOR_FAST_CODE 1 +#endif /* __OPTIMIZE__ */ +#endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */ + +#if !defined(MHD_FAVOR_FAST_CODE) && !defined(MHD_FAVOR_SMALL_CODE) +/* Use faster code by default */ +#define MHD_FAVOR_FAST_CODE 1 +#endif /* !MHD_FAVOR_FAST_CODE && !MHD_FAVOR_SMALL_CODE */ + +#endif /* MHD_OPTIONS_H */ diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h new file mode 100644 index 0000000..4f219fd --- /dev/null +++ b/src/include/microhttpd.h @@ -0,0 +1,3514 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2006-2017 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd.h + * @brief public interface to libmicrohttpd + * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) + * @author Chris GauthierDickey + * + * All symbols defined in this header start with MHD. MHD is a small + * HTTP daemon library. As such, it does not have any API for logging + * errors (you can only enable or disable logging to stderr). Also, + * it may not support all of the HTTP features directly, where + * applicable, portions of HTTP may have to be handled by clients of + * the library. + * + * The library is supposed to handle everything that it must handle + * (because the API would not allow clients to do this), such as basic + * connection management; however, detailed interpretations of headers + * -- such as range requests -- and HTTP methods are left to clients. + * The library does understand HEAD and will only send the headers of + * the response and not the body, even if the client supplied a body. + * The library also understands headers that control connection + * management (specifically, "Connection: close" and "Expect: 100 + * continue" are understood and handled automatically). + * + * MHD understands POST data and is able to decode certain formats + * (at the moment only "application/x-www-form-urlencoded" and + * "mulitpart/formdata"). Unsupported encodings and large POST + * submissions may require the application to manually process + * the stream, which is provided to the main application (and thus can be + * processed, just not conveniently by MHD). + * + * The header file defines various constants used by the HTTP protocol. + * This does not mean that MHD actually interprets all of these + * values. The provided constants are exported as a convenience + * for users of the library. MHD does not verify that transmitted + * HTTP headers are part of the standard specification; users of the + * library are free to define their own extensions of the HTTP + * standard and use those with MHD. + * + * All functions are guaranteed to be completely reentrant and + * thread-safe (with the exception of #MHD_set_connection_value, + * which must only be used in a particular context). + * + * + * @defgroup event event-loop control + * MHD API to start and stop the HTTP server and manage the event loop. + * @defgroup response generation of responses + * MHD API used to generate responses. + * @defgroup request handling of requests + * MHD API used to access information about requests. + * @defgroup authentication HTTP authentication + * MHD API related to basic and digest HTTP authentication. + * @defgroup logging logging + * MHD API to mange logging and error handling + * @defgroup specialized misc. specialized functions + * This group includes functions that do not fit into any particular + * category and that are rarely used. + */ + +#ifndef MHD_MICROHTTPD_H +#define MHD_MICROHTTPD_H + +#ifdef __cplusplus +extern "C" +{ +#if 0 /* keep Emacsens' auto-indent happy */ +} +#endif +#endif + +/* While we generally would like users to use a configure-driven + build process which detects which headers are present and + hence works on any platform, we use "standard" includes here + to build out-of-the-box for beginning users on common systems. + + If generic headers don't work on your platform, include headers + which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', + 'uint16_t', 'uint32_t', 'uint64_t', 'off_t', 'struct sockaddr', + 'socklen_t', 'fd_set' and "#define MHD_PLATFORM_H" before + including "microhttpd.h". Then the following "standard" + includes won't be used (which might be a good idea, especially + on platforms where they do not exist). + */ +#ifndef MHD_PLATFORM_H +#include +#include +#include +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED) +#define _SSIZE_T_DEFINED +typedef intptr_t ssize_t; +#endif /* !_SSIZE_T_DEFINED */ +#else +#include +#include +#include +#endif +#endif + +#if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET) +/* Do not define __USE_W32_SOCKETS under Cygwin! */ +#error Cygwin with winsock fd_set is not supported +#endif + +/** + * Current version of the library. + * 0x01093001 = 1.9.30-1. + */ +#define MHD_VERSION 0x00095900 + +/** + * MHD-internal return code for "YES". + */ +#define MHD_YES 1 + +/** + * MHD-internal return code for "NO". + */ +#define MHD_NO 0 + +/** + * MHD digest auth internal code for an invalid nonce. + */ +#define MHD_INVALID_NONCE -1 + +/** + * Constant used to indicate unknown size (use when + * creating a response). + */ +#ifdef UINT64_MAX +#define MHD_SIZE_UNKNOWN UINT64_MAX +#else +#define MHD_SIZE_UNKNOWN ((uint64_t) -1LL) +#endif + +#ifdef SIZE_MAX +#define MHD_CONTENT_READER_END_OF_STREAM SIZE_MAX +#define MHD_CONTENT_READER_END_WITH_ERROR (SIZE_MAX - 1) +#else +#define MHD_CONTENT_READER_END_OF_STREAM ((size_t) -1LL) +#define MHD_CONTENT_READER_END_WITH_ERROR (((size_t) -1LL) - 1) +#endif + +#ifndef _MHD_EXTERN +#if defined(_WIN32) && defined(MHD_W32LIB) +#define _MHD_EXTERN extern +#elif defined (_WIN32) && defined(MHD_W32DLL) +/* Define MHD_W32DLL when using MHD as W32 .DLL to speed up linker a little */ +#define _MHD_EXTERN __declspec(dllimport) +#else +#define _MHD_EXTERN extern +#endif +#endif + +#ifndef MHD_SOCKET_DEFINED +/** + * MHD_socket is type for socket FDs + */ +#if !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) +#define MHD_POSIX_SOCKETS 1 +typedef int MHD_socket; +#define MHD_INVALID_SOCKET (-1) +#else /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */ +#define MHD_WINSOCK_SOCKETS 1 +#include +typedef SOCKET MHD_socket; +#define MHD_INVALID_SOCKET (INVALID_SOCKET) +#endif /* !defined(_WIN32) || defined(_SYS_TYPES_FD_SET) */ +#define MHD_SOCKET_DEFINED 1 +#endif /* MHD_SOCKET_DEFINED */ + +/** + * Define MHD_NO_DEPRECATION before including "microhttpd.h" to disable deprecation messages + */ +#ifdef MHD_NO_DEPRECATION +#define _MHD_DEPR_MACRO(msg) +#define _MHD_NO_DEPR_IN_MACRO 1 +#define _MHD_DEPR_IN_MACRO(msg) +#define _MHD_NO_DEPR_FUNC 1 +#define _MHD_DEPR_FUNC(msg) +#endif /* MHD_NO_DEPRECATION */ + +#ifndef _MHD_DEPR_MACRO +#if defined(_MSC_FULL_VER) && _MSC_VER+0 >= 1500 +/* VS 2008 or later */ +/* Stringify macros */ +#define _MHD_INSTRMACRO(a) #a +#define _MHD_STRMACRO(a) _MHD_INSTRMACRO(a) +/* deprecation message */ +#define _MHD_DEPR_MACRO(msg) __pragma(message(__FILE__ "(" _MHD_STRMACRO(__LINE__)"): warning: " msg)) +#define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO(msg) +#elif defined(__clang__) || defined (__GNUC_PATCHLEVEL__) +/* clang or GCC since 3.0 */ +#define _MHD_GCC_PRAG(x) _Pragma (#x) +#if (defined(__clang__) && (__clang_major__+0 >= 5 || \ + (!defined(__apple_build_version__) && (__clang_major__+0 > 3 || (__clang_major__+0 == 3 && __clang_minor__ >= 3))))) || \ + __GNUC__+0 > 4 || (__GNUC__+0 == 4 && __GNUC_MINOR__+0 >= 8) +/* clang >= 3.3 (or XCode's clang >= 5.0) or + GCC >= 4.8 */ +#define _MHD_DEPR_MACRO(msg) _MHD_GCC_PRAG(GCC warning msg) +#define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO(msg) +#else /* older clang or GCC */ +/* clang < 3.3, XCode's clang < 5.0, 3.0 <= GCC < 4.8 */ +#define _MHD_DEPR_MACRO(msg) _MHD_GCC_PRAG(message msg) +#if (defined(__clang__) && (__clang_major__+0 > 2 || (__clang_major__+0 == 2 && __clang_minor__ >= 9))) /* FIXME: clang >= 2.9, earlier versions not tested */ +/* clang handles inline pragmas better than GCC */ +#define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO(msg) +#endif /* clang >= 2.9 */ +#endif /* older clang or GCC */ +/* #elif defined(SOMEMACRO) */ /* add compiler-specific macros here if required */ +#endif /* clang || GCC >= 3.0 */ +#endif /* !_MHD_DEPR_MACRO */ + +#ifndef _MHD_DEPR_MACRO +#define _MHD_DEPR_MACRO(msg) +#endif /* !_MHD_DEPR_MACRO */ + +#ifndef _MHD_DEPR_IN_MACRO +#define _MHD_NO_DEPR_IN_MACRO 1 +#define _MHD_DEPR_IN_MACRO(msg) +#endif /* !_MHD_DEPR_IN_MACRO */ + +#ifndef _MHD_DEPR_FUNC +#if defined(_MSC_FULL_VER) && _MSC_VER+0 >= 1400 +/* VS 2005 or later */ +#define _MHD_DEPR_FUNC(msg) __declspec(deprecated(msg)) +#elif defined(_MSC_FULL_VER) && _MSC_VER+0 >= 1310 +/* VS .NET 2003 deprecation do not support custom messages */ +#define _MHD_DEPR_FUNC(msg) __declspec(deprecated) +#elif (__GNUC__+0 >= 5) || (defined (__clang__) && \ + (__clang_major__+0 > 2 || (__clang_major__+0 == 2 && __clang_minor__ >= 9))) /* FIXME: earlier versions not tested */ +/* GCC >= 5.0 or clang >= 2.9 */ +#define _MHD_DEPR_FUNC(msg) __attribute__((deprecated(msg))) +#elif defined (__clang__) || __GNUC__+0 > 3 || (__GNUC__+0 == 3 && __GNUC_MINOR__+0 >= 1) +/* 3.1 <= GCC < 5.0 or clang < 2.9 */ +/* old GCC-style deprecation do not support custom messages */ +#define _MHD_DEPR_FUNC(msg) __attribute__((__deprecated__)) +/* #elif defined(SOMEMACRO) */ /* add compiler-specific macros here if required */ +#endif /* clang < 2.9 || GCC >= 3.1 */ +#endif /* !_MHD_DEPR_FUNC */ + +#ifndef _MHD_DEPR_FUNC +#define _MHD_NO_DEPR_FUNC 1 +#define _MHD_DEPR_FUNC(msg) +#endif /* !_MHD_DEPR_FUNC */ + +/** + * Not all architectures and `printf()`'s support the `long long` type. + * This gives the ability to replace `long long` with just a `long`, + * standard `int` or a `short`. + */ +#ifndef MHD_LONG_LONG +/** + * @deprecated use #MHD_UNSIGNED_LONG_LONG instead! + */ +#define MHD_LONG_LONG long long +#define MHD_UNSIGNED_LONG_LONG unsigned long long +#else /* MHD_LONG_LONG */ +_MHD_DEPR_MACRO("Macro MHD_LONG_LONG is deprecated, use MHD_UNSIGNED_LONG_LONG") +#endif +/** + * Format string for printing a variable of type #MHD_LONG_LONG. + * You should only redefine this if you also define #MHD_LONG_LONG. + */ +#ifndef MHD_LONG_LONG_PRINTF +/** + * @deprecated use #MHD_UNSIGNED_LONG_LONG_PRINTF instead! + */ +#define MHD_LONG_LONG_PRINTF "ll" +#define MHD_UNSIGNED_LONG_LONG_PRINTF "%llu" +#else /* MHD_LONG_LONG_PRINTF */ +_MHD_DEPR_MACRO("Macro MHD_LONG_LONG_PRINTF is deprecated, use MHD_UNSIGNED_LONG_LONG_PRINTF") +#endif + + +/** + * @defgroup httpcode HTTP response codes. + * These are the status codes defined for HTTP responses. + * @{ + */ +/* See http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml */ + +#define MHD_HTTP_CONTINUE 100 +#define MHD_HTTP_SWITCHING_PROTOCOLS 101 +#define MHD_HTTP_PROCESSING 102 + +#define MHD_HTTP_OK 200 +#define MHD_HTTP_CREATED 201 +#define MHD_HTTP_ACCEPTED 202 +#define MHD_HTTP_NON_AUTHORITATIVE_INFORMATION 203 +#define MHD_HTTP_NO_CONTENT 204 +#define MHD_HTTP_RESET_CONTENT 205 +#define MHD_HTTP_PARTIAL_CONTENT 206 +#define MHD_HTTP_MULTI_STATUS 207 +#define MHD_HTTP_ALREADY_REPORTED 208 + +#define MHD_HTTP_IM_USED 226 + +#define MHD_HTTP_MULTIPLE_CHOICES 300 +#define MHD_HTTP_MOVED_PERMANENTLY 301 +#define MHD_HTTP_FOUND 302 +#define MHD_HTTP_SEE_OTHER 303 +#define MHD_HTTP_NOT_MODIFIED 304 +#define MHD_HTTP_USE_PROXY 305 +#define MHD_HTTP_SWITCH_PROXY 306 +#define MHD_HTTP_TEMPORARY_REDIRECT 307 +#define MHD_HTTP_PERMANENT_REDIRECT 308 + +#define MHD_HTTP_BAD_REQUEST 400 +#define MHD_HTTP_UNAUTHORIZED 401 +#define MHD_HTTP_PAYMENT_REQUIRED 402 +#define MHD_HTTP_FORBIDDEN 403 +#define MHD_HTTP_NOT_FOUND 404 +#define MHD_HTTP_METHOD_NOT_ALLOWED 405 +#define MHD_HTTP_NOT_ACCEPTABLE 406 +/** @deprecated */ +#define MHD_HTTP_METHOD_NOT_ACCEPTABLE \ + _MHD_DEPR_IN_MACRO("Value MHD_HTTP_METHOD_NOT_ACCEPTABLE is deprecated, use MHD_HTTP_NOT_ACCEPTABLE") 406 +#define MHD_HTTP_PROXY_AUTHENTICATION_REQUIRED 407 +#define MHD_HTTP_REQUEST_TIMEOUT 408 +#define MHD_HTTP_CONFLICT 409 +#define MHD_HTTP_GONE 410 +#define MHD_HTTP_LENGTH_REQUIRED 411 +#define MHD_HTTP_PRECONDITION_FAILED 412 +#define MHD_HTTP_PAYLOAD_TOO_LARGE 413 +/** @deprecated */ +#define MHD_HTTP_REQUEST_ENTITY_TOO_LARGE \ + _MHD_DEPR_IN_MACRO("Value MHD_HTTP_REQUEST_ENTITY_TOO_LARGE is deprecated, use MHD_HTTP_PAYLOAD_TOO_LARGE") 413 +#define MHD_HTTP_URI_TOO_LONG 414 +/** @deprecated */ +#define MHD_HTTP_REQUEST_URI_TOO_LONG \ + _MHD_DEPR_IN_MACRO("Value MHD_HTTP_REQUEST_URI_TOO_LONG is deprecated, use MHD_HTTP_URI_TOO_LONG") 414 +#define MHD_HTTP_UNSUPPORTED_MEDIA_TYPE 415 +#define MHD_HTTP_RANGE_NOT_SATISFIABLE 416 +/** @deprecated */ +#define MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE \ + _MHD_DEPR_IN_MACRO("Value MHD_HTTP_REQUESTED_RANGE_NOT_SATISFIABLE is deprecated, use MHD_HTTP_RANGE_NOT_SATISFIABLE") 416 +#define MHD_HTTP_EXPECTATION_FAILED 417 + +#define MHD_HTTP_MISDIRECTED_REQUEST 421 +#define MHD_HTTP_UNPROCESSABLE_ENTITY 422 +#define MHD_HTTP_LOCKED 423 +#define MHD_HTTP_FAILED_DEPENDENCY 424 +#define MHD_HTTP_UNORDERED_COLLECTION 425 +#define MHD_HTTP_UPGRADE_REQUIRED 426 + +#define MHD_HTTP_PRECONDITION_REQUIRED 428 +#define MHD_HTTP_TOO_MANY_REQUESTS 429 +#define MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE 431 + +#define MHD_HTTP_NO_RESPONSE 444 + +#define MHD_HTTP_RETRY_WITH 449 +#define MHD_HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS 450 +#define MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS 451 + +#define MHD_HTTP_INTERNAL_SERVER_ERROR 500 +#define MHD_HTTP_NOT_IMPLEMENTED 501 +#define MHD_HTTP_BAD_GATEWAY 502 +#define MHD_HTTP_SERVICE_UNAVAILABLE 503 +#define MHD_HTTP_GATEWAY_TIMEOUT 504 +#define MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED 505 +#define MHD_HTTP_VARIANT_ALSO_NEGOTIATES 506 +#define MHD_HTTP_INSUFFICIENT_STORAGE 507 +#define MHD_HTTP_LOOP_DETECTED 508 +#define MHD_HTTP_BANDWIDTH_LIMIT_EXCEEDED 509 +#define MHD_HTTP_NOT_EXTENDED 510 +#define MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED 511 + +/** @} */ /* end of group httpcode */ + +/** + * Returns the string reason phrase for a response code. + * + * If we don't have a string for a status code, we give the first + * message in that status code class. + */ +_MHD_EXTERN const char * +MHD_get_reason_phrase_for (unsigned int code); + + +/** + * Flag to be or-ed with MHD_HTTP status code for + * SHOUTcast. This will cause the response to begin + * with the SHOUTcast "ICY" line instad of "HTTP". + * @ingroup specialized + */ +#define MHD_ICY_FLAG ((uint32_t)(((uint32_t)1) << 31)) + +/** + * @defgroup headers HTTP headers + * These are the standard headers found in HTTP requests and responses. + * See: http://www.iana.org/assignments/message-headers/message-headers.xml + * Registry Version 2017-01-27 + * @{ + */ + +/* Main HTTP headers. */ +/* Standard. RFC7231, Section 5.3.2 */ +#define MHD_HTTP_HEADER_ACCEPT "Accept" +/* Standard. RFC7231, Section 5.3.3 */ +#define MHD_HTTP_HEADER_ACCEPT_CHARSET "Accept-Charset" +/* Standard. RFC7231, Section 5.3.4; RFC7694, Section 3 */ +#define MHD_HTTP_HEADER_ACCEPT_ENCODING "Accept-Encoding" +/* Standard. RFC7231, Section 5.3.5 */ +#define MHD_HTTP_HEADER_ACCEPT_LANGUAGE "Accept-Language" +/* Standard. RFC7233, Section 2.3 */ +#define MHD_HTTP_HEADER_ACCEPT_RANGES "Accept-Ranges" +/* Standard. RFC7234, Section 5.1 */ +#define MHD_HTTP_HEADER_AGE "Age" +/* Standard. RFC7231, Section 7.4.1 */ +#define MHD_HTTP_HEADER_ALLOW "Allow" +/* Standard. RFC7235, Section 4.2 */ +#define MHD_HTTP_HEADER_AUTHORIZATION "Authorization" +/* Standard. RFC7234, Section 5.2 */ +#define MHD_HTTP_HEADER_CACHE_CONTROL "Cache-Control" +/* Reserved. RFC7230, Section 8.1 */ +#define MHD_HTTP_HEADER_CLOSE "Close" +/* Standard. RFC7230, Section 6.1 */ +#define MHD_HTTP_HEADER_CONNECTION "Connection" +/* Standard. RFC7231, Section 3.1.2.2 */ +#define MHD_HTTP_HEADER_CONTENT_ENCODING "Content-Encoding" +/* Standard. RFC7231, Section 3.1.3.2 */ +#define MHD_HTTP_HEADER_CONTENT_LANGUAGE "Content-Language" +/* Standard. RFC7230, Section 3.3.2 */ +#define MHD_HTTP_HEADER_CONTENT_LENGTH "Content-Length" +/* Standard. RFC7231, Section 3.1.4.2 */ +#define MHD_HTTP_HEADER_CONTENT_LOCATION "Content-Location" +/* Standard. RFC7233, Section 4.2 */ +#define MHD_HTTP_HEADER_CONTENT_RANGE "Content-Range" +/* Standard. RFC7231, Section 3.1.1.5 */ +#define MHD_HTTP_HEADER_CONTENT_TYPE "Content-Type" +/* Standard. RFC7231, Section 7.1.1.2 */ +#define MHD_HTTP_HEADER_DATE "Date" +/* Standard. RFC7232, Section 2.3 */ +#define MHD_HTTP_HEADER_ETAG "ETag" +/* Standard. RFC7231, Section 5.1.1 */ +#define MHD_HTTP_HEADER_EXPECT "Expect" +/* Standard. RFC7234, Section 5.3 */ +#define MHD_HTTP_HEADER_EXPIRES "Expires" +/* Standard. RFC7231, Section 5.5.1 */ +#define MHD_HTTP_HEADER_FROM "From" +/* Standard. RFC7230, Section 5.4 */ +#define MHD_HTTP_HEADER_HOST "Host" +/* Standard. RFC7232, Section 3.1 */ +#define MHD_HTTP_HEADER_IF_MATCH "If-Match" +/* Standard. RFC7232, Section 3.3 */ +#define MHD_HTTP_HEADER_IF_MODIFIED_SINCE "If-Modified-Since" +/* Standard. RFC7232, Section 3.2 */ +#define MHD_HTTP_HEADER_IF_NONE_MATCH "If-None-Match" +/* Standard. RFC7233, Section 3.2 */ +#define MHD_HTTP_HEADER_IF_RANGE "If-Range" +/* Standard. RFC7232, Section 3.4 */ +#define MHD_HTTP_HEADER_IF_UNMODIFIED_SINCE "If-Unmodified-Since" +/* Standard. RFC7232, Section 2.2 */ +#define MHD_HTTP_HEADER_LAST_MODIFIED "Last-Modified" +/* Standard. RFC7231, Section 7.1.2 */ +#define MHD_HTTP_HEADER_LOCATION "Location" +/* Standard. RFC7231, Section 5.1.2 */ +#define MHD_HTTP_HEADER_MAX_FORWARDS "Max-Forwards" +/* Standard. RFC7231, Appendix A.1 */ +#define MHD_HTTP_HEADER_MIME_VERSION "MIME-Version" +/* Standard. RFC7234, Section 5.4 */ +#define MHD_HTTP_HEADER_PRAGMA "Pragma" +/* Standard. RFC7235, Section 4.3 */ +#define MHD_HTTP_HEADER_PROXY_AUTHENTICATE "Proxy-Authenticate" +/* Standard. RFC7235, Section 4.4 */ +#define MHD_HTTP_HEADER_PROXY_AUTHORIZATION "Proxy-Authorization" +/* Standard. RFC7233, Section 3.1 */ +#define MHD_HTTP_HEADER_RANGE "Range" +/* Standard. RFC7231, Section 5.5.2 */ +#define MHD_HTTP_HEADER_REFERER "Referer" +/* Standard. RFC7231, Section 7.1.3 */ +#define MHD_HTTP_HEADER_RETRY_AFTER "Retry-After" +/* Standard. RFC7231, Section 7.4.2 */ +#define MHD_HTTP_HEADER_SERVER "Server" +/* Standard. RFC7230, Section 4.3 */ +#define MHD_HTTP_HEADER_TE "TE" +/* Standard. RFC7230, Section 4.4 */ +#define MHD_HTTP_HEADER_TRAILER "Trailer" +/* Standard. RFC7230, Section 3.3.1 */ +#define MHD_HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding" +/* Standard. RFC7230, Section 6.7 */ +#define MHD_HTTP_HEADER_UPGRADE "Upgrade" +/* Standard. RFC7231, Section 5.5.3 */ +#define MHD_HTTP_HEADER_USER_AGENT "User-Agent" +/* Standard. RFC7231, Section 7.1.4 */ +#define MHD_HTTP_HEADER_VARY "Vary" +/* Standard. RFC7230, Section 5.7.1 */ +#define MHD_HTTP_HEADER_VIA "Via" +/* Standard. RFC7235, Section 4.1 */ +#define MHD_HTTP_HEADER_WWW_AUTHENTICATE "WWW-Authenticate" +/* Standard. RFC7234, Section 5.5 */ +#define MHD_HTTP_HEADER_WARNING "Warning" + +/* Additional HTTP headers. */ +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_A_IM "A-IM" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_ACCEPT_ADDITIONS "Accept-Additions" +/* Informational. RFC7089 */ +#define MHD_HTTP_HEADER_ACCEPT_DATETIME "Accept-Datetime" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_ACCEPT_FEATURES "Accept-Features" +/* No category. RFC5789 */ +#define MHD_HTTP_HEADER_ACCEPT_PATCH "Accept-Patch" +/* Standard. RFC7639, Section 2 */ +#define MHD_HTTP_HEADER_ALPN "ALPN" +/* Standard. RFC7838 */ +#define MHD_HTTP_HEADER_ALT_SVC "Alt-Svc" +/* Standard. RFC7838 */ +#define MHD_HTTP_HEADER_ALT_USED "Alt-Used" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_ALTERNATES "Alternates" +/* No category. RFC4437 */ +#define MHD_HTTP_HEADER_APPLY_TO_REDIRECT_REF "Apply-To-Redirect-Ref" +/* Experimental. RFC8053, Section 4 */ +#define MHD_HTTP_HEADER_AUTHENTICATION_CONTROL "Authentication-Control" +/* Standard. RFC7615, Section 3 */ +#define MHD_HTTP_HEADER_AUTHENTICATION_INFO "Authentication-Info" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_EXT "C-Ext" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_MAN "C-Man" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_OPT "C-Opt" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_PEP "C-PEP" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_C_PEP_INFO "C-PEP-Info" +/* Standard. RFC7809, Section 7.1 */ +#define MHD_HTTP_HEADER_CALDAV_TIMEZONES "CalDAV-Timezones" +/* Obsoleted. RFC2068; RFC2616 */ +#define MHD_HTTP_HEADER_CONTENT_BASE "Content-Base" +/* Standard. RFC6266 */ +#define MHD_HTTP_HEADER_CONTENT_DISPOSITION "Content-Disposition" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_ID "Content-ID" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_MD5 "Content-MD5" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_SCRIPT_TYPE "Content-Script-Type" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_STYLE_TYPE "Content-Style-Type" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_CONTENT_VERSION "Content-Version" +/* Standard. RFC6265 */ +#define MHD_HTTP_HEADER_COOKIE "Cookie" +/* Obsoleted. RFC2965; RFC6265 */ +#define MHD_HTTP_HEADER_COOKIE2 "Cookie2" +/* Standard. RFC5323 */ +#define MHD_HTTP_HEADER_DASL "DASL" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_DAV "DAV" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DEFAULT_STYLE "Default-Style" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DELTA_BASE "Delta-Base" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_DEPTH "Depth" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DERIVED_FROM "Derived-From" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_DESTINATION "Destination" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DIFFERENTIAL_ID "Differential-ID" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_DIGEST "Digest" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_EXT "Ext" +/* Standard. RFC7239 */ +#define MHD_HTTP_HEADER_FORWARDED "Forwarded" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_GETPROFILE "GetProfile" +/* Experimental. RFC7486, Section 6.1.1 */ +#define MHD_HTTP_HEADER_HOBAREG "Hobareg" +/* Standard. RFC7540, Section 3.2.1 */ +#define MHD_HTTP_HEADER_HTTP2_SETTINGS "HTTP2-Settings" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_IM "IM" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_IF "If" +/* Standard. RFC6638 */ +#define MHD_HTTP_HEADER_IF_SCHEDULE_TAG_MATCH "If-Schedule-Tag-Match" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_KEEP_ALIVE "Keep-Alive" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_LABEL "Label" +/* No category. RFC5988 */ +#define MHD_HTTP_HEADER_LINK "Link" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_LOCK_TOKEN "Lock-Token" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_MAN "Man" +/* Informational. RFC7089 */ +#define MHD_HTTP_HEADER_MEMENTO_DATETIME "Memento-Datetime" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_METER "Meter" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_NEGOTIATE "Negotiate" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_OPT "Opt" +/* Experimental. RFC8053, Section 3 */ +#define MHD_HTTP_HEADER_OPTIONAL_WWW_AUTHENTICATE "Optional-WWW-Authenticate" +/* Standard. RFC4229 */ +#define MHD_HTTP_HEADER_ORDERING_TYPE "Ordering-Type" +/* Standard. RFC6454 */ +#define MHD_HTTP_HEADER_ORIGIN "Origin" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_OVERWRITE "Overwrite" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_P3P "P3P" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PEP "PEP" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PICS_LABEL "PICS-Label" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PEP_INFO "Pep-Info" +/* Standard. RFC4229 */ +#define MHD_HTTP_HEADER_POSITION "Position" +/* Standard. RFC7240 */ +#define MHD_HTTP_HEADER_PREFER "Prefer" +/* Standard. RFC7240 */ +#define MHD_HTTP_HEADER_PREFERENCE_APPLIED "Preference-Applied" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROFILEOBJECT "ProfileObject" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROTOCOL "Protocol" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROTOCOL_INFO "Protocol-Info" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROTOCOL_QUERY "Protocol-Query" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROTOCOL_REQUEST "Protocol-Request" +/* Standard. RFC7615, Section 4 */ +#define MHD_HTTP_HEADER_PROXY_AUTHENTICATION_INFO "Proxy-Authentication-Info" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROXY_FEATURES "Proxy-Features" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PROXY_INSTRUCTION "Proxy-Instruction" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_PUBLIC "Public" +/* Standard. RFC7469 */ +#define MHD_HTTP_HEADER_PUBLIC_KEY_PINS "Public-Key-Pins" +/* Standard. RFC7469 */ +#define MHD_HTTP_HEADER_PUBLIC_KEY_PINS_REPORT_ONLY "Public-Key-Pins-Report-Only" +/* No category. RFC4437 */ +#define MHD_HTTP_HEADER_REDIRECT_REF "Redirect-Ref" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SAFE "Safe" +/* Standard. RFC6638 */ +#define MHD_HTTP_HEADER_SCHEDULE_REPLY "Schedule-Reply" +/* Standard. RFC6638 */ +#define MHD_HTTP_HEADER_SCHEDULE_TAG "Schedule-Tag" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_ACCEPT "Sec-WebSocket-Accept" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_EXTENSIONS "Sec-WebSocket-Extensions" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_KEY "Sec-WebSocket-Key" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_PROTOCOL "Sec-WebSocket-Protocol" +/* Standard. RFC6455 */ +#define MHD_HTTP_HEADER_SEC_WEBSOCKET_VERSION "Sec-WebSocket-Version" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SECURITY_SCHEME "Security-Scheme" +/* Standard. RFC6265 */ +#define MHD_HTTP_HEADER_SET_COOKIE "Set-Cookie" +/* Obsoleted. RFC2965; RFC6265 */ +#define MHD_HTTP_HEADER_SET_COOKIE2 "Set-Cookie2" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SETPROFILE "SetProfile" +/* Standard. RFC5023 */ +#define MHD_HTTP_HEADER_SLUG "SLUG" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SOAPACTION "SoapAction" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_STATUS_URI "Status-URI" +/* Standard. RFC6797 */ +#define MHD_HTTP_HEADER_STRICT_TRANSPORT_SECURITY "Strict-Transport-Security" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SURROGATE_CAPABILITY "Surrogate-Capability" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_SURROGATE_CONTROL "Surrogate-Control" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_TCN "TCN" +/* Standard. RFC4918 */ +#define MHD_HTTP_HEADER_TIMEOUT "Timeout" +/* Standard. RFC8030, Section 5.4 */ +#define MHD_HTTP_HEADER_TOPIC "Topic" +/* Standard. RFC8030, Section 5.2 */ +#define MHD_HTTP_HEADER_TTL "TTL" +/* Standard. RFC8030, Section 5.3 */ +#define MHD_HTTP_HEADER_URGENCY "Urgency" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_URI "URI" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_VARIANT_VARY "Variant-Vary" +/* No category. RFC4229 */ +#define MHD_HTTP_HEADER_WANT_DIGEST "Want-Digest" +/* Informational. RFC7034 */ +#define MHD_HTTP_HEADER_X_FRAME_OPTIONS "X-Frame-Options" + +/* Some provisional headers. */ +#define MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN "Access-Control-Allow-Origin" +/** @} */ /* end of group headers */ + +/** + * @defgroup versions HTTP versions + * These strings should be used to match against the first line of the + * HTTP header. + * @{ + */ +#define MHD_HTTP_VERSION_1_0 "HTTP/1.0" +#define MHD_HTTP_VERSION_1_1 "HTTP/1.1" + +/** @} */ /* end of group versions */ + +/** + * @defgroup methods HTTP methods + * HTTP methods (as strings). + * See: http://www.iana.org/assignments/http-methods/http-methods.xml + * Registry Version 2015-05-19 + * @{ + */ +/* Main HTTP methods. */ +/* Not safe. Not idempotent. RFC7231, Section 4.3.6. */ +#define MHD_HTTP_METHOD_CONNECT "CONNECT" +/* Not safe. Idempotent. RFC7231, Section 4.3.5. */ +#define MHD_HTTP_METHOD_DELETE "DELETE" +/* Safe. Idempotent. RFC7231, Section 4.3.1. */ +#define MHD_HTTP_METHOD_GET "GET" +/* Safe. Idempotent. RFC7231, Section 4.3.2. */ +#define MHD_HTTP_METHOD_HEAD "HEAD" +/* Safe. Idempotent. RFC7231, Section 4.3.7. */ +#define MHD_HTTP_METHOD_OPTIONS "OPTIONS" +/* Not safe. Not idempotent. RFC7231, Section 4.3.3. */ +#define MHD_HTTP_METHOD_POST "POST" +/* Not safe. Idempotent. RFC7231, Section 4.3.4. */ +#define MHD_HTTP_METHOD_PUT "PUT" +/* Safe. Idempotent. RFC7231, Section 4.3.8. */ +#define MHD_HTTP_METHOD_TRACE "TRACE" + +/* Additional HTTP methods. */ +/* Not safe. Idempotent. RFC3744, Section 8.1. */ +#define MHD_HTTP_METHOD_ACL "ACL" +/* Not safe. Idempotent. RFC3253, Section 12.6. */ +#define MHD_HTTP_METHOD_BASELINE_CONTROL "BASELINE-CONTROL" +/* Not safe. Idempotent. RFC5842, Section 4. */ +#define MHD_HTTP_METHOD_BIND "BIND" +/* Not safe. Idempotent. RFC3253, Section 4.4, Section 9.4. */ +#define MHD_HTTP_METHOD_CHECKIN "CHECKIN" +/* Not safe. Idempotent. RFC3253, Section 4.3, Section 8.8. */ +#define MHD_HTTP_METHOD_CHECKOUT "CHECKOUT" +/* Not safe. Idempotent. RFC4918, Section 9.8. */ +#define MHD_HTTP_METHOD_COPY "COPY" +/* Not safe. Idempotent. RFC3253, Section 8.2. */ +#define MHD_HTTP_METHOD_LABEL "LABEL" +/* Not safe. Idempotent. RFC2068, Section 19.6.1.2. */ +#define MHD_HTTP_METHOD_LINK "LINK" +/* Not safe. Not idempotent. RFC4918, Section 9.10. */ +#define MHD_HTTP_METHOD_LOCK "LOCK" +/* Not safe. Idempotent. RFC3253, Section 11.2. */ +#define MHD_HTTP_METHOD_MERGE "MERGE" +/* Not safe. Idempotent. RFC3253, Section 13.5. */ +#define MHD_HTTP_METHOD_MKACTIVITY "MKACTIVITY" +/* Not safe. Idempotent. RFC4791, Section 5.3.1. */ +#define MHD_HTTP_METHOD_MKCALENDAR "MKCALENDAR" +/* Not safe. Idempotent. RFC4918, Section 9.3. */ +#define MHD_HTTP_METHOD_MKCOL "MKCOL" +/* Not safe. Idempotent. RFC4437, Section 6. */ +#define MHD_HTTP_METHOD_MKREDIRECTREF "MKREDIRECTREF" +/* Not safe. Idempotent. RFC3253, Section 6.3. */ +#define MHD_HTTP_METHOD_MKWORKSPACE "MKWORKSPACE" +/* Not safe. Idempotent. RFC4918, Section 9.9. */ +#define MHD_HTTP_METHOD_MOVE "MOVE" +/* Not safe. Idempotent. RFC3648, Section 7. */ +#define MHD_HTTP_METHOD_ORDERPATCH "ORDERPATCH" +/* Not safe. Not idempotent. RFC5789, Section 2. */ +#define MHD_HTTP_METHOD_PATCH "PATCH" +/* Safe. Idempotent. RFC7540, Section 3.5. */ +#define MHD_HTTP_METHOD_PRI "PRI" +/* Safe. Idempotent. RFC4918, Section 9.1. */ +#define MHD_HTTP_METHOD_PROPFIND "PROPFIND" +/* Not safe. Idempotent. RFC4918, Section 9.2. */ +#define MHD_HTTP_METHOD_PROPPATCH "PROPPATCH" +/* Not safe. Idempotent. RFC5842, Section 6. */ +#define MHD_HTTP_METHOD_REBIND "REBIND" +/* Safe. Idempotent. RFC3253, Section 3.6. */ +#define MHD_HTTP_METHOD_REPORT "REPORT" +/* Safe. Idempotent. RFC5323, Section 2. */ +#define MHD_HTTP_METHOD_SEARCH "SEARCH" +/* Not safe. Idempotent. RFC5842, Section 5. */ +#define MHD_HTTP_METHOD_UNBIND "UNBIND" +/* Not safe. Idempotent. RFC3253, Section 4.5. */ +#define MHD_HTTP_METHOD_UNCHECKOUT "UNCHECKOUT" +/* Not safe. Idempotent. RFC2068, Section 19.6.1.3. */ +#define MHD_HTTP_METHOD_UNLINK "UNLINK" +/* Not safe. Idempotent. RFC4918, Section 9.11. */ +#define MHD_HTTP_METHOD_UNLOCK "UNLOCK" +/* Not safe. Idempotent. RFC3253, Section 7.1. */ +#define MHD_HTTP_METHOD_UPDATE "UPDATE" +/* Not safe. Idempotent. RFC4437, Section 7. */ +#define MHD_HTTP_METHOD_UPDATEREDIRECTREF "UPDATEREDIRECTREF" +/* Not safe. Idempotent. RFC3253, Section 3.5. */ +#define MHD_HTTP_METHOD_VERSION_CONTROL "VERSION-CONTROL" + +/** @} */ /* end of group methods */ + +/** + * @defgroup postenc HTTP POST encodings + * See also: http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 + * @{ + */ +#define MHD_HTTP_POST_ENCODING_FORM_URLENCODED "application/x-www-form-urlencoded" +#define MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA "multipart/form-data" + +/** @} */ /* end of group postenc */ + + +/** + * @brief Handle for the daemon (listening on a socket for HTTP traffic). + * @ingroup event + */ +struct MHD_Daemon; + +/** + * @brief Handle for a connection / HTTP request. + * + * With HTTP/1.1, multiple requests can be run over the same + * connection. However, MHD will only show one request per TCP + * connection to the client at any given time. + * @ingroup request + */ +struct MHD_Connection; + +/** + * @brief Handle for a response. + * @ingroup response + */ +struct MHD_Response; + +/** + * @brief Handle for POST processing. + * @ingroup response + */ +struct MHD_PostProcessor; + + +/** + * @brief Flags for the `struct MHD_Daemon`. + * + * Note that MHD will run automatically in background thread(s) only + * if #MHD_USE_INTERNAL_POLLING_THREAD is used. Otherwise caller (application) + * must use #MHD_run() or #MHD_run_from_select() to have MHD processed + * network connections and data. + * + * Starting the daemon may also fail if a particular option is not + * implemented or not supported on the target platform (i.e. no + * support for TLS, epoll or IPv6). + */ +enum MHD_FLAG +{ + /** + * No options selected. + */ + MHD_NO_FLAG = 0, + + /** + * Print errors messages to custom error logger or to `stderr` if + * custom error logger is not set. + * @sa ::MHD_OPTION_EXTERNAL_LOGGER + */ + MHD_USE_ERROR_LOG = 1, + + /** + * Run in debug mode. If this flag is used, the library should + * print error messages and warnings to `stderr`. + */ + MHD_USE_DEBUG = 1, + + /** + * Run in HTTPS mode. The modern protocol is called TLS. + */ + MHD_USE_TLS = 2, + + /** @deprecated */ + MHD_USE_SSL = 2, +#if 0 + /* let's do this later once versions that define MHD_USE_TLS a more widely deployed. */ +#define MHD_USE_SSL \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_SSL is deprecated, use MHD_USE_TLS") \ + MHD_USE_TLS +#endif + + /** + * Run using one thread per connection. + * Must be used only with #MHD_USE_INTERNAL_POLLING_THREAD. + */ + MHD_USE_THREAD_PER_CONNECTION = 4, + + /** + * Run using an internal thread (or thread pool) for sockets sending + * and receiving and data processing. Without this flag MHD will not + * run automatically in background thread(s). + * If this flag is set, #MHD_run() and #MHD_run_from_select() couldn't + * be used. + * This flag is set explicitly by #MHD_USE_POLL_INTERNAL_THREAD and + * by #MHD_USE_EPOLL_INTERNAL_THREAD. + */ + MHD_USE_INTERNAL_POLLING_THREAD = 8, + + /** @deprecated */ + MHD_USE_SELECT_INTERNALLY = 8, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_SELECT_INTERNALLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_SELECT_INTERNALLY is deprecated, use MHD_USE_INTERNAL_POLLING_THREAD instead") \ + MHD_USE_INTERNAL_POLLING_THREAD +#endif /* 0 */ + + /** + * Run using the IPv6 protocol (otherwise, MHD will just support + * IPv4). If you want MHD to support IPv4 and IPv6 using a single + * socket, pass #MHD_USE_DUAL_STACK, otherwise, if you only pass + * this option, MHD will try to bind to IPv6-only (resulting in + * no IPv4 support). + */ + MHD_USE_IPv6 = 16, + + /** + * Be pedantic about the protocol (as opposed to as tolerant as + * possible). Specifically, at the moment, this flag causes MHD to + * reject HTTP 1.1 connections without a "Host" header. This is + * required by the standard, but of course in violation of the "be + * as liberal as possible in what you accept" norm. It is + * recommended to turn this ON if you are testing clients against + * MHD, and OFF in production. + */ + MHD_USE_PEDANTIC_CHECKS = 32, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_PEDANTIC_CHECKS \ + _MHD_DEPR_IN_MACRO("Flag MHD_USE_PEDANTIC_CHECKS is deprecated, use option MHD_OPTION_STRICT_FOR_CLIENT instead") \ + 32 +#endif /* 0 */ + + /** + * Use `poll()` instead of `select()`. This allows sockets with `fd >= + * FD_SETSIZE`. This option is not compatible with using an + * 'external' polling mode (as there is no API to get the file + * descriptors for the external poll() from MHD) and must also not + * be used in combination with #MHD_USE_EPOLL. + * @sa ::MHD_FEATURE_POLL, #MHD_USE_POLL_INTERNAL_THREAD + */ + MHD_USE_POLL = 64, + + /** + * Run using an internal thread (or thread pool) doing `poll()`. + * @sa ::MHD_FEATURE_POLL, #MHD_USE_POLL, #MHD_USE_INTERNAL_POLLING_THREAD + */ + MHD_USE_POLL_INTERNAL_THREAD = MHD_USE_POLL | MHD_USE_INTERNAL_POLLING_THREAD, + + /** @deprecated */ + MHD_USE_POLL_INTERNALLY = MHD_USE_POLL | MHD_USE_INTERNAL_POLLING_THREAD, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_POLL_INTERNALLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_POLL_INTERNALLY is deprecated, use MHD_USE_POLL_INTERNAL_THREAD instead") \ + MHD_USE_POLL_INTERNAL_THREAD +#endif /* 0 */ + + /** + * Suppress (automatically) adding the 'Date:' header to HTTP responses. + * This option should ONLY be used on systems that do not have a clock + * and that DO provide other mechanisms for cache control. See also + * RFC 2616, section 14.18 (exception 3). + */ + MHD_USE_SUPPRESS_DATE_NO_CLOCK = 128, + + /** @deprecated */ + MHD_SUPPRESS_DATE_NO_CLOCK = 128, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_SUPPRESS_DATE_NO_CLOCK \ + _MHD_DEPR_IN_MACRO("Value MHD_SUPPRESS_DATE_NO_CLOCK is deprecated, use MHD_USE_SUPPRESS_DATE_NO_CLOCK instead") \ + MHD_USE_SUPPRESS_DATE_NO_CLOCK +#endif /* 0 */ + + /** + * Run without a listen socket. This option only makes sense if + * #MHD_add_connection is to be used exclusively to connect HTTP + * clients to the HTTP server. This option is incompatible with + * using a thread pool; if it is used, #MHD_OPTION_THREAD_POOL_SIZE + * is ignored. + */ + MHD_USE_NO_LISTEN_SOCKET = 256, + + /** + * Use `epoll()` instead of `select()` or `poll()` for the event loop. + * This option is only available on some systems; using the option on + * systems without epoll will cause #MHD_start_daemon to fail. Using + * this option is not supported with #MHD_USE_THREAD_PER_CONNECTION. + * @sa ::MHD_FEATURE_EPOLL + */ + MHD_USE_EPOLL = 512, + + /** @deprecated */ + MHD_USE_EPOLL_LINUX_ONLY = 512, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_EPOLL_LINUX_ONLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_LINUX_ONLY is deprecated, use MHD_USE_EPOLL") \ + MHD_USE_EPOLL +#endif /* 0 */ + + /** + * Run using an internal thread (or thread pool) doing `epoll()`. + * This option is only available on certain platforms; using the option on + * platform without `epoll` support will cause #MHD_start_daemon to fail. + * @sa ::MHD_FEATURE_EPOLL, #MHD_USE_EPOLL, #MHD_USE_INTERNAL_POLLING_THREAD + */ + MHD_USE_EPOLL_INTERNAL_THREAD = MHD_USE_EPOLL | MHD_USE_INTERNAL_POLLING_THREAD, + + /** @deprecated */ + MHD_USE_EPOLL_INTERNALLY = MHD_USE_EPOLL | MHD_USE_INTERNAL_POLLING_THREAD, + /** @deprecated */ + MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY = MHD_USE_EPOLL | MHD_USE_INTERNAL_POLLING_THREAD, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_EPOLL_INTERNALLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_INTERNALLY is deprecated, use MHD_USE_EPOLL_INTERNAL_THREAD") \ + MHD_USE_EPOLL_INTERNAL_THREAD + /** @deprecated */ +#define MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY is deprecated, use MHD_USE_EPOLL_INTERNAL_THREAD") \ + MHD_USE_EPOLL_INTERNAL_THREAD +#endif /* 0 */ + + /** + * Use inter-thread communication channel. + * #MHD_USE_ITC can be used with #MHD_USE_INTERNAL_POLLING_THREAD + * and is ignored with any "external" mode. + * It's required for use of #MHD_quiesce_daemon + * or #MHD_add_connection. + * This option is enforced by #MHD_ALLOW_SUSPEND_RESUME or + * #MHD_USE_NO_LISTEN_SOCKET. + * #MHD_USE_ITC is always used automatically on platforms + * where select()/poll()/other ignore shutdown of listen + * socket. + */ + MHD_USE_ITC = 1024, + + /** @deprecated */ + MHD_USE_PIPE_FOR_SHUTDOWN = 1024, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_PIPE_FOR_SHUTDOWN \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_PIPE_FOR_SHUTDOWN is deprecated, use MHD_USE_ITC") \ + MHD_USE_ITC +#endif /* 0 */ + + /** + * Use a single socket for IPv4 and IPv6. + */ + MHD_USE_DUAL_STACK = MHD_USE_IPv6 | 2048, + + /** + * Enable `turbo`. Disables certain calls to `shutdown()`, + * enables aggressive non-blocking optimistic reads and + * other potentially unsafe optimizations. + * Most effects only happen with #MHD_USE_EPOLL. + */ + MHD_USE_TURBO = 4096, + + /** @deprecated */ + MHD_USE_EPOLL_TURBO = 4096, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_EPOLL_TURBO \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_TURBO is deprecated, use MHD_USE_TURBO") \ + MHD_USE_TURBO +#endif /* 0 */ + + /** + * Enable suspend/resume functions, which also implies setting up + * ITC to signal resume. + */ + MHD_ALLOW_SUSPEND_RESUME = 8192 | MHD_USE_ITC, + + /** @deprecated */ + MHD_USE_SUSPEND_RESUME = 8192 | MHD_USE_ITC, +#if 0 /* Will be marked for real deprecation later. */ +#define MHD_USE_SUSPEND_RESUME \ + _MHD_DEPR_IN_MACRO("Value MHD_USE_SUSPEND_RESUME is deprecated, use MHD_ALLOW_SUSPEND_RESUME instead") \ + MHD_ALLOW_SUSPEND_RESUME +#endif /* 0 */ + + /** + * Enable TCP_FASTOPEN option. This option is only available on Linux with a + * kernel >= 3.6. On other systems, using this option cases #MHD_start_daemon + * to fail. + */ + MHD_USE_TCP_FASTOPEN = 16384, + + /** + * You need to set this option if you want to use HTTP "Upgrade". + * "Upgrade" may require usage of additional internal resources, + * which we do not want to use unless necessary. + */ + MHD_ALLOW_UPGRADE = 32768, + + /** + * Automatically use best available polling function. + * Choice of polling function is also depend on other daemon options. + * If #MHD_USE_INTERNAL_POLLING_THREAD is specified then epoll, poll() or + * select() will be used (listed in decreasing preference order, first + * function available on system will be used). + * If #MHD_USE_THREAD_PER_CONNECTION is specified then poll() or select() + * will be used. + * If those flags are not specified then epoll or select() will be + * used (as the only suitable for MHD_get_fdset()) + */ + MHD_USE_AUTO = 65536, + + /** + * Run using an internal thread (or thread pool) with best available on + * system polling function. + * This is combination of #MHD_USE_AUTO and #MHD_USE_INTERNAL_POLLING_THREAD + * flags. + */ + MHD_USE_AUTO_INTERNAL_THREAD = MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD + +}; + + +/** + * Type of a callback function used for logging by MHD. + * + * @param cls closure + * @param fm format string (`printf()`-style) + * @param ap arguments to @a fm + * @ingroup logging + */ +typedef void +(*MHD_LogCallback)(void *cls, + const char *fm, + va_list ap); + + +/** + * @brief MHD options. + * + * Passed in the varargs portion of #MHD_start_daemon. + */ +enum MHD_OPTION +{ + + /** + * No more options / last option. This is used + * to terminate the VARARGs list. + */ + MHD_OPTION_END = 0, + + /** + * Maximum memory size per connection (followed by a `size_t`). + * Default is 32 kb (#MHD_POOL_SIZE_DEFAULT). + * Values above 128k are unlikely to result in much benefit, as half + * of the memory will be typically used for IO, and TCP buffers are + * unlikely to support window sizes above 64k on most systems. + */ + MHD_OPTION_CONNECTION_MEMORY_LIMIT = 1, + + /** + * Maximum number of concurrent connections to + * accept (followed by an `unsigned int`). + */ + MHD_OPTION_CONNECTION_LIMIT = 2, + + /** + * After how many seconds of inactivity should a + * connection automatically be timed out? (followed + * by an `unsigned int`; use zero for no timeout). + */ + MHD_OPTION_CONNECTION_TIMEOUT = 3, + + /** + * Register a function that should be called whenever a request has + * been completed (this can be used for application-specific clean + * up). Requests that have never been presented to the application + * (via #MHD_AccessHandlerCallback) will not result in + * notifications. + * + * This option should be followed by TWO pointers. First a pointer + * to a function of type #MHD_RequestCompletedCallback and second a + * pointer to a closure to pass to the request completed callback. + * The second pointer maybe NULL. + */ + MHD_OPTION_NOTIFY_COMPLETED = 4, + + /** + * Limit on the number of (concurrent) connections made to the + * server from the same IP address. Can be used to prevent one + * IP from taking over all of the allowed connections. If the + * same IP tries to establish more than the specified number of + * connections, they will be immediately rejected. The option + * should be followed by an `unsigned int`. The default is + * zero, which means no limit on the number of connections + * from the same IP address. + */ + MHD_OPTION_PER_IP_CONNECTION_LIMIT = 5, + + /** + * Bind daemon to the supplied `struct sockaddr`. This option should + * be followed by a `struct sockaddr *`. If #MHD_USE_IPv6 is + * specified, the `struct sockaddr*` should point to a `struct + * sockaddr_in6`, otherwise to a `struct sockaddr_in`. + */ + MHD_OPTION_SOCK_ADDR = 6, + + /** + * Specify a function that should be called before parsing the URI from + * the client. The specified callback function can be used for processing + * the URI (including the options) before it is parsed. The URI after + * parsing will no longer contain the options, which maybe inconvenient for + * logging. This option should be followed by two arguments, the first + * one must be of the form + * + * void * my_logger(void *cls, const char *uri, struct MHD_Connection *con) + * + * where the return value will be passed as + * (`* con_cls`) in calls to the #MHD_AccessHandlerCallback + * when this request is processed later; returning a + * value of NULL has no special significance (however, + * note that if you return non-NULL, you can no longer + * rely on the first call to the access handler having + * `NULL == *con_cls` on entry;) + * "cls" will be set to the second argument following + * #MHD_OPTION_URI_LOG_CALLBACK. Finally, uri will + * be the 0-terminated URI of the request. + * + * Note that during the time of this call, most of the connection's + * state is not initialized (as we have not yet parsed the headers). + * However, information about the connecting client (IP, socket) + * is available. + * + * The specified function is called only once per request, therefore some + * programmers may use it to instantiate their own request objects, freeing + * them in the notifier #MHD_OPTION_NOTIFY_COMPLETED. + */ + MHD_OPTION_URI_LOG_CALLBACK = 7, + + /** + * Memory pointer for the private key (key.pem) to be used by the + * HTTPS daemon. This option should be followed by a + * `const char *` argument. + * This should be used in conjunction with #MHD_OPTION_HTTPS_MEM_CERT. + */ + MHD_OPTION_HTTPS_MEM_KEY = 8, + + /** + * Memory pointer for the certificate (cert.pem) to be used by the + * HTTPS daemon. This option should be followed by a + * `const char *` argument. + * This should be used in conjunction with #MHD_OPTION_HTTPS_MEM_KEY. + */ + MHD_OPTION_HTTPS_MEM_CERT = 9, + + /** + * Daemon credentials type. + * Followed by an argument of type + * `gnutls_credentials_type_t`. + */ + MHD_OPTION_HTTPS_CRED_TYPE = 10, + + /** + * Memory pointer to a `const char *` specifying the + * cipher algorithm (default: "NORMAL"). + */ + MHD_OPTION_HTTPS_PRIORITIES = 11, + + /** + * Pass a listen socket for MHD to use (systemd-style). If this + * option is used, MHD will not open its own listen socket(s). The + * argument passed must be of type `MHD_socket` and refer to an + * existing socket that has been bound to a port and is listening. + */ + MHD_OPTION_LISTEN_SOCKET = 12, + + /** + * Use the given function for logging error messages. This option + * must be followed by two arguments; the first must be a pointer to + * a function of type #MHD_LogCallback and the second a pointer + * `void *` which will be passed as the first argument to the log + * callback. + * + * Note that MHD will not generate any log messages + * if it was compiled without the "--enable-messages" + * flag being set. + */ + MHD_OPTION_EXTERNAL_LOGGER = 13, + + /** + * Number (`unsigned int`) of threads in thread pool. Enable + * thread pooling by setting this value to to something + * greater than 1. Currently, thread model must be + * #MHD_USE_INTERNAL_POLLING_THREAD if thread pooling is enabled + * (#MHD_start_daemon returns NULL for an unsupported thread + * model). + */ + MHD_OPTION_THREAD_POOL_SIZE = 14, + + /** + * Additional options given in an array of `struct MHD_OptionItem`. + * The array must be terminated with an entry `{MHD_OPTION_END, 0, NULL}`. + * An example for code using #MHD_OPTION_ARRAY is: + * + * struct MHD_OptionItem ops[] = { + * { MHD_OPTION_CONNECTION_LIMIT, 100, NULL }, + * { MHD_OPTION_CONNECTION_TIMEOUT, 10, NULL }, + * { MHD_OPTION_END, 0, NULL } + * }; + * d = MHD_start_daemon (0, 8080, NULL, NULL, dh, NULL, + * MHD_OPTION_ARRAY, ops, + * MHD_OPTION_END); + * + * For options that expect a single pointer argument, the + * second member of the `struct MHD_OptionItem` is ignored. + * For options that expect two pointer arguments, the first + * argument must be cast to `intptr_t`. + */ + MHD_OPTION_ARRAY = 15, + + /** + * Specify a function that should be called for unescaping escape + * sequences in URIs and URI arguments. Note that this function + * will NOT be used by the `struct MHD_PostProcessor`. If this + * option is not specified, the default method will be used which + * decodes escape sequences of the form "%HH". This option should + * be followed by two arguments, the first one must be of the form + * + * size_t my_unescaper(void *cls, + * struct MHD_Connection *c, + * char *s) + * + * where the return value must be "strlen(s)" and "s" should be + * updated. Note that the unescape function must not lengthen "s" + * (the result must be shorter than the input and still be + * 0-terminated). "cls" will be set to the second argument + * following #MHD_OPTION_UNESCAPE_CALLBACK. + */ + MHD_OPTION_UNESCAPE_CALLBACK = 16, + + /** + * Memory pointer for the random values to be used by the Digest + * Auth module. This option should be followed by two arguments. + * First an integer of type `size_t` which specifies the size + * of the buffer pointed to by the second argument in bytes. + * Note that the application must ensure that the buffer of the + * second argument remains allocated and unmodified while the + * deamon is running. + */ + MHD_OPTION_DIGEST_AUTH_RANDOM = 17, + + /** + * Size of the internal array holding the map of the nonce and + * the nonce counter. This option should be followed by an `unsigend int` + * argument. + */ + MHD_OPTION_NONCE_NC_SIZE = 18, + + /** + * Desired size of the stack for threads created by MHD. Followed + * by an argument of type `size_t`. Use 0 for system default. + */ + MHD_OPTION_THREAD_STACK_SIZE = 19, + + /** + * Memory pointer for the certificate (ca.pem) to be used by the + * HTTPS daemon for client authentification. + * This option should be followed by a `const char *` argument. + */ + MHD_OPTION_HTTPS_MEM_TRUST = 20, + + /** + * Increment to use for growing the read buffer (followed by a + * `size_t`). Must fit within #MHD_OPTION_CONNECTION_MEMORY_LIMIT. + */ + MHD_OPTION_CONNECTION_MEMORY_INCREMENT = 21, + + /** + * Use a callback to determine which X.509 certificate should be + * used for a given HTTPS connection. This option should be + * followed by a argument of type `gnutls_certificate_retrieve_function2 *`. + * This option provides an + * alternative to #MHD_OPTION_HTTPS_MEM_KEY, + * #MHD_OPTION_HTTPS_MEM_CERT. You must use this version if + * multiple domains are to be hosted at the same IP address using + * TLS's Server Name Indication (SNI) extension. In this case, + * the callback is expected to select the correct certificate + * based on the SNI information provided. The callback is expected + * to access the SNI data using `gnutls_server_name_get()`. + * Using this option requires GnuTLS 3.0 or higher. + */ + MHD_OPTION_HTTPS_CERT_CALLBACK = 22, + + /** + * When using #MHD_USE_TCP_FASTOPEN, this option changes the default TCP + * fastopen queue length of 50. Note that having a larger queue size can + * cause resource exhaustion attack as the TCP stack has to now allocate + * resources for the SYN packet along with its DATA. This option should be + * followed by an `unsigned int` argument. + */ + MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE = 23, + + /** + * Memory pointer for the Diffie-Hellman parameters (dh.pem) to be used by the + * HTTPS daemon for key exchange. + * This option must be followed by a `const char *` argument. + */ + MHD_OPTION_HTTPS_MEM_DHPARAMS = 24, + + /** + * If present and set to true, allow reusing address:port socket + * (by using SO_REUSEPORT on most platform, or platform-specific ways). + * If present and set to false, disallow reusing address:port socket + * (does nothing on most plaform, but uses SO_EXCLUSIVEADDRUSE on Windows). + * This option must be followed by a `unsigned int` argument. + */ + MHD_OPTION_LISTENING_ADDRESS_REUSE = 25, + + /** + * Memory pointer for a password that decrypts the private key (key.pem) + * to be used by the HTTPS daemon. This option should be followed by a + * `const char *` argument. + * This should be used in conjunction with #MHD_OPTION_HTTPS_MEM_KEY. + * @sa ::MHD_FEATURE_HTTPS_KEY_PASSWORD + */ + MHD_OPTION_HTTPS_KEY_PASSWORD = 26, + + /** + * Register a function that should be called whenever a connection is + * started or closed. + * + * This option should be followed by TWO pointers. First a pointer + * to a function of type #MHD_NotifyConnectionCallback and second a + * pointer to a closure to pass to the request completed callback. + * The second pointer maybe NULL. + */ + MHD_OPTION_NOTIFY_CONNECTION = 27, + + /** + * Allow to change maximum length of the queue of pending connections on + * listen socket. If not present than default platform-specific SOMAXCONN + * value is used. This option should be followed by an `unsigned int` + * argument. + */ + MHD_OPTION_LISTEN_BACKLOG_SIZE = 28, + + /** + * If set to 1 - be strict about the protocol (as opposed to as + * tolerant as possible). Specifically, at the moment, this flag + * causes MHD to reject HTTP 1.1 connections without a "Host" header. + * This is required by the standard, but of course in violation of + * the "be as liberal as possible in what you accept" norm. It is + * recommended to set this to 1 if you are testing clients against + * MHD, and 0 in production. + * This option should be followed by an `int` argument. + */ + MHD_OPTION_STRICT_FOR_CLIENT = 29 +}; + + +/** + * Entry in an #MHD_OPTION_ARRAY. + */ +struct MHD_OptionItem +{ + /** + * Which option is being given. Use #MHD_OPTION_END + * to terminate the array. + */ + enum MHD_OPTION option; + + /** + * Option value (for integer arguments, and for options requiring + * two pointer arguments); should be 0 for options that take no + * arguments or only a single pointer argument. + */ + intptr_t value; + + /** + * Pointer option value (use NULL for options taking no arguments + * or only an integer option). + */ + void *ptr_value; + +}; + + +/** + * The `enum MHD_ValueKind` specifies the source of + * the key-value pairs in the HTTP protocol. + */ +enum MHD_ValueKind +{ + + /** + * Response header + * @deprecated + */ + MHD_RESPONSE_HEADER_KIND = 0, +#define MHD_RESPONSE_HEADER_KIND \ + _MHD_DEPR_IN_MACRO("Value MHD_RESPONSE_HEADER_KIND is deprecated and not used") \ + MHD_RESPONSE_HEADER_KIND + + /** + * HTTP header (request/response). + */ + MHD_HEADER_KIND = 1, + + /** + * Cookies. Note that the original HTTP header containing + * the cookie(s) will still be available and intact. + */ + MHD_COOKIE_KIND = 2, + + /** + * POST data. This is available only if a content encoding + * supported by MHD is used (currently only URL encoding), + * and only if the posted content fits within the available + * memory pool. Note that in that case, the upload data + * given to the #MHD_AccessHandlerCallback will be + * empty (since it has already been processed). + */ + MHD_POSTDATA_KIND = 4, + + /** + * GET (URI) arguments. + */ + MHD_GET_ARGUMENT_KIND = 8, + + /** + * HTTP footer (only for HTTP 1.1 chunked encodings). + */ + MHD_FOOTER_KIND = 16 +}; + + +/** + * The `enum MHD_RequestTerminationCode` specifies reasons + * why a request has been terminated (or completed). + * @ingroup request + */ +enum MHD_RequestTerminationCode +{ + + /** + * We finished sending the response. + * @ingroup request + */ + MHD_REQUEST_TERMINATED_COMPLETED_OK = 0, + + /** + * Error handling the connection (resources + * exhausted, other side closed connection, + * application error accepting request, etc.) + * @ingroup request + */ + MHD_REQUEST_TERMINATED_WITH_ERROR = 1, + + /** + * No activity on the connection for the number + * of seconds specified using + * #MHD_OPTION_CONNECTION_TIMEOUT. + * @ingroup request + */ + MHD_REQUEST_TERMINATED_TIMEOUT_REACHED = 2, + + /** + * We had to close the session since MHD was being + * shut down. + * @ingroup request + */ + MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN = 3, + + /** + * We tried to read additional data, but the other side closed the + * connection. This error is similar to + * #MHD_REQUEST_TERMINATED_WITH_ERROR, but specific to the case where + * the connection died because the other side did not send expected + * data. + * @ingroup request + */ + MHD_REQUEST_TERMINATED_READ_ERROR = 4, + + /** + * The client terminated the connection by closing the socket + * for writing (TCP half-closed); MHD aborted sending the + * response according to RFC 2616, section 8.1.4. + * @ingroup request + */ + MHD_REQUEST_TERMINATED_CLIENT_ABORT = 5 + +}; + + +/** + * The `enum MHD_ConnectionNotificationCode` specifies types + * of connection notifications. + * @ingroup request + */ +enum MHD_ConnectionNotificationCode +{ + + /** + * A new connection has been started. + * @ingroup request + */ + MHD_CONNECTION_NOTIFY_STARTED = 0, + + /** + * A connection is closed. + * @ingroup request + */ + MHD_CONNECTION_NOTIFY_CLOSED = 1 + +}; + + +/** + * Information about a connection. + */ +union MHD_ConnectionInfo +{ + + /** + * Cipher algorithm used, of type "enum gnutls_cipher_algorithm". + */ + int /* enum gnutls_cipher_algorithm */ cipher_algorithm; + + /** + * Protocol used, of type "enum gnutls_protocol". + */ + int /* enum gnutls_protocol */ protocol; + + /** + * The suspended status of a connection. + */ + int /* MHD_YES or MHD_NO */ suspended; + + /** + * Amount of second that connection could spend in idle state + * before automatically disconnected. + * Zero for no timeout (unlimited idle time). + */ + unsigned int connection_timeout; + + /** + * Connect socket + */ + MHD_socket connect_fd; + + /** + * Size of the client's HTTP header. + */ + size_t header_size; + + /** + * GNUtls session handle, of type "gnutls_session_t". + */ + void * /* gnutls_session_t */ tls_session; + + /** + * GNUtls client certificate handle, of type "gnutls_x509_crt_t". + */ + void * /* gnutls_x509_crt_t */ client_cert; + + /** + * Address information for the client. + */ + struct sockaddr *client_addr; + + /** + * Which daemon manages this connection (useful in case there are many + * daemons running). + */ + struct MHD_Daemon *daemon; + + /** + * Socket-specific client context. Points to the same address as + * the "socket_context" of the #MHD_NotifyConnectionCallback. + */ + void *socket_context; +}; + + +/** + * Values of this enum are used to specify what + * information about a connection is desired. + * @ingroup request + */ +enum MHD_ConnectionInfoType +{ + /** + * What cipher algorithm is being used. + * Takes no extra arguments. + * @ingroup request + */ + MHD_CONNECTION_INFO_CIPHER_ALGO, + + /** + * + * Takes no extra arguments. + * @ingroup request + */ + MHD_CONNECTION_INFO_PROTOCOL, + + /** + * Obtain IP address of the client. Takes no extra arguments. + * Returns essentially a `struct sockaddr **` (since the API returns + * a `union MHD_ConnectionInfo *` and that union contains a `struct + * sockaddr *`). + * @ingroup request + */ + MHD_CONNECTION_INFO_CLIENT_ADDRESS, + + /** + * Get the gnuTLS session handle. + * @ingroup request + */ + MHD_CONNECTION_INFO_GNUTLS_SESSION, + + /** + * Get the gnuTLS client certificate handle. Dysfunctional (never + * implemented, deprecated). Use #MHD_CONNECTION_INFO_GNUTLS_SESSION + * to get the `gnutls_session_t` and then call + * gnutls_certificate_get_peers(). + */ + MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT, + + /** + * Get the `struct MHD_Daemon *` responsible for managing this connection. + * @ingroup request + */ + MHD_CONNECTION_INFO_DAEMON, + + /** + * Request the file descriptor for the connection socket. + * No extra arguments should be passed. + * @ingroup request + */ + MHD_CONNECTION_INFO_CONNECTION_FD, + + /** + * Returns the client-specific pointer to a `void *` that was (possibly) + * set during a #MHD_NotifyConnectionCallback when the socket was + * first accepted. Note that this is NOT the same as the "con_cls" + * argument of the #MHD_AccessHandlerCallback. The "con_cls" is + * fresh for each HTTP request, while the "socket_context" is fresh + * for each socket. + */ + MHD_CONNECTION_INFO_SOCKET_CONTEXT, + + /** + * Check whether the connection is suspended. + * @ingroup request + */ + MHD_CONNECTION_INFO_CONNECTION_SUSPENDED, + + /** + * Get connection timeout + * @ingroup request + */ + MHD_CONNECTION_INFO_CONNECTION_TIMEOUT, + + /** + * Return length of the client's HTTP request header. + * @ingroup request + */ + MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE +}; + + +/** + * Values of this enum are used to specify what + * information about a deamon is desired. + */ +enum MHD_DaemonInfoType +{ + /** + * No longer supported (will return NULL). + */ + MHD_DAEMON_INFO_KEY_SIZE, + + /** + * No longer supported (will return NULL). + */ + MHD_DAEMON_INFO_MAC_KEY_SIZE, + + /** + * Request the file descriptor for the listening socket. + * No extra arguments should be passed. + */ + MHD_DAEMON_INFO_LISTEN_FD, + + /** + * Request the file descriptor for the external epoll. + * No extra arguments should be passed. + * Waiting on epoll FD must not block longer than value + * returned by #MHD_get_timeout(). + */ + MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY, + MHD_DAEMON_INFO_EPOLL_FD = MHD_DAEMON_INFO_EPOLL_FD_LINUX_ONLY, + + /** + * Request the number of current connections handled by the daemon. + * No extra arguments should be passed. + * Note: when using MHD in external polling mode, this type of request + * could be used only when #MHD_run()/#MHD_run_from_select is not + * working in other thread at the same time. + */ + MHD_DAEMON_INFO_CURRENT_CONNECTIONS, + + /** + * Request the daemon flags. + * No extra arguments should be passed. + * Note: flags may differ from original 'flags' specified for + * daemon, especially if #MHD_USE_AUTO was set. + */ + MHD_DAEMON_INFO_FLAGS, + + /** + * Request the port number of daemon's listen socket. + * No extra arguments should be passed. + * Note: if port '0' was specified for #MHD_start_daemon(), returned + * value will be real port number. + */ + MHD_DAEMON_INFO_BIND_PORT +}; + + +/** + * Callback for serious error condition. The default action is to print + * an error message and `abort()`. + * + * @param cls user specified value + * @param file where the error occured + * @param line where the error occured + * @param reason error detail, may be NULL + * @ingroup logging + */ +typedef void +(*MHD_PanicCallback) (void *cls, + const char *file, + unsigned int line, + const char *reason); + +/** + * Allow or deny a client to connect. + * + * @param cls closure + * @param addr address information from the client + * @param addrlen length of @a addr + * @return #MHD_YES if connection is allowed, #MHD_NO if not + */ +typedef int +(*MHD_AcceptPolicyCallback) (void *cls, + const struct sockaddr *addr, + socklen_t addrlen); + + +/** + * A client has requested the given url using the given method + * (#MHD_HTTP_METHOD_GET, #MHD_HTTP_METHOD_PUT, + * #MHD_HTTP_METHOD_DELETE, #MHD_HTTP_METHOD_POST, etc). The callback + * must call MHD callbacks to provide content to give back to the + * client and return an HTTP status code (i.e. #MHD_HTTP_OK, + * #MHD_HTTP_NOT_FOUND, etc.). + * + * @param cls argument given together with the function + * pointer when the handler was registered with MHD + * @param url the requested url + * @param method the HTTP method used (#MHD_HTTP_METHOD_GET, + * #MHD_HTTP_METHOD_PUT, etc.) + * @param version the HTTP version string (i.e. + * #MHD_HTTP_VERSION_1_1) + * @param upload_data the data being uploaded (excluding HEADERS, + * for a POST that fits into memory and that is encoded + * with a supported encoding, the POST data will NOT be + * given in upload_data and is instead available as + * part of #MHD_get_connection_values; very large POST + * data *will* be made available incrementally in + * @a upload_data) + * @param[in,out] upload_data_size set initially to the size of the + * @a upload_data provided; the method must update this + * value to the number of bytes NOT processed; + * @param[in,out] con_cls pointer that the callback can set to some + * address and that will be preserved by MHD for future + * calls for this request; since the access handler may + * be called many times (i.e., for a PUT/POST operation + * with plenty of upload data) this allows the application + * to easily associate some request-specific state. + * If necessary, this state can be cleaned up in the + * global #MHD_RequestCompletedCallback (which + * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). + * Initially, `*con_cls` will be NULL. + * @return #MHD_YES if the connection was handled successfully, + * #MHD_NO if the socket must be closed due to a serios + * error while handling the request + */ +typedef int +(*MHD_AccessHandlerCallback) (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls); + + +/** + * Signature of the callback used by MHD to notify the + * application about completed requests. + * + * @param cls client-defined closure + * @param connection connection handle + * @param con_cls value as set by the last call to + * the #MHD_AccessHandlerCallback + * @param toe reason for request termination + * @see #MHD_OPTION_NOTIFY_COMPLETED + * @ingroup request + */ +typedef void +(*MHD_RequestCompletedCallback) (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe); + + +/** + * Signature of the callback used by MHD to notify the + * application about started/stopped connections + * + * @param cls client-defined closure + * @param connection connection handle + * @param socket_context socket-specific pointer where the + * client can associate some state specific + * to the TCP connection; note that this is + * different from the "con_cls" which is per + * HTTP request. The client can initialize + * during #MHD_CONNECTION_NOTIFY_STARTED and + * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED + * and access in the meantime using + * #MHD_CONNECTION_INFO_SOCKET_CONTEXT. + * @param toe reason for connection notification + * @see #MHD_OPTION_NOTIFY_CONNECTION + * @ingroup request + */ +typedef void +(*MHD_NotifyConnectionCallback) (void *cls, + struct MHD_Connection *connection, + void **socket_context, + enum MHD_ConnectionNotificationCode toe); + + +/** + * Iterator over key-value pairs. This iterator + * can be used to iterate over all of the cookies, + * headers, or POST-data fields of a request, and + * also to iterate over the headers that have been + * added to a response. + * + * @param cls closure + * @param kind kind of the header we are looking at + * @param key key for the value, can be an empty string + * @param value corresponding value, can be NULL + * @return #MHD_YES to continue iterating, + * #MHD_NO to abort the iteration + * @ingroup request + */ +typedef int +(*MHD_KeyValueIterator) (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *value); + + +/** + * Callback used by libmicrohttpd in order to obtain content. The + * callback is to copy at most @a max bytes of content into @a buf. The + * total number of bytes that has been placed into @a buf should be + * returned. + * + * Note that returning zero will cause libmicrohttpd to try again. + * Thus, returning zero should only be used in conjunction + * with MHD_suspend_connection() to avoid busy waiting. + * + * @param cls extra argument to the callback + * @param pos position in the datastream to access; + * note that if a `struct MHD_Response` object is re-used, + * it is possible for the same content reader to + * be queried multiple times for the same data; + * however, if a `struct MHD_Response` is not re-used, + * libmicrohttpd guarantees that "pos" will be + * the sum of all non-negative return values + * obtained from the content reader so far. + * @param buf where to copy the data + * @param max maximum number of bytes to copy to @a buf (size of @a buf) + * @return number of bytes written to @a buf; + * 0 is legal unless we are running in internal select mode (since + * this would cause busy-waiting); 0 in external select mode + * will cause this function to be called again once the external + * select calls MHD again; + * #MHD_CONTENT_READER_END_OF_STREAM (-1) for the regular + * end of transmission (with chunked encoding, MHD will then + * terminate the chunk and send any HTTP footers that might be + * present; without chunked encoding and given an unknown + * response size, MHD will simply close the connection; note + * that while returning #MHD_CONTENT_READER_END_OF_STREAM is not technically + * legal if a response size was specified, MHD accepts this + * and treats it just as #MHD_CONTENT_READER_END_WITH_ERROR; + * #MHD_CONTENT_READER_END_WITH_ERROR (-2) to indicate a server + * error generating the response; this will cause MHD to simply + * close the connection immediately. If a response size was + * given or if chunked encoding is in use, this will indicate + * an error to the client. Note, however, that if the client + * does not know a response size and chunked encoding is not in + * use, then clients will not be able to tell the difference between + * #MHD_CONTENT_READER_END_WITH_ERROR and #MHD_CONTENT_READER_END_OF_STREAM. + * This is not a limitation of MHD but rather of the HTTP protocol. + */ +typedef ssize_t +(*MHD_ContentReaderCallback) (void *cls, + uint64_t pos, + char *buf, + size_t max); + + +/** + * This method is called by libmicrohttpd if we + * are done with a content reader. It should + * be used to free resources associated with the + * content reader. + * + * @param cls closure + * @ingroup response + */ +typedef void +(*MHD_ContentReaderFreeCallback) (void *cls); + + +/** + * Iterator over key-value pairs where the value + * maybe made available in increments and/or may + * not be zero-terminated. Used for processing + * POST data. + * + * @param cls user-specified closure + * @param kind type of the value, always #MHD_POSTDATA_KIND when called from MHD + * @param key 0-terminated key for the value + * @param filename name of the uploaded file, NULL if not known + * @param content_type mime-type of the data, NULL if not known + * @param transfer_encoding encoding of the data, NULL if not known + * @param data pointer to @a size bytes of data at the + * specified offset + * @param off offset of data in the overall value + * @param size number of bytes in @a data available + * @return #MHD_YES to continue iterating, + * #MHD_NO to abort the iteration + */ +typedef int +(*MHD_PostDataIterator) (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, + uint64_t off, + size_t size); + +/* **************** Daemon handling functions ***************** */ + +/** + * Start a webserver on the given port. + * + * @param flags combination of `enum MHD_FLAG` values + * @param port port to bind to (in host byte order), + * use '0' to bind to random free port, + * ignored if MHD_OPTION_SOCK_ADDR or + * MHD_OPTION_LISTEN_SOCKET is provided + * or MHD_USE_NO_LISTEN_SOCKET is specified + * @param apc callback to call to check which clients + * will be allowed to connect; you can pass NULL + * in which case connections from any IP will be + * accepted + * @param apc_cls extra argument to apc + * @param dh handler called for all requests (repeatedly) + * @param dh_cls extra argument to @a dh + * @param ap list of options (type-value pairs, + * terminated with #MHD_OPTION_END). + * @return NULL on error, handle to daemon on success + * @ingroup event + */ +_MHD_EXTERN struct MHD_Daemon * +MHD_start_daemon_va (unsigned int flags, + uint16_t port, + MHD_AcceptPolicyCallback apc, void *apc_cls, + MHD_AccessHandlerCallback dh, void *dh_cls, + va_list ap); + + +/** + * Start a webserver on the given port. Variadic version of + * #MHD_start_daemon_va. + * + * @param flags combination of `enum MHD_FLAG` values + * @param port port to bind to (in host byte order), + * use '0' to bind to random free port, + * ignored if MHD_OPTION_SOCK_ADDR or + * MHD_OPTION_LISTEN_SOCKET is provided + * or MHD_USE_NO_LISTEN_SOCKET is specified + * @param apc callback to call to check which clients + * will be allowed to connect; you can pass NULL + * in which case connections from any IP will be + * accepted + * @param apc_cls extra argument to apc + * @param dh handler called for all requests (repeatedly) + * @param dh_cls extra argument to @a dh + * @return NULL on error, handle to daemon on success + * @ingroup event + */ +_MHD_EXTERN struct MHD_Daemon * +MHD_start_daemon (unsigned int flags, + uint16_t port, + MHD_AcceptPolicyCallback apc, void *apc_cls, + MHD_AccessHandlerCallback dh, void *dh_cls, + ...); + + +/** + * Stop accepting connections from the listening socket. Allows + * clients to continue processing, but stops accepting new + * connections. Note that the caller is responsible for closing the + * returned socket; however, if MHD is run using threads (anything but + * external select mode), it must not be closed until AFTER + * #MHD_stop_daemon has been called (as it is theoretically possible + * that an existing thread is still using it). + * + * Note that some thread modes require the caller to have passed + * #MHD_USE_ITC when using this API. If this daemon is + * in one of those modes and this option was not given to + * #MHD_start_daemon, this function will return #MHD_INVALID_SOCKET. + * + * @param daemon daemon to stop accepting new connections for + * @return old listen socket on success, #MHD_INVALID_SOCKET if + * the daemon was already not listening anymore + * @ingroup specialized + */ +_MHD_EXTERN MHD_socket +MHD_quiesce_daemon (struct MHD_Daemon *daemon); + + +/** + * Shutdown an HTTP daemon. + * + * @param daemon daemon to stop + * @ingroup event + */ +_MHD_EXTERN void +MHD_stop_daemon (struct MHD_Daemon *daemon); + + +/** + * Add another client connection to the set of connections managed by + * MHD. This API is usually not needed (since MHD will accept inbound + * connections on the server socket). Use this API in special cases, + * for example if your HTTP server is behind NAT and needs to connect + * out to the HTTP client, or if you are building a proxy. + * + * If you use this API in conjunction with a internal select or a + * thread pool, you must set the option + * #MHD_USE_ITC to ensure that the freshly added + * connection is immediately processed by MHD. + * + * The given client socket will be managed (and closed!) by MHD after + * this call and must no longer be used directly by the application + * afterwards. + * + * @param daemon daemon that manages the connection + * @param client_socket socket to manage (MHD will expect + * to receive an HTTP request from this socket next). + * @param addr IP address of the client + * @param addrlen number of bytes in @a addr + * @return #MHD_YES on success, #MHD_NO if this daemon could + * not handle the connection (i.e. `malloc()` failed, etc). + * The socket will be closed in any case; `errno` is + * set to indicate further details about the error. + * @ingroup specialized + */ +_MHD_EXTERN int +MHD_add_connection (struct MHD_Daemon *daemon, + MHD_socket client_socket, + const struct sockaddr *addr, + socklen_t addrlen); + + +/** + * Obtain the `select()` sets for this daemon. + * Daemon's FDs will be added to fd_sets. To get only + * daemon FDs in fd_sets, call FD_ZERO for each fd_set + * before calling this function. FD_SETSIZE is assumed + * to be platform's default. + * + * This function should only be called in when MHD is configured to + * use external select with 'select()' or with 'epoll'. + * In the latter case, it will only add the single 'epoll()' file + * descriptor used by MHD to the sets. + * It's necessary to use #MHD_get_timeout() in combination with + * this function. + * + * This function must be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. + * + * @param daemon daemon to get sets from + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @param max_fd increased to largest FD added (if larger + * than existing value); can be NULL + * @return #MHD_YES on success, #MHD_NO if this + * daemon was not started with the right + * options for this call or any FD didn't + * fit fd_set. + * @ingroup event + */ +_MHD_EXTERN int +MHD_get_fdset (struct MHD_Daemon *daemon, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *except_fd_set, + MHD_socket *max_fd); + + +/** + * Obtain the `select()` sets for this daemon. + * Daemon's FDs will be added to fd_sets. To get only + * daemon FDs in fd_sets, call FD_ZERO for each fd_set + * before calling this function. + * + * Passing custom FD_SETSIZE as @a fd_setsize allow usage of + * larger/smaller than platform's default fd_sets. + * + * This function should only be called in when MHD is configured to + * use external select with 'select()' or with 'epoll'. + * In the latter case, it will only add the single 'epoll' file + * descriptor used by MHD to the sets. + * It's necessary to use #MHD_get_timeout() in combination with + * this function. + * + * This function must be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. + * + * @param daemon daemon to get sets from + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @param max_fd increased to largest FD added (if larger + * than existing value); can be NULL + * @param fd_setsize value of FD_SETSIZE + * @return #MHD_YES on success, #MHD_NO if this + * daemon was not started with the right + * options for this call or any FD didn't + * fit fd_set. + * @ingroup event + */ +_MHD_EXTERN int +MHD_get_fdset2 (struct MHD_Daemon *daemon, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *except_fd_set, + MHD_socket *max_fd, + unsigned int fd_setsize); + + +/** + * Obtain the `select()` sets for this daemon. + * Daemon's FDs will be added to fd_sets. To get only + * daemon FDs in fd_sets, call FD_ZERO for each fd_set + * before calling this function. Size of fd_set is + * determined by current value of FD_SETSIZE. + * It's necessary to use #MHD_get_timeout() in combination with + * this function. + * + * This function could be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. + * + * @param daemon daemon to get sets from + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @param max_fd increased to largest FD added (if larger + * than existing value); can be NULL + * @return #MHD_YES on success, #MHD_NO if this + * daemon was not started with the right + * options for this call or any FD didn't + * fit fd_set. + * @ingroup event + */ +#define MHD_get_fdset(daemon,read_fd_set,write_fd_set,except_fd_set,max_fd) \ + MHD_get_fdset2((daemon),(read_fd_set),(write_fd_set),(except_fd_set),(max_fd),FD_SETSIZE) + + +/** + * Obtain timeout value for polling function for this daemon. + * This function set value to amount of milliseconds for which polling + * function (`select()` or `poll()`) should at most block, not the + * timeout value set for connections. + * It is important to always use this function, even if connection + * timeout is not set, as in some cases MHD may already have more + * data to process on next turn (data pending in TLS buffers, + * connections are already ready with epoll etc.) and returned timeout + * will be zero. + * + * @param daemon daemon to query for timeout + * @param timeout set to the timeout (in milliseconds) + * @return #MHD_YES on success, #MHD_NO if timeouts are + * not used (or no connections exist that would + * necessitate the use of a timeout right now). + * @ingroup event + */ +_MHD_EXTERN int +MHD_get_timeout (struct MHD_Daemon *daemon, + MHD_UNSIGNED_LONG_LONG *timeout); + + +/** + * Run webserver operations (without blocking unless in client + * callbacks). This method should be called by clients in combination + * with #MHD_get_fdset if the client-controlled select method is used and + * #MHD_get_timeout(). + * + * This function is a convenience method, which is useful if the + * fd_sets from #MHD_get_fdset were not directly passed to `select()`; + * with this function, MHD will internally do the appropriate `select()` + * call itself again. While it is always safe to call #MHD_run (if + * #MHD_USE_INTERNAL_POLLING_THREAD is not set), you should call + * #MHD_run_from_select if performance is important (as it saves an + * expensive call to `select()`). + * + * @param daemon daemon to run + * @return #MHD_YES on success, #MHD_NO if this + * daemon was not started with the right + * options for this call. + * @ingroup event + */ +_MHD_EXTERN int +MHD_run (struct MHD_Daemon *daemon); + + +/** + * Run webserver operations. This method should be called by clients + * in combination with #MHD_get_fdset and #MHD_get_timeout() if the + * client-controlled select method is used. + * + * You can use this function instead of #MHD_run if you called + * `select()` on the result from #MHD_get_fdset. File descriptors in + * the sets that are not controlled by MHD will be ignored. Calling + * this function instead of #MHD_run is more efficient as MHD will + * not have to call `select()` again to determine which operations are + * ready. + * + * This function cannot be used with daemon started with + * #MHD_USE_INTERNAL_POLLING_THREAD flag. + * + * @param daemon daemon to run select loop for + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @return #MHD_NO on serious errors, #MHD_YES on success + * @ingroup event + */ +_MHD_EXTERN int +MHD_run_from_select (struct MHD_Daemon *daemon, + const fd_set *read_fd_set, + const fd_set *write_fd_set, + const fd_set *except_fd_set); + + + + +/* **************** Connection handling functions ***************** */ + +/** + * Get all of the headers from the request. + * + * @param connection connection to get values from + * @param kind types of values to iterate over, can be a bitmask + * @param iterator callback to call on each header; + * maybe NULL (then just count headers) + * @param iterator_cls extra argument to @a iterator + * @return number of entries iterated over + * @ingroup request + */ +_MHD_EXTERN int +MHD_get_connection_values (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + MHD_KeyValueIterator iterator, + void *iterator_cls); + + +/** + * This function can be used to add an entry to the HTTP headers of a + * connection (so that the #MHD_get_connection_values function will + * return them -- and the `struct MHD_PostProcessor` will also see + * them). This maybe required in certain situations (see Mantis + * #1399) where (broken) HTTP implementations fail to supply values + + * needed by the post processor (or other parts of the application). + * + * This function MUST only be called from within the + * #MHD_AccessHandlerCallback (otherwise, access maybe improperly + * synchronized). Furthermore, the client must guarantee that the key + * and value arguments are 0-terminated strings that are NOT freed + * until the connection is closed. (The easiest way to do this is by + * passing only arguments to permanently allocated strings.). + * + * @param connection the connection for which a + * value should be set + * @param kind kind of the value + * @param key key for the value + * @param value the value itself + * @return #MHD_NO if the operation could not be + * performed due to insufficient memory; + * #MHD_YES on success + * @ingroup request + */ +_MHD_EXTERN int +MHD_set_connection_value (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + const char *key, + const char *value); + + +/** + * Sets the global error handler to a different implementation. @a cb + * will only be called in the case of typically fatal, serious + * internal consistency issues. These issues should only arise in the + * case of serious memory corruption or similar problems with the + * architecture. While @a cb is allowed to return and MHD will then + * try to continue, this is never safe. + * + * The default implementation that is used if no panic function is set + * simply prints an error message and calls `abort()`. Alternative + * implementations might call `exit()` or other similar functions. + * + * @param cb new error handler + * @param cls passed to @a cb + * @ingroup logging + */ +_MHD_EXTERN void +MHD_set_panic_func (MHD_PanicCallback cb, void *cls); + + +/** + * Process escape sequences ('%HH') Updates val in place; the + * result should be UTF-8 encoded and cannot be larger than the input. + * The result must also still be 0-terminated. + * + * @param val value to unescape (modified in the process) + * @return length of the resulting val (`strlen(val)` may be + * shorter afterwards due to elimination of escape sequences) + */ +_MHD_EXTERN size_t +MHD_http_unescape (char *val); + + +/** + * Get a particular header value. If multiple + * values match the kind, return any one of them. + * + * @param connection connection to get values from + * @param kind what kind of value are we looking for + * @param key the header to look for, NULL to lookup 'trailing' value without a key + * @return NULL if no such item was found + * @ingroup request + */ +_MHD_EXTERN const char * +MHD_lookup_connection_value (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + const char *key); + + +/** + * Queue a response to be transmitted to the client (as soon as + * possible but after #MHD_AccessHandlerCallback returns). + * + * @param connection the connection identifying the client + * @param status_code HTTP status code (i.e. #MHD_HTTP_OK) + * @param response response to transmit + * @return #MHD_NO on error (i.e. reply already sent), + * #MHD_YES on success or if message has been queued + * @ingroup response + */ +_MHD_EXTERN int +MHD_queue_response (struct MHD_Connection *connection, + unsigned int status_code, + struct MHD_Response *response); + + +/** + * Suspend handling of network data for a given connection. This can + * be used to dequeue a connection from MHD's event loop for a while. + * + * If you use this API in conjunction with a internal select or a + * thread pool, you must set the option #MHD_USE_ITC to + * ensure that a resumed connection is immediately processed by MHD. + * + * Suspended connections continue to count against the total number of + * connections allowed (per daemon, as well as per IP, if such limits + * are set). Suspended connections will NOT time out; timeouts will + * restart when the connection handling is resumed. While a + * connection is suspended, MHD will not detect disconnects by the + * client. + * + * The only safe time to suspend a connection is from the + * #MHD_AccessHandlerCallback. + * + * Finally, it is an API violation to call #MHD_stop_daemon while + * having suspended connections (this will at least create memory and + * socket leaks or lead to undefined behavior). You must explicitly + * resume all connections before stopping the daemon. + * + * @param connection the connection to suspend + */ +_MHD_EXTERN void +MHD_suspend_connection (struct MHD_Connection *connection); + + +/** + * Resume handling of network data for suspended connection. It is + * safe to resume a suspended connection at any time. Calling this + * function on a connection that was not previously suspended will + * result in undefined behavior. + * + * If you are using this function in ``external'' select mode, you must + * make sure to run #MHD_run() afterwards (before again calling + * #MHD_get_fdset(), as otherwise the change may not be reflected in + * the set returned by #MHD_get_fdset() and you may end up with a + * connection that is stuck until the next network activity. + * + * @param connection the connection to resume + */ +_MHD_EXTERN void +MHD_resume_connection (struct MHD_Connection *connection); + + +/* **************** Response manipulation functions ***************** */ + + +/** + * Flags for special handling of responses. + */ +enum MHD_ResponseFlags +{ + /** + * Default: no special flags. + */ + MHD_RF_NONE = 0, + + /** + * Only respond in conservative HTTP 1.0-mode. In particular, + * do not (automatically) sent "Connection" headers and always + * close the connection after generating the response. + */ + MHD_RF_HTTP_VERSION_1_0_ONLY = 1 + +}; + + +/** + * MHD options (for future extensions). + */ +enum MHD_ResponseOptions +{ + /** + * End of the list of options. + */ + MHD_RO_END = 0 +}; + + +/** + * Set special flags and options for a response. + * + * @param response the response to modify + * @param flags to set for the response + * @param ... #MHD_RO_END terminated list of options + * @return #MHD_YES on success, #MHD_NO on error + */ +_MHD_EXTERN int +MHD_set_response_options (struct MHD_Response *response, + enum MHD_ResponseFlags flags, + ...); + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response, #MHD_SIZE_UNKNOWN for unknown + * @param block_size preferred block size for querying crc (advisory only, + * MHD may still call @a crc using smaller chunks); this + * is essentially the buffer size used for IO, clients + * should pick a value that is appropriate for IO and + * memory performance requirements + * @param crc callback to use to obtain response data + * @param crc_cls extra argument to @a crc + * @param crfc callback to call to free @a crc_cls resources + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_callback (uint64_t size, + size_t block_size, + MHD_ContentReaderCallback crc, void *crc_cls, + MHD_ContentReaderFreeCallback crfc); + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the @a data portion of the response + * @param data the data itself + * @param must_free libmicrohttpd should free data when done + * @param must_copy libmicrohttpd must make a copy of @a data + * right away, the data maybe released anytime after + * this call returns + * @return NULL on error (i.e. invalid arguments, out of memory) + * @deprecated use #MHD_create_response_from_buffer instead + * @ingroup response + */ +_MHD_DEPR_FUNC("MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer()") \ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_data (size_t size, + void *data, + int must_free, + int must_copy); + + +/** + * Specification for how MHD should treat the memory buffer + * given for the response. + * @ingroup response + */ +enum MHD_ResponseMemoryMode +{ + + /** + * Buffer is a persistent (static/global) buffer that won't change + * for at least the lifetime of the response, MHD should just use + * it, not free it, not copy it, just keep an alias to it. + * @ingroup response + */ + MHD_RESPMEM_PERSISTENT, + + /** + * Buffer is heap-allocated with `malloc()` (or equivalent) and + * should be freed by MHD after processing the response has + * concluded (response reference counter reaches zero). + * @ingroup response + */ + MHD_RESPMEM_MUST_FREE, + + /** + * Buffer is in transient memory, but not on the heap (for example, + * on the stack or non-`malloc()` allocated) and only valid during the + * call to #MHD_create_response_from_buffer. MHD must make its + * own private copy of the data for processing. + * @ingroup response + */ + MHD_RESPMEM_MUST_COPY + +}; + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response + * @param buffer size bytes containing the response's data portion + * @param mode flags for buffer management + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_buffer (size_t size, + void *buffer, + enum MHD_ResponseMemoryMode mode); + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_fd (size_t size, + int fd); + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response; + * sizes larger than 2 GiB may be not supported by OS or + * MHD build; see ::MHD_FEATURE_LARGE_FILE + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_fd64 (uint64_t size, + int fd); + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode + * @param offset offset to start reading from in the file; + * Be careful! `off_t` may have been compiled to be a + * 64-bit variable for MHD, in which case your application + * also has to be compiled using the same options! Read + * the MHD manual for more details. + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +_MHD_DEPR_FUNC("Function MHD_create_response_from_fd_at_offset() is deprecated, use MHD_create_response_from_fd_at_offset64()") \ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_fd_at_offset (size_t size, + int fd, + off_t offset); + +#if !defined(_MHD_NO_DEPR_IN_MACRO) || defined(_MHD_NO_DEPR_FUNC) +/* Substitute MHD_create_response_from_fd_at_offset64() instead of MHD_create_response_from_fd_at_offset() + to minimize potential problems with different off_t sizes */ +#define MHD_create_response_from_fd_at_offset(size,fd,offset) \ + _MHD_DEPR_IN_MACRO("Usage of MHD_create_response_from_fd_at_offset() is deprecated, use MHD_create_response_from_fd_at_offset64()") \ + MHD_create_response_from_fd_at_offset64((size),(fd),(offset)) +#endif /* !_MHD_NO_DEPR_IN_MACRO || _MHD_NO_DEPR_FUNC */ + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response; + * sizes larger than 2 GiB may be not supported by OS or + * MHD build; see ::MHD_FEATURE_LARGE_FILE + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode + * @param offset offset to start reading from in the file; + * reading file beyond 2 GiB may be not supported by OS or + * MHD build; see ::MHD_FEATURE_LARGE_FILE + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_fd_at_offset64 (uint64_t size, + int fd, + uint64_t offset); + + +/** + * Enumeration for actions MHD should perform on the underlying socket + * of the upgrade. This API is not finalized, and in particular + * the final set of actions is yet to be decided. This is just an + * idea for what we might want. + */ +enum MHD_UpgradeAction +{ + + /** + * Close the socket, the application is done with it. + * + * Takes no extra arguments. + */ + MHD_UPGRADE_ACTION_CLOSE = 0 + +}; + + +/** + * Handle given to the application to manage special + * actions relating to MHD responses that "upgrade" + * the HTTP protocol (i.e. to WebSockets). + */ +struct MHD_UpgradeResponseHandle; + + +/** + * This connection-specific callback is provided by MHD to + * applications (unusual) during the #MHD_UpgradeHandler. + * It allows applications to perform 'special' actions on + * the underlying socket from the upgrade. + * + * @param urh the handle identifying the connection to perform + * the upgrade @a action on. + * @param action which action should be performed + * @param ... arguments to the action (depends on the action) + * @return #MHD_NO on error, #MHD_YES on success + */ +_MHD_EXTERN int +MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, + enum MHD_UpgradeAction action, + ...); + + +/** + * Function called after a protocol "upgrade" response was sent + * successfully and the socket should now be controlled by some + * protocol other than HTTP. + * + * Any data already received on the socket will be made available in + * @e extra_in. This can happen if the application sent extra data + * before MHD send the upgrade response. The application should + * treat data from @a extra_in as if it had read it from the socket. + * + * Note that the application must not close() @a sock directly, + * but instead use #MHD_upgrade_action() for special operations + * on @a sock. + * + * Data forwarding to "upgraded" @a sock will be started as soon + * as this function return. + * + * Except when in 'thread-per-connection' mode, implementations + * of this function should never block (as it will still be called + * from within the main event loop). + * + * @param cls closure, whatever was given to #MHD_create_response_for_upgrade(). + * @param connection original HTTP connection handle, + * giving the function a last chance + * to inspect the original HTTP request + * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param extra_in if we happened to have read bytes after the + * HTTP header already (because the client sent + * more than the HTTP header of the request before + * we sent the upgrade response), + * these are the extra bytes already read from @a sock + * by MHD. The application should treat these as if + * it had read them from @a sock. + * @param extra_in_size number of bytes in @a extra_in + * @param sock socket to use for bi-directional communication + * with the client. For HTTPS, this may not be a socket + * that is directly connected to the client and thus certain + * operations (TCP-specific setsockopt(), getsockopt(), etc.) + * may not work as expected (as the socket could be from a + * socketpair() or a TCP-loopback). The application is expected + * to perform read()/recv() and write()/send() calls on the socket. + * The application may also call shutdown(), but must not call + * close() directly. + * @param urh argument for #MHD_upgrade_action()s on this @a connection. + * Applications must eventually use this callback to (indirectly) + * perform the close() action on the @a sock. + */ +typedef void +(*MHD_UpgradeHandler)(void *cls, + struct MHD_Connection *connection, + void *con_cls, + const char *extra_in, + size_t extra_in_size, + MHD_socket sock, + struct MHD_UpgradeResponseHandle *urh); + + +/** + * Create a response object that can be used for 101 UPGRADE + * responses, for example to implement WebSockets. After sending the + * response, control over the data stream is given to the callback (which + * can then, for example, start some bi-directional communication). + * If the response is queued for multiple connections, the callback + * will be called for each connection. The callback + * will ONLY be called after the response header was successfully passed + * to the OS; if there are communication errors before, the usual MHD + * connection error handling code will be performed. + * + * Setting the correct HTTP code (i.e. MHD_HTTP_SWITCHING_PROTOCOLS) + * and setting correct HTTP headers for the upgrade must be done + * manually (this way, it is possible to implement most existing + * WebSocket versions using this API; in fact, this API might be useful + * for any protocol switch, not just WebSockets). Note that + * draft-ietf-hybi-thewebsocketprotocol-00 cannot be implemented this + * way as the header "HTTP/1.1 101 WebSocket Protocol Handshake" + * cannot be generated; instead, MHD will always produce "HTTP/1.1 101 + * Switching Protocols" (if the response code 101 is used). + * + * As usual, the response object can be extended with header + * information and then be used any number of times (as long as the + * header information is not connection-specific). + * + * @param upgrade_handler function to call with the "upgraded" socket + * @param upgrade_handler_cls closure for @a upgrade_handler + * @return NULL on error (i.e. invalid arguments, out of memory) + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, + void *upgrade_handler_cls); + + +/** + * Destroy a response object and associated resources. Note that + * libmicrohttpd may keep some of the resources around if the response + * is still in the queue for some clients, so the memory may not + * necessarily be freed immediatley. + * + * @param response response to destroy + * @ingroup response + */ +_MHD_EXTERN void +MHD_destroy_response (struct MHD_Response *response); + + +/** + * Add a header line to the response. + * + * @param response response to add a header to + * @param header the header to add + * @param content value to add + * @return #MHD_NO on error (i.e. invalid header or content format), + * or out of memory + * @ingroup response + */ +_MHD_EXTERN int +MHD_add_response_header (struct MHD_Response *response, + const char *header, + const char *content); + + +/** + * Add a footer line to the response. + * + * @param response response to remove a header from + * @param footer the footer to delete + * @param content value to delete + * @return #MHD_NO on error (i.e. invalid footer or content format). + * @ingroup response + */ +_MHD_EXTERN int +MHD_add_response_footer (struct MHD_Response *response, + const char *footer, + const char *content); + + +/** + * Delete a header (or footer) line from the response. + * + * @param response response to remove a header from + * @param header the header to delete + * @param content value to delete + * @return #MHD_NO on error (no such header known) + * @ingroup response + */ +_MHD_EXTERN int +MHD_del_response_header (struct MHD_Response *response, + const char *header, + const char *content); + + +/** + * Get all of the headers (and footers) added to a response. + * + * @param response response to query + * @param iterator callback to call on each header; + * maybe NULL (then just count headers) + * @param iterator_cls extra argument to @a iterator + * @return number of entries iterated over + * @ingroup response + */ +_MHD_EXTERN int +MHD_get_response_headers (struct MHD_Response *response, + MHD_KeyValueIterator iterator, void *iterator_cls); + + +/** + * Get a particular header (or footer) from the response. + * + * @param response response to query + * @param key which header to get + * @return NULL if header does not exist + * @ingroup response + */ +_MHD_EXTERN const char * +MHD_get_response_header (struct MHD_Response *response, + const char *key); + + +/* ********************** PostProcessor functions ********************** */ + +/** + * Create a `struct MHD_PostProcessor`. + * + * A `struct MHD_PostProcessor` can be used to (incrementally) parse + * the data portion of a POST request. Note that some buggy browsers + * fail to set the encoding type. If you want to support those, you + * may have to call #MHD_set_connection_value with the proper encoding + * type before creating a post processor (if no supported encoding + * type is set, this function will fail). + * + * @param connection the connection on which the POST is + * happening (used to determine the POST format) + * @param buffer_size maximum number of bytes to use for + * internal buffering (used only for the parsing, + * specifically the parsing of the keys). A + * tiny value (256-1024) should be sufficient. + * Do NOT use a value smaller than 256. For good + * performance, use 32 or 64k (i.e. 65536). + * @param iter iterator to be called with the parsed data, + * Must NOT be NULL. + * @param iter_cls first argument to @a iter + * @return NULL on error (out of memory, unsupported encoding), + * otherwise a PP handle + * @ingroup request + */ +_MHD_EXTERN struct MHD_PostProcessor * +MHD_create_post_processor (struct MHD_Connection *connection, + size_t buffer_size, + MHD_PostDataIterator iter, void *iter_cls); + + +/** + * Parse and process POST data. Call this function when POST data is + * available (usually during an #MHD_AccessHandlerCallback) with the + * "upload_data" and "upload_data_size". Whenever possible, this will + * then cause calls to the #MHD_PostDataIterator. + * + * @param pp the post processor + * @param post_data @a post_data_len bytes of POST data + * @param post_data_len length of @a post_data + * @return #MHD_YES on success, #MHD_NO on error + * (out-of-memory, iterator aborted, parse error) + * @ingroup request + */ +_MHD_EXTERN int +MHD_post_process (struct MHD_PostProcessor *pp, + const char *post_data, size_t post_data_len); + + +/** + * Release PostProcessor resources. + * + * @param pp the PostProcessor to destroy + * @return #MHD_YES if processing completed nicely, + * #MHD_NO if there were spurious characters / formatting + * problems; it is common to ignore the return + * value of this function + * @ingroup request + */ +_MHD_EXTERN int +MHD_destroy_post_processor (struct MHD_PostProcessor *pp); + + +/* ********************* Digest Authentication functions *************** */ + + +/** + * Constant to indicate that the nonce of the provided + * authentication code was wrong. + * @ingroup authentication + */ +#define MHD_INVALID_NONCE -1 + + +/** + * Get the username from the authorization header sent by the client + * + * @param connection The MHD connection structure + * @return NULL if no username could be found, a pointer + * to the username if found, free using #MHD_free(). + * @ingroup authentication + */ +_MHD_EXTERN char * +MHD_digest_auth_get_username (struct MHD_Connection *connection); + + +/** + * Free the memory given by @a ptr. Calls "free(ptr)". This function + * should be used to free the username returned by + * #MHD_digest_auth_get_username(). + * @note Since v0.9.56 + * + * @param ptr pointer to free. + */ +_MHD_EXTERN void +MHD_free (void *ptr); + + +/** + * Authenticates the authorization header sent by the client + * + * @param connection The MHD connection structure + * @param realm The realm presented to the client + * @param username The username needs to be authenticated + * @param password The password used in the authentication + * @param nonce_timeout The amount of time for a nonce to be + * invalid in seconds + * @return #MHD_YES if authenticated, #MHD_NO if not, + * #MHD_INVALID_NONCE if nonce is invalid + * @ingroup authentication + */ +_MHD_EXTERN int +MHD_digest_auth_check (struct MHD_Connection *connection, + const char *realm, + const char *username, + const char *password, + unsigned int nonce_timeout); + + +/** + * Queues a response to request authentication from the client + * + * @param connection The MHD connection structure + * @param realm The realm presented to the client + * @param opaque string to user for opaque value + * @param response reply to send; should contain the "access denied" + * body; note that this function will set the "WWW Authenticate" + * header and that the caller should not do this + * @param signal_stale #MHD_YES if the nonce is invalid to add + * 'stale=true' to the authentication header + * @return #MHD_YES on success, #MHD_NO otherwise + * @ingroup authentication + */ +_MHD_EXTERN int +MHD_queue_auth_fail_response (struct MHD_Connection *connection, + const char *realm, + const char *opaque, + struct MHD_Response *response, + int signal_stale); + + +/** + * Get the username and password from the basic authorization header sent by the client + * + * @param connection The MHD connection structure + * @param[out] password a pointer for the password, free using #MHD_free(). + * @return NULL if no username could be found, a pointer + * to the username if found, free using #MHD_free(). + * @ingroup authentication + */ +_MHD_EXTERN char * +MHD_basic_auth_get_username_password (struct MHD_Connection *connection, + char** password); + + +/** + * Queues a response to request basic authentication from the client + * The given response object is expected to include the payload for + * the response; the "WWW-Authenticate" header will be added and the + * response queued with the 'UNAUTHORIZED' status code. + * + * @param connection The MHD connection structure + * @param realm the realm presented to the client + * @param response response object to modify and queue + * @return #MHD_YES on success, #MHD_NO otherwise + * @ingroup authentication + */ +_MHD_EXTERN int +MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, + const char *realm, + struct MHD_Response *response); + +/* ********************** generic query functions ********************** */ + + +/** + * Obtain information about the given connection. + * + * @param connection what connection to get information about + * @param info_type what information is desired? + * @param ... depends on @a info_type + * @return NULL if this information is not available + * (or if the @a info_type is unknown) + * @ingroup specialized + */ +_MHD_EXTERN const union MHD_ConnectionInfo * +MHD_get_connection_info (struct MHD_Connection *connection, + enum MHD_ConnectionInfoType info_type, + ...); + + +/** + * MHD connection options. Given to #MHD_set_connection_option to + * set custom options for a particular connection. + */ +enum MHD_CONNECTION_OPTION +{ + + /** + * Set a custom timeout for the given connection. Specified + * as the number of seconds, given as an `unsigned int`. Use + * zero for no timeout. + * If timeout was set to zero (or unset) before, setup of new value by + * MHD_set_connection_option() will reset timeout timer. + */ + MHD_CONNECTION_OPTION_TIMEOUT + +}; + + +/** + * Set a custom option for the given connection, overriding defaults. + * + * @param connection connection to modify + * @param option option to set + * @param ... arguments to the option, depending on the option type + * @return #MHD_YES on success, #MHD_NO if setting the option failed + * @ingroup specialized + */ +_MHD_EXTERN int +MHD_set_connection_option (struct MHD_Connection *connection, + enum MHD_CONNECTION_OPTION option, + ...); + + +/** + * Information about an MHD daemon. + */ +union MHD_DaemonInfo +{ + /** + * Size of the key, no longer supported. + * @deprecated + */ + size_t key_size; + + /** + * Size of the mac key, no longer supported. + * @deprecated + */ + size_t mac_key_size; + + /** + * Socket, returned for #MHD_DAEMON_INFO_LISTEN_FD. + */ + MHD_socket listen_fd; + + /** + * Bind port number, returned for #MHD_DAEMON_INFO_BIND_PORT. + */ + uint16_t port; + + /** + * epoll FD, returned for #MHD_DAEMON_INFO_EPOLL_FD. + */ + int epoll_fd; + + /** + * Number of active connections, for #MHD_DAEMON_INFO_CURRENT_CONNECTIONS. + */ + unsigned int num_connections; + + /** + * Combination of #MHD_FLAG values, for #MHD_DAEMON_INFO_FLAGS. + * This value is actually a bitfield. + * Note: flags may differ from original 'flags' specified for + * daemon, especially if #MHD_USE_AUTO was set. + */ + enum MHD_FLAG flags; +}; + + +/** + * Obtain information about the given daemon + * (not fully implemented!). + * + * @param daemon what daemon to get information about + * @param info_type what information is desired? + * @param ... depends on @a info_type + * @return NULL if this information is not available + * (or if the @a info_type is unknown) + * @ingroup specialized + */ +_MHD_EXTERN const union MHD_DaemonInfo * +MHD_get_daemon_info (struct MHD_Daemon *daemon, + enum MHD_DaemonInfoType info_type, + ...); + + +/** + * Obtain the version of this library + * + * @return static version string, e.g. "0.9.9" + * @ingroup specialized + */ +_MHD_EXTERN const char* +MHD_get_version (void); + + +/** + * Types of information about MHD features, + * used by #MHD_is_feature_supported(). + */ +enum MHD_FEATURE +{ + /** + * Get whether messages are supported. If supported then in debug + * mode messages can be printed to stderr or to external logger. + */ + MHD_FEATURE_MESSAGES = 1, + + /** + * Get whether HTTPS is supported. If supported then flag + * #MHD_USE_TLS and options #MHD_OPTION_HTTPS_MEM_KEY, + * #MHD_OPTION_HTTPS_MEM_CERT, #MHD_OPTION_HTTPS_MEM_TRUST, + * #MHD_OPTION_HTTPS_MEM_DHPARAMS, #MHD_OPTION_HTTPS_CRED_TYPE, + * #MHD_OPTION_HTTPS_PRIORITIES can be used. + */ + MHD_FEATURE_TLS = 2, + MHD_FEATURE_SSL = 2, + + /** + * Get whether option #MHD_OPTION_HTTPS_CERT_CALLBACK is + * supported. + */ + MHD_FEATURE_HTTPS_CERT_CALLBACK = 3, + + /** + * Get whether IPv6 is supported. If supported then flag + * #MHD_USE_IPv6 can be used. + */ + MHD_FEATURE_IPv6 = 4, + + /** + * Get whether IPv6 without IPv4 is supported. If not supported + * then IPv4 is always enabled in IPv6 sockets and + * flag #MHD_USE_DUAL_STACK if always used when #MHD_USE_IPv6 is + * specified. + */ + MHD_FEATURE_IPv6_ONLY = 5, + + /** + * Get whether `poll()` is supported. If supported then flag + * #MHD_USE_POLL can be used. + */ + MHD_FEATURE_POLL = 6, + + /** + * Get whether `epoll()` is supported. If supported then Flags + * #MHD_USE_EPOLL and + * #MHD_USE_EPOLL_INTERNAL_THREAD can be used. + */ + MHD_FEATURE_EPOLL = 7, + + /** + * Get whether shutdown on listen socket to signal other + * threads is supported. If not supported flag + * #MHD_USE_ITC is automatically forced. + */ + MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET = 8, + + /** + * Get whether socketpair is used internally instead of pipe to + * signal other threads. + */ + MHD_FEATURE_SOCKETPAIR = 9, + + /** + * Get whether TCP Fast Open is supported. If supported then + * flag #MHD_USE_TCP_FASTOPEN and option + * #MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE can be used. + */ + MHD_FEATURE_TCP_FASTOPEN = 10, + + /** + * Get whether HTTP Basic authorization is supported. If supported + * then functions #MHD_basic_auth_get_username_password and + * #MHD_queue_basic_auth_fail_response can be used. + */ + MHD_FEATURE_BASIC_AUTH = 11, + + /** + * Get whether HTTP Digest authorization is supported. If + * supported then options #MHD_OPTION_DIGEST_AUTH_RANDOM, + * #MHD_OPTION_NONCE_NC_SIZE and + * #MHD_digest_auth_check() can be used. + */ + MHD_FEATURE_DIGEST_AUTH = 12, + + /** + * Get whether postprocessor is supported. If supported then + * functions #MHD_create_post_processor(), #MHD_post_process() and + * #MHD_destroy_post_processor() can + * be used. + */ + MHD_FEATURE_POSTPROCESSOR = 13, + + /** + * Get whether password encrypted private key for HTTPS daemon is + * supported. If supported then option + * ::MHD_OPTION_HTTPS_KEY_PASSWORD can be used. + */ + MHD_FEATURE_HTTPS_KEY_PASSWORD = 14, + + /** + * Get whether reading files beyond 2 GiB boundary is supported. + * If supported then #MHD_create_response_from_fd(), + * #MHD_create_response_from_fd64 #MHD_create_response_from_fd_at_offset() + * and #MHD_create_response_from_fd_at_offset64() can be used with sizes and + * offsets larger than 2 GiB. If not supported value of size+offset is + * limited to 2 GiB. + */ + MHD_FEATURE_LARGE_FILE = 15, + + /** + * Get whether MHD set names on generated threads. + */ + MHD_FEATURE_THREAD_NAMES = 16, + MHD_THREAD_NAMES = 16, + + /** + * Get whether HTTP "Upgrade" is supported. + * If supported then #MHD_ALLOW_UPGRADE, #MHD_upgrade_action() and + * #MHD_create_response_for_upgrade() can be used. + */ + MHD_FEATURE_UPGRADE = 17, + + /** + * Get whether it's safe to use same FD for multiple calls of + * #MHD_create_response_from_fd() and whether it's safe to use single + * response generated by #MHD_create_response_from_fd() with multiple + * connections at same time. + * If #MHD_is_feature_supported() return #MHD_NO for this feature then + * usage of responses with same file FD in multiple parallel threads may + * results in incorrect data sent to remote client. + * It's always safe to use same file FD in multiple responses if MHD + * is run in any single thread mode. + */ + MHD_FEATURE_RESPONSES_SHARED_FD = 18, + + /** + * Get whether MHD support automatic detection of bind port number. + * @sa #MHD_DAEMON_INFO_BIND_PORT + */ + MHD_FEATURE_AUTODETECT_BIND_PORT = 19, + + /** + * Get whether MHD support SIGPIPE suppression. + * If SIGPIPE suppression is not supported, application must handle + * SIGPIPE signal by itself. + */ + MHD_FEATURE_AUTOSUPPRESS_SIGPIPE = 20, + + /** + * Get whether MHD use system's sendfile() function to send + * file-FD based responses over non-TLS connections. + * @note Since v0.9.56 + */ + MHD_FEATURE_SENDFILE = 21 +}; + + +/** + * Get information about supported MHD features. + * Indicate that MHD was compiled with or without support for + * particular feature. Some features require additional support + * by kernel. Kernel support is not checked by this function. + * + * @param feature type of requested information + * @return #MHD_YES if feature is supported by MHD, #MHD_NO if + * feature is not supported or feature is unknown. + * @ingroup specialized + */ +_MHD_EXTERN int +MHD_is_feature_supported (enum MHD_FEATURE feature); + + +#if 0 /* keep Emacsens' auto-indent happy */ +{ +#endif +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/platform.h b/src/include/platform.h new file mode 100644 index 0000000..20d4df5 --- /dev/null +++ b/src/include/platform.h @@ -0,0 +1,132 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2008 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file platform.h + * @brief platform-specific includes for libmicrohttpd + * @author Christian Grothoff + * + * This file is included by the libmicrohttpd code + * before "microhttpd.h"; it provides the required + * standard headers (which are platform-specific).

    + * + * Note that this file depends on our configure.ac + * build process and the generated config.h file. + * Hence you cannot include it directly in applications + * that use libmicrohttpd. + */ +#ifndef MHD_PLATFORM_H +#define MHD_PLATFORM_H + +#include "mhd_options.h" + +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include +#include + +/* different OSes have fd_set in + a broad range of header files; + we just include most of them (if they + are available) */ + + +#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) +#include +#include +#ifdef HAVE_SOCKLIB_H +#include +#endif /* HAVE_SOCKLIB_H */ +#ifdef HAVE_INETLIB_H +#include +#endif /* HAVE_INETLIB_H */ +#endif /* __VXWORKS__ */ + +#if HAVE_MEMORY_H +#include +#endif + +#if HAVE_SYS_SELECT_H +#include +#endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_TIME_H +#include +#endif +#if HAVE_SYS_STAT_H +#include +#endif +#if HAVE_SYS_MSG_H +#include +#endif +#if HAVE_SYS_MMAN_H +#include +#endif +#if HAVE_TIME_H +#include +#endif +#if HAVE_SYS_SOCKET_H +#include +#endif +#if defined(_WIN32) && !defined(__CYGWIN__) +#ifndef WIN32_LEAN_AND_MEAN +/* Do not include unneeded parts of W32 headers. */ +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#include +#endif /* _WIN32 && !__CYGWIN__ */ + +#if defined(__CYGWIN__) && !defined(_SYS_TYPES_FD_SET) +/* Do not define __USE_W32_SOCKETS under Cygwin! */ +#error Cygwin with winsock fd_set is not supported +#endif + +#if defined(_WIN32) && !defined(__CYGWIN__) +#define sleep(seconds) ((SleepEx((seconds)*1000, 1)==0)?0:(seconds)) +#define usleep(useconds) ((SleepEx((useconds)/1000, 1)==0)?0:-1) +#endif + +#if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED) +#define _SSIZE_T_DEFINED +typedef intptr_t ssize_t; +#endif /* !_SSIZE_T_DEFINED */ + +#if !defined(_WIN32) || defined(__CYGWIN__) +typedef time_t _MHD_TIMEVAL_TV_SEC_TYPE; +#else /* _WIN32 && ! __CYGWIN__ */ +typedef long _MHD_TIMEVAL_TV_SEC_TYPE; +#endif /* _WIN32 && ! __CYGWIN__ */ + +#if !defined(IPPROTO_IPV6) && defined(_MSC_FULL_VER) && _WIN32_WINNT >= 0x0501 +/* VC use IPPROTO_IPV6 as part of enum */ +#define IPPROTO_IPV6 IPPROTO_IPV6 +#endif + +#endif diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am new file mode 100644 index 0000000..d89f3c1 --- /dev/null +++ b/src/microhttpd/Makefile.am @@ -0,0 +1,297 @@ +# This Makefile.am is in the public domain +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/include \ + -I$(top_srcdir)/src/microhttpd + +AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) + +lib_LTLIBRARIES = \ + libmicrohttpd.la + +noinst_DATA = +MOSTLYCLEANFILES = + +if W32_SHARED_LIB_EXP +W32_MHD_LIB_LDFLAGS = -Wl,--output-def,$(lt_cv_objdir)/libmicrohttpd.def -XCClinker -static-libgcc +noinst_DATA += $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp +MOSTLYCLEANFILES += $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp + +$(lt_cv_objdir)/libmicrohttpd.def: libmicrohttpd.la + +$(lt_cv_objdir)/libmicrohttpd.exp: $(lt_cv_objdir)/libmicrohttpd.lib + +$(lt_cv_objdir)/libmicrohttpd.lib: $(lt_cv_objdir)/libmicrohttpd.def libmicrohttpd.la $(libmicrohttpd_la_OBJECTS) +if USE_MS_LIB_TOOL + @echo Creating $@ and libmicrohttpd.exp by $(MS_LIB_TOOL)... && \ + dll_name=`$(EGREP) -o dlname=\'.+\' libmicrohttpd.la` && \ + dll_name=$${dll_name#*\'} && dll_name=$${dll_name%\'} && test -n "$$dll_name" && \ + echo Creating $$dll_name by $(MS_LIB_TOOL).. && cd "$(lt_cv_objdir)" && \ + $(MS_LIB_TOOL) -def:libmicrohttpd.def -name:$$dll_name -out:libmicrohttpd.lib $(libmicrohttpd_la_OBJECTS:.lo=.o) && cd .. +else + @echo Creating $@ and libmicrohttpd.exp by $(DLLTOOL)... && \ + dll_name=`$(EGREP) -o dlname=\'.+\' libmicrohttpd.la` && \ + dll_name=$${dll_name#*\'} && dll_name=$${dll_name%\'} && test -n "$$dll_name" && \ + echo Creating $$dll_name by $(DLLTOOL).. && cd "$(lt_cv_objdir)" && \ + $(DLLTOOL) -d ./libmicrohttpd.def -D $$dll_name -l libmicrohttpd.lib $(libmicrohttpd_la_OBJECTS:.lo=.o) -e ./libmicrohttpd.exp && cd .. &&\ + echo Created libmicrohttpd.exp and libmicrohttpd.lib. +endif +else + W32_MHD_LIB_LDFLAGS = +endif + +if W32_STATIC_LIB +noinst_DATA += $(lt_cv_objdir)/libmicrohttpd-static.lib +MOSTLYCLEANFILES += $(lt_cv_objdir)/libmicrohttpd-static.lib + +$(lt_cv_objdir)/libmicrohttpd-static.lib: libmicrohttpd.la $(libmicrohttpd_la_OBJECTS) +if USE_MS_LIB_TOOL + $(MS_LIB_TOOL) -out:$@ $(libmicrohttpd_la_OBJECTS:.lo=.o) +else + cp $(lt_cv_objdir)/libmicrohttpd.a $@ +endif +endif + + +libmicrohttpd_la_SOURCES = \ + connection.c connection.h \ + reason_phrase.c \ + daemon.c \ + internal.c internal.h \ + memorypool.c memorypool.h \ + mhd_mono_clock.c mhd_mono_clock.h \ + mhd_limits.h mhd_byteorder.h \ + sysfdsetsize.c sysfdsetsize.h \ + mhd_str.c mhd_str.h \ + mhd_threads.c mhd_threads.h \ + mhd_locks.h mhd_assert.h \ + mhd_sockets.c mhd_sockets.h \ + mhd_itc.c mhd_itc.h mhd_itc_types.h \ + mhd_compat.c mhd_compat.h \ + response.c response.h + +libmicrohttpd_la_CPPFLAGS = \ + $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) \ + -DBUILDING_MHD_LIB=1 +libmicrohttpd_la_CFLAGS = \ + $(AM_CFLAGS) $(MHD_LIB_CFLAGS) +libmicrohttpd_la_LDFLAGS = \ + $(MHD_LIB_LDFLAGS) \ + $(W32_MHD_LIB_LDFLAGS) \ + -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@ +libmicrohttpd_la_LIBADD = \ + $(MHD_LIBDEPS) + +if HAVE_W32 +MHD_DLL_RES_SRC = microhttpd_dll_res.rc +MHD_DLL_RES_LO = libmicrohttpd_la-$(MHD_DLL_RES_SRC:.rc=.lo) + +EXTRA_libmicrohttpd_la_DEPENDENCIES = $(MHD_DLL_RES_LO) +libmicrohttpd_la_LIBADD += $(MHD_DLL_RES_LO) + +# General rule is not required, but keep it just in case +.rc.lo: + $(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< -o $@ + +# To add dll resource only to .dll file and exclude it form static +# lib, a little trick was used. Allow libtool to create file.lo, +# file.o and .libs/file.lo, .libs/file.o files, then overwrite file.o +# by empty object generated from empty c-file. Later libtool will +# use .libs/file.o for shared lib and empty file.o for static lib. +# This implementation is based on trick found in liblzma. +# Note: windres does not understand '-isystem' flag, so all +# possible '-isystem' flags are replaced by simple '-I' flags. +$(MHD_DLL_RES_LO): $(MHD_DLL_RES_SRC) + RC_CPP_FLAGS=" $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) " && \ + $(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $${RC_CPP_FLAGS// -isystem / -I } $< -o $@ && \ + echo > $@-empty.c && $(CC) $(AM_CFLAGS) $(CFLAGS) -c $@-empty.c -o $(@:.lo=.o) && rm -f $@-empty.c +endif + +if USE_COVERAGE + AM_CFLAGS += --coverage +endif + +if !MHD_HAVE_TSEARCH +libmicrohttpd_la_SOURCES += \ + tsearch.c tsearch.h +endif + +if HAVE_POSTPROCESSOR +libmicrohttpd_la_SOURCES += \ + postprocessor.c +endif + +if ENABLE_DAUTH +libmicrohttpd_la_SOURCES += \ + digestauth.c \ + md5.c md5.h +endif + +if ENABLE_BAUTH +libmicrohttpd_la_SOURCES += \ + basicauth.c \ + base64.c base64.h +endif + +if ENABLE_HTTPS +libmicrohttpd_la_SOURCES += \ + connection_https.c connection_https.h +endif + + + +check_PROGRAMS = \ + test_str_compare \ + test_str_to_value \ + test_str_token \ + test_http_reasons \ + test_start_stop \ + test_daemon \ + test_options + +if HAVE_POSIX_THREADS +if ENABLE_UPGRADE + check_PROGRAMS += test_upgrade +if ENABLE_HTTPS + check_PROGRAMS += test_upgrade_tls +endif +endif +endif + +if HAVE_POSTPROCESSOR +check_PROGRAMS += \ + test_postprocessor \ + test_postprocessor_large \ + test_postprocessor_amp +endif + +TESTS = $(check_PROGRAMS) + +# Do not test trigger of select by shutdown of listen socket +# on Cygwin as this ability is deliberately ignored on Cygwin +# to improve compatibility with core OS. +if !CYGWIN_TARGET +if HAVE_LISTEN_SHUTDOWN +check_PROGRAMS += \ + test_shutdown_select \ + test_shutdown_poll +else +check_PROGRAMS += \ + test_shutdown_select_ignore \ + test_shutdown_poll_ignore +endif +endif + +test_start_stop_SOURCES = \ + test_start_stop.c +test_start_stop_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_daemon_SOURCES = \ + test_daemon.c +test_daemon_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_upgrade_SOURCES = \ + test_upgrade.c test_helpers.h mhd_sockets.h +test_upgrade_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_upgrade_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) +test_upgrade_LDFLAGS = \ + $(GNUTLS_LDFLAGS) +test_upgrade_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + +test_upgrade_tls_SOURCES = \ + test_upgrade.c test_helpers.h mhd_sockets.h +test_upgrade_tls_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_upgrade_tls_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) +test_upgrade_tls_LDFLAGS = \ + $(GNUTLS_LDFLAGS) +test_upgrade_tls_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + +test_postprocessor_SOURCES = \ + test_postprocessor.c +test_postprocessor_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) +test_postprocessor_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_postprocessor_amp_SOURCES = \ + test_postprocessor_amp.c +test_postprocessor_amp_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_amp_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) +test_postprocessor_amp_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_postprocessor_large_SOURCES = \ + test_postprocessor_large.c +test_postprocessor_large_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) +test_postprocessor_large_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) +test_postprocessor_large_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_shutdown_select_SOURCES = \ + test_shutdown_select.c +if USE_POSIX_THREADS +test_shutdown_select_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) +test_shutdown_select_LDADD = \ + $(PTHREAD_LIBS) +endif + +test_shutdown_poll_SOURCES = \ + test_shutdown_select.c mhd_threads.h +if USE_POSIX_THREADS +test_shutdown_poll_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) +test_shutdown_poll_LDADD = \ + $(PTHREAD_LIBS) +endif + +test_shutdown_select_ignore_SOURCES = \ + test_shutdown_select.c +if USE_POSIX_THREADS +test_shutdown_select_ignore_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) +test_shutdown_select_ignore_LDADD = \ + $(PTHREAD_LIBS) +endif + +test_shutdown_poll_ignore_SOURCES = \ + test_shutdown_select.c mhd_threads.h +if USE_POSIX_THREADS +test_shutdown_poll_ignore_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) +test_shutdown_poll_ignore_LDADD = \ + $(PTHREAD_LIBS) +endif + +test_str_compare_SOURCES = \ + test_str.c test_helpers.h mhd_str.c + +test_str_to_value_SOURCES = \ + test_str.c test_helpers.h mhd_str.c + +test_str_token_SOURCES = \ + test_str_token.c mhd_str.c + +test_http_reasons_SOURCES = \ + test_http_reasons.c \ + reason_phrase.c mhd_str.c mhd_str.h + +test_options_SOURCES = \ + test_options.c +test_options_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la diff --git a/src/microhttpd/Makefile.in b/src/microhttpd/Makefile.in new file mode 100644 index 0000000..e38c474 --- /dev/null +++ b/src/microhttpd/Makefile.in @@ -0,0 +1,1962 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +@W32_SHARED_LIB_EXP_TRUE@am__append_1 = $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp +@W32_SHARED_LIB_EXP_TRUE@am__append_2 = $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp +@W32_STATIC_LIB_TRUE@am__append_3 = $(lt_cv_objdir)/libmicrohttpd-static.lib +@W32_STATIC_LIB_TRUE@am__append_4 = $(lt_cv_objdir)/libmicrohttpd-static.lib +@HAVE_W32_TRUE@am__append_5 = $(MHD_DLL_RES_LO) +@USE_COVERAGE_TRUE@am__append_6 = --coverage +@MHD_HAVE_TSEARCH_FALSE@am__append_7 = \ +@MHD_HAVE_TSEARCH_FALSE@ tsearch.c tsearch.h + +@HAVE_POSTPROCESSOR_TRUE@am__append_8 = \ +@HAVE_POSTPROCESSOR_TRUE@ postprocessor.c + +@ENABLE_DAUTH_TRUE@am__append_9 = \ +@ENABLE_DAUTH_TRUE@ digestauth.c \ +@ENABLE_DAUTH_TRUE@ md5.c md5.h + +@ENABLE_BAUTH_TRUE@am__append_10 = \ +@ENABLE_BAUTH_TRUE@ basicauth.c \ +@ENABLE_BAUTH_TRUE@ base64.c base64.h + +@ENABLE_HTTPS_TRUE@am__append_11 = \ +@ENABLE_HTTPS_TRUE@ connection_https.c connection_https.h + +check_PROGRAMS = test_str_compare$(EXEEXT) test_str_to_value$(EXEEXT) \ + test_str_token$(EXEEXT) test_http_reasons$(EXEEXT) \ + test_start_stop$(EXEEXT) test_daemon$(EXEEXT) \ + test_options$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \ + $(am__EXEEXT_3) $(am__EXEEXT_4) $(am__EXEEXT_5) +@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_12 = test_upgrade +@ENABLE_HTTPS_TRUE@@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_13 = test_upgrade_tls +@HAVE_POSTPROCESSOR_TRUE@am__append_14 = \ +@HAVE_POSTPROCESSOR_TRUE@ test_postprocessor \ +@HAVE_POSTPROCESSOR_TRUE@ test_postprocessor_large \ +@HAVE_POSTPROCESSOR_TRUE@ test_postprocessor_amp + + +# Do not test trigger of select by shutdown of listen socket +# on Cygwin as this ability is deliberately ignored on Cygwin +# to improve compatibility with core OS. +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_TRUE@am__append_15 = \ +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_TRUE@ test_shutdown_select \ +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_TRUE@ test_shutdown_poll + +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_FALSE@am__append_16 = \ +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_FALSE@ test_shutdown_select_ignore \ +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_FALSE@ test_shutdown_poll_ignore + +subdir = src/microhttpd +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = microhttpd_dll_res.rc +CONFIG_CLEAN_VPATH_FILES = +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libmicrohttpd_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_5) +am__libmicrohttpd_la_SOURCES_DIST = connection.c connection.h \ + reason_phrase.c daemon.c internal.c internal.h memorypool.c \ + memorypool.h mhd_mono_clock.c mhd_mono_clock.h mhd_limits.h \ + mhd_byteorder.h sysfdsetsize.c sysfdsetsize.h mhd_str.c \ + mhd_str.h mhd_threads.c mhd_threads.h mhd_locks.h mhd_assert.h \ + mhd_sockets.c mhd_sockets.h mhd_itc.c mhd_itc.h \ + mhd_itc_types.h mhd_compat.c mhd_compat.h response.c \ + response.h tsearch.c tsearch.h postprocessor.c digestauth.c \ + md5.c md5.h basicauth.c base64.c base64.h connection_https.c \ + connection_https.h +@MHD_HAVE_TSEARCH_FALSE@am__objects_1 = libmicrohttpd_la-tsearch.lo +@HAVE_POSTPROCESSOR_TRUE@am__objects_2 = \ +@HAVE_POSTPROCESSOR_TRUE@ libmicrohttpd_la-postprocessor.lo +@ENABLE_DAUTH_TRUE@am__objects_3 = libmicrohttpd_la-digestauth.lo \ +@ENABLE_DAUTH_TRUE@ libmicrohttpd_la-md5.lo +@ENABLE_BAUTH_TRUE@am__objects_4 = libmicrohttpd_la-basicauth.lo \ +@ENABLE_BAUTH_TRUE@ libmicrohttpd_la-base64.lo +@ENABLE_HTTPS_TRUE@am__objects_5 = \ +@ENABLE_HTTPS_TRUE@ libmicrohttpd_la-connection_https.lo +am_libmicrohttpd_la_OBJECTS = libmicrohttpd_la-connection.lo \ + libmicrohttpd_la-reason_phrase.lo libmicrohttpd_la-daemon.lo \ + libmicrohttpd_la-internal.lo libmicrohttpd_la-memorypool.lo \ + libmicrohttpd_la-mhd_mono_clock.lo \ + libmicrohttpd_la-sysfdsetsize.lo libmicrohttpd_la-mhd_str.lo \ + libmicrohttpd_la-mhd_threads.lo \ + libmicrohttpd_la-mhd_sockets.lo libmicrohttpd_la-mhd_itc.lo \ + libmicrohttpd_la-mhd_compat.lo libmicrohttpd_la-response.lo \ + $(am__objects_1) $(am__objects_2) $(am__objects_3) \ + $(am__objects_4) $(am__objects_5) +libmicrohttpd_la_OBJECTS = $(am_libmicrohttpd_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libmicrohttpd_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libmicrohttpd_la_CFLAGS) $(CFLAGS) \ + $(libmicrohttpd_la_LDFLAGS) $(LDFLAGS) -o $@ +@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_1 = test_upgrade$(EXEEXT) +@ENABLE_HTTPS_TRUE@@ENABLE_UPGRADE_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_2 = test_upgrade_tls$(EXEEXT) +@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_3 = test_postprocessor$(EXEEXT) \ +@HAVE_POSTPROCESSOR_TRUE@ test_postprocessor_large$(EXEEXT) \ +@HAVE_POSTPROCESSOR_TRUE@ test_postprocessor_amp$(EXEEXT) +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_TRUE@am__EXEEXT_4 = test_shutdown_select$(EXEEXT) \ +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_TRUE@ test_shutdown_poll$(EXEEXT) +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_FALSE@am__EXEEXT_5 = test_shutdown_select_ignore$(EXEEXT) \ +@CYGWIN_TARGET_FALSE@@HAVE_LISTEN_SHUTDOWN_FALSE@ test_shutdown_poll_ignore$(EXEEXT) +am_test_daemon_OBJECTS = test_daemon.$(OBJEXT) +test_daemon_OBJECTS = $(am_test_daemon_OBJECTS) +test_daemon_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_http_reasons_OBJECTS = test_http_reasons.$(OBJEXT) \ + reason_phrase.$(OBJEXT) mhd_str.$(OBJEXT) +test_http_reasons_OBJECTS = $(am_test_http_reasons_OBJECTS) +test_http_reasons_LDADD = $(LDADD) +am_test_options_OBJECTS = test_options.$(OBJEXT) +test_options_OBJECTS = $(am_test_options_OBJECTS) +test_options_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_postprocessor_OBJECTS = \ + test_postprocessor-test_postprocessor.$(OBJEXT) +test_postprocessor_OBJECTS = $(am_test_postprocessor_OBJECTS) +test_postprocessor_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +test_postprocessor_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_postprocessor_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_postprocessor_amp_OBJECTS = \ + test_postprocessor_amp-test_postprocessor_amp.$(OBJEXT) +test_postprocessor_amp_OBJECTS = $(am_test_postprocessor_amp_OBJECTS) +test_postprocessor_amp_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +test_postprocessor_amp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_postprocessor_amp_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_postprocessor_large_OBJECTS = \ + test_postprocessor_large-test_postprocessor_large.$(OBJEXT) +test_postprocessor_large_OBJECTS = \ + $(am_test_postprocessor_large_OBJECTS) +test_postprocessor_large_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +test_postprocessor_large_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_postprocessor_large_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_shutdown_poll_OBJECTS = \ + test_shutdown_poll-test_shutdown_select.$(OBJEXT) +test_shutdown_poll_OBJECTS = $(am_test_shutdown_poll_OBJECTS) +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_DEPENDENCIES = \ +@USE_POSIX_THREADS_TRUE@ $(am__DEPENDENCIES_1) +test_shutdown_poll_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_shutdown_poll_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_shutdown_poll_ignore_OBJECTS = \ + test_shutdown_poll_ignore-test_shutdown_select.$(OBJEXT) +test_shutdown_poll_ignore_OBJECTS = \ + $(am_test_shutdown_poll_ignore_OBJECTS) +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_ignore_DEPENDENCIES = \ +@USE_POSIX_THREADS_TRUE@ $(am__DEPENDENCIES_1) +test_shutdown_poll_ignore_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_shutdown_poll_ignore_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_shutdown_select_OBJECTS = \ + test_shutdown_select-test_shutdown_select.$(OBJEXT) +test_shutdown_select_OBJECTS = $(am_test_shutdown_select_OBJECTS) +@USE_POSIX_THREADS_TRUE@test_shutdown_select_DEPENDENCIES = \ +@USE_POSIX_THREADS_TRUE@ $(am__DEPENDENCIES_1) +test_shutdown_select_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_shutdown_select_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_shutdown_select_ignore_OBJECTS = \ + test_shutdown_select_ignore-test_shutdown_select.$(OBJEXT) +test_shutdown_select_ignore_OBJECTS = \ + $(am_test_shutdown_select_ignore_OBJECTS) +@USE_POSIX_THREADS_TRUE@test_shutdown_select_ignore_DEPENDENCIES = \ +@USE_POSIX_THREADS_TRUE@ $(am__DEPENDENCIES_1) +test_shutdown_select_ignore_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_shutdown_select_ignore_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_start_stop_OBJECTS = test_start_stop.$(OBJEXT) +test_start_stop_OBJECTS = $(am_test_start_stop_OBJECTS) +test_start_stop_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_str_compare_OBJECTS = test_str.$(OBJEXT) mhd_str.$(OBJEXT) +test_str_compare_OBJECTS = $(am_test_str_compare_OBJECTS) +test_str_compare_LDADD = $(LDADD) +am_test_str_to_value_OBJECTS = test_str.$(OBJEXT) mhd_str.$(OBJEXT) +test_str_to_value_OBJECTS = $(am_test_str_to_value_OBJECTS) +test_str_to_value_LDADD = $(LDADD) +am_test_str_token_OBJECTS = test_str_token.$(OBJEXT) mhd_str.$(OBJEXT) +test_str_token_OBJECTS = $(am_test_str_token_OBJECTS) +test_str_token_LDADD = $(LDADD) +am_test_upgrade_OBJECTS = test_upgrade-test_upgrade.$(OBJEXT) +test_upgrade_OBJECTS = $(am_test_upgrade_OBJECTS) +test_upgrade_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_upgrade_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_upgrade_CFLAGS) \ + $(CFLAGS) $(test_upgrade_LDFLAGS) $(LDFLAGS) -o $@ +am_test_upgrade_tls_OBJECTS = test_upgrade_tls-test_upgrade.$(OBJEXT) +test_upgrade_tls_OBJECTS = $(am_test_upgrade_tls_OBJECTS) +test_upgrade_tls_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_upgrade_tls_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_upgrade_tls_CFLAGS) $(CFLAGS) \ + $(test_upgrade_tls_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libmicrohttpd_la_SOURCES) $(test_daemon_SOURCES) \ + $(test_http_reasons_SOURCES) $(test_options_SOURCES) \ + $(test_postprocessor_SOURCES) \ + $(test_postprocessor_amp_SOURCES) \ + $(test_postprocessor_large_SOURCES) \ + $(test_shutdown_poll_SOURCES) \ + $(test_shutdown_poll_ignore_SOURCES) \ + $(test_shutdown_select_SOURCES) \ + $(test_shutdown_select_ignore_SOURCES) \ + $(test_start_stop_SOURCES) $(test_str_compare_SOURCES) \ + $(test_str_to_value_SOURCES) $(test_str_token_SOURCES) \ + $(test_upgrade_SOURCES) $(test_upgrade_tls_SOURCES) +DIST_SOURCES = $(am__libmicrohttpd_la_SOURCES_DIST) \ + $(test_daemon_SOURCES) $(test_http_reasons_SOURCES) \ + $(test_options_SOURCES) $(test_postprocessor_SOURCES) \ + $(test_postprocessor_amp_SOURCES) \ + $(test_postprocessor_large_SOURCES) \ + $(test_shutdown_poll_SOURCES) \ + $(test_shutdown_poll_ignore_SOURCES) \ + $(test_shutdown_select_SOURCES) \ + $(test_shutdown_select_ignore_SOURCES) \ + $(test_start_stop_SOURCES) $(test_str_compare_SOURCES) \ + $(test_str_to_value_SOURCES) $(test_str_token_SOURCES) \ + $(test_upgrade_SOURCES) $(test_upgrade_tls_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(noinst_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/microhttpd_dll_res.rc.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/include \ + -I$(top_srcdir)/src/microhttpd + +AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) $(am__append_6) +lib_LTLIBRARIES = \ + libmicrohttpd.la + +noinst_DATA = $(am__append_1) $(am__append_3) +MOSTLYCLEANFILES = $(am__append_2) $(am__append_4) +@W32_SHARED_LIB_EXP_FALSE@W32_MHD_LIB_LDFLAGS = +@W32_SHARED_LIB_EXP_TRUE@W32_MHD_LIB_LDFLAGS = -Wl,--output-def,$(lt_cv_objdir)/libmicrohttpd.def -XCClinker -static-libgcc +libmicrohttpd_la_SOURCES = connection.c connection.h reason_phrase.c \ + daemon.c internal.c internal.h memorypool.c memorypool.h \ + mhd_mono_clock.c mhd_mono_clock.h mhd_limits.h mhd_byteorder.h \ + sysfdsetsize.c sysfdsetsize.h mhd_str.c mhd_str.h \ + mhd_threads.c mhd_threads.h mhd_locks.h mhd_assert.h \ + mhd_sockets.c mhd_sockets.h mhd_itc.c mhd_itc.h \ + mhd_itc_types.h mhd_compat.c mhd_compat.h response.c \ + response.h $(am__append_7) $(am__append_8) $(am__append_9) \ + $(am__append_10) $(am__append_11) +libmicrohttpd_la_CPPFLAGS = \ + $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) \ + -DBUILDING_MHD_LIB=1 + +libmicrohttpd_la_CFLAGS = \ + $(AM_CFLAGS) $(MHD_LIB_CFLAGS) + +libmicrohttpd_la_LDFLAGS = \ + $(MHD_LIB_LDFLAGS) \ + $(W32_MHD_LIB_LDFLAGS) \ + -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@ + +libmicrohttpd_la_LIBADD = $(MHD_LIBDEPS) $(am__append_5) +@HAVE_W32_TRUE@MHD_DLL_RES_SRC = microhttpd_dll_res.rc +@HAVE_W32_TRUE@MHD_DLL_RES_LO = libmicrohttpd_la-$(MHD_DLL_RES_SRC:.rc=.lo) +@HAVE_W32_TRUE@EXTRA_libmicrohttpd_la_DEPENDENCIES = $(MHD_DLL_RES_LO) +TESTS = $(check_PROGRAMS) +test_start_stop_SOURCES = \ + test_start_stop.c + +test_start_stop_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_daemon_SOURCES = \ + test_daemon.c + +test_daemon_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_upgrade_SOURCES = \ + test_upgrade.c test_helpers.h mhd_sockets.h + +test_upgrade_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +test_upgrade_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) + +test_upgrade_LDFLAGS = \ + $(GNUTLS_LDFLAGS) + +test_upgrade_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + +test_upgrade_tls_SOURCES = \ + test_upgrade.c test_helpers.h mhd_sockets.h + +test_upgrade_tls_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +test_upgrade_tls_CFLAGS = \ + $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(GNUTLS_CFLAGS) + +test_upgrade_tls_LDFLAGS = \ + $(GNUTLS_LDFLAGS) + +test_upgrade_tls_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) + +test_postprocessor_SOURCES = \ + test_postprocessor.c + +test_postprocessor_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +test_postprocessor_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) + +test_postprocessor_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_postprocessor_amp_SOURCES = \ + test_postprocessor_amp.c + +test_postprocessor_amp_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +test_postprocessor_amp_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) + +test_postprocessor_amp_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_postprocessor_large_SOURCES = \ + test_postprocessor_large.c + +test_postprocessor_large_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +test_postprocessor_large_CFLAGS = \ + $(AM_CFLAGS) $(GNUTLS_CFLAGS) + +test_postprocessor_large_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_shutdown_select_SOURCES = \ + test_shutdown_select.c + +@USE_POSIX_THREADS_TRUE@test_shutdown_select_CFLAGS = \ +@USE_POSIX_THREADS_TRUE@ $(AM_CFLAGS) $(PTHREAD_CFLAGS) + +@USE_POSIX_THREADS_TRUE@test_shutdown_select_LDADD = \ +@USE_POSIX_THREADS_TRUE@ $(PTHREAD_LIBS) + +test_shutdown_poll_SOURCES = \ + test_shutdown_select.c mhd_threads.h + +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_CFLAGS = \ +@USE_POSIX_THREADS_TRUE@ $(AM_CFLAGS) $(PTHREAD_CFLAGS) + +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_LDADD = \ +@USE_POSIX_THREADS_TRUE@ $(PTHREAD_LIBS) + +test_shutdown_select_ignore_SOURCES = \ + test_shutdown_select.c + +@USE_POSIX_THREADS_TRUE@test_shutdown_select_ignore_CFLAGS = \ +@USE_POSIX_THREADS_TRUE@ $(AM_CFLAGS) $(PTHREAD_CFLAGS) + +@USE_POSIX_THREADS_TRUE@test_shutdown_select_ignore_LDADD = \ +@USE_POSIX_THREADS_TRUE@ $(PTHREAD_LIBS) + +test_shutdown_poll_ignore_SOURCES = \ + test_shutdown_select.c mhd_threads.h + +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_ignore_CFLAGS = \ +@USE_POSIX_THREADS_TRUE@ $(AM_CFLAGS) $(PTHREAD_CFLAGS) + +@USE_POSIX_THREADS_TRUE@test_shutdown_poll_ignore_LDADD = \ +@USE_POSIX_THREADS_TRUE@ $(PTHREAD_LIBS) + +test_str_compare_SOURCES = \ + test_str.c test_helpers.h mhd_str.c + +test_str_to_value_SOURCES = \ + test_str.c test_helpers.h mhd_str.c + +test_str_token_SOURCES = \ + test_str_token.c mhd_str.c + +test_http_reasons_SOURCES = \ + test_http_reasons.c \ + reason_phrase.c mhd_str.c mhd_str.h + +test_options_SOURCES = \ + test_options.c + +test_options_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .rc .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/microhttpd/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/microhttpd/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +microhttpd_dll_res.rc: $(top_builddir)/config.status $(srcdir)/microhttpd_dll_res.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libmicrohttpd.la: $(libmicrohttpd_la_OBJECTS) $(libmicrohttpd_la_DEPENDENCIES) $(EXTRA_libmicrohttpd_la_DEPENDENCIES) + $(AM_V_CCLD)$(libmicrohttpd_la_LINK) -rpath $(libdir) $(libmicrohttpd_la_OBJECTS) $(libmicrohttpd_la_LIBADD) $(LIBS) + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_daemon$(EXEEXT): $(test_daemon_OBJECTS) $(test_daemon_DEPENDENCIES) $(EXTRA_test_daemon_DEPENDENCIES) + @rm -f test_daemon$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_daemon_OBJECTS) $(test_daemon_LDADD) $(LIBS) + +test_http_reasons$(EXEEXT): $(test_http_reasons_OBJECTS) $(test_http_reasons_DEPENDENCIES) $(EXTRA_test_http_reasons_DEPENDENCIES) + @rm -f test_http_reasons$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_http_reasons_OBJECTS) $(test_http_reasons_LDADD) $(LIBS) + +test_options$(EXEEXT): $(test_options_OBJECTS) $(test_options_DEPENDENCIES) $(EXTRA_test_options_DEPENDENCIES) + @rm -f test_options$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_options_OBJECTS) $(test_options_LDADD) $(LIBS) + +test_postprocessor$(EXEEXT): $(test_postprocessor_OBJECTS) $(test_postprocessor_DEPENDENCIES) $(EXTRA_test_postprocessor_DEPENDENCIES) + @rm -f test_postprocessor$(EXEEXT) + $(AM_V_CCLD)$(test_postprocessor_LINK) $(test_postprocessor_OBJECTS) $(test_postprocessor_LDADD) $(LIBS) + +test_postprocessor_amp$(EXEEXT): $(test_postprocessor_amp_OBJECTS) $(test_postprocessor_amp_DEPENDENCIES) $(EXTRA_test_postprocessor_amp_DEPENDENCIES) + @rm -f test_postprocessor_amp$(EXEEXT) + $(AM_V_CCLD)$(test_postprocessor_amp_LINK) $(test_postprocessor_amp_OBJECTS) $(test_postprocessor_amp_LDADD) $(LIBS) + +test_postprocessor_large$(EXEEXT): $(test_postprocessor_large_OBJECTS) $(test_postprocessor_large_DEPENDENCIES) $(EXTRA_test_postprocessor_large_DEPENDENCIES) + @rm -f test_postprocessor_large$(EXEEXT) + $(AM_V_CCLD)$(test_postprocessor_large_LINK) $(test_postprocessor_large_OBJECTS) $(test_postprocessor_large_LDADD) $(LIBS) + +test_shutdown_poll$(EXEEXT): $(test_shutdown_poll_OBJECTS) $(test_shutdown_poll_DEPENDENCIES) $(EXTRA_test_shutdown_poll_DEPENDENCIES) + @rm -f test_shutdown_poll$(EXEEXT) + $(AM_V_CCLD)$(test_shutdown_poll_LINK) $(test_shutdown_poll_OBJECTS) $(test_shutdown_poll_LDADD) $(LIBS) + +test_shutdown_poll_ignore$(EXEEXT): $(test_shutdown_poll_ignore_OBJECTS) $(test_shutdown_poll_ignore_DEPENDENCIES) $(EXTRA_test_shutdown_poll_ignore_DEPENDENCIES) + @rm -f test_shutdown_poll_ignore$(EXEEXT) + $(AM_V_CCLD)$(test_shutdown_poll_ignore_LINK) $(test_shutdown_poll_ignore_OBJECTS) $(test_shutdown_poll_ignore_LDADD) $(LIBS) + +test_shutdown_select$(EXEEXT): $(test_shutdown_select_OBJECTS) $(test_shutdown_select_DEPENDENCIES) $(EXTRA_test_shutdown_select_DEPENDENCIES) + @rm -f test_shutdown_select$(EXEEXT) + $(AM_V_CCLD)$(test_shutdown_select_LINK) $(test_shutdown_select_OBJECTS) $(test_shutdown_select_LDADD) $(LIBS) + +test_shutdown_select_ignore$(EXEEXT): $(test_shutdown_select_ignore_OBJECTS) $(test_shutdown_select_ignore_DEPENDENCIES) $(EXTRA_test_shutdown_select_ignore_DEPENDENCIES) + @rm -f test_shutdown_select_ignore$(EXEEXT) + $(AM_V_CCLD)$(test_shutdown_select_ignore_LINK) $(test_shutdown_select_ignore_OBJECTS) $(test_shutdown_select_ignore_LDADD) $(LIBS) + +test_start_stop$(EXEEXT): $(test_start_stop_OBJECTS) $(test_start_stop_DEPENDENCIES) $(EXTRA_test_start_stop_DEPENDENCIES) + @rm -f test_start_stop$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_start_stop_OBJECTS) $(test_start_stop_LDADD) $(LIBS) + +test_str_compare$(EXEEXT): $(test_str_compare_OBJECTS) $(test_str_compare_DEPENDENCIES) $(EXTRA_test_str_compare_DEPENDENCIES) + @rm -f test_str_compare$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_str_compare_OBJECTS) $(test_str_compare_LDADD) $(LIBS) + +test_str_to_value$(EXEEXT): $(test_str_to_value_OBJECTS) $(test_str_to_value_DEPENDENCIES) $(EXTRA_test_str_to_value_DEPENDENCIES) + @rm -f test_str_to_value$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_str_to_value_OBJECTS) $(test_str_to_value_LDADD) $(LIBS) + +test_str_token$(EXEEXT): $(test_str_token_OBJECTS) $(test_str_token_DEPENDENCIES) $(EXTRA_test_str_token_DEPENDENCIES) + @rm -f test_str_token$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_str_token_OBJECTS) $(test_str_token_LDADD) $(LIBS) + +test_upgrade$(EXEEXT): $(test_upgrade_OBJECTS) $(test_upgrade_DEPENDENCIES) $(EXTRA_test_upgrade_DEPENDENCIES) + @rm -f test_upgrade$(EXEEXT) + $(AM_V_CCLD)$(test_upgrade_LINK) $(test_upgrade_OBJECTS) $(test_upgrade_LDADD) $(LIBS) + +test_upgrade_tls$(EXEEXT): $(test_upgrade_tls_OBJECTS) $(test_upgrade_tls_DEPENDENCIES) $(EXTRA_test_upgrade_tls_DEPENDENCIES) + @rm -f test_upgrade_tls$(EXEEXT) + $(AM_V_CCLD)$(test_upgrade_tls_LINK) $(test_upgrade_tls_OBJECTS) $(test_upgrade_tls_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-base64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-basicauth.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-connection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-connection_https.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-daemon.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-digestauth.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-internal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-md5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-memorypool.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_compat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_itc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_mono_clock.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_sockets.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_str.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-mhd_threads.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-postprocessor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-reason_phrase.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-response.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-sysfdsetsize.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmicrohttpd_la-tsearch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mhd_str.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reason_phrase.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_daemon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_http_reasons.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_options.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_postprocessor-test_postprocessor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_shutdown_poll-test_shutdown_select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_shutdown_poll_ignore-test_shutdown_select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_shutdown_select-test_shutdown_select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_shutdown_select_ignore-test_shutdown_select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_start_stop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_str.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_str_token.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_upgrade-test_upgrade.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_upgrade_tls-test_upgrade.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libmicrohttpd_la-connection.lo: connection.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-connection.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-connection.Tpo -c -o libmicrohttpd_la-connection.lo `test -f 'connection.c' || echo '$(srcdir)/'`connection.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-connection.Tpo $(DEPDIR)/libmicrohttpd_la-connection.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='connection.c' object='libmicrohttpd_la-connection.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-connection.lo `test -f 'connection.c' || echo '$(srcdir)/'`connection.c + +libmicrohttpd_la-reason_phrase.lo: reason_phrase.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-reason_phrase.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-reason_phrase.Tpo -c -o libmicrohttpd_la-reason_phrase.lo `test -f 'reason_phrase.c' || echo '$(srcdir)/'`reason_phrase.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-reason_phrase.Tpo $(DEPDIR)/libmicrohttpd_la-reason_phrase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='reason_phrase.c' object='libmicrohttpd_la-reason_phrase.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-reason_phrase.lo `test -f 'reason_phrase.c' || echo '$(srcdir)/'`reason_phrase.c + +libmicrohttpd_la-daemon.lo: daemon.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-daemon.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-daemon.Tpo -c -o libmicrohttpd_la-daemon.lo `test -f 'daemon.c' || echo '$(srcdir)/'`daemon.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-daemon.Tpo $(DEPDIR)/libmicrohttpd_la-daemon.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='daemon.c' object='libmicrohttpd_la-daemon.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-daemon.lo `test -f 'daemon.c' || echo '$(srcdir)/'`daemon.c + +libmicrohttpd_la-internal.lo: internal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-internal.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-internal.Tpo -c -o libmicrohttpd_la-internal.lo `test -f 'internal.c' || echo '$(srcdir)/'`internal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-internal.Tpo $(DEPDIR)/libmicrohttpd_la-internal.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='internal.c' object='libmicrohttpd_la-internal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-internal.lo `test -f 'internal.c' || echo '$(srcdir)/'`internal.c + +libmicrohttpd_la-memorypool.lo: memorypool.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-memorypool.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-memorypool.Tpo -c -o libmicrohttpd_la-memorypool.lo `test -f 'memorypool.c' || echo '$(srcdir)/'`memorypool.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-memorypool.Tpo $(DEPDIR)/libmicrohttpd_la-memorypool.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='memorypool.c' object='libmicrohttpd_la-memorypool.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-memorypool.lo `test -f 'memorypool.c' || echo '$(srcdir)/'`memorypool.c + +libmicrohttpd_la-mhd_mono_clock.lo: mhd_mono_clock.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_mono_clock.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_mono_clock.Tpo -c -o libmicrohttpd_la-mhd_mono_clock.lo `test -f 'mhd_mono_clock.c' || echo '$(srcdir)/'`mhd_mono_clock.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_mono_clock.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_mono_clock.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_mono_clock.c' object='libmicrohttpd_la-mhd_mono_clock.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_mono_clock.lo `test -f 'mhd_mono_clock.c' || echo '$(srcdir)/'`mhd_mono_clock.c + +libmicrohttpd_la-sysfdsetsize.lo: sysfdsetsize.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-sysfdsetsize.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-sysfdsetsize.Tpo -c -o libmicrohttpd_la-sysfdsetsize.lo `test -f 'sysfdsetsize.c' || echo '$(srcdir)/'`sysfdsetsize.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-sysfdsetsize.Tpo $(DEPDIR)/libmicrohttpd_la-sysfdsetsize.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sysfdsetsize.c' object='libmicrohttpd_la-sysfdsetsize.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-sysfdsetsize.lo `test -f 'sysfdsetsize.c' || echo '$(srcdir)/'`sysfdsetsize.c + +libmicrohttpd_la-mhd_str.lo: mhd_str.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_str.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_str.Tpo -c -o libmicrohttpd_la-mhd_str.lo `test -f 'mhd_str.c' || echo '$(srcdir)/'`mhd_str.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_str.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_str.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_str.c' object='libmicrohttpd_la-mhd_str.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_str.lo `test -f 'mhd_str.c' || echo '$(srcdir)/'`mhd_str.c + +libmicrohttpd_la-mhd_threads.lo: mhd_threads.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_threads.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_threads.Tpo -c -o libmicrohttpd_la-mhd_threads.lo `test -f 'mhd_threads.c' || echo '$(srcdir)/'`mhd_threads.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_threads.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_threads.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_threads.c' object='libmicrohttpd_la-mhd_threads.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_threads.lo `test -f 'mhd_threads.c' || echo '$(srcdir)/'`mhd_threads.c + +libmicrohttpd_la-mhd_sockets.lo: mhd_sockets.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_sockets.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_sockets.Tpo -c -o libmicrohttpd_la-mhd_sockets.lo `test -f 'mhd_sockets.c' || echo '$(srcdir)/'`mhd_sockets.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_sockets.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_sockets.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_sockets.c' object='libmicrohttpd_la-mhd_sockets.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_sockets.lo `test -f 'mhd_sockets.c' || echo '$(srcdir)/'`mhd_sockets.c + +libmicrohttpd_la-mhd_itc.lo: mhd_itc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_itc.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_itc.Tpo -c -o libmicrohttpd_la-mhd_itc.lo `test -f 'mhd_itc.c' || echo '$(srcdir)/'`mhd_itc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_itc.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_itc.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_itc.c' object='libmicrohttpd_la-mhd_itc.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_itc.lo `test -f 'mhd_itc.c' || echo '$(srcdir)/'`mhd_itc.c + +libmicrohttpd_la-mhd_compat.lo: mhd_compat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-mhd_compat.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-mhd_compat.Tpo -c -o libmicrohttpd_la-mhd_compat.lo `test -f 'mhd_compat.c' || echo '$(srcdir)/'`mhd_compat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-mhd_compat.Tpo $(DEPDIR)/libmicrohttpd_la-mhd_compat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mhd_compat.c' object='libmicrohttpd_la-mhd_compat.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-mhd_compat.lo `test -f 'mhd_compat.c' || echo '$(srcdir)/'`mhd_compat.c + +libmicrohttpd_la-response.lo: response.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-response.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-response.Tpo -c -o libmicrohttpd_la-response.lo `test -f 'response.c' || echo '$(srcdir)/'`response.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-response.Tpo $(DEPDIR)/libmicrohttpd_la-response.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='response.c' object='libmicrohttpd_la-response.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-response.lo `test -f 'response.c' || echo '$(srcdir)/'`response.c + +libmicrohttpd_la-tsearch.lo: tsearch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-tsearch.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-tsearch.Tpo -c -o libmicrohttpd_la-tsearch.lo `test -f 'tsearch.c' || echo '$(srcdir)/'`tsearch.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-tsearch.Tpo $(DEPDIR)/libmicrohttpd_la-tsearch.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tsearch.c' object='libmicrohttpd_la-tsearch.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-tsearch.lo `test -f 'tsearch.c' || echo '$(srcdir)/'`tsearch.c + +libmicrohttpd_la-postprocessor.lo: postprocessor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-postprocessor.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-postprocessor.Tpo -c -o libmicrohttpd_la-postprocessor.lo `test -f 'postprocessor.c' || echo '$(srcdir)/'`postprocessor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-postprocessor.Tpo $(DEPDIR)/libmicrohttpd_la-postprocessor.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='postprocessor.c' object='libmicrohttpd_la-postprocessor.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-postprocessor.lo `test -f 'postprocessor.c' || echo '$(srcdir)/'`postprocessor.c + +libmicrohttpd_la-digestauth.lo: digestauth.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-digestauth.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-digestauth.Tpo -c -o libmicrohttpd_la-digestauth.lo `test -f 'digestauth.c' || echo '$(srcdir)/'`digestauth.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-digestauth.Tpo $(DEPDIR)/libmicrohttpd_la-digestauth.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='digestauth.c' object='libmicrohttpd_la-digestauth.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-digestauth.lo `test -f 'digestauth.c' || echo '$(srcdir)/'`digestauth.c + +libmicrohttpd_la-md5.lo: md5.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-md5.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-md5.Tpo -c -o libmicrohttpd_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-md5.Tpo $(DEPDIR)/libmicrohttpd_la-md5.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='md5.c' object='libmicrohttpd_la-md5.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c + +libmicrohttpd_la-basicauth.lo: basicauth.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-basicauth.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-basicauth.Tpo -c -o libmicrohttpd_la-basicauth.lo `test -f 'basicauth.c' || echo '$(srcdir)/'`basicauth.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-basicauth.Tpo $(DEPDIR)/libmicrohttpd_la-basicauth.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='basicauth.c' object='libmicrohttpd_la-basicauth.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-basicauth.lo `test -f 'basicauth.c' || echo '$(srcdir)/'`basicauth.c + +libmicrohttpd_la-base64.lo: base64.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-base64.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-base64.Tpo -c -o libmicrohttpd_la-base64.lo `test -f 'base64.c' || echo '$(srcdir)/'`base64.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-base64.Tpo $(DEPDIR)/libmicrohttpd_la-base64.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='base64.c' object='libmicrohttpd_la-base64.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-base64.lo `test -f 'base64.c' || echo '$(srcdir)/'`base64.c + +libmicrohttpd_la-connection_https.lo: connection_https.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -MT libmicrohttpd_la-connection_https.lo -MD -MP -MF $(DEPDIR)/libmicrohttpd_la-connection_https.Tpo -c -o libmicrohttpd_la-connection_https.lo `test -f 'connection_https.c' || echo '$(srcdir)/'`connection_https.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmicrohttpd_la-connection_https.Tpo $(DEPDIR)/libmicrohttpd_la-connection_https.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='connection_https.c' object='libmicrohttpd_la-connection_https.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) $(libmicrohttpd_la_CFLAGS) $(CFLAGS) -c -o libmicrohttpd_la-connection_https.lo `test -f 'connection_https.c' || echo '$(srcdir)/'`connection_https.c + +test_postprocessor-test_postprocessor.o: test_postprocessor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_CFLAGS) $(CFLAGS) -MT test_postprocessor-test_postprocessor.o -MD -MP -MF $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo -c -o test_postprocessor-test_postprocessor.o `test -f 'test_postprocessor.c' || echo '$(srcdir)/'`test_postprocessor.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo $(DEPDIR)/test_postprocessor-test_postprocessor.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor.c' object='test_postprocessor-test_postprocessor.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_CFLAGS) $(CFLAGS) -c -o test_postprocessor-test_postprocessor.o `test -f 'test_postprocessor.c' || echo '$(srcdir)/'`test_postprocessor.c + +test_postprocessor-test_postprocessor.obj: test_postprocessor.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_CFLAGS) $(CFLAGS) -MT test_postprocessor-test_postprocessor.obj -MD -MP -MF $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo -c -o test_postprocessor-test_postprocessor.obj `if test -f 'test_postprocessor.c'; then $(CYGPATH_W) 'test_postprocessor.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor-test_postprocessor.Tpo $(DEPDIR)/test_postprocessor-test_postprocessor.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor.c' object='test_postprocessor-test_postprocessor.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_CFLAGS) $(CFLAGS) -c -o test_postprocessor-test_postprocessor.obj `if test -f 'test_postprocessor.c'; then $(CYGPATH_W) 'test_postprocessor.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor.c'; fi` + +test_postprocessor_amp-test_postprocessor_amp.o: test_postprocessor_amp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_amp_CFLAGS) $(CFLAGS) -MT test_postprocessor_amp-test_postprocessor_amp.o -MD -MP -MF $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo -c -o test_postprocessor_amp-test_postprocessor_amp.o `test -f 'test_postprocessor_amp.c' || echo '$(srcdir)/'`test_postprocessor_amp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor_amp.c' object='test_postprocessor_amp-test_postprocessor_amp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_amp_CFLAGS) $(CFLAGS) -c -o test_postprocessor_amp-test_postprocessor_amp.o `test -f 'test_postprocessor_amp.c' || echo '$(srcdir)/'`test_postprocessor_amp.c + +test_postprocessor_amp-test_postprocessor_amp.obj: test_postprocessor_amp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_amp_CFLAGS) $(CFLAGS) -MT test_postprocessor_amp-test_postprocessor_amp.obj -MD -MP -MF $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo -c -o test_postprocessor_amp-test_postprocessor_amp.obj `if test -f 'test_postprocessor_amp.c'; then $(CYGPATH_W) 'test_postprocessor_amp.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_amp.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Tpo $(DEPDIR)/test_postprocessor_amp-test_postprocessor_amp.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor_amp.c' object='test_postprocessor_amp-test_postprocessor_amp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_amp_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_amp_CFLAGS) $(CFLAGS) -c -o test_postprocessor_amp-test_postprocessor_amp.obj `if test -f 'test_postprocessor_amp.c'; then $(CYGPATH_W) 'test_postprocessor_amp.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_amp.c'; fi` + +test_postprocessor_large-test_postprocessor_large.o: test_postprocessor_large.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_large_CFLAGS) $(CFLAGS) -MT test_postprocessor_large-test_postprocessor_large.o -MD -MP -MF $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo -c -o test_postprocessor_large-test_postprocessor_large.o `test -f 'test_postprocessor_large.c' || echo '$(srcdir)/'`test_postprocessor_large.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor_large.c' object='test_postprocessor_large-test_postprocessor_large.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_large_CFLAGS) $(CFLAGS) -c -o test_postprocessor_large-test_postprocessor_large.o `test -f 'test_postprocessor_large.c' || echo '$(srcdir)/'`test_postprocessor_large.c + +test_postprocessor_large-test_postprocessor_large.obj: test_postprocessor_large.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_large_CFLAGS) $(CFLAGS) -MT test_postprocessor_large-test_postprocessor_large.obj -MD -MP -MF $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo -c -o test_postprocessor_large-test_postprocessor_large.obj `if test -f 'test_postprocessor_large.c'; then $(CYGPATH_W) 'test_postprocessor_large.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_large.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Tpo $(DEPDIR)/test_postprocessor_large-test_postprocessor_large.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_postprocessor_large.c' object='test_postprocessor_large-test_postprocessor_large.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_postprocessor_large_CPPFLAGS) $(CPPFLAGS) $(test_postprocessor_large_CFLAGS) $(CFLAGS) -c -o test_postprocessor_large-test_postprocessor_large.obj `if test -f 'test_postprocessor_large.c'; then $(CYGPATH_W) 'test_postprocessor_large.c'; else $(CYGPATH_W) '$(srcdir)/test_postprocessor_large.c'; fi` + +test_shutdown_poll-test_shutdown_select.o: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_CFLAGS) $(CFLAGS) -MT test_shutdown_poll-test_shutdown_select.o -MD -MP -MF $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Tpo -c -o test_shutdown_poll-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_poll-test_shutdown_select.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_CFLAGS) $(CFLAGS) -c -o test_shutdown_poll-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c + +test_shutdown_poll-test_shutdown_select.obj: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_CFLAGS) $(CFLAGS) -MT test_shutdown_poll-test_shutdown_select.obj -MD -MP -MF $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Tpo -c -o test_shutdown_poll-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_poll-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_poll-test_shutdown_select.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_CFLAGS) $(CFLAGS) -c -o test_shutdown_poll-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` + +test_shutdown_poll_ignore-test_shutdown_select.o: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_ignore_CFLAGS) $(CFLAGS) -MT test_shutdown_poll_ignore-test_shutdown_select.o -MD -MP -MF $(DEPDIR)/test_shutdown_poll_ignore-test_shutdown_select.Tpo -c -o test_shutdown_poll_ignore-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_poll_ignore-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_poll_ignore-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_poll_ignore-test_shutdown_select.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_ignore_CFLAGS) $(CFLAGS) -c -o test_shutdown_poll_ignore-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c + +test_shutdown_poll_ignore-test_shutdown_select.obj: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_ignore_CFLAGS) $(CFLAGS) -MT test_shutdown_poll_ignore-test_shutdown_select.obj -MD -MP -MF $(DEPDIR)/test_shutdown_poll_ignore-test_shutdown_select.Tpo -c -o test_shutdown_poll_ignore-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_poll_ignore-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_poll_ignore-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_poll_ignore-test_shutdown_select.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_poll_ignore_CFLAGS) $(CFLAGS) -c -o test_shutdown_poll_ignore-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` + +test_shutdown_select-test_shutdown_select.o: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_CFLAGS) $(CFLAGS) -MT test_shutdown_select-test_shutdown_select.o -MD -MP -MF $(DEPDIR)/test_shutdown_select-test_shutdown_select.Tpo -c -o test_shutdown_select-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_select-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_select-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_select-test_shutdown_select.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_CFLAGS) $(CFLAGS) -c -o test_shutdown_select-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c + +test_shutdown_select-test_shutdown_select.obj: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_CFLAGS) $(CFLAGS) -MT test_shutdown_select-test_shutdown_select.obj -MD -MP -MF $(DEPDIR)/test_shutdown_select-test_shutdown_select.Tpo -c -o test_shutdown_select-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_select-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_select-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_select-test_shutdown_select.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_CFLAGS) $(CFLAGS) -c -o test_shutdown_select-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` + +test_shutdown_select_ignore-test_shutdown_select.o: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_ignore_CFLAGS) $(CFLAGS) -MT test_shutdown_select_ignore-test_shutdown_select.o -MD -MP -MF $(DEPDIR)/test_shutdown_select_ignore-test_shutdown_select.Tpo -c -o test_shutdown_select_ignore-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_select_ignore-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_select_ignore-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_select_ignore-test_shutdown_select.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_ignore_CFLAGS) $(CFLAGS) -c -o test_shutdown_select_ignore-test_shutdown_select.o `test -f 'test_shutdown_select.c' || echo '$(srcdir)/'`test_shutdown_select.c + +test_shutdown_select_ignore-test_shutdown_select.obj: test_shutdown_select.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_ignore_CFLAGS) $(CFLAGS) -MT test_shutdown_select_ignore-test_shutdown_select.obj -MD -MP -MF $(DEPDIR)/test_shutdown_select_ignore-test_shutdown_select.Tpo -c -o test_shutdown_select_ignore-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_shutdown_select_ignore-test_shutdown_select.Tpo $(DEPDIR)/test_shutdown_select_ignore-test_shutdown_select.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_shutdown_select.c' object='test_shutdown_select_ignore-test_shutdown_select.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_shutdown_select_ignore_CFLAGS) $(CFLAGS) -c -o test_shutdown_select_ignore-test_shutdown_select.obj `if test -f 'test_shutdown_select.c'; then $(CYGPATH_W) 'test_shutdown_select.c'; else $(CYGPATH_W) '$(srcdir)/test_shutdown_select.c'; fi` + +test_upgrade-test_upgrade.o: test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_CFLAGS) $(CFLAGS) -MT test_upgrade-test_upgrade.o -MD -MP -MF $(DEPDIR)/test_upgrade-test_upgrade.Tpo -c -o test_upgrade-test_upgrade.o `test -f 'test_upgrade.c' || echo '$(srcdir)/'`test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_upgrade-test_upgrade.Tpo $(DEPDIR)/test_upgrade-test_upgrade.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_upgrade.c' object='test_upgrade-test_upgrade.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_CFLAGS) $(CFLAGS) -c -o test_upgrade-test_upgrade.o `test -f 'test_upgrade.c' || echo '$(srcdir)/'`test_upgrade.c + +test_upgrade-test_upgrade.obj: test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_CFLAGS) $(CFLAGS) -MT test_upgrade-test_upgrade.obj -MD -MP -MF $(DEPDIR)/test_upgrade-test_upgrade.Tpo -c -o test_upgrade-test_upgrade.obj `if test -f 'test_upgrade.c'; then $(CYGPATH_W) 'test_upgrade.c'; else $(CYGPATH_W) '$(srcdir)/test_upgrade.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_upgrade-test_upgrade.Tpo $(DEPDIR)/test_upgrade-test_upgrade.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_upgrade.c' object='test_upgrade-test_upgrade.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_CFLAGS) $(CFLAGS) -c -o test_upgrade-test_upgrade.obj `if test -f 'test_upgrade.c'; then $(CYGPATH_W) 'test_upgrade.c'; else $(CYGPATH_W) '$(srcdir)/test_upgrade.c'; fi` + +test_upgrade_tls-test_upgrade.o: test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_tls_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_tls_CFLAGS) $(CFLAGS) -MT test_upgrade_tls-test_upgrade.o -MD -MP -MF $(DEPDIR)/test_upgrade_tls-test_upgrade.Tpo -c -o test_upgrade_tls-test_upgrade.o `test -f 'test_upgrade.c' || echo '$(srcdir)/'`test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_upgrade_tls-test_upgrade.Tpo $(DEPDIR)/test_upgrade_tls-test_upgrade.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_upgrade.c' object='test_upgrade_tls-test_upgrade.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_tls_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_tls_CFLAGS) $(CFLAGS) -c -o test_upgrade_tls-test_upgrade.o `test -f 'test_upgrade.c' || echo '$(srcdir)/'`test_upgrade.c + +test_upgrade_tls-test_upgrade.obj: test_upgrade.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_tls_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_tls_CFLAGS) $(CFLAGS) -MT test_upgrade_tls-test_upgrade.obj -MD -MP -MF $(DEPDIR)/test_upgrade_tls-test_upgrade.Tpo -c -o test_upgrade_tls-test_upgrade.obj `if test -f 'test_upgrade.c'; then $(CYGPATH_W) 'test_upgrade.c'; else $(CYGPATH_W) '$(srcdir)/test_upgrade.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_upgrade_tls-test_upgrade.Tpo $(DEPDIR)/test_upgrade_tls-test_upgrade.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_upgrade.c' object='test_upgrade_tls-test_upgrade.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_upgrade_tls_CPPFLAGS) $(CPPFLAGS) $(test_upgrade_tls_CFLAGS) $(CFLAGS) -c -o test_upgrade_tls-test_upgrade.obj `if test -f 'test_upgrade.c'; then $(CYGPATH_W) 'test_upgrade.c'; else $(CYGPATH_W) '$(srcdir)/test_upgrade.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test_str_compare.log: test_str_compare$(EXEEXT) + @p='test_str_compare$(EXEEXT)'; \ + b='test_str_compare'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_str_to_value.log: test_str_to_value$(EXEEXT) + @p='test_str_to_value$(EXEEXT)'; \ + b='test_str_to_value'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_str_token.log: test_str_token$(EXEEXT) + @p='test_str_token$(EXEEXT)'; \ + b='test_str_token'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_http_reasons.log: test_http_reasons$(EXEEXT) + @p='test_http_reasons$(EXEEXT)'; \ + b='test_http_reasons'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_start_stop.log: test_start_stop$(EXEEXT) + @p='test_start_stop$(EXEEXT)'; \ + b='test_start_stop'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_daemon.log: test_daemon$(EXEEXT) + @p='test_daemon$(EXEEXT)'; \ + b='test_daemon'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_options.log: test_options$(EXEEXT) + @p='test_options$(EXEEXT)'; \ + b='test_options'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_upgrade.log: test_upgrade$(EXEEXT) + @p='test_upgrade$(EXEEXT)'; \ + b='test_upgrade'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_upgrade_tls.log: test_upgrade_tls$(EXEEXT) + @p='test_upgrade_tls$(EXEEXT)'; \ + b='test_upgrade_tls'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_postprocessor.log: test_postprocessor$(EXEEXT) + @p='test_postprocessor$(EXEEXT)'; \ + b='test_postprocessor'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_postprocessor_large.log: test_postprocessor_large$(EXEEXT) + @p='test_postprocessor_large$(EXEEXT)'; \ + b='test_postprocessor_large'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_postprocessor_amp.log: test_postprocessor_amp$(EXEEXT) + @p='test_postprocessor_amp$(EXEEXT)'; \ + b='test_postprocessor_amp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_shutdown_select.log: test_shutdown_select$(EXEEXT) + @p='test_shutdown_select$(EXEEXT)'; \ + b='test_shutdown_select'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_shutdown_poll.log: test_shutdown_poll$(EXEEXT) + @p='test_shutdown_poll$(EXEEXT)'; \ + b='test_shutdown_poll'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_shutdown_select_ignore.log: test_shutdown_select_ignore$(EXEEXT) + @p='test_shutdown_select_ignore$(EXEEXT)'; \ + b='test_shutdown_select_ignore'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_shutdown_poll_ignore.log: test_shutdown_poll_ignore$(EXEEXT) + @p='test_shutdown_poll_ignore$(EXEEXT)'; \ + b='test_shutdown_poll_ignore'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man 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 mostlyclean-libtool pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am \ + uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +@W32_SHARED_LIB_EXP_TRUE@$(lt_cv_objdir)/libmicrohttpd.def: libmicrohttpd.la + +@W32_SHARED_LIB_EXP_TRUE@$(lt_cv_objdir)/libmicrohttpd.exp: $(lt_cv_objdir)/libmicrohttpd.lib + +@W32_SHARED_LIB_EXP_TRUE@$(lt_cv_objdir)/libmicrohttpd.lib: $(lt_cv_objdir)/libmicrohttpd.def libmicrohttpd.la $(libmicrohttpd_la_OBJECTS) +@USE_MS_LIB_TOOL_TRUE@@W32_SHARED_LIB_EXP_TRUE@ @echo Creating $@ and libmicrohttpd.exp by $(MS_LIB_TOOL)... && \ +@USE_MS_LIB_TOOL_TRUE@@W32_SHARED_LIB_EXP_TRUE@ dll_name=`$(EGREP) -o dlname=\'.+\' libmicrohttpd.la` && \ +@USE_MS_LIB_TOOL_TRUE@@W32_SHARED_LIB_EXP_TRUE@ dll_name=$${dll_name#*\'} && dll_name=$${dll_name%\'} && test -n "$$dll_name" && \ +@USE_MS_LIB_TOOL_TRUE@@W32_SHARED_LIB_EXP_TRUE@ echo Creating $$dll_name by $(MS_LIB_TOOL).. && cd "$(lt_cv_objdir)" && \ +@USE_MS_LIB_TOOL_TRUE@@W32_SHARED_LIB_EXP_TRUE@ $(MS_LIB_TOOL) -def:libmicrohttpd.def -name:$$dll_name -out:libmicrohttpd.lib $(libmicrohttpd_la_OBJECTS:.lo=.o) && cd .. +@USE_MS_LIB_TOOL_FALSE@@W32_SHARED_LIB_EXP_TRUE@ @echo Creating $@ and libmicrohttpd.exp by $(DLLTOOL)... && \ +@USE_MS_LIB_TOOL_FALSE@@W32_SHARED_LIB_EXP_TRUE@ dll_name=`$(EGREP) -o dlname=\'.+\' libmicrohttpd.la` && \ +@USE_MS_LIB_TOOL_FALSE@@W32_SHARED_LIB_EXP_TRUE@ dll_name=$${dll_name#*\'} && dll_name=$${dll_name%\'} && test -n "$$dll_name" && \ +@USE_MS_LIB_TOOL_FALSE@@W32_SHARED_LIB_EXP_TRUE@ echo Creating $$dll_name by $(DLLTOOL).. && cd "$(lt_cv_objdir)" && \ +@USE_MS_LIB_TOOL_FALSE@@W32_SHARED_LIB_EXP_TRUE@ $(DLLTOOL) -d ./libmicrohttpd.def -D $$dll_name -l libmicrohttpd.lib $(libmicrohttpd_la_OBJECTS:.lo=.o) -e ./libmicrohttpd.exp && cd .. &&\ +@USE_MS_LIB_TOOL_FALSE@@W32_SHARED_LIB_EXP_TRUE@ echo Created libmicrohttpd.exp and libmicrohttpd.lib. + +@W32_STATIC_LIB_TRUE@$(lt_cv_objdir)/libmicrohttpd-static.lib: libmicrohttpd.la $(libmicrohttpd_la_OBJECTS) +@USE_MS_LIB_TOOL_TRUE@@W32_STATIC_LIB_TRUE@ $(MS_LIB_TOOL) -out:$@ $(libmicrohttpd_la_OBJECTS:.lo=.o) +@USE_MS_LIB_TOOL_FALSE@@W32_STATIC_LIB_TRUE@ cp $(lt_cv_objdir)/libmicrohttpd.a $@ + +# General rule is not required, but keep it just in case +@HAVE_W32_TRUE@.rc.lo: +@HAVE_W32_TRUE@ $(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< -o $@ + +# To add dll resource only to .dll file and exclude it form static +# lib, a little trick was used. Allow libtool to create file.lo, +# file.o and .libs/file.lo, .libs/file.o files, then overwrite file.o +# by empty object generated from empty c-file. Later libtool will +# use .libs/file.o for shared lib and empty file.o for static lib. +# This implementation is based on trick found in liblzma. +# Note: windres does not understand '-isystem' flag, so all +# possible '-isystem' flags are replaced by simple '-I' flags. +@HAVE_W32_TRUE@$(MHD_DLL_RES_LO): $(MHD_DLL_RES_SRC) +@HAVE_W32_TRUE@ RC_CPP_FLAGS=" $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) " && \ +@HAVE_W32_TRUE@ $(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $${RC_CPP_FLAGS// -isystem / -I } $< -o $@ && \ +@HAVE_W32_TRUE@ echo > $@-empty.c && $(CC) $(AM_CFLAGS) $(CFLAGS) -c $@-empty.c -o $(@:.lo=.o) && rm -f $@-empty.c + +# 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: diff --git a/src/microhttpd/base64.c b/src/microhttpd/base64.c new file mode 100644 index 0000000..3dc7a14 --- /dev/null +++ b/src/microhttpd/base64.c @@ -0,0 +1,59 @@ +/* + * This code implements the BASE64 algorithm. + * This code is in the public domain; do with it what you wish. + * + * @file base64.c + * @brief This code implements the BASE64 algorithm + * @author Matthieu Speder + */ +#include "base64.h" + +static const char base64_digits[] = + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 0, 0, 0, -1, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + +char * +BASE64Decode(const char* src) +{ + size_t in_len = strlen (src); + char* dest; + char* result; + + if (in_len % 4) + { + /* Wrong base64 string length */ + return NULL; + } + result = dest = malloc(in_len / 4 * 3 + 1); + if (NULL == result) + return NULL; /* out of memory */ + while (*src) { + char a = base64_digits[(unsigned char)*(src++)]; + char b = base64_digits[(unsigned char)*(src++)]; + char c = base64_digits[(unsigned char)*(src++)]; + char d = base64_digits[(unsigned char)*(src++)]; + *(dest++) = (a << 2) | ((b & 0x30) >> 4); + if (c == (char)-1) + break; + *(dest++) = ((b & 0x0f) << 4) | ((c & 0x3c) >> 2); + if (d == (char)-1) + break; + *(dest++) = ((c & 0x03) << 6) | d; + } + *dest = 0; + return result; +} + + +/* end of base64.c */ diff --git a/src/microhttpd/base64.h b/src/microhttpd/base64.h new file mode 100644 index 0000000..ba96ca0 --- /dev/null +++ b/src/microhttpd/base64.h @@ -0,0 +1,17 @@ +/* + * This code implements the BASE64 algorithm. + * This code is in the public domain; do with it what you wish. + * + * @file base64.c + * @brief This code implements the BASE64 algorithm + * @author Matthieu Speder + */ +#ifndef BASE64_H +#define BASE64_H + +#include "platform.h" + +char * +BASE64Decode(const char* src); + +#endif /* !BASE64_H */ diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c new file mode 100644 index 0000000..4cb671e --- /dev/null +++ b/src/microhttpd/basicauth.c @@ -0,0 +1,164 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2010, 2011, 2012 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file basicauth.c + * @brief Implements HTTP basic authentication methods + * @author Amr Ali + * @author Matthieu Speder + */ +#include "platform.h" +#include "mhd_limits.h" +#include "internal.h" +#include "base64.h" +#include "mhd_compat.h" + +/** + * Beginning string for any valid Basic authentication header. + */ +#define _BASIC_BASE "Basic " + + +/** + * Get the username and password from the basic authorization header sent by the client + * + * @param connection The MHD connection structure + * @param password a pointer for the password + * @return NULL if no username could be found, a pointer + * to the username if found + * @ingroup authentication + */ +char * +MHD_basic_auth_get_username_password (struct MHD_Connection *connection, + char** password) +{ + const char *header; + char *decode; + const char *separator; + char *user; + + if ( (NULL == (header = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_AUTHORIZATION))) || + (0 != strncmp (header, + _BASIC_BASE, + MHD_STATICSTR_LEN_ (_BASIC_BASE))) ) + return NULL; + header += MHD_STATICSTR_LEN_ (_BASIC_BASE); + if (NULL == (decode = BASE64Decode (header))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Error decoding basic authentication\n")); +#endif + return NULL; + } + /* Find user:password pattern */ + if (NULL == (separator = strchr (decode, + ':'))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG(connection->daemon, + _("Basic authentication doesn't contain ':' separator\n")); +#endif + free (decode); + return NULL; + } + if (NULL == (user = strdup (decode))) + { + free (decode); + return NULL; + } + user[separator - decode] = '\0'; /* cut off at ':' */ + if (NULL != password) + { + *password = strdup (separator + 1); + if (NULL == *password) + { +#ifdef HAVE_MESSAGES + MHD_DLOG(connection->daemon, + _("Failed to allocate memory for password\n")); +#endif + free (decode); + free (user); + return NULL; + } + } + free (decode); + return user; +} + + +/** + * Queues a response to request basic authentication from the client. + * The given response object is expected to include the payload for + * the response; the "WWW-Authenticate" header will be added and the + * response queued with the 'UNAUTHORIZED' status code. + * + * @param connection The MHD connection structure + * @param realm the realm presented to the client + * @param response response object to modify and queue + * @return #MHD_YES on success, #MHD_NO otherwise + * @ingroup authentication + */ +int +MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, + const char *realm, + struct MHD_Response *response) +{ + int ret; + int res; + size_t hlen = strlen(realm) + strlen("Basic realm=\"\"") + 1; + char *header; + + header = (char *) malloc(hlen); + if (NULL == header) + { +#ifdef HAVE_MESSAGES + MHD_DLOG(connection->daemon, + "Failed to allocate memory for auth header\n"); +#endif /* HAVE_MESSAGES */ + return MHD_NO; + } + res = MHD_snprintf_ (header, + hlen, + "Basic realm=\"%s\"", + realm); + if (res > 0 && (size_t)res < hlen) + ret = MHD_add_response_header (response, + MHD_HTTP_HEADER_WWW_AUTHENTICATE, + header); + else + ret = MHD_NO; + + free(header); + if (MHD_YES == ret) + ret = MHD_queue_response (connection, + MHD_HTTP_UNAUTHORIZED, + response); + else + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to add Basic auth header\n")); +#endif /* HAVE_MESSAGES */ + } + return ret; +} + +/* end of basicauth.c */ diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c new file mode 100644 index 0000000..2865df2 --- /dev/null +++ b/src/microhttpd/connection.c @@ -0,0 +1,4020 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007-2017 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ +/** + * @file connection.c + * @brief Methods for managing connections + * @author Daniel Pittman + * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) + */ + +#include "internal.h" +#include "mhd_limits.h" +#include "connection.h" +#include "memorypool.h" +#include "response.h" +#include "mhd_mono_clock.h" +#include "mhd_str.h" +#include "mhd_locks.h" +#include "mhd_sockets.h" +#include "mhd_compat.h" +#include "mhd_itc.h" +#ifdef MHD_LINUX_SOLARIS_SENDFILE +#include +#endif /* MHD_LINUX_SOLARIS_SENDFILE */ +#if defined(HAVE_FREEBSD_SENDFILE) || defined(HAVE_DARWIN_SENDFILE) +#include +#include +#include +#endif /* HAVE_FREEBSD_SENDFILE || HAVE_DARWIN_SENDFILE */ +#ifdef HTTPS_SUPPORT +#include "connection_https.h" +#endif /* HTTPS_SUPPORT */ + + +/** + * Message to transmit when http 1.1 request is received + */ +#define HTTP_100_CONTINUE "HTTP/1.1 100 Continue\r\n\r\n" + +/** + * Response text used when the request (http header) is too big to + * be processed. + * + * Intentionally empty here to keep our memory footprint + * minimal. + */ +#ifdef HAVE_MESSAGES +#define REQUEST_TOO_BIG "Request too bigYour HTTP header was too big for the memory constraints of this webserver." +#else +#define REQUEST_TOO_BIG "" +#endif + +/** + * Response text used when the request (http header) does not + * contain a "Host:" header and still claims to be HTTP 1.1. + * + * Intentionally empty here to keep our memory footprint + * minimal. + */ +#ifdef HAVE_MESSAGES +#define REQUEST_LACKS_HOST ""Host:" header requiredIn HTTP 1.1, requests must include a "Host:" header, and your HTTP 1.1 request lacked such a header." +#else +#define REQUEST_LACKS_HOST "" +#endif + +/** + * Response text used when the request (http header) is + * malformed. + * + * Intentionally empty here to keep our memory footprint + * minimal. + */ +#ifdef HAVE_MESSAGES +#define REQUEST_MALFORMED "Request malformedYour HTTP request was syntactically incorrect." +#else +#define REQUEST_MALFORMED "" +#endif + +/** + * Response text used when there is an internal server error. + * + * Intentionally empty here to keep our memory footprint + * minimal. + */ +#ifdef HAVE_MESSAGES +#define INTERNAL_ERROR "Internal server errorPlease ask the developer of this Web server to carefully read the GNU libmicrohttpd documentation about connection management and blocking." +#else +#define INTERNAL_ERROR "" +#endif + +/** + * Add extra debug messages with reasons for closing connections + * (non-error reasons). + */ +#define DEBUG_CLOSE MHD_NO + +/** + * Should all data send be printed to stderr? + */ +#define DEBUG_SEND_DATA MHD_NO + + +/** + * sendfile() chuck size + */ +#define MHD_SENFILE_CHUNK_ (0x20000) + +/** + * sendfile() chuck size for thread-per-connection + */ +#define MHD_SENFILE_CHUNK_THR_P_C_ (0x200000) + +#ifdef HAVE_FREEBSD_SENDFILE +#ifdef SF_FLAGS +/** + * FreeBSD sendfile() flags + */ +static int freebsd_sendfile_flags_; + +/** + * FreeBSD sendfile() flags for thread-per-connection + */ +static int freebsd_sendfile_flags_thd_p_c_; +#endif /* SF_FLAGS */ +/** + * Initialises static variables + */ +void +MHD_conn_init_static_ (void) +{ +/* FreeBSD 11 and later allow to specify read-ahead size + * and handles SF_NODISKIO differently. + * SF_FLAGS defined only on FreeBSD 11 and later. */ +#ifdef SF_FLAGS + long sys_page_size = sysconf (_SC_PAGESIZE); + if (0 > sys_page_size) + { /* Failed to get page size. */ + freebsd_sendfile_flags_ = SF_NODISKIO; + freebsd_sendfile_flags_thd_p_c_ = SF_NODISKIO; + } + else + { + freebsd_sendfile_flags_ = + SF_FLAGS((uint16_t)(MHD_SENFILE_CHUNK_ / sys_page_size), SF_NODISKIO); + freebsd_sendfile_flags_thd_p_c_ = + SF_FLAGS((uint16_t)(MHD_SENFILE_CHUNK_THR_P_C_ / sys_page_size), SF_NODISKIO); + } +#endif /* SF_FLAGS */ +} +#endif /* HAVE_FREEBSD_SENDFILE */ +/** + * Callback for receiving data from the socket. + * + * @param connection the MHD connection structure + * @param other where to write received data to + * @param i maximum size of other (in bytes) + * @return positive value for number of bytes actually received or + * negative value for error number MHD_ERR_xxx_ + */ +static ssize_t +recv_param_adapter (struct MHD_Connection *connection, + void *other, + size_t i) +{ + ssize_t ret; + + if ( (MHD_INVALID_SOCKET == connection->socket_fd) || + (MHD_CONNECTION_CLOSED == connection->state) ) + { + return MHD_ERR_NOTCONN_; + } + if (i > MHD_SCKT_SEND_MAX_SIZE_) + i = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */ + + ret = MHD_recv_ (connection->socket_fd, + other, + i); + if (0 > ret) + { + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EAGAIN_ (err)) + { +#ifdef EPOLL_SUPPORT + /* Got EAGAIN --- no longer read-ready */ + connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; +#endif /* EPOLL_SUPPORT */ + return MHD_ERR_AGAIN_; + } + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + return MHD_ERR_AGAIN_; + if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_ECONNRESET_)) + return MHD_ERR_CONNRESET_; + /* Treat any other error as hard error. */ + return MHD_ERR_NOTCONN_; + } +#ifdef EPOLL_SUPPORT + else if (i > (size_t)ret) + connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; +#endif /* EPOLL_SUPPORT */ + return ret; +} + + +/** + * Callback for writing data to the socket. + * + * @param connection the MHD connection structure + * @param other data to write + * @param i number of bytes to write + * @return positive value for number of bytes actually sent or + * negative value for error number MHD_ERR_xxx_ + */ +static ssize_t +send_param_adapter (struct MHD_Connection *connection, + const void *other, + size_t i) +{ + ssize_t ret; + + if ( (MHD_INVALID_SOCKET == connection->socket_fd) || + (MHD_CONNECTION_CLOSED == connection->state) ) + { + return MHD_ERR_NOTCONN_; + } + if (i > MHD_SCKT_SEND_MAX_SIZE_) + i = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */ + + ret = MHD_send_ (connection->socket_fd, + other, + i); + if (0 > ret) + { + const int err = MHD_socket_get_error_(); + + if (MHD_SCKT_ERR_IS_EAGAIN_(err)) + { +#ifdef EPOLL_SUPPORT + /* EAGAIN --- no longer write-ready */ + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; +#endif /* EPOLL_SUPPORT */ + return MHD_ERR_AGAIN_; + } + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + return MHD_ERR_AGAIN_; + if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_ECONNRESET_)) + return MHD_ERR_CONNRESET_; + /* Treat any other error as hard error. */ + return MHD_ERR_NOTCONN_; + } +#ifdef EPOLL_SUPPORT + else if (i > (size_t)ret) + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; +#endif /* EPOLL_SUPPORT */ + return ret; +} + + +#if defined(_MHD_HAVE_SENDFILE) +/** + * Function for sending responses backed by file FD. + * + * @param connection the MHD connection structure + * @return actual number of bytes sent + */ +static ssize_t +sendfile_adapter (struct MHD_Connection *connection) +{ + ssize_t ret; + const int file_fd = connection->response->fd; + uint64_t left; + uint64_t offsetu64; +#ifndef HAVE_SENDFILE64 + const uint64_t max_off_t = (uint64_t)OFF_T_MAX; +#else /* HAVE_SENDFILE64 */ + const uint64_t max_off_t = (uint64_t)OFF64_T_MAX; +#endif /* HAVE_SENDFILE64 */ +#ifdef MHD_LINUX_SOLARIS_SENDFILE +#ifndef HAVE_SENDFILE64 + off_t offset; +#else /* HAVE_SENDFILE64 */ + off64_t offset; +#endif /* HAVE_SENDFILE64 */ +#endif /* MHD_LINUX_SOLARIS_SENDFILE */ +#ifdef HAVE_FREEBSD_SENDFILE + off_t sent_bytes; + int flags = 0; +#endif +#ifdef HAVE_DARWIN_SENDFILE + off_t len; +#endif /* HAVE_DARWIN_SENDFILE */ + const bool used_thr_p_c = (0 != (connection->daemon->options & MHD_USE_THREAD_PER_CONNECTION)); + const size_t chunk_size = used_thr_p_c ? MHD_SENFILE_CHUNK_THR_P_C_ : MHD_SENFILE_CHUNK_; + size_t send_size = 0; + mhd_assert (MHD_resp_sender_sendfile == connection->resp_sender); + + offsetu64 = connection->response_write_position + connection->response->fd_off; + left = connection->response->total_size - connection->response_write_position; + /* Do not allow system to stick sending on single fast connection: + * use 128KiB chunks (2MiB for thread-per-connection). */ + send_size = (left > chunk_size) ? chunk_size : (size_t) left; + if (max_off_t < offsetu64) + { /* Retry to send with standard 'send()'. */ + connection->resp_sender = MHD_resp_sender_std; + return MHD_ERR_AGAIN_; + } +#ifdef MHD_LINUX_SOLARIS_SENDFILE +#ifndef HAVE_SENDFILE64 + offset = (off_t) offsetu64; + ret = sendfile (connection->socket_fd, + file_fd, + &offset, + send_size); +#else /* HAVE_SENDFILE64 */ + offset = (off64_t) offsetu64; + ret = sendfile64 (connection->socket_fd, + file_fd, + &offset, + send_size); +#endif /* HAVE_SENDFILE64 */ + if (0 > ret) + { + const int err = MHD_socket_get_error_(); + if (MHD_SCKT_ERR_IS_EAGAIN_(err)) + { +#ifdef EPOLL_SUPPORT + /* EAGAIN --- no longer write-ready */ + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; +#endif /* EPOLL_SUPPORT */ + return MHD_ERR_AGAIN_; + } + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + return MHD_ERR_AGAIN_; +#ifdef HAVE_LINUX_SENDFILE + if (MHD_SCKT_ERR_IS_(err, + MHD_SCKT_EBADF_)) + return MHD_ERR_BADF_; + /* sendfile() failed with EINVAL if mmap()-like operations are not + supported for FD or other 'unusual' errors occurred, so we should try + to fall back to 'SEND'; see also this thread for info on + odd libc/Linux behavior with sendfile: + http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ + connection->resp_sender = MHD_resp_sender_std; + return MHD_ERR_AGAIN_; +#else /* HAVE_SOLARIS_SENDFILE */ + if ( (EAFNOSUPPORT == err) || + (EINVAL == err) || + (EOPNOTSUPP == err) ) + { /* Retry with standard file reader. */ + connection->resp_sender = MHD_resp_sender_std; + return MHD_ERR_AGAIN_; + } + if ( (ENOTCONN == err) || + (EPIPE == err) ) + { + return MHD_ERR_CONNRESET_; + } + return MHD_ERR_BADF_; /* Fail hard */ +#endif /* HAVE_SOLARIS_SENDFILE */ + } +#ifdef EPOLL_SUPPORT + else if (send_size > (size_t)ret) + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; +#endif /* EPOLL_SUPPORT */ +#elif defined(HAVE_FREEBSD_SENDFILE) +#ifdef SF_FLAGS + flags = used_thr_p_c ? + freebsd_sendfile_flags_thd_p_c_ : freebsd_sendfile_flags_; +#endif /* SF_FLAGS */ + if (0 != sendfile (file_fd, + connection->socket_fd, + (off_t) offsetu64, + send_size, + NULL, + &sent_bytes, + flags)) + { + const int err = MHD_socket_get_error_(); + if (MHD_SCKT_ERR_IS_EAGAIN_(err) || + MHD_SCKT_ERR_IS_EINTR_(err) || + EBUSY == err) + { + mhd_assert (SSIZE_MAX >= sent_bytes); + if (0 != sent_bytes) + return (ssize_t)sent_bytes; + + return MHD_ERR_AGAIN_; + } + /* Some unrecoverable error. Possibly file FD is not suitable + * for sendfile(). Retry with standard send(). */ + connection->resp_sender = MHD_resp_sender_std; + return MHD_ERR_AGAIN_; + } + mhd_assert (0 < sent_bytes); + mhd_assert (SSIZE_MAX >= sent_bytes); + ret = (ssize_t)sent_bytes; +#elif defined(HAVE_DARWIN_SENDFILE) + len = (off_t)send_size; /* chunk always fit */ + if (0 != sendfile (file_fd, + connection->socket_fd, + (off_t) offsetu64, + &len, + NULL, + 0)) + { + const int err = MHD_socket_get_error_(); + if (MHD_SCKT_ERR_IS_EAGAIN_(err) || + MHD_SCKT_ERR_IS_EINTR_(err)) + { + mhd_assert (0 <= len); + mhd_assert (SSIZE_MAX >= len); + mhd_assert (send_size >= (size_t)len); + if (0 != len) + return (ssize_t)len; + + return MHD_ERR_AGAIN_; + } + if (ENOTCONN == err || + EPIPE == err) + return MHD_ERR_CONNRESET_; + if (ENOTSUP == err || + EOPNOTSUPP == err) + { /* This file FD is not suitable for sendfile(). + * Retry with standard send(). */ + connection->resp_sender = MHD_resp_sender_std; + return MHD_ERR_AGAIN_; + } + return MHD_ERR_BADF_; /* Return hard error. */ + } + mhd_assert (0 <= len); + mhd_assert (SSIZE_MAX >= len); + mhd_assert (send_size >= (size_t)len); + ret = (ssize_t)len; +#endif /* HAVE_FREEBSD_SENDFILE */ + return ret; +} +#endif /* _MHD_HAVE_SENDFILE */ + + +/** + * Check whether is possible to force push socket buffer content as + * partial packet. + * MHD use different buffering logic depending on whether flushing of + * socket buffer is possible or not. + * If flushing IS possible than MHD activates extra buffering before + * sending data to prevent sending partial packets and flush pending + * data in socket buffer to push last partial packet to client after + * sending logical completed part of data (for example: after sending + * full response header or full response message). + * If flushing IS NOT possible than MHD activates no buffering (no + * delay sending) when it going to send formed fully completed logical + * part of data and activate normal buffering after sending. + * For idled keep-alive connection MHD always activate normal + * buffering. + * + * @param connection connection to check + * @return #MHD_YES if force push is possible, #MHD_NO otherwise + */ +static int +socket_flush_possible(struct MHD_Connection *connection) +{ + (void)connection; /* Mute compiler warning. */ +#if defined(TCP_CORK) || defined(TCP_PUSH) + return MHD_YES; +#else /* !TCP_CORK && !TCP_PUSH */ + return MHD_NO; +#endif /* !TCP_CORK && !TCP_PUSH */ +} + + +/** + * Activate extra buffering mode on connection socket to prevent + * sending of partial packets. + * + * @param connection connection to be processed + * @return #MHD_YES on success, #MHD_NO otherwise + */ +static int +socket_start_extra_buffering (struct MHD_Connection *connection) +{ + int res = MHD_NO; + (void)connection; /* Mute compiler warning. */ +#if defined(TCP_CORK) || defined(TCP_NOPUSH) + const MHD_SCKT_OPT_BOOL_ on_val = 1; +#if defined(TCP_NODELAY) + const MHD_SCKT_OPT_BOOL_ off_val = 0; +#endif /* TCP_NODELAY */ + mhd_assert(NULL != connection); +#if defined(TCP_NOPUSH) && !defined(TCP_CORK) + /* Buffer data before sending */ + res = (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NOPUSH, + (const void *) &on_val, + sizeof (on_val))) + ? MHD_YES : MHD_NO; +#if defined(TCP_NODELAY) + /* Enable Nagle's algorithm */ + /* TCP_NODELAY may interfere with TCP_NOPUSH */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_NODELAY */ +#else /* TCP_CORK */ +#if defined(TCP_NODELAY) + /* Enable Nagle's algorithm */ + /* TCP_NODELAY may prevent enabling TCP_CORK. Resulting buffering mode depends + solely on TCP_CORK result, so ignoring return code here. */ + (void) setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) &off_val, + sizeof (off_val)); +#endif /* TCP_NODELAY */ + /* Send only full packets */ + res = (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_CORK, + (const void *) &on_val, + sizeof (on_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_CORK */ +#endif /* TCP_CORK || TCP_NOPUSH */ + return res; +} + + +/** + * Activate no buffering mode (no delay sending) on connection socket. + * + * @param connection connection to be processed + * @return #MHD_YES on success, #MHD_NO otherwise + */ +static int +socket_start_no_buffering (struct MHD_Connection *connection) +{ +#if defined(TCP_NODELAY) + int res = MHD_YES; + const MHD_SCKT_OPT_BOOL_ on_val = 1; +#if defined(TCP_CORK) || defined(TCP_NOPUSH) + const MHD_SCKT_OPT_BOOL_ off_val = 0; +#endif /* TCP_CORK || TCP_NOPUSH */ + + (void)connection; /* Mute compiler warning. */ + mhd_assert(NULL != connection); +#if defined(TCP_CORK) + /* Allow partial packets */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_CORK, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_CORK */ +#if defined(TCP_NODELAY) + /* Disable Nagle's algorithm for sending packets without delay */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) &on_val, + sizeof (on_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_NODELAY */ +#if defined(TCP_NOPUSH) && !defined(TCP_CORK) + /* Disable extra buffering */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NOPUSH, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_NOPUSH && !TCP_CORK */ + return res; +#else /* !TCP_NODELAY */ + return MHD_NO; +#endif /* !TCP_NODELAY */ +} + + +/** + * Activate no buffering mode (no delay sending) on connection socket + * and push to client data pending in socket buffer. + * + * @param connection connection to be processed + * @return #MHD_YES on success, #MHD_NO otherwise + */ +static int +socket_start_no_buffering_flush (struct MHD_Connection *connection) +{ + int res = MHD_YES; +#if defined(TCP_NOPUSH) && !defined(TCP_CORK) + const int dummy = 0; +#endif /* !TCP_CORK */ + + if (NULL == connection) + return MHD_NO; + res = socket_start_no_buffering (connection); +#if defined(TCP_NOPUSH) && !defined(TCP_CORK) + /* Force flush data with zero send otherwise Darwin and some BSD systems + will add 5 seconds delay. Not required with TCP_CORK as switching off + TCP_CORK always flushes socket buffer. */ + res &= (0 <= MHD_send_ (connection->socket_fd, + &dummy, + 0)) + ? MHD_YES : MHD_NO; +#endif /* TCP_NOPUSH && !TCP_CORK*/ + return res; +} + + +/** + * Activate normal buffering mode on connection socket. + * + * @param connection connection to be processed + * @return #MHD_YES on success, #MHD_NO otherwise + */ +static int +socket_start_normal_buffering (struct MHD_Connection *connection) +{ +#if defined(TCP_NODELAY) + int res = MHD_YES; + const MHD_SCKT_OPT_BOOL_ off_val = 0; +#if defined(TCP_CORK) + MHD_SCKT_OPT_BOOL_ cork_val = 0; + socklen_t param_size = sizeof (cork_val); +#endif /* TCP_CORK */ + mhd_assert(NULL != connection); +#if defined(TCP_CORK) + /* Allow partial packets */ + /* Disabling TCP_CORK will flush partial packet even if TCP_CORK wasn't enabled before + so try to check current value of TCP_CORK to prevent unrequested flushing */ + if ( (0 != getsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_CORK, + (void*)&cork_val, + ¶m_size)) || + (0 != cork_val)) + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_CORK, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#elif defined(TCP_NOPUSH) + /* Disable extra buffering */ + /* No need to check current value as disabling TCP_NOPUSH will not flush partial + packet if TCP_NOPUSH wasn't enabled before */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NOPUSH, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; +#endif /* TCP_NOPUSH && !TCP_CORK */ + /* Enable Nagle's algorithm for normal buffering */ + res &= (0 == setsockopt (connection->socket_fd, + IPPROTO_TCP, + TCP_NODELAY, + (const void *) &off_val, + sizeof (off_val))) + ? MHD_YES : MHD_NO; + return res; +#else /* !TCP_NODELAY */ + return MHD_NO; +#endif /* !TCP_NODELAY */ +} + + +/** + * Get all of the headers from the request. + * + * @param connection connection to get values from + * @param kind types of values to iterate over, can be a bitmask + * @param iterator callback to call on each header; + * maybe NULL (then just count headers) + * @param iterator_cls extra argument to @a iterator + * @return number of entries iterated over + * @ingroup request + */ +int +MHD_get_connection_values (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + MHD_KeyValueIterator iterator, + void *iterator_cls) +{ + int ret; + struct MHD_HTTP_Header *pos; + + if (NULL == connection) + return -1; + ret = 0; + for (pos = connection->headers_received; NULL != pos; pos = pos->next) + if (0 != (pos->kind & kind)) + { + ret++; + if ( (NULL != iterator) && + (MHD_YES != iterator (iterator_cls, + pos->kind, + pos->header, + pos->value)) ) + return ret; + } + return ret; +} + + +/** + * This function can be used to add an entry to the HTTP headers of a + * connection (so that the #MHD_get_connection_values function will + * return them -- and the `struct MHD_PostProcessor` will also see + * them). This maybe required in certain situations (see Mantis + * #1399) where (broken) HTTP implementations fail to supply values + * needed by the post processor (or other parts of the application). + * + * This function MUST only be called from within the + * #MHD_AccessHandlerCallback (otherwise, access maybe improperly + * synchronized). Furthermore, the client must guarantee that the key + * and value arguments are 0-terminated strings that are NOT freed + * until the connection is closed. (The easiest way to do this is by + * passing only arguments to permanently allocated strings.). + * + * @param connection the connection for which a + * value should be set + * @param kind kind of the value + * @param key key for the value + * @param value the value itself + * @return #MHD_NO if the operation could not be + * performed due to insufficient memory; + * #MHD_YES on success + * @ingroup request + */ +int +MHD_set_connection_value (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + const char *key, + const char *value) +{ + struct MHD_HTTP_Header *pos; + + pos = MHD_pool_allocate (connection->pool, + sizeof (struct MHD_HTTP_Header), + MHD_YES); + if (NULL == pos) + return MHD_NO; + pos->header = (char *) key; + pos->value = (char *) value; + pos->kind = kind; + pos->next = NULL; + /* append 'pos' to the linked list of headers */ + if (NULL == connection->headers_received_tail) + { + connection->headers_received = pos; + connection->headers_received_tail = pos; + } + else + { + connection->headers_received_tail->next = pos; + connection->headers_received_tail = pos; + } + return MHD_YES; +} + + +/** + * Get a particular header value. If multiple + * values match the kind, return any one of them. + * + * @param connection connection to get values from + * @param kind what kind of value are we looking for + * @param key the header to look for, NULL to lookup 'trailing' value without a key + * @return NULL if no such item was found + * @ingroup request + */ +const char * +MHD_lookup_connection_value (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + const char *key) +{ + struct MHD_HTTP_Header *pos; + + if (NULL == connection) + return NULL; + for (pos = connection->headers_received; NULL != pos; pos = pos->next) + if ((0 != (pos->kind & kind)) && + ( (key == pos->header) || + ( (NULL != pos->header) && + (NULL != key) && + (MHD_str_equal_caseless_(key, + pos->header))))) + return pos->value; + return NULL; +} + + +/** + * Check whether request header contains particular token. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param connection the connection to get values from + * @param header the header name + * @param token the token to find + * @param token_len the length of token, not including optional + * terminating null-character. + * @return true if token is found in specified header, + * false otherwise + */ +static bool +MHD_lookup_header_token_ci (const struct MHD_Connection *connection, + const char *header, + const char *token, + size_t token_len) +{ + struct MHD_HTTP_Header *pos; + + if (NULL == connection || NULL == header || 0 == header[0] || NULL == token || 0 == token[0]) + return false; + for (pos = connection->headers_received; NULL != pos; pos = pos->next) + { + if ((0 != (pos->kind & MHD_HEADER_KIND)) && + ( (header == pos->header) || + (MHD_str_equal_caseless_(header, + pos->header)) ) && + (MHD_str_has_token_caseless_ (pos->value, token, token_len))) + return true; + } + return false; +} + + +/** + * Check whether request header contains particular static @a tkn. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param c the connection to get values from + * @param h the header name + * @param tkn the static string of token to find + * @return true if token is found in specified header, + * false otherwise + */ +#define MHD_lookup_header_s_token_ci(c,h,tkn) \ + MHD_lookup_header_token_ci((c),(h),(tkn),MHD_STATICSTR_LEN_(tkn)) + + +/** + * Do we (still) need to send a 100 continue + * message for this connection? + * + * @param connection connection to test + * @return 0 if we don't need 100 CONTINUE, 1 if we do + */ +static int +need_100_continue (struct MHD_Connection *connection) +{ + const char *expect; + + return ( (NULL == connection->response) && + (NULL != connection->version) && + (MHD_str_equal_caseless_(connection->version, + MHD_HTTP_VERSION_1_1)) && + (NULL != (expect = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_EXPECT))) && + (MHD_str_equal_caseless_(expect, + "100-continue")) && + (connection->continue_message_write_offset < + MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE)) ); +} + + +/** + * Mark connection as "closed". + * @remark To be called from any thread. + * + * @param connection connection to close + */ +void +MHD_connection_mark_closed_ (struct MHD_Connection *connection) +{ + const struct MHD_Daemon *daemon = connection->daemon; + + connection->state = MHD_CONNECTION_CLOSED; + connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; + if (0 == (daemon->options & MHD_USE_TURBO)) + { +#ifdef HTTPS_SUPPORT + /* For TLS connection use shutdown of TLS layer + * and do not shutdown TCP socket. This give more + * chances to send TLS closure data to remote side. + * Closure of TLS layer will be interpreted by + * remote side as end of transmission. */ + if (0 != (daemon->options & MHD_USE_TLS)) + { + if (! MHD_tls_connection_shutdown(connection)) + shutdown (connection->socket_fd, + SHUT_WR); + } + else /* Combined with next 'shutdown()'. */ +#endif /* HTTPS_SUPPORT */ + shutdown (connection->socket_fd, + SHUT_WR); + } +} + + +/** + * Close the given connection and give the + * specified termination code to the user. + * @remark To be called only from thread that + * process connection's recv(), send() and response. + * + * @param connection connection to close + * @param termination_code termination reason to give + */ +void +MHD_connection_close_ (struct MHD_Connection *connection, + enum MHD_RequestTerminationCode termination_code) +{ + struct MHD_Daemon *daemon = connection->daemon; + struct MHD_Response *resp = connection->response; + + MHD_connection_mark_closed_ (connection); + if (NULL != resp) + { + connection->response = NULL; + MHD_destroy_response (resp); + } + if ( (NULL != daemon->notify_completed) && + (connection->client_aware) ) + daemon->notify_completed (daemon->notify_completed_cls, + connection, + &connection->client_context, + termination_code); + connection->client_aware = false; +} + + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) +/** + * Stop TLS forwarding on upgraded connection and + * reflect remote disconnect state to socketpair. + * @remark In thread-per-connection mode this function + * can be called from any thread, in other modes this + * function must be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param connection the upgraded connection + */ +void +MHD_connection_finish_forward_ (struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + struct MHD_UpgradeResponseHandle *urh = connection->urh; + + if (0 == (daemon->options & MHD_USE_TLS)) + return; /* Nothing to do with non-TLS connection. */ + + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + DLL_remove (daemon->urh_head, + daemon->urh_tail, + urh); +#if EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_DEL, + connection->socket_fd, + NULL)) ) + { + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + } + if (urh->in_eready_list) + { + EDLL_remove (daemon->eready_urh_head, + daemon->eready_urh_tail, + urh); + urh->in_eready_list = false; + } +#endif /* EPOLL_SUPPORT */ + if (MHD_INVALID_SOCKET != urh->mhd.socket) + { +#if EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_DEL, + urh->mhd.socket, + NULL)) ) + { + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + } +#endif /* EPOLL_SUPPORT */ + /* Reflect remote disconnect to application by breaking + * socketpair connection. */ + shutdown (urh->mhd.socket, SHUT_RDWR); + } + /* Socketpair sockets will remain open as they will be + * used with MHD_UPGRADE_ACTION_CLOSE. They will be + * closed by MHD_cleanup_upgraded_connection_() during + * connection's final cleanup. + */ +} +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/ + + +/** + * A serious error occured, close the + * connection (and notify the application). + * + * @param connection connection to close with error + * @param emsg error message (can be NULL) + */ +static void +connection_close_error (struct MHD_Connection *connection, + const char *emsg) +{ +#ifdef HAVE_MESSAGES + if (NULL != emsg) + MHD_DLOG (connection->daemon, + emsg); +#else /* ! HAVE_MESSAGES */ + (void)emsg; /* Mute compiler warning. */ +#endif /* ! HAVE_MESSAGES */ + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_WITH_ERROR); +} + + +/** + * Macro to only include error message in call to + * #connection_close_error() if we have HAVE_MESSAGES. + */ +#ifdef HAVE_MESSAGES +#define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, emsg) +#else +#define CONNECTION_CLOSE_ERROR(c, emsg) connection_close_error (c, NULL) +#endif + + +/** + * Prepare the response buffer of this connection for + * sending. Assumes that the response mutex is + * already held. If the transmission is complete, + * this function may close the socket (and return + * #MHD_NO). + * + * @param connection the connection + * @return #MHD_NO if readying the response failed (the + * lock on the response will have been released already + * in this case). + */ +static int +try_ready_normal_body (struct MHD_Connection *connection) +{ + ssize_t ret; + struct MHD_Response *response; + + response = connection->response; + if (NULL == response->crc) + return MHD_YES; + if ( (0 == response->total_size) || + (connection->response_write_position == response->total_size) ) + return MHD_YES; /* 0-byte response is always ready */ + if ( (response->data_start <= + connection->response_write_position) && + (response->data_size + response->data_start > + connection->response_write_position) ) + return MHD_YES; /* response already ready */ +#if defined(_MHD_HAVE_SENDFILE) + if (MHD_resp_sender_sendfile == connection->resp_sender) + { + /* will use sendfile, no need to bother response crc */ + return MHD_YES; + } +#endif /* _MHD_HAVE_SENDFILE */ + + ret = response->crc (response->crc_cls, + connection->response_write_position, + response->data, + (size_t) MHD_MIN ((uint64_t)response->data_buffer_size, + response->total_size - + connection->response_write_position)); + if ( (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret) || + (((ssize_t) MHD_CONTENT_READER_END_WITH_ERROR) == ret) ) + { + /* either error or http 1.0 transfer, close socket! */ + response->total_size = connection->response_write_position; + MHD_mutex_unlock_chk_ (&response->mutex); + if ( ((ssize_t)MHD_CONTENT_READER_END_OF_STREAM) == ret) + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_COMPLETED_OK); + else + CONNECTION_CLOSE_ERROR (connection, + _("Closing connection (application reported error generating data)\n")); + return MHD_NO; + } + response->data_start = connection->response_write_position; + response->data_size = ret; + if (0 == ret) + { + connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY; + MHD_mutex_unlock_chk_ (&response->mutex); + return MHD_NO; + } + return MHD_YES; +} + + +/** + * Prepare the response buffer of this connection for sending. + * Assumes that the response mutex is already held. If the + * transmission is complete, this function may close the socket (and + * return #MHD_NO). + * + * @param connection the connection + * @return #MHD_NO if readying the response failed + */ +static int +try_ready_chunked_body (struct MHD_Connection *connection) +{ + ssize_t ret; + char *buf; + struct MHD_Response *response; + size_t size; + char cbuf[10]; /* 10: max strlen of "%x\r\n" */ + int cblen; + + response = connection->response; + if (NULL == response->crc) + return MHD_YES; + if (0 == connection->write_buffer_size) + { + size = MHD_MIN (connection->daemon->pool_size, + 2 * (0xFFFFFF + sizeof(cbuf) + 2)); + do + { + size /= 2; + if (size < 128) + { + MHD_mutex_unlock_chk_ (&response->mutex); + /* not enough memory */ + CONNECTION_CLOSE_ERROR (connection, + _("Closing connection (out of memory)\n")); + return MHD_NO; + } + buf = MHD_pool_allocate (connection->pool, + size, + MHD_NO); + } + while (NULL == buf); + connection->write_buffer_size = size; + connection->write_buffer = buf; + } + + if (0 == response->total_size) + ret = 0; /* response must be empty, don't bother calling crc */ + else if ( (response->data_start <= + connection->response_write_position) && + (response->data_start + response->data_size > + connection->response_write_position) ) + { + /* difference between response_write_position and data_start is less + than data_size which is size_t type, no need to check for overflow */ + const size_t data_write_offset + = (size_t)(connection->response_write_position - response->data_start); + /* buffer already ready, use what is there for the chunk */ + ret = response->data_size - data_write_offset; + if ( ((size_t) ret) > connection->write_buffer_size - sizeof (cbuf) - 2 ) + ret = connection->write_buffer_size - sizeof (cbuf) - 2; + memcpy (&connection->write_buffer[sizeof (cbuf)], + &response->data[data_write_offset], + ret); + } + else + { + /* buffer not in range, try to fill it */ + ret = response->crc (response->crc_cls, + connection->response_write_position, + &connection->write_buffer[sizeof (cbuf)], + connection->write_buffer_size - sizeof (cbuf) - 2); + } + if ( ((ssize_t) MHD_CONTENT_READER_END_WITH_ERROR) == ret) + { + /* error, close socket! */ + response->total_size = connection->response_write_position; + MHD_mutex_unlock_chk_ (&response->mutex); + CONNECTION_CLOSE_ERROR (connection, + _("Closing connection (application error generating response)\n")); + return MHD_NO; + } + if ( (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret) || + (0 == response->total_size) ) + { + /* end of message, signal other side! */ + strcpy (connection->write_buffer, + "0\r\n"); + connection->write_buffer_append_offset = 3; + connection->write_buffer_send_offset = 0; + response->total_size = connection->response_write_position; + return MHD_YES; + } + if (0 == ret) + { + connection->state = MHD_CONNECTION_CHUNKED_BODY_UNREADY; + MHD_mutex_unlock_chk_ (&response->mutex); + return MHD_NO; + } + if (ret > 0xFFFFFF) + ret = 0xFFFFFF; + cblen = MHD_snprintf_(cbuf, + sizeof (cbuf), + "%X\r\n", + (unsigned int) ret); + mhd_assert(cblen > 0); + mhd_assert((size_t)cblen < sizeof(cbuf)); + memcpy (&connection->write_buffer[sizeof (cbuf) - cblen], + cbuf, + cblen); + memcpy (&connection->write_buffer[sizeof (cbuf) + ret], + "\r\n", + 2); + connection->response_write_position += ret; + connection->write_buffer_send_offset = sizeof (cbuf) - cblen; + connection->write_buffer_append_offset = sizeof (cbuf) + ret + 2; + return MHD_YES; +} + + +/** + * Are we allowed to keep the given connection alive? We can use the + * TCP stream for a second request if the connection is HTTP 1.1 and + * the "Connection" header either does not exist or is not set to + * "close", or if the connection is HTTP 1.0 and the "Connection" + * header is explicitly set to "keep-alive". If no HTTP version is + * specified (or if it is not 1.0 or 1.1), we definitively close the + * connection. If the "Connection" header is not exactly "close" or + * "keep-alive", we proceed to use the default for the respective HTTP + * version (which is conservative for HTTP 1.0, but might be a bit + * optimistic for HTTP 1.1). + * + * @param connection the connection to check for keepalive + * @return #MHD_YES if (based on the request), a keepalive is + * legal + */ +static int +keepalive_possible (struct MHD_Connection *connection) +{ + if (MHD_CONN_MUST_CLOSE == connection->keepalive) + return MHD_NO; + if (NULL == connection->version) + return MHD_NO; + if ( (NULL != connection->response) && + (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) ) + return MHD_NO; + + if (MHD_str_equal_caseless_(connection->version, + MHD_HTTP_VERSION_1_1)) + { + if (MHD_lookup_header_s_token_ci (connection, + MHD_HTTP_HEADER_CONNECTION, + "upgrade")) + return MHD_NO; + + if (MHD_lookup_header_s_token_ci (connection, + MHD_HTTP_HEADER_CONNECTION, + "close")) + return MHD_NO; + + return MHD_YES; + } + if (MHD_str_equal_caseless_(connection->version, + MHD_HTTP_VERSION_1_0)) + { + if (MHD_lookup_header_s_token_ci (connection, + MHD_HTTP_HEADER_CONNECTION, + "Keep-Alive")) + return MHD_YES; + + return MHD_NO; + } + return MHD_NO; +} + + +/** + * Produce HTTP time stamp. + * + * @param date where to write the header, with + * at least 128 bytes available space. + * @param date_len number of bytes in @a date + */ +static void +get_date_string (char *date, + size_t date_len) +{ + static const char *const days[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + static const char *const mons[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + struct tm now; + time_t t; +#if !defined(HAVE_C11_GMTIME_S) && !defined(HAVE_W32_GMTIME_S) && !defined(HAVE_GMTIME_R) + struct tm* pNow; +#endif + + date[0] = 0; + time (&t); +#if defined(HAVE_C11_GMTIME_S) + if (NULL == gmtime_s (&t, + &now)) + return; +#elif defined(HAVE_W32_GMTIME_S) + if (0 != gmtime_s (&now, + &t)) + return; +#elif defined(HAVE_GMTIME_R) + if (NULL == gmtime_r(&t, + &now)) + return; +#else + pNow = gmtime(&t); + if (NULL == pNow) + return; + now = *pNow; +#endif + MHD_snprintf_ (date, + date_len, + "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n", + days[now.tm_wday % 7], + (unsigned int) now.tm_mday, + mons[now.tm_mon % 12], + (unsigned int) (1900 + now.tm_year), + (unsigned int) now.tm_hour, + (unsigned int) now.tm_min, + (unsigned int) now.tm_sec); +} + + +/** + * Try growing the read buffer. We initially claim half the available + * buffer space for the read buffer (the other half being left for + * management data structures; the write buffer can in the end take + * virtually everything as the read buffer can be reduced to the + * minimum necessary at that point. + * + * @param connection the connection + * @return #MHD_YES on success, #MHD_NO on failure + */ +static int +try_grow_read_buffer (struct MHD_Connection *connection) +{ + void *buf; + size_t new_size; + + if (0 == connection->read_buffer_size) + new_size = connection->daemon->pool_size / 2; + else + new_size = connection->read_buffer_size + MHD_BUF_INC_SIZE; + buf = MHD_pool_reallocate (connection->pool, + connection->read_buffer, + connection->read_buffer_size, + new_size); + if (NULL == buf) + return MHD_NO; + /* we can actually grow the buffer, do it! */ + connection->read_buffer = buf; + connection->read_buffer_size = new_size; + return MHD_YES; +} + + +/** + * Allocate the connection's write buffer and fill it with all of the + * headers (or footers, if we have already sent the body) from the + * HTTPd's response. If headers are missing in the response supplied + * by the application, additional headers may be added here. + * + * @param connection the connection + * @return #MHD_YES on success, #MHD_NO on failure (out of memory) + */ +static int +build_header_response (struct MHD_Connection *connection) +{ + size_t size; + size_t off; + struct MHD_HTTP_Header *pos; + char code[256]; + char date[128]; + char content_length_buf[128]; + size_t content_length_len; + char *data; + enum MHD_ValueKind kind; + const char *reason_phrase; + uint32_t rc; + bool client_requested_close; + bool response_has_close; + bool response_has_keepalive; + const char *have_encoding; + const char *have_content_length; + int must_add_close; + int must_add_chunked_encoding; + int must_add_keep_alive; + int must_add_content_length; + + mhd_assert (NULL != connection->version); + if (0 == connection->version[0]) + { + data = MHD_pool_allocate (connection->pool, + 0, + MHD_YES); + connection->write_buffer = data; + connection->write_buffer_append_offset = 0; + connection->write_buffer_send_offset = 0; + connection->write_buffer_size = 0; + return MHD_YES; + } + rc = connection->responseCode & (~MHD_ICY_FLAG); + if (MHD_CONNECTION_FOOTERS_RECEIVED == connection->state) + { + reason_phrase = MHD_get_reason_phrase_for (rc); + MHD_snprintf_ (code, + sizeof (code), + "%s %u %s\r\n", + (0 != (connection->responseCode & MHD_ICY_FLAG)) + ? "ICY" + : ( (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_0, + connection->version)) + ? MHD_HTTP_VERSION_1_0 + : MHD_HTTP_VERSION_1_1), + rc, + reason_phrase); + off = strlen (code); + /* estimate size */ + size = off + 2; /* +2 for extra "\r\n" at the end */ + kind = MHD_HEADER_KIND; + if ( (0 == (connection->daemon->options & MHD_USE_SUPPRESS_DATE_NO_CLOCK)) && + (NULL == MHD_get_response_header (connection->response, + MHD_HTTP_HEADER_DATE)) ) + get_date_string (date, + sizeof (date)); + else + date[0] = '\0'; + size += strlen (date); + } + else + { + /* 2 bytes for final CRLF of a Chunked-Body */ + size = 2; + kind = MHD_FOOTER_KIND; + off = 0; + } + + /* calculate extra headers we need to add, such as 'Connection: close', + first see what was explicitly requested by the application */ + must_add_close = MHD_NO; + must_add_chunked_encoding = MHD_NO; + must_add_keep_alive = MHD_NO; + must_add_content_length = MHD_NO; + response_has_close = false; + response_has_keepalive = false; + switch (connection->state) + { + case MHD_CONNECTION_FOOTERS_RECEIVED: + response_has_close = MHD_check_response_header_s_token_ci (connection->response, + MHD_HTTP_HEADER_CONNECTION, + "close"); + response_has_keepalive = MHD_check_response_header_s_token_ci (connection->response, + MHD_HTTP_HEADER_CONNECTION, + "Keep-Alive"); + client_requested_close = MHD_lookup_header_s_token_ci (connection, + MHD_HTTP_HEADER_CONNECTION, + "close"); + + if (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY)) + connection->keepalive = MHD_CONN_MUST_CLOSE; +#ifdef UPGRADE_SUPPORT + else if (NULL != connection->response->upgrade_handler) + /* If this connection will not be "upgraded", it must be closed. */ + connection->keepalive = MHD_CONN_MUST_CLOSE; +#endif /* UPGRADE_SUPPORT */ + + /* now analyze chunked encoding situation */ + connection->have_chunked_upload = false; + + if ( (MHD_SIZE_UNKNOWN == connection->response->total_size) && +#ifdef UPGRADE_SUPPORT + (NULL == connection->response->upgrade_handler) && +#endif /* UPGRADE_SUPPORT */ + (! response_has_close) && + (! client_requested_close) ) + { + /* size is unknown, and close was not explicitly requested; + need to either to HTTP 1.1 chunked encoding or + close the connection */ + /* 'close' header doesn't exist yet, see if we need to add one; + if the client asked for a close, no need to start chunk'ing */ + if ( (MHD_YES == keepalive_possible (connection)) && + (MHD_str_equal_caseless_ (MHD_HTTP_VERSION_1_1, + connection->version) ) ) + { + have_encoding = MHD_get_response_header (connection->response, + MHD_HTTP_HEADER_TRANSFER_ENCODING); + if (NULL == have_encoding) + { + must_add_chunked_encoding = MHD_YES; + connection->have_chunked_upload = true; + } + else if (MHD_str_equal_caseless_ (have_encoding, + "identity")) + { + /* application forced identity encoding, can't do 'chunked' */ + must_add_close = MHD_YES; + } + else + { + connection->have_chunked_upload = true; + } + } + else + { + /* Keep alive or chunking not possible + => set close header if not present */ + if (! response_has_close) + must_add_close = MHD_YES; + } + } + + /* check for other reasons to add 'close' header */ + if ( ( (client_requested_close) || + (connection->read_closed) || + (MHD_CONN_MUST_CLOSE == connection->keepalive)) && + (! response_has_close) && +#ifdef UPGRADE_SUPPORT + (NULL == connection->response->upgrade_handler) && +#endif /* UPGRADE_SUPPORT */ + (0 == (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) ) + must_add_close = MHD_YES; + + /* check if we should add a 'content length' header */ + have_content_length = MHD_get_response_header (connection->response, + MHD_HTTP_HEADER_CONTENT_LENGTH); + + /* MHD_HTTP_NO_CONTENT, MHD_HTTP_NOT_MODIFIED and 1xx-status + codes SHOULD NOT have a Content-Length according to spec; + also chunked encoding / unknown length or CONNECT... */ + if ( (MHD_SIZE_UNKNOWN != connection->response->total_size) && + (MHD_HTTP_NO_CONTENT != rc) && + (MHD_HTTP_NOT_MODIFIED != rc) && + (MHD_HTTP_OK <= rc) && + (NULL == have_content_length) && + ( (NULL == connection->method) || + (! MHD_str_equal_caseless_ (connection->method, + MHD_HTTP_METHOD_CONNECT)) ) ) + { + /* + Here we add a content-length if one is missing; however, + for 'connect' methods, the responses MUST NOT include a + content-length header *if* the response code is 2xx (in + which case we expect there to be no body). Still, + as we don't know the response code here in some cases, we + simply only force adding a content-length header if this + is not a 'connect' or if the response is not empty + (which is kind of more sane, because if some crazy + application did return content with a 2xx status code, + then having a content-length might again be a good idea). + + Note that the change from 'SHOULD NOT' to 'MUST NOT' is + a recent development of the HTTP 1.1 specification. + */ + content_length_len + = MHD_snprintf_ (content_length_buf, + sizeof (content_length_buf), + MHD_HTTP_HEADER_CONTENT_LENGTH ": " MHD_UNSIGNED_LONG_LONG_PRINTF "\r\n", + (MHD_UNSIGNED_LONG_LONG) connection->response->total_size); + must_add_content_length = MHD_YES; + } + + /* check for adding keep alive */ + if ( (! response_has_keepalive) && + (! response_has_close) && + (MHD_NO == must_add_close) && + (MHD_CONN_MUST_CLOSE != connection->keepalive) && +#ifdef UPGRADE_SUPPORT + (NULL == connection->response->upgrade_handler) && +#endif /* UPGRADE_SUPPORT */ + (MHD_YES == keepalive_possible (connection)) ) + must_add_keep_alive = MHD_YES; + break; + case MHD_CONNECTION_BODY_SENT: + response_has_keepalive = false; + break; + default: + mhd_assert (0); + } + + if (MHD_CONN_MUST_CLOSE != connection->keepalive) + { + if ( (must_add_close) || (response_has_close) ) + connection->keepalive = MHD_CONN_MUST_CLOSE; + else if ( (must_add_keep_alive) || (response_has_keepalive) ) + connection->keepalive = MHD_CONN_USE_KEEPALIVE; + } + + if (must_add_close) + size += MHD_STATICSTR_LEN_ ("Connection: close\r\n"); + if (must_add_keep_alive) + size += MHD_STATICSTR_LEN_ ("Connection: Keep-Alive\r\n"); + if (must_add_chunked_encoding) + size += MHD_STATICSTR_LEN_ ("Transfer-Encoding: chunked\r\n"); + if (must_add_content_length) + size += content_length_len; + mhd_assert (! (must_add_close && must_add_keep_alive) ); + mhd_assert (! (must_add_chunked_encoding && must_add_content_length) ); + + for (pos = connection->response->first_header; NULL != pos; pos = pos->next) + { + /* TODO: add proper support for excluding "Keep-Alive" token. */ + if ( (pos->kind == kind) && + (! ( (MHD_YES == must_add_close) && + (response_has_keepalive) && + (MHD_str_equal_caseless_(pos->header, + MHD_HTTP_HEADER_CONNECTION)) && + (MHD_str_equal_caseless_(pos->value, + "Keep-Alive")) ) ) ) + size += strlen (pos->header) + strlen (pos->value) + 4; /* colon, space, linefeeds */ + } + /* produce data */ + data = MHD_pool_allocate (connection->pool, + size + 1, + MHD_NO); + if (NULL == data) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + "Not enough memory for write!\n"); +#endif + return MHD_NO; + } + if (MHD_CONNECTION_FOOTERS_RECEIVED == connection->state) + { + memcpy (data, + code, + off); + } + if (must_add_close) + { + /* we must add the 'Connection: close' header */ + memcpy (&data[off], + "Connection: close\r\n", + MHD_STATICSTR_LEN_ ("Connection: close\r\n")); + off += MHD_STATICSTR_LEN_ ("Connection: close\r\n"); + } + if (must_add_keep_alive) + { + /* we must add the 'Connection: Keep-Alive' header */ + memcpy (&data[off], + "Connection: Keep-Alive\r\n", + MHD_STATICSTR_LEN_ ("Connection: Keep-Alive\r\n")); + off += MHD_STATICSTR_LEN_ ("Connection: Keep-Alive\r\n"); + } + if (must_add_chunked_encoding) + { + /* we must add the 'Transfer-Encoding: chunked' header */ + memcpy (&data[off], + "Transfer-Encoding: chunked\r\n", + MHD_STATICSTR_LEN_ ("Transfer-Encoding: chunked\r\n")); + off += MHD_STATICSTR_LEN_ ("Transfer-Encoding: chunked\r\n"); + } + if (must_add_content_length) + { + /* we must add the 'Content-Length' header */ + memcpy (&data[off], + content_length_buf, + content_length_len); + off += content_length_len; + } + for (pos = connection->response->first_header; NULL != pos; pos = pos->next) + { + /* TODO: add proper support for excluding "Keep-Alive" token. */ + if ( (pos->kind == kind) && + (! ( (MHD_YES == must_add_close) && + (response_has_keepalive) && + (MHD_str_equal_caseless_(pos->header, + MHD_HTTP_HEADER_CONNECTION)) && + (MHD_str_equal_caseless_(pos->value, + "Keep-Alive")) ) ) ) + off += MHD_snprintf_ (&data[off], + size - off, + "%s: %s\r\n", + pos->header, + pos->value); + } + if (MHD_CONNECTION_FOOTERS_RECEIVED == connection->state) + { + strcpy (&data[off], + date); + off += strlen (date); + } + memcpy (&data[off], + "\r\n", + 2); + off += 2; + + if (off != size) + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__, + NULL); + connection->write_buffer = data; + connection->write_buffer_append_offset = size; + connection->write_buffer_send_offset = 0; + connection->write_buffer_size = size + 1; + return MHD_YES; +} + + +/** + * We encountered an error processing the request. + * Handle it properly by stopping to read data + * and sending the indicated response code and message. + * + * @param connection the connection + * @param status_code the response code to send (400, 413 or 414) + * @param message the error message to send + */ +static void +transmit_error_response (struct MHD_Connection *connection, + unsigned int status_code, + const char *message) +{ + struct MHD_Response *response; + + if (NULL == connection->version) + { + /* we were unable to process the full header line, so we don't + really know what version the client speaks; assume 1.0 */ + connection->version = MHD_HTTP_VERSION_1_0; + } + connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + connection->read_closed = true; +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Error processing request (HTTP response code is %u (`%s')). Closing connection.\n"), + status_code, + message); +#endif + if (NULL != connection->response) + { + MHD_destroy_response (connection->response); + connection->response = NULL; + } + response = MHD_create_response_from_buffer (strlen (message), + (void *) message, + MHD_RESPMEM_PERSISTENT); + MHD_queue_response (connection, + status_code, + response); + mhd_assert (NULL != connection->response); + MHD_destroy_response (response); + /* Do not reuse this connection. */ + connection->keepalive = MHD_CONN_MUST_CLOSE; + if (MHD_NO == build_header_response (connection)) + { + /* oops - close! */ + CONNECTION_CLOSE_ERROR (connection, + _("Closing connection (failed to create response header)\n")); + } + else + { + connection->state = MHD_CONNECTION_HEADERS_SENDING; + } +} + + +/** + * Update the 'event_loop_info' field of this connection based on the state + * that the connection is now in. May also close the connection or + * perform other updates to the connection if needed to prepare for + * the next round of the event loop. + * + * @param connection connection to get poll set for + */ +static void +MHD_connection_update_event_loop_info (struct MHD_Connection *connection) +{ + /* Do not update states of suspended connection */ + if (connection->suspended) + return; /* States will be updated after resume. */ +#ifdef HTTPS_SUPPORT + if (MHD_TLS_CONN_NO_TLS != connection->tls_state) + { /* HTTPS connection. */ + switch (connection->tls_state) + { + case MHD_TLS_CONN_INIT: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ; + return; + case MHD_TLS_CONN_HANDSHAKING: + if (0 == gnutls_record_get_direction (connection->tls_session)) + connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ; + else + connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; + return; + default: + break; + } + } +#endif /* HTTPS_SUPPORT */ + while (1) + { +#if DEBUG_STATES + MHD_DLOG (connection->daemon, + _("In function %s handling connection at state: %s\n"), + __FUNCTION__, + MHD_state_to_string (connection->state)); +#endif + switch (connection->state) + { + case MHD_CONNECTION_INIT: + case MHD_CONNECTION_URL_RECEIVED: + case MHD_CONNECTION_HEADER_PART_RECEIVED: + /* while reading headers, we always grow the + read buffer if needed, no size-check required */ + if ( (connection->read_buffer_offset == connection->read_buffer_size) && + (MHD_NO == try_grow_read_buffer (connection)) ) + { + transmit_error_response (connection, + (connection->url != NULL) + ? MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE + : MHD_HTTP_URI_TOO_LONG, + REQUEST_TOO_BIG); + continue; + } + if (! connection->read_closed) + connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ; + else + connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; + break; + case MHD_CONNECTION_HEADERS_RECEIVED: + mhd_assert (0); + break; + case MHD_CONNECTION_HEADERS_PROCESSED: + mhd_assert (0); + break; + case MHD_CONNECTION_CONTINUE_SENDING: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; + break; + case MHD_CONNECTION_CONTINUE_SENT: + if (connection->read_buffer_offset == connection->read_buffer_size) + { + if ((MHD_YES != try_grow_read_buffer (connection)) && + (0 != (connection->daemon->options & + MHD_USE_INTERNAL_POLLING_THREAD))) + { + /* failed to grow the read buffer, and the + client which is supposed to handle the + received data in a *blocking* fashion + (in this mode) did not handle the data as + it was supposed to! + => we would either have to do busy-waiting + (on the client, which would likely fail), + or if we do nothing, we would just timeout + on the connection (if a timeout is even + set!). + Solution: we kill the connection with an error */ + transmit_error_response (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + INTERNAL_ERROR); + continue; + } + } + if ( (connection->read_buffer_offset < connection->read_buffer_size) && + (! connection->read_closed) ) + connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ; + else + connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; + break; + case MHD_CONNECTION_BODY_RECEIVED: + case MHD_CONNECTION_FOOTER_PART_RECEIVED: + /* while reading footers, we always grow the + read buffer if needed, no size-check required */ + if (connection->read_closed) + { + CONNECTION_CLOSE_ERROR (connection, + NULL); + continue; + } + connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ; + /* transition to FOOTERS_RECEIVED + happens in read handler */ + break; + case MHD_CONNECTION_FOOTERS_RECEIVED: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; + break; + case MHD_CONNECTION_HEADERS_SENDING: + /* headers in buffer, keep writing */ + connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; + break; + case MHD_CONNECTION_HEADERS_SENT: + mhd_assert (0); + break; + case MHD_CONNECTION_NORMAL_BODY_READY: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; + break; + case MHD_CONNECTION_NORMAL_BODY_UNREADY: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; + break; + case MHD_CONNECTION_CHUNKED_BODY_READY: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; + break; + case MHD_CONNECTION_CHUNKED_BODY_UNREADY: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_BLOCK; + break; + case MHD_CONNECTION_BODY_SENT: + mhd_assert (0); + break; + case MHD_CONNECTION_FOOTERS_SENDING: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE; + break; + case MHD_CONNECTION_FOOTERS_SENT: + mhd_assert (0); + break; + case MHD_CONNECTION_CLOSED: + connection->event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; + return; /* do nothing, not even reading */ + case MHD_CONNECTION_IN_CLEANUP: + mhd_assert (0); + break; +#ifdef UPGRADE_SUPPORT + case MHD_CONNECTION_UPGRADE: + mhd_assert (0); + break; +#endif /* UPGRADE_SUPPORT */ + default: + mhd_assert (0); + } + break; + } +} + + +/** + * Parse a single line of the HTTP header. Advance read_buffer (!) + * appropriately. If the current line does not fit, consider growing + * the buffer. If the line is far too long, close the connection. If + * no line is found (incomplete, buffer too small, line too long), + * return NULL. Otherwise return a pointer to the line. + * + * @param connection connection we're processing + * @param[out] line_len pointer to variable that receive + * length of line or NULL + * @return NULL if no full line is available; note that the returned + * string will not be 0-termianted + */ +static char * +get_next_header_line (struct MHD_Connection *connection, + size_t *line_len) +{ + char *rbuf; + size_t pos; + + if (0 == connection->read_buffer_offset) + return NULL; + pos = 0; + rbuf = connection->read_buffer; + while ( (pos < connection->read_buffer_offset - 1) && + ('\r' != rbuf[pos]) && + ('\n' != rbuf[pos]) ) + pos++; + if ( (pos == connection->read_buffer_offset - 1) && + ('\n' != rbuf[pos]) ) + { + /* not found, consider growing... */ + if ( (connection->read_buffer_offset == connection->read_buffer_size) && + (MHD_NO == + try_grow_read_buffer (connection)) ) + { + transmit_error_response (connection, + (NULL != connection->url) + ? MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE + : MHD_HTTP_URI_TOO_LONG, + REQUEST_TOO_BIG); + } + if (line_len) + *line_len = 0; + return NULL; + } + + if (line_len) + *line_len = pos; + /* found, check if we have proper LFCR */ + if ( ('\r' == rbuf[pos]) && + ('\n' == rbuf[pos + 1]) ) + rbuf[pos++] = '\0'; /* skip both r and n */ + rbuf[pos++] = '\0'; + connection->read_buffer += pos; + connection->read_buffer_size -= pos; + connection->read_buffer_offset -= pos; + return rbuf; +} + + +/** + * Add an entry to the HTTP headers of a connection. If this fails, + * transmit an error response (request too big). + * + * @param connection the connection for which a + * value should be set + * @param kind kind of the value + * @param key key for the value + * @param value the value itself + * @return #MHD_NO on failure (out of memory), #MHD_YES for success + */ +static int +connection_add_header (struct MHD_Connection *connection, + const char *key, + const char *value, + enum MHD_ValueKind kind) +{ + if (MHD_NO == + MHD_set_connection_value (connection, + kind, + key, + value)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Not enough memory in pool to allocate header record!\n")); +#endif + transmit_error_response (connection, + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, + REQUEST_TOO_BIG); + return MHD_NO; + } + return MHD_YES; +} + + +/** + * Parse the cookie header (see RFC 2109). + * + * @param connection connection to parse header of + * @return #MHD_YES for success, #MHD_NO for failure (malformed, out of memory) + */ +static int +parse_cookie_header (struct MHD_Connection *connection) +{ + const char *hdr; + char *cpy; + char *pos; + char *sce; + char *semicolon; + char *equals; + char *ekill; + char old; + int quotes; + + hdr = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_COOKIE); + if (NULL == hdr) + return MHD_YES; + cpy = MHD_pool_allocate (connection->pool, + strlen (hdr) + 1, + MHD_YES); + if (NULL == cpy) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Not enough memory in pool to parse cookies!\n")); +#endif + transmit_error_response (connection, + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, + REQUEST_TOO_BIG); + return MHD_NO; + } + memcpy (cpy, + hdr, + strlen (hdr) + 1); + pos = cpy; + while (NULL != pos) + { + while (' ' == *pos) + pos++; /* skip spaces */ + + sce = pos; + while ( ((*sce) != '\0') && + ((*sce) != ',') && + ((*sce) != ';') && + ((*sce) != '=') ) + sce++; + /* remove tailing whitespace (if any) from key */ + ekill = sce - 1; + while ( (*ekill == ' ') && + (ekill >= pos) ) + *(ekill--) = '\0'; + old = *sce; + *sce = '\0'; + if (old != '=') + { + /* value part omitted, use empty string... */ + if (MHD_NO == + connection_add_header (connection, + pos, + "", + MHD_COOKIE_KIND)) + return MHD_NO; + if (old == '\0') + break; + pos = sce + 1; + continue; + } + equals = sce + 1; + quotes = 0; + semicolon = equals; + while ( ('\0' != semicolon[0]) && + ( (0 != quotes) || + ( (';' != semicolon[0]) && + (',' != semicolon[0]) ) ) ) + { + if ('"' == semicolon[0]) + quotes = (quotes + 1) & 1; + semicolon++; + } + if ('\0' == semicolon[0]) + semicolon = NULL; + if (NULL != semicolon) + { + semicolon[0] = '\0'; + semicolon++; + } + /* remove quotes */ + if ( ('"' == equals[0]) && + ('"' == equals[strlen (equals) - 1]) ) + { + equals[strlen (equals) - 1] = '\0'; + equals++; + } + if (MHD_NO == + connection_add_header (connection, + pos, + equals, + MHD_COOKIE_KIND)) + return MHD_NO; + pos = semicolon; + } + return MHD_YES; +} + + +/** + * Parse the first line of the HTTP HEADER. + * + * @param connection the connection (updated) + * @param line the first line, not 0-terminated + * @param line_len length of the first @a line + * @return #MHD_YES if the line is ok, #MHD_NO if it is malformed + */ +static int +parse_initial_message_line (struct MHD_Connection *connection, + char *line, + size_t line_len) +{ + struct MHD_Daemon *daemon = connection->daemon; + const char *curi; + char *uri; + char *http_version; + char *args; + unsigned int unused_num_headers; + + if (NULL == (uri = memchr (line, + ' ', + line_len))) + return MHD_NO; /* serious error */ + uri[0] = '\0'; + connection->method = line; + uri++; + /* Skip any spaces. Not required by standard but allow + to be more tolerant. */ + while ( (' ' == uri[0]) && + ( (size_t)(uri - line) < line_len) ) + uri++; + if ((size_t)(uri - line) == line_len) + { + curi = ""; + uri = NULL; + connection->version = ""; + args = NULL; + } + else + { + curi = uri; + /* Search from back to accept misformed URI with space */ + http_version = line + line_len - 1; + /* Skip any trailing spaces */ + while ( (' ' == http_version[0]) && + (http_version > uri) ) + http_version--; + /* Find first space in reverse direction */ + while ( (' ' != http_version[0]) && + (http_version > uri) ) + http_version--; + if (http_version > uri) + { + http_version[0] = '\0'; + connection->version = http_version + 1; + args = memchr (uri, + '?', + http_version - uri); + } + else + { + connection->version = ""; + args = memchr (uri, + '?', + line_len - (uri - line)); + } + } + if (NULL != daemon->uri_log_callback) + { + connection->client_aware = true; + connection->client_context + = daemon->uri_log_callback (daemon->uri_log_callback_cls, + curi, + connection); + } + if (NULL != args) + { + args[0] = '\0'; + args++; + /* note that this call clobbers 'args' */ + MHD_parse_arguments_ (connection, + MHD_GET_ARGUMENT_KIND, + args, + &connection_add_header, + &unused_num_headers); + } + if (NULL != uri) + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + uri); + connection->url = curi; + return MHD_YES; +} + + +/** + * Call the handler of the application for this + * connection. Handles chunking of the upload + * as well as normal uploads. + * + * @param connection connection we're processing + */ +static void +call_connection_handler (struct MHD_Connection *connection) +{ + size_t processed; + + if (NULL != connection->response) + return; /* already queued a response */ + processed = 0; + connection->client_aware = true; + if (MHD_NO == + connection->daemon->default_handler (connection->daemon->default_handler_cls, + connection, + connection->url, + connection->method, + connection->version, + NULL, + &processed, + &connection->client_context)) + { + /* serious internal error, close connection */ + CONNECTION_CLOSE_ERROR (connection, + _("Application reported internal error, closing connection.\n")); + return; + } +} + + + +/** + * Call the handler of the application for this + * connection. Handles chunking of the upload + * as well as normal uploads. + * + * @param connection connection we're processing + */ +static void +process_request_body (struct MHD_Connection *connection) +{ + size_t available; + int instant_retry; + char *buffer_head; + + if (NULL != connection->response) + return; /* already queued a response */ + + buffer_head = connection->read_buffer; + available = connection->read_buffer_offset; + do + { + size_t to_be_processed; + size_t left_unprocessed; + size_t processed_size; + + instant_retry = MHD_NO; + if ( (connection->have_chunked_upload) && + (MHD_SIZE_UNKNOWN == connection->remaining_upload_size) ) + { + if ( (connection->current_chunk_offset == connection->current_chunk_size) && + (0LLU != connection->current_chunk_offset) && + (available >= 2) ) + { + size_t i; + /* skip new line at the *end* of a chunk */ + i = 0; + if ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) ) + i++; /* skip 1st part of line feed */ + if ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) ) + i++; /* skip 2nd part of line feed */ + if (0 == i) + { + /* malformed encoding */ + CONNECTION_CLOSE_ERROR (connection, + _("Received malformed HTTP request (bad chunked encoding). Closing connection.\n")); + return; + } + available -= i; + buffer_head += i; + connection->current_chunk_offset = 0; + connection->current_chunk_size = 0; + } + if (connection->current_chunk_offset < + connection->current_chunk_size) + { + uint64_t cur_chunk_left; + /* we are in the middle of a chunk, give + as much as possible to the client (without + crossing chunk boundaries) */ + cur_chunk_left + = connection->current_chunk_size - connection->current_chunk_offset; + if (cur_chunk_left > available) + to_be_processed = available; + else + { /* cur_chunk_left <= (size_t)available */ + to_be_processed = (size_t)cur_chunk_left; + if (available > to_be_processed) + instant_retry = MHD_YES; + } + } + else + { + size_t i; + size_t end_size; + bool malformed; + + /* we need to read chunk boundaries */ + i = 0; + while (i < available) + { + if ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) || + (';' == buffer_head[i]) ) + break; + i++; + if (i >= 16) + break; + } + end_size = i; + /* find beginning of CRLF (skip over chunk extensions) */ + if (';' == buffer_head[i]) + { + while (i < available) + { + if ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) ) + break; + i++; + } + } + /* take '\n' into account; if '\n' is the unavailable + character, we will need to wait until we have it + before going further */ + if ( (i + 1 >= available) && + ! ( (1 == i) && + (2 == available) && + ('0' == buffer_head[0]) ) ) + break; /* need more data... */ + i++; + malformed = (end_size >= 16); + if (! malformed) + { + size_t num_dig = MHD_strx_to_uint64_n_ (buffer_head, + end_size, + &connection->current_chunk_size); + malformed = (end_size != num_dig); + } + if (malformed) + { + /* malformed encoding */ + CONNECTION_CLOSE_ERROR (connection, + _("Received malformed HTTP request (bad chunked encoding). Closing connection.\n")); + return; + } + /* skip 2nd part of line feed */ + if ( (i < available) && + ( ('\r' == buffer_head[i]) || + ('\n' == buffer_head[i]) ) ) + i++; + + buffer_head += i; + available -= i; + connection->current_chunk_offset = 0; + + if (available > 0) + instant_retry = MHD_YES; + if (0LLU == connection->current_chunk_size) + { + connection->remaining_upload_size = 0; + break; + } + continue; + } + } + else + { + /* no chunked encoding, give all to the client */ + if ( (0 != connection->remaining_upload_size) && + (MHD_SIZE_UNKNOWN != connection->remaining_upload_size) && + (connection->remaining_upload_size < available) ) + { + to_be_processed = (size_t)connection->remaining_upload_size; + } + else + { + /** + * 1. no chunked encoding, give all to the client + * 2. client may send large chunked data, but only a smaller part is available at one time. + */ + to_be_processed = available; + } + } + left_unprocessed = to_be_processed; + connection->client_aware = true; + if (MHD_NO == + connection->daemon->default_handler (connection->daemon->default_handler_cls, + connection, + connection->url, + connection->method, + connection->version, + buffer_head, + &left_unprocessed, + &connection->client_context)) + { + /* serious internal error, close connection */ + CONNECTION_CLOSE_ERROR (connection, + _("Application reported internal error, closing connection.\n")); + return; + } + if (left_unprocessed > to_be_processed) + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__ +#ifdef HAVE_MESSAGES + , _("libmicrohttpd API violation") +#else + , NULL +#endif + ); + if (0 != left_unprocessed) + { + instant_retry = MHD_NO; /* client did not process everything */ +#ifdef HAVE_MESSAGES + /* client did not process all upload data, complain if + the setup was incorrect, which may prevent us from + handling the rest of the request */ + if ( (0 != (connection->daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) && + (! connection->suspended) ) + MHD_DLOG (connection->daemon, + _("WARNING: incomplete upload processing and connection not suspended may result in hung connection.\n")); +#endif + } + processed_size = to_be_processed - left_unprocessed; + if (connection->have_chunked_upload) + connection->current_chunk_offset += processed_size; + /* dh left "processed" bytes in buffer for next time... */ + buffer_head += processed_size; + available -= processed_size; + if (MHD_SIZE_UNKNOWN != connection->remaining_upload_size) + connection->remaining_upload_size -= processed_size; + } + while (MHD_YES == instant_retry); + if (available > 0) + memmove (connection->read_buffer, + buffer_head, + available); + connection->read_buffer_offset = available; +} + + +/** + * Check if we are done sending the write-buffer. + * If so, transition into "next_state". + * + * @param connection connection to check write status for + * @param next_state the next state to transition to + * @return #MHD_NO if we are not done, #MHD_YES if we are + */ +static int +check_write_done (struct MHD_Connection *connection, + enum MHD_CONNECTION_STATE next_state) +{ + if (connection->write_buffer_append_offset != + connection->write_buffer_send_offset) + return MHD_NO; + connection->write_buffer_append_offset = 0; + connection->write_buffer_send_offset = 0; + connection->state = next_state; + MHD_pool_reallocate (connection->pool, + connection->write_buffer, + connection->write_buffer_size, + 0); + connection->write_buffer = NULL; + connection->write_buffer_size = 0; + return MHD_YES; +} + + +/** + * We have received (possibly the beginning of) a line in the + * header (or footer). Validate (check for ":") and prepare + * to process. + * + * @param connection connection we're processing + * @param line line from the header to process + * @return #MHD_YES on success, #MHD_NO on error (malformed @a line) + */ +static int +process_header_line (struct MHD_Connection *connection, + char *line) +{ + char *colon; + + /* line should be normal header line, find colon */ + colon = strchr (line, ':'); + if (NULL == colon) + { + /* error in header line, die hard */ + CONNECTION_CLOSE_ERROR (connection, + _("Received malformed line (no colon). Closing connection.\n")); + return MHD_NO; + } + if (-1 >= connection->daemon->strict_for_client) + { + /* check for whitespace before colon, which is not allowed + by RFC 7230 section 3.2.4; we count space ' ' and + tab '\t', but not '\r\n' as those would have ended the line. */ + const char *white; + + white = strchr (line, ' '); + if ( (NULL != white) && + (white < colon) ) + return MHD_NO; + white = strchr (line, '\t'); + if ( (NULL != white) && + (white < colon) ) + return MHD_NO; + } + /* zero-terminate header */ + colon[0] = '\0'; + colon++; /* advance to value */ + while ( ('\0' != colon[0]) && + ( (' ' == colon[0]) || + ('\t' == colon[0]) ) ) + colon++; + /* we do the actual adding of the connection + header at the beginning of the while + loop since we need to be able to inspect + the *next* header line (in case it starts + with a space...) */ + connection->last = line; + connection->colon = colon; + return MHD_YES; +} + + +/** + * Process a header value that spans multiple lines. + * The previous line(s) are in connection->last. + * + * @param connection connection we're processing + * @param line the current input line + * @param kind if the line is complete, add a header + * of the given kind + * @return #MHD_YES if the line was processed successfully + */ +static int +process_broken_line (struct MHD_Connection *connection, + char *line, + enum MHD_ValueKind kind) +{ + char *last; + char *tmp; + size_t last_len; + size_t tmp_len; + + last = connection->last; + if ( (' ' == line[0]) || + ('\t' == line[0]) ) + { + /* value was continued on the next line, see + http://www.jmarshall.com/easy/http/ */ + last_len = strlen (last); + /* skip whitespace at start of 2nd line */ + tmp = line; + while ( (' ' == tmp[0]) || + ('\t' == tmp[0]) ) + tmp++; + tmp_len = strlen (tmp); + /* FIXME: we might be able to do this better (faster!), as most + likely 'last' and 'line' should already be adjacent in + memory; however, doing this right gets tricky if we have a + value continued over multiple lines (in which case we need to + record how often we have done this so we can check for + adjacency); also, in the case where these are not adjacent + (not sure how it can happen!), we would want to allocate from + the end of the pool, so as to not destroy the read-buffer's + ability to grow nicely. */ + last = MHD_pool_reallocate (connection->pool, + last, + last_len + 1, + last_len + tmp_len + 1); + if (NULL == last) + { + transmit_error_response (connection, + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, + REQUEST_TOO_BIG); + return MHD_NO; + } + memcpy (&last[last_len], tmp, tmp_len + 1); + connection->last = last; + return MHD_YES; /* possibly more than 2 lines... */ + } + mhd_assert ( (NULL != last) && + (NULL != connection->colon) ); + if ((MHD_NO == connection_add_header (connection, + last, + connection->colon, + kind))) + { + transmit_error_response (connection, + MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, + REQUEST_TOO_BIG); + return MHD_NO; + } + /* we still have the current line to deal with... */ + if (0 != line[0]) + { + if (MHD_NO == process_header_line (connection, + line)) + { + transmit_error_response (connection, + MHD_HTTP_BAD_REQUEST, + REQUEST_MALFORMED); + return MHD_NO; + } + } + return MHD_YES; +} + + +/** + * Parse the various headers; figure out the size + * of the upload and make sure the headers follow + * the protocol. Advance to the appropriate state. + * + * @param connection connection we're processing + */ +static void +parse_connection_headers (struct MHD_Connection *connection) +{ + const char *clen; + struct MHD_Response *response; + const char *enc; + const char *end; + + parse_cookie_header (connection); + if ( (1 <= connection->daemon->strict_for_client) && + (NULL != connection->version) && + (MHD_str_equal_caseless_(MHD_HTTP_VERSION_1_1, + connection->version)) && + (NULL == + MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_HOST)) ) + { + /* die, http 1.1 request without host and we are pedantic */ + connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + connection->read_closed = true; +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Received HTTP 1.1 request without `Host' header.\n")); +#endif + mhd_assert (NULL == connection->response); + response = + MHD_create_response_from_buffer (MHD_STATICSTR_LEN_ (REQUEST_LACKS_HOST), + REQUEST_LACKS_HOST, + MHD_RESPMEM_PERSISTENT); + MHD_queue_response (connection, + MHD_HTTP_BAD_REQUEST, + response); + MHD_destroy_response (response); + return; + } + + connection->remaining_upload_size = 0; + enc = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_TRANSFER_ENCODING); + if (NULL != enc) + { + connection->remaining_upload_size = MHD_SIZE_UNKNOWN; + if (MHD_str_equal_caseless_(enc, + "chunked")) + connection->have_chunked_upload = true; + } + else + { + clen = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_CONTENT_LENGTH); + if (NULL != clen) + { + end = clen + MHD_str_to_uint64_ (clen, + &connection->remaining_upload_size); + if ( (clen == end) || + ('\0' != *end) ) + { + connection->remaining_upload_size = 0; +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + "Failed to parse `Content-Length' header. Closing connection.\n"); +#endif + CONNECTION_CLOSE_ERROR (connection, + NULL); + return; + } + } + } +} + + +/** + * Update the 'last_activity' field of the connection to the current time + * and move the connection to the head of the 'normal_timeout' list if + * the timeout for the connection uses the default value. + * + * @param connection the connection that saw some activity + */ +void +MHD_update_last_activity_ (struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + + if (0 == connection->connection_timeout) + return; /* Skip update of activity for connections + without timeout timer. */ + if (connection->suspended) + return; /* no activity on suspended connections */ + + connection->last_activity = MHD_monotonic_sec_counter(); + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + return; /* each connection has personal timeout */ + + if (connection->connection_timeout != daemon->connection_timeout) + return; /* custom timeout, no need to move it in "normal" DLL */ + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + /* move connection to head of timeout list (by remove + add operation) */ + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + XDLL_insert (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); +} + + +/** + * This function handles a particular connection when it has been + * determined that there is data to be read off a socket. + * + * @param connection connection to handle + */ +void +MHD_connection_handle_read (struct MHD_Connection *connection) +{ + ssize_t bytes_read; + + if ( (MHD_CONNECTION_CLOSED == connection->state) || + (connection->suspended) ) + return; +#ifdef HTTPS_SUPPORT + if (MHD_TLS_CONN_NO_TLS != connection->tls_state) + { /* HTTPS connection. */ + if (MHD_TLS_CONN_CONNECTED > connection->tls_state) + { + if (!MHD_run_tls_handshake_ (connection)) + return; + } + } +#endif /* HTTPS_SUPPORT */ + + /* make sure "read" has a reasonable number of bytes + in buffer to use per system call (if possible) */ + if (connection->read_buffer_offset + connection->daemon->pool_increment > + connection->read_buffer_size) + try_grow_read_buffer (connection); + + if (connection->read_buffer_size == connection->read_buffer_offset) + return; /* No space for receiving data. */ + bytes_read = connection->recv_cls (connection, + &connection->read_buffer + [connection->read_buffer_offset], + connection->read_buffer_size - + connection->read_buffer_offset); + if (bytes_read < 0) + { + if (MHD_ERR_AGAIN_ == bytes_read) + return; /* No new data to process. */ + if (MHD_ERR_CONNRESET_ == bytes_read) + { + CONNECTION_CLOSE_ERROR (connection, + (MHD_CONNECTION_INIT == connection->state) ? + NULL : + _("Socket disconnected while reading request.\n")); + return; + } + CONNECTION_CLOSE_ERROR (connection, + (MHD_CONNECTION_INIT == connection->state) ? + NULL : + _("Connection socket is closed due to error when reading request.\n")); + return; + } + + if (0 == bytes_read) + { /* Remote side closed connection. */ + connection->read_closed = true; + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_CLIENT_ABORT); + return; + } + connection->read_buffer_offset += bytes_read; + MHD_update_last_activity_ (connection); +#if DEBUG_STATES + MHD_DLOG (connection->daemon, + _("In function %s handling connection at state: %s\n"), + __FUNCTION__, + MHD_state_to_string (connection->state)); +#endif + switch (connection->state) + { + case MHD_CONNECTION_INIT: + case MHD_CONNECTION_URL_RECEIVED: + case MHD_CONNECTION_HEADER_PART_RECEIVED: + case MHD_CONNECTION_HEADERS_RECEIVED: + case MHD_CONNECTION_HEADERS_PROCESSED: + case MHD_CONNECTION_CONTINUE_SENDING: + case MHD_CONNECTION_CONTINUE_SENT: + case MHD_CONNECTION_BODY_RECEIVED: + case MHD_CONNECTION_FOOTER_PART_RECEIVED: + /* nothing to do but default action */ + if (connection->read_closed) + { + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_READ_ERROR); + } + return; + case MHD_CONNECTION_CLOSED: + return; +#ifdef UPGRADE_SUPPORT + case MHD_CONNECTION_UPGRADE: + mhd_assert (0); + return; +#endif /* UPGRADE_SUPPORT */ + default: + /* shrink read buffer to how much is actually used */ + MHD_pool_reallocate (connection->pool, + connection->read_buffer, + connection->read_buffer_size + 1, + connection->read_buffer_offset); + break; + } + return; +} + + +/** + * This function was created to handle writes to sockets when it has + * been determined that the socket can be written to. + * + * @param connection connection to handle + */ +void +MHD_connection_handle_write (struct MHD_Connection *connection) +{ + struct MHD_Response *response; + ssize_t ret; + if (connection->suspended) + return; + +#ifdef HTTPS_SUPPORT + if (MHD_TLS_CONN_NO_TLS != connection->tls_state) + { /* HTTPS connection. */ + if (MHD_TLS_CONN_CONNECTED > connection->tls_state) + { + if (!MHD_run_tls_handshake_ (connection)) + return; + } + } +#endif /* HTTPS_SUPPORT */ + +#if DEBUG_STATES + MHD_DLOG (connection->daemon, + _("In function %s handling connection at state: %s\n"), + __FUNCTION__, + MHD_state_to_string (connection->state)); +#endif + switch (connection->state) + { + case MHD_CONNECTION_INIT: + case MHD_CONNECTION_URL_RECEIVED: + case MHD_CONNECTION_HEADER_PART_RECEIVED: + case MHD_CONNECTION_HEADERS_RECEIVED: + mhd_assert (0); + return; + case MHD_CONNECTION_HEADERS_PROCESSED: + return; + case MHD_CONNECTION_CONTINUE_SENDING: + ret = connection->send_cls (connection, + &HTTP_100_CONTINUE + [connection->continue_message_write_offset], + MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE) - + connection->continue_message_write_offset); + if (ret < 0) + { + if (MHD_ERR_AGAIN_ == ret) + return; +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to send data in request for %s.\n"), + connection->url); +#endif + CONNECTION_CLOSE_ERROR (connection, + NULL); + return; + } +#if DEBUG_SEND_DATA + fprintf (stderr, + _("Sent 100 continue response: `%.*s'\n"), + (int) ret, + &HTTP_100_CONTINUE[connection->continue_message_write_offset]); +#endif + connection->continue_message_write_offset += ret; + MHD_update_last_activity_ (connection); + return; + case MHD_CONNECTION_CONTINUE_SENT: + case MHD_CONNECTION_BODY_RECEIVED: + case MHD_CONNECTION_FOOTER_PART_RECEIVED: + case MHD_CONNECTION_FOOTERS_RECEIVED: + mhd_assert (0); + return; + case MHD_CONNECTION_HEADERS_SENDING: + ret = connection->send_cls (connection, + &connection->write_buffer + [connection->write_buffer_send_offset], + connection->write_buffer_append_offset - + connection->write_buffer_send_offset); + if (ret < 0) + { + if (MHD_ERR_AGAIN_ == ret) + return; + CONNECTION_CLOSE_ERROR (connection, + _("Connection was closed while sending response headers.\n")); + return; + } + connection->write_buffer_send_offset += ret; + MHD_update_last_activity_ (connection); + if (MHD_CONNECTION_HEADERS_SENDING != connection->state) + return; + check_write_done (connection, + MHD_CONNECTION_HEADERS_SENT); + return; + case MHD_CONNECTION_HEADERS_SENT: + return; + case MHD_CONNECTION_NORMAL_BODY_READY: + response = connection->response; + if (connection->response_write_position < + connection->response->total_size) + { + uint64_t data_write_offset; + + if (NULL != response->crc) + MHD_mutex_lock_chk_ (&response->mutex); + if (MHD_YES != try_ready_normal_body (connection)) + { + /* mutex was already unlocked by try_ready_normal_body */ + return; + } +#if defined(_MHD_HAVE_SENDFILE) + if (MHD_resp_sender_sendfile == connection->resp_sender) + { + ret = sendfile_adapter (connection); + } + else +#else /* ! _MHD_HAVE_SENDFILE */ + if (1) +#endif /* ! _MHD_HAVE_SENDFILE */ + { + data_write_offset = connection->response_write_position + - response->data_start; + if (data_write_offset > (uint64_t)SIZE_MAX) + MHD_PANIC (_("Data offset exceeds limit")); + ret = connection->send_cls (connection, + &response->data + [(size_t)data_write_offset], + response->data_size - + (size_t)data_write_offset); +#if DEBUG_SEND_DATA + if (ret > 0) + fprintf (stderr, + _("Sent %d-byte DATA response: `%.*s'\n"), + (int) ret, + (int) ret, + &response->data[connection->response_write_position - + response->data_start]); +#endif + } + if (NULL != response->crc) + MHD_mutex_unlock_chk_ (&response->mutex); + if (ret < 0) + { + if (MHD_ERR_AGAIN_ == ret) + return; +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to send data in request for `%s'.\n"), + connection->url); +#endif + CONNECTION_CLOSE_ERROR (connection, + NULL); + return; + } + connection->response_write_position += ret; + MHD_update_last_activity_ (connection); + } + if (connection->response_write_position == + connection->response->total_size) + connection->state = MHD_CONNECTION_FOOTERS_SENT; /* have no footers */ + return; + case MHD_CONNECTION_NORMAL_BODY_UNREADY: + mhd_assert (0); + return; + case MHD_CONNECTION_CHUNKED_BODY_READY: + ret = connection->send_cls (connection, + &connection->write_buffer + [connection->write_buffer_send_offset], + connection->write_buffer_append_offset - + connection->write_buffer_send_offset); + if (ret < 0) + { + if (MHD_ERR_AGAIN_ == ret) + return; + CONNECTION_CLOSE_ERROR (connection, + _("Connection was closed while sending response body.\n")); + return; + } + connection->write_buffer_send_offset += ret; + MHD_update_last_activity_ (connection); + if (MHD_CONNECTION_CHUNKED_BODY_READY != connection->state) + return; + check_write_done (connection, + (connection->response->total_size == + connection->response_write_position) ? + MHD_CONNECTION_BODY_SENT : + MHD_CONNECTION_CHUNKED_BODY_UNREADY); + return; + case MHD_CONNECTION_CHUNKED_BODY_UNREADY: + case MHD_CONNECTION_BODY_SENT: + mhd_assert (0); + return; + case MHD_CONNECTION_FOOTERS_SENDING: + ret = connection->send_cls (connection, + &connection->write_buffer + [connection->write_buffer_send_offset], + connection->write_buffer_append_offset - + connection->write_buffer_send_offset); + if (ret < 0) + { + if (MHD_ERR_AGAIN_ == ret) + return; + CONNECTION_CLOSE_ERROR (connection, + _("Connection was closed while sending response body.\n")); + return; + } + connection->write_buffer_send_offset += ret; + MHD_update_last_activity_ (connection); + if (MHD_CONNECTION_FOOTERS_SENDING != connection->state) + return; + check_write_done (connection, + MHD_CONNECTION_FOOTERS_SENT); + return; + case MHD_CONNECTION_FOOTERS_SENT: + mhd_assert (0); + return; + case MHD_CONNECTION_CLOSED: + return; + case MHD_CONNECTION_IN_CLEANUP: + mhd_assert (0); + return; +#ifdef UPGRADE_SUPPORT + case MHD_CONNECTION_UPGRADE: + mhd_assert (0); + return; +#endif /* UPGRADE_SUPPORT */ + default: + mhd_assert (0); + CONNECTION_CLOSE_ERROR (connection, + _("Internal error\n")); + break; + } + return; +} + + +/** + * Clean up the state of the given connection and move it into the + * clean up queue for final disposal. + * @remark To be called only from thread that process connection's + * recv(), send() and response. + * + * @param connection handle for the connection to clean up + */ +static void +cleanup_connection (struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + + if (connection->in_cleanup) + return; /* Prevent double cleanup. */ + connection->in_cleanup = true; + if (NULL != connection->response) + { + MHD_destroy_response (connection->response); + connection->response = NULL; + } + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if (connection->suspended) + { + DLL_remove (daemon->suspended_connections_head, + daemon->suspended_connections_tail, + connection); + connection->suspended = false; + } + else + { + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + if (connection->connection_timeout == daemon->connection_timeout) + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + else + XDLL_remove (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + connection); + } + DLL_remove (daemon->connections_head, + daemon->connections_tail, + connection); + } + DLL_insert (daemon->cleanup_head, + daemon->cleanup_tail, + connection); + connection->resuming = false; + connection->in_idle = false; + MHD_mutex_unlock_chk_(&daemon->cleanup_connection_mutex); + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + /* if we were at the connection limit before and are in + thread-per-connection mode, signal the main thread + to resume accepting connections */ + if ( (MHD_ITC_IS_VALID_ (daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "c")) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to signal end of connection via inter-thread communication channel")); +#endif + } + } +} + + +/** + * This function was created to handle per-connection processing that + * has to happen even if the socket cannot be read or written to. + * @remark To be called only from thread that process connection's + * recv(), send() and response. + * + * @param connection connection to handle + * @return #MHD_YES if we should continue to process the + * connection (not dead yet), #MHD_NO if it died + */ +int +MHD_connection_handle_idle (struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + char *line; + size_t line_len; + int ret; + + connection->in_idle = true; + while (! connection->suspended) + { +#ifdef HTTPS_SUPPORT + if (MHD_TLS_CONN_NO_TLS != connection->tls_state) + { /* HTTPS connection. */ + if ((MHD_TLS_CONN_INIT <= connection->tls_state) && + (MHD_TLS_CONN_CONNECTED > connection->tls_state)) + break; + } +#endif /* HTTPS_SUPPORT */ +#if DEBUG_STATES + MHD_DLOG (daemon, + _("In function %s handling connection at state: %s\n"), + __FUNCTION__, + MHD_state_to_string (connection->state)); +#endif + switch (connection->state) + { + case MHD_CONNECTION_INIT: + line = get_next_header_line (connection, + &line_len); + /* Check for empty string, as we might want + to tolerate 'spurious' empty lines; also + NULL means we didn't get a full line yet; + line is not 0-terminated here. */ + if ( (NULL == line) || + (0 == line[0]) ) + { + if (MHD_CONNECTION_INIT != connection->state) + continue; + if (connection->read_closed) + { + CONNECTION_CLOSE_ERROR (connection, + NULL); + continue; + } + break; + } + if (MHD_NO == parse_initial_message_line (connection, + line, + line_len)) + CONNECTION_CLOSE_ERROR (connection, + NULL); + else + connection->state = MHD_CONNECTION_URL_RECEIVED; + continue; + case MHD_CONNECTION_URL_RECEIVED: + line = get_next_header_line (connection, + NULL); + if (NULL == line) + { + if (MHD_CONNECTION_URL_RECEIVED != connection->state) + continue; + if (connection->read_closed) + { + CONNECTION_CLOSE_ERROR (connection, + NULL); + continue; + } + break; + } + if (0 == line[0]) + { + connection->state = MHD_CONNECTION_HEADERS_RECEIVED; + connection->header_size = (size_t) (line - connection->read_buffer); + continue; + } + if (MHD_NO == process_header_line (connection, + line)) + { + transmit_error_response (connection, + MHD_HTTP_BAD_REQUEST, + REQUEST_MALFORMED); + break; + } + connection->state = MHD_CONNECTION_HEADER_PART_RECEIVED; + continue; + case MHD_CONNECTION_HEADER_PART_RECEIVED: + line = get_next_header_line (connection, + NULL); + if (NULL == line) + { + if (connection->state != MHD_CONNECTION_HEADER_PART_RECEIVED) + continue; + if (connection->read_closed) + { + CONNECTION_CLOSE_ERROR (connection, + NULL); + continue; + } + break; + } + if (MHD_NO == + process_broken_line (connection, + line, + MHD_HEADER_KIND)) + continue; + if (0 == line[0]) + { + connection->state = MHD_CONNECTION_HEADERS_RECEIVED; + connection->header_size = (size_t) (line - connection->read_buffer); + continue; + } + continue; + case MHD_CONNECTION_HEADERS_RECEIVED: + parse_connection_headers (connection); + if (MHD_CONNECTION_CLOSED == connection->state) + continue; + connection->state = MHD_CONNECTION_HEADERS_PROCESSED; + if (connection->suspended) + break; + continue; + case MHD_CONNECTION_HEADERS_PROCESSED: + call_connection_handler (connection); /* first call */ + if (MHD_CONNECTION_CLOSED == connection->state) + continue; + if (need_100_continue (connection)) + { + connection->state = MHD_CONNECTION_CONTINUE_SENDING; + if (MHD_NO != socket_flush_possible (connection)) + socket_start_extra_buffering (connection); + else + socket_start_no_buffering (connection); + + break; + } + if ( (NULL != connection->response) && + ( (MHD_str_equal_caseless_ (connection->method, + MHD_HTTP_METHOD_POST)) || + (MHD_str_equal_caseless_ (connection->method, + MHD_HTTP_METHOD_PUT))) ) + { + /* we refused (no upload allowed!) */ + connection->remaining_upload_size = 0; + /* force close, in case client still tries to upload... */ + connection->read_closed = true; + } + connection->state = (0 == connection->remaining_upload_size) + ? MHD_CONNECTION_FOOTERS_RECEIVED : MHD_CONNECTION_CONTINUE_SENT; + if (connection->suspended) + break; + continue; + case MHD_CONNECTION_CONTINUE_SENDING: + if (connection->continue_message_write_offset == + MHD_STATICSTR_LEN_ (HTTP_100_CONTINUE)) + { + connection->state = MHD_CONNECTION_CONTINUE_SENT; + if (MHD_NO != socket_flush_possible (connection)) + socket_start_no_buffering_flush (connection); + else + socket_start_normal_buffering (connection); + + continue; + } + break; + case MHD_CONNECTION_CONTINUE_SENT: + if (0 != connection->read_buffer_offset) + { + process_request_body (connection); /* loop call */ + if (MHD_CONNECTION_CLOSED == connection->state) + continue; + } + if ( (0 == connection->remaining_upload_size) || + ( (MHD_SIZE_UNKNOWN == connection->remaining_upload_size) && + (0 == connection->read_buffer_offset) && + (connection->read_closed) ) ) + { + if ( (connection->have_chunked_upload) && + (! connection->read_closed) ) + connection->state = MHD_CONNECTION_BODY_RECEIVED; + else + connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + if (connection->suspended) + break; + continue; + } + break; + case MHD_CONNECTION_BODY_RECEIVED: + line = get_next_header_line (connection, + NULL); + if (NULL == line) + { + if (connection->state != MHD_CONNECTION_BODY_RECEIVED) + continue; + if (connection->read_closed) + { + CONNECTION_CLOSE_ERROR (connection, + NULL); + continue; + } + break; + } + if (0 == line[0]) + { + connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + if (connection->suspended) + break; + continue; + } + if (MHD_NO == process_header_line (connection, + line)) + { + transmit_error_response (connection, + MHD_HTTP_BAD_REQUEST, + REQUEST_MALFORMED); + break; + } + connection->state = MHD_CONNECTION_FOOTER_PART_RECEIVED; + continue; + case MHD_CONNECTION_FOOTER_PART_RECEIVED: + line = get_next_header_line (connection, + NULL); + if (NULL == line) + { + if (connection->state != MHD_CONNECTION_FOOTER_PART_RECEIVED) + continue; + if (connection->read_closed) + { + CONNECTION_CLOSE_ERROR (connection, + NULL); + continue; + } + break; + } + if (MHD_NO == + process_broken_line (connection, + line, + MHD_FOOTER_KIND)) + continue; + if (0 == line[0]) + { + connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + if (connection->suspended) + break; + continue; + } + continue; + case MHD_CONNECTION_FOOTERS_RECEIVED: + call_connection_handler (connection); /* "final" call */ + if (connection->state == MHD_CONNECTION_CLOSED) + continue; + if (NULL == connection->response) + break; /* try again next time */ + if (MHD_NO == build_header_response (connection)) + { + /* oops - close! */ + CONNECTION_CLOSE_ERROR (connection, + _("Closing connection (failed to create response header)\n")); + continue; + } + connection->state = MHD_CONNECTION_HEADERS_SENDING; + if (MHD_NO != socket_flush_possible (connection)) + socket_start_extra_buffering (connection); + else + socket_start_no_buffering (connection); + + break; + case MHD_CONNECTION_HEADERS_SENDING: + /* no default action */ + break; + case MHD_CONNECTION_HEADERS_SENT: + /* Some clients may take some actions right after header receive */ + if (MHD_NO != socket_flush_possible (connection)) + socket_start_no_buffering_flush (connection); + +#ifdef UPGRADE_SUPPORT + if (NULL != connection->response->upgrade_handler) + { + socket_start_normal_buffering (connection); + connection->state = MHD_CONNECTION_UPGRADE; + /* This connection is "upgraded". Pass socket to application. */ + if (MHD_YES != + MHD_response_execute_upgrade_ (connection->response, + connection)) + { + /* upgrade failed, fail hard */ + CONNECTION_CLOSE_ERROR (connection, + NULL); + continue; + } + /* Response is not required anymore for this connection. */ + if (NULL != connection->response) + { + struct MHD_Response * const resp = connection->response; + connection->response = NULL; + MHD_destroy_response (resp); + } + continue; + } +#endif /* UPGRADE_SUPPORT */ + if (MHD_NO != socket_flush_possible (connection)) + socket_start_extra_buffering (connection); + else + socket_start_normal_buffering (connection); + + if (connection->have_chunked_upload) + connection->state = MHD_CONNECTION_CHUNKED_BODY_UNREADY; + else + connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY; + continue; + case MHD_CONNECTION_NORMAL_BODY_READY: + /* nothing to do here */ + break; + case MHD_CONNECTION_NORMAL_BODY_UNREADY: + if (NULL != connection->response->crc) + MHD_mutex_lock_chk_ (&connection->response->mutex); + if (0 == connection->response->total_size) + { + if (NULL != connection->response->crc) + MHD_mutex_unlock_chk_ (&connection->response->mutex); + connection->state = MHD_CONNECTION_BODY_SENT; + continue; + } + if (MHD_YES == try_ready_normal_body (connection)) + { + if (NULL != connection->response->crc) + MHD_mutex_unlock_chk_ (&connection->response->mutex); + connection->state = MHD_CONNECTION_NORMAL_BODY_READY; + /* Buffering for flushable socket was already enabled*/ + if (MHD_NO == socket_flush_possible (connection)) + socket_start_no_buffering (connection); + break; + } + /* mutex was already unlocked by "try_ready_normal_body */ + /* not ready, no socket action */ + break; + case MHD_CONNECTION_CHUNKED_BODY_READY: + /* nothing to do here */ + break; + case MHD_CONNECTION_CHUNKED_BODY_UNREADY: + if (NULL != connection->response->crc) + MHD_mutex_lock_chk_ (&connection->response->mutex); + if ( (0 == connection->response->total_size) || + (connection->response_write_position == + connection->response->total_size) ) + { + if (NULL != connection->response->crc) + MHD_mutex_unlock_chk_ (&connection->response->mutex); + connection->state = MHD_CONNECTION_BODY_SENT; + continue; + } + if (MHD_YES == try_ready_chunked_body (connection)) + { + if (NULL != connection->response->crc) + MHD_mutex_unlock_chk_ (&connection->response->mutex); + connection->state = MHD_CONNECTION_CHUNKED_BODY_READY; + /* Buffering for flushable socket was already enabled */ + if (MHD_NO == socket_flush_possible (connection)) + socket_start_no_buffering (connection); + continue; + } + /* mutex was already unlocked by try_ready_chunked_body */ + break; + case MHD_CONNECTION_BODY_SENT: + if (MHD_NO == build_header_response (connection)) + { + /* oops - close! */ + CONNECTION_CLOSE_ERROR (connection, + _("Closing connection (failed to create response header)\n")); + continue; + } + if ( (! connection->have_chunked_upload) || + (connection->write_buffer_send_offset == + connection->write_buffer_append_offset) ) + connection->state = MHD_CONNECTION_FOOTERS_SENT; + else + connection->state = MHD_CONNECTION_FOOTERS_SENDING; + continue; + case MHD_CONNECTION_FOOTERS_SENDING: + /* no default action */ + break; + case MHD_CONNECTION_FOOTERS_SENT: + if (MHD_HTTP_PROCESSING == connection->responseCode) + { + /* After this type of response, we allow sending another! */ + connection->state = MHD_CONNECTION_HEADERS_PROCESSED; + MHD_destroy_response (connection->response); + connection->response = NULL; + /* FIXME: maybe partially reset memory pool? */ + continue; + } + if (MHD_NO != socket_flush_possible (connection)) + socket_start_no_buffering_flush (connection); + else + socket_start_normal_buffering (connection); + + MHD_destroy_response (connection->response); + connection->response = NULL; + if ( (NULL != daemon->notify_completed) && + (connection->client_aware) ) + { + connection->client_aware = false; + daemon->notify_completed (daemon->notify_completed_cls, + connection, + &connection->client_context, + MHD_REQUEST_TERMINATED_COMPLETED_OK); + } + if ( (MHD_CONN_USE_KEEPALIVE != connection->keepalive) || + (connection->read_closed) ) + { + /* have to close for some reason */ + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_COMPLETED_OK); + MHD_pool_destroy (connection->pool); + connection->pool = NULL; + connection->read_buffer = NULL; + connection->read_buffer_size = 0; + connection->read_buffer_offset = 0; + } + else + { + /* can try to keep-alive */ + if (MHD_NO != socket_flush_possible (connection)) + socket_start_normal_buffering (connection); + connection->version = NULL; + connection->state = MHD_CONNECTION_INIT; + connection->last = NULL; + connection->colon = NULL; + connection->header_size = 0; + connection->keepalive = MHD_CONN_KEEPALIVE_UNKOWN; + /* Reset the read buffer to the starting size, + preserving the bytes we have already read. */ + connection->read_buffer + = MHD_pool_reset (connection->pool, + connection->read_buffer, + connection->read_buffer_offset, + connection->daemon->pool_size / 2); + connection->read_buffer_size + = connection->daemon->pool_size / 2; + } + connection->client_aware = false; + connection->client_context = NULL; + connection->continue_message_write_offset = 0; + connection->responseCode = 0; + connection->headers_received = NULL; + connection->headers_received_tail = NULL; + connection->response_write_position = 0; + connection->have_chunked_upload = false; + connection->current_chunk_size = 0; + connection->current_chunk_offset = 0; + connection->method = NULL; + connection->url = NULL; + connection->write_buffer = NULL; + connection->write_buffer_size = 0; + connection->write_buffer_send_offset = 0; + connection->write_buffer_append_offset = 0; + continue; + case MHD_CONNECTION_CLOSED: + cleanup_connection (connection); + connection->in_idle = false; + return MHD_NO; +#ifdef UPGRADE_SUPPORT + case MHD_CONNECTION_UPGRADE: + connection->in_idle = false; + return MHD_YES; /* keep open */ +#endif /* UPGRADE_SUPPORT */ + default: + mhd_assert (0); + break; + } + break; + } + if (! connection->suspended) + { + time_t timeout; + timeout = connection->connection_timeout; + if ( (0 != timeout) && + (timeout < (MHD_monotonic_sec_counter() - connection->last_activity)) ) + { + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); + connection->in_idle = false; + return MHD_YES; + } + } + MHD_connection_update_event_loop_info (connection); + ret = MHD_YES; +#ifdef EPOLL_SUPPORT + if ( (! connection->suspended) && + (0 != (daemon->options & MHD_USE_EPOLL)) ) + { + ret = MHD_connection_epoll_update_ (connection); + } +#endif /* EPOLL_SUPPORT */ + connection->in_idle = false; + return ret; +} + + +#ifdef EPOLL_SUPPORT +/** + * Perform epoll() processing, possibly moving the connection back into + * the epoll() set if needed. + * + * @param connection connection to process + * @return #MHD_YES if we should continue to process the + * connection (not dead yet), #MHD_NO if it died + */ +int +MHD_connection_epoll_update_ (struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (0 == (connection->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) && + (0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED)) && + ( ( (MHD_EVENT_LOOP_INFO_WRITE == connection->event_loop_info) && + (0 == (connection->epoll_state & MHD_EPOLL_STATE_WRITE_READY))) || + ( (MHD_EVENT_LOOP_INFO_READ == connection->event_loop_info) && + (0 == (connection->epoll_state & MHD_EPOLL_STATE_READ_READY)) ) ) ) + { + /* add to epoll set */ + struct epoll_event event; + + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; + event.data.ptr = connection; + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_ADD, + connection->socket_fd, + &event)) + { +#ifdef HAVE_MESSAGES + if (0 != (daemon->options & MHD_USE_ERROR_LOG)) + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + connection->state = MHD_CONNECTION_CLOSED; + cleanup_connection (connection); + return MHD_NO; + } + connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET; + } + return MHD_YES; +} +#endif + + +/** + * Set callbacks for this connection to those for HTTP. + * + * @param connection connection to initialize + */ +void +MHD_set_http_callbacks_ (struct MHD_Connection *connection) +{ + connection->recv_cls = &recv_param_adapter; + connection->send_cls = &send_param_adapter; +} + + +/** + * Obtain information about the given connection. + * + * @param connection what connection to get information about + * @param info_type what information is desired? + * @param ... depends on @a info_type + * @return NULL if this information is not available + * (or if the @a info_type is unknown) + * @ingroup specialized + */ +const union MHD_ConnectionInfo * +MHD_get_connection_info (struct MHD_Connection *connection, + enum MHD_ConnectionInfoType info_type, + ...) +{ + switch (info_type) + { +#ifdef HTTPS_SUPPORT + case MHD_CONNECTION_INFO_CIPHER_ALGO: + if (NULL == connection->tls_session) + return NULL; + connection->cipher = gnutls_cipher_get (connection->tls_session); + return (const union MHD_ConnectionInfo *) &connection->cipher; + case MHD_CONNECTION_INFO_PROTOCOL: + if (NULL == connection->tls_session) + return NULL; + connection->protocol = gnutls_protocol_get_version (connection->tls_session); + return (const union MHD_ConnectionInfo *) &connection->protocol; + case MHD_CONNECTION_INFO_GNUTLS_SESSION: + if (NULL == connection->tls_session) + return NULL; + return (const union MHD_ConnectionInfo *) &connection->tls_session; +#endif /* HTTPS_SUPPORT */ + case MHD_CONNECTION_INFO_CLIENT_ADDRESS: + return (const union MHD_ConnectionInfo *) &connection->addr; + case MHD_CONNECTION_INFO_DAEMON: + return (const union MHD_ConnectionInfo *) &connection->daemon; + case MHD_CONNECTION_INFO_CONNECTION_FD: + return (const union MHD_ConnectionInfo *) &connection->socket_fd; + case MHD_CONNECTION_INFO_SOCKET_CONTEXT: + return (const union MHD_ConnectionInfo *) &connection->socket_context; + case MHD_CONNECTION_INFO_CONNECTION_SUSPENDED: + connection->suspended_dummy = connection->suspended ? MHD_YES : MHD_NO; + return (const union MHD_ConnectionInfo *) &connection->suspended_dummy; + case MHD_CONNECTION_INFO_CONNECTION_TIMEOUT: + connection->connection_timeout_dummy = (unsigned int)connection->connection_timeout; + return (const union MHD_ConnectionInfo *) &connection->connection_timeout_dummy; + case MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE: + if ( (MHD_CONNECTION_HEADERS_RECEIVED > connection->state) || + (MHD_CONNECTION_CLOSED == connection->state) || + (MHD_CONNECTION_IN_CLEANUP == connection->state) ) + return NULL; /* invalid, too early! */ + return (const union MHD_ConnectionInfo *) &connection->header_size; + default: + return NULL; + } +} + + +/** + * Set a custom option for the given connection, overriding defaults. + * + * @param connection connection to modify + * @param option option to set + * @param ... arguments to the option, depending on the option type + * @return #MHD_YES on success, #MHD_NO if setting the option failed + * @ingroup specialized + */ +int +MHD_set_connection_option (struct MHD_Connection *connection, + enum MHD_CONNECTION_OPTION option, + ...) +{ + va_list ap; + struct MHD_Daemon *daemon; + + daemon = connection->daemon; + switch (option) + { + case MHD_CONNECTION_OPTION_TIMEOUT: + if (0 == connection->connection_timeout) + connection->last_activity = MHD_monotonic_sec_counter(); + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (! connection->suspended) ) + { + if (connection->connection_timeout == daemon->connection_timeout) + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + else + XDLL_remove (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + connection); + } + va_start (ap, option); + connection->connection_timeout = va_arg (ap, + unsigned int); + va_end (ap); + if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (! connection->suspended) ) + { + if (connection->connection_timeout == daemon->connection_timeout) + XDLL_insert (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + else + XDLL_insert (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + connection); + } + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + return MHD_YES; + default: + return MHD_NO; + } +} + + +/** + * Queue a response to be transmitted to the client (as soon as + * possible but after #MHD_AccessHandlerCallback returns). + * + * @param connection the connection identifying the client + * @param status_code HTTP status code (i.e. #MHD_HTTP_OK) + * @param response response to transmit + * @return #MHD_NO on error (i.e. reply already sent), + * #MHD_YES on success or if message has been queued + * @ingroup response + */ +int +MHD_queue_response (struct MHD_Connection *connection, + unsigned int status_code, + struct MHD_Response *response) +{ + struct MHD_Daemon *daemon; + + if ( (NULL == connection) || + (NULL == response) || + (NULL != connection->response) || + ( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) && + (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) ) + return MHD_NO; + daemon = connection->daemon; + + if (daemon->shutdown) + return MHD_YES; /* If daemon was shut down in parallel, + * response will be aborted now or on later stage. */ + + if ( (!connection->suspended) && + (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) && + (!MHD_thread_ID_match_current_(connection->pid.ID)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Attempted to queue response on wrong thread!\n")); +#endif + return MHD_NO; + } +#ifdef UPGRADE_SUPPORT + if ( (NULL != response->upgrade_handler) && + (0 == (daemon->options & MHD_ALLOW_UPGRADE)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Attempted 'upgrade' connection on daemon without MHD_ALLOW_UPGRADE option!\n")); +#endif + return MHD_NO; + } + if ( (MHD_HTTP_SWITCHING_PROTOCOLS != status_code) && + (NULL != response->upgrade_handler) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Application used invalid status code for 'upgrade' response!\n")); +#endif + return MHD_NO; + } +#endif /* UPGRADE_SUPPORT */ + MHD_increment_response_rc (response); + connection->response = response; + connection->responseCode = status_code; +#if defined(_MHD_HAVE_SENDFILE) + if ( (response->fd == -1) || + (0 != (connection->daemon->options & MHD_USE_TLS)) ) + connection->resp_sender = MHD_resp_sender_std; + else + connection->resp_sender = MHD_resp_sender_sendfile; +#endif /* _MHD_HAVE_SENDFILE */ + + if ( ( (NULL != connection->method) && + (MHD_str_equal_caseless_ (connection->method, + MHD_HTTP_METHOD_HEAD)) ) || + (MHD_HTTP_OK > status_code) || + (MHD_HTTP_NO_CONTENT == status_code) || + (MHD_HTTP_NOT_MODIFIED == status_code) ) + { + /* if this is a "HEAD" request, or a status code for + which a body is not allowed, pretend that we + have already sent the full message body. */ + connection->response_write_position = response->total_size; + } + if ( (MHD_CONNECTION_HEADERS_PROCESSED == connection->state) && + (NULL != connection->method) && + ( (MHD_str_equal_caseless_ (connection->method, + MHD_HTTP_METHOD_POST)) || + (MHD_str_equal_caseless_ (connection->method, + MHD_HTTP_METHOD_PUT))) ) + { + /* response was queued "early", refuse to read body / footers or + further requests! */ + connection->read_closed = true; + connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; + } + if (! connection->in_idle) + (void) MHD_connection_handle_idle (connection); + return MHD_YES; +} + + +/* end of connection.c */ diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h new file mode 100644 index 0000000..a9df999 --- /dev/null +++ b/src/microhttpd/connection.h @@ -0,0 +1,183 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file connection.h + * @brief Methods for managing connections + * @author Daniel Pittman + * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef CONNECTION_H +#define CONNECTION_H + +#include "internal.h" + +/** + * Error code similar to EGAIN or EINTR + */ +#define MHD_ERR_AGAIN_ (-3073) + +/** + * Connection was hard-closed by remote peer. + */ +#define MHD_ERR_CONNRESET_ (-3074) + +/** + * Connection is not connected anymore due to + * network error or any other reason. + */ +#define MHD_ERR_NOTCONN_ (-3075) + +/** + * "Not enough memory" error code + */ +#define MHD_ERR_NOMEM_ (-3076) + +/** + * "Bad FD" error code + */ +#define MHD_ERR_BADF_ (-3077) + +/** + * Error code similar to EINVAL + */ +#define MHD_ERR_INVAL_ (-3078) + + +#ifdef HAVE_FREEBSD_SENDFILE +/** + * Initialises static variables + */ +void +MHD_conn_init_static_ (void); +#endif /* HAVE_FREEBSD_SENDFILE */ + + +/** + * Set callbacks for this connection to those for HTTP. + * + * @param connection connection to initialize + */ +void +MHD_set_http_callbacks_ (struct MHD_Connection *connection); + + +/** + * This function handles a particular connection when it has been + * determined that there is data to be read off a socket. All + * implementations (multithreaded, external select, internal select) + * call this function to handle reads. + * + * @param connection connection to handle + */ +void +MHD_connection_handle_read (struct MHD_Connection *connection); + + +/** + * This function was created to handle writes to sockets when it has + * been determined that the socket can be written to. All + * implementations (multithreaded, external select, internal select) + * call this function + * + * @param connection connection to handle + */ +void +MHD_connection_handle_write (struct MHD_Connection *connection); + + +/** + * This function was created to handle per-connection processing that + * has to happen even if the socket cannot be read or written to. All + * implementations (multithreaded, external select, internal select) + * call this function. + * @remark To be called only from thread that process connection's + * recv(), send() and response. + * + * @param connection connection to handle + * @return MHD_YES if we should continue to process the + * connection (not dead yet), MHD_NO if it died + */ +int +MHD_connection_handle_idle (struct MHD_Connection *connection); + + +/** + * Mark connection as "closed". + * @remark To be called from any thread. + * + * @param connection connection to close + */ +void +MHD_connection_mark_closed_ (struct MHD_Connection *connection); + + +/** + * Close the given connection and give the + * specified termination code to the user. + * @remark To be called only from thread that + * process connection's recv(), send() and response. + * + * @param connection connection to close + * @param termination_code termination reason to give + */ +void +MHD_connection_close_ (struct MHD_Connection *connection, + enum MHD_RequestTerminationCode termination_code); + + +#ifdef HTTPS_SUPPORT +/** + * Stop TLS forwarding on upgraded connection and + * reflect remote disconnect state to socketpair. + * @param connection the upgraded connection + */ +void +MHD_connection_finish_forward_ (struct MHD_Connection *connection); +#else /* ! HTTPS_SUPPORT */ +#define MHD_connection_finish_forward_(conn) (void)conn +#endif /* ! HTTPS_SUPPORT */ + + +#ifdef EPOLL_SUPPORT +/** + * Perform epoll processing, possibly moving the connection back into + * the epoll set if needed. + * + * @param connection connection to process + * @return MHD_YES if we should continue to process the + * connection (not dead yet), MHD_NO if it died + */ +int +MHD_connection_epoll_update_ (struct MHD_Connection *connection); +#endif + +/** + * Update the 'last_activity' field of the connection to the current time + * and move the connection to the head of the 'normal_timeout' list if + * the timeout for the connection uses the default value. + * + * @param connection the connection that saw some activity + */ +void +MHD_update_last_activity_ (struct MHD_Connection *connection); + +#endif diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c new file mode 100644 index 0000000..6362313 --- /dev/null +++ b/src/microhttpd/connection_https.c @@ -0,0 +1,228 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008, 2010 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file connection_https.c + * @brief Methods for managing SSL/TLS connections. This file is only + * compiled if ENABLE_HTTPS is set. + * @author Sagie Amir + * @author Christian Grothoff + */ + +#include "internal.h" +#include "connection.h" +#include "connection_https.h" +#include "memorypool.h" +#include "response.h" +#include "mhd_mono_clock.h" +#include + + +/** + * Callback for receiving data from the socket. + * + * @param connection the MHD_Connection structure + * @param other where to write received data to + * @param i maximum size of other (in bytes) + * @return positive value for number of bytes actually received or + * negative value for error number MHD_ERR_xxx_ + */ +static ssize_t +recv_tls_adapter (struct MHD_Connection *connection, + void *other, + size_t i) +{ + ssize_t res; + + if (i > SSIZE_MAX) + i = SSIZE_MAX; + + res = gnutls_record_recv (connection->tls_session, + other, + i); + if ( (GNUTLS_E_AGAIN == res) || + (GNUTLS_E_INTERRUPTED == res) ) + { +#ifdef EPOLL_SUPPORT + if (GNUTLS_E_AGAIN == res) + connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; +#endif + /* Any network errors means that buffer is empty. */ + connection->tls_read_ready = false; + return MHD_ERR_AGAIN_; + } + if (res < 0) + { + /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication + disrupted); interpret as a hard error */ + connection->tls_read_ready = false; + return MHD_ERR_NOTCONN_; + } + +#ifdef EPOLL_SUPPORT + /* Unlike non-TLS connections, do not reset "read-ready" if + * received amount smaller than provided amount, as TLS + * connections may receive data by fixed-size chunks. */ +#endif /* EPOLL_SUPPORT */ + + /* Check whether TLS buffers still have some unread data. */ + connection->tls_read_ready = ( ((size_t)res == i) && + (0 != gnutls_record_check_pending (connection->tls_session)) ); + return res; +} + + +/** + * Callback for writing data to the socket. + * + * @param connection the MHD connection structure + * @param other data to write + * @param i number of bytes to write + * @return positive value for number of bytes actually sent or + * negative value for error number MHD_ERR_xxx_ + */ +static ssize_t +send_tls_adapter (struct MHD_Connection *connection, + const void *other, + size_t i) +{ + ssize_t res; + + if (i > SSIZE_MAX) + i = SSIZE_MAX; + + res = gnutls_record_send (connection->tls_session, + other, + i); + if ( (GNUTLS_E_AGAIN == res) || + (GNUTLS_E_INTERRUPTED == res) ) + { +#ifdef EPOLL_SUPPORT + if (GNUTLS_E_AGAIN == res) + connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; +#endif + return MHD_ERR_AGAIN_; + } + if (res < 0) + { + /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication + disrupted); interpret as a hard error */ + return MHD_ERR_NOTCONN_; + } +#ifdef EPOLL_SUPPORT + /* Unlike non-TLS connections, do not reset "write-ready" if + * sent amount smaller than provided amount, as TLS + * connections may break data into smaller parts for sending. */ +#endif /* EPOLL_SUPPORT */ + return res; +} + + +/** + * Give gnuTLS chance to work on the TLS handshake. + * + * @param connection connection to handshake on + * @return true if the handshake has completed successfully + * and we should start to read/write data, + * false is handshake in progress or in case + * of error + */ +bool +MHD_run_tls_handshake_ (struct MHD_Connection *connection) +{ + int ret; + + if ((MHD_TLS_CONN_INIT == connection->tls_state) || + (MHD_TLS_CONN_HANDSHAKING == connection->tls_state)) + { + ret = gnutls_handshake (connection->tls_session); + if (ret == GNUTLS_E_SUCCESS) + { + /* set connection TLS state to enable HTTP processing */ + connection->tls_state = MHD_TLS_CONN_CONNECTED; + MHD_update_last_activity_ (connection); + return true; + } + if ( (GNUTLS_E_AGAIN == ret) || + (GNUTLS_E_INTERRUPTED == ret) ) + { + connection->tls_state = MHD_TLS_CONN_HANDSHAKING; + /* handshake not done */ + return false; + } + /* handshake failed */ + connection->tls_state = MHD_TLS_CONN_TLS_FAILED; +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Error: received handshake message out of context\n")); +#endif + MHD_connection_close_ (connection, + MHD_REQUEST_TERMINATED_WITH_ERROR); + return false; + } + return true; +} + + +/** + * Set connection callback function to be used through out + * the processing of this secure connection. + * + * @param connection which callbacks should be modified + */ +void +MHD_set_https_callbacks (struct MHD_Connection *connection) +{ + connection->recv_cls = &recv_tls_adapter; + connection->send_cls = &send_tls_adapter; +} + + +/** + * Initiate shutdown of TLS layer of connection. + * + * @param connection to use + * @return true if succeed, false otherwise. + */ +bool +MHD_tls_connection_shutdown (struct MHD_Connection *connection) +{ + if (MHD_TLS_CONN_WR_CLOSED > connection->tls_state) + { + const int res = + gnutls_bye(connection->tls_session, GNUTLS_SHUT_WR); + if (GNUTLS_E_SUCCESS == res) + { + connection->tls_state = MHD_TLS_CONN_WR_CLOSED; + return true; + } + if ((GNUTLS_E_AGAIN == res) || + (GNUTLS_E_INTERRUPTED == res)) + { + connection->tls_state = MHD_TLS_CONN_WR_CLOSING; + return true; + } + else + connection->tls_state = MHD_TLS_CONN_TLS_FAILED; + } + return false; +} + +/* end of connection_https.c */ diff --git a/src/microhttpd/connection_https.h b/src/microhttpd/connection_https.h new file mode 100644 index 0000000..1c12ea9 --- /dev/null +++ b/src/microhttpd/connection_https.h @@ -0,0 +1,65 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2008 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file connection_https.h + * @brief Methods for managing connections + * @author Christian Grothoff + */ + +#ifndef CONNECTION_HTTPS_H +#define CONNECTION_HTTPS_H + +#include "internal.h" + +#ifdef HTTPS_SUPPORT +/** + * Set connection callback function to be used through out + * the processing of this secure connection. + * + * @param connection which callbacks should be modified + */ +void +MHD_set_https_callbacks (struct MHD_Connection *connection); + + +/** + * Give gnuTLS chance to work on the TLS handshake. + * + * @param connection connection to handshake on + * @return true if the handshake has completed successfully + * and we should start to read/write data, + * false is handshake in progress or in case + * of error + */ +bool +MHD_run_tls_handshake_ (struct MHD_Connection *connection); + + +/** + * Initiate shutdown of TLS layer of connection. + * + * @param connection to use + * @return true if succeed, false otherwise. + */ +bool +MHD_tls_connection_shutdown (struct MHD_Connection *connection); +#endif /* HTTPS_SUPPORT */ + +#endif diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c new file mode 100644 index 0000000..56cd453 --- /dev/null +++ b/src/microhttpd/daemon.c @@ -0,0 +1,6801 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007-2017 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/daemon.c + * @brief A minimal-HTTP server library + * @author Daniel Pittman + * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) + */ +#include "platform.h" +#include "mhd_threads.h" +#include "internal.h" +#include "response.h" +#include "connection.h" +#include "memorypool.h" +#include "mhd_limits.h" +#include "autoinit_funcs.h" +#include "mhd_mono_clock.h" +#include "mhd_locks.h" +#include "mhd_sockets.h" +#include "mhd_itc.h" +#include "mhd_compat.h" + +#if HAVE_SEARCH_H +#include +#else +#include "tsearch.h" +#endif + +#ifdef HTTPS_SUPPORT +#include "connection_https.h" +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#endif /* HTTPS_SUPPORT */ + +#if defined(_WIN32) && ! defined(__CYGWIN__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +/** + * Default connection limit. + */ +#ifdef MHD_POSIX_SOCKETS +#define MHD_MAX_CONNECTIONS_DEFAULT (FD_SETSIZE - 4) +#else +#define MHD_MAX_CONNECTIONS_DEFAULT (FD_SETSIZE - 2) +#endif + +/** + * Default memory allowed per connection. + */ +#define MHD_POOL_SIZE_DEFAULT (32 * 1024) + +/** + * Print extra messages with reasons for closing + * sockets? (only adds non-error messages). + */ +#define DEBUG_CLOSE MHD_NO + +/** + * Print extra messages when establishing + * connections? (only adds non-error messages). + */ +#define DEBUG_CONNECT MHD_NO + + +/* Forward declarations. */ + +/** + * Close all connections for the daemon. + * Must only be called when MHD_Daemon::shutdown was set to #MHD_YES. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param daemon daemon to close down + */ +static void +close_all_connections (struct MHD_Daemon *daemon); + +#ifdef EPOLL_SUPPORT + +/** + * Do epoll()-based processing (this function is allowed to + * block if @a may_block is set to #MHD_YES). + * + * @param daemon daemon to run poll loop for + * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking + * @return #MHD_NO on serious errors, #MHD_YES on success + */ +static int +MHD_epoll (struct MHD_Daemon *daemon, + int may_block); + +#endif /* EPOLL_SUPPORT */ + +/** + * Default implementation of the panic function, + * prints an error message and aborts. + * + * @param cls unused + * @param file name of the file with the problem + * @param line line number with the problem + * @param reason error message with details + */ +static void +mhd_panic_std (void *cls, + const char *file, + unsigned int line, + const char *reason) +{ + (void)cls; /* Mute compiler warning. */ +#ifdef HAVE_MESSAGES + fprintf (stderr, + _("Fatal error in GNU libmicrohttpd %s:%u: %s\n"), + file, + line, + reason); +#else /* ! HAVE_MESSAGES */ + (void)file; /* Mute compiler warning. */ + (void)line; /* Mute compiler warning. */ + (void)reason; /* Mute compiler warning. */ +#endif + abort (); +} + + +/** + * Handler for fatal errors. + */ +MHD_PanicCallback mhd_panic = NULL; + +/** + * Closure argument for #mhd_panic. + */ +void *mhd_panic_cls = NULL; + +/** + * Globally initialise library. + */ +void +MHD_init(void); + + +#if defined(_WIN32) && ! defined(__CYGWIN__) +/** + * Track initialization of winsock + */ +static int mhd_winsock_inited_ = 0; +#endif + +#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED +/** + * Do nothing - global initialisation is + * performed by library constructor. + */ +#define MHD_check_global_init_() (void)0 +#else /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */ +/** + * Track global initialisation + */ +volatile int global_init_count = 0; +#ifdef MHD_MUTEX_STATIC_DEFN_INIT_ +/** + * Global initialisation mutex + */ +MHD_MUTEX_STATIC_DEFN_INIT_(global_init_mutex_); +#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */ +/** + * Check whether global initialisation was performed + * and call initialiser if necessary. + */ +void +MHD_check_global_init_ (void) +{ +#ifdef MHD_MUTEX_STATIC_DEFN_INIT_ + MHD_mutex_lock_chk_(&global_init_mutex_); +#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */ + if (0 == global_init_count++) + MHD_init (); +#ifdef MHD_MUTEX_STATIC_DEFN_INIT_ + MHD_mutex_unlock_chk_(&global_init_mutex_); +#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */ +} +#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */ + +/** + * Trace up to and return master daemon. If the supplied daemon + * is a master, then return the daemon itself. + * + * @param daemon handle to a daemon + * @return master daemon handle + */ +static struct MHD_Daemon* +MHD_get_master (struct MHD_Daemon *daemon) +{ + while (NULL != daemon->master) + daemon = daemon->master; + return daemon; +} + + +/** + * Maintain connection count for single address. + */ +struct MHD_IPCount +{ + /** + * Address family. AF_INET or AF_INET6 for now. + */ + int family; + + /** + * Actual address. + */ + union + { + /** + * IPv4 address. + */ + struct in_addr ipv4; +#if HAVE_INET6 + /** + * IPv6 address. + */ + struct in6_addr ipv6; +#endif + } addr; + + /** + * Counter. + */ + unsigned int count; +}; + + +/** + * Lock shared structure for IP connection counts and connection DLLs. + * + * @param daemon handle to daemon where lock is + */ +static void +MHD_ip_count_lock (struct MHD_Daemon *daemon) +{ + MHD_mutex_lock_chk_(&daemon->per_ip_connection_mutex); +} + + +/** + * Unlock shared structure for IP connection counts and connection DLLs. + * + * @param daemon handle to daemon where lock is + */ +static void +MHD_ip_count_unlock (struct MHD_Daemon *daemon) +{ + MHD_mutex_unlock_chk_(&daemon->per_ip_connection_mutex); +} + + +/** + * Tree comparison function for IP addresses (supplied to tsearch() family). + * We compare everything in the struct up through the beginning of the + * 'count' field. + * + * @param a1 first address to compare + * @param a2 second address to compare + * @return -1, 0 or 1 depending on result of compare + */ +static int +MHD_ip_addr_compare (const void *a1, + const void *a2) +{ + return memcmp (a1, + a2, + offsetof (struct MHD_IPCount, + count)); +} + + +/** + * Parse address and initialize @a key using the address. + * + * @param addr address to parse + * @param addrlen number of bytes in @a addr + * @param key where to store the parsed address + * @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address type) + */ +static int +MHD_ip_addr_to_key (const struct sockaddr *addr, + socklen_t addrlen, + struct MHD_IPCount *key) +{ + memset(key, + 0, + sizeof(*key)); + + /* IPv4 addresses */ + if (sizeof (struct sockaddr_in) == addrlen) + { + const struct sockaddr_in *addr4 = (const struct sockaddr_in*) addr; + + key->family = AF_INET; + memcpy (&key->addr.ipv4, + &addr4->sin_addr, + sizeof(addr4->sin_addr)); + return MHD_YES; + } + +#if HAVE_INET6 + /* IPv6 addresses */ + if (sizeof (struct sockaddr_in6) == addrlen) + { + const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6*) addr; + + key->family = AF_INET6; + memcpy (&key->addr.ipv6, + &addr6->sin6_addr, + sizeof(addr6->sin6_addr)); + return MHD_YES; + } +#endif + + /* Some other address */ + return MHD_NO; +} + + +/** + * Check if IP address is over its limit in terms of the number + * of allowed concurrent connections. If the IP is still allowed, + * increments the connection counter. + * + * @param daemon handle to daemon where connection counts are tracked + * @param addr address to add (or increment counter) + * @param addrlen number of bytes in @a addr + * @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed limit. + * Also returns #MHD_NO if fails to allocate memory. + */ +static int +MHD_ip_limit_add (struct MHD_Daemon *daemon, + const struct sockaddr *addr, + socklen_t addrlen) +{ + struct MHD_IPCount *key; + void **nodep; + void *node; + int result; + + daemon = MHD_get_master (daemon); + /* Ignore if no connection limit assigned */ + if (0 == daemon->per_ip_connection_limit) + return MHD_YES; + + if (NULL == (key = malloc (sizeof(*key)))) + return MHD_NO; + + /* Initialize key */ + if (MHD_NO == MHD_ip_addr_to_key (addr, + addrlen, + key)) + { + /* Allow unhandled address types through */ + free (key); + return MHD_YES; + } + MHD_ip_count_lock (daemon); + + /* Search for the IP address */ + if (NULL == (nodep = tsearch (key, + &daemon->per_ip_connection_count, + &MHD_ip_addr_compare))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to add IP connection count node\n")); +#endif + MHD_ip_count_unlock (daemon); + free (key); + return MHD_NO; + } + node = *nodep; + /* If we got an existing node back, free the one we created */ + if (node != key) + free(key); + key = (struct MHD_IPCount *) node; + /* Test if there is room for another connection; if so, + * increment count */ + result = (key->count < daemon->per_ip_connection_limit) ? MHD_YES : MHD_NO; + if (MHD_YES == result) + ++key->count; + + MHD_ip_count_unlock (daemon); + return result; +} + + +/** + * Decrement connection count for IP address, removing from table + * count reaches 0. + * + * @param daemon handle to daemon where connection counts are tracked + * @param addr address to remove (or decrement counter) + * @param addrlen number of bytes in @a addr + */ +static void +MHD_ip_limit_del (struct MHD_Daemon *daemon, + const struct sockaddr *addr, + socklen_t addrlen) +{ + struct MHD_IPCount search_key; + struct MHD_IPCount *found_key; + void **nodep; + + daemon = MHD_get_master (daemon); + /* Ignore if no connection limit assigned */ + if (0 == daemon->per_ip_connection_limit) + return; + /* Initialize search key */ + if (MHD_NO == MHD_ip_addr_to_key (addr, + addrlen, + &search_key)) + return; + + MHD_ip_count_lock (daemon); + + /* Search for the IP address */ + if (NULL == (nodep = tfind (&search_key, + &daemon->per_ip_connection_count, + &MHD_ip_addr_compare))) + { + /* Something's wrong if we couldn't find an IP address + * that was previously added */ + MHD_PANIC (_("Failed to find previously-added IP address\n")); + } + found_key = (struct MHD_IPCount *) *nodep; + /* Validate existing count for IP address */ + if (0 == found_key->count) + { + MHD_PANIC (_("Previously-added IP address had counter of zero\n")); + } + /* Remove the node entirely if count reduces to 0 */ + if (0 == --found_key->count) + { + tdelete (found_key, + &daemon->per_ip_connection_count, + &MHD_ip_addr_compare); + free (found_key); + } + + MHD_ip_count_unlock (daemon); +} + + +#ifdef HTTPS_SUPPORT +/** + * Read and setup our certificate and key. + * + * @param daemon handle to daemon to initialize + * @return 0 on success + */ +static int +MHD_init_daemon_certificate (struct MHD_Daemon *daemon) +{ + gnutls_datum_t key; + gnutls_datum_t cert; + int ret; + +#if GNUTLS_VERSION_MAJOR >= 3 + if (NULL != daemon->cert_callback) + { + gnutls_certificate_set_retrieve_function2 (daemon->x509_cred, + daemon->cert_callback); + } +#endif + if (NULL != daemon->https_mem_trust) + { + cert.data = (unsigned char *) daemon->https_mem_trust; + cert.size = strlen (daemon->https_mem_trust); + if (gnutls_certificate_set_x509_trust_mem (daemon->x509_cred, + &cert, + GNUTLS_X509_FMT_PEM) < 0) + { +#ifdef HAVE_MESSAGES + MHD_DLOG(daemon, + "Bad trust certificate format\n"); +#endif + return -1; + } + } + + if (daemon->have_dhparams) + { + gnutls_certificate_set_dh_params (daemon->x509_cred, + daemon->https_mem_dhparams); + } + /* certificate & key loaded from memory */ + if ( (NULL != daemon->https_mem_cert) && + (NULL != daemon->https_mem_key) ) + { + key.data = (unsigned char *) daemon->https_mem_key; + key.size = strlen (daemon->https_mem_key); + cert.data = (unsigned char *) daemon->https_mem_cert; + cert.size = strlen (daemon->https_mem_cert); + + if (NULL != daemon->https_key_password) { +#if GNUTLS_VERSION_NUMBER >= 0x030111 + ret = gnutls_certificate_set_x509_key_mem2 (daemon->x509_cred, + &cert, + &key, + GNUTLS_X509_FMT_PEM, + daemon->https_key_password, + 0); +#else +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to setup x509 certificate/key: pre 3.X.X version " \ + "of GnuTLS does not support setting key password")); +#endif + return -1; +#endif + } + else + ret = gnutls_certificate_set_x509_key_mem (daemon->x509_cred, + &cert, + &key, + GNUTLS_X509_FMT_PEM); +#ifdef HAVE_MESSAGES + if (0 != ret) + MHD_DLOG (daemon, + "GnuTLS failed to setup x509 certificate/key: %s\n", + gnutls_strerror (ret)); +#endif + return ret; + } +#if GNUTLS_VERSION_MAJOR >= 3 + if (NULL != daemon->cert_callback) + return 0; +#endif +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + "You need to specify a certificate and key location\n"); +#endif + return -1; +} + + +/** + * Initialize security aspects of the HTTPS daemon + * + * @param daemon handle to daemon to initialize + * @return 0 on success + */ +static int +MHD_TLS_init (struct MHD_Daemon *daemon) +{ + switch (daemon->cred_type) + { + case GNUTLS_CRD_CERTIFICATE: + if (0 != + gnutls_certificate_allocate_credentials (&daemon->x509_cred)) + return GNUTLS_E_MEMORY_ERROR; + return MHD_init_daemon_certificate (daemon); + default: +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error: invalid credentials type %d specified.\n"), + daemon->cred_type); +#endif + return -1; + } +} +#endif /* HTTPS_SUPPORT */ + + +#undef MHD_get_fdset + +/** + * Obtain the `select()` sets for this daemon. + * Daemon's FDs will be added to fd_sets. To get only + * daemon FDs in fd_sets, call FD_ZERO for each fd_set + * before calling this function. FD_SETSIZE is assumed + * to be platform's default. + * + * This function should only be called in when MHD is configured to + * use external select with 'select()' or with 'epoll'. + * In the latter case, it will only add the single 'epoll' file + * descriptor used by MHD to the sets. + * It's necessary to use #MHD_get_timeout() in combination with + * this function. + * + * This function must be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. + * + * @param daemon daemon to get sets from + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @param max_fd increased to largest FD added (if larger + * than existing value); can be NULL + * @return #MHD_YES on success, #MHD_NO if this + * daemon was not started with the right + * options for this call or any FD didn't + * fit fd_set. + * @ingroup event + */ +int +MHD_get_fdset (struct MHD_Daemon *daemon, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *except_fd_set, + MHD_socket *max_fd) +{ + return MHD_get_fdset2 (daemon, + read_fd_set, + write_fd_set, + except_fd_set, + max_fd, + _MHD_SYS_DEFAULT_FD_SETSIZE); +} + + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) +/** + * Obtain the select() file descriptor sets for the + * given @a urh. + * + * @param urh upgrade handle to wait for + * @param[out] rs read set to initialize + * @param[out] ws write set to initialize + * @param[out] es except set to initialize + * @param[out] max_fd maximum FD to update + * @param fd_setsize value of FD_SETSIZE + * @return true on success, false on error + */ +static bool +urh_to_fdset (struct MHD_UpgradeResponseHandle *urh, + fd_set *rs, + fd_set *ws, + fd_set *es, + MHD_socket *max_fd, + unsigned int fd_setsize) +{ + const MHD_socket conn_sckt = urh->connection->socket_fd; + const MHD_socket mhd_sckt = urh->mhd.socket; + bool res = true; + + /* Do not add to 'es' only if socket is closed + * or not used anymore. */ + if (MHD_INVALID_SOCKET != conn_sckt) + { + if ( (urh->in_buffer_used < urh->in_buffer_size) && + (! MHD_add_to_fd_set_ (conn_sckt, + rs, + max_fd, + fd_setsize)) ) + res = false; + if ( (0 != urh->out_buffer_used) && + (! MHD_add_to_fd_set_ (conn_sckt, + ws, + max_fd, + fd_setsize)) ) + res = false; + /* Do not monitor again for errors if error was detected before as + * error state is remembered. */ + if ((0 == (urh->app.celi & MHD_EPOLL_STATE_ERROR)) && + ((0 != urh->in_buffer_size) || + (0 != urh->out_buffer_size) || + (0 != urh->out_buffer_used))) + MHD_add_to_fd_set_ (conn_sckt, + es, + max_fd, + fd_setsize); + } + if (MHD_INVALID_SOCKET != mhd_sckt) + { + if ( (urh->out_buffer_used < urh->out_buffer_size) && + (! MHD_add_to_fd_set_ (mhd_sckt, + rs, + max_fd, + fd_setsize)) ) + res = false; + if ( (0 != urh->in_buffer_used) && + (! MHD_add_to_fd_set_ (mhd_sckt, + ws, + max_fd, + fd_setsize)) ) + res = false; + /* Do not monitor again for errors if error was detected before as + * error state is remembered. */ + if ((0 == (urh->mhd.celi & MHD_EPOLL_STATE_ERROR)) && + ((0 != urh->out_buffer_size) || + (0 != urh->in_buffer_size) || + (0 != urh->in_buffer_used))) + MHD_add_to_fd_set_ (mhd_sckt, + es, + max_fd, + fd_setsize); + } + + return res; +} + + +/** + * Update the @a urh based on the ready FDs in + * the @a rs, @a ws, and @a es. + * + * @param urh upgrade handle to update + * @param rs read result from select() + * @param ws write result from select() + * @param es except result from select() + */ +static void +urh_from_fdset (struct MHD_UpgradeResponseHandle *urh, + const fd_set *rs, + const fd_set *ws, + const fd_set *es) +{ + const MHD_socket conn_sckt = urh->connection->socket_fd; + const MHD_socket mhd_sckt = urh->mhd.socket; + + /* Reset read/write ready, preserve error state. */ + urh->app.celi &= (~MHD_EPOLL_STATE_READ_READY & ~MHD_EPOLL_STATE_WRITE_READY); + urh->mhd.celi &= (~MHD_EPOLL_STATE_READ_READY & ~MHD_EPOLL_STATE_WRITE_READY); + + if (MHD_INVALID_SOCKET != conn_sckt) + { + if (FD_ISSET (conn_sckt, rs)) + urh->app.celi |= MHD_EPOLL_STATE_READ_READY; + if (FD_ISSET (conn_sckt, ws)) + urh->app.celi |= MHD_EPOLL_STATE_WRITE_READY; + if (FD_ISSET (conn_sckt, es)) + urh->app.celi |= MHD_EPOLL_STATE_ERROR; + } + if ((MHD_INVALID_SOCKET != mhd_sckt)) + { + if (FD_ISSET (mhd_sckt, rs)) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; + if (FD_ISSET (mhd_sckt, ws)) + urh->mhd.celi |= MHD_EPOLL_STATE_WRITE_READY; + if (FD_ISSET (mhd_sckt, es)) + urh->mhd.celi |= MHD_EPOLL_STATE_ERROR; + } +} + +#ifdef HAVE_POLL + +/** + * Set required 'event' members in 'pollfd' elements, + * assuming that @a p[0].fd is MHD side of socketpair + * and @a p[1].fd is TLS connected socket. + * + * @param urh upgrade handle to watch for + * @param p pollfd array to update + */ +static void +urh_update_pollfd(struct MHD_UpgradeResponseHandle *urh, + struct pollfd p[2]) +{ + p[0].events = 0; + p[1].events = 0; + + if (urh->in_buffer_used < urh->in_buffer_size) + p[0].events |= POLLIN; + if (0 != urh->out_buffer_used) + p[0].events |= POLLOUT; + + /* Do not monitor again for errors if error was detected before as + * error state is remembered. */ + if ((0 == (urh->app.celi & MHD_EPOLL_STATE_ERROR)) && + ((0 != urh->in_buffer_size) || + (0 != urh->out_buffer_size) || + (0 != urh->out_buffer_used))) + p[0].events |= MHD_POLL_EVENTS_ERR_DISC; + + if (urh->out_buffer_used < urh->out_buffer_size) + p[1].events |= POLLIN; + if (0 != urh->in_buffer_used) + p[1].events |= POLLOUT; + + /* Do not monitor again for errors if error was detected before as + * error state is remembered. */ + if ((0 == (urh->mhd.celi & MHD_EPOLL_STATE_ERROR)) && + ((0 != urh->out_buffer_size) || + (0 != urh->in_buffer_size) || + (0 != urh->in_buffer_used))) + p[1].events |= MHD_POLL_EVENTS_ERR_DISC; +} + + +/** + * Set @a p to watch for @a urh. + * + * @param urh upgrade handle to watch for + * @param p pollfd array to set + */ +static void +urh_to_pollfd(struct MHD_UpgradeResponseHandle *urh, + struct pollfd p[2]) +{ + p[0].fd = urh->connection->socket_fd; + p[1].fd = urh->mhd.socket; + urh_update_pollfd(urh, p); +} + + +/** + * Update ready state in @a urh based on pollfd. + * @param urh upgrade handle to update + * @param p 'poll()' processed pollfd. + */ +static void +urh_from_pollfd(struct MHD_UpgradeResponseHandle *urh, + struct pollfd p[2]) +{ + /* Reset read/write ready, preserve error state. */ + urh->app.celi &= (~MHD_EPOLL_STATE_READ_READY & ~MHD_EPOLL_STATE_WRITE_READY); + urh->mhd.celi &= (~MHD_EPOLL_STATE_READ_READY & ~MHD_EPOLL_STATE_WRITE_READY); + + if (0 != (p[0].revents & POLLIN)) + urh->app.celi |= MHD_EPOLL_STATE_READ_READY; + if (0 != (p[0].revents & POLLOUT)) + urh->app.celi |= MHD_EPOLL_STATE_WRITE_READY; + if (0 != (p[0].revents & POLLHUP)) + urh->app.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; + if (0 != (p[0].revents & MHD_POLL_REVENTS_ERRROR)) + urh->app.celi |= MHD_EPOLL_STATE_ERROR; + if (0 != (p[1].revents & POLLIN)) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; + if (0 != (p[1].revents & POLLOUT)) + urh->mhd.celi |= MHD_EPOLL_STATE_WRITE_READY; + if (0 != (p[1].revents & POLLHUP)) + urh->mhd.celi |= MHD_EPOLL_STATE_ERROR; + if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR)) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; +} +#endif /* HAVE_POLL */ +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + +/** + * Internal version of #MHD_get_fdset2(). + * + * @param daemon daemon to get sets from + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @param max_fd increased to largest FD added (if larger + * than existing value); can be NULL + * @param fd_setsize value of FD_SETSIZE + * @return #MHD_YES on success, #MHD_NO if any FD didn't + * fit fd_set. + * @ingroup event + */ +static int +internal_get_fdset2 (struct MHD_Daemon *daemon, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *except_fd_set, + MHD_socket *max_fd, + unsigned int fd_setsize) + +{ + struct MHD_Connection *pos; + struct MHD_Connection *posn; + int result = MHD_YES; + MHD_socket ls; + + if (daemon->shutdown) + return MHD_NO; + + ls = daemon->listen_fd; + if ( (MHD_INVALID_SOCKET != ls) && + (! daemon->was_quiesced) && + (! MHD_add_to_fd_set_ (ls, + read_fd_set, + max_fd, + fd_setsize)) ) + result = MHD_NO; + + /* Add all sockets to 'except_fd_set' as well to watch for + * out-of-band data. However, ignore errors if INFO_READ + * or INFO_WRITE sockets will not fit 'except_fd_set'. */ + /* Start from oldest connections. Make sense for W32 FDSETs. */ + for (pos = daemon->connections_tail; NULL != pos; pos = posn) + { + posn = pos->prev; + + switch (pos->event_loop_info) + { + case MHD_EVENT_LOOP_INFO_READ: + if (! MHD_add_to_fd_set_ (pos->socket_fd, + read_fd_set, + max_fd, + fd_setsize)) + result = MHD_NO; +#ifdef MHD_POSIX_SOCKETS + MHD_add_to_fd_set_ (pos->socket_fd, + except_fd_set, + max_fd, + fd_setsize); +#endif /* MHD_POSIX_SOCKETS */ + break; + case MHD_EVENT_LOOP_INFO_WRITE: + if (! MHD_add_to_fd_set_ (pos->socket_fd, + write_fd_set, + max_fd, + fd_setsize)) + result = MHD_NO; +#ifdef MHD_POSIX_SOCKETS + MHD_add_to_fd_set_ (pos->socket_fd, + except_fd_set, + max_fd, + fd_setsize); +#endif /* MHD_POSIX_SOCKETS */ + break; + case MHD_EVENT_LOOP_INFO_BLOCK: + if ( (NULL == except_fd_set) || + ! MHD_add_to_fd_set_ (pos->socket_fd, + except_fd_set, + max_fd, + fd_setsize)) + result = MHD_NO; + break; + case MHD_EVENT_LOOP_INFO_CLEANUP: + /* this should never happen */ + break; + } + } +#ifdef MHD_WINSOCK_SOCKETS + /* W32 use limited array for fd_set so add INFO_READ/INFO_WRITE sockets + * only after INFO_BLOCK sockets to ensure that INFO_BLOCK sockets will + * not be pushed out. */ + for (pos = daemon->connections_tail; NULL != pos; pos = posn) + { + posn = pos->prev; + MHD_add_to_fd_set_ (pos->socket_fd, + except_fd_set, + max_fd, + fd_setsize); + } +#endif /* MHD_WINSOCK_SOCKETS */ +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + { + struct MHD_UpgradeResponseHandle *urh; + + for (urh = daemon->urh_tail; NULL != urh; urh = urh->prev) + { + if (MHD_NO == + urh_to_fdset (urh, + read_fd_set, + write_fd_set, + except_fd_set, + max_fd, + fd_setsize)) + result = MHD_NO; + } + } +#endif +#if DEBUG_CONNECT +#ifdef HAVE_MESSAGES + if (NULL != max_fd) + MHD_DLOG (daemon, + _("Maximum socket in select set: %d\n"), + *max_fd); +#endif +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + return result; +} + + +/** + * Obtain the `select()` sets for this daemon. + * Daemon's FDs will be added to fd_sets. To get only + * daemon FDs in fd_sets, call FD_ZERO for each fd_set + * before calling this function. + * + * Passing custom FD_SETSIZE as @a fd_setsize allow usage of + * larger/smaller than platform's default fd_sets. + * + * This function should only be called in when MHD is configured to + * use external select with 'select()' or with 'epoll'. + * In the latter case, it will only add the single 'epoll' file + * descriptor used by MHD to the sets. + * It's necessary to use #MHD_get_timeout() in combination with + * this function. + * + * This function must be called only for daemon started + * without #MHD_USE_INTERNAL_POLLING_THREAD flag. + * + * @param daemon daemon to get sets from + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @param max_fd increased to largest FD added (if larger + * than existing value); can be NULL + * @param fd_setsize value of FD_SETSIZE + * @return #MHD_YES on success, #MHD_NO if this + * daemon was not started with the right + * options for this call or any FD didn't + * fit fd_set. + * @ingroup event + */ +int +MHD_get_fdset2 (struct MHD_Daemon *daemon, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *except_fd_set, + MHD_socket *max_fd, + unsigned int fd_setsize) +{ + fd_set es; + + if ( (NULL == daemon) || + (NULL == read_fd_set) || + (NULL == write_fd_set) || + (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || + (0 != (daemon->options & MHD_USE_POLL))) + return MHD_NO; + + if (NULL == except_fd_set) + { /* Workaround to maintain backward compatibility. */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_get_fdset2() called with except_fd_set " + "set to NULL. Such behavior is unsupported.\n")); +#endif + FD_ZERO (&es); + except_fd_set = &es; + } + +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + if (daemon->shutdown) + return MHD_NO; + + /* we're in epoll mode, use the epoll FD as a stand-in for + the entire event set */ + + return MHD_add_to_fd_set_ (daemon->epoll_fd, + read_fd_set, + max_fd, + fd_setsize) ? MHD_YES : MHD_NO; + } +#endif + + return internal_get_fdset2 (daemon, + read_fd_set, + write_fd_set, + except_fd_set, + max_fd, + fd_setsize); +} + + +/** + * Call the handlers for a connection in the appropriate order based + * on the readiness as detected by the event loop. + * + * @param con connection to handle + * @param read_ready set if the socket is ready for reading + * @param write_ready set if the socket is ready for writing + * @param force_close set if a hard error was detected on the socket; + * if this information is not available, simply pass #MHD_NO + * @return #MHD_YES to continue normally, + * #MHD_NO if a serious error was encountered and the + * connection is to be closed. + */ +static int +call_handlers (struct MHD_Connection *con, + bool read_ready, + bool write_ready, + bool force_close) +{ + int ret; + bool states_info_processed = false; + /* Fast track flag */ + bool on_fasttrack = (con->state == MHD_CONNECTION_INIT); + +#ifdef HTTPS_SUPPORT + if (con->tls_read_ready) + read_ready = true; +#endif /* HTTPS_SUPPORT */ + if (!force_close) + { + if ( (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) && + read_ready) + { + MHD_connection_handle_read (con); + ret = MHD_connection_handle_idle (con); + states_info_processed = true; + } + /* No need to check value of 'ret' here as closed connection + * cannot be in MHD_EVENT_LOOP_INFO_WRITE state. */ + if ( (MHD_EVENT_LOOP_INFO_WRITE == con->event_loop_info) && + write_ready) + { + MHD_connection_handle_write (con); + ret = MHD_connection_handle_idle (con); + states_info_processed = true; + } + } + else + { + MHD_connection_close_ (con, + MHD_REQUEST_TERMINATED_WITH_ERROR); + return MHD_connection_handle_idle (con); + } + + if (!states_info_processed) + { /* Connection is not read or write ready, but external conditions + * may be changed and need to be processed. */ + ret = MHD_connection_handle_idle (con); + } + /* Fast track for fast connections. */ + /* If full request was read by single read_handler() invocation + and headers were completely prepared by single MHD_connection_handle_idle() + then try not to wait for next sockets polling and send response + immediately. + As writeability of socket was not checked and it may have + some data pending in system buffers, use this optimization + only for non-blocking sockets. */ + /* No need to check 'ret' as connection is always in + * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */ + else if (on_fasttrack && con->sk_nonblck) + { + if (MHD_CONNECTION_HEADERS_SENDING == con->state) + { + MHD_connection_handle_write (con); + /* Always call 'MHD_connection_handle_idle()' after each read/write. */ + ret = MHD_connection_handle_idle (con); + } + /* If all headers were sent by single write_handler() and + * response body is prepared by single MHD_connection_handle_idle() + * call - continue. */ + if ((MHD_CONNECTION_NORMAL_BODY_READY == con->state) || + (MHD_CONNECTION_CHUNKED_BODY_READY == con->state)) + { + MHD_connection_handle_write (con); + ret = MHD_connection_handle_idle (con); + } + } + + /* All connection's data and states are processed for this turn. + * If connection already has more data to be processed - use + * zero timeout for next select()/poll(). */ + /* Thread-per-connection do not need global zero timeout as + * connections are processed individually. */ + /* Note: no need to check for read buffer availability for + * TLS read-ready connection in 'read info' state as connection + * without space in read buffer will be market as 'info block'. */ + if ( (!con->daemon->data_already_pending) && + (0 == (con->daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) + { + if (MHD_EVENT_LOOP_INFO_BLOCK == con->event_loop_info) + con->daemon->data_already_pending = true; +#ifdef HTTPS_SUPPORT + else if ( (con->tls_read_ready) && + (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) ) + con->daemon->data_already_pending = true; +#endif /* HTTPS_SUPPORT */ + } + return ret; +} + + +#ifdef UPGRADE_SUPPORT +/** + * Finally cleanup upgrade-related resources. It should + * be called when TLS buffers have been drained and + * application signaled MHD by #MHD_UPGRADE_ACTION_CLOSE. + * + * @param connection handle to the upgraded connection to clean + */ +static void +cleanup_upgraded_connection (struct MHD_Connection *connection) +{ + struct MHD_UpgradeResponseHandle *urh = connection->urh; + + if (NULL == urh) + return; +#ifdef HTTPS_SUPPORT + /* Signal remote client the end of TLS connection by + * gracefully closing TLS session. */ + if (0 != (connection->daemon->options & MHD_USE_TLS)) + gnutls_bye (connection->tls_session, + GNUTLS_SHUT_WR); + + if (MHD_INVALID_SOCKET != urh->mhd.socket) + MHD_socket_close_chk_ (urh->mhd.socket); + + if (MHD_INVALID_SOCKET != urh->app.socket) + MHD_socket_close_chk_ (urh->app.socket); +#endif /* HTTPS_SUPPORT */ + connection->urh = NULL; + free (urh); +} +#endif /* UPGRADE_SUPPORT */ + + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) +/** + * Performs bi-directional forwarding on upgraded HTTPS connections + * based on the readyness state stored in the @a urh handle. + * @remark To be called only from thread that process + * connection's recv(), send() and response. + * + * @param urh handle to process + */ +static void +process_urh (struct MHD_UpgradeResponseHandle *urh) +{ + /* Help compiler to optimize: + * pointers to 'connection' and 'daemon' are not changed + * during this processing, so no need to chain dereference + * each time. */ + struct MHD_Connection * const connection = urh->connection; + struct MHD_Daemon * const daemon = connection->daemon; + /* Prevent data races: use same value of 'was_closed' throughout + * this function. If 'was_closed' changed externally in the middle + * of processing - it will be processed on next iteration. */ + bool was_closed; + if (daemon->shutdown) + { + /* Daemon shutting down, application will not receive any more data. */ +#ifdef HAVE_MESSAGES + if (! urh->was_closed) + { + MHD_DLOG (daemon, + _("Initiated daemon shutdown while \"upgraded\" connection was not closed.\n")); + } +#endif + urh->was_closed = true; + } + was_closed = urh->was_closed; + if (was_closed) + { + /* Application was closed connections: no more data + * can be forwarded to application socket. */ + if (0 < urh->in_buffer_used) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to forward to application " MHD_UNSIGNED_LONG_LONG_PRINTF \ + " bytes of data received from remote side: application shut down socket\n"), + (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used); +#endif + + } + /* If application signaled MHD about socket closure then + * check for any pending data even if socket is not marked + * as 'ready' (signal may arrive after poll()/select()). + * Socketpair for forwarding is always in non-blocking mode + * so no risk that recv() will block the thread. */ + if (0 != urh->out_buffer_size) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; + /* Discard any data received form remote. */ + urh->in_buffer_used = 0; + /* Do not try to push data to application. */ + urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + /* Reading from remote client is not required anymore. */ + urh->in_buffer_size = 0; + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + connection->tls_read_ready = false; + } + + /* On some platforms (W32, possibly Darwin) failed send() (send() will always + * fail after remote disconnect was detected) may discard data in system + * buffers received by system but not yet read by recv(). + * So, before trying send() on any socket, recv() must be performed at first + * otherwise last part of incoming data may be lost. */ + + /* If disconnect or error was detected - try to read from socket + * to dry data possibly pending is system buffers. */ + if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi)) + urh->app.celi |= MHD_EPOLL_STATE_READ_READY; + if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) + urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; + + /* + * handle reading from remote TLS client + */ + if ( ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->app.celi)) || + (connection->tls_read_ready) ) && + (urh->in_buffer_used < urh->in_buffer_size) ) + { + ssize_t res; + size_t buf_size; + + buf_size = urh->in_buffer_size - urh->in_buffer_used; + if (buf_size > SSIZE_MAX) + buf_size = SSIZE_MAX; + + connection->tls_read_ready = false; + res = gnutls_record_recv (connection->tls_session, + &urh->in_buffer[urh->in_buffer_used], + buf_size); + if (0 >= res) + { + if (GNUTLS_E_INTERRUPTED != res) + { + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + if (GNUTLS_E_AGAIN != res) + { + /* Unrecoverable error on socket was detected or + * socket was disconnected/shut down. */ + /* Stop trying to read from this TLS socket. */ + urh->in_buffer_size = 0; + } + } + } + else /* 0 < res */ + { + urh->in_buffer_used += res; + if (buf_size > (size_t)res) + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + else if (0 < gnutls_record_check_pending (connection->tls_session)) + connection->tls_read_ready = true; + } + if (MHD_EPOLL_STATE_ERROR == + ((MHD_EPOLL_STATE_ERROR | MHD_EPOLL_STATE_READ_READY) & urh->app.celi)) + { + /* Unrecoverable error on socket was detected and all + * pending data was read from system buffers. */ + /* Stop trying to read from this TLS socket. */ + urh->in_buffer_size = 0; + } + } + + /* + * handle reading from application + */ + if ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->mhd.celi)) && + (urh->out_buffer_used < urh->out_buffer_size) ) + { + ssize_t res; + size_t buf_size; + + buf_size = urh->out_buffer_size - urh->out_buffer_used; + if (buf_size > MHD_SCKT_SEND_MAX_SIZE_) + buf_size = MHD_SCKT_SEND_MAX_SIZE_; + + res = MHD_recv_ (urh->mhd.socket, + &urh->out_buffer[urh->out_buffer_used], + buf_size); + if (0 >= res) + { + const int err = MHD_socket_get_error_ (); + if ((0 == res) || + ((! MHD_SCKT_ERR_IS_EINTR_ (err)) && + (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)))) + { + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + if ((0 == res) || + (was_closed) || + (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) || + (! MHD_SCKT_ERR_IS_EAGAIN_ (err))) + { + /* Socket disconnect/shutdown was detected; + * Application signaled about closure of 'upgraded' socket; + * or persistent / unrecoverable error. */ + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + } + } + } + else /* 0 < res */ + { + urh->out_buffer_used += res; + if (buf_size > (size_t)res) + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + } + if ( (0 == (MHD_EPOLL_STATE_READ_READY & urh->mhd.celi)) && + ( (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) || + (was_closed) ) ) + { + /* Unrecoverable error on socket was detected and all + * pending data was read from system buffers. */ + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + } + } + + /* + * handle writing to remote HTTPS client + */ + if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->app.celi)) && + (urh->out_buffer_used > 0) ) + { + ssize_t res; + size_t data_size; + + data_size = urh->out_buffer_used; + if (data_size > SSIZE_MAX) + data_size = SSIZE_MAX; + + res = gnutls_record_send (connection->tls_session, + urh->out_buffer, + data_size); + if (0 >= res) + { + if (GNUTLS_E_INTERRUPTED != res) + { + urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + if (GNUTLS_E_INTERRUPTED != res) + { + /* TLS connection shut down or + * persistent / unrecoverable error. */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to forward to remote client " MHD_UNSIGNED_LONG_LONG_PRINTF \ + " bytes of data received from application: %s\n"), + (MHD_UNSIGNED_LONG_LONG) urh->out_buffer_used, + gnutls_strerror(res)); +#endif + /* Discard any data unsent to remote. */ + urh->out_buffer_used = 0; + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + } + } + } + else /* 0 < res */ + { + const size_t next_out_buffer_used = urh->out_buffer_used - res; + if (0 != next_out_buffer_used) + { + memmove (urh->out_buffer, + &urh->out_buffer[res], + next_out_buffer_used); + if (data_size > (size_t)res) + urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + } + urh->out_buffer_used = next_out_buffer_used; + } + if ( (0 == urh->out_buffer_used) && + (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi)) ) + { + /* Unrecoverable error on socket was detected and all + * pending data was sent to remote. */ + /* Do not try to send to remote anymore. */ + urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + } + } + + /* + * handle writing to application + */ + if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->mhd.celi)) && + (urh->in_buffer_used > 0) ) + { + ssize_t res; + size_t data_size; + + data_size = urh->in_buffer_used; + if (data_size > MHD_SCKT_SEND_MAX_SIZE_) + data_size = MHD_SCKT_SEND_MAX_SIZE_; + + res = MHD_send_ (urh->mhd.socket, + urh->in_buffer, + data_size); + if (0 >= res) + { + const int err = MHD_socket_get_error_ (); + if ( (! MHD_SCKT_ERR_IS_EINTR_ (err)) && + (! MHD_SCKT_ERR_IS_LOW_RESOURCES_(err)) ) + { + urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + if (! MHD_SCKT_ERR_IS_EAGAIN_ (err)) + { + /* Socketpair connection shut down or + * persistent / unrecoverable error. */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to forward to application " MHD_UNSIGNED_LONG_LONG_PRINTF \ + " bytes of data received from remote side: %s\n"), + (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used, + MHD_socket_strerr_ (err)); +#endif + /* Discard any data received form remote. */ + urh->in_buffer_used = 0; + /* Reading from remote client is not required anymore. */ + urh->in_buffer_size = 0; + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + connection->tls_read_ready = false; + } + } + } + else /* 0 < res */ + { + const size_t next_in_buffer_used = urh->in_buffer_used - res; + if (0 != next_in_buffer_used) + { + memmove (urh->in_buffer, + &urh->in_buffer[res], + next_in_buffer_used); + if (data_size > (size_t)res) + urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + } + urh->in_buffer_used = next_in_buffer_used; + } + if ( (0 == urh->in_buffer_used) && + (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) ) + { + /* Do not try to push data to application. */ + urh->mhd.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + /* Reading from remote client is not required anymore. */ + urh->in_buffer_size = 0; + urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; + connection->tls_read_ready = false; + } + } + + /* Check whether data is present in TLS buffers + * and incoming forward buffer have some space. */ + if ( (connection->tls_read_ready) && + (urh->in_buffer_used < urh->in_buffer_size) && + (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) + daemon->data_already_pending = true; + + if ( (daemon->shutdown) && + ( (0 != urh->out_buffer_size) || + (0 != urh->out_buffer_used) ) ) + { + /* Daemon shutting down, discard any remaining forward data. */ +#ifdef HAVE_MESSAGES + if (0 < urh->out_buffer_used) + MHD_DLOG (daemon, + _("Failed to forward to remote client " MHD_UNSIGNED_LONG_LONG_PRINTF \ + " bytes of data received from application: daemon shut down\n"), + (MHD_UNSIGNED_LONG_LONG) urh->out_buffer_used); +#endif + /* Discard any data unsent to remote. */ + urh->out_buffer_used = 0; + /* Do not try to sent to remote anymore. */ + urh->app.celi &= ~MHD_EPOLL_STATE_WRITE_READY; + /* Do not try to pull more data from application. */ + urh->out_buffer_size = 0; + urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; + } +} +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + +#ifdef UPGRADE_SUPPORT +/** + * Main function of the thread that handles an individual connection + * after it was "upgraded" when #MHD_USE_THREAD_PER_CONNECTION is set. + * @remark To be called only from thread that process + * connection's recv(), send() and response. + * + * @param con the connection this thread will handle + */ +static void +thread_main_connection_upgrade (struct MHD_Connection *con) +{ +#ifdef HTTPS_SUPPORT + struct MHD_UpgradeResponseHandle *urh = con->urh; + struct MHD_Daemon *daemon = con->daemon; + + /* Here, we need to bi-directionally forward + until the application tells us that it is done + with the socket; */ + if ( (0 != (daemon->options & MHD_USE_TLS)) && + (0 == (daemon->options & MHD_USE_POLL))) + { + while ( (0 != urh->in_buffer_size) || + (0 != urh->out_buffer_size) || + (0 != urh->in_buffer_used) || + (0 != urh->out_buffer_used) ) + { + /* use select */ + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max_fd; + int num_ready; + bool result; + + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + max_fd = MHD_INVALID_SOCKET; + result = urh_to_fdset (urh, + &rs, + &ws, + &es, + &max_fd, + FD_SETSIZE); + if (! result) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error preparing select\n")); +#endif + break; + } + /* FIXME: does this check really needed? */ + if (MHD_INVALID_SOCKET != max_fd) + { + struct timeval* tvp; + struct timeval tv; + if ( (con->tls_read_ready) && + (urh->in_buffer_used < urh->in_buffer_size)) + { /* No need to wait if incoming data is already pending in TLS buffers. */ + tv.tv_sec = 0; + tv.tv_usec = 0; + tvp = &tv; + } + else + tvp = NULL; + num_ready = MHD_SYS_select_ (max_fd + 1, + &rs, + &ws, + &es, + tvp); + } + else + num_ready = 0; + if (num_ready < 0) + { + const int err = MHD_socket_get_error_(); + + if (MHD_SCKT_ERR_IS_EINTR_(err)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during select (%d): `%s'\n"), + err, + MHD_socket_strerr_ (err)); +#endif + break; + } + urh_from_fdset (urh, + &rs, + &ws, + &es); + process_urh (urh); + } + } +#ifdef HAVE_POLL + else if (0 != (daemon->options & MHD_USE_TLS)) + { + /* use poll() */ + struct pollfd p[2]; + memset (p, + 0, + sizeof (p)); + p[0].fd = urh->connection->socket_fd; + p[1].fd = urh->mhd.socket; + + while ( (0 != urh->in_buffer_size) || + (0 != urh->out_buffer_size) || + (0 != urh->in_buffer_used) || + (0 != urh->out_buffer_used) ) + { + int timeout; + + urh_update_pollfd(urh, p); + + if ( (con->tls_read_ready) && + (urh->in_buffer_used < urh->in_buffer_size)) + timeout = 0; /* No need to wait if incoming data is already pending in TLS buffers. */ + else + timeout = -1; + + if (MHD_sys_poll_ (p, + 2, + timeout) < 0) + { + const int err = MHD_socket_get_error_ (); + + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during poll: `%s'\n"), + MHD_socket_strerr_ (err)); +#endif + break; + } + urh_from_pollfd(urh, p); + process_urh (urh); + } + } + /* end POLL */ +#endif + /* end HTTPS */ +#endif /* HTTPS_SUPPORT */ + /* TLS forwarding was finished. Cleanup socketpair. */ + MHD_connection_finish_forward_ (con); + /* Do not set 'urh->clean_ready' yet as 'urh' will be used + * in connection thread for a little while. */ +} +#endif /* UPGRADE_SUPPORT */ + + +/** + * Main function of the thread that handles an individual + * connection when #MHD_USE_THREAD_PER_CONNECTION is set. + * + * @param data the `struct MHD_Connection` this thread will handle + * @return always 0 + */ +static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ +thread_main_handle_connection (void *data) +{ + struct MHD_Connection *con = data; + struct MHD_Daemon *daemon = con->daemon; + int num_ready; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; + struct timeval tv; + struct timeval *tvp; + time_t now; +#if WINDOWS +#ifdef HAVE_POLL + int extra_slot; +#endif /* HAVE_POLL */ +#define EXTRA_SLOTS 1 +#else /* !WINDOWS */ +#define EXTRA_SLOTS 0 +#endif /* !WINDOWS */ +#ifdef HAVE_POLL + struct pollfd p[1 + EXTRA_SLOTS]; +#endif +#undef EXTRA_SLOTS +#ifdef HAVE_POLL + const bool use_poll = (0 != (daemon->options & MHD_USE_POLL)); +#else /* ! HAVE_POLL */ + const bool use_poll = 0; +#endif /* ! HAVE_POLL */ + bool was_suspended = false; + MHD_thread_init_(&(con->pid)); + + while ( (! daemon->shutdown) && + (MHD_CONNECTION_CLOSED != con->state) ) + { + const time_t timeout = daemon->connection_timeout; +#ifdef UPGRADE_SUPPORT + struct MHD_UpgradeResponseHandle * const urh = con->urh; +#else /* ! UPGRADE_SUPPORT */ + static const void * const urh = NULL; +#endif /* ! UPGRADE_SUPPORT */ + + if ( (con->suspended) && + (NULL == urh) ) + { + /* Connection was suspended, wait for resume. */ + was_suspended = true; + if (! use_poll) + { + FD_ZERO (&rs); + if (! MHD_add_to_fd_set_ (MHD_itc_r_fd_ (daemon->itc), + &rs, + NULL, + FD_SETSIZE)) + { + #ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Failed to add FD to fd_set\n")); + #endif + goto exit; + } + if (0 > MHD_SYS_select_ (MHD_itc_r_fd_ (daemon->itc) + 1, + &rs, + NULL, + NULL, + NULL)) + { + const int err = MHD_socket_get_error_(); + + if (MHD_SCKT_ERR_IS_EINTR_(err)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during select (%d): `%s'\n"), + err, + MHD_socket_strerr_ (err)); +#endif + break; + } + } +#ifdef HAVE_POLL + else /* use_poll */ + { + p[0].events = POLLIN; + p[0].fd = MHD_itc_r_fd_ (daemon->itc); + p[0].revents = 0; + if (0 > MHD_sys_poll_ (p, + 1, + -1)) + { + if (MHD_SCKT_LAST_ERR_IS_(MHD_SCKT_EINTR_)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during poll: `%s'\n"), + MHD_socket_last_strerr_ ()); +#endif + break; + } + } +#endif /* HAVE_POLL */ + MHD_itc_clear_ (daemon->itc); + continue; /* Check again for resume. */ + } /* End of "suspended" branch. */ + + if (was_suspended) + { + MHD_update_last_activity_ (con); /* Reset timeout timer. */ + /* Process response queued during suspend and update states. */ + MHD_connection_handle_idle (con); + was_suspended = false; + } + + tvp = NULL; + + if ( (MHD_EVENT_LOOP_INFO_BLOCK == con->event_loop_info) +#ifdef HTTPS_SUPPORT + || ( (con->tls_read_ready) && + (MHD_EVENT_LOOP_INFO_READ == con->event_loop_info) ) +#endif /* HTTPS_SUPPORT */ + ) + { + /* do not block: more data may be inside of TLS buffers waiting or + * application must provide response data */ + tv.tv_sec = 0; + tv.tv_usec = 0; + tvp = &tv; + } + if ( (NULL == tvp) && + (timeout > 0) ) + { + now = MHD_monotonic_sec_counter(); + if (now - con->last_activity > timeout) + tv.tv_sec = 0; + else + { + const time_t seconds_left = timeout - (now - con->last_activity); +#if !defined(_WIN32) || defined(__CYGWIN__) + tv.tv_sec = seconds_left; +#else /* _WIN32 && !__CYGWIN__ */ + if (seconds_left > TIMEVAL_TV_SEC_MAX) + tv.tv_sec = TIMEVAL_TV_SEC_MAX; + else + tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) seconds_left; +#endif /* _WIN32 && ! __CYGWIN__ */ + } + tv.tv_usec = 0; + tvp = &tv; + } + if (! use_poll) + { + /* use select */ + bool err_state = false; + + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + maxsock = MHD_INVALID_SOCKET; + switch (con->event_loop_info) + { + case MHD_EVENT_LOOP_INFO_READ: + if (! MHD_add_to_fd_set_ (con->socket_fd, + &rs, + &maxsock, + FD_SETSIZE)) + err_state = true; + break; + case MHD_EVENT_LOOP_INFO_WRITE: + if (! MHD_add_to_fd_set_ (con->socket_fd, + &ws, + &maxsock, + FD_SETSIZE)) + err_state = true; + break; + case MHD_EVENT_LOOP_INFO_BLOCK: + if (! MHD_add_to_fd_set_ (con->socket_fd, + &es, + &maxsock, + FD_SETSIZE)) + err_state = true; + break; + case MHD_EVENT_LOOP_INFO_CLEANUP: + /* how did we get here!? */ + goto exit; + } +#if WINDOWS + if (MHD_ITC_IS_VALID_(daemon->itc) ) + { + if (! MHD_add_to_fd_set_ (MHD_itc_r_fd_ (daemon->itc), + &rs, + &maxsock, + FD_SETSIZE)) + err_state = 1; + } +#endif + if (err_state) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Failed to add FD to fd_set\n")); +#endif + goto exit; + } + + num_ready = MHD_SYS_select_ (maxsock + 1, + &rs, + &ws, + NULL, + tvp); + if (num_ready < 0) + { + const int err = MHD_socket_get_error_(); + + if (MHD_SCKT_ERR_IS_EINTR_(err)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during select (%d): `%s'\n"), + err, + MHD_socket_strerr_ (err)); +#endif + break; + } +#if WINDOWS + /* Clear ITC before other processing so additional + * signals will trigger select() again */ + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (FD_ISSET (MHD_itc_r_fd_ (daemon->itc), + &rs)) ) + MHD_itc_clear_ (daemon->itc); +#endif + if (MHD_NO == + call_handlers (con, + FD_ISSET (con->socket_fd, + &rs), + FD_ISSET (con->socket_fd, + &ws), + FD_ISSET (con->socket_fd, + &es)) ) + goto exit; + } +#ifdef HAVE_POLL + else + { + /* use poll */ + memset (&p, + 0, + sizeof (p)); + p[0].fd = con->socket_fd; + switch (con->event_loop_info) + { + case MHD_EVENT_LOOP_INFO_READ: + p[0].events |= POLLIN | MHD_POLL_EVENTS_ERR_DISC; + break; + case MHD_EVENT_LOOP_INFO_WRITE: + p[0].events |= POLLOUT | MHD_POLL_EVENTS_ERR_DISC; + break; + case MHD_EVENT_LOOP_INFO_BLOCK: + p[0].events |= MHD_POLL_EVENTS_ERR_DISC; + break; + case MHD_EVENT_LOOP_INFO_CLEANUP: + /* how did we get here!? */ + goto exit; + } +#if WINDOWS + extra_slot = 0; + if (MHD_ITC_IS_VALID_(daemon->itc)) + { + p[1].events |= POLLIN; + p[1].fd = MHD_itc_r_fd_ (daemon->itc); + p[1].revents = 0; + extra_slot = 1; + } +#endif + if (MHD_sys_poll_ (p, +#if WINDOWS + 1 + extra_slot, +#else + 1, +#endif + (NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0) + { + if (MHD_SCKT_LAST_ERR_IS_(MHD_SCKT_EINTR_)) + continue; +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Error during poll: `%s'\n"), + MHD_socket_last_strerr_ ()); +#endif + break; + } +#if WINDOWS + /* Clear ITC before other processing so additional + * signals will trigger poll() again */ + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (0 != (p[1].revents & (POLLERR | POLLHUP | POLLIN))) ) + MHD_itc_clear_ (daemon->itc); +#endif + if (MHD_NO == + call_handlers (con, + 0 != (p[0].revents & POLLIN), + 0 != (p[0].revents & POLLOUT), + 0 != (p[0].revents & (POLLERR | MHD_POLL_REVENTS_ERR_DISC)))) + goto exit; + } +#endif +#ifdef UPGRADE_SUPPORT + if (MHD_CONNECTION_UPGRADE == con->state) + { + /* Normal HTTP processing is finished, + * notify application. */ + if ( (NULL != daemon->notify_completed) && + (con->client_aware) ) + daemon->notify_completed (daemon->notify_completed_cls, + con, + &con->client_context, + MHD_REQUEST_TERMINATED_COMPLETED_OK); + con->client_aware = false; + + thread_main_connection_upgrade (con); + /* MHD_connection_finish_forward_() was called by thread_main_connection_upgrade(). */ + + /* "Upgraded" data will not be used in this thread from this point. */ + con->urh->clean_ready = true; + /* If 'urh->was_closed' set to true, connection will be + * moved immediately to cleanup list. Otherwise connection + * will stay in suspended list until 'urh' will be marked + * with 'was_closed' by application. */ + MHD_resume_connection(con); + + /* skip usual clean up */ + return (MHD_THRD_RTRN_TYPE_) 0; + } +#endif /* UPGRADE_SUPPORT */ + } + if (MHD_CONNECTION_IN_CLEANUP != con->state) + { +#if DEBUG_CLOSE +#ifdef HAVE_MESSAGES + MHD_DLOG (con->daemon, + _("Processing thread terminating. Closing connection\n")); +#endif +#endif + if (MHD_CONNECTION_CLOSED != con->state) + MHD_connection_close_ (con, + (daemon->shutdown) ? + MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN: + MHD_REQUEST_TERMINATED_WITH_ERROR); + MHD_connection_handle_idle (con); + } +exit: + if (NULL != con->response) + { + MHD_destroy_response (con->response); + con->response = NULL; + } + + if (MHD_INVALID_SOCKET != con->socket_fd) + { + shutdown (con->socket_fd, + SHUT_WR); + /* 'socket_fd' can be used in other thread to signal shutdown. + * To avoid data races, do not close socket here. Daemon will + * use more connections only after cleanup anyway. */ + } + return (MHD_THRD_RTRN_TYPE_) 0; +} + + +/** + * Free resources associated with all closed connections. + * (destroy responses, free buffers, etc.). All closed + * connections are kept in the "cleanup" doubly-linked list. + * + * @param daemon daemon to clean up + */ +static void +MHD_cleanup_connections (struct MHD_Daemon *daemon); + +#if defined(HTTPS_SUPPORT) +#if !defined(MHD_WINSOCK_SOCKETS) && !defined(MHD_socket_nosignal_) && \ + (GNUTLS_VERSION_NUMBER+0 < 0x030402) && defined(MSG_NOSIGNAL) +/** + * Older version of GnuTLS do not support suppressing of SIGPIPE signal. + * Use push function replacement with suppressing SIGPIPE signal where necessary + * and if possible. + */ +#define MHD_TLSLIB_NEED_PUSH_FUNC 1 +#endif /* !MHD_WINSOCK_SOCKETS && !MHD_socket_nosignal_ && (GNUTLS_VERSION_NUMBER+0 < 0x030402) */ + +#ifdef MHD_TLSLIB_NEED_PUSH_FUNC +/** + * Data push function replacement with suppressing SIGPIPE signal + * for TLS library. + */ +static ssize_t +MHD_tls_push_func_(gnutls_transport_ptr_t trnsp, + const void *data, + size_t data_size) +{ +#if (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX) + if (data_size > MHD_SCKT_SEND_MAX_SIZE_) + data_size = MHD_SCKT_SEND_MAX_SIZE_; +#endif /* (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX) */ + return MHD_send_ ((MHD_socket)(intptr_t)(trnsp), data, data_size); +} +#endif /* MHD_TLSLIB_DONT_SUPPRESS_SIGPIPE */ +#endif /* HTTPS_SUPPORT */ + +/** + * Add another client connection to the set of connections + * managed by MHD. This API is usually not needed (since + * MHD will accept inbound connections on the server socket). + * Use this API in special cases, for example if your HTTP + * server is behind NAT and needs to connect out to the + * HTTP client. + * + * The given client socket will be managed (and closed!) by MHD after + * this call and must no longer be used directly by the application + * afterwards. + * + * @param daemon daemon that manages the connection + * @param client_socket socket to manage (MHD will expect + * to receive an HTTP request from this socket next). + * @param addr IP address of the client + * @param addrlen number of bytes in @a addr + * @param external_add perform additional operations needed due + * to the application calling us directly + * @param non_blck indicate that socket in non-blocking mode + * @return #MHD_YES on success, #MHD_NO if this daemon could + * not handle the connection (i.e. malloc failed, etc). + * The socket will be closed in any case; 'errno' is + * set to indicate further details about the error. + */ +static int +internal_add_connection (struct MHD_Daemon *daemon, + MHD_socket client_socket, + const struct sockaddr *addr, + socklen_t addrlen, + bool external_add, + bool non_blck) +{ + struct MHD_Connection *connection; + unsigned int i; + int eno = 0; + + /* Direct add to master daemon could happen only with "external" add mode. */ + mhd_assert ((NULL == daemon->worker_pool) || (external_add)); + if ((external_add) && (NULL != daemon->worker_pool)) + { + /* have a pool, try to find a pool with capacity; we use the + socket as the initial offset into the pool for load + balancing */ + for (i = 0; i < daemon->worker_pool_size; ++i) + { + struct MHD_Daemon * const worker = + &daemon->worker_pool[(i + client_socket) % daemon->worker_pool_size]; + if (worker->connections < worker->connection_limit) + return internal_add_connection (worker, + client_socket, + addr, + addrlen, + true, + non_blck); + } + /* all pools are at their connection limit, must refuse */ + MHD_socket_close_chk_ (client_socket); +#if ENFILE + errno = ENFILE; +#endif + return MHD_NO; + } + + if ( (! MHD_SCKT_FD_FITS_FDSET_(client_socket, + NULL)) && + (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"), + (int) client_socket, + (int) FD_SETSIZE); +#endif + MHD_socket_close_chk_ (client_socket); +#if EINVAL + errno = EINVAL; +#endif + return MHD_NO; + } + +#ifdef MHD_socket_nosignal_ + if (! MHD_socket_nosignal_ (client_socket)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set SO_NOSIGPIPE on accepted socket: %s\n"), + MHD_socket_last_strerr_()); +#endif +#ifndef MSG_NOSIGNAL + /* Cannot use socket as it can produce SIGPIPE. */ +#ifdef ENOTSOCK + errno = ENOTSOCK; +#endif /* ENOTSOCK */ + return MHD_NO; +#endif /* ! MSG_NOSIGNAL */ + } +#endif /* MHD_socket_nosignal_ */ + + +#ifdef HAVE_MESSAGES +#if DEBUG_CONNECT + MHD_DLOG (daemon, + _("Accepted connection on socket %d\n"), + client_socket); +#endif +#endif + if ( (daemon->connections == daemon->connection_limit) || + (MHD_NO == MHD_ip_limit_add (daemon, + addr, + addrlen)) ) + { + /* above connection limit - reject */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Server reached connection limit. Closing inbound connection.\n")); +#endif + MHD_socket_close_chk_ (client_socket); +#if ENFILE + errno = ENFILE; +#endif + return MHD_NO; + } + + /* apply connection acceptance policy if present */ + if ( (NULL != daemon->apc) && + (MHD_NO == daemon->apc (daemon->apc_cls, + addr, + addrlen)) ) + { +#if DEBUG_CLOSE +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Connection rejected by application. Closing connection.\n")); +#endif +#endif + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); +#if EACCESS + errno = EACCESS; +#endif + return MHD_NO; + } + + if (NULL == (connection = MHD_calloc_ (1, sizeof (struct MHD_Connection)))) + { + eno = errno; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + "Error allocating memory: %s\n", + MHD_strerror_ (errno)); +#endif + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); + errno = eno; + return MHD_NO; + } + connection->pool = MHD_pool_create (daemon->pool_size); + if (NULL == connection->pool) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error allocating memory: %s\n"), + MHD_strerror_ (errno)); +#endif + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); + free (connection); +#if ENOMEM + errno = ENOMEM; +#endif + return MHD_NO; + } + + connection->connection_timeout = daemon->connection_timeout; + if (NULL == (connection->addr = malloc (addrlen))) + { + eno = errno; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error allocating memory: %s\n"), + MHD_strerror_ (errno)); +#endif + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); + MHD_pool_destroy (connection->pool); + free (connection); + errno = eno; + return MHD_NO; + } + memcpy (connection->addr, + addr, + addrlen); + connection->addr_len = addrlen; + connection->socket_fd = client_socket; + connection->sk_nonblck = non_blck; + connection->daemon = daemon; + connection->last_activity = MHD_monotonic_sec_counter(); + + if (0 == (daemon->options & MHD_USE_TLS)) + { + /* set default connection handlers */ + MHD_set_http_callbacks_ (connection); + } + else + { +#ifdef HTTPS_SUPPORT + connection->tls_state = MHD_TLS_CONN_INIT; + MHD_set_https_callbacks (connection); + gnutls_init (&connection->tls_session, + GNUTLS_SERVER +#if (GNUTLS_VERSION_NUMBER+0 >= 0x030402) + | GNUTLS_NO_SIGNAL +#endif /* GNUTLS_VERSION_NUMBER >= 0x030402 */ +#if GNUTLS_VERSION_MAJOR >= 3 + | GNUTLS_NONBLOCK +#endif /* GNUTLS_VERSION_MAJOR >= 3*/ + ); + gnutls_priority_set (connection->tls_session, + daemon->priority_cache); + switch (daemon->cred_type) + { + /* set needed credentials for certificate authentication. */ + case GNUTLS_CRD_CERTIFICATE: + gnutls_credentials_set (connection->tls_session, + GNUTLS_CRD_CERTIFICATE, + daemon->x509_cred); + break; + default: +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to setup TLS credentials: unknown credential type %d\n"), + daemon->cred_type); +#endif + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); + free (connection->addr); + free (connection); + MHD_PANIC (_("Unknown credential type")); +#if EINVAL + errno = EINVAL; +#endif + return MHD_NO; + } +#if (GNUTLS_VERSION_NUMBER+0 >= 0x030109) && !defined(_WIN64) + gnutls_transport_set_int (connection->tls_session, (int)(client_socket)); +#else /* GnuTLS before 3.1.9 or Win x64 */ + gnutls_transport_set_ptr (connection->tls_session, (gnutls_transport_ptr_t)(intptr_t)(client_socket)); +#endif /* GnuTLS before 3.1.9 */ +#ifdef MHD_TLSLIB_NEED_PUSH_FUNC + gnutls_transport_set_push_function (connection->tls_session, MHD_tls_push_func_); +#endif /* MHD_TLSLIB_NEED_PUSH_FUNC */ + if (daemon->https_mem_trust) + gnutls_certificate_server_set_request (connection->tls_session, + GNUTLS_CERT_REQUEST); +#else /* ! HTTPS_SUPPORT */ + eno = EINVAL; + goto cleanup; +#endif /* ! HTTPS_SUPPORT */ + } + + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + /* Firm check under lock. */ + if (daemon->connections >= daemon->connection_limit) + { + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + /* above connection limit - reject */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Server reached connection limit. Closing inbound connection.\n")); +#endif +#if ENFILE + eno = ENFILE; +#endif + goto cleanup; + } + daemon->connections++; + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + XDLL_insert (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + } + DLL_insert (daemon->connections_head, + daemon->connections_tail, + connection); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + + if (NULL != daemon->notify_connection) + daemon->notify_connection (daemon->notify_connection_cls, + connection, + &connection->socket_context, + MHD_CONNECTION_NOTIFY_STARTED); + + /* attempt to create handler thread */ + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + if (! MHD_create_named_thread_ (&connection->pid, + "MHD-connection", + daemon->thread_stack_size, + &thread_main_handle_connection, + connection)) + { + eno = errno; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + "Failed to create a thread: %s\n", + MHD_strerror_ (eno)); +#endif + goto cleanup; + } + } + else + connection->pid = daemon->pid; +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + if ((0 == (daemon->options & MHD_USE_TURBO)) || (external_add)) + { /* Do not manipulate EReady DL-list in 'external_add' mode. */ + struct epoll_event event; + + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; + event.data.ptr = connection; + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_ADD, + client_socket, + &event)) + { + eno = errno; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + goto cleanup; + } + connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET; + } + else + { + connection->epoll_state |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY + | MHD_EPOLL_STATE_IN_EREADY_EDLL; + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + connection); + } + } + else /* This 'else' is combined with next 'if'. */ +#endif + if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (external_add) && + (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "n")) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to signal new connection via inter-thread communication channel.")); +#endif + } + return MHD_YES; + cleanup: + if (NULL != daemon->notify_connection) + daemon->notify_connection (daemon->notify_connection_cls, + connection, + &connection->socket_context, + MHD_CONNECTION_NOTIFY_CLOSED); +#ifdef HTTPS_SUPPORT + if (NULL != connection->tls_session) + gnutls_deinit (connection->tls_session); +#endif /* HTTPS_SUPPORT */ + MHD_socket_close_chk_ (client_socket); + MHD_ip_limit_del (daemon, + addr, + addrlen); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + } + DLL_remove (daemon->connections_head, + daemon->connections_tail, + connection); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + MHD_pool_destroy (connection->pool); + free (connection->addr); + free (connection); + if (0 != eno) + errno = eno; + else + errno = EINVAL; + return MHD_NO; +} + + +/** + * Internal version of ::MHD_suspend_connection(). + * + * @remark In thread-per-connection mode: can be called from any thread, + * in any other mode: to be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param connection the connection to suspend + */ +void +internal_suspend_connection_ (struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + if (connection->resuming) + { + /* suspending again while we didn't even complete resuming yet */ + connection->resuming = false; + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + return; + } + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + if (connection->connection_timeout == daemon->connection_timeout) + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + connection); + else + XDLL_remove (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + connection); + } + DLL_remove (daemon->connections_head, + daemon->connections_tail, + connection); + mhd_assert (! connection->suspended); + DLL_insert (daemon->suspended_connections_head, + daemon->suspended_connections_tail, + connection); + connection->suspended = true; +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + if (0 != (connection->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) + { + EDLL_remove (daemon->eready_head, + daemon->eready_tail, + connection); + connection->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + if (0 != (connection->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) + { + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + connection->socket_fd, + NULL)) + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + connection->epoll_state &= ~MHD_EPOLL_STATE_IN_EPOLL_SET; + } + connection->epoll_state |= MHD_EPOLL_STATE_SUSPENDED; + } +#endif + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); +} + + +/** + * Suspend handling of network data for a given connection. This can + * be used to dequeue a connection from MHD's event loop (external + * select, internal select or thread pool; not applicable to + * thread-per-connection!) for a while. + * + * If you use this API in conjunction with a internal select or a + * thread pool, you must set the option #MHD_USE_ITC to + * ensure that a resumed connection is immediately processed by MHD. + * + * Suspended connections continue to count against the total number of + * connections allowed (per daemon, as well as per IP, if such limits + * are set). Suspended connections will NOT time out; timeouts will + * restart when the connection handling is resumed. While a + * connection is suspended, MHD will not detect disconnects by the + * client. + * + * The only safe time to suspend a connection is from the + * #MHD_AccessHandlerCallback. + * + * Finally, it is an API violation to call #MHD_stop_daemon while + * having suspended connections (this will at least create memory and + * socket leaks or lead to undefined behavior). You must explicitly + * resume all connections before stopping the daemon. + * + * @remark In thread-per-connection mode: can be called from any thread, + * in any other mode: to be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param connection the connection to suspend + */ +void +MHD_suspend_connection (struct MHD_Connection *connection) +{ + struct MHD_Daemon * const daemon = connection->daemon; + + if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) + MHD_PANIC (_("Cannot suspend connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); +#ifdef UPGRADE_SUPPORT + if (NULL != connection->urh) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error: connection scheduled for \"upgrade\" cannot be suspended")); +#endif /* HAVE_MESSAGES */ + return; + } +#endif /* UPGRADE_SUPPORT */ + internal_suspend_connection_ (connection); +} + + +/** + * Resume handling of network data for suspended connection. It is + * safe to resume a suspended connection at any time. Calling this function + * on a connection that was not previously suspended will result + * in undefined behavior. + * + * @param connection the connection to resume + */ +void +MHD_resume_connection (struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon; + + daemon = connection->daemon; + if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) + MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + connection->resuming = true; + daemon->resuming = true; + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "r")) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to signal resume via inter-thread communication channel.")); +#endif + } +} + + +/** + * Run through the suspended connections and move any that are no + * longer suspended back to the active state. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param daemon daemon context + * @return #MHD_YES if a connection was actually resumed + */ +static int +resume_suspended_connections (struct MHD_Daemon *daemon) +{ + struct MHD_Connection *pos; + struct MHD_Connection *prev = NULL; + int ret; + const bool used_thr_p_c = (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)); + mhd_assert (NULL == daemon->worker_pool); + + ret = MHD_NO; + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + + if (daemon->resuming) + { + prev = daemon->suspended_connections_tail; + /* During shutdown check for resuming is forced. */ + mhd_assert((NULL != prev) || (daemon->shutdown)); + } + + daemon->resuming = false; + + while (NULL != (pos = prev)) + { +#ifdef UPGRADE_SUPPORT + struct MHD_UpgradeResponseHandle * const urh = pos->urh; +#else /* ! UPGRADE_SUPPORT */ + static const void * const urh = NULL; +#endif /* ! UPGRADE_SUPPORT */ + prev = pos->prev; + if ( (! pos->resuming) +#ifdef UPGRADE_SUPPORT + || ( (NULL != urh) && + ( (! urh->was_closed) || + (! urh->clean_ready) ) ) +#endif /* UPGRADE_SUPPORT */ + ) + continue; + ret = MHD_YES; + mhd_assert (pos->suspended); + DLL_remove (daemon->suspended_connections_head, + daemon->suspended_connections_tail, + pos); + pos->suspended = false; + if (NULL == urh) + { + DLL_insert (daemon->connections_head, + daemon->connections_tail, + pos); + if (!used_thr_p_c) + { + /* Reset timeout timer on resume. */ + if (0 != pos->connection_timeout) + pos->last_activity = MHD_monotonic_sec_counter(); + + if (pos->connection_timeout == daemon->connection_timeout) + XDLL_insert (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + pos); + else + XDLL_insert (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + pos); + } +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) + MHD_PANIC ("Resumed connection was already in EREADY set\n"); + /* we always mark resumed connections as ready, as we + might have missed the edge poll event during suspension */ + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL | \ + MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; + pos->epoll_state &= ~MHD_EPOLL_STATE_SUSPENDED; + } +#endif + } +#ifdef UPGRADE_SUPPORT + else + { + /* Data forwarding was finished (for TLS connections) AND + * application was closed upgraded connection. + * Insert connection into cleanup list. */ + DLL_insert (daemon->cleanup_head, + daemon->cleanup_tail, + pos); + + } +#endif /* UPGRADE_SUPPORT */ + pos->resuming = false; + } + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + if ( (used_thr_p_c) && + (MHD_NO != ret) ) + { /* Wake up suspended connections. */ + if (! MHD_itc_activate_(daemon->itc, + "w")) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to signal resume of connection via inter-thread communication channel.")); +#endif + } + } + return ret; +} + + +/** + * Add another client connection to the set of connections managed by + * MHD. This API is usually not needed (since MHD will accept inbound + * connections on the server socket). Use this API in special cases, + * for example if your HTTP server is behind NAT and needs to connect + * out to the HTTP client, or if you are building a proxy. + * + * If you use this API in conjunction with a internal select or a + * thread pool, you must set the option + * #MHD_USE_ITC to ensure that the freshly added + * connection is immediately processed by MHD. + * + * The given client socket will be managed (and closed!) by MHD after + * this call and must no longer be used directly by the application + * afterwards. + * + * @param daemon daemon that manages the connection + * @param client_socket socket to manage (MHD will expect + * to receive an HTTP request from this socket next). + * @param addr IP address of the client + * @param addrlen number of bytes in @a addr + * @return #MHD_YES on success, #MHD_NO if this daemon could + * not handle the connection (i.e. malloc() failed, etc). + * The socket will be closed in any case; `errno` is + * set to indicate further details about the error. + * @ingroup specialized + */ +int +MHD_add_connection (struct MHD_Daemon *daemon, + MHD_socket client_socket, + const struct sockaddr *addr, + socklen_t addrlen) +{ + bool sk_nonbl; + if (! MHD_socket_nonblocking_ (client_socket)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set nonblocking mode on new client socket: %s\n"), + MHD_socket_last_strerr_()); +#endif + sk_nonbl = 0; + } + else + sk_nonbl = !0; + + if ( (0 != (daemon->options & MHD_USE_TURBO)) && + (! MHD_socket_noninheritable_ (client_socket)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set noninheritable mode on new client socket.\n")); +#endif + } + return internal_add_connection (daemon, + client_socket, + addr, + addrlen, + true, + sk_nonbl); +} + + +/** + * Accept an incoming connection and create the MHD_Connection object for + * it. This function also enforces policy by way of checking with the + * accept policy callback. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param daemon handle with the listen socket + * @return #MHD_YES on success (connections denied by policy or due + * to 'out of memory' and similar errors) are still considered + * successful as far as #MHD_accept_connection() is concerned); + * a return code of #MHD_NO only refers to the actual + * accept() system call. + */ +static int +MHD_accept_connection (struct MHD_Daemon *daemon) +{ +#if HAVE_INET6 + struct sockaddr_in6 addrstorage; +#else + struct sockaddr_in addrstorage; +#endif + struct sockaddr *addr = (struct sockaddr *) &addrstorage; + socklen_t addrlen; + MHD_socket s; + MHD_socket fd; + bool sk_nonbl; + + addrlen = sizeof (addrstorage); + memset (addr, + 0, + sizeof (addrstorage)); + if ( (MHD_INVALID_SOCKET == (fd = daemon->listen_fd)) || + (daemon->was_quiesced) ) + return MHD_NO; +#ifdef USE_ACCEPT4 + s = accept4 (fd, + addr, + &addrlen, + MAYBE_SOCK_CLOEXEC | MAYBE_SOCK_NONBLOCK); + sk_nonbl = (MAYBE_SOCK_NONBLOCK != 0); +#else /* ! USE_ACCEPT4 */ + s = accept (fd, + addr, + &addrlen); + sk_nonbl = 0; +#endif /* ! USE_ACCEPT4 */ + if ( (MHD_INVALID_SOCKET == s) || + (addrlen <= 0) ) + { + const int err = MHD_socket_get_error_ (); + + /* This could be a common occurance with multiple worker threads */ + if (MHD_SCKT_ERR_IS_ (err, + MHD_SCKT_EINVAL_)) + return MHD_NO; /* can happen during shutdown */ + if (MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_(err)) + return MHD_NO; /* do not print error if client just disconnected early */ +#ifdef HAVE_MESSAGES + if (! MHD_SCKT_ERR_IS_EAGAIN_ (err) ) + MHD_DLOG (daemon, + _("Error accepting connection: %s\n"), + MHD_socket_strerr_(err)); +#endif + if (MHD_INVALID_SOCKET != s) + { + MHD_socket_close_chk_ (s); + } + if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) ) + { + /* system/process out of resources */ + if (0 == daemon->connections) + { +#ifdef HAVE_MESSAGES + /* Not setting 'at_limit' flag, as there is no way it + would ever be cleared. Instead trying to produce + bit fat ugly warning. */ + MHD_DLOG (daemon, + _("Hit process or system resource limit at FIRST connection. This is really bad as there is no sane way to proceed. Will try busy waiting for system resources to become magically available.\n")); +#endif + } + else + { + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + daemon->at_limit = true; + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Hit process or system resource limit at %u connections, temporarily suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n"), + (unsigned int) daemon->connections); +#endif + } + } + return MHD_NO; + } +#if !defined(USE_ACCEPT4) || !defined(HAVE_SOCK_NONBLOCK) + if (! MHD_socket_nonblocking_ (s)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set nonblocking mode on incoming connection socket: %s\n"), + MHD_socket_last_strerr_()); +#endif + } + else + sk_nonbl = !0; +#endif /* !USE_ACCEPT4 || !HAVE_SOCK_NONBLOCK */ +#if !defined(USE_ACCEPT4) || !defined(SOCK_CLOEXEC) + if (! MHD_socket_noninheritable_ (s)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set noninheritable mode on incoming connection socket.\n")); +#endif + } +#endif /* !USE_ACCEPT4 || !SOCK_CLOEXEC */ +#ifdef HAVE_MESSAGES +#if DEBUG_CONNECT + MHD_DLOG (daemon, + _("Accepted connection on socket %d\n"), + s); +#endif +#endif + (void) internal_add_connection (daemon, + s, + addr, + addrlen, + false, + sk_nonbl); + return MHD_YES; +} + + +/** + * Free resources associated with all closed connections. + * (destroy responses, free buffers, etc.). All closed + * connections are kept in the "cleanup" doubly-linked list. + * @remark To be called only from thread that + * process daemon's select()/poll()/etc. + * + * @param daemon daemon to clean up + */ +static void +MHD_cleanup_connections (struct MHD_Daemon *daemon) +{ + struct MHD_Connection *pos; + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + while (NULL != (pos = daemon->cleanup_tail)) + { + DLL_remove (daemon->cleanup_head, + daemon->cleanup_tail, + pos); + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + + if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (! pos->thread_joined) && + (! MHD_join_thread_ (pos->pid.handle)) ) + MHD_PANIC (_("Failed to join a thread\n")); +#ifdef UPGRADE_SUPPORT + cleanup_upgraded_connection (pos); +#endif /* UPGRADE_SUPPORT */ + MHD_pool_destroy (pos->pool); +#ifdef HTTPS_SUPPORT + if (NULL != pos->tls_session) + gnutls_deinit (pos->tls_session); +#endif /* HTTPS_SUPPORT */ + + /* clean up the connection */ + if (NULL != daemon->notify_connection) + daemon->notify_connection (daemon->notify_connection_cls, + pos, + &pos->socket_context, + MHD_CONNECTION_NOTIFY_CLOSED); + MHD_ip_limit_del (daemon, + pos->addr, + pos->addr_len); +#ifdef EPOLL_SUPPORT + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) + { + EDLL_remove (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + if ( (-1 != daemon->epoll_fd) && + (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) ) + { + /* epoll documentation suggests that closing a FD + automatically removes it from the epoll set; however, + this is not true as if we fail to do manually remove it, + we are still seeing an event for this fd in epoll, + causing grief (use-after-free...) --- at least on my + system. */ + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + pos->socket_fd, + NULL)) + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EPOLL_SET; + } + } +#endif + if (NULL != pos->response) + { + MHD_destroy_response (pos->response); + pos->response = NULL; + } + if (MHD_INVALID_SOCKET != pos->socket_fd) + MHD_socket_close_chk_ (pos->socket_fd); + if (NULL != pos->addr) + free (pos->addr); + free (pos); + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + daemon->connections--; + daemon->at_limit = false; + } + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); +} + + +/** + * Obtain timeout value for polling function for this daemon. + * This function set value to amount of milliseconds for which polling + * function (`select()` or `poll()`) should at most block, not the + * timeout value set for connections. + * It is important to always use this function, even if connection + * timeout is not set as in some cases MHD may already have more + * data to process on next turn (data pending in TLS buffers, + * connections are already ready with epoll etc.) and returned timeout + * will be zero. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param daemon daemon to query for timeout + * @param timeout set to the timeout (in milliseconds) + * @return #MHD_YES on success, #MHD_NO if timeouts are + * not used (or no connections exist that would + * necessitate the use of a timeout right now). + * @ingroup event + */ +int +MHD_get_timeout (struct MHD_Daemon *daemon, + MHD_UNSIGNED_LONG_LONG *timeout) +{ + time_t earliest_deadline; + time_t now; + struct MHD_Connection *pos; + bool have_timeout; + + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Illegal call to MHD_get_timeout\n")); +#endif + return MHD_NO; + } + + if (daemon->data_already_pending) + { + /* Some data already waiting to be processed. */ + *timeout = 0; + return MHD_YES; + } + +#ifdef EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + ((NULL != daemon->eready_head) +#if defined(UPGRADE_SUPPORT) && defined(HTTPS_SUPPORT) + || (NULL != daemon->eready_urh_head) +#endif /* UPGRADE_SUPPORT && HTTPS_SUPPORT */ + ) ) + { + /* Some connection(s) already have some data pending. */ + *timeout = 0; + return MHD_YES; + } +#endif /* EPOLL_SUPPORT */ + + have_timeout = false; + earliest_deadline = 0; /* avoid compiler warnings */ + for (pos = daemon->manual_timeout_tail; NULL != pos; pos = pos->prevX) + { + if (0 != pos->connection_timeout) + { + if ( (! have_timeout) || + (earliest_deadline - pos->last_activity > pos->connection_timeout) ) + earliest_deadline = pos->last_activity + pos->connection_timeout; + have_timeout = true; + } + } + /* normal timeouts are sorted, so we only need to look at the 'tail' (oldest) */ + pos = daemon->normal_timeout_tail; + if ( (NULL != pos) && + (0 != pos->connection_timeout) ) + { + if ( (! have_timeout) || + (earliest_deadline - pos->connection_timeout > pos->last_activity) ) + earliest_deadline = pos->last_activity + pos->connection_timeout; + have_timeout = true; + } + + if (! have_timeout) + return MHD_NO; + now = MHD_monotonic_sec_counter(); + if (earliest_deadline < now) + *timeout = 0; + else + { + const time_t second_left = earliest_deadline - now; + if (second_left > ULLONG_MAX / 1000) /* Ignore compiler warning: 'second_left' is always positive. */ + *timeout = ULLONG_MAX; + else + *timeout = 1000LL * second_left; + } + return MHD_YES; +} + + +/** + * Internal version of #MHD_run_from_select(). + * + * @param daemon daemon to run select loop for + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set (not used, can be NULL) + * @return #MHD_NO on serious errors, #MHD_YES on success + * @ingroup event + */ +static int +internal_run_from_select (struct MHD_Daemon *daemon, + const fd_set *read_fd_set, + const fd_set *write_fd_set, + const fd_set *except_fd_set) +{ + MHD_socket ds; + struct MHD_Connection *pos; + struct MHD_Connection *prev; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + struct MHD_UpgradeResponseHandle *urh; + struct MHD_UpgradeResponseHandle *urhn; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + /* Reset. New value will be set when connections are processed. */ + /* Note: no-op for thread-per-connection as it is always false in that mode. */ + daemon->data_already_pending = false; + + /* Clear ITC to avoid spinning select */ + /* Do it before any other processing so new signals + will trigger select again and will be processed */ + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (FD_ISSET (MHD_itc_r_fd_ (daemon->itc), + read_fd_set)) ) + MHD_itc_clear_ (daemon->itc); + + /* select connection thread handling type */ + if ( (MHD_INVALID_SOCKET != (ds = daemon->listen_fd)) && + (! daemon->was_quiesced) && + (FD_ISSET (ds, + read_fd_set)) ) + (void) MHD_accept_connection (daemon); + + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + /* do not have a thread per connection, process all connections now */ + prev = daemon->connections_tail; + while (NULL != (pos = prev)) + { + prev = pos->prev; + ds = pos->socket_fd; + if (MHD_INVALID_SOCKET == ds) + continue; + call_handlers (pos, + FD_ISSET (ds, + read_fd_set), + FD_ISSET (ds, + write_fd_set), + FD_ISSET (ds, + except_fd_set)); + } + } + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + /* handle upgraded HTTPS connections */ + for (urh = daemon->urh_tail; NULL != urh; urh = urhn) + { + urhn = urh->prev; + /* update urh state based on select() output */ + urh_from_fdset (urh, + read_fd_set, + write_fd_set, + except_fd_set); + /* call generic forwarding function for passing data */ + process_urh (urh); + /* Finished forwarding? */ + if ( (0 == urh->in_buffer_size) && + (0 == urh->out_buffer_size) && + (0 == urh->in_buffer_used) && + (0 == urh->out_buffer_used) ) + { + MHD_connection_finish_forward_ (urh->connection); + urh->clean_ready = true; + /* Resuming will move connection to cleanup list. */ + MHD_resume_connection(urh->connection); + } + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + MHD_cleanup_connections (daemon); + return MHD_YES; +} + + +/** + * Run webserver operations. This method should be called by clients + * in combination with #MHD_get_fdset and #MHD_get_timeout() if the + * client-controlled select method is used. + * + * You can use this function instead of #MHD_run if you called + * `select()` on the result from #MHD_get_fdset. File descriptors in + * the sets that are not controlled by MHD will be ignored. Calling + * this function instead of #MHD_run is more efficient as MHD will + * not have to call `select()` again to determine which operations are + * ready. + * + * This function cannot be used with daemon started with + * MHD_USE_INTERNAL_POLLING_THREAD flag. + * + * @param daemon daemon to run select loop for + * @param read_fd_set read set + * @param write_fd_set write set + * @param except_fd_set except set + * @return #MHD_NO on serious errors, #MHD_YES on success + * @ingroup event + */ +int +MHD_run_from_select (struct MHD_Daemon *daemon, + const fd_set *read_fd_set, + const fd_set *write_fd_set, + const fd_set *except_fd_set) +{ + fd_set es; + if (0 != (daemon->options & + (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL)) ) + return MHD_NO; + if (NULL == read_fd_set || NULL == write_fd_set) + return MHD_NO; + if (NULL == except_fd_set) + { /* Workaround to maintain backward compatibility. */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_run_from_select() called with except_fd_set " + "set to NULL. Such behavior is deprecated.\n")); +#endif + FD_ZERO (&es); + except_fd_set = &es; + } + if (0 != (daemon->options & MHD_USE_EPOLL)) + { +#ifdef EPOLL_SUPPORT + int ret; + ret = MHD_epoll (daemon, MHD_NO); + MHD_cleanup_connections (daemon); + return ret; +#else /* ! EPOLL_SUPPORT */ + return MHD_NO; +#endif /* ! EPOLL_SUPPORT */ + } + + /* Resuming external connections when using an extern mainloop */ + if (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) + resume_suspended_connections (daemon); + + return internal_run_from_select (daemon, read_fd_set, + write_fd_set, except_fd_set); +} + + +/** + * Main internal select() call. Will compute select sets, call select() + * and then #internal_run_from_select with the result. + * + * @param daemon daemon to run select() loop for + * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking + * @return #MHD_NO on serious errors, #MHD_YES on success + */ +static int +MHD_select (struct MHD_Daemon *daemon, + int may_block) +{ + int num_ready; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; + struct timeval timeout; + struct timeval *tv; + MHD_UNSIGNED_LONG_LONG ltimeout; + int err_state; + MHD_socket ls; + + timeout.tv_sec = 0; + timeout.tv_usec = 0; + if (daemon->shutdown) + return MHD_NO; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + maxsock = MHD_INVALID_SOCKET; + err_state = MHD_NO; + if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && + (MHD_YES == resume_suspended_connections (daemon)) && + (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ) + may_block = MHD_NO; + + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + /* single-threaded, go over everything */ + if (MHD_NO == + internal_get_fdset2 (daemon, + &rs, + &ws, + &es, + &maxsock, + FD_SETSIZE)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Could not obtain daemon fdsets")); +#endif + err_state = MHD_YES; + } + } + else + { + /* accept only, have one thread per connection */ + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) && + (! MHD_add_to_fd_set_ (ls, + &rs, + &maxsock, + FD_SETSIZE)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Could not add listen socket to fdset")); +#endif + return MHD_NO; + } + } + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_add_to_fd_set_ (MHD_itc_r_fd_ (daemon->itc), + &rs, + &maxsock, + FD_SETSIZE)) ) + { +#if defined(MHD_WINSOCK_SOCKETS) + /* fdset limit reached, new connections + cannot be handled. Remove listen socket FD + from fdset and retry to add ITC FD. */ + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) ) + { + FD_CLR (ls, + &rs); + if (! MHD_add_to_fd_set_ (MHD_itc_r_fd_(daemon->itc), + &rs, + &maxsock, + FD_SETSIZE)) + { +#endif /* MHD_WINSOCK_SOCKETS */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Could not add control inter-thread communication channel FD to fdset")); +#endif + err_state = MHD_YES; +#if defined(MHD_WINSOCK_SOCKETS) + } + } +#endif /* MHD_WINSOCK_SOCKETS */ + } + /* Stop listening if we are at the configured connection limit */ + /* If we're at the connection limit, no point in really + accepting new connections; however, make sure we do not miss + the shutdown OR the termination of an existing connection; so + only do this optimization if we have a signaling ITC in + place. */ + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (MHD_ITC_IS_VALID_(daemon->itc)) && + ( (daemon->connections == daemon->connection_limit) || + (daemon->at_limit) ) ) + { + FD_CLR (ls, + &rs); + } + tv = NULL; + if (MHD_YES == err_state) + may_block = MHD_NO; + if (MHD_NO == may_block) + { + timeout.tv_usec = 0; + timeout.tv_sec = 0; + tv = &timeout; + } + else if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (MHD_YES == MHD_get_timeout (daemon, <imeout)) ) + { + /* ltimeout is in ms */ + timeout.tv_usec = (ltimeout % 1000) * 1000; + if (ltimeout / 1000 > TIMEVAL_TV_SEC_MAX) + timeout.tv_sec = TIMEVAL_TV_SEC_MAX; + else + timeout.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE)(ltimeout / 1000); + tv = &timeout; + } + num_ready = MHD_SYS_select_ (maxsock + 1, + &rs, + &ws, + &es, + tv); + if (daemon->shutdown) + return MHD_NO; + if (num_ready < 0) + { + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_(err)) + return (MHD_NO == err_state) ? MHD_YES : MHD_NO; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("select failed: %s\n"), + MHD_socket_strerr_ (err)); +#endif + return MHD_NO; + } + if (MHD_YES == internal_run_from_select (daemon, + &rs, + &ws, + &es)) + return (MHD_NO == err_state) ? MHD_YES : MHD_NO; + return MHD_NO; +} + + +#ifdef HAVE_POLL +/** + * Process all of our connections and possibly the server + * socket using poll(). + * + * @param daemon daemon to run poll loop for + * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking + * @return #MHD_NO on serious errors, #MHD_YES on success + */ +static int +MHD_poll_all (struct MHD_Daemon *daemon, + int may_block) +{ + unsigned int num_connections; + struct MHD_Connection *pos; + struct MHD_Connection *prev; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + struct MHD_UpgradeResponseHandle *urh; + struct MHD_UpgradeResponseHandle *urhn; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && + (MHD_YES == resume_suspended_connections (daemon)) ) + may_block = MHD_NO; + + /* count number of connections and thus determine poll set size */ + num_connections = 0; + for (pos = daemon->connections_head; NULL != pos; pos = pos->next) + num_connections++; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + for (urh = daemon->urh_head; NULL != urh; urh = urh->next) + num_connections += 2; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + { + MHD_UNSIGNED_LONG_LONG ltimeout; + unsigned int i; + int timeout; + unsigned int poll_server; + int poll_listen; + int poll_itc_idx; + struct pollfd *p; + MHD_socket ls; + + p = MHD_calloc_ ((2 + num_connections), sizeof (struct pollfd)); + if (NULL == p) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error allocating memory: %s\n"), + MHD_strerror_(errno)); +#endif + return MHD_NO; + } + poll_server = 0; + poll_listen = -1; + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) && + (daemon->connections < daemon->connection_limit) && + (! daemon->at_limit) ) + { + /* only listen if we are not at the connection limit */ + p[poll_server].fd = ls; + p[poll_server].events = POLLIN; + p[poll_server].revents = 0; + poll_listen = (int) poll_server; + poll_server++; + } + poll_itc_idx = -1; + if (MHD_ITC_IS_VALID_(daemon->itc)) + { + p[poll_server].fd = MHD_itc_r_fd_ (daemon->itc); + p[poll_server].events = POLLIN; + p[poll_server].revents = 0; + poll_itc_idx = (int) poll_server; + poll_server++; + } + if (may_block == MHD_NO) + timeout = 0; + else if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || + (MHD_YES != MHD_get_timeout (daemon, + <imeout)) ) + timeout = -1; + else + timeout = (ltimeout > INT_MAX) ? INT_MAX : (int) ltimeout; + + i = 0; + for (pos = daemon->connections_tail; NULL != pos; pos = pos->prev) + { + p[poll_server+i].fd = pos->socket_fd; + switch (pos->event_loop_info) + { + case MHD_EVENT_LOOP_INFO_READ: + p[poll_server+i].events |= POLLIN | MHD_POLL_EVENTS_ERR_DISC; + break; + case MHD_EVENT_LOOP_INFO_WRITE: + p[poll_server+i].events |= POLLOUT | MHD_POLL_EVENTS_ERR_DISC; + break; + case MHD_EVENT_LOOP_INFO_BLOCK: + p[poll_server+i].events |= MHD_POLL_EVENTS_ERR_DISC; + break; + case MHD_EVENT_LOOP_INFO_CLEANUP: + timeout = 0; /* clean up "pos" immediately */ + break; + } + i++; + } +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + for (urh = daemon->urh_tail; NULL != urh; urh = urh->prev) + { + urh_to_pollfd(urh, &(p[poll_server+i])); + i += 2; + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + if (0 == poll_server + num_connections) + { + free(p); + return MHD_YES; + } + if (MHD_sys_poll_(p, + poll_server + num_connections, + timeout) < 0) + { + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + { + free(p); + return MHD_YES; + } +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("poll failed: %s\n"), + MHD_socket_strerr_ (err)); +#endif + free(p); + return MHD_NO; + } + + /* Reset. New value will be set when connections are processed. */ + daemon->data_already_pending = false; + + /* handle ITC FD */ + /* do it before any other processing so + new signals will be processed in next loop */ + if ( (-1 != poll_itc_idx) && + (0 != (p[poll_itc_idx].revents & POLLIN)) ) + MHD_itc_clear_ (daemon->itc); + + /* handle shutdown */ + if (daemon->shutdown) + { + free(p); + return MHD_NO; + } + i = 0; + prev = daemon->connections_tail; + while (NULL != (pos = prev)) + { + prev = pos->prev; + /* first, sanity checks */ + if (i >= num_connections) + break; /* connection list changed somehow, retry later ... */ + if (p[poll_server+i].fd != pos->socket_fd) + continue; /* fd mismatch, something else happened, retry later ... */ + call_handlers (pos, + 0 != (p[poll_server+i].revents & POLLIN), + 0 != (p[poll_server+i].revents & POLLOUT), + 0 != (p[poll_server+i].revents & MHD_POLL_REVENTS_ERR_DISC)); + i++; + } +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + for (urh = daemon->urh_tail; NULL != urh; urh = urhn) + { + if (i >= num_connections) + break; /* connection list changed somehow, retry later ... */ + + /* Get next connection here as connection can be removed + * from 'daemon->urh_head' list. */ + urhn = urh->prev; + /* Check for fd mismatch. FIXME: required for safety? */ + if ((p[poll_server+i].fd != urh->connection->socket_fd) || + (p[poll_server+i+1].fd != urh->mhd.socket)) + break; + urh_from_pollfd(urh, &(p[poll_server+i])); + i += 2; + process_urh (urh); + /* Finished forwarding? */ + if ( (0 == urh->in_buffer_size) && + (0 == urh->out_buffer_size) && + (0 == urh->in_buffer_used) && + (0 == urh->out_buffer_used) ) + { + /* MHD_connection_finish_forward_() will remove connection from + * 'daemon->urh_head' list. */ + MHD_connection_finish_forward_ (urh->connection); + urh->clean_ready = true; + /* If 'urh->was_closed' already was set to true, connection will be + * moved immediately to cleanup list. Otherwise connection + * will stay in suspended list until 'urh' will be marked + * with 'was_closed' by application. */ + MHD_resume_connection(urh->connection); + } + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + /* handle 'listen' FD */ + if ( (-1 != poll_listen) && + (0 != (p[poll_listen].revents & POLLIN)) ) + (void) MHD_accept_connection (daemon); + + free(p); + } + return MHD_YES; +} + + +/** + * Process only the listen socket using poll(). + * + * @param daemon daemon to run poll loop for + * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking + * @return #MHD_NO on serious errors, #MHD_YES on success + */ +static int +MHD_poll_listen_socket (struct MHD_Daemon *daemon, + int may_block) +{ + struct pollfd p[2]; + int timeout; + unsigned int poll_count; + int poll_listen; + int poll_itc_idx; + MHD_socket ls; + + memset (&p, + 0, + sizeof (p)); + poll_count = 0; + poll_listen = -1; + poll_itc_idx = -1; + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) ) + + { + p[poll_count].fd = ls; + p[poll_count].events = POLLIN; + p[poll_count].revents = 0; + poll_listen = poll_count; + poll_count++; + } + if (MHD_ITC_IS_VALID_(daemon->itc)) + { + p[poll_count].fd = MHD_itc_r_fd_ (daemon->itc); + p[poll_count].events = POLLIN; + p[poll_count].revents = 0; + poll_itc_idx = poll_count; + poll_count++; + } + + if (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) + (void)resume_suspended_connections (daemon); + + if (MHD_NO == may_block) + timeout = 0; + else + timeout = -1; + if (0 == poll_count) + return MHD_YES; + if (MHD_sys_poll_(p, + poll_count, + timeout) < 0) + { + const int err = MHD_socket_get_error_ (); + + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + return MHD_YES; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("poll failed: %s\n"), + MHD_socket_strerr_ (err)); +#endif + return MHD_NO; + } + if ( (-1 != poll_itc_idx) && + (0 != (p[poll_itc_idx].revents & POLLIN)) ) + MHD_itc_clear_ (daemon->itc); + + /* handle shutdown */ + if (daemon->shutdown) + return MHD_NO; + if ( (-1 != poll_listen) && + (0 != (p[poll_listen].revents & POLLIN)) ) + (void) MHD_accept_connection (daemon); + return MHD_YES; +} +#endif + + +/** + * Do poll()-based processing. + * + * @param daemon daemon to run poll()-loop for + * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking + * @return #MHD_NO on serious errors, #MHD_YES on success + */ +static int +MHD_poll (struct MHD_Daemon *daemon, + int may_block) +{ +#ifdef HAVE_POLL + if (daemon->shutdown) + return MHD_NO; + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + return MHD_poll_all (daemon, + may_block); + return MHD_poll_listen_socket (daemon, + may_block); +#else + return MHD_NO; +#endif +} + + +#ifdef EPOLL_SUPPORT + +/** + * How many events to we process at most per epoll() call? Trade-off + * between required stack-size and number of system calls we have to + * make; 128 should be way enough to avoid more than one system call + * for most scenarios, and still be moderate in stack size + * consumption. Embedded systems might want to choose a smaller value + * --- but why use epoll() on such a system in the first place? + */ +#define MAX_EVENTS 128 + + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + +/** + * Checks whether @a urh has some data to process. + * + * @param urh upgrade handler to analyse + * @return 'true' if @a urh has some data to process, + * 'false' otherwise + */ +static bool +is_urh_ready(struct MHD_UpgradeResponseHandle * const urh) +{ + const struct MHD_Connection * const connection = urh->connection; + + if ( (0 == urh->in_buffer_size) && + (0 == urh->out_buffer_size) && + (0 == urh->in_buffer_used) && + (0 == urh->out_buffer_used) ) + return false; + + if (connection->daemon->shutdown) + return true; + + if ( ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->app.celi)) || + (connection->tls_read_ready) ) && + (urh->in_buffer_used < urh->in_buffer_size) ) + return true; + + if ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->mhd.celi)) && + (urh->out_buffer_used < urh->out_buffer_size) ) + return true; + + if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->app.celi)) && + (urh->out_buffer_used > 0) ) + return true; + + if ( (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->mhd.celi)) && + (urh->in_buffer_used > 0) ) + return true; + + return false; +} + +/** + * Do epoll()-based processing for TLS connections that have been + * upgraded. This requires a separate epoll() invocation as we + * cannot use the `struct MHD_Connection` data structures for + * the `union epoll_data` in this case. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + */ +static int +run_epoll_for_upgrade (struct MHD_Daemon *daemon) +{ + struct epoll_event events[MAX_EVENTS]; + int num_events; + struct MHD_UpgradeResponseHandle * pos; + struct MHD_UpgradeResponseHandle * prev; + + num_events = MAX_EVENTS; + while (MAX_EVENTS == num_events) + { + unsigned int i; + /* update event masks */ + num_events = epoll_wait (daemon->epoll_upgrade_fd, + events, + MAX_EVENTS, + 0); + if (-1 == num_events) + { + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + return MHD_YES; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_wait failed: %s\n"), + MHD_socket_strerr_ (err)); +#endif + return MHD_NO; + } + for (i = 0; i < (unsigned int) num_events; i++) + { + struct UpgradeEpollHandle * const ueh = events[i].data.ptr; + struct MHD_UpgradeResponseHandle * const urh = ueh->urh; + bool new_err_state = false; + + if (urh->clean_ready) + continue; + + /* Update ueh state based on what is ready according to epoll() */ + if (0 != (events[i].events & EPOLLIN)) + ueh->celi |= MHD_EPOLL_STATE_READ_READY; + if (0 != (events[i].events & EPOLLOUT)) + ueh->celi |= MHD_EPOLL_STATE_WRITE_READY; + if (0 != (events[i].events & EPOLLHUP)) + ueh->celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; + + if ( (0 == (ueh->celi & MHD_EPOLL_STATE_ERROR)) && + (0 != (events[i].events & (EPOLLERR | EPOLLPRI))) ) + { + /* Process new error state only one time + * and avoid continuously marking this connection + * as 'ready'. */ + ueh->celi |= MHD_EPOLL_STATE_ERROR; + new_err_state = true; + } + + if (! urh->in_eready_list) + { + if (new_err_state || + is_urh_ready(urh)) + { + EDLL_insert (daemon->eready_urh_head, + daemon->eready_urh_tail, + urh); + urh->in_eready_list = true; + } + } + } + } + prev = daemon->eready_urh_tail; + while (NULL != (pos = prev)) + { + prev = pos->prevE; + process_urh (pos); + if (! is_urh_ready(pos)) + { + EDLL_remove (daemon->eready_urh_head, + daemon->eready_urh_tail, + pos); + pos->in_eready_list = false; + } + /* Finished forwarding? */ + if ( (0 == pos->in_buffer_size) && + (0 == pos->out_buffer_size) && + (0 == pos->in_buffer_used) && + (0 == pos->out_buffer_used) ) + { + MHD_connection_finish_forward_ (pos->connection); + pos->clean_ready = true; + /* If 'pos->was_closed' already was set to true, connection + * will be moved immediately to cleanup list. Otherwise + * connection will stay in suspended list until 'pos' will + * be marked with 'was_closed' by application. */ + MHD_resume_connection(pos->connection); + } + } + + return MHD_YES; +} +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + +/** + * Pointer-marker to distinguish ITC slot in epoll sets. + */ +static const char * const epoll_itc_marker = "itc_marker"; + +/** + * Do epoll()-based processing (this function is allowed to + * block if @a may_block is set to #MHD_YES). + * + * @param daemon daemon to run poll loop for + * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking + * @return #MHD_NO on serious errors, #MHD_YES on success + */ +static int +MHD_epoll (struct MHD_Daemon *daemon, + int may_block) +{ +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + static const char * const upgrade_marker = "upgrade_ptr"; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + struct MHD_Connection *pos; + struct MHD_Connection *prev; + struct epoll_event events[MAX_EVENTS]; + struct epoll_event event; + int timeout_ms; + MHD_UNSIGNED_LONG_LONG timeout_ll; + int num_events; + unsigned int i; + MHD_socket ls; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + int run_upgraded = MHD_NO; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + if (-1 == daemon->epoll_fd) + return MHD_NO; /* we're down! */ + if (daemon->shutdown) + return MHD_NO; + if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && + (! daemon->was_quiesced) && + (daemon->connections < daemon->connection_limit) && + (! daemon->listen_socket_in_epoll) && + (! daemon->at_limit) ) + { + event.events = EPOLLIN; + event.data.ptr = daemon; + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_ADD, + ls, + &event)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + return MHD_NO; + } + daemon->listen_socket_in_epoll = true; + } + if ( (daemon->was_quiesced) && + (daemon->listen_socket_in_epoll) ) + { + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + ls, + NULL)) + MHD_PANIC ("Failed to remove listen FD from epoll set\n"); + daemon->listen_socket_in_epoll = false; + } + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if ( (! daemon->upgrade_fd_in_epoll) && + (-1 != daemon->epoll_upgrade_fd) ) + { + event.events = EPOLLIN | EPOLLOUT; + event.data.ptr = (void *) upgrade_marker; + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_ADD, + daemon->epoll_upgrade_fd, + &event)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + return MHD_NO; + } + daemon->upgrade_fd_in_epoll = true; + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + if ( (daemon->listen_socket_in_epoll) && + ( (daemon->connections == daemon->connection_limit) || + (daemon->at_limit) || + (daemon->was_quiesced) ) ) + { + /* we're at the connection limit, disable listen socket + for event loop for now */ + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + ls, + NULL)) + MHD_PANIC (_("Failed to remove listen FD from epoll set\n")); + daemon->listen_socket_in_epoll = false; + } + + if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && + (MHD_YES == resume_suspended_connections (daemon)) ) + may_block = MHD_NO; + + if (MHD_YES == may_block) + { + if (MHD_YES == MHD_get_timeout (daemon, + &timeout_ll)) + { + if (timeout_ll >= (MHD_UNSIGNED_LONG_LONG) INT_MAX) + timeout_ms = INT_MAX; + else + timeout_ms = (int) timeout_ll; + } + else + timeout_ms = -1; + } + else + timeout_ms = 0; + + /* Reset. New value will be set when connections are processed. */ + /* Note: Used mostly for uniformity here as same situation is + * signaled in epoll mode by non-empty eready DLL. */ + daemon->data_already_pending = false; + + /* drain 'epoll' event queue; need to iterate as we get at most + MAX_EVENTS in one system call here; in practice this should + pretty much mean only one round, but better an extra loop here + than unfair behavior... */ + num_events = MAX_EVENTS; + while (MAX_EVENTS == num_events) + { + /* update event masks */ + num_events = epoll_wait (daemon->epoll_fd, + events, + MAX_EVENTS, + timeout_ms); + if (-1 == num_events) + { + const int err = MHD_socket_get_error_ (); + if (MHD_SCKT_ERR_IS_EINTR_ (err)) + return MHD_YES; +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_wait failed: %s\n"), + MHD_socket_strerr_ (err)); +#endif + return MHD_NO; + } + for (i=0;i<(unsigned int) num_events;i++) + { + /* First, check for the values of `ptr` that would indicate + that this event is not about a normal connection. */ + if (NULL == events[i].data.ptr) + continue; /* shutdown signal! */ +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (upgrade_marker == events[i].data.ptr) + { + /* activity on an upgraded connection, we process + those in a separate epoll() */ + run_upgraded = MHD_YES; + continue; + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + if (epoll_itc_marker == events[i].data.ptr) + { + /* It's OK to clear ITC here as all external + conditions will be processed later. */ + MHD_itc_clear_ (daemon->itc); + continue; + } + if (daemon == events[i].data.ptr) + { + /* Check for error conditions on listen socket. */ + /* FIXME: Initiate MHD_quiesce_daemon() to prevent busy waiting? */ + if (0 == (events[i].events & (EPOLLERR | EPOLLHUP))) + { + unsigned int series_length = 0; + /* Run 'accept' until it fails or daemon at limit of connections. + * Do not accept more then 10 connections at once. The rest will + * be accepted on next turn (level trigger is used for listen + * socket). */ + while ( (MHD_YES == MHD_accept_connection (daemon)) && + (series_length < 10) && + (daemon->connections < daemon->connection_limit) && + (! daemon->at_limit) ) + series_length++; + } + continue; + } + /* this is an event relating to a 'normal' connection, + remember the event and if appropriate mark the + connection as 'eready'. */ + pos = events[i].data.ptr; + /* normal processing: update read/write data */ + if (0 != (events[i].events & (EPOLLPRI | EPOLLERR | EPOLLHUP))) + { + pos->epoll_state |= MHD_EPOLL_STATE_ERROR; + if (0 == (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) + { + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + } + else + { + if (0 != (events[i].events & EPOLLIN)) + { + pos->epoll_state |= MHD_EPOLL_STATE_READ_READY; + if ( ( (MHD_EVENT_LOOP_INFO_READ == pos->event_loop_info) || + (pos->read_buffer_size > pos->read_buffer_offset) ) && + (0 == (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL) ) ) + { + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + } + if (0 != (events[i].events & EPOLLOUT)) + { + pos->epoll_state |= MHD_EPOLL_STATE_WRITE_READY; + if ( (MHD_EVENT_LOOP_INFO_WRITE == pos->event_loop_info) && + (0 == (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL) ) ) + { + EDLL_insert (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state |= MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + } + } + } + } + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (MHD_YES == run_upgraded) + run_epoll_for_upgrade (daemon); +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + /* process events for connections */ + prev = daemon->eready_tail; + while (NULL != (pos = prev)) + { + prev = pos->prevE; + call_handlers (pos, + 0 != (pos->epoll_state & MHD_EPOLL_STATE_READ_READY), + 0 != (pos->epoll_state & MHD_EPOLL_STATE_WRITE_READY), + 0 != (pos->epoll_state & MHD_EPOLL_STATE_ERROR)); + if (MHD_EPOLL_STATE_IN_EREADY_EDLL == + (pos->epoll_state & (MHD_EPOLL_STATE_SUSPENDED | MHD_EPOLL_STATE_IN_EREADY_EDLL))) + { + if ( (MHD_EVENT_LOOP_INFO_READ == pos->event_loop_info && + 0 == (pos->epoll_state & MHD_EPOLL_STATE_READ_READY) ) || + (MHD_EVENT_LOOP_INFO_WRITE == pos->event_loop_info && + 0 == (pos->epoll_state & MHD_EPOLL_STATE_WRITE_READY) ) || + MHD_EVENT_LOOP_INFO_CLEANUP == pos->event_loop_info) + { + EDLL_remove (daemon->eready_head, + daemon->eready_tail, + pos); + pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EREADY_EDLL; + } + } + } + + /* Finally, handle timed-out connections; we need to do this here + as the epoll mechanism won't call the 'MHD_connection_handle_idle()' on everything, + as the other event loops do. As timeouts do not get an explicit + event, we need to find those connections that might have timed out + here. + + Connections with custom timeouts must all be looked at, as we + do not bother to sort that (presumably very short) list. */ + prev = daemon->manual_timeout_tail; + while (NULL != (pos = prev)) + { + prev = pos->prevX; + MHD_connection_handle_idle (pos); + } + /* Connections with the default timeout are sorted by prepending + them to the head of the list whenever we touch the connection; + thus it suffices to iterate from the tail until the first + connection is NOT timed out */ + prev = daemon->normal_timeout_tail; + while (NULL != (pos = prev)) + { + prev = pos->prevX; + MHD_connection_handle_idle (pos); + if (MHD_CONNECTION_CLOSED != pos->state) + break; /* sorted by timeout, no need to visit the rest! */ + } + return MHD_YES; +} +#endif + + +/** + * Run webserver operations (without blocking unless in client + * callbacks). This method should be called by clients in combination + * with #MHD_get_fdset if the client-controlled select method is used and + * #MHD_get_timeout(). + * + * This function is a convenience method, which is useful if the + * fd_sets from #MHD_get_fdset were not directly passed to `select()`; + * with this function, MHD will internally do the appropriate `select()` + * call itself again. While it is always safe to call #MHD_run (in + * external select mode), you should call #MHD_run_from_select if + * performance is important (as it saves an expensive call to + * `select()`). + * + * @param daemon daemon to run + * @return #MHD_YES on success, #MHD_NO if this + * daemon was not started with the right + * options for this call. + * @ingroup event + */ +int +MHD_run (struct MHD_Daemon *daemon) +{ + if ( (daemon->shutdown) || + (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) ) + return MHD_NO; + if (0 != (daemon->options & MHD_USE_POLL)) + { + MHD_poll (daemon, MHD_NO); + MHD_cleanup_connections (daemon); + } +#ifdef EPOLL_SUPPORT + else if (0 != (daemon->options & MHD_USE_EPOLL)) + { + MHD_epoll (daemon, MHD_NO); + MHD_cleanup_connections (daemon); + } +#endif + else + { + MHD_select (daemon, MHD_NO); + /* MHD_select does MHD_cleanup_connections already */ + } + return MHD_YES; +} + + +/** + * Close the given connection, remove it from all of its + * DLLs and move it into the cleanup queue. + * @remark To be called only from thread that + * process daemon's select()/poll()/etc. + * + * @param pos connection to move to cleanup + */ +static void +close_connection (struct MHD_Connection *pos) +{ + struct MHD_Daemon *daemon = pos->daemon; + + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { + MHD_connection_mark_closed_ (pos); + return; /* must let thread to do the rest */ + } + MHD_connection_close_ (pos, + MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); + + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + + mhd_assert (! pos->suspended); + mhd_assert (! pos->resuming); + if (pos->connection_timeout == pos->daemon->connection_timeout) + XDLL_remove (daemon->normal_timeout_head, + daemon->normal_timeout_tail, + pos); + else + XDLL_remove (daemon->manual_timeout_head, + daemon->manual_timeout_tail, + pos); + DLL_remove (daemon->connections_head, + daemon->connections_tail, + pos); + DLL_insert (daemon->cleanup_head, + daemon->cleanup_tail, + pos); + + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); +} + + +/** + * Thread that runs the polling loop until the daemon + * is explicitly shut down. + * + * @param cls `struct MHD_Deamon` to run select loop in a thread for + * @return always 0 (on shutdown) + */ +static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ +MHD_polling_thread (void *cls) +{ + struct MHD_Daemon *daemon = cls; + MHD_thread_init_(&(daemon->pid)); + + while (! daemon->shutdown) + { + if (0 != (daemon->options & MHD_USE_POLL)) + MHD_poll (daemon, MHD_YES); +#ifdef EPOLL_SUPPORT + else if (0 != (daemon->options & MHD_USE_EPOLL)) + MHD_epoll (daemon, MHD_YES); +#endif + else + MHD_select (daemon, MHD_YES); + MHD_cleanup_connections (daemon); + } + + /* Resume any pending for resume connections, join + * all connection's threads (if any) and finally cleanup + * everything. */ + close_all_connections (daemon); + + return (MHD_THRD_RTRN_TYPE_)0; +} + + +/** + * Process escape sequences ('%HH') Updates val in place; the + * result should be UTF-8 encoded and cannot be larger than the input. + * The result must also still be 0-terminated. + * + * @param cls closure (use NULL) + * @param connection handle to connection, not used + * @param val value to unescape (modified in the process) + * @return length of the resulting val (strlen(val) maybe + * shorter afterwards due to elimination of escape sequences) + */ +static size_t +unescape_wrapper (void *cls, + struct MHD_Connection *connection, + char *val) +{ + (void)cls; /* Mute compiler warning. */ + (void)connection; /* Mute compiler warning. */ + return MHD_http_unescape (val); +} + + +/** + * Start a webserver on the given port. Variadic version of + * #MHD_start_daemon_va. + * + * @param flags combination of `enum MHD_FLAG` values + * @param port port to bind to (in host byte order), + * use '0' to bind to random free port, + * ignored if MHD_OPTION_SOCK_ADDR or + * MHD_OPTION_LISTEN_SOCKET is provided + * or MHD_USE_NO_LISTEN_SOCKET is specified + * @param apc callback to call to check which clients + * will be allowed to connect; you can pass NULL + * in which case connections from any IP will be + * accepted + * @param apc_cls extra argument to @a apc + * @param dh handler called for all requests (repeatedly) + * @param dh_cls extra argument to @a dh + * @return NULL on error, handle to daemon on success + * @ingroup event + */ +struct MHD_Daemon * +MHD_start_daemon (unsigned int flags, + uint16_t port, + MHD_AcceptPolicyCallback apc, + void *apc_cls, + MHD_AccessHandlerCallback dh, + void *dh_cls, + ...) +{ + struct MHD_Daemon *daemon; + va_list ap; + + va_start (ap, + dh_cls); + daemon = MHD_start_daemon_va (flags, + port, + apc, + apc_cls, + dh, + dh_cls, + ap); + va_end (ap); + return daemon; +} + + +/** + * Stop accepting connections from the listening socket. Allows + * clients to continue processing, but stops accepting new + * connections. Note that the caller is responsible for closing the + * returned socket; however, if MHD is run using threads (anything but + * external select mode), socket will be removed from existing threads + * with some delay and it must not be closed while it's in use. To make + * sure that the socket is not used anymore, call #MHD_stop_daemon. + * + * Note that some thread modes require the caller to have passed + * #MHD_USE_ITC when using this API. If this daemon is + * in one of those modes and this option was not given to + * #MHD_start_daemon, this function will return #MHD_INVALID_SOCKET. + * + * @param daemon daemon to stop accepting new connections for + * @return old listen socket on success, #MHD_INVALID_SOCKET if + * the daemon was already not listening anymore + * @ingroup specialized + */ +MHD_socket +MHD_quiesce_daemon (struct MHD_Daemon *daemon) +{ + unsigned int i; + MHD_socket ret; + + ret = daemon->listen_fd; + if (MHD_INVALID_SOCKET == ret) + return MHD_INVALID_SOCKET; + if ( (0 == (daemon->options & (MHD_USE_ITC))) && + (0 != (daemon->options & (MHD_USE_INTERNAL_POLLING_THREAD))) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + "Using MHD_quiesce_daemon in this mode requires MHD_USE_ITC\n"); +#endif + return MHD_INVALID_SOCKET; + } + + if (NULL != daemon->worker_pool) + for (i = 0; i < daemon->worker_pool_size; i++) + { + daemon->worker_pool[i].was_quiesced = true; +#ifdef EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (-1 != daemon->worker_pool[i].epoll_fd) && + (daemon->worker_pool[i].listen_socket_in_epoll) ) + { + if (0 != epoll_ctl (daemon->worker_pool[i].epoll_fd, + EPOLL_CTL_DEL, + ret, + NULL)) + MHD_PANIC (_("Failed to remove listen FD from epoll set\n")); + daemon->worker_pool[i].listen_socket_in_epoll = false; + } + else +#endif + if (MHD_ITC_IS_VALID_(daemon->worker_pool[i].itc)) + { + if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, "q")) + MHD_PANIC (_("Failed to signal quiesce via inter-thread communication channel")); + } + } + daemon->was_quiesced = true; +#ifdef EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (-1 != daemon->epoll_fd) && + (daemon->listen_socket_in_epoll) ) + { + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + ret, + NULL)) + MHD_PANIC ("Failed to remove listen FD from epoll set\n"); + daemon->listen_socket_in_epoll = false; + } +#endif + if ( (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "q")) ) + MHD_PANIC (_("failed to signal quiesce via inter-thread communication channel")); + return ret; +} + + +/** + * Signature of the MHD custom logger function. + * + * @param cls closure + * @param format format string + * @param va arguments to the format string (fprintf-style) + */ +typedef void +(*VfprintfFunctionPointerType)(void *cls, + const char *format, + va_list va); + + +/** + * Parse a list of options given as varargs. + * + * @param daemon the daemon to initialize + * @param servaddr where to store the server's listen address + * @param ap the options + * @return #MHD_YES on success, #MHD_NO on error + */ +static int +parse_options_va (struct MHD_Daemon *daemon, + const struct sockaddr **servaddr, + va_list ap); + + +/** + * Parse a list of options given as varargs. + * + * @param daemon the daemon to initialize + * @param servaddr where to store the server's listen address + * @param ... the options + * @return #MHD_YES on success, #MHD_NO on error + */ +static int +parse_options (struct MHD_Daemon *daemon, + const struct sockaddr **servaddr, + ...) +{ + va_list ap; + int ret; + + va_start (ap, servaddr); + ret = parse_options_va (daemon, + servaddr, + ap); + va_end (ap); + return ret; +} + + +/** + * Parse a list of options given as varargs. + * + * @param daemon the daemon to initialize + * @param servaddr where to store the server's listen address + * @param ap the options + * @return #MHD_YES on success, #MHD_NO on error + */ +static int +parse_options_va (struct MHD_Daemon *daemon, + const struct sockaddr **servaddr, + va_list ap) +{ + enum MHD_OPTION opt; + struct MHD_OptionItem *oa; + unsigned int i; + unsigned int uv; +#ifdef HTTPS_SUPPORT + int ret; + const char *pstr; +#endif /* HTTPS_SUPPORT */ + + while (MHD_OPTION_END != (opt = (enum MHD_OPTION) va_arg (ap, int))) + { + switch (opt) + { + case MHD_OPTION_CONNECTION_MEMORY_LIMIT: + daemon->pool_size = va_arg (ap, + size_t); + break; + case MHD_OPTION_CONNECTION_MEMORY_INCREMENT: + daemon->pool_increment= va_arg (ap, + size_t); + break; + case MHD_OPTION_CONNECTION_LIMIT: + daemon->connection_limit = va_arg (ap, + unsigned int); + break; + case MHD_OPTION_CONNECTION_TIMEOUT: + uv = va_arg (ap, + unsigned int); + /* Next comparison could be always false on some platforms and whole branch will + * be optimized out on those platforms. On others it will be compiled into real + * check. */ + if (TIME_T_MAX < uv) /* Compiler may warn on some platforms, ignore warning. */ + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Warning: Too large timeout value, ignored.\n")); +#endif + daemon->connection_timeout = 0; + } + else + daemon->connection_timeout = (time_t)uv; + break; + case MHD_OPTION_NOTIFY_COMPLETED: + daemon->notify_completed = va_arg (ap, + MHD_RequestCompletedCallback); + daemon->notify_completed_cls = va_arg (ap, + void *); + break; + case MHD_OPTION_NOTIFY_CONNECTION: + daemon->notify_connection = va_arg (ap, + MHD_NotifyConnectionCallback); + daemon->notify_connection_cls = va_arg (ap, + void *); + break; + case MHD_OPTION_PER_IP_CONNECTION_LIMIT: + daemon->per_ip_connection_limit = va_arg (ap, + unsigned int); + break; + case MHD_OPTION_SOCK_ADDR: + *servaddr = va_arg (ap, + const struct sockaddr *); + break; + case MHD_OPTION_URI_LOG_CALLBACK: + daemon->uri_log_callback = va_arg (ap, + LogCallback); + daemon->uri_log_callback_cls = va_arg (ap, + void *); + break; + case MHD_OPTION_THREAD_POOL_SIZE: + daemon->worker_pool_size = va_arg (ap, + unsigned int); + if (0 == daemon->worker_pool_size) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Warning: Zero size, specified for thread pool size, is ignored. " + "Thread pool is not used.\n")); +#endif + } + else if (1 == daemon->worker_pool_size) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Warning: \"1\", specified for thread pool size, is ignored. " + "Thread pool is not used.\n")); +#endif + daemon->worker_pool_size = 0; + } + /* Next comparison could be always false on some platforms and whole branch will + * be optimized out on those platforms. On others it will be compiled into real + * check. */ + else if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct MHD_Daemon))) /* Compiler may warn on some platforms, ignore warning. */ + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Specified thread pool size (%u) too big\n"), + daemon->worker_pool_size); +#endif + return MHD_NO; + } + else + { + if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_OPTION_THREAD_POOL_SIZE option is specified but " + "MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n")); +#endif + return MHD_NO; + } + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Both MHD_OPTION_THREAD_POOL_SIZE option and " + "MHD_USE_THREAD_PER_CONNECTION flag are specified.\n")); +#endif + return MHD_NO; + } + } + break; +#ifdef HTTPS_SUPPORT + case MHD_OPTION_HTTPS_MEM_KEY: + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->https_mem_key = va_arg (ap, + const char *); +#ifdef HAVE_MESSAGES + else + MHD_DLOG (daemon, + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), + opt); +#endif + break; + case MHD_OPTION_HTTPS_KEY_PASSWORD: + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->https_key_password = va_arg (ap, + const char *); +#ifdef HAVE_MESSAGES + else + MHD_DLOG (daemon, + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), + opt); +#endif + break; + case MHD_OPTION_HTTPS_MEM_CERT: + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->https_mem_cert = va_arg (ap, + const char *); +#ifdef HAVE_MESSAGES + else + MHD_DLOG (daemon, + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), + opt); +#endif + break; + case MHD_OPTION_HTTPS_MEM_TRUST: + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->https_mem_trust = va_arg (ap, + const char *); +#ifdef HAVE_MESSAGES + else + MHD_DLOG (daemon, + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), + opt); +#endif + break; + case MHD_OPTION_HTTPS_CRED_TYPE: + daemon->cred_type = (gnutls_credentials_type_t) va_arg (ap, + int); + break; + case MHD_OPTION_HTTPS_MEM_DHPARAMS: + if (0 != (daemon->options & MHD_USE_TLS)) + { + const char *arg = va_arg (ap, + const char *); + gnutls_datum_t dhpar; + + if (gnutls_dh_params_init (&daemon->https_mem_dhparams) < 0) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Error initializing DH parameters\n")); +#endif + return MHD_NO; + } + dhpar.data = (unsigned char *) arg; + dhpar.size = strlen (arg); + if (gnutls_dh_params_import_pkcs3 (daemon->https_mem_dhparams, + &dhpar, + GNUTLS_X509_FMT_PEM) < 0) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Bad Diffie-Hellman parameters format\n")); +#endif + gnutls_dh_params_deinit (daemon->https_mem_dhparams); + return MHD_NO; + } + daemon->have_dhparams = true; + } + else + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n"), + opt); +#endif + return MHD_NO; + } + break; + case MHD_OPTION_HTTPS_PRIORITIES: + if (0 != (daemon->options & MHD_USE_TLS)) + { + gnutls_priority_deinit (daemon->priority_cache); + ret = gnutls_priority_init (&daemon->priority_cache, + pstr = va_arg (ap, const char*), + NULL); + if (GNUTLS_E_SUCCESS != ret) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Setting priorities to `%s' failed: %s\n"), + pstr, + gnutls_strerror (ret)); +#endif + daemon->priority_cache = NULL; + return MHD_NO; + } + } + break; + case MHD_OPTION_HTTPS_CERT_CALLBACK: +#if GNUTLS_VERSION_MAJOR < 3 +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n")); +#endif + return MHD_NO; +#else + if (0 != (daemon->options & MHD_USE_TLS)) + daemon->cert_callback = va_arg (ap, + gnutls_certificate_retrieve_function2 *); + break; +#endif +#endif /* HTTPS_SUPPORT */ +#ifdef DAUTH_SUPPORT + case MHD_OPTION_DIGEST_AUTH_RANDOM: + daemon->digest_auth_rand_size = va_arg (ap, + size_t); + daemon->digest_auth_random = va_arg (ap, + const char *); + break; + case MHD_OPTION_NONCE_NC_SIZE: + daemon->nonce_nc_size = va_arg (ap, + unsigned int); + break; +#endif + case MHD_OPTION_LISTEN_SOCKET: + if (0 != (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD_OPTION_LISTEN_SOCKET specified for daemon " + "with MHD_USE_NO_LISTEN_SOCKET flag set.\n")); +#endif + return MHD_NO; + } + else + daemon->listen_fd = va_arg (ap, + MHD_socket); + break; + case MHD_OPTION_EXTERNAL_LOGGER: +#ifdef HAVE_MESSAGES + daemon->custom_error_log = va_arg (ap, + VfprintfFunctionPointerType); + daemon->custom_error_log_cls = va_arg (ap, + void *); +#else + va_arg (ap, + VfprintfFunctionPointerType); + va_arg (ap, + void *); +#endif + break; + case MHD_OPTION_THREAD_STACK_SIZE: + daemon->thread_stack_size = va_arg (ap, + size_t); + break; +#ifdef TCP_FASTOPEN + case MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE: + daemon->fastopen_queue_size = va_arg (ap, + unsigned int); + break; +#endif + case MHD_OPTION_LISTENING_ADDRESS_REUSE: + daemon->listening_address_reuse = va_arg (ap, + unsigned int) ? 1 : -1; + break; + case MHD_OPTION_LISTEN_BACKLOG_SIZE: + daemon->listen_backlog_size = va_arg (ap, + unsigned int); + break; + case MHD_OPTION_STRICT_FOR_CLIENT: + daemon->strict_for_client = va_arg (ap, int);; +#ifdef HAVE_MESSAGES + if ( (0 != (daemon->options & MHD_USE_PEDANTIC_CHECKS)) && + (1 != daemon->strict_for_client) ) + { + MHD_DLOG (daemon, + _("Flag MHD_USE_PEDANTIC_CHECKS is ignored because " + "another behavior is specified by MHD_OPTION_STRICT_CLIENT.\n")); + } +#endif /* HAVE_MESSAGES */ + break; + case MHD_OPTION_ARRAY: + oa = va_arg (ap, struct MHD_OptionItem*); + i = 0; + while (MHD_OPTION_END != (opt = oa[i].option)) + { + switch (opt) + { + /* all options taking 'size_t' */ + case MHD_OPTION_CONNECTION_MEMORY_LIMIT: + case MHD_OPTION_CONNECTION_MEMORY_INCREMENT: + case MHD_OPTION_THREAD_STACK_SIZE: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + (size_t) oa[i].value, + MHD_OPTION_END)) + return MHD_NO; + break; + /* all options taking 'unsigned int' */ + case MHD_OPTION_NONCE_NC_SIZE: + case MHD_OPTION_CONNECTION_LIMIT: + case MHD_OPTION_CONNECTION_TIMEOUT: + case MHD_OPTION_PER_IP_CONNECTION_LIMIT: + case MHD_OPTION_THREAD_POOL_SIZE: + case MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE: + case MHD_OPTION_LISTENING_ADDRESS_REUSE: + case MHD_OPTION_LISTEN_BACKLOG_SIZE: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + (unsigned int) oa[i].value, + MHD_OPTION_END)) + return MHD_NO; + break; + /* all options taking 'enum' */ +#ifdef HTTPS_SUPPORT + case MHD_OPTION_HTTPS_CRED_TYPE: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + (gnutls_credentials_type_t) oa[i].value, + MHD_OPTION_END)) + return MHD_NO; + break; +#endif /* HTTPS_SUPPORT */ + /* all options taking 'MHD_socket' */ + case MHD_OPTION_LISTEN_SOCKET: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + (MHD_socket) oa[i].value, + MHD_OPTION_END)) + return MHD_NO; + break; + /* all options taking 'int' */ + case MHD_OPTION_STRICT_FOR_CLIENT: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + (int) oa[i].value, + MHD_OPTION_END)) + return MHD_NO; + break; + /* all options taking one pointer */ + case MHD_OPTION_SOCK_ADDR: + case MHD_OPTION_HTTPS_MEM_KEY: + case MHD_OPTION_HTTPS_KEY_PASSWORD: + case MHD_OPTION_HTTPS_MEM_CERT: + case MHD_OPTION_HTTPS_MEM_TRUST: + case MHD_OPTION_HTTPS_MEM_DHPARAMS: + case MHD_OPTION_HTTPS_PRIORITIES: + case MHD_OPTION_ARRAY: + case MHD_OPTION_HTTPS_CERT_CALLBACK: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + oa[i].ptr_value, + MHD_OPTION_END)) + return MHD_NO; + break; + /* all options taking two pointers */ + case MHD_OPTION_NOTIFY_COMPLETED: + case MHD_OPTION_NOTIFY_CONNECTION: + case MHD_OPTION_URI_LOG_CALLBACK: + case MHD_OPTION_EXTERNAL_LOGGER: + case MHD_OPTION_UNESCAPE_CALLBACK: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + (void *) oa[i].value, + oa[i].ptr_value, + MHD_OPTION_END)) + return MHD_NO; + break; + /* options taking size_t-number followed by pointer */ + case MHD_OPTION_DIGEST_AUTH_RANDOM: + if (MHD_YES != parse_options (daemon, + servaddr, + opt, + (size_t) oa[i].value, + oa[i].ptr_value, + MHD_OPTION_END)) + return MHD_NO; + break; + default: + return MHD_NO; + } + i++; + } + break; + case MHD_OPTION_UNESCAPE_CALLBACK: + daemon->unescape_callback = va_arg (ap, + UnescapeCallback); + daemon->unescape_callback_cls = va_arg (ap, + void *); + break; + default: +#ifdef HAVE_MESSAGES + if ( ( (opt >= MHD_OPTION_HTTPS_MEM_KEY) && + (opt <= MHD_OPTION_HTTPS_PRIORITIES) ) || + (opt == MHD_OPTION_HTTPS_MEM_TRUST)) + { + MHD_DLOG (daemon, + _("MHD HTTPS option %d passed to MHD compiled without HTTPS support\n"), + opt); + } + else + { + MHD_DLOG (daemon, + _("Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n"), + opt); + } +#endif + return MHD_NO; + } + } + return MHD_YES; +} + + +#ifdef EPOLL_SUPPORT +static int +setup_epoll_fd (struct MHD_Daemon *daemon) +{ + int fd; + +#ifndef HAVE_MESSAGES + (void)daemon; /* Mute compiler warning. */ +#endif /* ! HAVE_MESSAGES */ + +#ifdef USE_EPOLL_CREATE1 + fd = epoll_create1 (EPOLL_CLOEXEC); +#else /* ! USE_EPOLL_CREATE1 */ + fd = epoll_create (MAX_EVENTS); +#endif /* ! USE_EPOLL_CREATE1 */ + if (MHD_INVALID_SOCKET == fd) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_create1 failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + return MHD_INVALID_SOCKET; + } +#if !defined(USE_EPOLL_CREATE1) + if (! MHD_socket_noninheritable_ (fd)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set noninheritable mode on epoll FD.\n")); +#endif + } +#endif /* ! USE_EPOLL_CREATE1 */ + return fd; +} + + +/** + * Setup epoll() FD for the daemon and initialize it to listen + * on the listen FD. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param daemon daemon to initialize for epoll() + * @return #MHD_YES on success, #MHD_NO on failure + */ +static int +setup_epoll_to_listen (struct MHD_Daemon *daemon) +{ + struct epoll_event event; + MHD_socket ls; + + daemon->epoll_fd = setup_epoll_fd (daemon); + if (-1 == daemon->epoll_fd) + return MHD_NO; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (0 != (MHD_ALLOW_UPGRADE & daemon->options)) + { + daemon->epoll_upgrade_fd = setup_epoll_fd (daemon); + if (MHD_INVALID_SOCKET == daemon->epoll_upgrade_fd) + return MHD_NO; + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + if ( (MHD_INVALID_SOCKET == (ls = daemon->listen_fd)) || + (daemon->was_quiesced) ) + return MHD_YES; /* non-listening daemon */ + event.events = EPOLLIN; + event.data.ptr = daemon; + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_ADD, + ls, + &event)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + return MHD_NO; + } + daemon->listen_socket_in_epoll = true; + if (MHD_ITC_IS_VALID_(daemon->itc)) + { + event.events = EPOLLIN; + event.data.ptr = (void *) epoll_itc_marker; + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_ADD, + MHD_itc_r_fd_ (daemon->itc), + &event)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + return MHD_NO; + } + } + return MHD_YES; +} +#endif + + +/** + * Start a webserver on the given port. + * + * @param flags combination of `enum MHD_FLAG` values + * @param port port to bind to (in host byte order), + * use '0' to bind to random free port, + * ignored if MHD_OPTION_SOCK_ADDR or + * MHD_OPTION_LISTEN_SOCKET is provided + * or MHD_USE_NO_LISTEN_SOCKET is specified + * @param apc callback to call to check which clients + * will be allowed to connect; you can pass NULL + * in which case connections from any IP will be + * accepted + * @param apc_cls extra argument to @a apc + * @param dh handler called for all requests (repeatedly) + * @param dh_cls extra argument to @a dh + * @param ap list of options (type-value pairs, + * terminated with #MHD_OPTION_END). + * @return NULL on error, handle to daemon on success + * @ingroup event + */ +struct MHD_Daemon * +MHD_start_daemon_va (unsigned int flags, + uint16_t port, + MHD_AcceptPolicyCallback apc, + void *apc_cls, + MHD_AccessHandlerCallback dh, + void *dh_cls, + va_list ap) +{ + const MHD_SCKT_OPT_BOOL_ on = 1; + struct MHD_Daemon *daemon; + MHD_socket listen_fd; + struct sockaddr_in servaddr4; +#if HAVE_INET6 + struct sockaddr_in6 servaddr6; +#endif + const struct sockaddr *servaddr = NULL; + socklen_t addrlen; + unsigned int i; + enum MHD_FLAG eflags; /* same type as in MHD_Daemon */ + enum MHD_FLAG *pflags; + + MHD_check_global_init_(); + eflags = (enum MHD_FLAG) flags; + pflags = &eflags; +#ifndef HAVE_INET6 + if (0 != (*pflags & MHD_USE_IPv6)) + return NULL; +#endif +#ifndef HAVE_POLL + if (0 != (*pflags & MHD_USE_POLL)) + return NULL; +#endif +#ifndef EPOLL_SUPPORT + if (0 != (*pflags & MHD_USE_EPOLL)) + return NULL; +#endif /* ! EPOLL_SUPPORT */ +#ifndef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) + return NULL; +#endif /* ! HTTPS_SUPPORT */ +#ifndef TCP_FASTOPEN + if (0 != (*pflags & MHD_USE_TCP_FASTOPEN)) + return NULL; +#endif + if (0 != (*pflags & MHD_ALLOW_UPGRADE)) + { +#ifdef UPGRADE_SUPPORT + *pflags |= MHD_ALLOW_SUSPEND_RESUME; +#else /* ! UPGRADE_SUPPORT */ + return NULL; +#endif /* ! UPGRADE_SUPPORT */ + } + if (NULL == dh) + return NULL; + + /* Check for invalid combinations of flags. */ + if ( ((0 != (*pflags & MHD_USE_POLL)) && (0 != (*pflags & MHD_USE_EPOLL))) || + ((0 != (*pflags & MHD_USE_EPOLL)) && (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION))) || + ((0 != (*pflags & MHD_USE_POLL)) && + (0 == (*pflags & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION)))) || + ((0 != (*pflags & MHD_USE_AUTO)) && (0 != (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL)))) ) + return NULL; + + if (0 != (*pflags & MHD_USE_AUTO)) + { + if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) + { + /* Thread per connection with internal polling thread. */ +#ifdef HAVE_POLL + *pflags |= MHD_USE_POLL; +#else /* ! HAVE_POLL */ + /* use select() - do not modify flags */ +#endif /* ! HAVE_POLL */ + } + else if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) + { + /* Internal polling thread. */ +#if defined(EPOLL_SUPPORT) + *pflags |= MHD_USE_EPOLL; +#elif defined(HAVE_POLL) + *pflags |= MHD_USE_POLL; +#else /* !HAVE_POLL && !EPOLL_SUPPORT */ + /* use select() - do not modify flags */ +#endif /* !HAVE_POLL && !EPOLL_SUPPORT */ + } + else + { + /* Internal threads are not used - "external" polling mode. */ +#if defined(EPOLL_SUPPORT) + *pflags |= MHD_USE_EPOLL; +#else /* ! EPOLL_SUPPORT */ + /* use select() - do not modify flags */ +#endif /* ! EPOLL_SUPPORT */ + } + } + + if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon)))) + return NULL; +#ifdef EPOLL_SUPPORT + daemon->epoll_fd = -1; +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + daemon->epoll_upgrade_fd = -1; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ +#endif + /* try to open listen socket */ +#ifdef HTTPS_SUPPORT + daemon->priority_cache = NULL; + if (0 != (*pflags & MHD_USE_TLS)) + { + gnutls_priority_init (&daemon->priority_cache, + "NORMAL", + NULL); + } +#endif /* HTTPS_SUPPORT */ + daemon->listen_fd = MHD_INVALID_SOCKET; + daemon->listening_address_reuse = 0; + daemon->options = *pflags; + pflags = &daemon->options; + daemon->strict_for_client = (0 != (*pflags & MHD_USE_PEDANTIC_CHECKS)) ? 1 : 0; + daemon->port = port; + daemon->apc = apc; + daemon->apc_cls = apc_cls; + daemon->default_handler = dh; + daemon->default_handler_cls = dh_cls; + daemon->connections = 0; + daemon->connection_limit = MHD_MAX_CONNECTIONS_DEFAULT; + daemon->pool_size = MHD_POOL_SIZE_DEFAULT; + daemon->pool_increment = MHD_BUF_INC_SIZE; + daemon->unescape_callback = &unescape_wrapper; + daemon->connection_timeout = 0; /* no timeout */ + MHD_itc_set_invalid_ (daemon->itc); +#ifdef SOMAXCONN + daemon->listen_backlog_size = SOMAXCONN; +#else /* !SOMAXCONN */ + daemon->listen_backlog_size = 511; /* should be safe value */ +#endif /* !SOMAXCONN */ +#ifdef HAVE_MESSAGES + daemon->custom_error_log = (MHD_LogCallback) &vfprintf; + daemon->custom_error_log_cls = stderr; +#endif + if ( (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) && + (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with " + "MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD " + "was added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n")); +#endif + *pflags |= MHD_USE_INTERNAL_POLLING_THREAD; + } + if (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) + *pflags &= ~MHD_USE_ITC; /* useless if we are using 'external' select */ + else + { +#ifdef HAVE_LISTEN_SHUTDOWN + if (0 != (*pflags & MHD_USE_NO_LISTEN_SOCKET)) +#endif + *pflags |= MHD_USE_ITC; /* yes, must use ITC to signal thread */ + } +#ifdef DAUTH_SUPPORT + daemon->digest_auth_rand_size = 0; + daemon->digest_auth_random = NULL; + daemon->nonce_nc_size = 4; /* tiny */ +#endif +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) + { + daemon->cred_type = GNUTLS_CRD_CERTIFICATE; + } +#endif /* HTTPS_SUPPORT */ + + + if (MHD_YES != parse_options_va (daemon, + &servaddr, + ap)) + { +#ifdef HTTPS_SUPPORT + if ( (0 != (*pflags & MHD_USE_TLS)) && + (NULL != daemon->priority_cache) ) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + free (daemon); + return NULL; + } +#ifndef NDEBUG +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, _("Using debug build of libmicrohttpd.\n") ); +#endif /* HAVE_MESSAGES */ +#endif /* ! NDEBUG */ + if ( (0 != (*pflags & MHD_USE_ITC)) && + (0 == daemon->worker_pool_size) ) + { + if (! MHD_itc_init_ (daemon->itc)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to create inter-thread communication channel: %s\n"), + MHD_itc_last_strerror_ ()); +#endif +#ifdef HTTPS_SUPPORT + if (NULL != daemon->priority_cache) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + free (daemon); + return NULL; + } + if ( (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL))) && + (! MHD_SCKT_FD_FITS_FDSET_(MHD_itc_r_fd_ (daemon->itc), + NULL)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("file descriptor for inter-thread communication channel exceeds maximum value\n")); +#endif + MHD_itc_destroy_chk_ (daemon->itc); +#ifdef HTTPS_SUPPORT + if (NULL != daemon->priority_cache) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + free (daemon); + return NULL; + } + } + +#ifdef DAUTH_SUPPORT + if (daemon->nonce_nc_size > 0) + { + if ( ( (size_t) (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc))) / + sizeof(struct MHD_NonceNc) != daemon->nonce_nc_size) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Specified value for NC_SIZE too large\n")); +#endif +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + free (daemon); + return NULL; + } + daemon->nnc = malloc (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc)); + if (NULL == daemon->nnc) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to allocate memory for nonce-nc map: %s\n"), + MHD_strerror_ (errno)); +#endif +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + free (daemon); + return NULL; + } + } + + if (! MHD_mutex_init_ (&daemon->nnc_lock)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD failed to initialize nonce-nc mutex\n")); +#endif +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + free (daemon->nnc); + free (daemon); + return NULL; + } +#endif + + /* Thread pooling currently works only with internal select thread model */ + if ( (0 == (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) && + (daemon->worker_pool_size > 0) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD thread pooling only works with MHD_USE_INTERNAL_POLLING_THREAD\n")); +#endif + goto free_and_fail; + } + + if ( (MHD_INVALID_SOCKET == daemon->listen_fd) && + (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) ) + { + /* try to open listen socket */ + listen_fd = MHD_socket_create_listen_(*pflags & MHD_USE_IPv6); + if (MHD_INVALID_SOCKET == listen_fd) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to create socket for listening: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + goto free_and_fail; + } + + /* Apply the socket options according to listening_address_reuse. */ + if (0 == daemon->listening_address_reuse) + { +#ifndef MHD_WINSOCK_SOCKETS + /* No user requirement, use "traditional" default SO_REUSEADDR + * on non-W32 platforms, and do not fail if it doesn't work. + * Don't use it on W32, because on W32 it will allow multiple + * bind to the same address:port, like SO_REUSEPORT on others. */ + if (0 > setsockopt (listen_fd, + SOL_SOCKET, + SO_REUSEADDR, + (void*)&on, sizeof (on))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("setsockopt failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + } +#endif /* ! MHD_WINSOCK_SOCKETS */ + } + else if (daemon->listening_address_reuse > 0) + { + /* User requested to allow reusing listening address:port. */ +#ifndef MHD_WINSOCK_SOCKETS + /* Use SO_REUSEADDR on non-W32 platforms, and do not fail if + * it doesn't work. */ + if (0 > setsockopt (listen_fd, + SOL_SOCKET, + SO_REUSEADDR, + (void*)&on, sizeof (on))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("setsockopt failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + } +#endif /* ! MHD_WINSOCK_SOCKETS */ + /* Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. + * Fail if SO_REUSEPORT is not defined or setsockopt fails. + */ + /* SO_REUSEADDR on W32 has the same semantics + as SO_REUSEPORT on BSD/Linux */ +#if defined(MHD_WINSOCK_SOCKETS) || defined(SO_REUSEPORT) + if (0 > setsockopt (listen_fd, + SOL_SOCKET, +#ifndef MHD_WINSOCK_SOCKETS + SO_REUSEPORT, +#else /* MHD_WINSOCK_SOCKETS */ + SO_REUSEADDR, +#endif /* MHD_WINSOCK_SOCKETS */ + (void *) &on, + sizeof (on))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("setsockopt failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + goto free_and_fail; + } +#else /* !MHD_WINSOCK_SOCKETS && !SO_REUSEPORT */ + /* we're supposed to allow address:port re-use, but + on this platform we cannot; fail hard */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Cannot allow listening address reuse: SO_REUSEPORT not defined\n")); +#endif + goto free_and_fail; +#endif /* !MHD_WINSOCK_SOCKETS && !SO_REUSEPORT */ + } + else /* if (daemon->listening_address_reuse < 0) */ + { + /* User requested to disallow reusing listening address:port. + * Do nothing except for Windows where SO_EXCLUSIVEADDRUSE + * is used and Solaris with SO_EXCLBIND. + * Fail if MHD was compiled for W32 without SO_EXCLUSIVEADDRUSE + * or setsockopt fails. + */ +#if (defined(MHD_WINSOCK_SOCKETS) && defined(SO_EXCLUSIVEADDRUSE)) || \ + (defined(__sun) && defined(SO_EXCLBIND)) + if (0 > setsockopt (listen_fd, + SOL_SOCKET, +#ifdef SO_EXCLUSIVEADDRUSE + SO_EXCLUSIVEADDRUSE, +#else /* SO_EXCLBIND */ + SO_EXCLBIND, +#endif /* SO_EXCLBIND */ + (void *) &on, + sizeof (on))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("setsockopt failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + goto free_and_fail; + } +#elif defined(MHD_WINSOCK_SOCKETS) /* SO_EXCLUSIVEADDRUSE not defined on W32? */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n")); +#endif + goto free_and_fail; +#endif /* MHD_WINSOCK_SOCKETS */ + } + + /* check for user supplied sockaddr */ +#if HAVE_INET6 + if (0 != (*pflags & MHD_USE_IPv6)) + addrlen = sizeof (struct sockaddr_in6); + else +#endif + addrlen = sizeof (struct sockaddr_in); + if (NULL == servaddr) + { +#if HAVE_INET6 + if (0 != (*pflags & MHD_USE_IPv6)) + { +#ifdef IN6ADDR_ANY_INIT + static const struct in6_addr static_in6any = IN6ADDR_ANY_INIT; +#endif + memset (&servaddr6, + 0, + sizeof (struct sockaddr_in6)); + servaddr6.sin6_family = AF_INET6; + servaddr6.sin6_port = htons (port); +#ifdef IN6ADDR_ANY_INIT + servaddr6.sin6_addr = static_in6any; +#endif +#if HAVE_SOCKADDR_IN_SIN_LEN + servaddr6.sin6_len = sizeof (struct sockaddr_in6); +#endif + servaddr = (struct sockaddr *) &servaddr6; + } + else +#endif + { + memset (&servaddr4, + 0, + sizeof (struct sockaddr_in)); + servaddr4.sin_family = AF_INET; + servaddr4.sin_port = htons (port); + if (0 != INADDR_ANY) + servaddr4.sin_addr.s_addr = htonl (INADDR_ANY); +#if HAVE_SOCKADDR_IN_SIN_LEN + servaddr4.sin_len = sizeof (struct sockaddr_in); +#endif + servaddr = (struct sockaddr *) &servaddr4; + } + } + daemon->listen_fd = listen_fd; + + if (0 != (*pflags & MHD_USE_IPv6)) + { +#ifdef IPPROTO_IPV6 +#ifdef IPV6_V6ONLY + /* Note: "IPV6_V6ONLY" is declared by Windows Vista ff., see "IPPROTO_IPV6 Socket Options" + (http://msdn.microsoft.com/en-us/library/ms738574%28v=VS.85%29.aspx); + and may also be missing on older POSIX systems; good luck if you have any of those, + your IPv6 socket may then also bind against IPv4 anyway... */ + const MHD_SCKT_OPT_BOOL_ v6_only = + (MHD_USE_DUAL_STACK != (*pflags & MHD_USE_DUAL_STACK)); + if (0 > setsockopt (listen_fd, + IPPROTO_IPV6, IPV6_V6ONLY, + (const void *) &v6_only, + sizeof (v6_only))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("setsockopt failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + } +#endif +#endif + } + if (-1 == bind (listen_fd, servaddr, addrlen)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to bind to port %u: %s\n"), + (unsigned int) port, + MHD_socket_last_strerr_ ()); +#endif + MHD_socket_close_chk_ (listen_fd); + goto free_and_fail; + } +#ifdef TCP_FASTOPEN + if (0 != (*pflags & MHD_USE_TCP_FASTOPEN)) + { + if (0 == daemon->fastopen_queue_size) + daemon->fastopen_queue_size = MHD_TCP_FASTOPEN_QUEUE_SIZE_DEFAULT; + if (0 != setsockopt (listen_fd, + IPPROTO_TCP, + TCP_FASTOPEN, + &daemon->fastopen_queue_size, + sizeof (daemon->fastopen_queue_size))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("setsockopt failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + } + } +#endif + if (listen (listen_fd, + daemon->listen_backlog_size) < 0) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to listen for connections: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + MHD_socket_close_chk_ (listen_fd); + goto free_and_fail; + } + } + else + { + listen_fd = daemon->listen_fd; + } + + if ( (0 == daemon->port) && + (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) ) + { /* Get port number. */ + struct sockaddr_storage servaddr; + + memset (&servaddr, + 0, + sizeof (struct sockaddr_storage)); + addrlen = sizeof (servaddr); + if (0 != getsockname (listen_fd, + (struct sockaddr *) &servaddr, + &addrlen)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to get listen port number: %s\n"), + MHD_socket_last_strerr_ ()); +#endif /* HAVE_MESSAGES */ + } +#ifdef MHD_POSIX_SOCKETS + else if (sizeof (servaddr) < addrlen) + { + /* should be impossible with `struct sockaddr_storage` */ +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to get listen port number (`struct sockaddr_storage` too small!?)\n")); +#endif /* HAVE_MESSAGES */ + } +#endif /* MHD_POSIX_SOCKETS */ + else + { + switch (servaddr.ss_family) + { + case AF_INET: + { + struct sockaddr_in *s4 = (struct sockaddr_in *) &servaddr; + + daemon->port = ntohs (s4->sin_port); + break; + } +#ifdef HAVE_INET6 + case AF_INET6: + { + struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) &servaddr; + + daemon->port = ntohs(s6->sin6_port); + mhd_assert (0 != (*pflags & MHD_USE_IPv6)); + break; + } +#endif /* HAVE_INET6 */ +#ifdef AF_UNIX + case AF_UNIX: + daemon->port = 0; /* special value for UNIX domain sockets */ + break; +#endif + default: +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Unknown address family!\n")); +#endif + daemon->port = 0; /* ugh */ + break; + } + } + } + + if ( (MHD_INVALID_SOCKET != listen_fd) && + (! MHD_socket_nonblocking_ (listen_fd)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set nonblocking mode on listening socket: %s\n"), + MHD_socket_last_strerr_()); +#endif + if (0 != (*pflags & MHD_USE_EPOLL) || + daemon->worker_pool_size > 0) + { + /* Accept must be non-blocking. Multiple children may wake up + * to handle a new connection, but only one will win the race. + * The others must immediately return. */ + MHD_socket_close_chk_ (listen_fd); + goto free_and_fail; + } + } + if ( (MHD_INVALID_SOCKET != listen_fd) && + (! MHD_SCKT_FD_FITS_FDSET_(listen_fd, + NULL)) && + (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"), + listen_fd, + FD_SETSIZE); +#endif + MHD_socket_close_chk_ (listen_fd); + goto free_and_fail; + } + +#ifdef EPOLL_SUPPORT + if ( (0 != (*pflags & MHD_USE_EPOLL)) && + (0 == daemon->worker_pool_size) && + (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) ) + { + if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n")); +#endif + goto free_and_fail; + } + if (MHD_YES != setup_epoll_to_listen (daemon)) + goto free_and_fail; + } +#endif /* EPOLL_SUPPORT */ + + if (! MHD_mutex_init_ (&daemon->per_ip_connection_mutex)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD failed to initialize IP connection limit mutex\n")); +#endif + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); + goto free_and_fail; + } + if (0 == daemon->worker_pool_size) + { /* Initialise connection mutex only if this daemon will handle + * any connections by itself. */ + if (! MHD_mutex_init_ (&daemon->cleanup_connection_mutex)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD failed to initialize IP connection limit mutex\n")); +#endif + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); + goto free_and_fail; + } + } + +#ifdef HTTPS_SUPPORT + /* initialize HTTPS daemon certificate aspects & send / recv functions */ + if ( (0 != (*pflags & MHD_USE_TLS)) && + (0 != MHD_TLS_init (daemon)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to initialize TLS support\n")); +#endif + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); + if (0 == daemon->worker_pool_size) + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); + MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); + goto free_and_fail; + } +#endif /* HTTPS_SUPPORT */ + if ( (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) && + (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) ) + { + if (0 == daemon->worker_pool_size) + { + if (! MHD_create_named_thread_ (&daemon->pid, + (*pflags & MHD_USE_THREAD_PER_CONNECTION) ? + "MHD-listen" : "MHD-single", + daemon->thread_stack_size, + &MHD_polling_thread, + daemon) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to create listen thread: %s\n"), + MHD_strerror_ (errno)); +#endif + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); + MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); + goto free_and_fail; + } + } + else /* 0 < daemon->worker_pool_size */ + { + /* Coarse-grained count of connections per thread (note error + * due to integer division). Also keep track of how many + * connections are leftover after an equal split. */ + unsigned int conns_per_thread = daemon->connection_limit + / daemon->worker_pool_size; + unsigned int leftover_conns = daemon->connection_limit + % daemon->worker_pool_size; + + i = 0; /* we need this in case fcntl or malloc fails */ + + /* Allocate memory for pooled objects */ + daemon->worker_pool = malloc (sizeof (struct MHD_Daemon) + * daemon->worker_pool_size); + if (NULL == daemon->worker_pool) + goto thread_failed; + + /* Start the workers in the pool */ + for (i = 0; i < daemon->worker_pool_size; ++i) + { + /* Create copy of the Daemon object for each worker */ + struct MHD_Daemon *d = &daemon->worker_pool[i]; + + memcpy (d, daemon, sizeof (struct MHD_Daemon)); + /* Adjust pooling params for worker daemons; note that memcpy() + has already copied MHD_USE_INTERNAL_POLLING_THREAD thread model into + the worker threads. */ + d->master = daemon; + d->worker_pool_size = 0; + d->worker_pool = NULL; + + if (0 != (*pflags & MHD_USE_ITC)) + { + if (! MHD_itc_init_ (d->itc)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to create worker inter-thread communication channel: %s\n"), + MHD_itc_last_strerror_() ); +#endif + goto thread_failed; + } + if ( (0 == (*pflags & (MHD_USE_POLL | MHD_USE_EPOLL))) && + (! MHD_SCKT_FD_FITS_FDSET_(MHD_itc_r_fd_ (d->itc), + NULL)) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("File descriptor for worker inter-thread communication channel exceeds maximum value\n")); +#endif + MHD_itc_destroy_chk_ (d->itc); + goto thread_failed; + } + } + else + MHD_itc_set_invalid_ (d->itc); + + /* Divide available connections evenly amongst the threads. + * Thread indexes in [0, leftover_conns) each get one of the + * leftover connections. */ + d->connection_limit = conns_per_thread; + if (i < leftover_conns) + ++d->connection_limit; +#ifdef EPOLL_SUPPORT + if ( (0 != (*pflags & MHD_USE_EPOLL)) && + (MHD_YES != setup_epoll_to_listen (d)) ) + goto thread_failed; +#endif + /* Must init cleanup connection mutex for each worker */ + if (! MHD_mutex_init_ (&d->cleanup_connection_mutex)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("MHD failed to initialize cleanup connection mutex\n")); +#endif + goto thread_failed; + } + + /* Spawn the worker thread */ + if (! MHD_create_named_thread_ (&d->pid, + "MHD-worker", + daemon->thread_stack_size, + &MHD_polling_thread, + d)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to create pool thread: %s\n"), + MHD_strerror_ (errno)); +#endif + /* Free memory for this worker; cleanup below handles + * all previously-created workers. */ + MHD_mutex_destroy_chk_ (&d->cleanup_connection_mutex); + goto thread_failed; + } + } + } + } +#ifdef HTTPS_SUPPORT + /* API promises to never use the password after initialization, + so we additionally NULL it here to not deref a dangling pointer. */ + daemon->https_key_password = NULL; +#endif /* HTTPS_SUPPORT */ + + return daemon; + +thread_failed: + /* If no worker threads created, then shut down normally. Calling + MHD_stop_daemon (as we do below) doesn't work here since it + assumes a 0-sized thread pool means we had been in the default + MHD_USE_INTERNAL_POLLING_THREAD mode. */ + if (0 == i) + { + if (MHD_INVALID_SOCKET != listen_fd) + MHD_socket_close_chk_ (listen_fd); + MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); + if (NULL != daemon->worker_pool) + free (daemon->worker_pool); + goto free_and_fail; + } + + /* Shutdown worker threads we've already created. Pretend + as though we had fully initialized our daemon, but + with a smaller number of threads than had been + requested. */ + daemon->worker_pool_size = i; + MHD_stop_daemon (daemon); + return NULL; + + free_and_fail: + /* clean up basic memory state in 'daemon' and return NULL to + indicate failure */ +#ifdef EPOLL_SUPPORT +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (daemon->upgrade_fd_in_epoll) + { + if (0 != epoll_ctl (daemon->epoll_fd, + EPOLL_CTL_DEL, + daemon->epoll_upgrade_fd, + NULL)) + MHD_PANIC (_("Failed to remove FD from epoll set\n")); + daemon->upgrade_fd_in_epoll = false; + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + if (-1 != daemon->epoll_fd) + close (daemon->epoll_fd); +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if (-1 != daemon->epoll_upgrade_fd) + close (daemon->epoll_upgrade_fd); +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ +#endif /* EPOLL_SUPPORT */ +#ifdef DAUTH_SUPPORT + free (daemon->nnc); + MHD_mutex_destroy_chk_ (&daemon->nnc_lock); +#endif +#ifdef HTTPS_SUPPORT + if (0 != (*pflags & MHD_USE_TLS)) + gnutls_priority_deinit (daemon->priority_cache); +#endif /* HTTPS_SUPPORT */ + if (MHD_ITC_IS_VALID_(daemon->itc)) + MHD_itc_destroy_chk_ (daemon->itc); + free (daemon); + return NULL; +} + + +/** + * Close all connections for the daemon. + * Must only be called when MHD_Daemon::shutdown was set to true. + * @remark To be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param daemon daemon to close down + */ +static void +close_all_connections (struct MHD_Daemon *daemon) +{ + struct MHD_Connection *pos; + const bool used_thr_p_c = (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)); +#ifdef UPGRADE_SUPPORT + const bool upg_allowed = (0 != (daemon->options & MHD_ALLOW_UPGRADE)); +#endif /* UPGRADE_SUPPORT */ +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + struct MHD_UpgradeResponseHandle *urh; + struct MHD_UpgradeResponseHandle *urhn; + const bool used_tls = (0 != (daemon->options & MHD_USE_TLS)); + + mhd_assert (NULL == daemon->worker_pool); + mhd_assert (daemon->shutdown); + /* give upgraded HTTPS connections a chance to finish */ + /* 'daemon->urh_head' is not used in thread-per-connection mode. */ + for (urh = daemon->urh_tail; NULL != urh; urh = urhn) + { + urhn = urh->prev; + /* call generic forwarding function for passing data + with chance to detect that application is done. */ + process_urh (urh); + MHD_connection_finish_forward_ (urh->connection); + urh->clean_ready = true; + /* Resuming will move connection to cleanup list. */ + MHD_resume_connection(urh->connection); + } +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + + /* Give suspended connections a chance to resume to avoid + running into the check for there not being any suspended + connections left in case of a tight race with a recently + resumed connection. */ + if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options)) + { + daemon->resuming = true; /* Force check for pending resume. */ + resume_suspended_connections (daemon); + } + /* first, make sure all threads are aware of shutdown; need to + traverse DLLs in peace... */ + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); +#ifdef UPGRADE_SUPPORT + if (upg_allowed) + { + struct MHD_Connection * susp; + + susp = daemon->suspended_connections_tail; + while (NULL != susp) + { + if (NULL == susp->urh) /* "Upgraded" connection? */ + MHD_PANIC (_("MHD_stop_daemon() called while we have suspended connections.\n")); +#ifdef HTTPS_SUPPORT + else if (used_tls && + used_thr_p_c && + (! susp->urh->clean_ready) ) + shutdown (susp->urh->app.socket, + SHUT_RDWR); /* Wake thread by shutdown of app socket. */ +#endif /* HTTPS_SUPPORT */ + else + { +#ifdef HAVE_MESSAGES + if (! susp->urh->was_closed) + MHD_DLOG (daemon, + _("Initiated daemon shutdown while \"upgraded\" connection was not closed.\n")); +#endif + susp->urh->was_closed = true; + /* If thread-per-connection is used, connection's thread + * may still processing "upgrade" (exiting). */ + if (! used_thr_p_c) + MHD_connection_finish_forward_ (susp); + /* Do not use MHD_resume_connection() as mutex is + * already locked. */ + susp->resuming = true; + daemon->resuming = true; + } + susp = susp->prev; + } + } + else /* This 'else' is combined with next 'if' */ +#endif /* UPGRADE_SUPPORT */ + if (NULL != daemon->suspended_connections_head) + MHD_PANIC (_("MHD_stop_daemon() called while we have suspended connections.\n")); + for (pos = daemon->connections_tail; NULL != pos; pos = pos->prev) + { + shutdown (pos->socket_fd, + SHUT_RDWR); +#if MHD_WINSOCK_SOCKETS + if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (MHD_ITC_IS_VALID_(daemon->itc)) && + (! MHD_itc_activate_ (daemon->itc, "e")) ) + MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel")); +#endif + } + + /* now, collect per-connection threads */ + if (used_thr_p_c) + { + pos = daemon->connections_tail; + while (NULL != pos) + { + if (! pos->thread_joined) + { + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + if (! MHD_join_thread_ (pos->pid.handle)) + MHD_PANIC (_("Failed to join a thread\n")); + MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); + pos->thread_joined = true; + /* The thread may have concurrently modified the DLL, + need to restart from the beginning */ + pos = daemon->connections_tail; + continue; + } + pos = pos->prev; + } + } + MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); + +#ifdef UPGRADE_SUPPORT + /* Finished threads with "upgraded" connections need to be moved + * to cleanup list by resume_suspended_connections(). */ + /* "Upgraded" connections that were not closed explicitly by + * application should be moved to cleanup list too. */ + if (upg_allowed) + { + daemon->resuming = true; /* Force check for pending resume. */ + resume_suspended_connections (daemon); + } +#endif /* UPGRADE_SUPPORT */ + + /* now that we're alone, move everyone to cleanup */ + while (NULL != (pos = daemon->connections_tail)) + { + if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && + (! pos->thread_joined) ) + MHD_PANIC (_("Failed to join a thread\n")); + close_connection (pos); + } + MHD_cleanup_connections (daemon); +} + + +/** + * Shutdown an HTTP daemon. + * + * @param daemon daemon to stop + * @ingroup event + */ +void +MHD_stop_daemon (struct MHD_Daemon *daemon) +{ + MHD_socket fd; + unsigned int i; + + if (NULL == daemon) + return; + + daemon->shutdown = true; + if (daemon->was_quiesced) + fd = MHD_INVALID_SOCKET; /* Do not use FD if daemon was quiesced */ + else + fd = daemon->listen_fd; + + if (NULL != daemon->worker_pool) + { /* Master daemon with worker pool. */ + mhd_assert (1 < daemon->worker_pool_size); + mhd_assert (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)); + + /* Let workers shutdown in parallel. */ + for (i = 0; i < daemon->worker_pool_size; ++i) + { + daemon->worker_pool[i].shutdown = true; + if (MHD_ITC_IS_VALID_(daemon->worker_pool[i].itc)) + { + if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, "e")) + MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel.")); + } + else + mhd_assert (MHD_INVALID_SOCKET != fd); + } +#ifdef HAVE_LISTEN_SHUTDOWN + if (MHD_INVALID_SOCKET != fd) + { + (void) shutdown (fd, + SHUT_RDWR); + } +#endif /* HAVE_LISTEN_SHUTDOWN */ + for (i = 0; i < daemon->worker_pool_size; ++i) + { + MHD_stop_daemon (&daemon->worker_pool[i]); + } + free (daemon->worker_pool); + mhd_assert (MHD_ITC_IS_INVALID_(daemon->itc)); +#ifdef EPOLL_SUPPORT + mhd_assert (-1 == daemon->epoll_fd); +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + mhd_assert (-1 == daemon->epoll_upgrade_fd); +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ +#endif /* EPOLL_SUPPORT */ + } + else + { /* Worker daemon or single daemon. */ + if (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) + { /* Worker daemon or single daemon with internal thread(s). */ + mhd_assert (0 == daemon->worker_pool_size); + if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options)) + resume_suspended_connections (daemon); + + if (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) + { + /* Separate thread(s) is used for polling sockets. */ + if (MHD_ITC_IS_VALID_(daemon->itc)) + { + if (! MHD_itc_activate_ (daemon->itc, "e")) + MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel")); + } + else + { +#ifdef HAVE_LISTEN_SHUTDOWN + if (MHD_INVALID_SOCKET != fd) + { + if (NULL == daemon->master) + (void) shutdown (fd, + SHUT_RDWR); + } + else +#endif /* HAVE_LISTEN_SHUTDOWN */ + mhd_assert (false); /* Should never happen */ + } + + if (! MHD_join_thread_ (daemon->pid.handle)) + { + MHD_PANIC (_("Failed to join a thread\n")); + } + /* close_all_connections() was called in daemon thread. */ + } + } + else + { + /* No internal threads are used for polling sockets. */ + close_all_connections (daemon); + } + if (MHD_ITC_IS_VALID_ (daemon->itc)) + MHD_itc_destroy_chk_ (daemon->itc); + +#ifdef EPOLL_SUPPORT + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (-1 != daemon->epoll_fd) ) + MHD_socket_close_chk_ (daemon->epoll_fd); +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + if ( (0 != (daemon->options & MHD_USE_EPOLL)) && + (-1 != daemon->epoll_upgrade_fd) ) + MHD_socket_close_chk_ (daemon->epoll_upgrade_fd); +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ +#endif /* EPOLL_SUPPORT */ + + MHD_mutex_destroy_chk_ (&daemon->cleanup_connection_mutex); + } + + if (NULL == daemon->master) + { /* Cleanup that should be done only one time in master/single daemon. + * Do not perform this cleanup in worker daemons. */ + + if (MHD_INVALID_SOCKET != fd) + MHD_socket_close_chk_ (fd); + + /* TLS clean up */ +#ifdef HTTPS_SUPPORT + if (daemon->have_dhparams) + { + gnutls_dh_params_deinit (daemon->https_mem_dhparams); + daemon->have_dhparams = false; + } + if (0 != (daemon->options & MHD_USE_TLS)) + { + gnutls_priority_deinit (daemon->priority_cache); + if (daemon->x509_cred) + gnutls_certificate_free_credentials (daemon->x509_cred); + } +#endif /* HTTPS_SUPPORT */ + +#ifdef DAUTH_SUPPORT + free (daemon->nnc); + MHD_mutex_destroy_chk_ (&daemon->nnc_lock); +#endif + MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex); + + free (daemon); + } +} + + +/** + * Obtain information about the given daemon + * (not fully implemented!). + * + * @param daemon what daemon to get information about + * @param info_type what information is desired? + * @param ... depends on @a info_type + * @return NULL if this information is not available + * (or if the @a info_type is unknown) + * @ingroup specialized + */ +const union MHD_DaemonInfo * +MHD_get_daemon_info (struct MHD_Daemon *daemon, + enum MHD_DaemonInfoType info_type, + ...) +{ + if (NULL == daemon) + return NULL; + switch (info_type) + { + case MHD_DAEMON_INFO_KEY_SIZE: + return NULL; /* no longer supported */ + case MHD_DAEMON_INFO_MAC_KEY_SIZE: + return NULL; /* no longer supported */ + case MHD_DAEMON_INFO_LISTEN_FD: + return (const union MHD_DaemonInfo *) &daemon->listen_fd; +#ifdef EPOLL_SUPPORT + case MHD_DAEMON_INFO_EPOLL_FD: + return (const union MHD_DaemonInfo *) &daemon->epoll_fd; +#endif + case MHD_DAEMON_INFO_CURRENT_CONNECTIONS: + if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) + { + /* Assume that MHD_run() in not called in other thread + * at the same time. */ + MHD_cleanup_connections (daemon); + } + else if (daemon->worker_pool) + { + unsigned int i; + /* Collect the connection information stored in the workers. */ + daemon->connections = 0; + for (i = 0; i < daemon->worker_pool_size; i++) + { + /* FIXME: next line is thread-safe only if read is atomic. */ + daemon->connections += daemon->worker_pool[i].connections; + } + } + return (const union MHD_DaemonInfo *) &daemon->connections; + case MHD_DAEMON_INFO_FLAGS: + return (const union MHD_DaemonInfo *) &daemon->options; + case MHD_DAEMON_INFO_BIND_PORT: + return (const union MHD_DaemonInfo *) &daemon->port; + default: + return NULL; + } +} + + +/** + * Sets the global error handler to a different implementation. @a cb + * will only be called in the case of typically fatal, serious + * internal consistency issues. These issues should only arise in the + * case of serious memory corruption or similar problems with the + * architecture. While @a cb is allowed to return and MHD will then + * try to continue, this is never safe. + * + * The default implementation that is used if no panic function is set + * simply prints an error message and calls `abort()`. Alternative + * implementations might call `exit()` or other similar functions. + * + * @param cb new error handler + * @param cls passed to @a cb + * @ingroup logging + */ +void +MHD_set_panic_func (MHD_PanicCallback cb, + void *cls) +{ + mhd_panic = cb; + mhd_panic_cls = cls; +} + + +/** + * Obtain the version of this library + * + * @return static version string, e.g. "0.9.9" + * @ingroup specialized + */ +const char * +MHD_get_version (void) +{ +#ifdef PACKAGE_VERSION + return PACKAGE_VERSION; +#else /* !PACKAGE_VERSION */ + static char ver[12] = "\0\0\0\0\0\0\0\0\0\0\0"; + if (0 == ver[0]) + { + int res = MHD_snprintf_(ver, + sizeof(ver), + "%x.%x.%x", + (((int)MHD_VERSION >> 24) & 0xFF), + (((int)MHD_VERSION >> 16) & 0xFF), + (((int)MHD_VERSION >> 8) & 0xFF)); + if (0 >= res || sizeof(ver) <= res) + return "0.0.0"; /* Can't return real version*/ + } + return ver; +#endif /* !PACKAGE_VERSION */ +} + + +/** + * Get information about supported MHD features. + * Indicate that MHD was compiled with or without support for + * particular feature. Some features require additional support + * by kernel. Kernel support is not checked by this function. + * + * @param feature type of requested information + * @return #MHD_YES if feature is supported by MHD, #MHD_NO if + * feature is not supported or feature is unknown. + * @ingroup specialized + */ +_MHD_EXTERN int +MHD_is_feature_supported(enum MHD_FEATURE feature) +{ + switch(feature) + { + case MHD_FEATURE_MESSAGES: +#ifdef HAVE_MESSAGES + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_TLS: +#ifdef HTTPS_SUPPORT + return MHD_YES; +#else /* ! HTTPS_SUPPORT */ + return MHD_NO; +#endif /* ! HTTPS_SUPPORT */ + case MHD_FEATURE_HTTPS_CERT_CALLBACK: +#if defined(HTTPS_SUPPORT) && GNUTLS_VERSION_MAJOR >= 3 + return MHD_YES; +#else /* !HTTPS_SUPPORT || GNUTLS_VERSION_MAJOR < 3 */ + return MHD_NO; +#endif /* !HTTPS_SUPPORT || GNUTLS_VERSION_MAJOR < 3 */ + case MHD_FEATURE_IPv6: +#ifdef HAVE_INET6 + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_IPv6_ONLY: +#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY) + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_POLL: +#ifdef HAVE_POLL + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_EPOLL: +#ifdef EPOLL_SUPPORT + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET: +#ifdef HAVE_LISTEN_SHUTDOWN + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_SOCKETPAIR: +#ifdef _MHD_ITC_SOCKETPAIR + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_TCP_FASTOPEN: +#ifdef TCP_FASTOPEN + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_BASIC_AUTH: +#ifdef BAUTH_SUPPORT + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_DIGEST_AUTH: +#ifdef DAUTH_SUPPORT + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_POSTPROCESSOR: +#ifdef HAVE_POSTPROCESSOR + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_HTTPS_KEY_PASSWORD: +#if defined(HTTPS_SUPPORT) && GNUTLS_VERSION_NUMBER >= 0x030111 + return MHD_YES; +#else /* !HTTPS_SUPPORT || GNUTLS_VERSION_NUMBER < 0x030111 */ + return MHD_NO; +#endif /* !HTTPS_SUPPORT || GNUTLS_VERSION_NUMBER < 0x030111 */ + case MHD_FEATURE_LARGE_FILE: +#if defined(HAVE_PREAD64) || defined(_WIN32) + return MHD_YES; +#elif defined(HAVE_PREAD) + return (sizeof(uint64_t) > sizeof(off_t)) ? MHD_NO : MHD_YES; +#elif defined(HAVE_LSEEK64) + return MHD_YES; +#else + return (sizeof(uint64_t) > sizeof(off_t)) ? MHD_NO : MHD_YES; +#endif + case MHD_FEATURE_THREAD_NAMES: +#if defined(MHD_USE_THREAD_NAME_) + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_UPGRADE: +#if defined(UPGRADE_SUPPORT) + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_RESPONSES_SHARED_FD: +#if defined(HAVE_PREAD64) || defined(HAVE_PREAD) || defined(_WIN32) + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_AUTODETECT_BIND_PORT: +#ifdef MHD_USE_GETSOCKNAME + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_AUTOSUPPRESS_SIGPIPE: +#if defined(MHD_WINSOCK_SOCKETS) || defined(MHD_socket_nosignal_) || defined (MSG_NOSIGNAL) + return MHD_YES; +#else + return MHD_NO; +#endif + case MHD_FEATURE_SENDFILE: +#ifdef _MHD_HAVE_SENDFILE + return MHD_YES; +#else + return MHD_NO; +#endif + + } + return MHD_NO; +} + + +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#if defined(HTTPS_SUPPORT) && GCRYPT_VERSION_NUMBER < 0x010600 +#if defined(MHD_USE_POSIX_THREADS) +GCRY_THREAD_OPTION_PTHREAD_IMPL; +#elif defined(MHD_W32_MUTEX_) + +static int +gcry_w32_mutex_init (void **ppmtx) +{ + *ppmtx = malloc (sizeof (MHD_mutex_)); + + if (NULL == *ppmtx) + return ENOMEM; + if (!MHD_mutex_init_ ((MHD_mutex_*)*ppmtx)) + { + free (*ppmtx); + *ppmtx = NULL; + return EPERM; + } + + return 0; +} + + +static int +gcry_w32_mutex_destroy (void **ppmtx) +{ + int res = (MHD_mutex_destroy_ ((MHD_mutex_*)*ppmtx)) ? 0 : EINVAL; + free (*ppmtx); + return res; +} + + +static int +gcry_w32_mutex_lock (void **ppmtx) +{ + return MHD_mutex_lock_ ((MHD_mutex_*)*ppmtx) ? 0 : EINVAL; +} + + +static int +gcry_w32_mutex_unlock (void **ppmtx) +{ + return MHD_mutex_unlock_ ((MHD_mutex_*)*ppmtx) ? 0 : EINVAL; +} + + +static struct gcry_thread_cbs gcry_threads_w32 = { + (GCRY_THREAD_OPTION_USER | (GCRY_THREAD_OPTION_VERSION << 8)), + NULL, gcry_w32_mutex_init, gcry_w32_mutex_destroy, + gcry_w32_mutex_lock, gcry_w32_mutex_unlock, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; + +#endif /* defined(MHD_W32_MUTEX_) */ +#endif /* HTTPS_SUPPORT && GCRYPT_VERSION_NUMBER < 0x010600 */ +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + +/** + * Initialize do setup work. + */ +void +MHD_init(void) +{ +#if defined(_WIN32) && ! defined(__CYGWIN__) + WSADATA wsd; +#endif /* _WIN32 && ! __CYGWIN__ */ + + if (NULL == mhd_panic) + mhd_panic = &mhd_panic_std; + +#if defined(_WIN32) && ! defined(__CYGWIN__) + if (0 != WSAStartup(MAKEWORD(2, 2), &wsd)) + MHD_PANIC (_("Failed to initialize winsock\n")); + mhd_winsock_inited_ = 1; + if (2 != LOBYTE(wsd.wVersion) && 2 != HIBYTE(wsd.wVersion)) + MHD_PANIC (_("Winsock version 2.2 is not available\n")); +#endif +#ifdef HTTPS_SUPPORT +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#if GCRYPT_VERSION_NUMBER < 0x010600 +#if defined(MHD_USE_POSIX_THREADS) + if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS, + &gcry_threads_pthread)) + MHD_PANIC (_("Failed to initialise multithreading in libgcrypt\n")); +#elif defined(MHD_W32_MUTEX_) + if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS, + &gcry_threads_w32)) + MHD_PANIC (_("Failed to initialise multithreading in libgcrypt\n")); +#endif /* defined(MHD_W32_MUTEX_) */ + gcry_check_version (NULL); +#else + if (NULL == gcry_check_version ("1.6.0")) + MHD_PANIC (_("libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n")); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + gnutls_global_init (); +#endif /* HTTPS_SUPPORT */ + MHD_monotonic_sec_counter_init(); +#ifdef HAVE_FREEBSD_SENDFILE + MHD_conn_init_static_ (); +#endif /* HAVE_FREEBSD_SENDFILE */ +} + + +void +MHD_fini(void) +{ +#ifdef HTTPS_SUPPORT + gnutls_global_deinit (); +#endif /* HTTPS_SUPPORT */ +#if defined(_WIN32) && ! defined(__CYGWIN__) + if (mhd_winsock_inited_) + WSACleanup(); +#endif + MHD_monotonic_sec_counter_finish(); +} + +#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED +_SET_INIT_AND_DEINIT_FUNCS(MHD_init, MHD_fini); +#endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */ + +/* end of daemon.c */ diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c new file mode 100644 index 0000000..f95f4d6 --- /dev/null +++ b/src/microhttpd/digestauth.c @@ -0,0 +1,1037 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2010, 2011, 2012, 2015 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file digestauth.c + * @brief Implements HTTP digest authentication + * @author Amr Ali + * @author Matthieu Speder + */ +#include "platform.h" +#include "mhd_limits.h" +#include "internal.h" +#include "md5.h" +#include "mhd_mono_clock.h" +#include "mhd_str.h" +#include "mhd_compat.h" + +#if defined(MHD_W32_MUTEX_) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif /* MHD_W32_MUTEX_ */ + +#define HASH_MD5_HEX_LEN (2 * MD5_DIGEST_SIZE) +/* 32 bit value is 4 bytes */ +#define TIMESTAMP_BIN_SIZE 4 +#define TIMESTAMP_HEX_LEN (2 * TIMESTAMP_BIN_SIZE) + +/* Standard server nonce length, not including terminating null */ +#define NONCE_STD_LEN (HASH_MD5_HEX_LEN + TIMESTAMP_HEX_LEN) + +/** + * Beginning string for any valid Digest authentication header. + */ +#define _BASE "Digest " + +/** + * Maximum length of a username for digest authentication. + */ +#define MAX_USERNAME_LENGTH 128 + +/** + * Maximum length of a realm for digest authentication. + */ +#define MAX_REALM_LENGTH 256 + +/** + * Maximum length of the response in digest authentication. + */ +#define MAX_AUTH_RESPONSE_LENGTH 128 + + +/** + * convert bin to hex + * + * @param bin binary data + * @param len number of bytes in bin + * @param hex pointer to len*2+1 bytes + */ +static void +cvthex (const unsigned char *bin, + size_t len, + char *hex) +{ + size_t i; + unsigned int j; + + for (i = 0; i < len; ++i) + { + j = (bin[i] >> 4) & 0x0f; + hex[i * 2] = (char)((j <= 9) ? (j + '0') : (j - 10 + 'a')); + j = bin[i] & 0x0f; + hex[i * 2 + 1] = (char)((j <= 9) ? (j + '0') : (j - 10 + 'a')); + } + hex[len * 2] = '\0'; +} + + +/** + * calculate H(A1) as per RFC2617 spec and store the + * result in 'sessionkey'. + * + * @param alg The hash algorithm used, can be "md5" or "md5-sess" + * @param username A `char *' pointer to the username value + * @param realm A `char *' pointer to the realm value + * @param password A `char *' pointer to the password value + * @param nonce A `char *' pointer to the nonce value + * @param cnonce A `char *' pointer to the cnonce value + * @param sessionkey pointer to buffer of HASH_MD5_HEX_LEN+1 bytes + */ +static void +digest_calc_ha1 (const char *alg, + const char *username, + const char *realm, + const char *password, + const char *nonce, + const char *cnonce, + char sessionkey[HASH_MD5_HEX_LEN + 1]) +{ + struct MD5Context md5; + unsigned char ha1[MD5_DIGEST_SIZE]; + + MD5Init (&md5); + MD5Update (&md5, + (const unsigned char *) username, + strlen (username)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) realm, + strlen (realm)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) password, + strlen (password)); + MD5Final (ha1, + &md5); + if (MHD_str_equal_caseless_(alg, + "md5-sess")) + { + MD5Init (&md5); + MD5Update (&md5, + (const unsigned char *) ha1, + sizeof (ha1)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) nonce, + strlen (nonce)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) cnonce, + strlen (cnonce)); + MD5Final (ha1, + &md5); + } + cvthex (ha1, + sizeof (ha1), + sessionkey); +} + + +/** + * Calculate request-digest/response-digest as per RFC2617 spec + * + * @param ha1 H(A1) + * @param nonce nonce from server + * @param noncecount 8 hex digits + * @param cnonce client nonce + * @param qop qop-value: "", "auth" or "auth-int" + * @param method method from request + * @param uri requested URL + * @param hentity H(entity body) if qop="auth-int" + * @param response request-digest or response-digest + */ +static void +digest_calc_response (const char ha1[HASH_MD5_HEX_LEN + 1], + const char *nonce, + const char *noncecount, + const char *cnonce, + const char *qop, + const char *method, + const char *uri, + const char *hentity, + char response[HASH_MD5_HEX_LEN + 1]) +{ + struct MD5Context md5; + unsigned char ha2[MD5_DIGEST_SIZE]; + unsigned char resphash[MD5_DIGEST_SIZE]; + char ha2hex[HASH_MD5_HEX_LEN + 1]; + (void)hentity; /* Unused. Silent compiler warning. */ + + MD5Init (&md5); + MD5Update (&md5, + (const unsigned char *) method, + strlen (method)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) uri, + strlen (uri)); +#if 0 + if (0 == strcasecmp(qop, + "auth-int")) + { + /* This is dead code since the rest of this module does + not support auth-int. */ + MD5Update (&md5, + ":", + 1); + if (NULL != hentity) + MD5Update (&md5, + hentity, + strlen (hentity)); + } +#endif + MD5Final (ha2, + &md5); + cvthex (ha2, + MD5_DIGEST_SIZE, + ha2hex); + MD5Init (&md5); + /* calculate response */ + MD5Update (&md5, + (const unsigned char *) ha1, + HASH_MD5_HEX_LEN); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) nonce, + strlen (nonce)); + MD5Update (&md5, + (const unsigned char*) ":", + 1); + if ('\0' != *qop) + { + MD5Update (&md5, + (const unsigned char *) noncecount, + strlen (noncecount)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) cnonce, + strlen (cnonce)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) qop, + strlen (qop)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + } + MD5Update (&md5, + (const unsigned char *) ha2hex, + HASH_MD5_HEX_LEN); + MD5Final (resphash, + &md5); + cvthex (resphash, + sizeof(resphash), + response); +} + + +/** + * Lookup subvalue off of the HTTP Authorization header. + * + * A description of the input format for 'data' is at + * http://en.wikipedia.org/wiki/Digest_access_authentication + * + * + * @param dest where to store the result (possibly truncated if + * the buffer is not big enough). + * @param size size of dest + * @param data pointer to the Authorization header + * @param key key to look up in data + * @return size of the located value, 0 if otherwise + */ +static size_t +lookup_sub_value (char *dest, + size_t size, + const char *data, + const char *key) +{ + size_t keylen; + size_t len; + const char *ptr; + const char *eq; + const char *q1; + const char *q2; + const char *qn; + + if (0 == size) + return 0; + keylen = strlen (key); + ptr = data; + while ('\0' != *ptr) + { + if (NULL == (eq = strchr (ptr, + '='))) + return 0; + q1 = eq + 1; + while (' ' == *q1) + q1++; + if ('\"' != *q1) + { + q2 = strchr (q1, + ','); + qn = q2; + } + else + { + q1++; + q2 = strchr (q1, + '\"'); + if (NULL == q2) + return 0; /* end quote not found */ + qn = q2 + 1; + } + if ( (MHD_str_equal_caseless_n_(ptr, + key, + keylen)) && + (eq == &ptr[keylen]) ) + { + if (NULL == q2) + { + len = strlen (q1) + 1; + if (size > len) + size = len; + size--; + strncpy (dest, + q1, + size); + dest[size] = '\0'; + return size; + } + else + { + if (size > (size_t) ((q2 - q1) + 1)) + size = (q2 - q1) + 1; + size--; + memcpy (dest, + q1, + size); + dest[size] = '\0'; + return size; + } + } + if (NULL == qn) + return 0; + ptr = strchr (qn, + ','); + if (NULL == ptr) + return 0; + ptr++; + while (' ' == *ptr) + ptr++; + } + return 0; +} + + +/** + * Check nonce-nc map array with either new nonce counter + * or a whole new nonce. + * + * @param connection The MHD connection structure + * @param nonce A pointer that referenced a zero-terminated array of nonce + * @param nc The nonce counter, zero to add the nonce to the array + * @return #MHD_YES if successful, #MHD_NO if invalid (or we have no NC array) + */ +static int +check_nonce_nc (struct MHD_Connection *connection, + const char *nonce, + uint64_t nc) +{ + struct MHD_Daemon *daemon = connection->daemon; + struct MHD_NonceNc *nn; + uint32_t off; + uint32_t mod; + const char *np; + + if (MAX_NONCE_LENGTH <= strlen (nonce)) + return MHD_NO; /* This should be impossible, but static analysis + tools have a hard time with it *and* this also + protects against unsafe modifications that may + happen in the future... */ + mod = daemon->nonce_nc_size; + if (0 == mod) + return MHD_NO; /* no array! */ + /* super-fast xor-based "hash" function for HT lookup in nonce array */ + off = 0; + np = nonce; + while ('\0' != *np) + { + off = (off << 8) | (*np ^ (off >> 24)); + np++; + } + off = off % mod; + /* + * Look for the nonce, if it does exist and its corresponding + * nonce counter is less than the current nonce counter by 1, + * then only increase the nonce counter by one. + */ + nn = &daemon->nnc[off]; + MHD_mutex_lock_chk_ (&daemon->nnc_lock); + if (0 == nc) + { + /* Fresh nonce, reinitialize array */ + strcpy (nn->nonce, + nonce); + nn->nc = 0; + nn->nmask = 0; + MHD_mutex_unlock_chk_ (&daemon->nnc_lock); + return MHD_YES; + } + /* Note that we use 64 here, as we do not store the + bit for 'nn->nc' itself in 'nn->nmask' */ + if ( (nc < nn->nc) && + (nc + 64 > nc /* checking for overflow */) && + (nc + 64 >= nn->nc) && + (0 == ((1LLU << (nn->nc - nc - 1)) & nn->nmask)) ) + { + /* Out-of-order nonce, but within 64-bit bitmask, set bit */ + nn->nmask |= (1LLU << (nn->nc - nc - 1)); + MHD_mutex_unlock_chk_ (&daemon->nnc_lock); + return MHD_YES; + } + + if ( (nc <= nn->nc) || + (0 != strcmp (nn->nonce, + nonce)) ) + { + /* Nonce does not match, fail */ + MHD_mutex_unlock_chk_ (&daemon->nnc_lock); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Stale nonce received. If this happens a lot, you should probably increase the size of the nonce array.\n")); +#endif + return MHD_NO; + } + /* Nonce is larger, shift bitmask and bump limit */ + if (64 > nc - nn->nc) + nn->nmask <<= (nc - nn->nc); /* small jump, less than mask width */ + else + nn->nmask = 0; /* big jump, unset all bits in the mask */ + nn->nc = nc; + MHD_mutex_unlock_chk_ (&daemon->nnc_lock); + return MHD_YES; +} + + +/** + * Get the username from the authorization header sent by the client + * + * @param connection The MHD connection structure + * @return NULL if no username could be found, a pointer + * to the username if found + * @warning Returned value must be freed by #MHD_free(). + * @ingroup authentication + */ +char * +MHD_digest_auth_get_username(struct MHD_Connection *connection) +{ + size_t len; + char user[MAX_USERNAME_LENGTH]; + const char *header; + + if (NULL == (header = + MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_AUTHORIZATION))) + return NULL; + if (0 != strncmp (header, + _BASE, + MHD_STATICSTR_LEN_ (_BASE))) + return NULL; + header += MHD_STATICSTR_LEN_ (_BASE); + if (0 == (len = lookup_sub_value (user, + sizeof (user), + header, + "username"))) + return NULL; + return strdup (user); +} + + +/** + * Calculate the server nonce so that it mitigates replay attacks + * The current format of the nonce is ... + * H(timestamp ":" method ":" random ":" uri ":" realm) + Hex(timestamp) + * + * @param nonce_time The amount of time in seconds for a nonce to be invalid + * @param method HTTP method + * @param rnd A pointer to a character array for the random seed + * @param rnd_size The size of the random seed array @a rnd + * @param uri HTTP URI (in MHD, without the arguments ("?k=v") + * @param realm A string of characters that describes the realm of auth. + * @param nonce A pointer to a character array for the nonce to put in + */ +static void +calculate_nonce (uint32_t nonce_time, + const char *method, + const char *rnd, + size_t rnd_size, + const char *uri, + const char *realm, + char nonce[NONCE_STD_LEN + 1]) +{ + struct MD5Context md5; + unsigned char timestamp[TIMESTAMP_BIN_SIZE]; + unsigned char tmpnonce[MD5_DIGEST_SIZE]; + char timestamphex[TIMESTAMP_HEX_LEN + 1]; + + MD5Init (&md5); + timestamp[0] = (unsigned char)((nonce_time & 0xff000000) >> 0x18); + timestamp[1] = (unsigned char)((nonce_time & 0x00ff0000) >> 0x10); + timestamp[2] = (unsigned char)((nonce_time & 0x0000ff00) >> 0x08); + timestamp[3] = (unsigned char)((nonce_time & 0x000000ff)); + MD5Update (&md5, + timestamp, + sizeof (timestamp)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) method, + strlen (method)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + if (rnd_size > 0) + MD5Update (&md5, + (const unsigned char *) rnd, + rnd_size); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) uri, + strlen (uri)); + MD5Update (&md5, + (const unsigned char *) ":", + 1); + MD5Update (&md5, + (const unsigned char *) realm, + strlen (realm)); + MD5Final (tmpnonce, + &md5); + cvthex (tmpnonce, + sizeof (tmpnonce), + nonce); + cvthex (timestamp, + sizeof (timestamp), + timestamphex); + strncat (nonce, + timestamphex, + 8); +} + + +/** + * Test if the given key-value pair is in the headers for the + * given connection. + * + * @param connection the connection + * @param key the key + * @param value the value, can be NULL + * @param kind type of the header + * @return #MHD_YES if the key-value pair is in the headers, + * #MHD_NO if not + */ +static int +test_header (struct MHD_Connection *connection, + const char *key, + const char *value, + enum MHD_ValueKind kind) +{ + struct MHD_HTTP_Header *pos; + + for (pos = connection->headers_received; NULL != pos; pos = pos->next) + { + if (kind != pos->kind) + continue; + if (0 != strcmp (key, + pos->header)) + continue; + if ( (NULL == value) && + (NULL == pos->value) ) + return MHD_YES; + if ( (NULL == value) || + (NULL == pos->value) || + (0 != strcmp (value, + pos->value)) ) + continue; + return MHD_YES; + } + return MHD_NO; +} + + +/** + * Check that the arguments given by the client as part + * of the authentication header match the arguments we + * got as part of the HTTP request URI. + * + * @param connection connections with headers to compare against + * @param args argument URI string (after "?" in URI) + * @return #MHD_YES if the arguments match, + * #MHD_NO if not + */ +static int +check_argument_match (struct MHD_Connection *connection, + const char *args) +{ + struct MHD_HTTP_Header *pos; + char *argb; + unsigned int num_headers; + int ret; + + argb = strdup (args); + if (NULL == argb) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to allocate memory for copy of URI arguments\n")); +#endif /* HAVE_MESSAGES */ + return MHD_NO; + } + ret = MHD_parse_arguments_ (connection, + MHD_GET_ARGUMENT_KIND, + argb, + &test_header, + &num_headers); + free (argb); + if (MHD_YES != ret) + return MHD_NO; + /* also check that the number of headers matches */ + for (pos = connection->headers_received; NULL != pos; pos = pos->next) + { + if (MHD_GET_ARGUMENT_KIND != pos->kind) + continue; + num_headers--; + } + if (0 != num_headers) + { + /* argument count mismatch */ + return MHD_NO; + } + return MHD_YES; +} + + +/** + * Authenticates the authorization header sent by the client + * + * @param connection The MHD connection structure + * @param realm The realm presented to the client + * @param username The username needs to be authenticated + * @param password The password used in the authentication + * @param nonce_timeout The amount of time for a nonce to be + * invalid in seconds + * @return #MHD_YES if authenticated, #MHD_NO if not, + * #MHD_INVALID_NONCE if nonce is invalid + * @ingroup authentication + */ +int +MHD_digest_auth_check (struct MHD_Connection *connection, + const char *realm, + const char *username, + const char *password, + unsigned int nonce_timeout) +{ + struct MHD_Daemon *daemon = connection->daemon; + size_t len; + const char *header; + char nonce[MAX_NONCE_LENGTH]; + char cnonce[MAX_NONCE_LENGTH]; + char qop[15]; /* auth,auth-int */ + char nc[20]; + char response[MAX_AUTH_RESPONSE_LENGTH]; + const char *hentity = NULL; /* "auth-int" is not supported */ + char ha1[HASH_MD5_HEX_LEN + 1]; + char respexp[HASH_MD5_HEX_LEN + 1]; + char noncehashexp[NONCE_STD_LEN + 1]; + uint32_t nonce_time; + uint32_t t; + size_t left; /* number of characters left in 'header' for 'uri' */ + uint64_t nci; + + header = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_AUTHORIZATION); + if (NULL == header) + return MHD_NO; + if (0 != strncmp (header, + _BASE, + MHD_STATICSTR_LEN_(_BASE))) + return MHD_NO; + header += MHD_STATICSTR_LEN_ (_BASE); + left = strlen (header); + + { + char un[MAX_USERNAME_LENGTH]; + + len = lookup_sub_value (un, + sizeof (un), + header, + "username"); + if ( (0 == len) || + (0 != strcmp (username, + un)) ) + return MHD_NO; + left -= strlen ("username") + len; + } + + { + char r[MAX_REALM_LENGTH]; + + len = lookup_sub_value (r, + sizeof (r), + header, + "realm"); + if ( (0 == len) || + (0 != strcmp (realm, + r)) ) + return MHD_NO; + left -= strlen ("realm") + len; + } + + if (0 == (len = lookup_sub_value (nonce, + sizeof (nonce), + header, + "nonce"))) + return MHD_NO; + left -= strlen ("nonce") + len; + if (left > 32 * 1024) + { + /* we do not permit URIs longer than 32k, as we want to + make sure to not blow our stack (or per-connection + heap memory limit). Besides, 32k is already insanely + large, but of course in theory the + #MHD_OPTION_CONNECTION_MEMORY_LIMIT might be very large + and would thus permit sending a >32k authorization + header value. */ + return MHD_NO; + } + if (TIMESTAMP_HEX_LEN != + MHD_strx_to_uint32_n_ (nonce + len - TIMESTAMP_HEX_LEN, + TIMESTAMP_HEX_LEN, + &nonce_time)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, invalid timestamp format.\n")); +#endif + return MHD_NO; + } + t = (uint32_t) MHD_monotonic_sec_counter(); + /* + * First level vetting for the nonce validity: if the timestamp + * attached to the nonce exceeds `nonce_timeout', then the nonce is + * invalid. + */ + if ( (t > nonce_time + nonce_timeout) || + (nonce_time + nonce_timeout < nonce_time) ) + { + /* too old */ + return MHD_INVALID_NONCE; + } + + calculate_nonce (nonce_time, + connection->method, + daemon->digest_auth_random, + daemon->digest_auth_rand_size, + connection->url, + realm, + noncehashexp); + /* + * Second level vetting for the nonce validity + * if the timestamp attached to the nonce is valid + * and possibly fabricated (in case of an attack) + * the attacker must also know the random seed to be + * able to generate a "sane" nonce, which if he does + * not, the nonce fabrication process going to be + * very hard to achieve. + */ + + if (0 != strcmp (nonce, noncehashexp)) + { + return MHD_INVALID_NONCE; + } + if ( (0 == lookup_sub_value (cnonce, + sizeof (cnonce), + header, + "cnonce")) || + (0 == lookup_sub_value (qop, + sizeof (qop), + header, + "qop")) || + ( (0 != strcmp (qop, + "auth")) && + (0 != strcmp (qop, + "")) ) || + (0 == (len = lookup_sub_value (nc, + sizeof (nc), + header, + "nc")) ) || + (0 == lookup_sub_value (response, + sizeof (response), + header, + "response")) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, invalid format.\n")); +#endif + return MHD_NO; + } + if (len != MHD_strx_to_uint64_n_ (nc, + len, + &nci)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, invalid nc format.\n")); +#endif + return MHD_NO; /* invalid nonce format */ + } + + /* + * Checking if that combination of nonce and nc is sound + * and not a replay attack attempt. Also adds the nonce + * to the nonce-nc map if it does not exist there. + */ + if (MHD_YES != + check_nonce_nc (connection, + nonce, + nci)) + { + return MHD_NO; + } + + { + char *uri; + + uri = malloc (left + 1); + if (NULL == uri) + { +#ifdef HAVE_MESSAGES + MHD_DLOG(daemon, + _("Failed to allocate memory for auth header processing\n")); +#endif /* HAVE_MESSAGES */ + return MHD_NO; + } + if (0 == lookup_sub_value (uri, + left + 1, + header, + "uri")) + { + free (uri); + return MHD_NO; + } + + digest_calc_ha1 ("md5", + username, + realm, + password, + nonce, + cnonce, + ha1); + digest_calc_response (ha1, + nonce, + nc, + cnonce, + qop, + connection->method, + uri, + hentity, + respexp); + + /* Need to unescape URI before comparing with connection->url */ + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + uri); + if (0 != strncmp (uri, + connection->url, + strlen (connection->url))) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, URI does not match.\n")); +#endif + free (uri); + return MHD_NO; + } + + { + const char *args = strchr (uri, + '?'); + + if (NULL == args) + args = ""; + else + args++; + if (MHD_YES != + check_argument_match (connection, + args) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Authentication failed, arguments do not match.\n")); +#endif + free (uri); + return MHD_NO; + } + } + free (uri); + return (0 == strcmp(response, + respexp)) + ? MHD_YES + : MHD_NO; + } +} + + +/** + * Queues a response to request authentication from the client + * + * @param connection The MHD connection structure + * @param realm the realm presented to the client + * @param opaque string to user for opaque value + * @param response reply to send; should contain the "access denied" + * body; note that this function will set the "WWW Authenticate" + * header and that the caller should not do this + * @param signal_stale #MHD_YES if the nonce is invalid to add + * 'stale=true' to the authentication header + * @return #MHD_YES on success, #MHD_NO otherwise + * @ingroup authentication + */ +int +MHD_queue_auth_fail_response (struct MHD_Connection *connection, + const char *realm, + const char *opaque, + struct MHD_Response *response, + int signal_stale) +{ + int ret; + int hlen; + char nonce[NONCE_STD_LEN + 1]; + + /* Generating the server nonce */ + calculate_nonce ((uint32_t) MHD_monotonic_sec_counter(), + connection->method, + connection->daemon->digest_auth_random, + connection->daemon->digest_auth_rand_size, + connection->url, + realm, + nonce); + if (MHD_YES != + check_nonce_nc (connection, + nonce, + 0)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Could not register nonce (is the nonce array size zero?).\n")); +#endif + return MHD_NO; + } + /* Building the authentication header */ + hlen = MHD_snprintf_ (NULL, + 0, + "Digest realm=\"%s\",qop=\"auth\",nonce=\"%s\",opaque=\"%s\"%s", + realm, + nonce, + opaque, + signal_stale + ? ",stale=\"true\"" + : ""); + if (hlen > 0) + { + char *header; + + header = MHD_calloc_ (1, hlen + 1); + if (NULL == header) + { +#ifdef HAVE_MESSAGES + MHD_DLOG(connection->daemon, + _("Failed to allocate memory for auth response header\n")); +#endif /* HAVE_MESSAGES */ + return MHD_NO; + } + + if (MHD_snprintf_ (header, + hlen + 1, + "Digest realm=\"%s\",qop=\"auth\",nonce=\"%s\",opaque=\"%s\"%s", + realm, + nonce, + opaque, + signal_stale + ? ",stale=\"true\"" + : "") == hlen) + ret = MHD_add_response_header(response, + MHD_HTTP_HEADER_WWW_AUTHENTICATE, + header); + else + ret = MHD_NO; + free (header); + } + else + ret = MHD_NO; + + if (MHD_YES == ret) + { + ret = MHD_queue_response (connection, + MHD_HTTP_UNAUTHORIZED, + response); + } + else + { +#ifdef HAVE_MESSAGES + MHD_DLOG (connection->daemon, + _("Failed to add Digest auth header\n")); +#endif /* HAVE_MESSAGES */ + } + return ret; +} + + +/* end of digestauth.c */ diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c new file mode 100644 index 0000000..d2532c5 --- /dev/null +++ b/src/microhttpd/internal.c @@ -0,0 +1,281 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/internal.c + * @brief internal shared structures + * @author Daniel Pittman + * @author Christian Grothoff + */ + +#include "internal.h" +#include "mhd_str.h" + +#ifdef HAVE_MESSAGES +#if DEBUG_STATES +/** + * State to string dictionary. + */ +const char * +MHD_state_to_string (enum MHD_CONNECTION_STATE state) +{ + switch (state) + { + case MHD_CONNECTION_INIT: + return "connection init"; + case MHD_CONNECTION_URL_RECEIVED: + return "connection url received"; + case MHD_CONNECTION_HEADER_PART_RECEIVED: + return "header partially received"; + case MHD_CONNECTION_HEADERS_RECEIVED: + return "headers received"; + case MHD_CONNECTION_HEADERS_PROCESSED: + return "headers processed"; + case MHD_CONNECTION_CONTINUE_SENDING: + return "continue sending"; + case MHD_CONNECTION_CONTINUE_SENT: + return "continue sent"; + case MHD_CONNECTION_BODY_RECEIVED: + return "body received"; + case MHD_CONNECTION_FOOTER_PART_RECEIVED: + return "footer partially received"; + case MHD_CONNECTION_FOOTERS_RECEIVED: + return "footers received"; + case MHD_CONNECTION_HEADERS_SENDING: + return "headers sending"; + case MHD_CONNECTION_HEADERS_SENT: + return "headers sent"; + case MHD_CONNECTION_NORMAL_BODY_READY: + return "normal body ready"; + case MHD_CONNECTION_NORMAL_BODY_UNREADY: + return "normal body unready"; + case MHD_CONNECTION_CHUNKED_BODY_READY: + return "chunked body ready"; + case MHD_CONNECTION_CHUNKED_BODY_UNREADY: + return "chunked body unready"; + case MHD_CONNECTION_BODY_SENT: + return "body sent"; + case MHD_CONNECTION_FOOTERS_SENDING: + return "footers sending"; + case MHD_CONNECTION_FOOTERS_SENT: + return "footers sent"; + case MHD_CONNECTION_CLOSED: + return "closed"; + default: + return "unrecognized connection state"; + } +} +#endif +#endif + + +#ifdef HAVE_MESSAGES +/** + * fprintf-like helper function for logging debug + * messages. + */ +void +MHD_DLOG (const struct MHD_Daemon *daemon, + const char *format, + ...) +{ + va_list va; + + if (0 == (daemon->options & MHD_USE_ERROR_LOG)) + return; + va_start (va, format); + daemon->custom_error_log (daemon->custom_error_log_cls, + format, + va); + va_end (va); +} +#endif + + +/** + * Convert all occurrences of '+' to ' '. + * + * @param arg string that is modified (in place), must be 0-terminated + */ +void +MHD_unescape_plus (char *arg) +{ + char *p; + + for (p=strchr (arg, '+'); NULL != p; p = strchr (p + 1, '+')) + *p = ' '; +} + + +/** + * Process escape sequences ('%HH') Updates val in place; the + * result should be UTF-8 encoded and cannot be larger than the input. + * The result must also still be 0-terminated. + * + * @param val value to unescape (modified in the process) + * @return length of the resulting val (strlen(val) maybe + * shorter afterwards due to elimination of escape sequences) + */ +size_t +MHD_http_unescape (char *val) +{ + char *rpos = val; + char *wpos = val; + + while ('\0' != *rpos) + { + uint32_t num; + switch (*rpos) + { + case '%': + if (2 == MHD_strx_to_uint32_n_ (rpos + 1, + 2, + &num)) + { + *wpos = (char)((unsigned char) num); + wpos++; + rpos += 3; + break; + } + /* TODO: add bad sequence handling */ + /* intentional fall through! */ + default: + *wpos = *rpos; + wpos++; + rpos++; + } + } + *wpos = '\0'; /* add 0-terminator */ + return wpos - val; /* = strlen(val) */ +} + + +/** + * Parse and unescape the arguments given by the client + * as part of the HTTP request URI. + * + * @param kind header kind to pass to @a cb + * @param connection connection to add headers to + * @param[in,out] args argument URI string (after "?" in URI), + * clobbered in the process! + * @param cb function to call on each key-value pair found + * @param[out] num_headers set to the number of headers found + * @return #MHD_NO on failure (@a cb returned #MHD_NO), + * #MHD_YES for success (parsing succeeded, @a cb always + * returned #MHD_YES) + */ +int +MHD_parse_arguments_ (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + char *args, + MHD_ArgumentIterator_ cb, + unsigned int *num_headers) +{ + struct MHD_Daemon *daemon = connection->daemon; + char *equals; + char *amper; + + *num_headers = 0; + while ( (NULL != args) && + ('\0' != args[0]) ) + { + equals = strchr (args, '='); + amper = strchr (args, '&'); + if (NULL == amper) + { + /* last argument */ + if (NULL == equals) + { + /* last argument, without '=' */ + MHD_unescape_plus (args); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + args); + if (MHD_YES != cb (connection, + args, + NULL, + kind)) + return MHD_NO; + (*num_headers)++; + break; + } + /* got 'foo=bar' */ + equals[0] = '\0'; + equals++; + MHD_unescape_plus (args); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + args); + MHD_unescape_plus (equals); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + equals); + if (MHD_YES != cb (connection, + args, + equals, + kind)) + return MHD_NO; + (*num_headers)++; + break; + } + /* amper is non-NULL here */ + amper[0] = '\0'; + amper++; + if ( (NULL == equals) || + (equals >= amper) ) + { + /* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value */ + MHD_unescape_plus (args); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + args); + if (MHD_YES != cb (connection, + args, + NULL, + kind)) + return MHD_NO; + /* continue with 'bar' */ + (*num_headers)++; + args = amper; + continue; + } + /* equals and amper are non-NULL here, and equals < amper, + so we got regular 'foo=value&bar...'-kind of argument */ + equals[0] = '\0'; + equals++; + MHD_unescape_plus (args); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + args); + MHD_unescape_plus (equals); + daemon->unescape_callback (daemon->unescape_callback_cls, + connection, + equals); + if (MHD_YES != cb (connection, + args, + equals, + kind)) + return MHD_NO; + (*num_headers)++; + args = amper; + } + return MHD_YES; +} + +/* end of internal.c */ diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h new file mode 100644 index 0000000..5668a8f --- /dev/null +++ b/src/microhttpd/internal.h @@ -0,0 +1,1926 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007-2017 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/internal.h + * @brief internal shared structures + * @author Daniel Pittman + * @author Christian Grothoff + */ + +#ifndef INTERNAL_H +#define INTERNAL_H + +#include "mhd_options.h" +#include "platform.h" +#include "microhttpd.h" +#include "mhd_assert.h" + +#ifdef HTTPS_SUPPORT +#include +#if GNUTLS_VERSION_MAJOR >= 3 +#include +#endif +#endif /* HTTPS_SUPPORT */ + +#ifdef HAVE_STDBOOL_H +#include +#endif + + +#ifdef MHD_PANIC +/* Override any defined MHD_PANIC macro with proper one */ +#undef MHD_PANIC +#endif /* MHD_PANIC */ + +#ifdef HAVE_MESSAGES +/** + * Trigger 'panic' action based on fatal errors. + * + * @param msg error message (const char *) + */ +#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, msg); BUILTIN_NOT_REACHED; } while (0) +#else +/** + * Trigger 'panic' action based on fatal errors. + * + * @param msg error message (const char *) + */ +#define MHD_PANIC(msg) do { mhd_panic (mhd_panic_cls, __FILE__, __LINE__, NULL); BUILTIN_NOT_REACHED; } while (0) +#endif + +#include "mhd_threads.h" +#include "mhd_locks.h" +#include "mhd_sockets.h" +#include "mhd_itc_types.h" + + +/** + * Close FD and abort execution if error is detected. + * @param fd the FD to close + */ +#define MHD_fd_close_chk_(fd) do { \ + if (0 == close ((fd)) && (EBADF == errno)) \ + MHD_PANIC(_("Failed to close FD.\n")); \ + } while(0) + +/** + * Should we perform additional sanity checks at runtime (on our internal + * invariants)? This may lead to aborts, but can be useful for debugging. + */ +#define EXTRA_CHECKS MHD_NO + +#define MHD_MAX(a,b) (((a)<(b)) ? (b) : (a)) +#define MHD_MIN(a,b) (((a)<(b)) ? (a) : (b)) + + +/** + * Minimum size by which MHD tries to increment read/write buffers. + * We usually begin with half the available pool space for the + * IO-buffer, but if absolutely needed we additively grow by the + * number of bytes given here (up to -- theoretically -- the full pool + * space). + */ +#define MHD_BUF_INC_SIZE 1024 + + +/** + * Handler for fatal errors. + */ +extern MHD_PanicCallback mhd_panic; + +/** + * Closure argument for "mhd_panic". + */ +extern void *mhd_panic_cls; + +/* If we have Clang or gcc >= 4.5, use __buildin_unreachable() */ +#if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#define BUILTIN_NOT_REACHED __builtin_unreachable() +#elif defined(_MSC_FULL_VER) +#define BUILTIN_NOT_REACHED __assume(0) +#else +#define BUILTIN_NOT_REACHED +#endif + +#ifndef MHD_STATICSTR_LEN_ +/** + * Determine length of static string / macro strings at compile time. + */ +#define MHD_STATICSTR_LEN_(macro) (sizeof(macro)/sizeof(char) - 1) +#endif /* ! MHD_STATICSTR_LEN_ */ + + +/** + * State of the socket with respect to epoll (bitmask). + */ +enum MHD_EpollState +{ + + /** + * The socket is not involved with a defined state in epoll() right + * now. + */ + MHD_EPOLL_STATE_UNREADY = 0, + + /** + * epoll() told us that data was ready for reading, and we did + * not consume all of it yet. + */ + MHD_EPOLL_STATE_READ_READY = 1, + + /** + * epoll() told us that space was available for writing, and we did + * not consume all of it yet. + */ + MHD_EPOLL_STATE_WRITE_READY = 2, + + /** + * Is this connection currently in the 'eready' EDLL? + */ + MHD_EPOLL_STATE_IN_EREADY_EDLL = 4, + + /** + * Is this connection currently in the epoll() set? + */ + MHD_EPOLL_STATE_IN_EPOLL_SET = 8, + + /** + * Is this connection currently suspended? + */ + MHD_EPOLL_STATE_SUSPENDED = 16, + + /** + * Is this connection in some error state? + */ + MHD_EPOLL_STATE_ERROR = 128 +}; + + +/** + * What is this connection waiting for? + */ +enum MHD_ConnectionEventLoopInfo +{ + /** + * We are waiting to be able to read. + */ + MHD_EVENT_LOOP_INFO_READ = 0, + + /** + * We are waiting to be able to write. + */ + MHD_EVENT_LOOP_INFO_WRITE = 1, + + /** + * We are waiting for the application to provide data. + */ + MHD_EVENT_LOOP_INFO_BLOCK = 2, + + /** + * We are finished and are awaiting cleanup. + */ + MHD_EVENT_LOOP_INFO_CLEANUP = 3 +}; + + +/** + * Additional test value for enum MHD_FLAG to check only for MHD_ALLOW_SUSPEND_RESUME and + * NOT for MHD_USE_ITC. + */ +#define MHD_TEST_ALLOW_SUSPEND_RESUME 8192 + +/** + * Maximum length of a nonce in digest authentication. 32(MD5 Hex) + + * 8(Timestamp Hex) + 1(NULL); hence 41 should suffice, but Opera + * (already) takes more (see Mantis #1633), so we've increased the + * value to support something longer... + */ +#define MAX_NONCE_LENGTH 129 + + +/** + * A structure representing the internal holder of the + * nonce-nc map. + */ +struct MHD_NonceNc +{ + + /** + * Nonce counter, a value that increases for each subsequent + * request for the same nonce. + */ + uint64_t nc; + + /** + * Bitmask over the nc-64 previous nonce values. Used to + * allow out-of-order nonces. + */ + uint64_t nmask; + + /** + * Nonce value: + */ + char nonce[MAX_NONCE_LENGTH]; + +}; + +#ifdef HAVE_MESSAGES +/** + * fprintf()-like helper function for logging debug + * messages. + */ +void +MHD_DLOG (const struct MHD_Daemon *daemon, + const char *format, + ...); +#endif + + +/** + * Header or cookie in HTTP request or response. + */ +struct MHD_HTTP_Header +{ + /** + * Headers are kept in a linked list. + */ + struct MHD_HTTP_Header *next; + + /** + * The name of the header (key), without the colon. + */ + char *header; + + /** + * The value of the header. + */ + char *value; + + /** + * Type of the header (where in the HTTP protocol is this header + * from). + */ + enum MHD_ValueKind kind; + +}; + + +/** + * Representation of a response. + */ +struct MHD_Response +{ + + /** + * Headers to send for the response. Initially + * the linked list is created in inverse order; + * the order should be inverted before sending! + */ + struct MHD_HTTP_Header *first_header; + + /** + * Buffer pointing to data that we are supposed + * to send as a response. + */ + char *data; + + /** + * Closure to give to the content reader @e crc + * and content reader free callback @e crfc. + */ + void *crc_cls; + + /** + * How do we get more data? NULL if we are + * given all of the data up front. + */ + MHD_ContentReaderCallback crc; + + /** + * NULL if data must not be freed, otherwise + * either user-specified callback or "&free". + */ + MHD_ContentReaderFreeCallback crfc; + +#ifdef UPGRADE_SUPPORT + /** + * Application function to call once we are done sending the headers + * of the response; NULL unless this is a response created with + * #MHD_create_response_for_upgrade(). + */ + MHD_UpgradeHandler upgrade_handler; + + /** + * Closure for @e uh. + */ + void *upgrade_handler_cls; +#endif /* UPGRADE_SUPPORT */ + + /** + * Mutex to synchronize access to @e data, @e size and + * @e reference_count. + */ + MHD_mutex_ mutex; + + /** + * Set to #MHD_SIZE_UNKNOWN if size is not known. + */ + uint64_t total_size; + + /** + * At what offset in the stream is the + * beginning of @e data located? + */ + uint64_t data_start; + + /** + * Offset to start reading from when using @e fd. + */ + uint64_t fd_off; + + /** + * Number of bytes ready in @e data (buffer may be larger + * than what is filled with payload). + */ + size_t data_size; + + /** + * Size of the data buffer @e data. + */ + size_t data_buffer_size; + + /** + * Reference count for this response. Free once the counter hits + * zero. + */ + unsigned int reference_count; + + /** + * File-descriptor if this response is FD-backed. + */ + int fd; + + /** + * Flags set for the MHD response. + */ + enum MHD_ResponseFlags flags; + +}; + + +/** + * States in a state machine for a connection. + * + * The main transitions are any-state to #MHD_CONNECTION_CLOSED, any + * state to state+1, #MHD_CONNECTION_FOOTERS_SENT to + * #MHD_CONNECTION_INIT. #MHD_CONNECTION_CLOSED is the terminal state + * and #MHD_CONNECTION_INIT the initial state. + * + * Note that transitions for *reading* happen only after the input has + * been processed; transitions for *writing* happen after the + * respective data has been put into the write buffer (the write does + * not have to be completed yet). A transition to + * #MHD_CONNECTION_CLOSED or #MHD_CONNECTION_INIT requires the write + * to be complete. + */ +enum MHD_CONNECTION_STATE +{ + /** + * Connection just started (no headers received). + * Waiting for the line with the request type, URL and version. + */ + MHD_CONNECTION_INIT = 0, + + /** + * 1: We got the URL (and request type and version). Wait for a header line. + */ + MHD_CONNECTION_URL_RECEIVED = MHD_CONNECTION_INIT + 1, + + /** + * 2: We got part of a multi-line request header. Wait for the rest. + */ + MHD_CONNECTION_HEADER_PART_RECEIVED = MHD_CONNECTION_URL_RECEIVED + 1, + + /** + * 3: We got the request headers. Process them. + */ + MHD_CONNECTION_HEADERS_RECEIVED = MHD_CONNECTION_HEADER_PART_RECEIVED + 1, + + /** + * 4: We have processed the request headers. Send 100 continue. + */ + MHD_CONNECTION_HEADERS_PROCESSED = MHD_CONNECTION_HEADERS_RECEIVED + 1, + + /** + * 5: We have processed the headers and need to send 100 CONTINUE. + */ + MHD_CONNECTION_CONTINUE_SENDING = MHD_CONNECTION_HEADERS_PROCESSED + 1, + + /** + * 6: We have sent 100 CONTINUE (or do not need to). Read the message body. + */ + MHD_CONNECTION_CONTINUE_SENT = MHD_CONNECTION_CONTINUE_SENDING + 1, + + /** + * 7: We got the request body. Wait for a line of the footer. + */ + MHD_CONNECTION_BODY_RECEIVED = MHD_CONNECTION_CONTINUE_SENT + 1, + + /** + * 8: We got part of a line of the footer. Wait for the + * rest. + */ + MHD_CONNECTION_FOOTER_PART_RECEIVED = MHD_CONNECTION_BODY_RECEIVED + 1, + + /** + * 9: We received the entire footer. Wait for a response to be queued + * and prepare the response headers. + */ + MHD_CONNECTION_FOOTERS_RECEIVED = MHD_CONNECTION_FOOTER_PART_RECEIVED + 1, + + /** + * 10: We have prepared the response headers in the writ buffer. + * Send the response headers. + */ + MHD_CONNECTION_HEADERS_SENDING = MHD_CONNECTION_FOOTERS_RECEIVED + 1, + + /** + * 11: We have sent the response headers. Get ready to send the body. + */ + MHD_CONNECTION_HEADERS_SENT = MHD_CONNECTION_HEADERS_SENDING + 1, + + /** + * 12: We are ready to send a part of a non-chunked body. Send it. + */ + MHD_CONNECTION_NORMAL_BODY_READY = MHD_CONNECTION_HEADERS_SENT + 1, + + /** + * 13: We are waiting for the client to provide more + * data of a non-chunked body. + */ + MHD_CONNECTION_NORMAL_BODY_UNREADY = MHD_CONNECTION_NORMAL_BODY_READY + 1, + + /** + * 14: We are ready to send a chunk. + */ + MHD_CONNECTION_CHUNKED_BODY_READY = MHD_CONNECTION_NORMAL_BODY_UNREADY + 1, + + /** + * 15: We are waiting for the client to provide a chunk of the body. + */ + MHD_CONNECTION_CHUNKED_BODY_UNREADY = MHD_CONNECTION_CHUNKED_BODY_READY + 1, + + /** + * 16: We have sent the response body. Prepare the footers. + */ + MHD_CONNECTION_BODY_SENT = MHD_CONNECTION_CHUNKED_BODY_UNREADY + 1, + + /** + * 17: We have prepared the response footer. Send it. + */ + MHD_CONNECTION_FOOTERS_SENDING = MHD_CONNECTION_BODY_SENT + 1, + + /** + * 18: We have sent the response footer. Shutdown or restart. + */ + MHD_CONNECTION_FOOTERS_SENT = MHD_CONNECTION_FOOTERS_SENDING + 1, + + /** + * 19: This connection is to be closed. + */ + MHD_CONNECTION_CLOSED = MHD_CONNECTION_FOOTERS_SENT + 1, + + /** + * 20: This connection is finished (only to be freed) + */ + MHD_CONNECTION_IN_CLEANUP = MHD_CONNECTION_CLOSED + 1, + +#ifdef UPGRADE_SUPPORT + /** + * Connection was "upgraded" and socket is now under the + * control of the application. + */ + MHD_CONNECTION_UPGRADE +#endif /* UPGRADE_SUPPORT */ + +}; + + +/** + * States of TLS transport layer. + */ +enum MHD_TLS_CONN_STATE +{ + MHD_TLS_CONN_NO_TLS = 0, /**< Not a TLS connection (plain socket). */ + MHD_TLS_CONN_INIT, /**< TLS connection is not established yet. */ + MHD_TLS_CONN_HANDSHAKING, /**< TLS is in handshake process. */ + MHD_TLS_CONN_CONNECTED, /**< TLS is established. */ + MHD_TLS_CONN_WR_CLOSING, /**< Closing WR side of TLS layer. */ + MHD_TLS_CONN_WR_CLOSED, /**< WR side of TLS layer is closed. */ + MHD_TLS_CONN_TLS_CLOSING, /**< TLS session is terminating. */ + MHD_TLS_CONN_TLS_CLOSED, /**< TLS session is terminated. */ + MHD_TLS_CONN_TLS_FAILED, /**< TLS session failed. */ + MHD_TLS_CONN_INVALID_STATE/**< Sentinel. Not a valid value. */ +}; + +/** + * Should all state transitions be printed to stderr? + */ +#define DEBUG_STATES MHD_NO + + +#ifdef HAVE_MESSAGES +#if DEBUG_STATES +const char * +MHD_state_to_string (enum MHD_CONNECTION_STATE state); +#endif +#endif + +/** + * Function to receive plaintext data. + * + * @param conn the connection struct + * @param write_to where to write received data + * @param max_bytes maximum number of bytes to receive + * @return number of bytes written to @a write_to + */ +typedef ssize_t +(*ReceiveCallback) (struct MHD_Connection *conn, + void *write_to, + size_t max_bytes); + + +/** + * Function to transmit plaintext data. + * + * @param conn the connection struct + * @param read_from where to read data to transmit + * @param max_bytes maximum number of bytes to transmit + * @return number of bytes transmitted + */ +typedef ssize_t +(*TransmitCallback) (struct MHD_Connection *conn, + const void *read_from, + size_t max_bytes); + + +/** + * Ability to use same connection for next request + */ +enum MHD_ConnKeepAlive +{ + /** + * Connection must be closed after sending response. + */ + MHD_CONN_MUST_CLOSE = -1, + + /** + * KeelAlive state is not yet determined + */ + MHD_CONN_KEEPALIVE_UNKOWN = 0, + + /** + * Connection can be used for serving next request + */ + MHD_CONN_USE_KEEPALIVE = 1 +}; + +/** + * State kept for each HTTP request. + */ +struct MHD_Connection +{ + +#ifdef EPOLL_SUPPORT + /** + * Next pointer for the EDLL listing connections that are epoll-ready. + */ + struct MHD_Connection *nextE; + + /** + * Previous pointer for the EDLL listing connections that are epoll-ready. + */ + struct MHD_Connection *prevE; +#endif + + /** + * Next pointer for the DLL describing our IO state. + */ + struct MHD_Connection *next; + + /** + * Previous pointer for the DLL describing our IO state. + */ + struct MHD_Connection *prev; + + /** + * Next pointer for the XDLL organizing connections by timeout. + * This DLL can be either the + * 'manual_timeout_head/manual_timeout_tail' or the + * 'normal_timeout_head/normal_timeout_tail', depending on whether a + * custom timeout is set for the connection. + */ + struct MHD_Connection *nextX; + + /** + * Previous pointer for the XDLL organizing connections by timeout. + */ + struct MHD_Connection *prevX; + + /** + * Reference to the MHD_Daemon struct. + */ + struct MHD_Daemon *daemon; + + /** + * Linked list of parsed headers. + */ + struct MHD_HTTP_Header *headers_received; + + /** + * Tail of linked list of parsed headers. + */ + struct MHD_HTTP_Header *headers_received_tail; + + /** + * Response to transmit (initially NULL). + */ + struct MHD_Response *response; + + /** + * The memory pool is created whenever we first read from the TCP + * stream and destroyed at the end of each request (and re-created + * for the next request). In the meantime, this pointer is NULL. + * The pool is used for all connection-related data except for the + * response (which maybe shared between connections) and the IP + * address (which persists across individual requests). + */ + struct MemoryPool *pool; + + /** + * We allow the main application to associate some pointer with the + * HTTP request, which is passed to each #MHD_AccessHandlerCallback + * and some other API calls. Here is where we store it. (MHD does + * not know or care what it is). + */ + void *client_context; + + /** + * We allow the main application to associate some pointer with the + * TCP connection (which may span multiple HTTP requests). Here is + * where we store it. (MHD does not know or care what it is). + * The location is given to the #MHD_NotifyConnectionCallback and + * also accessible via #MHD_CONNECTION_INFO_SOCKET_CONTEXT. + */ + void *socket_context; + + /** + * Request method. Should be GET/POST/etc. Allocated in pool. + */ + char *method; + + /** + * Requested URL (everything after "GET" only). Allocated + * in pool. + */ + const char *url; + + /** + * HTTP version string (i.e. http/1.1). Allocated + * in pool. + */ + char *version; + + /** + * Close connection after sending response? + * Functions may change value from "Unknown" or "KeepAlive" to "Must close", + * but no functions reset value "Must Close" to any other value. + */ + enum MHD_ConnKeepAlive keepalive; + + /** + * Buffer for reading requests. Allocated in pool. Actually one + * byte larger than @e read_buffer_size (if non-NULL) to allow for + * 0-termination. + */ + char *read_buffer; + + /** + * Buffer for writing response (headers only). Allocated + * in pool. + */ + char *write_buffer; + + /** + * Last incomplete header line during parsing of headers. + * Allocated in pool. Only valid if state is + * either #MHD_CONNECTION_HEADER_PART_RECEIVED or + * #MHD_CONNECTION_FOOTER_PART_RECEIVED. + */ + char *last; + + /** + * Position after the colon on the last incomplete header + * line during parsing of headers. + * Allocated in pool. Only valid if state is + * either #MHD_CONNECTION_HEADER_PART_RECEIVED or + * #MHD_CONNECTION_FOOTER_PART_RECEIVED. + */ + char *colon; + + /** + * Foreign address (of length @e addr_len). MALLOCED (not + * in pool!). + */ + struct sockaddr *addr; + + /** + * Thread handle for this connection (if we are using + * one thread per connection). + */ + MHD_thread_handle_ID_ pid; + + /** + * Size of @e read_buffer (in bytes). This value indicates + * how many bytes we're willing to read into the buffer; + * the real buffer is one byte longer to allow for + * adding zero-termination (when needed). + */ + size_t read_buffer_size; + + /** + * Position where we currently append data in + * @e read_buffer (last valid position). + */ + size_t read_buffer_offset; + + /** + * Size of @e write_buffer (in bytes). + */ + size_t write_buffer_size; + + /** + * Offset where we are with sending from @e write_buffer. + */ + size_t write_buffer_send_offset; + + /** + * Last valid location in write_buffer (where do we + * append and up to where is it safe to send?) + */ + size_t write_buffer_append_offset; + + /** + * Number of bytes we had in the HTTP header, set once we + * pass #MHD_CONNECTION_HEADERS_RECEIVED. + */ + size_t header_size; + + /** + * How many more bytes of the body do we expect + * to read? #MHD_SIZE_UNKNOWN for unknown. + */ + uint64_t remaining_upload_size; + + /** + * Current write position in the actual response + * (excluding headers, content only; should be 0 + * while sending headers). + */ + uint64_t response_write_position; + +#if defined(_MHD_HAVE_SENDFILE) + enum MHD_resp_sender_ + { + MHD_resp_sender_std = 0, + MHD_resp_sender_sendfile + } resp_sender; +#endif /* _MHD_HAVE_SENDFILE */ + + /** + * Position in the 100 CONTINUE message that + * we need to send when receiving http 1.1 requests. + */ + size_t continue_message_write_offset; + + /** + * Length of the foreign address. + */ + socklen_t addr_len; + + /** + * Last time this connection had any activity + * (reading or writing). + */ + time_t last_activity; + + /** + * After how many seconds of inactivity should + * this connection time out? Zero for no timeout. + */ + time_t connection_timeout; + + /** + * Special member to be returned by #MHD_get_connection_info() + */ + unsigned int connection_timeout_dummy; + + /** + * Did we ever call the "default_handler" on this connection? (this + * flag will determine if we call the #MHD_OPTION_NOTIFY_COMPLETED + * handler when the connection closes down). + */ + bool client_aware; + + /** + * Socket for this connection. Set to #MHD_INVALID_SOCKET if + * this connection has died (daemon should clean + * up in that case). + */ + MHD_socket socket_fd; + + /** + * true if #socket_fd is non-blocking, false otherwise. + */ + bool sk_nonblck; + + /** + * Has this socket been closed for reading (i.e. other side closed + * the connection)? If so, we must completely close the connection + * once we are done sending our response (and stop trying to read + * from this socket). + */ + bool read_closed; + + /** + * Set to `true` if the thread has been joined. + */ + bool thread_joined; + + /** + * Are we currently inside the "idle" handler (to avoid recursively + * invoking it). + */ + bool in_idle; + + /** + * Are we currently inside the "idle" handler (to avoid recursively + * invoking it). + */ + bool in_cleanup; + +#ifdef EPOLL_SUPPORT + /** + * What is the state of this socket in relation to epoll? + */ + enum MHD_EpollState epoll_state; +#endif + + /** + * State in the FSM for this connection. + */ + enum MHD_CONNECTION_STATE state; + + /** + * What is this connection waiting for? + */ + enum MHD_ConnectionEventLoopInfo event_loop_info; + + /** + * HTTP response code. Only valid if response object + * is already set. + */ + unsigned int responseCode; + + /** + * Are we receiving with chunked encoding? This will be set to + * #MHD_YES after we parse the headers and are processing the body + * with chunks. After we are done with the body and we are + * processing the footers; once the footers are also done, this will + * be set to #MHD_NO again (before the final call to the handler). + */ + bool have_chunked_upload; + + /** + * If we are receiving with chunked encoding, where are we right + * now? Set to 0 if we are waiting to receive the chunk size; + * otherwise, this is the size of the current chunk. A value of + * zero is also used when we're at the end of the chunks. + */ + uint64_t current_chunk_size; + + /** + * If we are receiving with chunked encoding, where are we currently + * with respect to the current chunk (at what offset / position)? + */ + uint64_t current_chunk_offset; + + /** + * Function used for reading HTTP request stream. + */ + ReceiveCallback recv_cls; + + /** + * Function used for writing HTTP response stream. + */ + TransmitCallback send_cls; + +#ifdef UPGRADE_SUPPORT + /** + * If this connection was upgraded, this points to + * the upgrade response details such that the + * #thread_main_connection_upgrade()-logic can perform the + * bi-directional forwarding. + */ + struct MHD_UpgradeResponseHandle *urh; +#endif /* UPGRADE_SUPPORT */ + +#ifdef HTTPS_SUPPORT + + /** + * State required for HTTPS/SSL/TLS support. + */ + gnutls_session_t tls_session; + + /** + * Memory location to return for protocol session info. + */ + int protocol; + + /** + * Memory location to return for protocol session info. + */ + int cipher; + + /** + * State of connection's TLS layer + */ + enum MHD_TLS_CONN_STATE tls_state; + + /** + * Could it be that we are ready to read due to TLS buffers + * even though the socket is not? + */ + bool tls_read_ready; +#endif /* HTTPS_SUPPORT */ + + /** + * Is the connection suspended? + */ + bool suspended; + + /** + * Special member to be returned by #MHD_get_connection_info() + */ + int suspended_dummy; + + /** + * Is the connection wanting to resume? + */ + bool resuming; +}; + + +#ifdef UPGRADE_SUPPORT +/** + * Buffer we use for upgrade response handling in the unlikely + * case where the memory pool was so small it had no buffer + * capacity left. Note that we don't expect to _ever_ use this + * buffer, so it's mostly wasted memory (except that it allows + * us to handle a tricky error condition nicely). So no need to + * make this one big. Applications that want to perform well + * should just pick an adequate size for the memory pools. + */ +#define RESERVE_EBUF_SIZE 8 + +/** + * Context we pass to epoll() for each of the two sockets + * of a `struct MHD_UpgradeResponseHandle`. We need to do + * this so we can distinguish the two sockets when epoll() + * gives us event notifications. + */ +struct UpgradeEpollHandle +{ + /** + * Reference to the overall response handle this struct is + * included within. + */ + struct MHD_UpgradeResponseHandle *urh; + + /** + * The socket this event is kind-of about. Note that this is NOT + * necessarily the socket we are polling on, as for when we read + * from TLS, we epoll() on the connection's socket + * (`urh->connection->socket_fd`), while this then the application's + * socket (where the application will read from). Nevertheless, for + * the application to read, we need to first read from TLS, hence + * the two are related. + * + * Similarly, for writing to TLS, this epoll() will be on the + * connection's `socket_fd`, and this will merely be the FD which + * the applicatio would write to. Hence this struct must always be + * interpreted based on which field in `struct + * MHD_UpgradeResponseHandle` it is (`app` or `mhd`). + */ + MHD_socket socket; + + /** + * IO-state of the @e socket (or the connection's `socket_fd`). + */ + enum MHD_EpollState celi; + +}; + + +/** + * Handle given to the application to manage special + * actions relating to MHD responses that "upgrade" + * the HTTP protocol (i.e. to WebSockets). + */ +struct MHD_UpgradeResponseHandle +{ + /** + * The connection for which this is an upgrade handle. Note that + * because a response may be shared over many connections, this may + * not be the only upgrade handle for the response of this connection. + */ + struct MHD_Connection *connection; + +#ifdef HTTPS_SUPPORT + /** + * Kept in a DLL per daemon. + */ + struct MHD_UpgradeResponseHandle *next; + + /** + * Kept in a DLL per daemon. + */ + struct MHD_UpgradeResponseHandle *prev; + +#ifdef EPOLL_SUPPORT + /** + * Next pointer for the EDLL listing urhs that are epoll-ready. + */ + struct MHD_UpgradeResponseHandle *nextE; + + /** + * Previous pointer for the EDLL listing urhs that are epoll-ready. + */ + struct MHD_UpgradeResponseHandle *prevE; + + /** + * Specifies whether urh already in EDLL list of ready connections. + */ + bool in_eready_list; +#endif + + /** + * The buffer for receiving data from TLS to + * be passed to the application. Contains @e in_buffer_size + * bytes (unless @e in_buffer_size is zero). Do not free! + */ + char *in_buffer; + + /** + * The buffer for receiving data from the application to + * be passed to TLS. Contains @e out_buffer_size + * bytes (unless @e out_buffer_size is zero). Do not free! + */ + char *out_buffer; + + /** + * Size of the @e in_buffer. + * Set to 0 if the TLS connection went down for reading or socketpair + * went down for writing. + */ + size_t in_buffer_size; + + /** + * Size of the @e out_buffer. + * Set to 0 if the TLS connection went down for writing or socketpair + * went down for reading. + */ + size_t out_buffer_size; + + /** + * Number of bytes actually in use in the @e in_buffer. Can be larger + * than @e in_buffer_size if and only if @a in_buffer_size is zero and + * we still have bytes that can be forwarded. + * Reset to zero if all data was forwarded to socketpair or + * if socketpair went down for writing. + */ + size_t in_buffer_used; + + /** + * Number of bytes actually in use in the @e out_buffer. Can be larger + * than @e out_buffer_size if and only if @a out_buffer_size is zero and + * we still have bytes that can be forwarded. + * Reset to zero if all data was forwarded to TLS connection or + * if TLS connection went down for writing. + */ + size_t out_buffer_used; + + /** + * The socket we gave to the application (r/w). + */ + struct UpgradeEpollHandle app; + + /** + * If @a app_sock was a socketpair, our end of it, otherwise + * #MHD_INVALID_SOCKET; (r/w). + */ + struct UpgradeEpollHandle mhd; + + /** + * Emergency IO buffer we use in case the memory pool has literally + * nothing left. + */ + char e_buf[RESERVE_EBUF_SIZE]; + +#endif /* HTTPS_SUPPORT */ + + /** + * Set to true after the application finished with the socket + * by #MHD_UPGRADE_ACTION_CLOSE. + * + * When BOTH @e was_closed (changed by command from application) + * AND @e clean_ready (changed internally by MHD) are set to + * #MHD_YES, function #MHD_resume_connection() will move this + * connection to cleanup list. + * @remark This flag could be changed from any thread. + */ + volatile bool was_closed; + + /** + * Set to true if connection is ready for cleanup. + * + * In TLS mode functions #MHD_connection_finish_forward_() must + * be called before setting this flag to true. + * + * In thread-per-connection mode, true in this flag means + * that connection's thread exited or about to exit and will + * not use MHD_Connection::urh data anymore. + * + * In any mode true in this flag also means that + * MHD_Connection::urh data will not be used for socketpair + * forwarding and forwarding itself is finished. + * + * When BOTH @e was_closed (changed by command from application) + * AND @e clean_ready (changed internally by MHD) are set to + * true, function #MHD_resume_connection() will move this + * connection to cleanup list. + * @remark This flag could be changed from thread that process + * connection's recv(), send() and response. + */ + bool clean_ready; +}; +#endif /* UPGRADE_SUPPORT */ + + +/** + * Signature of function called to log URI accesses. + * + * @param cls closure + * @param uri uri being accessed + * @param con connection handle + * @return new closure + */ +typedef void * +(*LogCallback)(void *cls, + const char *uri, + struct MHD_Connection *con); + +/** + * Signature of function called to unescape URIs. See also + * #MHD_http_unescape(). + * + * @param cls closure + * @param conn connection handle + * @param uri 0-terminated string to unescape (should be updated) + * @return length of the resulting string + */ +typedef size_t +(*UnescapeCallback)(void *cls, + struct MHD_Connection *conn, + char *uri); + + +/** + * State kept for each MHD daemon. All connections are kept in two + * doubly-linked lists. The first one reflects the state of the + * connection in terms of what operations we are waiting for (read, + * write, locally blocked, cleanup) whereas the second is about its + * timeout state (default or custom). + */ +struct MHD_Daemon +{ + + /** + * Callback function for all requests. + */ + MHD_AccessHandlerCallback default_handler; + + /** + * Closure argument to default_handler. + */ + void *default_handler_cls; + + /** + * Head of doubly-linked list of our current, active connections. + */ + struct MHD_Connection *connections_head; + + /** + * Tail of doubly-linked list of our current, active connections. + */ + struct MHD_Connection *connections_tail; + + /** + * Head of doubly-linked list of our current but suspended connections. + */ + struct MHD_Connection *suspended_connections_head; + + /** + * Tail of doubly-linked list of our current but suspended connections. + */ + struct MHD_Connection *suspended_connections_tail; + + /** + * Head of doubly-linked list of connections to clean up. + */ + struct MHD_Connection *cleanup_head; + + /** + * Tail of doubly-linked list of connections to clean up. + */ + struct MHD_Connection *cleanup_tail; + +#ifdef EPOLL_SUPPORT + /** + * Head of EDLL of connections ready for processing (in epoll mode). + */ + struct MHD_Connection *eready_head; + + /** + * Tail of EDLL of connections ready for processing (in epoll mode) + */ + struct MHD_Connection *eready_tail; + +#ifdef UPGRADE_SUPPORT + /** + * Head of EDLL of upgraded connections ready for processing (in epoll mode). + */ + struct MHD_UpgradeResponseHandle *eready_urh_head; + + /** + * Tail of EDLL of upgraded connections ready for processing (in epoll mode) + */ + struct MHD_UpgradeResponseHandle *eready_urh_tail; +#endif /* UPGRADE_SUPPORT */ +#endif /* EPOLL_SUPPORT */ + + /** + * Head of the XDLL of ALL connections with a default ('normal') + * timeout, sorted by timeout (earliest at the tail, most recently + * used connection at the head). MHD can just look at the tail of + * this list to determine the timeout for all of its elements; + * whenever there is an event of a connection, the connection is + * moved back to the tail of the list. + * + * All connections by default start in this list; if a custom + * timeout that does not match @e connection_timeout is set, they + * are moved to the @e manual_timeout_head-XDLL. + * Not used in MHD_USE_THREAD_PER_CONNECTION mode as each thread + * needs only one connection-specific timeout. + */ + struct MHD_Connection *normal_timeout_head; + + /** + * Tail of the XDLL of ALL connections with a default timeout, + * sorted by timeout (earliest timeout at the tail). + * Not used in MHD_USE_THREAD_PER_CONNECTION mode. + */ + struct MHD_Connection *normal_timeout_tail; + + /** + * Head of the XDLL of ALL connections with a non-default/custom + * timeout, unsorted. MHD will do a O(n) scan over this list to + * determine the current timeout. + * Not used in MHD_USE_THREAD_PER_CONNECTION mode. + */ + struct MHD_Connection *manual_timeout_head; + + /** + * Tail of the XDLL of ALL connections with a non-default/custom + * timeout, unsorted. + * Not used in MHD_USE_THREAD_PER_CONNECTION mode. + */ + struct MHD_Connection *manual_timeout_tail; + + /** + * Function to call to check if we should accept or reject an + * incoming request. May be NULL. + */ + MHD_AcceptPolicyCallback apc; + + /** + * Closure argument to apc. + */ + void *apc_cls; + + /** + * Function to call when we are done processing + * a particular request. May be NULL. + */ + MHD_RequestCompletedCallback notify_completed; + + /** + * Closure argument to @e notify_completed. + */ + void *notify_completed_cls; + + /** + * Function to call when we are starting/stopping + * a connection. May be NULL. + */ + MHD_NotifyConnectionCallback notify_connection; + + /** + * Closure argument to @e notify_connection. + */ + void *notify_connection_cls; + + /** + * Function to call with the full URI at the + * beginning of request processing. May be NULL. + *

    + * Returns the initial pointer to internal state + * kept by the client for the request. + */ + LogCallback uri_log_callback; + + /** + * Closure argument to @e uri_log_callback. + */ + void *uri_log_callback_cls; + + /** + * Function to call when we unescape escape sequences. + */ + UnescapeCallback unescape_callback; + + /** + * Closure for @e unescape_callback. + */ + void *unescape_callback_cls; + +#ifdef HAVE_MESSAGES + /** + * Function for logging error messages (if we + * support error reporting). + */ + void (*custom_error_log) (void *cls, const char *fmt, va_list va); + + /** + * Closure argument to @e custom_error_log. + */ + void *custom_error_log_cls; +#endif + + /** + * Pointer to master daemon (NULL if this is the master) + */ + struct MHD_Daemon *master; + + /** + * Worker daemons (one per thread) + */ + struct MHD_Daemon *worker_pool; + + /** + * Table storing number of connections per IP + */ + void *per_ip_connection_count; + + /** + * Size of the per-connection memory pools. + */ + size_t pool_size; + + /** + * Increment for growth of the per-connection memory pools. + */ + size_t pool_increment; + + /** + * Size of threads created by MHD. + */ + size_t thread_stack_size; + + /** + * Number of worker daemons + */ + unsigned int worker_pool_size; + + /** + * The select thread handle (if we have internal select) + */ + MHD_thread_handle_ID_ pid; + + /** + * Mutex for per-IP connection counts. + */ + MHD_mutex_ per_ip_connection_mutex; + + /** + * Mutex for (modifying) access to the "cleanup", "normal_timeout" and + * "manual_timeout" DLLs. + */ + MHD_mutex_ cleanup_connection_mutex; + + /** + * Listen socket. + */ + MHD_socket listen_fd; + + /** + * Whether to allow/disallow/ignore reuse of listening address. + * The semantics is the following: + * 0: ignore (user did not ask for neither allow/disallow, use SO_REUSEADDR + * except W32) + * >0: allow (use SO_REUSEPORT on most platforms, SO_REUSEADDR on Windows) + * <0: disallow (mostly no action, SO_EXCLUSIVEADDRUSE on Windows or SO_EXCLBIND + * on Solaris) + */ + int listening_address_reuse; + +#ifdef EPOLL_SUPPORT + /** + * File descriptor associated with our epoll loop. + */ + int epoll_fd; + + /** + * true if the listen socket is in the 'epoll' set, + * false if not. + */ + bool listen_socket_in_epoll; + +#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) + /** + * File descriptor associated with the #run_epoll_for_upgrade() loop. + * Only available if #MHD_USE_HTTPS_EPOLL_UPGRADE is set. + */ + int epoll_upgrade_fd; + + /** + * true if @e epoll_upgrade_fd is in the 'epoll' set, + * false if not. + */ + bool upgrade_fd_in_epoll; +#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ + +#endif + + /** + * Inter-thread communication channel. + */ + struct MHD_itc_ itc; + + /** + * Are we shutting down? + */ + volatile bool shutdown; + + /** + * Has this deamon been quiesced via #MHD_quiesce_daemon()? + * If so, we should no longer use the @e listen_fd (including + * removing it from the @e epoll_fd when possible). + */ + volatile bool was_quiesced; + + /** + * Did we hit some system or process-wide resource limit while + * trying to accept() the last time? If so, we don't accept new + * connections until we close an existing one. This effectively + * temporarily lowers the "connection_limit" to the current + * number of connections. + */ + bool at_limit; + + /* + * Do we need to process resuming connections? + */ + bool resuming; + + /** + * 'True' if some data is already waiting to be processed. + * If set to 'true' - zero timeout for select()/poll*() + * is used. + * Should be reset each time before processing connections + * and raised by any connection which require additional + * immediately processing (application does not provide + * data for response, data waiting in TLS buffers etc.) + */ + bool data_already_pending; + + /** + * Number of active parallel connections. + */ + unsigned int connections; + + /** + * Limit on the number of parallel connections. + */ + unsigned int connection_limit; + + /** + * After how many seconds of inactivity should + * connections time out? Zero for no timeout. + */ + time_t connection_timeout; + + /** + * Maximum number of connections per IP, or 0 for + * unlimited. + */ + unsigned int per_ip_connection_limit; + + /** + * Daemon's flags (bitfield). + */ + enum MHD_FLAG options; + + /** + * Listen port. + */ + uint16_t port; + + /** + * Be neutral (zero), strict (1) or permissive (-1) to client. + */ + int strict_for_client; + +#ifdef HTTPS_SUPPORT +#ifdef UPGRADE_SUPPORT + /** + * Head of DLL of upgrade response handles we are processing. + * Used for upgraded TLS connections when thread-per-connection + * is not used. + */ + struct MHD_UpgradeResponseHandle *urh_head; + + /** + * Tail of DLL of upgrade response handles we are processing. + * Used for upgraded TLS connections when thread-per-connection + * is not used. + */ + struct MHD_UpgradeResponseHandle *urh_tail; +#endif /* UPGRADE_SUPPORT */ + + /** + * Desired cipher algorithms. + */ + gnutls_priority_t priority_cache; + + /** + * What kind of credentials are we offering + * for SSL/TLS? + */ + gnutls_credentials_type_t cred_type; + + /** + * Server x509 credentials + */ + gnutls_certificate_credentials_t x509_cred; + + /** + * Diffie-Hellman parameters + */ + gnutls_dh_params_t dh_params; + +#if GNUTLS_VERSION_MAJOR >= 3 + /** + * Function that can be used to obtain the certificate. Needed + * for SNI support. See #MHD_OPTION_HTTPS_CERT_CALLBACK. + */ + gnutls_certificate_retrieve_function2 *cert_callback; +#endif + + /** + * Pointer to our SSL/TLS key (in ASCII) in memory. + */ + const char *https_mem_key; + + /** + * Pointer to our SSL/TLS certificate (in ASCII) in memory. + */ + const char *https_mem_cert; + + /** + * Pointer to 0-terminated HTTPS passphrase in memory. + */ + const char *https_key_password; + + /** + * Pointer to our SSL/TLS certificate authority (in ASCII) in memory. + */ + const char *https_mem_trust; + + /** + * Our Diffie-Hellman parameters in memory. + */ + gnutls_dh_params_t https_mem_dhparams; + + /** + * true if we have initialized @e https_mem_dhparams. + */ + bool have_dhparams; + +#endif /* HTTPS_SUPPORT */ + +#ifdef DAUTH_SUPPORT + + /** + * Character array of random values. + */ + const char *digest_auth_random; + + /** + * An array that contains the map nonce-nc. + */ + struct MHD_NonceNc *nnc; + + /** + * A rw-lock for synchronizing access to @e nnc. + */ + MHD_mutex_ nnc_lock; + + /** + * Size of `digest_auth_random. + */ + size_t digest_auth_rand_size; + + /** + * Size of the nonce-nc array. + */ + unsigned int nonce_nc_size; + +#endif + +#ifdef TCP_FASTOPEN + /** + * The queue size for incoming SYN + DATA packets. + */ + unsigned int fastopen_queue_size; +#endif + + /** + * The size of queue for listen socket. + */ + unsigned int listen_backlog_size; +}; + + +/** + * Insert an element at the head of a DLL. Assumes that head, tail and + * element are structs with prev and next fields. + * + * @param head pointer to the head of the DLL + * @param tail pointer to the tail of the DLL + * @param element element to insert + */ +#define DLL_insert(head,tail,element) do { \ + mhd_assert (NULL == (element)->next); \ + mhd_assert (NULL == (element)->prev); \ + (element)->next = (head); \ + (element)->prev = NULL; \ + if ((tail) == NULL) \ + (tail) = element; \ + else \ + (head)->prev = element; \ + (head) = (element); } while (0) + + +/** + * Remove an element from a DLL. Assumes + * that head, tail and element are structs + * with prev and next fields. + * + * @param head pointer to the head of the DLL + * @param tail pointer to the tail of the DLL + * @param element element to remove + */ +#define DLL_remove(head,tail,element) do { \ + mhd_assert ( (NULL != (element)->next) || ((element) == (tail))); \ + mhd_assert ( (NULL != (element)->prev) || ((element) == (head))); \ + if ((element)->prev == NULL) \ + (head) = (element)->next; \ + else \ + (element)->prev->next = (element)->next; \ + if ((element)->next == NULL) \ + (tail) = (element)->prev; \ + else \ + (element)->next->prev = (element)->prev; \ + (element)->next = NULL; \ + (element)->prev = NULL; } while (0) + + + +/** + * Insert an element at the head of a XDLL. Assumes that head, tail and + * element are structs with prevX and nextX fields. + * + * @param head pointer to the head of the XDLL + * @param tail pointer to the tail of the XDLL + * @param element element to insert + */ +#define XDLL_insert(head,tail,element) do { \ + mhd_assert (NULL == (element)->nextX); \ + mhd_assert (NULL == (element)->prevX); \ + (element)->nextX = (head); \ + (element)->prevX = NULL; \ + if (NULL == (tail)) \ + (tail) = element; \ + else \ + (head)->prevX = element; \ + (head) = (element); } while (0) + + +/** + * Remove an element from a XDLL. Assumes + * that head, tail and element are structs + * with prevX and nextX fields. + * + * @param head pointer to the head of the XDLL + * @param tail pointer to the tail of the XDLL + * @param element element to remove + */ +#define XDLL_remove(head,tail,element) do { \ + mhd_assert ( (NULL != (element)->nextX) || ((element) == (tail))); \ + mhd_assert ( (NULL != (element)->prevX) || ((element) == (head))); \ + if (NULL == (element)->prevX) \ + (head) = (element)->nextX; \ + else \ + (element)->prevX->nextX = (element)->nextX; \ + if (NULL == (element)->nextX) \ + (tail) = (element)->prevX; \ + else \ + (element)->nextX->prevX = (element)->prevX; \ + (element)->nextX = NULL; \ + (element)->prevX = NULL; } while (0) + + +/** + * Insert an element at the head of a EDLL. Assumes that head, tail and + * element are structs with prevE and nextE fields. + * + * @param head pointer to the head of the EDLL + * @param tail pointer to the tail of the EDLL + * @param element element to insert + */ +#define EDLL_insert(head,tail,element) do { \ + (element)->nextE = (head); \ + (element)->prevE = NULL; \ + if ((tail) == NULL) \ + (tail) = element; \ + else \ + (head)->prevE = element; \ + (head) = (element); } while (0) + + +/** + * Remove an element from a EDLL. Assumes + * that head, tail and element are structs + * with prevE and nextE fields. + * + * @param head pointer to the head of the EDLL + * @param tail pointer to the tail of the EDLL + * @param element element to remove + */ +#define EDLL_remove(head,tail,element) do { \ + if ((element)->prevE == NULL) \ + (head) = (element)->nextE; \ + else \ + (element)->prevE->nextE = (element)->nextE; \ + if ((element)->nextE == NULL) \ + (tail) = (element)->prevE; \ + else \ + (element)->nextE->prevE = (element)->prevE; \ + (element)->nextE = NULL; \ + (element)->prevE = NULL; } while (0) + + +/** + * Convert all occurrences of '+' to ' '. + * + * @param arg string that is modified (in place), must be 0-terminated + */ +void +MHD_unescape_plus (char *arg); + + +/** + * Callback invoked when iterating over @a key / @a value + * argument pairs during parsing. + * + * @param connection context of the iteration + * @param key 0-terminated key string, never NULL + * @param value 0-terminated value string, may be NULL + * @param kind origin of the key-value pair + * @return #MHD_YES on success (continue to iterate) + * #MHD_NO to signal failure (and abort iteration) + */ +typedef int +(*MHD_ArgumentIterator_)(struct MHD_Connection *connection, + const char *key, + const char *value, + enum MHD_ValueKind kind); + + +/** + * Parse and unescape the arguments given by the client + * as part of the HTTP request URI. + * + * @param kind header kind to pass to @a cb + * @param connection connection to add headers to + * @param[in,out] args argument URI string (after "?" in URI), + * clobbered in the process! + * @param cb function to call on each key-value pair found + * @param[out] num_headers set to the number of headers found + * @return #MHD_NO on failure (@a cb returned #MHD_NO), + * #MHD_YES for success (parsing succeeded, @a cb always + * returned #MHD_YES) + */ +int +MHD_parse_arguments_ (struct MHD_Connection *connection, + enum MHD_ValueKind kind, + char *args, + MHD_ArgumentIterator_ cb, + unsigned int *num_headers); + + +/** + * Check whether response header contains particular @a token. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param response the response to query + * @param key header name + * @param token the token to find + * @param token_len the length of token, not including optional + * terminating null-character. + * @return true if token is found in specified header, + * false otherwise + */ +bool +MHD_check_response_header_token_ci (const struct MHD_Response *response, + const char *key, + const char *token, + size_t token_len); + +/** + * Check whether response header contains particular static @a tkn. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * @param r the response to query + * @param k header name + * @param tkn the static string of token to find + * @return true if token is found in specified header, + * false otherwise + */ +#define MHD_check_response_header_s_token_ci(r,k,tkn) \ + MHD_check_response_header_token_ci((r),(k),(tkn),MHD_STATICSTR_LEN_(tkn)) + + +/** + * Internal version of #MHD_suspend_connection(). + * + * @remark In thread-per-connection mode: can be called from any thread, + * in any other mode: to be called only from thread that process + * daemon's select()/poll()/etc. + * + * @param connection the connection to suspend + */ +void +internal_suspend_connection_ (struct MHD_Connection *connection); + +#endif diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c new file mode 100644 index 0000000..d92a42e --- /dev/null +++ b/src/microhttpd/md5.c @@ -0,0 +1,264 @@ +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ + +/* Based on OpenBSD modifications */ + +#include "md5.h" +#include "mhd_byteorder.h" + +#define PUT_64BIT_LE(cp, value) do { \ + (cp)[7] = (uint8_t)((value) >> 56); \ + (cp)[6] = (uint8_t)((value) >> 48); \ + (cp)[5] = (uint8_t)((value) >> 40); \ + (cp)[4] = (uint8_t)((value) >> 32); \ + (cp)[3] = (uint8_t)((value) >> 24); \ + (cp)[2] = (uint8_t)((value) >> 16); \ + (cp)[1] = (uint8_t)((value) >> 8); \ + (cp)[0] = (uint8_t)((value)); } while (0) + +#define PUT_32BIT_LE(cp, value) do { \ + (cp)[3] = (uint8_t)((value) >> 24); \ + (cp)[2] = (uint8_t)((value) >> 16); \ + (cp)[1] = (uint8_t)((value) >> 8); \ + (cp)[0] = (uint8_t)((value)); } while (0) + +static uint8_t PADDING[MD5_BLOCK_SIZE] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void +MD5Init(struct MD5Context *ctx) +{ + if (!ctx) + return; + + ctx->count = 0; + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xefcdab89; + ctx->state[2] = 0x98badcfe; + ctx->state[3] = 0x10325476; +} + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void +MD5Update(struct MD5Context *ctx, const unsigned char *input, size_t len) +{ + size_t have, need; + + if (!ctx || !input) + return; + + /* Check how many bytes we already have and how many more we need. */ + have = (size_t)((ctx->count >> 3) & (MD5_BLOCK_SIZE - 1)); + need = MD5_BLOCK_SIZE - have; + + /* Update bitcount */ + ctx->count += (uint64_t)len << 3; + + if (len >= need) + { + if (have != 0) + { + memcpy(ctx->buffer + have, input, need); + MD5Transform(ctx->state, ctx->buffer); + input += need; + len -= need; + have = 0; + } + + /* Process data in MD5_BLOCK_SIZE-byte chunks. */ + while (len >= MD5_BLOCK_SIZE) + { + MD5Transform(ctx->state, input); + input += MD5_BLOCK_SIZE; + len -= MD5_BLOCK_SIZE; + } + } + + /* Handle any remaining bytes of data. */ + if (len != 0) + memcpy(ctx->buffer + have, input, len); +} + +/* + * Pad pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void +MD5Pad(struct MD5Context *ctx) +{ + uint8_t count[8]; + size_t padlen; + + if (!ctx) + return; + + /* Convert count to 8 bytes in little endian order. */ + PUT_64BIT_LE(count, ctx->count); + + /* Pad out to 56 mod 64. */ + padlen = MD5_BLOCK_SIZE - + ((ctx->count >> 3) & (MD5_BLOCK_SIZE - 1)); + if (padlen < 1 + 8) + padlen += MD5_BLOCK_SIZE; + MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ + MD5Update(ctx, count, 8); +} + +/* + * Final wrapup--call MD5Pad, fill in digest and zero out ctx. + */ +void +MD5Final(unsigned char digest[MD5_DIGEST_SIZE], struct MD5Context *ctx) +{ + int i; + + if (!ctx || !digest) + return; + + MD5Pad(ctx); + for (i = 0; i < 4; i++) + PUT_32BIT_LE(digest + i * 4, ctx->state[i]); + + memset(ctx, 0, sizeof(*ctx)); +} + + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f, w, x, y, z, data, s) \ + ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +void +MD5Transform(uint32_t state[4], const uint8_t block[MD5_BLOCK_SIZE]) +{ + uint32_t a, b, c, d, in[MD5_BLOCK_SIZE / 4]; + +#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN + memcpy(in, block, sizeof(in)); +#else + for (a = 0; a < MD5_BLOCK_SIZE / 4; a++) + { + in[a] = (uint32_t)( + (uint32_t)(block[a * 4 + 0]) | + (uint32_t)(block[a * 4 + 1]) << 8 | + (uint32_t)(block[a * 4 + 2]) << 16 | + (uint32_t)(block[a * 4 + 3]) << 24); + } +#endif + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; +} + +/* end of md5.c */ diff --git a/src/microhttpd/md5.h b/src/microhttpd/md5.h new file mode 100644 index 0000000..ad1151e --- /dev/null +++ b/src/microhttpd/md5.h @@ -0,0 +1,64 @@ +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + */ + +#ifndef MHD_MD5_H +#define MHD_MD5_H + +#include "platform.h" + +#define MD5_BLOCK_SIZE 64 +#define MD5_DIGEST_SIZE 16 +#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_SIZE * 2 + 1) + +struct MD5Context +{ + uint32_t state[4]; /* state */ + uint64_t count; /* number of bits, mod 2^64 */ + uint8_t buffer[MD5_BLOCK_SIZE]; /* input buffer */ +}; + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void MD5Init(struct MD5Context *ctx); + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void MD5Update(struct MD5Context *ctx, const unsigned char *input, size_t len); + +/* + * Pad pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void MD5Pad(struct MD5Context *ctx); + +/* + * Final wrapup--call MD5Pad, fill in digest and zero out ctx. + */ +void MD5Final(unsigned char digest[MD5_DIGEST_SIZE], struct MD5Context *ctx); + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +void MD5Transform(uint32_t state[4], const uint8_t block[MD5_BLOCK_SIZE]); + +#endif /* !MHD_MD5_H */ diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c new file mode 100644 index 0000000..bda45e1 --- /dev/null +++ b/src/microhttpd/memorypool.c @@ -0,0 +1,340 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009, 2010 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file memorypool.c + * @brief memory pool + * @author Christian Grothoff + */ +#include "memorypool.h" + +/* define MAP_ANONYMOUS for Mac OS X */ +#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) +#define MAP_ANONYMOUS MAP_ANON +#endif +#ifndef MAP_FAILED +#define MAP_FAILED ((void*)-1) +#endif + +/** + * Align to 2x word size (as GNU libc does). + */ +#define ALIGN_SIZE (2 * sizeof(void*)) + +/** + * Round up 'n' to a multiple of ALIGN_SIZE. + */ +#define ROUND_TO_ALIGN(n) ((n+(ALIGN_SIZE-1)) & (~(ALIGN_SIZE-1))) + + +/** + * Handle for a memory pool. Pools are not reentrant and must not be + * used by multiple threads. + */ +struct MemoryPool +{ + + /** + * Pointer to the pool's memory + */ + char *memory; + + /** + * Size of the pool. + */ + size_t size; + + /** + * Offset of the first unallocated byte. + */ + size_t pos; + + /** + * Offset of the last unallocated byte. + */ + size_t end; + + /** + * #MHD_NO if pool was malloc'ed, #MHD_YES if mmapped (VirtualAlloc'ed for W32). + */ + int is_mmap; +}; + + +/** + * Free the memory given by @a ptr. Calls "free(ptr)". This function + * should be used to free the username returned by + * #MHD_digest_auth_get_username(). + * @note Since v0.9.56 + * + * @param ptr pointer to free. + */ +_MHD_EXTERN void +MHD_free (void *ptr) +{ + free (ptr); +} + + +/** + * Create a memory pool. + * + * @param max maximum size of the pool + * @return NULL on error + */ +struct MemoryPool * +MHD_pool_create (size_t max) +{ + struct MemoryPool *pool; + + pool = malloc (sizeof (struct MemoryPool)); + if (NULL == pool) + return NULL; +#if defined(MAP_ANONYMOUS) || defined(_WIN32) + if (max <= 32 * 1024) + pool->memory = MAP_FAILED; + else +#if defined(MAP_ANONYMOUS) && !defined(_WIN32) + pool->memory = mmap (NULL, + max, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, + -1, + 0); +#elif defined(_WIN32) + pool->memory = VirtualAlloc (NULL, + max, + MEM_COMMIT | MEM_RESERVE, + PAGE_READWRITE); +#endif +#else + pool->memory = MAP_FAILED; +#endif + if ( (MAP_FAILED == pool->memory) || + (NULL == pool->memory)) + { + pool->memory = malloc (max); + if (NULL == pool->memory) + { + free (pool); + return NULL; + } + pool->is_mmap = MHD_NO; + } + else + { + pool->is_mmap = MHD_YES; + } + pool->pos = 0; + pool->end = max; + pool->size = max; + return pool; +} + + +/** + * Destroy a memory pool. + * + * @param pool memory pool to destroy + */ +void +MHD_pool_destroy (struct MemoryPool *pool) +{ + if (NULL == pool) + return; + if (MHD_NO == pool->is_mmap) + free (pool->memory); + else +#if defined(MAP_ANONYMOUS) && !defined(_WIN32) + munmap (pool->memory, + pool->size); +#elif defined(_WIN32) + VirtualFree (pool->memory, + 0, + MEM_RELEASE); +#else + abort (); +#endif + free (pool); +} + + +/** + * Check how much memory is left in the @a pool + * + * @param pool pool to check + * @return number of bytes still available in @a pool + */ +size_t +MHD_pool_get_free (struct MemoryPool *pool) +{ + return (pool->end - pool->pos); +} + + +/** + * Allocate size bytes from the pool. + * + * @param pool memory pool to use for the operation + * @param size number of bytes to allocate + * @param from_end allocate from end of pool (set to #MHD_YES); + * use this for small, persistent allocations that + * will never be reallocated + * @return NULL if the pool cannot support size more + * bytes + */ +void * +MHD_pool_allocate (struct MemoryPool *pool, + size_t size, + int from_end) +{ + void *ret; + size_t asize; + + asize = ROUND_TO_ALIGN (size); + if ( (0 == asize) && (0 != size) ) + return NULL; /* size too close to SIZE_MAX */ + if ( (pool->pos + asize > pool->end) || + (pool->pos + asize < pool->pos)) + return NULL; + if (from_end == MHD_YES) + { + ret = &pool->memory[pool->end - asize]; + pool->end -= asize; + } + else + { + ret = &pool->memory[pool->pos]; + pool->pos += asize; + } + return ret; +} + + +/** + * Reallocate a block of memory obtained from the pool. + * This is particularly efficient when growing or + * shrinking the block that was last (re)allocated. + * If the given block is not the most recently + * (re)allocated block, the memory of the previous + * allocation may be leaked until the pool is + * destroyed (and copying the data maybe required). + * + * @param pool memory pool to use for the operation + * @param old the existing block + * @param old_size the size of the existing block + * @param new_size the new size of the block + * @return new address of the block, or + * NULL if the pool cannot support @a new_size + * bytes (old continues to be valid for @a old_size) + */ +void * +MHD_pool_reallocate (struct MemoryPool *pool, + void *old, + size_t old_size, + size_t new_size) +{ + void *ret; + size_t asize; + + asize = ROUND_TO_ALIGN (new_size); + if ( (0 == asize) && + (0 != new_size) ) + return NULL; /* new_size too close to SIZE_MAX */ + if ( (pool->end < old_size) || + (pool->end < asize) ) + return NULL; /* unsatisfiable or bogus request */ + + if ( (pool->pos >= old_size) && + (&pool->memory[pool->pos - old_size] == old) ) + { + /* was the previous allocation - optimize! */ + if (pool->pos + asize - old_size <= pool->end) + { + /* fits */ + pool->pos += asize - old_size; + if (asize < old_size) /* shrinking - zero again! */ + memset (&pool->memory[pool->pos], + 0, + old_size - asize); + return old; + } + /* does not fit */ + return NULL; + } + if (asize <= old_size) + return old; /* cannot shrink, no need to move */ + if ((pool->pos + asize >= pool->pos) && + (pool->pos + asize <= pool->end)) + { + /* fits */ + ret = &pool->memory[pool->pos]; + if (0 != old_size) + memmove (ret, + old, + old_size); + pool->pos += asize; + return ret; + } + /* does not fit */ + return NULL; +} + + +/** + * Clear all entries from the memory pool except + * for @a keep of the given @a size. The pointer + * returned should be a buffer of @a new_size where + * the first @a copy_bytes are from @a keep. + * + * @param pool memory pool to use for the operation + * @param keep pointer to the entry to keep (maybe NULL) + * @param copy_bytes how many bytes need to be kept at this address + * @param new_size how many bytes should the allocation we return have? + * (should be larger or equal to @a copy_bytes) + * @return addr new address of @a keep (if it had to change) + */ +void * +MHD_pool_reset (struct MemoryPool *pool, + void *keep, + size_t copy_bytes, + size_t new_size) +{ + if ( (NULL != keep) && + (keep != pool->memory) ) + { + if (0 != copy_bytes) + memmove (pool->memory, + keep, + copy_bytes); + keep = pool->memory; + } + pool->end = pool->size; + /* technically not needed, but safer to zero out */ + if (pool->size > copy_bytes) + memset (&pool->memory[copy_bytes], + 0, + pool->size - copy_bytes); + if (NULL != keep) + pool->pos = ROUND_TO_ALIGN (new_size); + return keep; +} + + +/* end of memorypool.c */ diff --git a/src/microhttpd/memorypool.h b/src/microhttpd/memorypool.h new file mode 100644 index 0000000..36136af --- /dev/null +++ b/src/microhttpd/memorypool.h @@ -0,0 +1,130 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file memorypool.h + * @brief memory pool; mostly used for efficient (de)allocation + * for each connection and bounding memory use for each + * request + * @author Christian Grothoff + */ + +#ifndef MEMORYPOOL_H +#define MEMORYPOOL_H + +#include "internal.h" + +/** + * Opaque handle for a memory pool. + * Pools are not reentrant and must not be used + * by multiple threads. + */ +struct MemoryPool; + + +/** + * Create a memory pool. + * + * @param max maximum size of the pool + * @return NULL on error + */ +struct MemoryPool * +MHD_pool_create (size_t max); + + +/** + * Destroy a memory pool. + * + * @param pool memory pool to destroy + */ +void +MHD_pool_destroy (struct MemoryPool *pool); + + +/** + * Allocate size bytes from the pool. + * + * @param pool memory pool to use for the operation + * @param size number of bytes to allocate + * @param from_end allocate from end of pool (set to #MHD_YES); + * use this for small, persistent allocations that + * will never be reallocated + * @return NULL if the pool cannot support size more + * bytes + */ +void * +MHD_pool_allocate (struct MemoryPool *pool, + size_t size, + int from_end); + + +/** + * Reallocate a block of memory obtained from the pool. + * This is particularly efficient when growing or + * shrinking the block that was last (re)allocated. + * If the given block is not the most recently + * (re)allocated block, the memory of the previous + * allocation may be leaked until the pool is + * destroyed (and copying the data maybe required). + * + * @param pool memory pool to use for the operation + * @param old the existing block + * @param old_size the size of the existing block + * @param new_size the new size of the block + * @return new address of the block, or + * NULL if the pool cannot support new_size + * bytes (old continues to be valid for old_size) + */ +void * +MHD_pool_reallocate (struct MemoryPool *pool, + void *old, + size_t old_size, + size_t new_size); + + +/** + * Check how much memory is left in the @a pool + * + * @param pool pool to check + * @return number of bytes still available in @a pool + */ +size_t +MHD_pool_get_free (struct MemoryPool *pool); + + +/** + * Clear all entries from the memory pool except + * for @a keep of the given @a copy_bytes. The pointer + * returned should be a buffer of @a new_size where + * the first @a copy_bytes are from @a keep. + * + * @param pool memory pool to use for the operation + * @param keep pointer to the entry to keep (maybe NULL) + * @param copy_bytes how many bytes need to be kept at this address + * @param new_size how many bytes should the allocation we return have? + * (should be larger or equal to @a copy_bytes) + * @return addr new address of @a keep (if it had to change) + */ +void * +MHD_pool_reset (struct MemoryPool *pool, + void *keep, + size_t copy_bytes, + size_t new_size); + +#endif diff --git a/src/microhttpd/mhd_assert.h b/src/microhttpd/mhd_assert.h new file mode 100644 index 0000000..c720ce5 --- /dev/null +++ b/src/microhttpd/mhd_assert.h @@ -0,0 +1,49 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2017 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. + If not, see . +*/ + +/** + * @file microhttpd/mhd_assert.h + * @brief macros for mhd_assert() + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef MHD_ASSERT_H +#define MHD_ASSERT_H 1 + +#include "mhd_options.h" +#ifdef NDEBUG +# define mhd_assert(ignore) ((void)0) +#else /* _DEBUG */ +# ifdef HAVE_ASSERT +# include +# define mhd_assert(CHK) assert(CHK) +# else /* ! HAVE_ASSERT */ +# include +# include +# define mhd_assert(CHK) \ + do { \ + if (!(CHK)) { \ + fprintf(stderr, "%s:%u Assertion failed: %s\nProgram aborted.\n", \ + __FILE__, (unsigned)__LINE__, #CHK); \ + fflush(stderr); abort(); } \ + } while(0) +# endif /* ! HAVE_ASSERT */ +#endif /* _DEBUG */ + +#endif /* ! MHD_ASSERT_H */ diff --git a/src/microhttpd/mhd_byteorder.h b/src/microhttpd/mhd_byteorder.h new file mode 100644 index 0000000..6668980 --- /dev/null +++ b/src/microhttpd/mhd_byteorder.h @@ -0,0 +1,160 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. + If not, see . +*/ + +/** + * @file microhttpd/mhd_byteorder.h + * @brief macro definitions for host byte order + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef MHD_BYTEORDER_H +#define MHD_BYTEORDER_H + +#include "platform.h" + +#if HAVE_ENDIAN_H +#include +#endif + +#if HAVE_SYS_PARAM_H +#include +#endif + +#if HAVE_MACHINE_ENDIAN_H +#include +#endif + +#if HAVE_SYS_ENDIAN_H +#include +#endif + +#if HAVE_SYS_TYPES_H +#include +#endif + +#if HAVE_SYS_BYTEORDER_H +#include +#endif + +#if HAVE_SYS_MACHINE_H +#include +#endif + +#if HAVE_MACHINE_PARAM_H +#include +#endif + +#if HAVE_SYS_ISA_DEFS_H +#include +#endif + +#define _MHD_BIG_ENDIAN 1234 +#define _MHD_LITTLE_ENDIAN 4321 +#define _MHD_PDP_ENDIAN 2143 + +#if defined(__BYTE_ORDER__) +#if defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN +#elif defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(__ORDER_PDP_ENDIAN__) && __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__ +#define _MHD_BYTE_ORDER _MHD_PDP_ENDIAN +#endif /* __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__ */ +#elif defined(__BYTE_ORDER) +#if defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN +#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN +#elif defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(__PDP_ENDIAN) && __BYTE_ORDER == __PDP_ENDIAN +#define _MHD_BYTE_ORDER _MHD_PDP_ENDIAN +#endif /* __BYTE_ORDER == __PDP_ENDIAN */ +#elif defined (BYTE_ORDER) +#if defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN +#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN +#elif defined(LITTLE_ENDIAN) && BYTE_ORDER == LITTLE_ENDIAN +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(PDP_ENDIAN) && BYTE_ORDER == PDP_ENDIAN +#define _MHD_BYTE_ORDER _MHD_PDP_ENDIAN +#endif /* __BYTE_ORDER == _PDP_ENDIAN */ +#elif defined (_BYTE_ORDER) +#if defined(_BIG_ENDIAN) && _BYTE_ORDER == _BIG_ENDIAN +#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN +#elif defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(_PDP_ENDIAN) && _BYTE_ORDER == _PDP_ENDIAN +#define _MHD_BYTE_ORDER _MHD_PDP_ENDIAN +#endif /* _BYTE_ORDER == _PDP_ENDIAN */ +#endif /* _BYTE_ORDER */ + +#ifndef _MHD_BYTE_ORDER +/* Byte order specification didn't detected in system headers */ +/* Try some guessing */ + +#if (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) || \ + (defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) +/* Seems that we are on big endian platform */ +#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN +#elif (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \ + (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) +/* Seems that we are on little endian platform */ +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || \ + defined(_M_X64) || defined(_M_AMD64) || defined(i386) || defined(__i386) || \ + defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || \ + defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__) +/* x86 family is little endian */ +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ + defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) +/* Looks like we are on ARM/MIPS in big endian mode */ +#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN +#elif defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || \ + defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) +/* Looks like we are on ARM/MIPS in little endian mode */ +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(__m68k__) || defined(M68000) || defined(__hppa__) || defined(__hppa) || \ + defined(__HPPA__) || defined(__370__) || defined(__THW_370__) || \ + defined(__s390__) || defined(__s390x__) || defined(__SYSC_ZARCH__) +/* Looks like we are on big endian platform */ +#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN +#elif defined(__ia64__) || defined(_IA64) || defined(__IA64__) || defined(__ia64) || \ + defined(_M_IA64) || defined(__itanium__) || defined(__bfin__) || \ + defined(__BFIN__) || defined(bfin) || defined(BFIN) +/* Looks like we are on little endian platform */ +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(_WIN32) +/* W32 is always little endian on all platforms */ +#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN +#elif defined(WORDS_BIGENDIAN) +/* Use byte order detected by configure */ +#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN +#endif /* _WIN32 */ + +#endif /* !_MHD_BYTE_ORDER */ + +#ifdef _MHD_BYTE_ORDER +/* Some safety checks */ +#if defined(WORDS_BIGENDIAN) && _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN +#error Configure detected big endian byte order but headers specify different byte order +#elif !defined(WORDS_BIGENDIAN) && _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN +#error Configure did not detect big endian byte order but headers specify big endian byte order +#endif /* !WORDS_BIGENDIAN && _MHD_BYTE_ORDER == _MHD_BIG_ENDIAN */ +#endif /* _MHD_BYTE_ORDER */ + +#endif /* !MHD_BYTEORDER_H */ diff --git a/src/microhttpd/mhd_compat.c b/src/microhttpd/mhd_compat.c new file mode 100644 index 0000000..3abdc36 --- /dev/null +++ b/src/microhttpd/mhd_compat.c @@ -0,0 +1,114 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_compat.c + * @brief Implementation of platform missing functions. + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_compat.h" +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#include +#ifndef HAVE_SNPRINTF +#include +#include +#endif /* HAVE_SNPRINTF */ +#endif /* _WIN32 && !__CYGWIN__ */ + +#ifndef HAVE_CALLOC +#include /* for memset() */ +#endif /* ! HAVE_CALLOC */ + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#ifndef HAVE_SNPRINTF +/* Emulate snprintf function on W32 */ +int +W32_snprintf (char *__restrict s, + size_t n, + const char *__restrict format, + ...) +{ + int ret; + va_list args; + + if ( (0 != n) && + (NULL != s) ) + { + va_start (args, + format); + ret = _vsnprintf (s, + n, + format, + args); + va_end (args); + if ((int)n == ret) + s[n - 1] = 0; + if (ret >= 0) + return ret; + } + va_start(args, + format); + ret = _vscprintf (format, + args); + va_end(args); + if ( (0 <= ret) && + (0 != n) && + (NULL == s) ) + return -1; + + return ret; +} + +#endif /* HAVE_SNPRINTF */ +#endif /* _WIN32 && !__CYGWIN__ */ + +#ifndef HAVE_CALLOC + +#ifdef __has_builtin +# if __has_builtin(__builtin_mul_overflow) +# define MHD_HAVE_NUL_OVERFLOW 1 +# endif +#elif __GNUC__+0 >= 5 +# define MHD_HAVE_NUL_OVERFLOW 1 +#endif /* __GNUC__ >= 5 */ + + +void *MHD_calloc_(size_t nelem, size_t elsize) +{ + size_t alloc_size; + void *ptr; +#ifdef MHD_HAVE_NUL_OVERFLOW + if (__builtin_mul_overflow(nelem, elsize, &alloc_size) || 0 == alloc_size) + return NULL; +#else /* ! MHD_HAVE_NUL_OVERFLOW */ + alloc_size = nelem * elsize; + if (0 == alloc_size || elsize != alloc_size / nelem) + return NULL; +#endif /* ! MHD_HAVE_NUL_OVERFLOW */ + ptr = malloc (alloc_size); + if (NULL == ptr) + return NULL; + memset(ptr, 0, alloc_size); + return ptr; +} +#endif /* ! HAVE_CALLOC */ diff --git a/src/microhttpd/mhd_compat.h b/src/microhttpd/mhd_compat.h new file mode 100644 index 0000000..b4e2c66 --- /dev/null +++ b/src/microhttpd/mhd_compat.h @@ -0,0 +1,87 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_compat.h + * @brief Header for platform missing functions. + * @author Karlson2k (Evgeny Grin) + * + * Provides compatibility for platforms with some missing + * functionality. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + */ + +#ifndef MHD_COMPAT_H +#define MHD_COMPAT_H 1 + +#include "mhd_options.h" +#include +#ifdef HAVE_STRING_H /* for strerror() */ +#include +#endif /* HAVE_STRING_H */ + + /* MHD_strerror_ is strerror */ +#define MHD_strerror_(errnum) strerror((errnum)) + +/* Platform-independent snprintf name */ +#if defined(HAVE_SNPRINTF) +#define MHD_snprintf_ snprintf +#else /* ! HAVE_SNPRINTF */ +#if defined(_WIN32) && ! defined(__CYGWIN__) +/* Emulate snprintf function on W32 */ +int W32_snprintf(char *__restrict s, size_t n, const char *__restrict format, ...); +#define MHD_snprintf_ W32_snprintf +#else /* ! _WIN32 || __CYGWIN__ */ +#error Your platform does not support snprintf() and MHD does not know how to emulate it on your platform. +#endif /* ! _WIN32 || __CYGWIN__ */ +#endif /* ! HAVE_SNPRINTF */ + +#ifdef HAVE_RANDOM +/** + * Generate pseudo random number at least 30-bit wide. + * @return pseudo random number at least 30-bit wide. + */ +#define MHD_random_() random() +#else /* HAVE_RANDOM */ +#ifdef HAVE_RAND +/** + * Generate pseudo random number at least 30-bit wide. + * @return pseudo random number at least 30-bit wide. + */ +#define MHD_random_() ( (((long)rand()) << 15) + (long)rand() ) +#endif /* HAVE_RAND */ +#endif /* HAVE_RANDOM */ + +#ifdef HAVE_CALLOC +/** + * MHD_calloc_ is platform-independent calloc() + */ +#define MHD_calloc_(n,s) calloc((n),(s)) +#else /* ! HAVE_CALLOC */ +/** + * MHD_calloc_ is platform-independent calloc() + */ +void *MHD_calloc_(size_t nelem, size_t elsize); +#endif /* ! HAVE_CALLOC */ + +#endif /* MHD_COMPAT_H */ diff --git a/src/microhttpd/mhd_itc.c b/src/microhttpd/mhd_itc.c new file mode 100644 index 0000000..8aeee57 --- /dev/null +++ b/src/microhttpd/mhd_itc.c @@ -0,0 +1,70 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_itc.c + * @brief Implementation of inter-thread communication functions + * @author Karlson2k (Evgeny Grin) + * @author Christian Grothoff + */ + +#include "mhd_itc.h" +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#include +#include "internal.h" + + +#if defined(_MHD_ITC_PIPE) +#if !defined(_WIN32) || defined(__CYGWIN__) + +#ifndef HAVE_PIPE2_FUNC +/** + * Change itc FD options to be non-blocking. + * + * @param itc the inter-thread communication primitive to manipulate + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_itc_nonblocking_ (struct MHD_itc_ itc) +{ + unsigned int i; + + for (i=0;i<2;i++) + { + int flags; + + flags = fcntl (itc.fd[i], + F_GETFL); + if (-1 == flags) + return 0; + + if ( ((flags | O_NONBLOCK) != flags) && + (0 != fcntl (itc.fd[i], + F_SETFL, + flags | O_NONBLOCK)) ) + return 0; + } + return !0; +} +#endif /* ! HAVE_PIPE2_FUNC */ +#endif /* !_WIN32 || __CYGWIN__ */ +#endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */ diff --git a/src/microhttpd/mhd_itc.h b/src/microhttpd/mhd_itc.h new file mode 100644 index 0000000..7bfccf3 --- /dev/null +++ b/src/microhttpd/mhd_itc.h @@ -0,0 +1,361 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_itc.h + * @brief Header for platform-independent inter-thread communication + * @author Karlson2k (Evgeny Grin) + * @author Christian Grothoff + * + * Provides basic abstraction for inter-thread communication. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + */ +#ifndef MHD_ITC_H +#define MHD_ITC_H 1 +#include "mhd_itc_types.h" + +#include + +#ifndef MHD_PANIC +# include +# include +/* Simple implementation of MHD_PANIC, to be used outside lib */ +# define MHD_PANIC(msg) do { fprintf (stderr, \ + "Abnormal termination at %d line in file %s: %s\n", \ + (int)__LINE__, __FILE__, msg); abort();} while(0) +#endif /* ! MHD_PANIC */ + +#if defined(_MHD_ITC_EVENTFD) + +/* **************** Optimized GNU/Linux ITC implementation by eventfd ********** */ +#include +#include /* for uint64_t */ +#ifdef HAVE_UNISTD_H +#include /* for read(), write(), errno */ +#endif /* HAVE_UNISTD_H */ +#ifdef HAVE_STRING_H +#include /* for strerror() */ +#endif + + +/** + * Initialise ITC by generating eventFD + * @param itc the itc to initialise + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_init_(itc) (-1 != ((itc).fd = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK))) + +/** + * Get description string of last errno for itc operations. + */ +#define MHD_itc_last_strerror_() strerror(errno) + +/** + * Internal static const helper for MHD_itc_activate_() + */ +static const uint64_t _MHD_itc_wr_data = 1; + +/** + * Activate signal on @a itc + * @param itc the itc to use + * @param str ignored + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_activate_(itc, str) \ + ((write((itc).fd, (const void*)&_MHD_itc_wr_data, 8) > 0) || (EAGAIN == errno)) + +/** + * Return read FD of @a itc which can be used for poll(), select() etc. + * @param itc the itc to get FD + * @return FD of read side + */ +#define MHD_itc_r_fd_(itc) ((itc).fd) + +/** + * Return write FD of @a itc + * @param itc the itc to get FD + * @return FD of write side + */ +#define MHD_itc_w_fd_(itc) ((itc).fd) + +/** + * Clear signaled state on @a itc + * @param itc the itc to clear + */ +#define MHD_itc_clear_(itc) \ + do { uint64_t __b; int __r; \ + __r = read((itc).fd, &__b, sizeof(__b)); \ + (void)__r; } while(0) + +/** + * Destroy previously initialised ITC + * @param itc the itc to destroy + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_destroy_(itc) ((0 != close ((itc).fd)) || (EBADF != errno)) + +/** + * Check whether ITC has valid value. + * + * Macro check whether @a itc value is valid (allowed), + * macro does not check whether @a itc was really initialised. + * @param itc the itc to check + * @return boolean true if @a itc has valid value, + * boolean false otherwise. + */ +#define MHD_ITC_IS_VALID_(itc) (-1 != ((itc).fd)) + +/** + * Set @a itc to invalid value. + * @param itc the itc to set + */ +#define MHD_itc_set_invalid_(itc) ((itc).fd = -1) + + +#elif defined(_MHD_ITC_PIPE) + +/* **************** Standard UNIX ITC implementation by pipe ********** */ + +#if defined(HAVE_PIPE2_FUNC) && defined(HAVE_FCNTL_H) +# include /* for O_CLOEXEC, O_NONBLOCK */ +#endif /* HAVE_PIPE2_FUNC && HAVE_FCNTL_H */ +#ifdef HAVE_UNISTD_H +#include /* for read(), write(), errno */ +#endif /* HAVE_UNISTD_H */ +#ifdef HAVE_STRING_H +#include /* for strerror() */ +#endif + + +/** + * Initialise ITC by generating pipe + * @param itc the itc to initialise + * @return non-zero if succeeded, zero otherwise + */ +#ifdef HAVE_PIPE2_FUNC +# define MHD_itc_init_(itc) (!pipe2((itc).fd, O_CLOEXEC | O_NONBLOCK)) +#else /* ! HAVE_PIPE2_FUNC */ +# define MHD_itc_init_(itc) \ + ( (!pipe((itc).fd)) ? \ + (MHD_itc_nonblocking_((itc)) ? \ + (!0) : \ + (MHD_itc_destroy_((itc)), 0) ) \ + : (0) ) +#endif /* ! HAVE_PIPE2_FUNC */ + +/** + * Get description string of last errno for itc operations. + */ +#define MHD_itc_last_strerror_() strerror(errno) + +/** + * Activate signal on @a itc + * @param itc the itc to use + * @param str one-symbol string, useful only for strace debug + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_activate_(itc, str) \ + ((write((itc).fd[1], (const void*)(str), 1) > 0) || (EAGAIN == errno)) + + +/** + * Return read FD of @a itc which can be used for poll(), select() etc. + * @param itc the itc to get FD + * @return FD of read side + */ +#define MHD_itc_r_fd_(itc) ((itc).fd[0]) + +/** + * Return write FD of @a itc + * @param itc the itc to get FD + * @return FD of write side + */ +#define MHD_itc_w_fd_(itc) ((itc).fd[1]) + +/** + * Clear signaled state on @a itc + * @param itc the itc to clear + */ +#define MHD_itc_clear_(itc) do \ + { long __b; \ + while(0 < read((itc).fd[0], &__b, sizeof(__b))) \ + {} } while(0) + +/** + * Destroy previously initialised ITC + * @param itc the itc to destroy + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_destroy_(itc) \ + ( (0 == close ((itc).fd[0])) ? \ + (0 == close ((itc).fd[1])) : \ + ((close ((itc).fd[1])), 0) ) + +/** + * Check whether ITC has valid value. + * + * Macro check whether @a itc value is valid (allowed), + * macro does not check whether @a itc was really initialised. + * @param itc the itc to check + * @return boolean true if @a itc has valid value, + * boolean false otherwise. + */ +#define MHD_ITC_IS_VALID_(itc) (-1 != (itc).fd[0]) + +/** + * Set @a itc to invalid value. + * @param itc the itc to set + */ +#define MHD_itc_set_invalid_(itc) ((itc).fd[0] = (itc).fd[1] = -1) + +#ifndef HAVE_PIPE2_FUNC + /** + * Change itc FD options to be non-blocking. + * + * @param fd the FD to manipulate + * @return non-zero if succeeded, zero otherwise + */ + int + MHD_itc_nonblocking_ (struct MHD_itc_ itc); +#endif /* ! HAVE_PIPE2_FUNC */ + + +#elif defined(_MHD_ITC_SOCKETPAIR) + +/* **************** ITC implementation by socket pair ********** */ + +#include "mhd_sockets.h" + + +/** + * Initialise ITC by generating socketpair + * @param itc the itc to initialise + * @return non-zero if succeeded, zero otherwise + */ +#ifdef MHD_socket_pair_nblk_ +# define MHD_itc_init_(itc) MHD_socket_pair_nblk_((itc).sk) +#else /* ! MHD_socket_pair_nblk_ */ +# define MHD_itc_init_(itc) \ + (MHD_socket_pair_((itc).sk) ? \ + (MHD_itc_nonblocking_((itc)) ? \ + (!0) : \ + (MHD_itc_destroy_((itc)), 0) ) \ + : (0)) +#endif /* ! MHD_socket_pair_nblk_ */ + +/** + * Get description string of last error for itc operations. + */ +#define MHD_itc_last_strerror_() MHD_socket_last_strerr_() + +/** + * Activate signal on @a itc + * @param itc the itc to use + * @param str one-symbol string, useful only for strace debug + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_activate_(itc, str) \ + ((MHD_send_((itc).sk[1], (str), 1) > 0) || \ + (MHD_SCKT_ERR_IS_EAGAIN_(MHD_socket_get_error_()))) + +/** + * Return read FD of @a itc which can be used for poll(), select() etc. + * @param itc the itc to get FD + * @return FD of read side + */ +#define MHD_itc_r_fd_(itc) ((itc).sk[0]) + +/** + * Return write FD of @a itc + * @param itc the itc to get FD + * @return FD of write side + */ +#define MHD_itc_w_fd_(itc) ((itc).sk[1]) + +/** + * Clear signaled state on @a itc + * @param itc the itc to clear + */ +#define MHD_itc_clear_(itc) do \ + { long __b; \ + while(0 < recv((itc).sk[0], \ + (char*)&__b, \ + sizeof(__b), 0)) \ + {} } while(0) + +/** + * Destroy previously initialised ITC + * @param itc the itc to destroy + * @return non-zero if succeeded, zero otherwise + */ +#define MHD_itc_destroy_(itc) \ + ( MHD_socket_close_((itc).sk[0]) ? \ + MHD_socket_close_((itc).sk[1]) : \ + ((void)MHD_socket_close_((itc).sk[1]), 0) ) + + +/** + * Check whether ITC has valid value. + * + * Macro check whether @a itc value is valid (allowed), + * macro does not check whether @a itc was really initialised. + * @param itc the itc to check + * @return boolean true if @a itc has valid value, + * boolean false otherwise. + */ +#define MHD_ITC_IS_VALID_(itc) (MHD_INVALID_SOCKET != (itc).sk[0]) + +/** + * Set @a itc to invalid value. + * @param itc the itc to set + */ +#define MHD_itc_set_invalid_(itc) ((itc).sk[0] = (itc).sk[1] = MHD_INVALID_SOCKET) + +#ifndef MHD_socket_pair_nblk_ +# define MHD_itc_nonblocking_(pip) (MHD_socket_nonblocking_((pip).sk[0]) && MHD_socket_nonblocking_((pip).sk[1])) +#endif /* ! MHD_socket_pair_nblk_ */ + +#endif /* _MHD_ITC_SOCKETPAIR */ + +/** + * Destroy previously initialised ITC and abort execution + * if error is detected. + * @param itc the itc to destroy + */ +#define MHD_itc_destroy_chk_(itc) do { \ + if (!MHD_itc_destroy_(itc)) \ + MHD_PANIC(_("Failed to destroy ITC.\n")); \ + } while(0) + +/** + * Check whether ITC has invalid value. + * + * Macro check whether @a itc value is invalid, + * macro does not check whether @a itc was destroyed. + * @param itc the itc to check + * @return boolean true if @a itc has invalid value, + * boolean false otherwise. + */ +#define MHD_ITC_IS_INVALID_(itc) (! MHD_ITC_IS_VALID_(itc)) + +#endif /* MHD_ITC_H */ diff --git a/src/microhttpd/mhd_itc_types.h b/src/microhttpd/mhd_itc_types.h new file mode 100644 index 0000000..04966d3 --- /dev/null +++ b/src/microhttpd/mhd_itc_types.h @@ -0,0 +1,77 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin), Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_itc_types.h + * @brief Types for platform-independent inter-thread communication + * @author Karlson2k (Evgeny Grin) + * @author Christian Grothoff + * + * Provides basic types for inter-thread communication. + * Designed to be included by other headers. + */ +#ifndef MHD_ITC_TYPES_H +#define MHD_ITC_TYPES_H 1 +#include "mhd_options.h" + +/* Force socketpair on native W32 */ +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(_MHD_ITC_SOCKETPAIR) +#error _MHD_ITC_SOCKETPAIR is not defined on naitive W32 platform +#endif /* _WIN32 && !__CYGWIN__ && !_MHD_ITC_SOCKETPAIR */ + +#if defined(_MHD_ITC_EVENTFD) +/* **************** Optimized GNU/Linux ITC implementation by eventfd ********** */ + +/** + * Data type for a MHD ITC. + */ +struct MHD_itc_ +{ + int fd; +}; + +#elif defined(_MHD_ITC_PIPE) +/* **************** Standard UNIX ITC implementation by pipe ********** */ + +/** + * Data type for a MHD ITC. + */ +struct MHD_itc_ +{ + int fd[2]; +}; + + +#elif defined(_MHD_ITC_SOCKETPAIR) +/* **************** ITC implementation by socket pair ********** */ + +#include "mhd_sockets.h" + +/** + * Data type for a MHD ITC. + */ +struct MHD_itc_ +{ + MHD_socket sk[2]; +}; + +#endif /* _MHD_ITC_SOCKETPAIR */ + +#endif /* ! MHD_ITC_TYPES_H */ diff --git a/src/microhttpd/mhd_limits.h b/src/microhttpd/mhd_limits.h new file mode 100644 index 0000000..1b0f5d7 --- /dev/null +++ b/src/microhttpd/mhd_limits.h @@ -0,0 +1,146 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/mhd_limits.h + * @brief limits values definitions + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef MHD_LIMITS_H +#define MHD_LIMITS_H + +#include "platform.h" + +#ifdef HAVE_LIMITS_H +#include +#endif /* HAVE_LIMITS_H */ + +#define MHD_UNSIGNED_TYPE_MAX_(type) ((type)-1) +/* Assume 8 bits per byte, no padding bits. */ +#define MHD_SIGNED_TYPE_MAX_(type) \ + ( (type)((( ((type)1) << (sizeof(type)*8 - 2)) - 1)*2 + 1) ) +#define MHD_TYPE_IS_SIGNED_(type) (((type)0)>((type)-1)) + +#ifndef UINT_MAX +#ifdef __UINT_MAX__ +#define UINT_MAX __UINT_MAX__ +#else /* ! __UINT_MAX__ */ +#define UINT_MAX MHD_UNSIGNED_TYPE_MAX_(unsigned int) +#endif /* ! __UINT_MAX__ */ +#endif /* !UINT_MAX */ + +#ifndef LONG_MAX +#ifdef __LONG_MAX__ +#define LONG_MAX __LONG_MAX__ +#else /* ! __LONG_MAX__ */ +#define LONG_MAX MHD_SIGNED_TYPE_MAX(long) +#endif /* ! __LONG_MAX__ */ +#endif /* !OFF_T_MAX */ + +#ifndef ULLONG_MAX +#define ULLONG_MAX MHD_UNSIGNED_TYPE_MAX_(MHD_UNSIGNED_LONG_LONG) +#endif /* !ULLONG_MAX */ + +#ifndef INT32_MAX +#ifdef __INT32_MAX__ +#define INT32_MAX __INT32_MAX__ +#else /* ! __INT32_MAX__ */ +#define INT32_MAX ((int32_t)0x7FFFFFFF) +#endif /* ! __INT32_MAX__ */ +#endif /* !INT32_MAX */ + +#ifndef UINT32_MAX +#ifdef __UINT32_MAX__ +#define UINT32_MAX __UINT32_MAX__ +#else /* ! __UINT32_MAX__ */ +#define UINT32_MAX ((int32_t)0xFFFFFFFF) +#endif /* ! __UINT32_MAX__ */ +#endif /* !UINT32_MAX */ + +#ifndef UINT64_MAX +#ifdef __UINT64_MAX__ +#define UINT64_MAX __UINT64_MAX__ +#else /* ! __UINT64_MAX__ */ +#define UINT64_MAX ((uint64_t)0xFFFFFFFFFFFFFFFF) +#endif /* ! __UINT64_MAX__ */ +#endif /* !UINT64_MAX */ + +#ifndef INT64_MAX +#ifdef __INT64_MAX__ +#define INT64_MAX __INT64_MAX__ +#else /* ! __INT64_MAX__ */ +#define INT64_MAX ((int64_t)0x7FFFFFFFFFFFFFFF) +#endif /* ! __UINT64_MAX__ */ +#endif /* !INT64_MAX */ + +#ifndef SIZE_MAX +#ifdef __SIZE_MAX__ +#define SIZE_MAX __SIZE_MAX__ +#elif defined(UINTPTR_MAX) +#define SIZE_MAX UINTPTR_MAX +#else /* ! __SIZE_MAX__ */ +#define SIZE_MAX MHD_UNSIGNED_TYPE_MAX_(size_t) +#endif /* ! __SIZE_MAX__ */ +#endif /* !SIZE_MAX */ + +#ifndef SSIZE_MAX +#ifdef __SSIZE_MAX__ +#define SSIZE_MAX __SSIZE_MAX__ +#elif defined(PTRDIFF_MAX) +#define SSIZE_MAX PTRDIFF_MAX +#elif defined(INTPTR_MAX) +#define SSIZE_MAX INTPTR_MAX +#else +#define SSIZE_MAN MHD_SIGNED_TYPE_MAX_(ssize_t) +#endif +#endif /* ! SSIZE_MAX */ + +#ifndef OFF_T_MAX +#ifdef OFF_MAX +#define OFF_T_MAX OFF_MAX +#elif defined(OFFT_MAX) +#define OFF_T_MAX OFFT_MAX +#elif defined(__APPLE__) && defined(__MACH__) +#define OFF_T_MAX INT64_MAX +#else +#define OFF_T_MAX MHD_SIGNED_TYPE_MAX_(off_t) +#endif +#endif /* !OFF_T_MAX */ + +#if defined(_LARGEFILE64_SOURCE) && !defined(OFF64_T_MAX) +#define OFF64_T_MAX MHD_SIGNED_TYPE_MAX_(uint64_t) +#endif /* _LARGEFILE64_SOURCE && !OFF64_T_MAX */ + +#ifndef TIME_T_MAX +#define TIME_T_MAX ((time_t) \ + ( MHD_TYPE_IS_SIGNED_(time_t) ? \ + MHD_SIGNED_TYPE_MAX_(time_t) : \ + MHD_UNSIGNED_TYPE_MAX_(time_t))) +#endif /* !TIME_T_MAX */ + +#ifndef TIMEVAL_TV_SEC_MAX +#ifndef _WIN32 +#define TIMEVAL_TV_SEC_MAX TIME_T_MAX +#else /* _WIN32 */ +#define TIMEVAL_TV_SEC_MAX LONG_MAX +#endif /* _WIN32 */ +#endif /* !TIMEVAL_TV_SEC_MAX */ + +#endif /* MHD_LIMITS_H */ diff --git a/src/microhttpd/mhd_locks.h b/src/microhttpd/mhd_locks.h new file mode 100644 index 0000000..21db56c --- /dev/null +++ b/src/microhttpd/mhd_locks.h @@ -0,0 +1,183 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_locks.h + * @brief Header for platform-independent locks abstraction + * @author Karlson2k (Evgeny Grin) + * @author Christian Grothoff + * + * Provides basic abstraction for locks/mutex. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + * + * @warning Unlike pthread functions, most of functions return + * nonzero on success. + */ + +#ifndef MHD_LOCKS_H +#define MHD_LOCKS_H 1 + +#include "mhd_options.h" + +#if defined(MHD_USE_W32_THREADS) +# define MHD_W32_MUTEX_ 1 +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif /* !WIN32_LEAN_AND_MEAN */ +# include +#elif defined(HAVE_PTHREAD_H) && defined(MHD_USE_POSIX_THREADS) +# define MHD_PTHREAD_MUTEX_ 1 +# undef HAVE_CONFIG_H +# include +# define HAVE_CONFIG_H 1 +#else +# error No base mutex API is available. +#endif + +#ifndef MHD_PANIC +# include +# include +/* Simple implementation of MHD_PANIC, to be used outside lib */ +# define MHD_PANIC(msg) do { fprintf (stderr, \ + "Abnormal termination at %d line in file %s: %s\n", \ + (int)__LINE__, __FILE__, msg); abort();} while(0) +#endif /* ! MHD_PANIC */ + +#if defined(MHD_PTHREAD_MUTEX_) + typedef pthread_mutex_t MHD_mutex_; +#elif defined(MHD_W32_MUTEX_) + typedef CRITICAL_SECTION MHD_mutex_; +#endif + +#if defined(MHD_PTHREAD_MUTEX_) +/** + * Initialise new mutex. + * @param pmutex pointer to the mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_init_(pmutex) (!(pthread_mutex_init((pmutex), NULL))) +#elif defined(MHD_W32_MUTEX_) +/** + * Initialise new mutex. + * @param pmutex pointer to mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_init_(pmutex) (InitializeCriticalSectionAndSpinCount((pmutex),16)) +#endif + +#if defined(MHD_PTHREAD_MUTEX_) +# if defined(PTHREAD_MUTEX_INITIALIZER) +/** + * Define static mutex and statically initialise it. + */ +# define MHD_MUTEX_STATIC_DEFN_INIT_(m) static MHD_mutex_ m = PTHREAD_MUTEX_INITIALIZER +# endif /* PTHREAD_MUTEX_INITIALIZER */ +#endif + +#if defined(MHD_PTHREAD_MUTEX_) +/** + * Destroy previously initialised mutex. + * @param pmutex pointer to mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_destroy_(pmutex) (!(pthread_mutex_destroy((pmutex)))) +#elif defined(MHD_W32_MUTEX_) +/** + * Destroy previously initialised mutex. + * @param pmutex pointer to mutex + * @return Always nonzero + */ +#define MHD_mutex_destroy_(pmutex) (DeleteCriticalSection((pmutex)), !0) +#endif + +/** + * Destroy previously initialised mutex and abort execution + * if error is detected. + * @param pmutex pointer to mutex + */ +#define MHD_mutex_destroy_chk_(pmutex) do { \ + if (!MHD_mutex_destroy_(pmutex)) \ + MHD_PANIC(_("Failed to destroy mutex.\n")); \ + } while(0) + + +#if defined(MHD_PTHREAD_MUTEX_) +/** + * Acquire lock on previously initialised mutex. + * If mutex was already locked by other thread, function + * blocks until mutex becomes available. + * @param pmutex pointer to mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_lock_(pmutex) (!(pthread_mutex_lock((pmutex)))) +#elif defined(MHD_W32_MUTEX_) +/** + * Acquire lock on previously initialised mutex. + * If mutex was already locked by other thread, function + * blocks until mutex becomes available. + * @param pmutex pointer to mutex + * @return Always nonzero + */ +#define MHD_mutex_lock_(pmutex) (EnterCriticalSection((pmutex)), !0) +#endif + +/** + * Acquire lock on previously initialised mutex. + * If mutex was already locked by other thread, function + * blocks until mutex becomes available. + * If error is detected, execution will be aborted. + * @param pmutex pointer to mutex + */ +#define MHD_mutex_lock_chk_(pmutex) do { \ + if (!MHD_mutex_lock_(pmutex)) \ + MHD_PANIC(_("Failed to lock mutex.\n")); \ + } while(0) + +#if defined(MHD_PTHREAD_MUTEX_) +/** + * Unlock previously initialised and locked mutex. + * @param pmutex pointer to mutex + * @return nonzero on success, zero otherwise + */ +#define MHD_mutex_unlock_(pmutex) (!(pthread_mutex_unlock((pmutex)))) +#elif defined(MHD_W32_MUTEX_) +/** + * Unlock previously initialised and locked mutex. + * @param pmutex pointer to mutex + * @return Always nonzero + */ +#define MHD_mutex_unlock_(pmutex) (LeaveCriticalSection((pmutex)), !0) +#endif + +/** + * Unlock previously initialised and locked mutex. + * If error is detected, execution will be aborted. + * @param pmutex pointer to mutex + */ +#define MHD_mutex_unlock_chk_(pmutex) do { \ + if (!MHD_mutex_unlock_(pmutex)) \ + MHD_PANIC(_("Failed to unlock mutex.\n")); \ + } while(0) + + +#endif /* ! MHD_LOCKS_H */ diff --git a/src/microhttpd/mhd_mono_clock.c b/src/microhttpd/mhd_mono_clock.c new file mode 100644 index 0000000..97dbfb9 --- /dev/null +++ b/src/microhttpd/mhd_mono_clock.c @@ -0,0 +1,377 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/mhd_mono_clock.h + * @brief internal monotonic clock functions implementations + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_mono_clock.h" + +#if defined(_WIN32) && ! defined(__CYGWIN__) && defined(HAVE_CLOCK_GETTIME) +/* Prefer native clock source over wrappers */ +#undef HAVE_CLOCK_GETTIME +#endif /* _WIN32 && ! __CYGWIN__ && HAVE_CLOCK_GETTIME */ + +#ifdef HAVE_CLOCK_GETTIME +#include +#endif /* HAVE_CLOCK_GETTIME */ + +#ifdef HAVE_GETHRTIME +#ifdef HAVE_SYS_TIME_H +/* Solaris defines gethrtime() in sys/time.h */ +#include +#endif /* HAVE_SYS_TIME_H */ +#ifdef HAVE_TIME_H +/* HP-UX defines gethrtime() in time.h */ +#include +#endif /* HAVE_TIME_H */ +#endif /* HAVE_GETHRTIME */ + +#ifdef HAVE_CLOCK_GET_TIME +#include +/* for host_get_clock_service(), mach_host_self(), mach_task_self() */ +#include +/* for clock_get_time() */ + +#define _MHD_INVALID_CLOCK_SERV ((clock_serv_t) -2) + +static clock_serv_t mono_clock_service = _MHD_INVALID_CLOCK_SERV; +#endif /* HAVE_CLOCK_GET_TIME */ + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +/* Do not include unneeded parts of W32 headers. */ +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#include +#endif /* _WIN32 */ + +#ifdef HAVE_CLOCK_GETTIME +#ifdef CLOCK_REALTIME +#define _MHD_UNWANTED_CLOCK CLOCK_REALTIME +#else /* !CLOCK_REALTIME */ +#define _MHD_UNWANTED_CLOCK ((clockid_t) -2) +#endif /* !CLOCK_REALTIME */ + +static clockid_t mono_clock_id = _MHD_UNWANTED_CLOCK; +#endif /* HAVE_CLOCK_GETTIME */ + +/* sync clocks; reduce chance of value wrap */ +#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_GET_TIME) || defined(HAVE_GETHRTIME) +static time_t mono_clock_start; +#endif /* HAVE_CLOCK_GETTIME || HAVE_CLOCK_GET_TIME || HAVE_GETHRTIME */ +static time_t sys_clock_start; +#ifdef HAVE_GETHRTIME +static hrtime_t hrtime_start; +#endif /* HAVE_GETHRTIME */ +#ifdef _WIN32 +#if _WIN32_WINNT >= 0x0600 +static uint64_t tick_start; +#else /* _WIN32_WINNT < 0x0600 */ +static int64_t perf_freq; +static int64_t perf_start; +#endif /* _WIN32_WINNT < 0x0600 */ +#endif /* _WIN32 */ + + + +/** + * Type of monotonic clock source + */ +enum _MHD_mono_clock_source +{ + /** + * No monotonic clock + */ + _MHD_CLOCK_NO_SOURCE = 0, + + /** + * clock_gettime() with specific clock + */ + _MHD_CLOCK_GETTIME, + + /** + * clock_get_time() with specific clock service + */ + _MHD_CLOCK_GET_TIME, + + /** + * gethrtime() / 1000000000 + */ + _MHD_CLOCK_GETHRTIME, + + /** + * GetTickCount64() / 1000 + */ + _MHD_CLOCK_GETTICKCOUNT64, + + /** + * QueryPerformanceCounter() / QueryPerformanceFrequency() + */ + _MHD_CLOCK_PERFCOUNTER +}; + + +/** + * Initialise monotonic seconds counter. + */ +void +MHD_monotonic_sec_counter_init (void) +{ +#ifdef HAVE_CLOCK_GET_TIME + mach_timespec_t cur_time; +#endif /* HAVE_CLOCK_GET_TIME */ + enum _MHD_mono_clock_source mono_clock_source = _MHD_CLOCK_NO_SOURCE; +#ifdef HAVE_CLOCK_GETTIME + struct timespec ts; + + mono_clock_id = _MHD_UNWANTED_CLOCK; +#endif /* HAVE_CLOCK_GETTIME */ +#ifdef HAVE_CLOCK_GET_TIME + mono_clock_service = _MHD_INVALID_CLOCK_SERV; +#endif /* HAVE_CLOCK_GET_TIME */ + + /* just a little syntactic trick to get the + various following ifdef's to work out nicely */ + if (0) + { + } + else +#ifdef HAVE_CLOCK_GETTIME +#ifdef CLOCK_MONOTONIC_COARSE + /* Linux-specific fast value-getting clock */ + /* Can be affected by frequency adjustment and don't count time in suspend, */ + /* but preferred since it's fast */ + if (0 == clock_gettime (CLOCK_MONOTONIC_COARSE, + &ts)) + { + mono_clock_id = CLOCK_MONOTONIC_COARSE; + mono_clock_start = ts.tv_sec; + mono_clock_source = _MHD_CLOCK_GETTIME; + } + else +#endif /* CLOCK_MONOTONIC_COARSE */ +#ifdef CLOCK_MONOTONIC_FAST + /* FreeBSD/DragonFly fast value-getting clock */ + /* Can be affected by frequency adjustment, but preferred since it's fast */ + if (0 == clock_gettime (CLOCK_MONOTONIC_FAST, + &ts)) + { + mono_clock_id = CLOCK_MONOTONIC_FAST; + mono_clock_start = ts.tv_sec; + mono_clock_source = _MHD_CLOCK_GETTIME; + } + else +#endif /* CLOCK_MONOTONIC_COARSE */ +#ifdef CLOCK_MONOTONIC_RAW + /* Linux-specific clock */ + /* Not affected by frequency adjustment, but don't count time in suspend */ + if (0 == clock_gettime (CLOCK_MONOTONIC_RAW, + &ts)) + { + mono_clock_id = CLOCK_MONOTONIC_RAW; + mono_clock_start = ts.tv_sec; + mono_clock_source = _MHD_CLOCK_GETTIME; + } + else +#endif /* CLOCK_MONOTONIC_RAW */ +#ifdef CLOCK_BOOTTIME + /* Linux-specific clock */ + /* Count time in suspend so it's real monotonic on Linux, */ + /* but can be slower value-getting than other clocks */ + if (0 == clock_gettime (CLOCK_BOOTTIME, + &ts)) + { + mono_clock_id = CLOCK_BOOTTIME; + mono_clock_start = ts.tv_sec; + mono_clock_source = _MHD_CLOCK_GETTIME; + } + else +#endif /* CLOCK_BOOTTIME */ +#ifdef CLOCK_MONOTONIC + /* Monotonic clock */ + /* Widely supported, may be affected by frequency adjustment */ + /* On Linux it's not truly monotonic as it doesn't count time in suspend */ + if (0 == clock_gettime (CLOCK_MONOTONIC, + &ts)) + { + mono_clock_id = CLOCK_MONOTONIC; + mono_clock_start = ts.tv_sec; + mono_clock_source = _MHD_CLOCK_GETTIME; + } + else +#endif /* CLOCK_BOOTTIME */ +#endif /* HAVE_CLOCK_GETTIME */ +#ifdef HAVE_CLOCK_GET_TIME + /* Darwin-specific monotonic clock */ + /* Should be monotonic as clock_set_time function always unconditionally */ + /* failed on latest kernels */ + if ( (KERN_SUCCESS == host_get_clock_service (mach_host_self(), + SYSTEM_CLOCK, + &mono_clock_service)) && + (KERN_SUCCESS == clock_get_time (mono_clock_service, + &cur_time)) ) + { + mono_clock_start = cur_time.tv_sec; + mono_clock_source = _MHD_CLOCK_GET_TIME; + } + else +#endif /* HAVE_CLOCK_GET_TIME */ +#ifdef _WIN32 +#if _WIN32_WINNT >= 0x0600 + /* W32 Vista or later specific monotonic clock */ + /* Available since Vista, ~15ms accuracy */ + if (1) + { + tick_start = GetTickCount64 (); + mono_clock_source = _MHD_CLOCK_GETTICKCOUNT64; + } + else +#else /* _WIN32_WINNT < 0x0600 */ + /* W32 specific monotonic clock */ + /* Available on Windows 2000 and later */ + if (1) + { + LARGE_INTEGER freq; + LARGE_INTEGER perf_counter; + + QueryPerformanceFrequency (&freq); /* never fail on XP and later */ + QueryPerformanceCounter (&perf_counter); /* never fail on XP and later */ + perf_freq = freq.QuadPart; + perf_start = perf_counter.QuadPart; + mono_clock_source = _MHD_CLOCK_PERFCOUNTER; + } + else +#endif /* _WIN32_WINNT < 0x0600 */ +#endif /* _WIN32 */ +#ifdef HAVE_CLOCK_GETTIME +#ifdef CLOCK_HIGHRES + /* Solaris-specific monotonic high-resolution clock */ + /* Not preferred due to be potentially resource-hungry */ + if (0 == clock_gettime (CLOCK_HIGHRES, + &ts)) + { + mono_clock_id = CLOCK_HIGHRES; + mono_clock_start = ts.tv_sec; + mono_clock_source = _MHD_CLOCK_GETTIME; + } + else +#endif /* CLOCK_HIGHRES */ +#endif /* HAVE_CLOCK_GETTIME */ +#ifdef HAVE_GETHRTIME + /* HP-UX and Solaris monotonic clock */ + /* Not preferred due to be potentially resource-hungry */ + if (1) + { + hrtime_start = gethrtime (); + mono_clock_source = _MHD_CLOCK_GETHRTIME; + } + else +#endif /* HAVE_GETHRTIME */ + { + /* no suitable clock source was found */ + mono_clock_source = _MHD_CLOCK_NO_SOURCE; + } + +#ifdef HAVE_CLOCK_GET_TIME + if ( (_MHD_CLOCK_GET_TIME != mono_clock_source) && + (_MHD_INVALID_CLOCK_SERV != mono_clock_service) ) + { + /* clock service was initialised but clock_get_time failed */ + mach_port_deallocate (mach_task_self(), + mono_clock_service); + mono_clock_service = _MHD_INVALID_CLOCK_SERV; + } +#else + (void) mono_clock_source; /* avoid compiler warning */ +#endif /* HAVE_CLOCK_GET_TIME */ + + sys_clock_start = time (NULL); +} + + +/** + * Deinitialise monotonic seconds counter by freeing any allocated resources + */ +void +MHD_monotonic_sec_counter_finish (void) +{ +#ifdef HAVE_CLOCK_GET_TIME + if (_MHD_INVALID_CLOCK_SERV != mono_clock_service) + { + mach_port_deallocate (mach_task_self(), + mono_clock_service); + mono_clock_service = _MHD_INVALID_CLOCK_SERV; + } +#endif /* HAVE_CLOCK_GET_TIME */ +} + + +/** + * Monotonic seconds counter, useful for timeout calculation. + * Tries to be not affected by manually setting the system real time + * clock or adjustments by NTP synchronization. + * + * @return number of seconds from some fixed moment + */ +time_t +MHD_monotonic_sec_counter (void) +{ +#ifdef HAVE_CLOCK_GETTIME + struct timespec ts; + + if ( (_MHD_UNWANTED_CLOCK != mono_clock_id) && + (0 == clock_gettime (mono_clock_id , + &ts)) ) + return ts.tv_sec - mono_clock_start; +#endif /* HAVE_CLOCK_GETTIME */ +#ifdef HAVE_CLOCK_GET_TIME + if (_MHD_INVALID_CLOCK_SERV != mono_clock_service) + { + mach_timespec_t cur_time; + + if (KERN_SUCCESS == clock_get_time(mono_clock_service, + &cur_time)) + return cur_time.tv_sec - mono_clock_start; + } +#endif /* HAVE_CLOCK_GET_TIME */ +#if defined(_WIN32) +#if _WIN32_WINNT >= 0x0600 + if (1) + return (time_t)(((uint64_t)(GetTickCount64() - tick_start)) / 1000); +#else /* _WIN32_WINNT < 0x0600 */ + if (0 != perf_freq) + { + LARGE_INTEGER perf_counter; + + QueryPerformanceCounter (&perf_counter); /* never fail on XP and later */ + return (time_t)(((uint64_t)(perf_counter.QuadPart - perf_start)) / perf_freq); + } +#endif /* _WIN32_WINNT < 0x0600 */ +#endif /* _WIN32 */ +#ifdef HAVE_GETHRTIME + if (1) + return (time_t)(((uint64_t) (gethrtime () - hrtime_start)) / 1000000000); +#endif /* HAVE_GETHRTIME */ + + return time (NULL) - sys_clock_start; +} diff --git a/src/microhttpd/mhd_mono_clock.h b/src/microhttpd/mhd_mono_clock.h new file mode 100644 index 0000000..f4722af --- /dev/null +++ b/src/microhttpd/mhd_mono_clock.h @@ -0,0 +1,60 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/mhd_mono_clock.h + * @brief internal monotonic clock functions declarations + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef MHD_MONO_CLOCK_H +#define MHD_MONO_CLOCK_H 1 +#include "mhd_options.h" + +#if defined(HAVE_TIME_H) +#include +#elif defined(HAVE_SYS_TYPES_H) +#include +#endif + +/** + * Initialise monotonic seconds counter. + */ +void +MHD_monotonic_sec_counter_init(void); + + +/** + * Deinitialise monotonic seconds counter by freeing any allocated resources + */ +void +MHD_monotonic_sec_counter_finish(void); + + +/** + * Monotonic seconds counter, useful for timeout calculation. + * Tries to be not affected by manually setting the system real time + * clock or adjustments by NTP synchronization. + * + * @return number of seconds from some fixed moment + */ +time_t +MHD_monotonic_sec_counter(void); + +#endif /* MHD_MONO_CLOCK_H */ diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c new file mode 100644 index 0000000..47c2d9d --- /dev/null +++ b/src/microhttpd/mhd_sockets.c @@ -0,0 +1,523 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_sockets.c + * @brief Implementation for sockets functions + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_sockets.h" +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#include + +#ifdef MHD_WINSOCK_SOCKETS + +/** + * Return pointer to string description of specified WinSock error + * @param err the WinSock error code. + * @return pointer to string description of specified WinSock error. + */ +const char* MHD_W32_strerror_winsock_(int err) +{ + switch (err) + { + case 0: + return "No error"; + case WSA_INVALID_HANDLE: + return "Specified event object handle is invalid"; + case WSA_NOT_ENOUGH_MEMORY: + return "Insufficient memory available"; + case WSA_INVALID_PARAMETER: + return "One or more parameters are invalid"; + case WSA_OPERATION_ABORTED: + return "Overlapped operation aborted"; + case WSA_IO_INCOMPLETE: + return "Overlapped I/O event object not in signaled state"; + case WSA_IO_PENDING: + return "Overlapped operations will complete later"; + case WSAEINTR: + return "Interrupted function call"; + case WSAEBADF: + return "File handle is not valid"; + case WSAEACCES: + return "Permission denied"; + case WSAEFAULT: + return "Bad address"; + case WSAEINVAL: + return "Invalid argument"; + case WSAEMFILE: + return "Too many open files"; + case WSAEWOULDBLOCK: + return "Resource temporarily unavailable"; + case WSAEINPROGRESS: + return "Operation now in progress"; + case WSAEALREADY: + return "Operation already in progress"; + case WSAENOTSOCK: + return "Socket operation on nonsocket"; + case WSAEDESTADDRREQ: + return "Destination address required"; + case WSAEMSGSIZE: + return "Message too long"; + case WSAEPROTOTYPE: + return "Protocol wrong type for socket"; + case WSAENOPROTOOPT: + return "Bad protocol option"; + case WSAEPROTONOSUPPORT: + return "Protocol not supported"; + case WSAESOCKTNOSUPPORT: + return "Socket type not supported"; + case WSAEOPNOTSUPP: + return "Operation not supported"; + case WSAEPFNOSUPPORT: + return "Protocol family not supported"; + case WSAEAFNOSUPPORT: + return "Address family not supported by protocol family"; + case WSAEADDRINUSE: + return "Address already in use"; + case WSAEADDRNOTAVAIL: + return "Cannot assign requested address"; + case WSAENETDOWN: + return "Network is down"; + case WSAENETUNREACH: + return "Network is unreachable"; + case WSAENETRESET: + return "Network dropped connection on reset"; + case WSAECONNABORTED: + return "Software caused connection abort"; + case WSAECONNRESET: + return "Connection reset by peer"; + case WSAENOBUFS: + return "No buffer space available"; + case WSAEISCONN: + return "Socket is already connected"; + case WSAENOTCONN: + return "Socket is not connected"; + case WSAESHUTDOWN: + return "Cannot send after socket shutdown"; + case WSAETOOMANYREFS: + return "Too many references"; + case WSAETIMEDOUT: + return "Connection timed out"; + case WSAECONNREFUSED: + return "Connection refused"; + case WSAELOOP: + return "Cannot translate name"; + case WSAENAMETOOLONG: + return "Name too long"; + case WSAEHOSTDOWN: + return "Host is down"; + case WSAEHOSTUNREACH: + return "No route to host"; + case WSAENOTEMPTY: + return "Directory not empty"; + case WSAEPROCLIM: + return "Too many processes"; + case WSAEUSERS: + return "User quota exceeded"; + case WSAEDQUOT: + return "Disk quota exceeded"; + case WSAESTALE: + return "Stale file handle reference"; + case WSAEREMOTE: + return "Item is remote"; + case WSASYSNOTREADY: + return "Network subsystem is unavailable"; + case WSAVERNOTSUPPORTED: + return "Winsock.dll version out of range"; + case WSANOTINITIALISED: + return "Successful WSAStartup not yet performed"; + case WSAEDISCON: + return "Graceful shutdown in progress"; + case WSAENOMORE: + return "No more results"; + case WSAECANCELLED: + return "Call has been canceled"; + case WSAEINVALIDPROCTABLE: + return "Procedure call table is invalid"; + case WSAEINVALIDPROVIDER: + return "Service provider is invalid"; + case WSAEPROVIDERFAILEDINIT: + return "Service provider failed to initialize"; + case WSASYSCALLFAILURE: + return "System call failure"; + case WSASERVICE_NOT_FOUND: + return "Service not found"; + case WSATYPE_NOT_FOUND: + return "Class type not found"; + case WSA_E_NO_MORE: + return "No more results"; + case WSA_E_CANCELLED: + return "Call was canceled"; + case WSAEREFUSED: + return "Database query was refused"; + case WSAHOST_NOT_FOUND: + return "Host not found"; + case WSATRY_AGAIN: + return "Nonauthoritative host not found"; + case WSANO_RECOVERY: + return "This is a nonrecoverable error"; + case WSANO_DATA: + return "Valid name, no data record of requested type"; + case WSA_QOS_RECEIVERS: + return "QoS receivers"; + case WSA_QOS_SENDERS: + return "QoS senders"; + case WSA_QOS_NO_SENDERS: + return "No QoS senders"; + case WSA_QOS_NO_RECEIVERS: + return "QoS no receivers"; + case WSA_QOS_REQUEST_CONFIRMED: + return "QoS request confirmed"; + case WSA_QOS_ADMISSION_FAILURE: + return "QoS admission error"; + case WSA_QOS_POLICY_FAILURE: + return "QoS policy failure"; + case WSA_QOS_BAD_STYLE: + return "QoS bad style"; + case WSA_QOS_BAD_OBJECT: + return "QoS bad object"; + case WSA_QOS_TRAFFIC_CTRL_ERROR: + return "QoS traffic control error"; + case WSA_QOS_GENERIC_ERROR: + return "QoS generic error"; + case WSA_QOS_ESERVICETYPE: + return "QoS service type error"; + case WSA_QOS_EFLOWSPEC: + return "QoS flowspec error"; + case WSA_QOS_EPROVSPECBUF: + return "Invalid QoS provider buffer"; + case WSA_QOS_EFILTERSTYLE: + return "Invalid QoS filter style"; + case WSA_QOS_EFILTERTYPE: + return "Invalid QoS filter type"; + case WSA_QOS_EFILTERCOUNT: + return "Incorrect QoS filter count"; + case WSA_QOS_EOBJLENGTH: + return "Invalid QoS object length"; + case WSA_QOS_EFLOWCOUNT: + return "Incorrect QoS flow count"; + case WSA_QOS_EUNKOWNPSOBJ: + return "Unrecognized QoS object"; + case WSA_QOS_EPOLICYOBJ: + return "Invalid QoS policy object"; + case WSA_QOS_EFLOWDESC: + return "Invalid QoS flow descriptor"; + case WSA_QOS_EPSFLOWSPEC: + return "Invalid QoS provider-specific flowspec"; + case WSA_QOS_EPSFILTERSPEC: + return "Invalid QoS provider-specific filterspec"; + case WSA_QOS_ESDMODEOBJ: + return "Invalid QoS shape discard mode object"; + case WSA_QOS_ESHAPERATEOBJ: + return "Invalid QoS shaping rate object"; + case WSA_QOS_RESERVED_PETYPE: + return "Reserved policy QoS element type"; + } + return "Unknown winsock error"; +} + + +/** + * Create pair of mutually connected TCP/IP sockets on loopback address + * @param sockets_pair array to receive resulted sockets + * @param non_blk if set to non-zero value, sockets created in non-blocking mode + * otherwise sockets will be in blocking mode + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_W32_socket_pair_(SOCKET sockets_pair[2], int non_blk) +{ + int i; + + if (! sockets_pair) + { + WSASetLastError (WSAEFAULT); + return 0; + } + +#define PAIRMAXTRYIES 800 + for (i = 0; i < PAIRMAXTRYIES; i++) + { + struct sockaddr_in listen_addr; + SOCKET listen_s; + static const int c_addinlen = sizeof(struct sockaddr_in); /* help compiler to optimize */ + int addr_len = c_addinlen; + unsigned long on_val = 1; + unsigned long off_val = 0; + + listen_s = socket (AF_INET, + SOCK_STREAM, + IPPROTO_TCP); + if (INVALID_SOCKET == listen_s) + break; /* can't create even single socket */ + + listen_addr.sin_family = AF_INET; + listen_addr.sin_port = 0; /* same as htons(0) */ + listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + if ( (0 == bind (listen_s, + (struct sockaddr*) &listen_addr, + c_addinlen) && + (0 == listen (listen_s, + 1) ) && + (0 == getsockname (listen_s, + (struct sockaddr*) &listen_addr, + &addr_len))) ) + { + SOCKET client_s = socket(AF_INET, + SOCK_STREAM, + IPPROTO_TCP); + struct sockaddr_in accepted_from_addr; + struct sockaddr_in client_addr; + SOCKET server_s; + + if (INVALID_SOCKET == client_s) + { + /* try again */ + closesocket (listen_s); + continue; + } + + if ( (0 != ioctlsocket (client_s, + FIONBIO, + &on_val)) || + ( (0 != connect (client_s, + (struct sockaddr*) &listen_addr, + c_addinlen)) && + (WSAGetLastError() != WSAEWOULDBLOCK)) ) + { + /* try again */ + closesocket (listen_s); + closesocket (client_s); + continue; + } + + addr_len = c_addinlen; + server_s = accept (listen_s, + (struct sockaddr*) &accepted_from_addr, + &addr_len); + if (INVALID_SOCKET == server_s) + { + /* try again */ + closesocket (listen_s); + closesocket (client_s); + continue; + } + + addr_len = c_addinlen; + if ( (0 == getsockname (client_s, + (struct sockaddr*) &client_addr, + &addr_len)) && + (accepted_from_addr.sin_family == client_addr.sin_family) && + (accepted_from_addr.sin_port == client_addr.sin_port) && + (accepted_from_addr.sin_addr.s_addr == client_addr.sin_addr.s_addr) && + ( (0 != non_blk) ? + (0 == ioctlsocket(server_s, + FIONBIO, + &on_val)) : + (0 == ioctlsocket(client_s, + FIONBIO, + &off_val)) ) ) + { + closesocket (listen_s); + sockets_pair[0] = server_s; + sockets_pair[1] = client_s; + return !0; + } + closesocket (server_s); + closesocket (client_s); + } + closesocket(listen_s); + } + + sockets_pair[0] = INVALID_SOCKET; + sockets_pair[1] = INVALID_SOCKET; + WSASetLastError(WSAECONNREFUSED); + + return 0; +} + +#endif /* MHD_WINSOCK_SOCKETS */ + + +/** + * Add @a fd to the @a set. If @a fd is + * greater than @a max_fd, set @a max_fd to @a fd. + * + * @param fd file descriptor to add to the @a set + * @param set set to modify + * @param max_fd maximum value to potentially update + * @param fd_setsize value of FD_SETSIZE + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_add_to_fd_set_ (MHD_socket fd, + fd_set *set, + MHD_socket *max_fd, + unsigned int fd_setsize) +{ + if ( (NULL == set) || + (MHD_INVALID_SOCKET == fd) ) + return 0; + if (! MHD_SCKT_FD_FITS_FDSET_SETSIZE_ (fd, + set, + fd_setsize)) + return 0; + MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_(fd, + set, + fd_setsize); + if ( (NULL != max_fd) && + ( (fd > *max_fd) || + (MHD_INVALID_SOCKET == *max_fd) ) ) + *max_fd = fd; + return ! 0; +} + + +/** + * Change socket options to be non-blocking. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_socket_nonblocking_ (MHD_socket sock) +{ +#if defined(MHD_POSIX_SOCKETS) + int flags; + + flags = fcntl (sock, + F_GETFL); + if (-1 == flags) + return 0; + + if ( ((flags | O_NONBLOCK) != flags) && + (0 != fcntl (sock, + F_SETFL, + flags | O_NONBLOCK)) ) + return 0; +#elif defined(MHD_WINSOCK_SOCKETS) + unsigned long flags = 1; + + if (0 != ioctlsocket (sock, + FIONBIO, + &flags)) + return 0; +#endif /* MHD_WINSOCK_SOCKETS */ + return !0; +} + + +/** + * Change socket options to be non-inheritable. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + * @warning Does not set socket error on W32. + */ +int +MHD_socket_noninheritable_ (MHD_socket sock) +{ +#if defined(MHD_POSIX_SOCKETS) + int flags; + + flags = fcntl (sock, + F_GETFD); + if (-1 == flags) + return 0; + + if ( ((flags | FD_CLOEXEC) != flags) && + (0 != fcntl (sock, + F_SETFD, + flags | FD_CLOEXEC)) ) + return 0; +#elif defined(MHD_WINSOCK_SOCKETS) + if (! SetHandleInformation ((HANDLE)sock, + HANDLE_FLAG_INHERIT, + 0)) + return 0; +#endif /* MHD_WINSOCK_SOCKETS */ + return !0; +} + + +/** + * Create a listen socket, with noninheritable flag if possible. + * + * @param use_ipv6 if set to non-zero IPv6 is used + * @return created socket or MHD_INVALID_SOCKET in case of errors + */ +MHD_socket +MHD_socket_create_listen_ (int use_ipv6) +{ + int domain; + MHD_socket fd; + int cloexec_set; + +#ifdef HAVE_INET6 + domain = (use_ipv6) ? PF_INET6 : PF_INET; +#else /* ! HAVE_INET6 */ + if (use_ipv6) + return MHD_INVALID_SOCKET; + domain = PF_INET; +#endif /* ! HAVE_INET6 */ + +#if defined(MHD_POSIX_SOCKETS) && defined(SOCK_CLOEXEC) + fd = socket (domain, + SOCK_STREAM | SOCK_CLOEXEC, + 0); + cloexec_set = !0; +#elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT) + fd = WSASocketW (domain, + SOCK_STREAM, + 0, + NULL, + 0, + WSA_FLAG_NO_HANDLE_INHERIT); + cloexec_set = !0; +#else /* !SOCK_CLOEXEC */ + fd = MHD_INVALID_SOCKET; +#endif /* !SOCK_CLOEXEC */ + if (MHD_INVALID_SOCKET == fd) + { + fd = socket (domain, + SOCK_STREAM, + 0); + cloexec_set = 0; + } + if (MHD_INVALID_SOCKET == fd) + return MHD_INVALID_SOCKET; +#ifdef MHD_socket_nosignal_ + if(! MHD_socket_nosignal_(fd)) + { + const int err = MHD_socket_get_error_ (); + (void) MHD_socket_close_ (fd); + MHD_socket_fset_error_ (err); + return MHD_INVALID_SOCKET; + } +#endif /* MHD_socket_nosignal_ */ + if (! cloexec_set) + (void) MHD_socket_noninheritable_ (fd); + + return fd; +} diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h new file mode 100644 index 0000000..b013baa --- /dev/null +++ b/src/microhttpd/mhd_sockets.h @@ -0,0 +1,760 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_sockets.c + * @brief Header for platform-independent sockets abstraction + * @author Karlson2k (Evgeny Grin) + * + * Provides basic abstraction for sockets. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + */ + +#ifndef MHD_SOCKETS_H +#define MHD_SOCKETS_H 1 +#include "mhd_options.h" + +#include + +#if !defined(MHD_POSIX_SOCKETS) && !defined(MHD_WINSOCK_SOCKETS) +# if !defined(_WIN32) || defined(__CYGWIN__) +# define MHD_POSIX_SOCKETS 1 +# else /* defined(_WIN32) && !defined(__CYGWIN__) */ +# define MHD_WINSOCK_SOCKETS 1 +# endif /* defined(_WIN32) && !defined(__CYGWIN__) */ +#endif /* !MHD_POSIX_SOCKETS && !MHD_WINSOCK_SOCKETS */ + +/* + * MHD require headers that define socket type, socket basic functions + * (socket(), accept(), listen(), bind(), send(), recv(), select()), socket + * parameters like SOCK_CLOEXEC, SOCK_NONBLOCK, additional socket functions + * (poll(), epoll(), accept4()), struct timeval and other types, required + * for socket function. + */ +#if defined(MHD_POSIX_SOCKETS) +# ifdef HAVE_SYS_TYPES_H +# include /* required on old platforms */ +# endif +# ifdef HAVE_SYS_SOCKET_H +# include +# endif +# if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) +# ifdef HAVE_SOCKLIB_H +# include +# endif /* HAVE_SOCKLIB_H */ +# ifdef HAVE_INETLIB_H +# include +# endif /* HAVE_INETLIB_H */ +# include /* required for FD_SET (bzero() function) */ +# endif /* __VXWORKS__ || __vxworks || OS_VXWORKS */ +# ifdef HAVE_NETINET_IN_H +# include +# endif /* HAVE_NETINET_IN_H */ +# ifdef HAVE_ARPA_INET_H +# include +# endif +# ifdef HAVE_NET_IF_H +# include +# endif +# ifdef HAVE_SYS_TIME_H +# include +# endif +# ifdef HAVE_TIME_H +# include +# endif +# ifdef HAVE_NETDB_H +# include +# endif +# ifdef HAVE_SYS_SELECT_H +# include +# endif +# ifdef EPOLL_SUPPORT +# include +# endif +# ifdef HAVE_NETINET_TCP_H + /* for TCP_FASTOPEN and TCP_CORK */ +# include +# endif +# ifdef HAVE_STRING_H +# include /* for strerror() */ +# endif +#elif defined(MHD_WINSOCK_SOCKETS) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif /* !WIN32_LEAN_AND_MEAN */ +# include +# include +#endif /* MHD_WINSOCK_SOCKETS */ + +#if defined(HAVE_POLL_H) && defined(HAVE_POLL) +# include +#endif + +#include +#if defined(_MSC_FULL_VER) && !defined (_SSIZE_T_DEFINED) +# include +# define _SSIZE_T_DEFINED + typedef intptr_t ssize_t; +#endif /* !_SSIZE_T_DEFINED */ + +#include "mhd_limits.h" + +#ifdef _MHD_FD_SETSIZE_IS_DEFAULT +# define _MHD_SYS_DEFAULT_FD_SETSIZE FD_SETSIZE +#else /* ! _MHD_FD_SETSIZE_IS_DEFAULT */ +# include "sysfdsetsize.h" +# define _MHD_SYS_DEFAULT_FD_SETSIZE get_system_fdsetsize_value() +#endif /* ! _MHD_FD_SETSIZE_IS_DEFAULT */ + +#ifndef MHD_PANIC +# include +# include +/* Simple implementation of MHD_PANIC, to be used outside lib */ +# define MHD_PANIC(msg) do { fprintf (stderr, \ + "Abnormal termination at %d line in file %s: %s\n", \ + (int)__LINE__, __FILE__, msg); abort();} while(0) +#endif /* ! MHD_PANIC */ + +#ifndef MHD_SOCKET_DEFINED +/** + * MHD_socket is type for socket FDs + */ +# if defined(MHD_POSIX_SOCKETS) + typedef int MHD_socket; +# define MHD_INVALID_SOCKET (-1) +# elif defined(MHD_WINSOCK_SOCKETS) + typedef SOCKET MHD_socket; +# define MHD_INVALID_SOCKET (INVALID_SOCKET) +# endif /* MHD_WINSOCK_SOCKETS */ + +# define MHD_SOCKET_DEFINED 1 +#endif /* ! MHD_SOCKET_DEFINED */ + +#ifdef SOCK_CLOEXEC +# define MAYBE_SOCK_CLOEXEC SOCK_CLOEXEC +#else /* ! SOCK_CLOEXEC */ +# define MAYBE_SOCK_CLOEXEC 0 +#endif /* ! SOCK_CLOEXEC */ + +#ifdef HAVE_SOCK_NONBLOCK +# define MAYBE_SOCK_NONBLOCK SOCK_NONBLOCK +#else /* ! HAVE_SOCK_NONBLOCK */ +# define MAYBE_SOCK_NONBLOCK 0 +#endif /* ! HAVE_SOCK_NONBLOCK */ + +#ifdef MSG_NOSIGNAL +# define MAYBE_MSG_NOSIGNAL MSG_NOSIGNAL +#else /* ! MSG_NOSIGNAL */ +# define MAYBE_MSG_NOSIGNAL 0 +#endif /* ! MSG_NOSIGNAL */ + +#if !defined(SHUT_WR) && defined(SD_SEND) +# define SHUT_WR SD_SEND +#endif +#if !defined(SHUT_RD) && defined(SD_RECEIVE) +# define SHUT_RD SD_RECEIVE +#endif +#if !defined(SHUT_RDWR) && defined(SD_BOTH) +# define SHUT_RDWR SD_BOTH +#endif + +#if HAVE_ACCEPT4+0 != 0 && (defined(HAVE_SOCK_NONBLOCK) || defined(SOCK_CLOEXEC)) +# define USE_ACCEPT4 1 +#endif + +#if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC) +# define USE_EPOLL_CREATE1 1 +#endif /* HAVE_EPOLL_CREATE1 && EPOLL_CLOEXEC */ + +#ifdef TCP_FASTOPEN +/** + * Default TCP fastopen queue size. + */ +#define MHD_TCP_FASTOPEN_QUEUE_SIZE_DEFAULT 10 +#endif + + +/** + * MHD_SCKT_OPT_BOOL_ is type for bool parameters for setsockopt()/getsockopt() + */ +#ifdef MHD_POSIX_SOCKETS + typedef int MHD_SCKT_OPT_BOOL_; +#else /* MHD_WINSOCK_SOCKETS */ + typedef BOOL MHD_SCKT_OPT_BOOL_; +#endif /* MHD_WINSOCK_SOCKETS */ + +/** + * MHD_SCKT_SEND_SIZE_ is type used to specify size for send and recv + * functions + */ +#if !defined(MHD_WINSOCK_SOCKETS) + typedef size_t MHD_SCKT_SEND_SIZE_; +#else + typedef int MHD_SCKT_SEND_SIZE_; +#endif + +/** + * MHD_SCKT_SEND_MAX_SIZE_ is maximum send()/recv() size value. + */ +#if !defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_SEND_MAX_SIZE_ SSIZE_MAX +#else +# define MHD_SCKT_SEND_MAX_SIZE_ INT_MAX +#endif + +/** + * MHD_socket_close_(fd) close any FDs (non-W32) / close only socket + * FDs (W32). Note that on HP-UNIX, this function may leak the FD if + * errno is set to EINTR. Do not use HP-UNIX. + * + * @param fd descriptor to close + * @return boolean true on success (error codes like EINTR and EIO are + * counted as success, only EBADF counts as an error!), + * boolean false otherwise. + */ +#if !defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_close_(fd) ((0 == close((fd))) || (EBADF != errno)) +#else +# define MHD_socket_close_(fd) (0 == closesocket((fd))) +#endif + +/** + * MHD_socket_close_chk_(fd) close socket and abort execution + * if error is detected. + * @param fd socket to close + */ +#define MHD_socket_close_chk_(fd) do { \ + if (!MHD_socket_close_(fd)) \ + MHD_PANIC(_("Close socket failed.\n")); \ + } while(0) + + +/** + * MHD_send_ is wrapper for system's send() + * @param s the socket to use + * @param b the buffer with data to send + * @param l the length of data in @a b + * @return ssize_t type value + */ +#define MHD_send_(s,b,l) \ + ((ssize_t)send((s),(const void*)(b),((MHD_SCKT_SEND_SIZE_)l), MAYBE_MSG_NOSIGNAL)) + + +/** + * MHD_recv_ is wrapper for system's recv() + * @param s the socket to use + * @param b the buffer for data to receive + * @param l the length of @a b + * @return ssize_t type value + */ +#define MHD_recv_(s,b,l) \ + ((ssize_t)recv((s),(void*)(b),((MHD_SCKT_SEND_SIZE_)l), 0)) + + +/** + * Check whether FD can be added to fd_set with specified FD_SETSIZE. + * @param fd the fd to check + * @param pset the pointer to fd_set to check or NULL to check + * whether FD can be used with fd_sets. + * @param setsize the value of FD_SETSIZE. + * @return boolean true if FD can be added to fd_set, + * boolean false otherwise. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_SCKT_FD_FITS_FDSET_SETSIZE_(fd,pset,setsize) ((fd) < ((MHD_socket)setsize)) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_FD_FITS_FDSET_SETSIZE_(fd,pset,setsize) ( ((void*)(pset)==(void*)0) || \ + (((fd_set*)(pset))->fd_count < ((unsigned)setsize)) || \ + (FD_ISSET((fd),(pset))) ) +#endif + +/** + * Check whether FD can be added to fd_set with current FD_SETSIZE. + * @param fd the fd to check + * @param pset the pointer to fd_set to check or NULL to check + * whether FD can be used with fd_sets. + * @return boolean true if FD can be added to fd_set, + * boolean false otherwise. + */ +#define MHD_SCKT_FD_FITS_FDSET_(fd,pset) MHD_SCKT_FD_FITS_FDSET_SETSIZE_((fd),(pset),FD_SETSIZE) + +/** + * Add FD to fd_set with specified FD_SETSIZE. + * @param fd the fd to add + * @param pset the valid pointer to fd_set. + * @param setsize the value of FD_SETSIZE. + * @note To work on W32 with value of FD_SETSIZE different from currently defined value, + * system definition of FD_SET() is not used. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_(fd,pset,setsize) FD_SET((fd),(pset)) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_ADD_FD_TO_FDSET_SETSIZE_(fd,pset,setsize) \ + do { \ + u_int _i_ = 0; \ + fd_set* const _s_ = (fd_set*)(pset); \ + while((_i_ < _s_->fd_count) && ((fd) != _s_->fd_array[_i_])) {++_i_;} \ + if ((_i_ == _s_->fd_count)) {_s_->fd_array[_s_->fd_count++] = (fd);} \ + } while(0) +#endif + + /* MHD_SYS_select_ is wrapper macro for system select() function */ +#if !defined(MHD_WINSOCK_SOCKETS) +# define MHD_SYS_select_(n,r,w,e,t) select((n),(r),(w),(e),(t)) +#else +# define MHD_SYS_select_(n,r,w,e,t) \ +( ( (((void*)(r) == (void*)0) || ((fd_set*)(r))->fd_count == 0) && \ + (((void*)(w) == (void*)0) || ((fd_set*)(w))->fd_count == 0) && \ + (((void*)(e) == (void*)0) || ((fd_set*)(e))->fd_count == 0) ) ? \ + ( ((void*)(t) == (void*)0) ? 0 : \ + (Sleep(((struct timeval*)(t))->tv_sec * 1000 + \ + ((struct timeval*)(t))->tv_usec / 1000), 0) ) : \ + (select((int)0,(r),(w),(e),(t))) ) +#endif + +#if defined(HAVE_POLL) +/* MHD_sys_poll_ is wrapper macro for system poll() function */ +# if !defined(MHD_WINSOCK_SOCKETS) +# define MHD_sys_poll_ poll +# else /* MHD_WINSOCK_SOCKETS */ +# define MHD_sys_poll_ WSAPoll +# endif /* MHD_WINSOCK_SOCKETS */ + +# ifdef POLLPRI +# define MHD_POLLPRI_OR_ZERO POLLPRI +# else /* ! POLLPRI */ +# define MHD_POLLPRI_OR_ZERO 0 +# endif /* ! POLLPRI */ +# ifdef POLLRDBAND +# define MHD_POLLRDBAND_OR_ZERO POLLRDBAND +# else /* ! POLLRDBAND */ +# define MHD_POLLRDBAND_OR_ZERO 0 +# endif /* ! POLLRDBAND */ +# ifdef POLLNVAL +# define MHD_POLLNVAL_OR_ZERO POLLNVAL +# else /* ! POLLNVAL */ +# define MHD_POLLNVAL_OR_ZERO 0 +# endif /* ! POLLNVAL */ + +/* MHD_POLL_EVENTS_ERR_DISC is 'events' mask for errors and disconnect. + * Note: Out-of-band data is treated as error. */ +# if defined(_WIN32) && ! defined(__CYGWIN__) +# define MHD_POLL_EVENTS_ERR_DISC POLLRDBAND +# elif defined(__linux__) +# define MHD_POLL_EVENTS_ERR_DISC POLLPRI +# else /* ! __linux__ */ +# define MHD_POLL_EVENTS_ERR_DISC (MHD_POLLPRI_OR_ZERO | MHD_POLLRDBAND_OR_ZERO) +# endif /* ! __linux__ */ +/* MHD_POLL_REVENTS_ERR_DISC is 'revents' mask for errors and disconnect. + * Note: Out-of-band data is treated as error. */ +# define MHD_POLL_REVENTS_ERR_DISC \ + (MHD_POLLPRI_OR_ZERO | MHD_POLLRDBAND_OR_ZERO | MHD_POLLNVAL_OR_ZERO | POLLERR | POLLHUP) +/* MHD_POLL_REVENTS_ERRROR is 'revents' mask for errors. + * Note: Out-of-band data is treated as error. */ +# define MHD_POLL_REVENTS_ERRROR \ + (MHD_POLLPRI_OR_ZERO | MHD_POLLRDBAND_OR_ZERO | MHD_POLLNVAL_OR_ZERO | POLLERR) +#endif /* HAVE_POLL */ + +#define MHD_SCKT_MISSING_ERR_CODE_ 31450 + +#if defined(MHD_POSIX_SOCKETS) +# if defined(EAGAIN) +# define MHD_SCKT_EAGAIN_ EAGAIN +# elif defined(EWOULDBLOCK) +# define MHD_SCKT_EAGAIN_ EWOULDBLOCK +# else /* !EAGAIN && !EWOULDBLOCK */ +# define MHD_SCKT_EAGAIN_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* !EAGAIN && !EWOULDBLOCK */ +# if defined(EWOULDBLOCK) +# define MHD_SCKT_EWOULDBLOCK_ EWOULDBLOCK +# elif defined(EAGAIN) +# define MHD_SCKT_EWOULDBLOCK_ EAGAIN +# else /* !EWOULDBLOCK && !EAGAIN */ +# define MHD_SCKT_EWOULDBLOCK_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* !EWOULDBLOCK && !EAGAIN */ +# ifdef EINTR +# define MHD_SCKT_EINTR_ EINTR +# else /* ! EINTR */ +# define MHD_SCKT_EINTR_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EINTR */ +# ifdef ECONNRESET +# define MHD_SCKT_ECONNRESET_ ECONNRESET +# else /* ! ECONNRESET */ +# define MHD_SCKT_ECONNRESET_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ECONNRESET */ +# ifdef ECONNABORTED +# define MHD_SCKT_ECONNABORTED_ ECONNABORTED +# else /* ! ECONNABORTED */ +# define MHD_SCKT_ECONNABORTED_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ECONNABORTED */ +# ifdef ENOTCONN +# define MHD_SCKT_ENOTCONN_ ENOTCONN +# else /* ! ENOTCONN */ +# define MHD_SCKT_ENOTCONN_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOTCONN */ +# ifdef EMFILE +# define MHD_SCKT_EMFILE_ EMFILE +# else /* ! EMFILE */ +# define MHD_SCKT_EMFILE_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EMFILE */ +# ifdef ENFILE +# define MHD_SCKT_ENFILE_ ENFILE +# else /* ! ENFILE */ +# define MHD_SCKT_ENFILE_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENFILE */ +# ifdef ENOMEM +# define MHD_SCKT_ENOMEM_ ENOMEM +# else /* ! ENOMEM */ +# define MHD_SCKT_ENOMEM_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOMEM */ +# ifdef ENOBUFS +# define MHD_SCKT_ENOBUFS_ ENOBUFS +# else /* ! ENOBUFS */ +# define MHD_SCKT_ENOBUFS_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOBUFS */ +# ifdef EBADF +# define MHD_SCKT_EBADF_ EBADF +# else /* ! EBADF */ +# define MHD_SCKT_EBADF_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EBADF */ +# ifdef ENOTSOCK +# define MHD_SCKT_ENOTSOCK_ ENOTSOCK +# else /* ! ENOTSOCK */ +# define MHD_SCKT_ENOTSOCK_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOTSOCK */ +# ifdef EINVAL +# define MHD_SCKT_EINVAL_ EINVAL +# else /* ! EINVAL */ +# define MHD_SCKT_EINVAL_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EINVAL */ +# ifdef EFAULT +# define MHD_SCKT_EFAUL_ EFAULT +# else /* ! EFAULT */ +# define MHD_SCKT_EFAUL_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EFAULT */ +# ifdef ENOSYS +# define MHD_SCKT_ENOSYS_ ENOSYS +# else /* ! ENOSYS */ +# define MHD_SCKT_ENOSYS_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOSYS */ +# ifdef ENOTSUP +# define MHD_SCKT_ENOTSUP_ ENOTSUP +# else /* ! ENOTSUP */ +# define MHD_SCKT_ENOTSUP_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENOTSUP */ +# ifdef EOPNOTSUPP +# define MHD_SCKT_EOPNOTSUPP_ EOPNOTSUPP +# else /* ! EOPNOTSUPP */ +# define MHD_SCKT_EOPNOTSUPP_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EOPNOTSUPP */ +# ifdef EACCES +# define MHD_SCKT_EACCESS_ EACCES +# else /* ! EACCES */ +# define MHD_SCKT_EACCESS_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! EACCES */ +# ifdef ENETDOWN +# define MHD_SCKT_ENETDOWN_ ENETDOWN +# else /* ! ENETDOWN */ +# define MHD_SCKT_ENETDOWN_ MHD_SCKT_MISSING_ERR_CODE_ +# endif /* ! ENETDOWN */ +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_EAGAIN_ WSAEWOULDBLOCK +# define MHD_SCKT_EWOULDBLOCK_ WSAEWOULDBLOCK +# define MHD_SCKT_EINTR_ WSAEINTR +# define MHD_SCKT_ECONNRESET_ WSAECONNRESET +# define MHD_SCKT_ECONNABORTED_ WSAECONNABORTED +# define MHD_SCKT_ENOTCONN_ WSAENOTCONN +# define MHD_SCKT_EMFILE_ WSAEMFILE +# define MHD_SCKT_ENFILE_ MHD_SCKT_MISSING_ERR_CODE_ +# define MHD_SCKT_ENOMEM_ MHD_SCKT_MISSING_ERR_CODE_ +# define MHD_SCKT_ENOBUFS_ WSAENOBUFS +# define MHD_SCKT_EBADF_ WSAEBADF +# define MHD_SCKT_ENOTSOCK_ WSAENOTSOCK +# define MHD_SCKT_EINVAL_ WSAEINVAL +# define MHD_SCKT_EFAUL_ WSAEFAULT +# define MHD_SCKT_ENOSYS_ MHD_SCKT_MISSING_ERR_CODE_ +# define MHD_SCKT_ENOTSUP_ MHD_SCKT_MISSING_ERR_CODE_ +# define MHD_SCKT_EOPNOTSUPP_ WSAEOPNOTSUPP +# define MHD_SCKT_EACCESS_ WSAEACCES +# define MHD_SCKT_ENETDOWN_ WSAENETDOWN +#endif + +/** + * MHD_socket_error_ return system native error code for last socket error. + * @return system error code for last socket error. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_socket_get_error_() (errno) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_get_error_() WSAGetLastError() +#endif + +#ifdef MHD_WINSOCK_SOCKETS + /* POSIX-W32 sockets compatibility functions */ + +/** + * Return pointer to string description of specified WinSock error + * @param err the WinSock error code. + * @return pointer to string description of specified WinSock error. + */ + const char* MHD_W32_strerror_winsock_(int err); +#endif /* MHD_WINSOCK_SOCKETS */ + +/* MHD_socket_last_strerr_ is description string of specified socket error code */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_socket_strerr_(err) strerror((err)) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_strerr_(err) MHD_W32_strerror_winsock_((err)) +#endif + +/* MHD_socket_last_strerr_ is description string of last errno (non-W32) / + * description string of last socket error (W32) */ +#define MHD_socket_last_strerr_() MHD_socket_strerr_(MHD_socket_get_error_()) + +/** + * MHD_socket_fset_error_() set socket system native error code. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_socket_fset_error_(err) (errno = (err)) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_fset_error_(err) (WSASetLastError((err))) +#endif + +/** + * MHD_socket_try_set_error_() set socket system native error code if + * specified code is defined on system. + * @return non-zero if specified @a err code is defined on system + * and error was set; + * zero if specified @a err code is not defined on system + * and error was not set. + */ +#define MHD_socket_try_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ != (err)) ? \ + (MHD_socket_fset_error_((err)), !0) : 0 ) + +/** + * MHD_socket_set_error_() set socket system native error code to + * specified code or replacement code if specified code is not + * defined on system. + */ +#if defined(MHD_POSIX_SOCKETS) +# if defined(ENOSYS) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (errno = ENOSYS) : (errno = (err)) ) +# elif defined(EOPNOTSUPP) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (errno = EOPNOTSUPP) : (errno = (err)) ) +# elif defined (EFAULT) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (errno = EFAULT) : (errno = (err)) ) +# elif defined (EINVAL) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (errno = EINVAL) : (errno = (err)) ) +# else /* !EOPNOTSUPP && !EFAULT && !EINVAL */ +# warning No suitable replacement for missing socket error code is found. Edit this file and add replacement code which is defined on system. +# define MHD_socket_set_error_(err) (errno = (err)) +# endif /* !EOPNOTSUPP && !EFAULT && !EINVAL*/ +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) ? \ + (WSASetLastError((WSAEOPNOTSUPP))) : \ + (WSASetLastError((err))) ) +#endif + +/** + * Check whether given socket error is equal to specified system + * native MHD_SCKT_E*_ code. + * If platform don't have specific error code, result is + * always boolean false. + * @return boolean true if @a code is real error code and + * @a err equals to MHD_SCKT_E*_ @a code; + * boolean false otherwise + */ +#define MHD_SCKT_ERR_IS_(err,code) ( (MHD_SCKT_MISSING_ERR_CODE_ != (code)) && \ + ((code) == (err)) ) + +/** + * Check whether last socket error is equal to specified system + * native MHD_SCKT_E*_ code. + * If platform don't have specific error code, result is + * always boolean false. + * @return boolean true if @a code is real error code and + * last socket error equals to MHD_SCKT_E*_ @a code; + * boolean false otherwise + */ +#define MHD_SCKT_LAST_ERR_IS_(code) MHD_SCKT_ERR_IS_(MHD_socket_get_error_() ,(code)) + +/* Specific error code checks */ + +/** + * Check whether given socket error is equal to system's + * socket error codes for EINTR. + * @return boolean true if @a err is equal to sockets' EINTR code; + * boolean false otherwise. + */ +#define MHD_SCKT_ERR_IS_EINTR_(err) MHD_SCKT_ERR_IS_((err),MHD_SCKT_EINTR_) + +/** + * Check whether given socket error is equal to system's + * socket error codes for EAGAIN or EWOULDBLOCK. + * @return boolean true if @a err is equal to sockets' EAGAIN or EWOULDBLOCK codes; + * boolean false otherwise. + */ +#if MHD_SCKT_EAGAIN_ == MHD_SCKT_EWOULDBLOCK_ +# define MHD_SCKT_ERR_IS_EAGAIN_(err) MHD_SCKT_ERR_IS_((err),MHD_SCKT_EAGAIN_) +#else /* MHD_SCKT_EAGAIN_ != MHD_SCKT_EWOULDBLOCK_ */ +# define MHD_SCKT_ERR_IS_EAGAIN_(err) ( MHD_SCKT_ERR_IS_((err),MHD_SCKT_EAGAIN_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_EWOULDBLOCK_) ) +#endif /* MHD_SCKT_EAGAIN_ != MHD_SCKT_EWOULDBLOCK_ */ + +/** + * Check whether given socket error is any kind of "low resource" error. + * @return boolean true if @a err is any kind of "low resource" error, + * boolean false otherwise. + */ +#define MHD_SCKT_ERR_IS_LOW_RESOURCES_(err) ( MHD_SCKT_ERR_IS_((err),MHD_SCKT_EMFILE_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_ENFILE_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_ENOMEM_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_ENOBUFS_) ) + +/** + * Check whether is given socket error is type of "incoming connection + * was disconnected before 'accept()' is called". + * @return boolean true is @a err match described socket error code, + * boolean false otherwise. + */ +#if defined(MHD_POSIX_SOCKETS) +# define MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_(err) MHD_SCKT_ERR_IS_((err),MHD_SCKT_ECONNABORTED_) +#elif defined(MHD_WINSOCK_SOCKETS) +# define MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_(err) MHD_SCKT_ERR_IS_((err),MHD_SCKT_ECONNRESET_) +#endif + +/** + * Check whether is given socket error is type of "connection was terminated + * by remote side". + * @return boolean true is @a err match described socket error code, + * boolean false otherwise. + */ +#define MHD_SCKT_ERR_IS_REMOTE_DISCNN_(err) ( MHD_SCKT_ERR_IS_((err),MHD_SCKT_ECONNRESET_) || \ + MHD_SCKT_ERR_IS_((err),MHD_SCKT_ECONNABORTED_)) + +/* Specific error code set */ + +/** + * Set socket's error code to ENOMEM or equivalent if ENOMEM is not + * available on platform. + */ +#if MHD_SCKT_MISSING_ERR_CODE_ != MHD_SCKT_ENOMEM_ +# define MHD_socket_set_error_to_ENOMEM() MHD_socket_set_error_(MHD_SCKT_ENOMEM_) +#elif MHD_SCKT_MISSING_ERR_CODE_ != MHD_SCKT_ENOBUFS_ +# define MHD_socket_set_error_to_ENOMEM() MHD_socket_set_error_(MHD_SCKT_ENOBUFS_) +#else +# warning No suitable replacement for ENOMEM error codes is found. Edit this file and add replacement code which is defined on system. +# define MHD_socket_set_error_to_ENOMEM() MHD_socket_set_error_(MHD_SCKT_ENOMEM_) +#endif + +/* Socket functions */ + +#if defined(AF_LOCAL) +# define MHD_SCKT_LOCAL AF_LOCAL +#elif defined(AF_UNIX) +# define MHD_SCKT_LOCAL AF_UNIX +#endif /* AF_UNIX */ + +#if defined(MHD_POSIX_SOCKETS) && defined(MHD_SCKT_LOCAL) +# define MHD_socket_pair_(fdarr) (!socketpair(MHD_SCKT_LOCAL, SOCK_STREAM, 0, (fdarr))) +# if defined(HAVE_SOCK_NONBLOCK) +# define MHD_socket_pair_nblk_(fdarr) (!socketpair(MHD_SCKT_LOCAL, SOCK_STREAM | SOCK_NONBLOCK, 0, (fdarr))) +# endif /* HAVE_SOCK_NONBLOCK*/ +#elif defined(MHD_WINSOCK_SOCKETS) + /** + * Create pair of mutually connected TCP/IP sockets on loopback address + * @param sockets_pair array to receive resulted sockets + * @param non_blk if set to non-zero value, sockets created in non-blocking mode + * otherwise sockets will be in blocking mode + * @return non-zero if succeeded, zero otherwise + */ + int MHD_W32_socket_pair_(SOCKET sockets_pair[2], int non_blk); + +# define MHD_socket_pair_(fdarr) MHD_W32_socket_pair_((fdarr), 0) +# define MHD_socket_pair_nblk_(fdarr) MHD_W32_socket_pair_((fdarr), 1) +#endif + +/** + * Add @a fd to the @a set. If @a fd is + * greater than @a max_fd, set @a max_fd to @a fd. + * + * @param fd file descriptor to add to the @a set + * @param set set to modify + * @param max_fd maximum value to potentially update + * @param fd_setsize value of FD_SETSIZE + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_add_to_fd_set_ (MHD_socket fd, + fd_set *set, + MHD_socket *max_fd, + unsigned int fd_setsize); + + +/** + * Change socket options to be non-blocking. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +int +MHD_socket_nonblocking_ (MHD_socket sock); + + +/** + * Change socket options to be non-inheritable. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + * @warning Does not set socket error on W32. + */ +int +MHD_socket_noninheritable_ (MHD_socket sock); + + +#if defined(SOL_SOCKET) && defined(SO_NOSIGPIPE) + static const int _MHD_socket_int_one = 1; +/** + * Change socket options to no signal on remote disconnect. + * + * @param sock socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +# define MHD_socket_nosignal_(sock) \ + (!setsockopt((sock),SOL_SOCKET,SO_NOSIGPIPE,&_MHD_socket_int_one,sizeof(_MHD_socket_int_one))) +#endif /* SOL_SOCKET && SO_NOSIGPIPE */ + +/** + * Create a listen socket, with noninheritable flag if possible. + * + * @param use_ipv6 if set to non-zero IPv6 is used + * @return created socket or MHD_INVALID_SOCKET in case of errors + */ +MHD_socket +MHD_socket_create_listen_ (int use_ipv6); + +#endif /* ! MHD_SOCKETS_H */ diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c new file mode 100644 index 0000000..d0b03ea --- /dev/null +++ b/src/microhttpd/mhd_str.c @@ -0,0 +1,758 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015, 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/mhd_str.c + * @brief Functions implementations for string manipulating + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_str.h" + +#ifdef HAVE_STDBOOL_H +#include +#endif + +#include "mhd_limits.h" + +#ifdef MHD_FAVOR_SMALL_CODE +#ifdef _MHD_static_inline +#undef _MHD_static_inline +#endif /* _MHD_static_inline */ +/* Do not force inlining and do not use macro functions, use normal static + functions instead. + This may give more flexibility for size optimizations. */ +#define _MHD_static_inline static +#ifndef INLINE_FUNC +#define INLINE_FUNC 1 +#endif /* !INLINE_FUNC */ +#endif /* MHD_FAVOR_SMALL_CODE */ + +/* + * Block of functions/macros that use US-ASCII charset as required by HTTP + * standards. Not affected by current locale settings. + */ + +#ifdef INLINE_FUNC + +#if 0 /* Disable unused functions. */ +/** + * Check whether character is lower case letter in US-ASCII + * + * @param c character to check + * @return non-zero if character is lower case letter, zero otherwise + */ +_MHD_static_inline bool +isasciilower (char c) +{ + return (c >= 'a') && (c <= 'z'); +} +#endif /* Disable unused functions. */ + + +/** + * Check whether character is upper case letter in US-ASCII + * + * @param c character to check + * @return non-zero if character is upper case letter, zero otherwise + */ +_MHD_static_inline bool +isasciiupper (char c) +{ + return (c >= 'A') && (c <= 'Z'); +} + + +#if 0 /* Disable unused functions. */ +/** + * Check whether character is letter in US-ASCII + * + * @param c character to check + * @return non-zero if character is letter in US-ASCII, zero otherwise + */ +_MHD_static_inline bool +isasciialpha (char c) +{ + return isasciilower (c) || isasciiupper (c); +} +#endif /* Disable unused functions. */ + + +/** + * Check whether character is decimal digit in US-ASCII + * + * @param c character to check + * @return non-zero if character is decimal digit, zero otherwise + */ +_MHD_static_inline bool +isasciidigit (char c) +{ + return (c >= '0') && (c <= '9'); +} + +#if 0 /* Disable unused functions. */ +/** + * Check whether character is hexadecimal digit in US-ASCII + * + * @param c character to check + * @return non-zero if character is decimal digit, zero otherwise + */ +_MHD_static_inline bool +isasciixdigit (char c) +{ + return isasciidigit (c) || + ( (c >= 'A') && (c <= 'F') ) || + ( (c >= 'a') && (c <= 'f') ); +} + + +/** + * Check whether character is decimal digit or letter in US-ASCII + * + * @param c character to check + * @return non-zero if character is decimal digit or letter, zero otherwise + */ +_MHD_static_inline bool +isasciialnum (char c) +{ + return isasciialpha (c) || isasciidigit (c); +} +#endif /* Disable unused functions. */ + + +/** + * Convert US-ASCII character to lower case. + * If character is upper case letter in US-ASCII than it's converted to lower + * case analog. If character is NOT upper case letter than it's returned + * unmodified. + * + * @param c character to convert + * @return converted to lower case character + */ +_MHD_static_inline char +toasciilower (char c) +{ + return isasciiupper (c) ? (c - 'A' + 'a') : c; +} + + +#if 0 /* Disable unused functions. */ +/** + * Convert US-ASCII character to upper case. + * If character is lower case letter in US-ASCII than it's converted to upper + * case analog. If character is NOT lower case letter than it's returned + * unmodified. + * + * @param c character to convert + * @return converted to upper case character + */ +_MHD_static_inline char +toasciiupper (char c) +{ + return isasciilower (c) ? (c - 'a' + 'A') : c; +} +#endif /* Disable unused functions. */ + + +#if defined(MHD_FAVOR_SMALL_CODE) /* Used only in MHD_str_to_uvalue_n_() */ +/** + * Convert US-ASCII decimal digit to its value. + * + * @param c character to convert + * @return value of decimal digit or -1 if @ c is not decimal digit + */ +_MHD_static_inline int +todigitvalue (char c) +{ + if (isasciidigit (c)) + return (unsigned char)(c - '0'); + + return -1; +} +#endif /* MHD_FAVOR_SMALL_CODE */ + + +/** + * Convert US-ASCII hexadecimal digit to its value. + * + * @param c character to convert + * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit + */ +_MHD_static_inline int +toxdigitvalue (char c) +{ + if (isasciidigit (c)) + return (unsigned char)(c - '0'); + if ( (c >= 'A') && (c <= 'F') ) + return (unsigned char)(c - 'A' + 10); + if ( (c >= 'a') && (c <= 'f') ) + return (unsigned char)(c - 'a' + 10); + + return -1; +} +#else /* !INLINE_FUNC */ + + +/** + * Checks whether character is lower case letter in US-ASCII + * + * @param c character to check + * @return boolean true if character is lower case letter, + * boolean false otherwise + */ +#define isasciilower(c) (((char)(c)) >= 'a' && ((char)(c)) <= 'z') + + +/** + * Checks whether character is upper case letter in US-ASCII + * + * @param c character to check + * @return boolean true if character is upper case letter, + * boolean false otherwise + */ +#define isasciiupper(c) (((char)(c)) >= 'A' && ((char)(c)) <= 'Z') + + +/** + * Checks whether character is letter in US-ASCII + * + * @param c character to check + * @return boolean true if character is letter, boolean false + * otherwise + */ +#define isasciialpha(c) (isasciilower(c) || isasciiupper(c)) + + +/** + * Check whether character is decimal digit in US-ASCII + * + * @param c character to check + * @return boolean true if character is decimal digit, boolean false + * otherwise + */ +#define isasciidigit(c) (((char)(c)) >= '0' && ((char)(c)) <= '9') + + +/** + * Check whether character is hexadecimal digit in US-ASCII + * + * @param c character to check + * @return boolean true if character is hexadecimal digit, + * boolean false otherwise + */ +#define isasciixdigit(c) (isasciidigit((c)) || \ + (((char)(c)) >= 'A' && ((char)(c)) <= 'F') || \ + (((char)(c)) >= 'a' && ((char)(c)) <= 'f') ) + + +/** + * Check whether character is decimal digit or letter in US-ASCII + * + * @param c character to check + * @return boolean true if character is decimal digit or letter, + * boolean false otherwise + */ +#define isasciialnum(c) (isasciialpha(c) || isasciidigit(c)) + + +/** + * Convert US-ASCII character to lower case. + * If character is upper case letter in US-ASCII than it's converted to lower + * case analog. If character is NOT upper case letter than it's returned + * unmodified. + * + * @param c character to convert + * @return converted to lower case character + */ +#define toasciilower(c) ((isasciiupper(c)) ? (((char)(c)) - 'A' + 'a') : ((char)(c))) + + +/** + * Convert US-ASCII character to upper case. + * If character is lower case letter in US-ASCII than it's converted to upper + * case analog. If character is NOT lower case letter than it's returned + * unmodified. + * + * @param c character to convert + * @return converted to upper case character + */ +#define toasciiupper(c) ((isasciilower(c)) ? (((char)(c)) - 'a' + 'A') : ((char)(c))) + + +/** + * Convert US-ASCII decimal digit to its value. + * + * @param c character to convert + * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit + */ +#define todigitvalue(c) (isasciidigit(c) ? (int)(((char)(c)) - '0') : (int)(-1)) + + +/** + * Convert US-ASCII hexadecimal digit to its value. + * @param c character to convert + * @return value of hexadecimal digit or -1 if @ c is not hexadecimal digit + */ +#define toxdigitvalue(c) ( isasciidigit(c) ? (int)(((char)(c)) - '0') : \ + ( (((char)(c)) >= 'A' && ((char)(c)) <= 'F') ? \ + (int)(((unsigned char)(c)) - 'A' + 10) : \ + ( (((char)(c)) >= 'a' && ((char)(c)) <= 'f') ? \ + (int)(((unsigned char)(c)) - 'a' + 10) : (int)(-1) ))) +#endif /* !INLINE_FUNC */ + + +#ifndef MHD_FAVOR_SMALL_CODE +/** + * Check two string for equality, ignoring case of US-ASCII letters. + * + * @param str1 first string to compare + * @param str2 second string to compare + * @return non-zero if two strings are equal, zero otherwise. + */ +int +MHD_str_equal_caseless_ (const char * str1, + const char * str2) +{ + while (0 != (*str1)) + { + const char c1 = *str1; + const char c2 = *str2; + if ( (c1 != c2) && + (toasciilower (c1) != toasciilower (c2)) ) + return 0; + str1++; + str2++; + } + return 0 == (*str2); +} +#endif /* ! MHD_FAVOR_SMALL_CODE */ + + +/** + * Check two string for equality, ignoring case of US-ASCII letters and + * checking not more than @a maxlen characters. + * Compares up to first terminating null character, but not more than + * first @a maxlen characters. + * + * @param str1 first string to compare + * @param str2 second string to compare + * @param maxlen maximum number of characters to compare + * @return non-zero if two strings are equal, zero otherwise. + */ +int +MHD_str_equal_caseless_n_ (const char * const str1, + const char * const str2, + size_t maxlen) +{ + size_t i; + + for (i = 0; i < maxlen; ++i) + { + const char c1 = str1[i]; + const char c2 = str2[i]; + if (0 == c2) + return 0 == c1; + if ( (c1 != c2) && + (toasciilower (c1) != toasciilower (c2)) ) + return 0; + } + return !0; +} + + +/** + * Check whether @a str has case-insensitive @a token. + * Token could be surrounded by spaces and tabs and delimited by comma. + * Match succeed if substring between start, end (of string) or comma + * contains only case-insensitive token and optional spaces and tabs. + * @warning token must not contain null-charters except optional + * terminating null-character. + * @param str the string to check + * @param token the token to find + * @param token_len length of token, not including optional terminating + * null-character. + * @return non-zero if two strings are equal, zero otherwise. + */ +bool +MHD_str_has_token_caseless_ (const char * str, + const char * const token, + size_t token_len) +{ + if (0 == token_len) + return false; + + while (0 != *str) + { + size_t i; + /* Skip all whitespaces and empty tokens. */ + while (' ' == *str || '\t' == *str || ',' == *str) str++; + + /* Check for token match. */ + i = 0; + while (1) + { + const char sc = *(str++); + const char tc = token[i++]; + + if (0 == sc) + return false; + if ( (sc != tc) && + (toasciilower (sc) != toasciilower (tc)) ) + break; + if (i >= token_len) + { + /* Check whether substring match token fully or + * has additional unmatched chars at tail. */ + while (' ' == *str || '\t' == *str) str++; + /* End of (sub)string? */ + if (0 == *str || ',' == *str) + return true; + /* Unmatched chars at end of substring. */ + break; + } + } + /* Find next substring. */ + while (0 != *str && ',' != *str) str++; + } + return false; +} + +#ifndef MHD_FAVOR_SMALL_CODE +/* Use individual function for each case */ + +/** + * Convert decimal US-ASCII digits in string to number in uint64_t. + * Conversion stopped at first non-digit character. + * + * @param str string to convert + * @param[out] out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_str_to_uint64_ (const char *str, + uint64_t *out_val) +{ + const char * const start = str; + uint64_t res; + + if (!str || !out_val || !isasciidigit(str[0])) + return 0; + + res = 0; + do + { + const int digit = (unsigned char)(*str) - '0'; + if ( (res > (UINT64_MAX / 10)) || + ( (res == (UINT64_MAX / 10)) && + ((uint64_t)digit > (UINT64_MAX % 10)) ) ) + return 0; + + res *= 10; + res += digit; + str++; + } while (isasciidigit (*str)); + + *out_val = res; + return str - start; +} + + +/** + * Convert not more then @a maxlen decimal US-ASCII digits in string to + * number in uint64_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param[out] out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_str_to_uint64_n_ (const char * str, + size_t maxlen, + uint64_t *out_val) +{ + uint64_t res; + size_t i; + + if (!str || !maxlen || !out_val || !isasciidigit (str[0])) + return 0; + + res = 0; + i = 0; + do + { + const int digit = (unsigned char)str[i] - '0'; + + if ( (res > (UINT64_MAX / 10)) || + ( (res == (UINT64_MAX / 10)) && + ((uint64_t)digit > (UINT64_MAX % 10)) ) ) + return 0; + + res *= 10; + res += digit; + i++; + } while ( (i < maxlen) && + isasciidigit (str[i]) ); + + *out_val= res; + return i; +} + + +/** + * Convert hexadecimal US-ASCII digits in string to number in uint32_t. + * Conversion stopped at first non-digit character. + * + * @param str string to convert + * @param[out] out_val pointer to uint32_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint32_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint32_ (const char * str, + uint32_t *out_val) +{ + const char * const start = str; + uint32_t res; + int digit; + + if (!str || !out_val) + return 0; + + res = 0; + digit = toxdigitvalue (*str); + while (digit >= 0) + { + if ( (res < (UINT32_MAX / 16)) || + (res == (UINT32_MAX / 16) && (uint32_t)digit <= (UINT32_MAX % 16)) ) + { + res *= 16; + res += digit; + } + else + return 0; + str++; + digit = toxdigitvalue (*str); + } + + if (str - start > 0) + *out_val = res; + return str - start; +} + + +/** + * Convert not more then @a maxlen hexadecimal US-ASCII digits in string + * to number in uint32_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param[out] out_val pointer to uint32_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint32_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint32_n_ (const char *str, + size_t maxlen, + uint32_t *out_val) +{ + size_t i; + uint32_t res; + int digit; + if (!str || !out_val) + return 0; + + res = 0; + i = 0; + while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) + { + if ( (res > (UINT32_MAX / 16)) || + (res == (UINT32_MAX / 16) && (uint32_t)digit > (UINT32_MAX % 16)) ) + return 0; + + res *= 16; + res += digit; + i++; + } + + if (i) + *out_val = res; + return i; +} + + +/** + * Convert hexadecimal US-ASCII digits in string to number in uint64_t. + * Conversion stopped at first non-digit character. + * + * @param str string to convert + * @param[out] out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint64_ (const char *str, + uint64_t *out_val) +{ + const char * const start = str; + uint64_t res; + int digit; + if (!str || !out_val) + return 0; + + res = 0; + digit = toxdigitvalue (*str); + while (digit >= 0) + { + if ( (res < (UINT64_MAX / 16)) || + (res == (UINT64_MAX / 16) && (uint64_t)digit <= (UINT64_MAX % 16)) ) + { + res *= 16; + res += digit; + } + else + return 0; + str++; + digit = toxdigitvalue (*str); + } + + if (str - start > 0) + *out_val = res; + return str - start; +} + + +/** + * Convert not more then @a maxlen hexadecimal US-ASCII digits in string + * to number in uint64_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param[out] out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint64_n_ (const char * str, + size_t maxlen, + uint64_t *out_val) +{ + size_t i; + uint64_t res; + int digit; + if (!str || !out_val) + return 0; + + res = 0; + i = 0; + while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) + { + if ( (res > (UINT64_MAX / 16)) || + (res == (UINT64_MAX / 16) && (uint64_t)digit > (UINT64_MAX % 16)) ) + return 0; + + res *= 16; + res += digit; + i++; + } + + if (i) + *out_val = res; + return i; +} + +#else /* MHD_FAVOR_SMALL_CODE */ + +/** + * Generic function for converting not more then @a maxlen + * hexadecimal or decimal US-ASCII digits in string to number. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * To be used only within macro. + * + * @param str the string to convert + * @param maxlen the maximum number of characters to process + * @param out_val the pointer to variable to store result of conversion + * @param val_size the size of variable pointed by @a out_val, in bytes, 4 or 8 + * @param max_val the maximum decoded number + * @param base the numeric base, 10 or 16 + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then @max_val, @val_size is not 16/32 or @a out_val is NULL + */ +size_t +MHD_str_to_uvalue_n_ (const char *str, + size_t maxlen, + void * out_val, + size_t val_size, + uint64_t max_val, + int base) +{ + size_t i; + uint64_t res; + int digit; + const uint64_t max_v_div_b = max_val / base; + const uint64_t max_v_mod_b = max_val % base; + /* 'digit->value' must be function, not macro */ + int (*const dfunc)(char) = (base == 16) ? + toxdigitvalue : todigitvalue; + + if ( !str || !out_val || + (base != 16 && base != 10) ) + return 0; + + res = 0; + i = 0; + while (maxlen > i && 0 <= (digit = dfunc (str[i]))) + { + if ( ((max_v_div_b) < res) || + ((max_v_div_b) == res && (max_v_mod_b) < (uint64_t)digit) ) + return 0; + + res *= base; + res += digit; + i++; + } + + if (i) + { + if (8 == val_size) + *(uint64_t*)out_val = res; + else if (4 == val_size) + *(uint32_t*)out_val = (uint32_t)res; + else + return 0; + } + return i; +} +#endif /* MHD_FAVOR_SMALL_CODE */ diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h new file mode 100644 index 0000000..410cc36 --- /dev/null +++ b/src/microhttpd/mhd_str.h @@ -0,0 +1,266 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015, 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/mhd_str.h + * @brief Header for string manipulating helpers + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef MHD_STR_H +#define MHD_STR_H 1 + +#include "mhd_options.h" + +#include +#include +#ifdef HAVE_STDBOOL_H +#include +#endif /* HAVE_STDBOOL_H */ + +#ifdef MHD_FAVOR_SMALL_CODE +#include "mhd_limits.h" +#endif /* MHD_FAVOR_SMALL_CODE */ + +#ifndef MHD_STATICSTR_LEN_ +/** + * Determine length of static string / macro strings at compile time. + */ +#define MHD_STATICSTR_LEN_(macro) (sizeof(macro)/sizeof(char) - 1) +#endif /* ! MHD_STATICSTR_LEN_ */ + +/* + * Block of functions/macros that use US-ASCII charset as required by HTTP + * standards. Not affected by current locale settings. + */ + +#ifndef MHD_FAVOR_SMALL_CODE +/** + * Check two string for equality, ignoring case of US-ASCII letters. + * @param str1 first string to compare + * @param str2 second string to compare + * @return non-zero if two strings are equal, zero otherwise. + */ +int +MHD_str_equal_caseless_ (const char * str1, + const char * str2); +#else /* MHD_FAVOR_SMALL_CODE */ +/* Reuse MHD_str_equal_caseless_n_() to reduce size */ +#define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_((s1),(s2), SIZE_MAX) +#endif /* MHD_FAVOR_SMALL_CODE */ + + +/** + * Check two string for equality, ignoring case of US-ASCII letters and + * checking not more than @a maxlen characters. + * Compares up to first terminating null character, but not more than + * first @a maxlen characters. + * @param str1 first string to compare + * @param str2 second string to compare + * @param maxlen maximum number of characters to compare + * @return non-zero if two strings are equal, zero otherwise. + */ +int +MHD_str_equal_caseless_n_ (const char * const str1, + const char * const str2, + size_t maxlen); + + +/** + * Check whether @a str has case-insensitive @a token. + * Token could be surrounded by spaces and tabs and delimited by comma. + * Match succeed if substring between start, end of string or comma + * contains only case-insensitive token and optional spaces and tabs. + * @warning token must not contain null-charters except optional + * terminating null-character. + * @param str the string to check + * @param token the token to find + * @param token_len length of token, not including optional terminating + * null-character. + * @return non-zero if two strings are equal, zero otherwise. + */ +bool +MHD_str_has_token_caseless_ (const char * str, + const char * const token, + size_t token_len); + +/** + * Check whether @a str has case-insensitive static @a tkn. + * Token could be surrounded by spaces and tabs and delimited by comma. + * Match succeed if substring between start, end of string or comma + * contains only case-insensitive token and optional spaces and tabs. + * @warning tkn must be static string + * @param str the string to check + * @param tkn the static string of token to find + * @return non-zero if two strings are equal, zero otherwise. + */ +#define MHD_str_has_s_token_caseless_(str,tkn) \ + MHD_str_has_token_caseless_((str),(tkn),MHD_STATICSTR_LEN_(tkn)) + +#ifndef MHD_FAVOR_SMALL_CODE +/* Use individual function for each case to improve speed */ + +/** + * Convert decimal US-ASCII digits in string to number in uint64_t. + * Conversion stopped at first non-digit character. + * @param str string to convert + * @param out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_str_to_uint64_ (const char * str, + uint64_t * out_val); + +/** + * Convert not more then @a maxlen decimal US-ASCII digits in string to + * number in uint64_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_str_to_uint64_n_ (const char * str, + size_t maxlen, + uint64_t * out_val); + + +/** + * Convert hexadecimal US-ASCII digits in string to number in uint32_t. + * Conversion stopped at first non-digit character. + * @param str string to convert + * @param out_val pointer to uint32_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint32_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint32_ (const char * str, + uint32_t * out_val); + + +/** + * Convert not more then @a maxlen hexadecimal US-ASCII digits in string + * to number in uint32_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param out_val pointer to uint32_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint32_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint32_n_ (const char * str, + size_t maxlen, + uint32_t * out_val); + + +/** + * Convert hexadecimal US-ASCII digits in string to number in uint64_t. + * Conversion stopped at first non-digit character. + * @param str string to convert + * @param out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint64_ (const char * str, + uint64_t * out_val); + + +/** + * Convert not more then @a maxlen hexadecimal US-ASCII digits in string + * to number in uint64_t. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * @param str string to convert + * @param maxlen maximum number of characters to process + * @param out_val pointer to uint64_t to store result of conversion + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then possible to store in uint64_t or @a out_val is NULL + */ +size_t +MHD_strx_to_uint64_n_ (const char * str, + size_t maxlen, + uint64_t * out_val); + +#else /* MHD_FAVOR_SMALL_CODE */ +/* Use one universal function and macros to reduce size */ + +/** + * Generic function for converting not more then @a maxlen + * hexadecimal or decimal US-ASCII digits in string to number. + * Conversion stopped at first non-digit character or after @a maxlen + * digits. + * To be used only within macro. + * @param str the string to convert + * @param maxlen the maximum number of characters to process + * @param out_val the pointer to uint64_t to store result of conversion + * @param val_size the size of variable pointed by @a out_val + * @param max_val the maximum decoded number + * @param base the numeric base, 10 or 16 + * @return non-zero number of characters processed on succeed, + * zero if no digit is found, resulting value is larger + * then @ max_val or @a out_val is NULL + */ +size_t +MHD_str_to_uvalue_n_ (const char * str, + size_t maxlen, + void * out_val, + size_t val_size, + uint64_t max_val, + int base); + +#define MHD_str_to_uint64_(s,ov) MHD_str_to_uvalue_n_((s),SIZE_MAX,(ov),\ + sizeof(uint64_t),UINT64_MAX,10) + +#define MHD_str_to_uint64_n_(s,ml,ov) MHD_str_to_uvalue_n_((s),(ml),(ov),\ + sizeof(uint64_t),UINT64_MAX,10) + +#define MHD_strx_to_sizet_(s,ov) MHD_str_to_uvalue_n_((s),SIZE_MAX,(ov),\ + sizeof(size_t),SIZE_MAX,16) + +#define MHD_strx_to_sizet_n_(s,ml,ov) MHD_str_to_uvalue_n_((s),(ml),(ov),\ + sizeof(size_t),SIZE_MAX,16) + +#define MHD_strx_to_uint32_(s,ov) MHD_str_to_uvalue_n_((s),SIZE_MAX,(ov),\ + sizeof(uint32_t),UINT32_MAX,16) + +#define MHD_strx_to_uint32_n_(s,ml,ov) MHD_str_to_uvalue_n_((s),(ml),(ov),\ + sizeof(uint32_t),UINT32_MAX,16) + +#define MHD_strx_to_uint64_(s,ov) MHD_str_to_uvalue_n_((s),SIZE_MAX,(ov),\ + sizeof(uint64_t),UINT64_MAX,16) + +#define MHD_strx_to_uint64_n_(s,ml,ov) MHD_str_to_uvalue_n_((s),(ml),(ov),\ + sizeof(uint64_t),UINT64_MAX,16) + +#endif /* MHD_FAVOR_SMALL_CODE */ + +#endif /* MHD_STR_H */ diff --git a/src/microhttpd/mhd_threads.c b/src/microhttpd/mhd_threads.c new file mode 100644 index 0000000..6578e4b --- /dev/null +++ b/src/microhttpd/mhd_threads.c @@ -0,0 +1,363 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_threads.c + * @brief Implementation for thread functions + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_threads.h" +#ifdef MHD_USE_W32_THREADS +#include "mhd_limits.h" +#include +#endif +#ifdef MHD_USE_THREAD_NAME_ +#include +#ifdef HAVE_PTHREAD_NP_H +#include +#endif /* HAVE_PTHREAD_NP_H */ +#endif /* MHD_USE_THREAD_NAME_ */ +#include + + +#ifndef MHD_USE_THREAD_NAME_ + +#define MHD_set_thread_name_(t, n) (void) +#define MHD_set_cur_thread_name_(n) (void) + +#else /* MHD_USE_THREAD_NAME_ */ + +#if defined(MHD_USE_POSIX_THREADS) +#if defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) +# define MHD_USE_THREAD_ATTR_SETNAME 1 +#endif /* HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD || HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI */ + +#if defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) \ + || defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) + +/** + * Set thread name + * + * @param thread_id ID of thread + * @param thread_name name to set + * @return non-zero on success, zero otherwise + */ +static int +MHD_set_thread_name_(const MHD_thread_ID_ thread_id, + const char *thread_name) +{ + if (NULL == thread_name) + return 0; + +#if defined(HAVE_PTHREAD_SETNAME_NP_GNU) + return !pthread_setname_np (thread_id, thread_name); +#elif defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) + /* FreeBSD and OpenBSD use different name and void return type */ + pthread_set_name_np (thread_id, thread_name); + return !0; +#elif defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) + /* NetBSD use 3 arguments: second argument is string in printf-like format, + * third argument is single argument for printf; + * OSF1 use 3 arguments too, but last one always must be zero (NULL). + * MHD doesn't use '%' in thread names, so both form are used in same way. + */ + return !pthread_setname_np (thread_id, thread_name, 0); +#endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */ +} + + +#ifndef __QNXNTO__ +/** + * Set current thread name + * @param n name to set + * @return non-zero on success, zero otherwise + */ +#define MHD_set_cur_thread_name_(n) MHD_set_thread_name_(pthread_self(),(n)) +#else /* __QNXNTO__ */ +/* Special case for QNX Neutrino - using zero for thread ID sets name faster. */ +#define MHD_set_cur_thread_name_(n) MHD_set_thread_name_(0,(n)) +#endif /* __QNXNTO__ */ +#elif defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) + +/** + * Set current thread name + * @param n name to set + * @return non-zero on success, zero otherwise + */ +#define MHD_set_cur_thread_name_(n) (!(pthread_setname_np((n)))) +#endif /* HAVE_PTHREAD_SETNAME_NP_DARWIN */ + +#elif defined(MHD_USE_W32_THREADS) +#ifndef _MSC_FULL_VER +/* Thread name available only for VC-compiler */ +#else /* _MSC_FULL_VER */ +/** + * Set thread name + * + * @param thread_id ID of thread, -1 for current thread + * @param thread_name name to set + * @return non-zero on success, zero otherwise + */ +static int +MHD_set_thread_name_(const MHD_thread_ID_ thread_id, + const char *thread_name) +{ + static const DWORD VC_SETNAME_EXC = 0x406D1388; +#pragma pack(push,8) + struct thread_info_struct + { + DWORD type; /* Must be 0x1000. */ + LPCSTR name; /* Pointer to name (in user address space). */ + DWORD ID; /* Thread ID (-1 = caller thread). */ + DWORD flags; /* Reserved for future use, must be zero. */ + } thread_info; +#pragma pack(pop) + + if (NULL == thread_name) + return 0; + + thread_info.type = 0x1000; + thread_info.name = thread_name; + thread_info.ID = thread_id; + thread_info.flags = 0; + + __try + { /* This exception is intercepted by debugger */ + RaiseException (VC_SETNAME_EXC, + 0, + sizeof (thread_info) / sizeof(ULONG_PTR), + (ULONG_PTR *) &thread_info); + } + __except (EXCEPTION_EXECUTE_HANDLER) + {} + + return !0; +} + + +/** + * Set current thread name + * @param n name to set + * @return non-zero on success, zero otherwise + */ +#define MHD_set_cur_thread_name_(n) MHD_set_thread_name_(-1,(n)) +#endif /* _MSC_FULL_VER */ +#endif /* MHD_USE_W32_THREADS */ + +#endif /* MHD_USE_THREAD_NAME_ */ + + +/** + * Create a thread and set the attributes according to our options. + * + * @param thread handle to initialize + * @param stack_size size of stack for new thread, 0 for default + * @param start_routine main function of thread + * @param arg argument for start_routine + * @return non-zero on success; zero otherwise (with errno set) + */ +int +MHD_create_thread_ (MHD_thread_handle_ID_ *thread, + size_t stack_size, + MHD_THREAD_START_ROUTINE_ start_routine, + void *arg) +{ +#if defined(MHD_USE_POSIX_THREADS) + int res; + + if (0 != stack_size) + { + pthread_attr_t attr; + res = pthread_attr_init (&attr); + if (0 == res) + { + res = pthread_attr_setstacksize (&attr, + stack_size); + if (0 == res) + res = pthread_create (&(thread->handle), + &attr, + start_routine, + arg); + pthread_attr_destroy (&attr); + } + } + else + res = pthread_create (&(thread->handle), + NULL, + start_routine, + arg); + + if (0 != res) + errno = res; + + return !res; +#elif defined(MHD_USE_W32_THREADS) +#if SIZE_MAX != UINT_MAX + if (stack_size > UINT_MAX) + { + errno = EINVAL; + return 0; + } +#endif /* SIZE_MAX != UINT_MAX */ + + thread->handle = (MHD_thread_handle_) + _beginthreadex (NULL, + (unsigned int) stack_size, + start_routine, + arg, + 0, + NULL); + + if ((MHD_thread_handle_)-1 == thread->handle) + return 0; + + return !0; +#endif +} + +#ifdef MHD_USE_THREAD_NAME_ + +#ifndef MHD_USE_THREAD_ATTR_SETNAME +struct MHD_named_helper_param_ +{ + /** + * Real thread start routine + */ + MHD_THREAD_START_ROUTINE_ start_routine; + + /** + * Argument for thread start routine + */ + void *arg; + + /** + * Name for thread + */ + const char *name; +}; + + +static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ +named_thread_starter (void *data) +{ + struct MHD_named_helper_param_ * const param = + (struct MHD_named_helper_param_ *) data; + void * arg; + MHD_THREAD_START_ROUTINE_ thr_func; + + if (NULL == data) + return (MHD_THRD_RTRN_TYPE_)0; + + MHD_set_cur_thread_name_ (param->name); + + arg = param->arg; + thr_func = param->start_routine; + free(data); + + return thr_func(arg); +} +#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ + + +/** + * Create a named thread and set the attributes according to our options. + * + * @param thread handle to initialize + * @param thread_name name for new thread + * @param stack_size size of stack for new thread, 0 for default + * @param start_routine main function of thread + * @param arg argument for start_routine + * @return non-zero on success; zero otherwise (with errno set) + */ +int +MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread, + const char* thread_name, + size_t stack_size, + MHD_THREAD_START_ROUTINE_ start_routine, + void *arg) +{ +#if defined(MHD_USE_THREAD_ATTR_SETNAME) + int res; + pthread_attr_t attr; + + res = pthread_attr_init (&attr); + if (0 == res) + { +#if defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) + /* NetBSD use 3 arguments: second argument is string in printf-like format, + * third argument is single argument for printf; + * OSF1 use 3 arguments too, but last one always must be zero (NULL). + * MHD doesn't use '%' in thread names, so both form are used in same way. + */ + res = pthread_attr_setname_np (&attr, thread_name, 0); +#elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) + res = pthread_attr_setname_np (&attr, thread_name); +#else +#error No pthread_attr_setname_np() function. +#endif + if (res == 0 && 0 != stack_size) + res = pthread_attr_setstacksize (&attr, + stack_size); + if (0 == res) + res = pthread_create (&(thread->handle), + &attr, + start_routine, + arg); + pthread_attr_destroy (&attr); + } + if (0 != res) + errno = res; + + return !res; +#else /* ! MHD_USE_THREAD_ATTR_SETNAME */ + struct MHD_named_helper_param_ *param; + + if (NULL == thread_name) + { + errno = EINVAL; + return 0; + } + + param = malloc (sizeof (struct MHD_named_helper_param_)); + if (NULL == param) + return 0; + + param->start_routine = start_routine; + param->arg = arg; + param->name = thread_name; + + /* Set thread name in thread itself to avoid problems with + * threads which terminated before name is set in other thread. + */ + if (! MHD_create_thread_(thread, + stack_size, + &named_thread_starter, + (void*)param)) + { + free (param); + return 0; + } + + return !0; +#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ +} + +#endif /* MHD_USE_THREAD_NAME_ */ diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h new file mode 100644 index 0000000..6d69b9e --- /dev/null +++ b/src/microhttpd/mhd_threads.h @@ -0,0 +1,229 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/** + * @file microhttpd/mhd_threads.h + * @brief Header for platform-independent threads abstraction + * @author Karlson2k (Evgeny Grin) + * + * Provides basic abstraction for threads. + * Any functions can be implemented as macro on some platforms + * unless explicitly marked otherwise. + * Any function argument can be skipped in macro, so avoid + * variable modification in function parameters. + * + * @warning Unlike pthread functions, most of functions return + * nonzero on success. + */ + +#ifndef MHD_THREADS_H +#define MHD_THREADS_H 1 + +#include "mhd_options.h" +#ifdef HAVE_STDDEF_H +# include /* for size_t */ +#else /* ! HAVE_STDDEF_H */ +# include /* for size_t */ +#endif /* ! HAVE_STDDEF_H */ + +#if defined(MHD_USE_POSIX_THREADS) +# undef HAVE_CONFIG_H +# include +# define HAVE_CONFIG_H 1 +#elif defined(MHD_USE_W32_THREADS) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif /* !WIN32_LEAN_AND_MEAN */ +# include +#else +# error No threading API is available. +#endif + +#ifndef MHD_NO_THREAD_NAMES +# if defined(MHD_USE_POSIX_THREADS) +# if defined(HAVE_PTHREAD_SETNAME_NP_GNU) || defined(HAVE_PTHREAD_SET_NAME_NP_FREEBSD) || \ + defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) || defined(HAVE_PTHREAD_SETNAME_NP_NETBSD) || \ + defined(HAVE_PTHREAD_ATTR_SETNAME_NP_NETBSD) || defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) +# define MHD_USE_THREAD_NAME_ +# endif /* HAVE_PTHREAD_SETNAME_NP */ +# elif defined(MHD_USE_W32_THREADS) +# ifdef _MSC_FULL_VER + /* Thread names only available with VC compiler */ +# define MHD_USE_THREAD_NAME_ +# endif /* _MSC_FULL_VER */ +# endif +#endif + +#if defined(MHD_USE_POSIX_THREADS) + typedef pthread_t MHD_thread_handle_; +#elif defined(MHD_USE_W32_THREADS) + typedef HANDLE MHD_thread_handle_; +#endif + +#if defined(MHD_USE_POSIX_THREADS) +# define MHD_THRD_RTRN_TYPE_ void* +# define MHD_THRD_CALL_SPEC_ +#elif defined(MHD_USE_W32_THREADS) +# define MHD_THRD_RTRN_TYPE_ unsigned +# define MHD_THRD_CALL_SPEC_ __stdcall +#endif + +#if defined(MHD_USE_POSIX_THREADS) + typedef pthread_t MHD_thread_ID_; +#elif defined(MHD_USE_W32_THREADS) + typedef DWORD MHD_thread_ID_; +#endif + +/* Depending on implementation, pthread_create() MAY set thread ID into + * provided pointer and after it start thread OR start thread and after + * if set thread ID. In latter case, to avoid data races, additional + * pthread_self() call is required in thread routine. Is some platform + * is known for setting thread ID BEFORE starting thread macro + * MHD_PTHREAD_CREATE__SET_ID_BEFORE_START_THREAD could be defined + * to save some resources. */ +#if defined(MHD_USE_POSIX_THREADS) +# ifdef MHD_PTHREAD_CREATE__SET_ID_BEFORE_START_THREAD + union _MHD_thread_handle_ID_ + { + MHD_thread_handle_ handle; /**< To be used in other threads */ + MHD_thread_ID_ ID; /**< To be used in thread itself */ + }; + typedef union _MHD_thread_handle_ID_ MHD_thread_handle_ID_; +# else /* ! MHD_PTHREAD_CREATE__SET_ID_BEFORE_START_THREAD */ + struct _MHD_thread_handle_ID_ + { + MHD_thread_handle_ handle; /**< To be used in other threads */ + MHD_thread_ID_ ID; /**< To be used in thread itself */ + }; + typedef struct _MHD_thread_handle_ID_ MHD_thread_handle_ID_; +# endif /* ! MHD_PTHREAD_CREATE__SET_ID_BEFORE_START_THREAD */ +#elif defined(MHD_USE_W32_THREADS) + struct _MHD_thread_handle_ID_ + { + MHD_thread_handle_ handle; /**< To be used in other threads */ + MHD_thread_ID_ ID; /**< To be used in thread itself */ + }; + typedef struct _MHD_thread_handle_ID_ MHD_thread_handle_ID_; +#endif + +#if defined(MHD_USE_POSIX_THREADS) +/** + * Wait until specified thread is ended and free thread handle on success. + * @param thread handle to watch + * @return nonzero on success, zero otherwise + */ +#define MHD_join_thread_(thread) (!pthread_join((thread), NULL)) +#elif defined(MHD_USE_W32_THREADS) +/** + * Wait until specified thread is ended and free thread handle on success. + * @param thread handle to watch + * @return nonzero on success, zero otherwise + */ +#define MHD_join_thread_(thread) (WAIT_OBJECT_0 == WaitForSingleObject((thread), INFINITE) ? (CloseHandle((thread)), !0) : 0) +#endif + +#if defined(MHD_USE_POSIX_THREADS) +/** + * Check whether provided thread ID match current thread. + * @param ID thread ID to match + * @return nonzero on match, zero otherwise + */ +#define MHD_thread_ID_match_current_(ID) (pthread_equal((ID), pthread_self())) +#elif defined(MHD_USE_W32_THREADS) +/** + * Check whether provided thread ID match current thread. + * @param ID thread ID to match + * @return nonzero on match, zero otherwise + */ +#define MHD_thread_ID_match_current_(ID) (GetCurrentThreadId() == (ID)) +#endif + +#if defined(MHD_USE_POSIX_THREADS) +# ifdef MHD_PTHREAD_CREATE__SET_ID_BEFORE_START_THREAD +/** + * Initialise thread ID. + * @param thread_handle_ID_ptr pointer to thread handle-ID + */ +#define MHD_thread_init_(thread_handle_ID_ptr) (void)0 +# else /* ! MHD_PTHREAD_CREATE__SET_ID_BEFORE_START_THREAD */ +/** + * Initialise thread ID. + * @param thread_handle_ID_ptr pointer to thread handle-ID + */ +#define MHD_thread_init_(thread_handle_ID_ptr) ((thread_handle_ID_ptr)->ID=pthread_self()) +# endif /* ! MHD_PTHREAD_CREATE__SET_ID_BEFORE_START_THREAD */ +#elif defined(MHD_USE_W32_THREADS) +/** + * Initialise thread ID. + * @param thread_handle_ID_ptr pointer to thread handle-ID + */ +#define MHD_thread_init_(thread_handle_ID_ptr) ((thread_handle_ID_ptr)->ID=GetCurrentThreadId()) +#endif + +/** + * Signature of main function for a thread. + * + * @param cls closure argument for the function + * @return termination code from the thread + */ +typedef MHD_THRD_RTRN_TYPE_ +(MHD_THRD_CALL_SPEC_ *MHD_THREAD_START_ROUTINE_)(void *cls); + + +/** + * Create a thread and set the attributes according to our options. + * + * If thread is created, thread handle must be freed by MHD_join_thread_(). + * + * @param thread handle to initialize + * @param stack_size size of stack for new thread, 0 for default + * @param start_routine main function of thread + * @param arg argument for start_routine + * @return non-zero on success; zero otherwise + */ +int +MHD_create_thread_ (MHD_thread_handle_ID_ *thread, + size_t stack_size, + MHD_THREAD_START_ROUTINE_ start_routine, + void *arg); + +#ifndef MHD_USE_THREAD_NAME_ +#define MHD_create_named_thread_(t,n,s,r,a) MHD_create_thread_((t),(s),(r),(a)) +#else /* MHD_USE_THREAD_NAME_ */ +/** + * Create a named thread and set the attributes according to our options. + * + * @param thread handle to initialize + * @param thread_name name for new thread + * @param stack_size size of stack for new thread, 0 for default + * @param start_routine main function of thread + * @param arg argument for start_routine + * @return non-zero on success; zero otherwise + */ +int +MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread, + const char* thread_name, + size_t stack_size, + MHD_THREAD_START_ROUTINE_ start_routine, + void *arg); + +#endif /* MHD_USE_THREAD_NAME_ */ + +#endif /* ! MHD_THREADS_H */ diff --git a/src/microhttpd/microhttpd_dll_res.rc.in b/src/microhttpd/microhttpd_dll_res.rc.in new file mode 100644 index 0000000..16a6bba --- /dev/null +++ b/src/microhttpd/microhttpd_dll_res.rc.in @@ -0,0 +1,35 @@ +/* W32 resources for .dll */ + +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +VS_VERSION_INFO VERSIONINFO + FILEVERSION @PACKAGE_VERSION_MAJOR@,@PACKAGE_VERSION_MINOR@,@PACKAGE_VERSION_SUBMINOR@,0 + PRODUCTVERSION @PACKAGE_VERSION_MAJOR@,@PACKAGE_VERSION_MINOR@,@PACKAGE_VERSION_SUBMINOR@,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "04090000" /* Lang = US English, Charset = ASCII */ + BEGIN + VALUE "ProductName", "GNU libmicrohttpd\0" + VALUE "ProductVersion", "@PACKAGE_VERSION@\0" + VALUE "FileVersion", "@PACKAGE_VERSION@\0" + VALUE "FileDescription", "GNU libmicrohttpd DLL for Windows (MinGW build)\0" + VALUE "InternalName", "libmicrohttpd\0" + VALUE "OriginalFilename", "libmicrohttpd-@MHD_W32_DLL_SUFF@.dll\0" + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "LegalCopyright", "Copyright (C) 2007-2017 Christian Grothoff and project contributors\0" + VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0 /* US English, ASCII */ + END +END + diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c new file mode 100644 index 0000000..8b710ea --- /dev/null +++ b/src/microhttpd/postprocessor.c @@ -0,0 +1,1282 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007-2013 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file postprocessor.c + * @brief Methods for parsing POST data + * @author Christian Grothoff + */ + +#include "internal.h" +#include "mhd_str.h" +#include "mhd_compat.h" + +/** + * Size of on-stack buffer that we use for un-escaping of the value. + * We use a pretty small value to be nice to the stack on embedded + * systems. + */ +#define XBUF_SIZE 512 + +/** + * States in the PP parser's state machine. + */ +enum PP_State +{ + /* general states */ + PP_Error, + PP_Done, + PP_Init, + PP_NextBoundary, + + /* url encoding-states */ + PP_ProcessValue, + PP_ExpectNewLine, + + /* post encoding-states */ + PP_ProcessEntryHeaders, + PP_PerformCheckMultipart, + PP_ProcessValueToBoundary, + PP_PerformCleanup, + + /* nested post-encoding states */ + PP_Nested_Init, + PP_Nested_PerformMarking, + PP_Nested_ProcessEntryHeaders, + PP_Nested_ProcessValueToBoundary, + PP_Nested_PerformCleanup + +}; + + +enum RN_State +{ + /** + * No RN-preprocessing in this state. + */ + RN_Inactive = 0, + + /** + * If the next character is CR, skip it. Otherwise, + * just go inactive. + */ + RN_OptN = 1, + + /** + * Expect LFCR (and only LFCR). As always, we also + * expect only LF or only CR. + */ + RN_Full = 2, + + /** + * Expect either LFCR or '--'LFCR. If '--'LFCR, transition into dash-state + * for the main state machine + */ + RN_Dash = 3, + + /** + * Got a single dash, expect second dash. + */ + RN_Dash2 = 4 +}; + + +/** + * Bits for the globally known fields that + * should not be deleted when we exit the + * nested state. + */ +enum NE_State +{ + NE_none = 0, + NE_content_name = 1, + NE_content_type = 2, + NE_content_filename = 4, + NE_content_transfer_encoding = 8 +}; + + +/** + * Internal state of the post-processor. Note that the fields + * are sorted by type to enable optimal packing by the compiler. + */ +struct MHD_PostProcessor +{ + + /** + * The connection for which we are doing + * POST processing. + */ + struct MHD_Connection *connection; + + /** + * Function to call with POST data. + */ + MHD_PostDataIterator ikvi; + + /** + * Extra argument to ikvi. + */ + void *cls; + + /** + * Encoding as given by the headers of the + * connection. + */ + const char *encoding; + + /** + * Primary boundary (points into encoding string) + */ + const char *boundary; + + /** + * Nested boundary (if we have multipart/mixed encoding). + */ + char *nested_boundary; + + /** + * Pointer to the name given in disposition. + */ + char *content_name; + + /** + * Pointer to the (current) content type. + */ + char *content_type; + + /** + * Pointer to the (current) filename. + */ + char *content_filename; + + /** + * Pointer to the (current) encoding. + */ + char *content_transfer_encoding; + + /** + * Unprocessed value bytes due to escape + * sequences (URL-encoding only). + */ + char xbuf[8]; + + /** + * Size of our buffer for the key. + */ + size_t buffer_size; + + /** + * Current position in the key buffer. + */ + size_t buffer_pos; + + /** + * Current position in @e xbuf. + */ + size_t xbuf_pos; + + /** + * Current offset in the value being processed. + */ + uint64_t value_offset; + + /** + * strlen(boundary) -- if boundary != NULL. + */ + size_t blen; + + /** + * strlen(nested_boundary) -- if nested_boundary != NULL. + */ + size_t nlen; + + /** + * Do we have to call the 'ikvi' callback when processing the + * multipart post body even if the size of the payload is zero? + * Set to #MHD_YES whenever we parse a new multiparty entry header, + * and to #MHD_NO the first time we call the 'ikvi' callback. + * Used to ensure that we do always call 'ikvi' even if the + * payload is empty (but not more than once). + */ + int must_ikvi; + + /** + * State of the parser. + */ + enum PP_State state; + + /** + * Side-state-machine: skip LRCR (or just LF). + * Set to 0 if we are not in skip mode. Set to 2 + * if a LFCR is expected, set to 1 if a CR should + * be skipped if it is the next character. + */ + enum RN_State skip_rn; + + /** + * If we are in skip_rn with "dash" mode and + * do find 2 dashes, what state do we go into? + */ + enum PP_State dash_state; + + /** + * Which headers are global? (used to tell which + * headers were only valid for the nested multipart). + */ + enum NE_State have; + +}; + + +/** + * Create a `struct MHD_PostProcessor`. + * + * A `struct MHD_PostProcessor` can be used to (incrementally) parse + * the data portion of a POST request. Note that some buggy browsers + * fail to set the encoding type. If you want to support those, you + * may have to call #MHD_set_connection_value with the proper encoding + * type before creating a post processor (if no supported encoding + * type is set, this function will fail). + * + * @param connection the connection on which the POST is + * happening (used to determine the POST format) + * @param buffer_size maximum number of bytes to use for + * internal buffering (used only for the parsing, + * specifically the parsing of the keys). A + * tiny value (256-1024) should be sufficient. + * Do NOT use a value smaller than 256. For good + * performance, use 32 or 64k (i.e. 65536). + * @param iter iterator to be called with the parsed data, + * Must NOT be NULL. + * @param iter_cls first argument to @a iter + * @return NULL on error (out of memory, unsupported encoding), + * otherwise a PP handle + * @ingroup request + */ +struct MHD_PostProcessor * +MHD_create_post_processor (struct MHD_Connection *connection, + size_t buffer_size, + MHD_PostDataIterator iter, + void *iter_cls) +{ + struct MHD_PostProcessor *ret; + const char *encoding; + const char *boundary; + size_t blen; + + if ( (buffer_size < 256) || + (NULL == connection) || + (NULL == iter)) + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__, + NULL); + encoding = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + MHD_HTTP_HEADER_CONTENT_TYPE); + if (NULL == encoding) + return NULL; + boundary = NULL; + if (! MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, + encoding, + MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) + { + if (! MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, + encoding, + MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))) + return NULL; + boundary = + &encoding[MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA)]; + /* Q: should this be "strcasestr"? */ + boundary = strstr (boundary, "boundary="); + if (NULL == boundary) + return NULL; /* failed to determine boundary */ + boundary += MHD_STATICSTR_LEN_ ("boundary="); + blen = strlen (boundary); + if ( (blen == 0) || + (blen * 2 + 2 > buffer_size) ) + return NULL; /* (will be) out of memory or invalid boundary */ + if ( (boundary[0] == '"') && + (boundary[blen - 1] == '"') ) + { + /* remove enclosing quotes */ + ++boundary; + blen -= 2; + } + } + else + blen = 0; + buffer_size += 4; /* round up to get nice block sizes despite boundary search */ + + /* add +1 to ensure we ALWAYS have a zero-termination at the end */ + if (NULL == (ret = MHD_calloc_ (1, sizeof (struct MHD_PostProcessor) + buffer_size + 1))) + return NULL; + ret->connection = connection; + ret->ikvi = iter; + ret->cls = iter_cls; + ret->encoding = encoding; + ret->buffer_size = buffer_size; + ret->state = PP_Init; + ret->blen = blen; + ret->boundary = boundary; + ret->skip_rn = RN_Inactive; + return ret; +} + + +/** + * Process url-encoded POST data. + * + * @param pp post processor context + * @param post_data upload data + * @param post_data_len number of bytes in @a post_data + * @return #MHD_YES on success, #MHD_NO if there was an error processing the data + */ +static int +post_process_urlencoded (struct MHD_PostProcessor *pp, + const char *post_data, + size_t post_data_len) +{ + size_t equals; + size_t amper; + size_t poff; + size_t xoff; + size_t delta; + int end_of_value_found; + char *buf; + char xbuf[XBUF_SIZE + 1]; + + buf = (char *) &pp[1]; + poff = 0; + while (poff < post_data_len) + { + switch (pp->state) + { + case PP_Error: + return MHD_NO; + case PP_Done: + /* did not expect to receive more data */ + pp->state = PP_Error; + return MHD_NO; + case PP_Init: + equals = 0; + while ((equals + poff < post_data_len) && + (post_data[equals + poff] != '=')) + equals++; + if (equals + pp->buffer_pos > pp->buffer_size) + { + pp->state = PP_Error; /* out of memory */ + return MHD_NO; + } + memcpy (&buf[pp->buffer_pos], &post_data[poff], equals); + pp->buffer_pos += equals; + if (equals + poff == post_data_len) + return MHD_YES; /* no '=' yet */ + buf[pp->buffer_pos] = '\0'; /* 0-terminate key */ + pp->buffer_pos = 0; /* reset for next key */ + MHD_unescape_plus (buf); + MHD_http_unescape (buf); + poff += equals + 1; + pp->state = PP_ProcessValue; + pp->value_offset = 0; + break; + case PP_ProcessValue: + /* obtain rest of value from previous iteration */ + memcpy (xbuf, pp->xbuf, pp->xbuf_pos); + xoff = pp->xbuf_pos; + pp->xbuf_pos = 0; + + /* find last position in input buffer that is part of the value */ + amper = 0; + while ((amper + poff < post_data_len) && + (amper < XBUF_SIZE) && + (post_data[amper + poff] != '&') && + (post_data[amper + poff] != '\n') && + (post_data[amper + poff] != '\r')) + amper++; + end_of_value_found = ((amper + poff < post_data_len) && + ((post_data[amper + poff] == '&') || + (post_data[amper + poff] == '\n') || + (post_data[amper + poff] == '\r'))); + /* compute delta, the maximum number of bytes that we will be able to + process right now (either amper-limited of xbuf-size limited) */ + delta = amper; + if (delta > XBUF_SIZE - xoff) + delta = XBUF_SIZE - xoff; + + /* move input into processing buffer */ + memcpy (&xbuf[xoff], &post_data[poff], delta); + xoff += delta; + poff += delta; + + /* find if escape sequence is at the end of the processing buffer; + if so, exclude those from processing (reduce delta to point at + end of processed region) */ + delta = xoff; + if ((delta > 0) && + ('%' == xbuf[delta - 1])) + delta--; + else if ((delta > 1) && + ('%' == xbuf[delta - 2])) + delta -= 2; + + /* if we have an incomplete escape sequence, save it to + pp->xbuf for later */ + if (delta < xoff) + { + memcpy (pp->xbuf, + &xbuf[delta], + xoff - delta); + pp->xbuf_pos = xoff - delta; + xoff = delta; + } + + /* If we have nothing to do (delta == 0) and + not just because the value is empty (are + waiting for more data), go for next iteration */ + if ( (0 == xoff) && + (poff == post_data_len)) + continue; + + /* unescape */ + xbuf[xoff] = '\0'; /* 0-terminate in preparation */ + MHD_unescape_plus (xbuf); + xoff = MHD_http_unescape (xbuf); + /* finally: call application! */ + pp->must_ikvi = MHD_NO; + if (MHD_NO == pp->ikvi (pp->cls, + MHD_POSTDATA_KIND, + (const char *) &pp[1], /* key */ + NULL, + NULL, + NULL, + xbuf, + pp->value_offset, + xoff)) + { + pp->state = PP_Error; + return MHD_NO; + } + pp->value_offset += xoff; + + /* are we done with the value? */ + if (end_of_value_found) + { + /* we found the end of the value! */ + if ( ('\n' == post_data[poff]) || + ('\r' == post_data[poff]) ) + { + pp->state = PP_ExpectNewLine; + } + else if ('&' == post_data[poff]) + { + poff++; /* skip '&' */ + pp->state = PP_Init; + } + } + break; + case PP_ExpectNewLine: + if ( ('\n' == post_data[poff]) || + ('\r' == post_data[poff]) ) + { + poff++; + /* we are done, report error if we receive any more... */ + pp->state = PP_Done; + return MHD_YES; + } + return MHD_NO; + default: + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__, + NULL); /* should never happen! */ + } + } + return MHD_YES; +} + + +/** + * If the given line matches the prefix, strdup the + * rest of the line into the suffix ptr. + * + * @param prefix prefix to match + * @param line line to match prefix in + * @param suffix set to a copy of the rest of the line, starting at the end of the match + * @return #MHD_YES if there was a match, #MHD_NO if not + */ +static int +try_match_header (const char *prefix, + char *line, + char **suffix) +{ + if (NULL != *suffix) + return MHD_NO; + while (0 != *line) + { + if (MHD_str_equal_caseless_n_ (prefix, + line, + strlen (prefix))) + { + *suffix = strdup (&line[strlen (prefix)]); + return MHD_YES; + } + ++line; + } + return MHD_NO; +} + + +/** + * + * @param pp post processor context + * @param boundary boundary to look for + * @param blen number of bytes in boundary + * @param ioffptr set to the end of the boundary if found, + * otherwise incremented by one (FIXME: quirky API!) + * @param next_state state to which we should advance the post processor + * if the boundary is found + * @param next_dash_state dash_state to which we should advance the + * post processor if the boundary is found + * @return #MHD_NO if the boundary is not found, #MHD_YES if we did find it + */ +static int +find_boundary (struct MHD_PostProcessor *pp, + const char *boundary, + size_t blen, + size_t *ioffptr, + enum PP_State next_state, + enum PP_State next_dash_state) +{ + char *buf = (char *) &pp[1]; + const char *dash; + + if (pp->buffer_pos < 2 + blen) + { + if (pp->buffer_pos == pp->buffer_size) + pp->state = PP_Error; /* out of memory */ + /* ++(*ioffptr); */ + return MHD_NO; /* not enough data */ + } + if ( (0 != memcmp ("--", + buf, + 2)) || + (0 != memcmp (&buf[2], + boundary, + blen))) + { + if (pp->state != PP_Init) + { + /* garbage not allowed */ + pp->state = PP_Error; + } + else + { + /* skip over garbage (RFC 2046, 5.1.1) */ + dash = memchr (buf, + '-', + pp->buffer_pos); + if (NULL == dash) + (*ioffptr) += pp->buffer_pos; /* skip entire buffer */ + else + if (dash == buf) + (*ioffptr)++; /* at least skip one byte */ + else + (*ioffptr) += dash - buf; /* skip to first possible boundary */ + } + return MHD_NO; /* expected boundary */ + } + /* remove boundary from buffer */ + (*ioffptr) += 2 + blen; + /* next: start with headers */ + pp->skip_rn = RN_Dash; + pp->state = next_state; + pp->dash_state = next_dash_state; + return MHD_YES; +} + + +/** + * In buf, there maybe an expression '$key="$value"'. If that is the + * case, copy a copy of $value to destination. + * + * If destination is already non-NULL, do nothing. + */ +static void +try_get_value (const char *buf, + const char *key, + char **destination) +{ + const char *spos; + const char *bpos; + const char *endv; + size_t klen; + size_t vlen; + + if (NULL != *destination) + return; + bpos = buf; + klen = strlen (key); + while (NULL != (spos = strstr (bpos, key))) + { + if ( (spos[klen] != '=') || + ( (spos != buf) && + (spos[-1] != ' ') ) ) + { + /* no match */ + bpos = spos + 1; + continue; + } + if (spos[klen + 1] != '"') + return; /* not quoted */ + if (NULL == (endv = strchr (&spos[klen + 2], + '\"'))) + return; /* no end-quote */ + vlen = endv - spos - klen - 1; + *destination = malloc (vlen); + if (NULL == *destination) + return; /* out of memory */ + (*destination)[vlen - 1] = '\0'; + memcpy (*destination, + &spos[klen + 2], + vlen - 1); + return; /* success */ + } +} + + +/** + * Go over the headers of the part and update + * the fields in "pp" according to what we find. + * If we are at the end of the headers (as indicated + * by an empty line), transition into next_state. + * + * @param pp post processor context + * @param ioffptr set to how many bytes have been + * processed + * @param next_state state to which the post processor should + * be advanced if we find the end of the headers + * @return #MHD_YES if we can continue processing, + * #MHD_NO on error or if we do not have + * enough data yet + */ +static int +process_multipart_headers (struct MHD_PostProcessor *pp, + size_t *ioffptr, + enum PP_State next_state) +{ + char *buf = (char *) &pp[1]; + size_t newline; + + newline = 0; + while ( (newline < pp->buffer_pos) && + (buf[newline] != '\r') && + (buf[newline] != '\n') ) + newline++; + if (newline == pp->buffer_size) + { + pp->state = PP_Error; + return MHD_NO; /* out of memory */ + } + if (newline == pp->buffer_pos) + return MHD_NO; /* will need more data */ + if (0 == newline) + { + /* empty line - end of headers */ + pp->skip_rn = RN_Full; + pp->state = next_state; + return MHD_YES; + } + /* got an actual header */ + if (buf[newline] == '\r') + pp->skip_rn = RN_OptN; + buf[newline] = '\0'; + if (MHD_str_equal_caseless_n_ ("Content-disposition: ", + buf, + MHD_STATICSTR_LEN_ ("Content-disposition: "))) + { + try_get_value (&buf[MHD_STATICSTR_LEN_ ("Content-disposition: ")], + "name", + &pp->content_name); + try_get_value (&buf[MHD_STATICSTR_LEN_ ("Content-disposition: ")], + "filename", + &pp->content_filename); + } + else + { + try_match_header ("Content-type: ", + buf, + &pp->content_type); + try_match_header ("Content-Transfer-Encoding: ", + buf, + &pp->content_transfer_encoding); + } + (*ioffptr) += newline + 1; + return MHD_YES; +} + + +/** + * We have the value until we hit the given boundary; + * process accordingly. + * + * @param pp post processor context + * @param ioffptr incremented based on the number of bytes processed + * @param boundary the boundary to look for + * @param blen strlen(boundary) + * @param next_state what state to go into after the + * boundary was found + * @param next_dash_state state to go into if the next + * boundary ends with "--" + * @return #MHD_YES if we can continue processing, + * #MHD_NO on error or if we do not have + * enough data yet + */ +static int +process_value_to_boundary (struct MHD_PostProcessor *pp, + size_t *ioffptr, + const char *boundary, + size_t blen, + enum PP_State next_state, + enum PP_State next_dash_state) +{ + char *buf = (char *) &pp[1]; + size_t newline; + const char *r; + + /* all data in buf until the boundary + (\r\n--+boundary) is part of the value */ + newline = 0; + while (1) + { + while (newline + 4 < pp->buffer_pos) + { + r = memchr (&buf[newline], + '\r', + pp->buffer_pos - newline - 4); + if (NULL == r) + { + newline = pp->buffer_pos - 4; + break; + } + newline = r - buf; + if (0 == memcmp ("\r\n--", + &buf[newline], + 4)) + break; + newline++; + } + if (newline + blen + 4 <= pp->buffer_pos) + { + /* can check boundary */ + if (0 != memcmp (&buf[newline + 4], + boundary, + blen)) + { + /* no boundary, "\r\n--" is part of content, skip */ + newline += 4; + continue; + } + else + { + /* boundary found, process until newline then + skip boundary and go back to init */ + pp->skip_rn = RN_Dash; + pp->state = next_state; + pp->dash_state = next_dash_state; + (*ioffptr) += blen + 4; /* skip boundary as well */ + buf[newline] = '\0'; + break; + } + } + else + { + /* cannot check for boundary, process content that + we have and check again later; except, if we have + no content, abort (out of memory) */ + if ( (0 == newline) && + (pp->buffer_pos == pp->buffer_size) ) + { + pp->state = PP_Error; + return MHD_NO; + } + break; + } + } + /* newline is either at beginning of boundary or + at least at the last character that we are sure + is not part of the boundary */ + if ( ( (MHD_YES == pp->must_ikvi) || + (0 != newline) ) && + (MHD_NO == pp->ikvi (pp->cls, + MHD_POSTDATA_KIND, + pp->content_name, + pp->content_filename, + pp->content_type, + pp->content_transfer_encoding, + buf, + pp->value_offset, + newline)) ) + { + pp->state = PP_Error; + return MHD_NO; + } + pp->must_ikvi = MHD_NO; + pp->value_offset += newline; + (*ioffptr) += newline; + return MHD_YES; +} + + +/** + * + * @param pp post processor context + */ +static void +free_unmarked (struct MHD_PostProcessor *pp) +{ + if ( (NULL != pp->content_name) && + (0 == (pp->have & NE_content_name)) ) + { + free (pp->content_name); + pp->content_name = NULL; + } + if ( (NULL != pp->content_type) && + (0 == (pp->have & NE_content_type)) ) + { + free (pp->content_type); + pp->content_type = NULL; + } + if ( (NULL != pp->content_filename) && + (0 == (pp->have & NE_content_filename)) ) + { + free (pp->content_filename); + pp->content_filename = NULL; + } + if ( (NULL != pp->content_transfer_encoding) && + (0 == (pp->have & NE_content_transfer_encoding)) ) + { + free (pp->content_transfer_encoding); + pp->content_transfer_encoding = NULL; + } +} + + +/** + * Decode multipart POST data. + * + * @param pp post processor context + * @param post_data data to decode + * @param post_data_len number of bytes in @a post_data + * @return #MHD_NO on error, + */ +static int +post_process_multipart (struct MHD_PostProcessor *pp, + const char *post_data, + size_t post_data_len) +{ + char *buf; + size_t max; + size_t ioff; + size_t poff; + int state_changed; + + buf = (char *) &pp[1]; + ioff = 0; + poff = 0; + state_changed = 1; + while ( (poff < post_data_len) || + ( (pp->buffer_pos > 0) && + (0 != state_changed) ) ) + { + /* first, move as much input data + as possible to our internal buffer */ + max = pp->buffer_size - pp->buffer_pos; + if (max > post_data_len - poff) + max = post_data_len - poff; + memcpy (&buf[pp->buffer_pos], + &post_data[poff], + max); + poff += max; + pp->buffer_pos += max; + if ( (0 == max) && + (0 == state_changed) && + (poff < post_data_len) ) + { + pp->state = PP_Error; + return MHD_NO; /* out of memory */ + } + state_changed = 0; + + /* first state machine for '\r'-'\n' and '--' handling */ + switch (pp->skip_rn) + { + case RN_Inactive: + break; + case RN_OptN: + if (buf[0] == '\n') + { + ioff++; + pp->skip_rn = RN_Inactive; + goto AGAIN; + } + /* fall-through! */ + case RN_Dash: + if (buf[0] == '-') + { + ioff++; + pp->skip_rn = RN_Dash2; + goto AGAIN; + } + pp->skip_rn = RN_Full; + /* fall-through! */ + case RN_Full: + if (buf[0] == '\r') + { + if ( (pp->buffer_pos > 1) && + ('\n' == buf[1]) ) + { + pp->skip_rn = RN_Inactive; + ioff += 2; + } + else + { + pp->skip_rn = RN_OptN; + ioff++; + } + goto AGAIN; + } + if (buf[0] == '\n') + { + ioff++; + pp->skip_rn = RN_Inactive; + goto AGAIN; + } + pp->skip_rn = RN_Inactive; + pp->state = PP_Error; + return MHD_NO; /* no '\r\n' */ + case RN_Dash2: + if (buf[0] == '-') + { + ioff++; + pp->skip_rn = RN_Full; + pp->state = pp->dash_state; + goto AGAIN; + } + pp->state = PP_Error; + break; + } + + /* main state engine */ + switch (pp->state) + { + case PP_Error: + return MHD_NO; + case PP_Done: + /* did not expect to receive more data */ + pp->state = PP_Error; + return MHD_NO; + case PP_Init: + /** + * Per RFC2046 5.1.1 NOTE TO IMPLEMENTORS, consume anything + * prior to the first multipart boundary: + * + * > There appears to be room for additional information prior + * > to the first boundary delimiter line and following the + * > final boundary delimiter line. These areas should + * > generally be left blank, and implementations must ignore + * > anything that appears before the first boundary delimiter + * > line or after the last one. + */ + (void) find_boundary (pp, + pp->boundary, + pp->blen, + &ioff, + PP_ProcessEntryHeaders, + PP_Done); + break; + case PP_NextBoundary: + if (MHD_NO == find_boundary (pp, + pp->boundary, + pp->blen, + &ioff, + PP_ProcessEntryHeaders, + PP_Done)) + { + if (pp->state == PP_Error) + return MHD_NO; + goto END; + } + break; + case PP_ProcessEntryHeaders: + pp->must_ikvi = MHD_YES; + if (MHD_NO == + process_multipart_headers (pp, + &ioff, + PP_PerformCheckMultipart)) + { + if (pp->state == PP_Error) + return MHD_NO; + else + goto END; + } + state_changed = 1; + break; + case PP_PerformCheckMultipart: + if ( (NULL != pp->content_type) && + (MHD_str_equal_caseless_n_ (pp->content_type, + "multipart/mixed", + MHD_STATICSTR_LEN_ ("multipart/mixed")))) + { + pp->nested_boundary = strstr (pp->content_type, + "boundary="); + if (NULL == pp->nested_boundary) + { + pp->state = PP_Error; + return MHD_NO; + } + pp->nested_boundary = + strdup (&pp->nested_boundary[MHD_STATICSTR_LEN_ ("boundary=")]); + if (NULL == pp->nested_boundary) + { + /* out of memory */ + pp->state = PP_Error; + return MHD_NO; + } + /* free old content type, we will need that field + for the content type of the nested elements */ + free (pp->content_type); + pp->content_type = NULL; + pp->nlen = strlen (pp->nested_boundary); + pp->state = PP_Nested_Init; + state_changed = 1; + break; + } + pp->state = PP_ProcessValueToBoundary; + pp->value_offset = 0; + state_changed = 1; + break; + case PP_ProcessValueToBoundary: + if (MHD_NO == process_value_to_boundary (pp, + &ioff, + pp->boundary, + pp->blen, + PP_PerformCleanup, + PP_Done)) + { + if (pp->state == PP_Error) + return MHD_NO; + break; + } + break; + case PP_PerformCleanup: + /* clean up state of one multipart form-data element! */ + pp->have = NE_none; + free_unmarked (pp); + if (NULL != pp->nested_boundary) + { + free (pp->nested_boundary); + pp->nested_boundary = NULL; + } + pp->state = PP_ProcessEntryHeaders; + state_changed = 1; + break; + case PP_Nested_Init: + if (NULL == pp->nested_boundary) + { + pp->state = PP_Error; + return MHD_NO; + } + if (MHD_NO == find_boundary (pp, + pp->nested_boundary, + pp->nlen, + &ioff, + PP_Nested_PerformMarking, + PP_NextBoundary /* or PP_Error? */ )) + { + if (pp->state == PP_Error) + return MHD_NO; + goto END; + } + break; + case PP_Nested_PerformMarking: + /* remember what headers were given + globally */ + pp->have = NE_none; + if (NULL != pp->content_name) + pp->have |= NE_content_name; + if (NULL != pp->content_type) + pp->have |= NE_content_type; + if (NULL != pp->content_filename) + pp->have |= NE_content_filename; + if (NULL != pp->content_transfer_encoding) + pp->have |= NE_content_transfer_encoding; + pp->state = PP_Nested_ProcessEntryHeaders; + state_changed = 1; + break; + case PP_Nested_ProcessEntryHeaders: + pp->value_offset = 0; + if (MHD_NO == + process_multipart_headers (pp, + &ioff, + PP_Nested_ProcessValueToBoundary)) + { + if (pp->state == PP_Error) + return MHD_NO; + else + goto END; + } + state_changed = 1; + break; + case PP_Nested_ProcessValueToBoundary: + if (MHD_NO == process_value_to_boundary (pp, + &ioff, + pp->nested_boundary, + pp->nlen, + PP_Nested_PerformCleanup, + PP_NextBoundary)) + { + if (pp->state == PP_Error) + return MHD_NO; + break; + } + break; + case PP_Nested_PerformCleanup: + free_unmarked (pp); + pp->state = PP_Nested_ProcessEntryHeaders; + state_changed = 1; + break; + default: + mhd_panic (mhd_panic_cls, + __FILE__, + __LINE__, + NULL); /* should never happen! */ + } + AGAIN: + if (ioff > 0) + { + memmove (buf, + &buf[ioff], + pp->buffer_pos - ioff); + pp->buffer_pos -= ioff; + ioff = 0; + state_changed = 1; + } + } +END: + if (0 != ioff) + { + memmove (buf, + &buf[ioff], + pp->buffer_pos - ioff); + pp->buffer_pos -= ioff; + } + if (poff < post_data_len) + { + pp->state = PP_Error; + return MHD_NO; /* serious error */ + } + return MHD_YES; +} + + +/** + * Parse and process POST data. Call this function when POST data is + * available (usually during an #MHD_AccessHandlerCallback) with the + * "upload_data" and "upload_data_size". Whenever possible, this will + * then cause calls to the #MHD_PostDataIterator. + * + * @param pp the post processor + * @param post_data @a post_data_len bytes of POST data + * @param post_data_len length of @a post_data + * @return #MHD_YES on success, #MHD_NO on error + * (out-of-memory, iterator aborted, parse error) + * @ingroup request + */ +int +MHD_post_process (struct MHD_PostProcessor *pp, + const char *post_data, + size_t post_data_len) +{ + if (0 == post_data_len) + return MHD_YES; + if (NULL == pp) + return MHD_NO; + if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_FORM_URLENCODED, + pp->encoding, + MHD_STATICSTR_LEN_(MHD_HTTP_POST_ENCODING_FORM_URLENCODED))) + return post_process_urlencoded (pp, + post_data, + post_data_len); + if (MHD_str_equal_caseless_n_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA, + pp->encoding, + MHD_STATICSTR_LEN_ (MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))) + return post_process_multipart (pp, + post_data, + post_data_len); + /* this should never be reached */ + return MHD_NO; +} + + +/** + * Release PostProcessor resources. + * + * @param pp post processor context to destroy + * @return #MHD_YES if processing completed nicely, + * #MHD_NO if there were spurious characters / formatting + * problems; it is common to ignore the return + * value of this function + * @ingroup request + */ +int +MHD_destroy_post_processor (struct MHD_PostProcessor *pp) +{ + int ret; + + if (NULL == pp) + return MHD_YES; + if (PP_ProcessValue == pp->state) + { + /* key without terminated value left at the end of the + buffer; fake receiving a termination character to + ensure it is also processed */ + post_process_urlencoded (pp, + "\n", + 1); + } + /* These internal strings need cleaning up since + the post-processing may have been interrupted + at any stage */ + if ( (pp->xbuf_pos > 0) || + ( (pp->state != PP_Done) && + (pp->state != PP_ExpectNewLine) ) ) + ret = MHD_NO; + else + ret = MHD_YES; + pp->have = NE_none; + free_unmarked (pp); + if (NULL != pp->nested_boundary) + free (pp->nested_boundary); + free (pp); + return ret; +} + +/* end of postprocessor.c */ diff --git a/src/microhttpd/reason_phrase.c b/src/microhttpd/reason_phrase.c new file mode 100644 index 0000000..a6ffc75 --- /dev/null +++ b/src/microhttpd/reason_phrase.c @@ -0,0 +1,183 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2011, 2017 Christian Grothoff, Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ +/** + * @file reason_phrase.c + * @brief Tables of the string response phrases + * @author Elliot Glaysher + * @author Christian Grothoff (minor code clean up) + * @author Karlson2k (Evgeny Grin) + */ +#include "platform.h" +#include "microhttpd.h" + +#ifndef NULL +#define NULL ((void*)0) +#endif + +static const char *const invalid_hundred[] = { + NULL +}; + +static const char *const one_hundred[] = { + "Continue", + "Switching Protocols", + "Processing" +}; + +static const char *const two_hundred[] = { + "OK", + "Created", + "Accepted", + "Non-Authoritative Information", + "No Content", + "Reset Content", + "Partial Content", + "Multi-Status", + "Already Reported", + "Unknown", + "Unknown", /* 210 */ + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", /* 215 */ + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", /* 220 */ + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", /* 225 */ + "IM Used" +}; + +static const char *const three_hundred[] = { + "Multiple Choices", + "Moved Permanently", + "Found", + "See Other", + "Not Modified", + "Use Proxy", + "Switch Proxy", + "Temporary Redirect", + "Permanent Redirect" +}; + +static const char *const four_hundred[] = { + "Bad Request", + "Unauthorized", + "Payment Required", + "Forbidden", + "Not Found", + "Method Not Allowed", + "Not Acceptable", + "Proxy Authentication Required", + "Request Timeout", + "Conflict", + "Gone", + "Length Required", + "Precondition Failed", + "Payload Too Large", + "URI Too Long", + "Unsupported Media Type", + "Range Not Satisfiable", + "Expectation Failed", + "Unknown", + "Unknown", + "Unknown", /* 420 */ + "Misdirected Request", + "Unprocessable Entity", + "Locked", + "Failed Dependency", + "Unordered Collection", + "Upgrade Required", + "Unknown", + "Precondition Required", + "Too Many Requests", + "Unknown", /* 430 */ + "Request Header Fields Too Large", + "Unknown", + "Unknown", + "Unknown", + "Unknown", /* 435 */ + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", /* 440 */ + "Unknown", + "Unknown", + "Unknown", + "No Response", + "Unknown", /* 445 */ + "Unknown", + "Unknown", + "Unknown", + "Retry With", + "Blocked by Windows Parental Controls", /* 450 */ + "Unavailable For Legal Reasons" +}; + +static const char *const five_hundred[] = { + "Internal Server Error", + "Not Implemented", + "Bad Gateway", + "Service Unavailable", + "Gateway Timeout", + "HTTP Version Not Supported", + "Variant Also Negotiates", + "Insufficient Storage", + "Loop Detected", + "Bandwidth Limit Exceeded", + "Not Extended", + "Network Authentication Required" +}; + + +struct MHD_Reason_Block +{ + size_t max; + const char *const*data; +}; + +#define BLOCK(m) { (sizeof(m) / sizeof(char*)), m } + +static const struct MHD_Reason_Block reasons[] = { + BLOCK (invalid_hundred), + BLOCK (one_hundred), + BLOCK (two_hundred), + BLOCK (three_hundred), + BLOCK (four_hundred), + BLOCK (five_hundred), +}; + + +const char * +MHD_get_reason_phrase_for (unsigned int code) +{ + if ( (code >= 100) && + (code < 600) && + (reasons[code / 100].max > (code % 100)) ) + return reasons[code / 100].data[code % 100]; + return "Unknown"; +} diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c new file mode 100644 index 0000000..d677cf6 --- /dev/null +++ b/src/microhttpd/response.c @@ -0,0 +1,1111 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009, 2010, 2016, 2017 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +/** + * @file response.c + * @brief Methods for managing response objects + * @author Daniel Pittman + * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) + */ + +#define MHD_NO_DEPRECATION 1 + +#include "mhd_options.h" +#ifdef HAVE_SYS_IOCTL_H +#include +#endif /* HAVE_SYS_IOCTL_H */ +#if defined(_WIN32) && ! defined(__CYGWIN__) +#include +#endif /* _WIN32 && !__CYGWIN__ */ + +#include "internal.h" +#include "response.h" +#include "mhd_limits.h" +#include "mhd_sockets.h" +#include "mhd_itc.h" +#include "mhd_str.h" +#include "connection.h" +#include "memorypool.h" +#include "mhd_compat.h" + + +#if defined(MHD_W32_MUTEX_) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif /* MHD_W32_MUTEX_ */ +#if defined(_WIN32) +#include /* for lseek(), read() */ +#endif /* _WIN32 */ + + +/** + * Add a header or footer line to the response. + * + * @param response response to add a header to + * @param kind header or footer + * @param header the header to add + * @param content value to add + * @return #MHD_NO on error (i.e. invalid header or content format). + */ +static int +add_response_entry (struct MHD_Response *response, + enum MHD_ValueKind kind, + const char *header, + const char *content) +{ + struct MHD_HTTP_Header *hdr; + + if ( (NULL == response) || + (NULL == header) || + (NULL == content) || + (0 == header[0]) || + (0 == content[0]) || + (NULL != strchr (header, '\t')) || + (NULL != strchr (header, '\r')) || + (NULL != strchr (header, '\n')) || + (NULL != strchr (content, '\t')) || + (NULL != strchr (content, '\r')) || + (NULL != strchr (content, '\n')) ) + return MHD_NO; + if (NULL == (hdr = malloc (sizeof (struct MHD_HTTP_Header)))) + return MHD_NO; + if (NULL == (hdr->header = strdup (header))) + { + free (hdr); + return MHD_NO; + } + if (NULL == (hdr->value = strdup (content))) + { + free (hdr->header); + free (hdr); + return MHD_NO; + } + hdr->kind = kind; + hdr->next = response->first_header; + response->first_header = hdr; + return MHD_YES; +} + + +/** + * Add a header line to the response. + * + * @param response response to add a header to + * @param header the header to add + * @param content value to add + * @return #MHD_NO on error (i.e. invalid header or content format). + * @ingroup response + */ +int +MHD_add_response_header (struct MHD_Response *response, + const char *header, + const char *content) +{ + return add_response_entry (response, + MHD_HEADER_KIND, + header, + content); +} + + +/** + * Add a footer line to the response. + * + * @param response response to remove a header from + * @param footer the footer to delete + * @param content value to delete + * @return #MHD_NO on error (i.e. invalid footer or content format). + * @ingroup response + */ +int +MHD_add_response_footer (struct MHD_Response *response, + const char *footer, + const char *content) +{ + return add_response_entry (response, + MHD_FOOTER_KIND, + footer, + content); +} + + +/** + * Delete a header (or footer) line from the response. + * + * @param response response to remove a header from + * @param header the header to delete + * @param content value to delete + * @return #MHD_NO on error (no such header known) + * @ingroup response + */ +int +MHD_del_response_header (struct MHD_Response *response, + const char *header, + const char *content) +{ + struct MHD_HTTP_Header *pos; + struct MHD_HTTP_Header *prev; + + if ( (NULL == header) || + (NULL == content) ) + return MHD_NO; + prev = NULL; + pos = response->first_header; + while (NULL != pos) + { + if ((0 == strcmp (header, + pos->header)) && + (0 == strcmp (content, + pos->value))) + { + free (pos->header); + free (pos->value); + if (NULL == prev) + response->first_header = pos->next; + else + prev->next = pos->next; + free (pos); + return MHD_YES; + } + prev = pos; + pos = pos->next; + } + return MHD_NO; +} + + +/** + * Get all of the headers (and footers) added to a response. + * + * @param response response to query + * @param iterator callback to call on each header; + * maybe NULL (then just count headers) + * @param iterator_cls extra argument to @a iterator + * @return number of entries iterated over + * @ingroup response + */ +int +MHD_get_response_headers (struct MHD_Response *response, + MHD_KeyValueIterator iterator, + void *iterator_cls) +{ + int numHeaders = 0; + struct MHD_HTTP_Header *pos; + + for (pos = response->first_header; + NULL != pos; + pos = pos->next) + { + numHeaders++; + if ((NULL != iterator) && + (MHD_YES != iterator (iterator_cls, + pos->kind, + pos->header, + pos->value))) + break; + } + return numHeaders; +} + + +/** + * Get a particular header (or footer) from the response. + * + * @param response response to query + * @param key which header to get + * @return NULL if header does not exist + * @ingroup response + */ +const char * +MHD_get_response_header (struct MHD_Response *response, + const char *key) +{ + struct MHD_HTTP_Header *pos; + + if (NULL == key) + return NULL; + for (pos = response->first_header; + NULL != pos; + pos = pos->next) + { + if ( MHD_str_equal_caseless_ (pos->header, key) ) + return pos->value; + } + return NULL; +} + +/** + * Check whether response header contains particular token. + * + * Token could be surrounded by spaces and tabs and delimited by comma. + * Case-insensitive match used for header names and tokens. + * + * @param response the response to query + * @param key header name + * @param token the token to find + * @param token_len the length of token, not including optional + * terminating null-character. + * @return true if token is found in specified header, + * false otherwise + */ +bool +MHD_check_response_header_token_ci (const struct MHD_Response *response, + const char *key, + const char *token, + size_t token_len) +{ + struct MHD_HTTP_Header *pos; + + if ( (NULL == key) || + ('\0' == key[0]) || + (NULL == token) || + ('\0' == token[0]) ) + return false; + + for (pos = response->first_header; + NULL != pos; + pos = pos->next) + { + if ( (pos->kind == MHD_HEADER_KIND) && + MHD_str_equal_caseless_ (pos->header, + key) && + MHD_str_has_token_caseless_ (pos->value, + token, + token_len) ) + return true; + } + return false; +} + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response, #MHD_SIZE_UNKNOWN for unknown + * @param block_size preferred block size for querying crc (advisory only, + * MHD may still call @a crc using smaller chunks); this + * is essentially the buffer size used for IO, clients + * should pick a value that is appropriate for IO and + * memory performance requirements + * @param crc callback to use to obtain response data + * @param crc_cls extra argument to @a crc + * @param crfc callback to call to free @a crc_cls resources + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +struct MHD_Response * +MHD_create_response_from_callback (uint64_t size, + size_t block_size, + MHD_ContentReaderCallback crc, + void *crc_cls, + MHD_ContentReaderFreeCallback crfc) +{ + struct MHD_Response *response; + + if ((NULL == crc) || (0 == block_size)) + return NULL; + if (NULL == (response = MHD_calloc_ (1, sizeof (struct MHD_Response) + block_size))) + return NULL; + response->fd = -1; + response->data = (void *) &response[1]; + response->data_buffer_size = block_size; + if (! MHD_mutex_init_ (&response->mutex)) + { + free (response); + return NULL; + } + response->crc = crc; + response->crfc = crfc; + response->crc_cls = crc_cls; + response->reference_count = 1; + response->total_size = size; + return response; +} + + +/** + * Set special flags and options for a response. + * + * @param response the response to modify + * @param flags to set for the response + * @param ... #MHD_RO_END terminated list of options + * @return #MHD_YES on success, #MHD_NO on error + */ +int +MHD_set_response_options (struct MHD_Response *response, + enum MHD_ResponseFlags flags, + ...) +{ + va_list ap; + int ret; + enum MHD_ResponseOptions ro; + + ret = MHD_YES; + response->flags = flags; + va_start (ap, flags); + while (MHD_RO_END != (ro = va_arg (ap, enum MHD_ResponseOptions))) + { + switch (ro) + { + default: + ret = MHD_NO; + break; + } + } + va_end (ap); + return ret; +} + + +/** + * Given a file descriptor, read data from the file + * to generate the response. + * + * @param cls pointer to the response + * @param pos offset in the file to access + * @param buf where to write the data + * @param max number of bytes to write at most + * @return number of bytes written + */ +static ssize_t +file_reader (void *cls, + uint64_t pos, + char *buf, + size_t max) +{ + struct MHD_Response *response = cls; +#if !defined(_WIN32) || defined(__CYGWIN__) + ssize_t n; +#else /* _WIN32 && !__CYGWIN__ */ + const HANDLE fh = (HANDLE) _get_osfhandle (response->fd); +#endif /* _WIN32 && !__CYGWIN__ */ + const int64_t offset64 = (int64_t)(pos + response->fd_off); + + if (offset64 < 0) + return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ + +#if !defined(_WIN32) || defined(__CYGWIN__) + if (max > SSIZE_MAX) + max = SSIZE_MAX; /* Clamp to maximum return value. */ + +#if defined(HAVE_PREAD64) + n = pread64(response->fd, buf, max, offset64); +#elif defined(HAVE_PREAD) + if ( (sizeof(off_t) < sizeof (uint64_t)) && + (offset64 > (uint64_t)INT32_MAX) ) + return MHD_CONTENT_READER_END_WITH_ERROR; /* Read at required position is not possible. */ + + n = pread(response->fd, buf, max, (off_t) offset64); +#else /* ! HAVE_PREAD */ +#if defined(HAVE_LSEEK64) + if (lseek64 (response->fd, + offset64, + SEEK_SET) != offset64) + return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */ +#else /* ! HAVE_LSEEK64 */ + if ( (sizeof(off_t) < sizeof (uint64_t)) && + (offset64 > (uint64_t)INT32_MAX) ) + return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */ + + if (lseek (response->fd, + (off_t) offset64, + SEEK_SET) != (off_t) offset64) + return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */ +#endif /* ! HAVE_LSEEK64 */ + n = read (response->fd, + buf, + max); + +#endif /* ! HAVE_PREAD */ + if (0 == n) + return MHD_CONTENT_READER_END_OF_STREAM; + if (n < 0) + return MHD_CONTENT_READER_END_WITH_ERROR; + return n; +#else /* _WIN32 && !__CYGWIN__ */ + if (INVALID_HANDLE_VALUE == fh) + return MHD_CONTENT_READER_END_WITH_ERROR; /* Value of 'response->fd' is not valid. */ + else + { + OVERLAPPED f_ol = {0, 0, {{0, 0}}, 0}; /* Initialize to zero. */ + ULARGE_INTEGER pos_uli; + DWORD toRead = (max > INT32_MAX) ? INT32_MAX : (DWORD) max; + DWORD resRead; + + pos_uli.QuadPart = (uint64_t) offset64; /* Simple transformation 64bit -> 2x32bit. */ + f_ol.Offset = pos_uli.LowPart; + f_ol.OffsetHigh = pos_uli.HighPart; + if (! ReadFile(fh, (void*)buf, toRead, &resRead, &f_ol)) + return MHD_CONTENT_READER_END_WITH_ERROR; /* Read error. */ + if (0 == resRead) + return MHD_CONTENT_READER_END_OF_STREAM; + return (ssize_t) resRead; + } +#endif /* _WIN32 && !__CYGWIN__ */ +} + + +/** + * Destroy file reader context. Closes the file + * descriptor. + * + * @param cls pointer to file descriptor + */ +static void +free_callback (void *cls) +{ + struct MHD_Response *response = cls; + + (void) close (response->fd); + response->fd = -1; +} + +#undef MHD_create_response_from_fd_at_offset + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode + * @param offset offset to start reading from in the file; + * Be careful! `off_t` may have been compiled to be a + * 64-bit variable for MHD, in which case your application + * also has to be compiled using the same options! Read + * the MHD manual for more details. + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +struct MHD_Response * +MHD_create_response_from_fd_at_offset (size_t size, + int fd, + off_t offset) +{ + return MHD_create_response_from_fd_at_offset64 (size, + fd, + offset); +} + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response; + * sizes larger than 2 GiB may be not supported by OS or + * MHD build; see ::MHD_FEATURE_LARGE_FILE + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode + * @param offset offset to start reading from in the file; + * reading file beyond 2 GiB may be not supported by OS or + * MHD build; see ::MHD_FEATURE_LARGE_FILE + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_fd_at_offset64 (uint64_t size, + int fd, + uint64_t offset) +{ + struct MHD_Response *response; + +#if !defined(HAVE___LSEEKI64) && !defined(HAVE_LSEEK64) + if ( (sizeof(uint64_t) > sizeof(off_t)) && + ( (size > (uint64_t)INT32_MAX) || + (offset > (uint64_t)INT32_MAX) || + ((size + offset) >= (uint64_t)INT32_MAX) ) ) + return NULL; +#endif + if ( ((int64_t)size < 0) || + ((int64_t)offset < 0) || + ((int64_t)(size + offset) < 0) ) + return NULL; + + response = MHD_create_response_from_callback (size, + 4 * 1024, + &file_reader, + NULL, + &free_callback); + if (NULL == response) + return NULL; + response->fd = fd; + response->fd_off = offset; + response->crc_cls = response; + return response; +} + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response + * @param fd file descriptor referring to a file on disk with the data + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +struct MHD_Response * +MHD_create_response_from_fd (size_t size, + int fd) +{ + return MHD_create_response_from_fd_at_offset64 (size, + fd, + 0); +} + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response; + * sizes larger than 2 GiB may be not supported by OS or + * MHD build; see ::MHD_FEATURE_LARGE_FILE + * @param fd file descriptor referring to a file on disk with the + * data; will be closed when response is destroyed; + * fd should be in 'blocking' mode + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_from_fd64 (uint64_t size, + int fd) +{ + return MHD_create_response_from_fd_at_offset64 (size, + fd, + 0); +} + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the @a data portion of the response + * @param data the data itself + * @param must_free libmicrohttpd should free data when done + * @param must_copy libmicrohttpd must make a copy of @a data + * right away, the data maybe released anytime after + * this call returns + * @return NULL on error (i.e. invalid arguments, out of memory) + * @deprecated use #MHD_create_response_from_buffer instead + * @ingroup response + */ +struct MHD_Response * +MHD_create_response_from_data (size_t size, + void *data, + int must_free, + int must_copy) +{ + struct MHD_Response *response; + void *tmp; + + if ((NULL == data) && (size > 0)) + return NULL; + if (NULL == (response = MHD_calloc_ (1, sizeof (struct MHD_Response)))) + return NULL; + response->fd = -1; + if (! MHD_mutex_init_ (&response->mutex)) + { + free (response); + return NULL; + } + if ((must_copy) && (size > 0)) + { + if (NULL == (tmp = malloc (size))) + { + MHD_mutex_destroy_chk_ (&response->mutex); + free (response); + return NULL; + } + memcpy (tmp, data, size); + must_free = MHD_YES; + data = tmp; + } + if (must_free) + { + response->crfc = &free; + response->crc_cls = data; + } + response->reference_count = 1; + response->total_size = size; + response->data = data; + response->data_size = size; + return response; +} + + +/** + * Create a response object. The response object can be extended with + * header information and then be used any number of times. + * + * @param size size of the data portion of the response + * @param buffer size bytes containing the response's data portion + * @param mode flags for buffer management + * @return NULL on error (i.e. invalid arguments, out of memory) + * @ingroup response + */ +struct MHD_Response * +MHD_create_response_from_buffer (size_t size, + void *buffer, + enum MHD_ResponseMemoryMode mode) +{ + return MHD_create_response_from_data (size, + buffer, + mode == MHD_RESPMEM_MUST_FREE, + mode == MHD_RESPMEM_MUST_COPY); +} + + +#ifdef UPGRADE_SUPPORT +/** + * This connection-specific callback is provided by MHD to + * applications (unusual) during the #MHD_UpgradeHandler. + * It allows applications to perform 'special' actions on + * the underlying socket from the upgrade. + * + * @param urh the handle identifying the connection to perform + * the upgrade @a action on. + * @param action which action should be performed + * @param ... arguments to the action (depends on the action) + * @return #MHD_NO on error, #MHD_YES on success + */ +_MHD_EXTERN int +MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, + enum MHD_UpgradeAction action, + ...) +{ + struct MHD_Connection *connection; + struct MHD_Daemon *daemon; + + if (NULL == urh) + return MHD_NO; + connection = urh->connection; + + /* Precaution checks on external data. */ + if (NULL == connection) + return MHD_NO; + daemon = connection->daemon; + if (NULL == daemon) + return MHD_NO; + + switch (action) + { + case MHD_UPGRADE_ACTION_CLOSE: + if (urh->was_closed) + return MHD_NO; /* Already closed. */ + + /* transition to special 'closed' state for start of cleanup */ +#ifdef HTTPS_SUPPORT + if (0 != (daemon->options & MHD_USE_TLS) ) + { + /* signal that app is done by shutdown() of 'app' socket */ + /* Application will not use anyway this socket after this command. */ + shutdown (urh->app.socket, + SHUT_RDWR); + } +#endif /* HTTPS_SUPPORT */ + mhd_assert (MHD_CONNECTION_UPGRADE == connection->state); + urh->was_closed = true; + /* As soon as connection will be marked with BOTH + * 'urh->was_closed' AND 'urh->clean_ready', it will + * be moved to cleanup list by MHD_resume_connection(). */ + MHD_resume_connection (connection); + return MHD_YES; + default: + /* we don't understand this one */ + return MHD_NO; + } +} + + +/** + * We are done sending the header of a given response to the client. + * Now it is time to perform the upgrade and hand over the connection + * to the application. + * @remark To be called only from thread that process connection's + * recv(), send() and response. Must be called right after sending + * response headers. + * + * @param response the response that was created for an upgrade + * @param connection the specific connection we are upgrading + * @return #MHD_YES on success, #MHD_NO on failure (will cause + * connection to be closed) + */ +int +MHD_response_execute_upgrade_ (struct MHD_Response *response, + struct MHD_Connection *connection) +{ + struct MHD_Daemon *daemon = connection->daemon; + struct MHD_UpgradeResponseHandle *urh; + size_t rbo; + + if (0 == (daemon->options & MHD_ALLOW_UPGRADE)) + return MHD_NO; + + if (NULL == + MHD_get_response_header (response, + MHD_HTTP_HEADER_UPGRADE)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Invalid response for upgrade: application failed to set the 'Upgrade' header!\n")); +#endif + return MHD_NO; + } + + urh = MHD_calloc_ (1, sizeof (struct MHD_UpgradeResponseHandle)); + if (NULL == urh) + return MHD_NO; + urh->connection = connection; + rbo = connection->read_buffer_offset; + connection->read_buffer_offset = 0; +#ifdef HTTPS_SUPPORT + if (0 != (daemon->options & MHD_USE_TLS) ) + { + struct MemoryPool *pool; + size_t avail; + char *buf; + MHD_socket sv[2]; +#if defined(MHD_socket_nosignal_) || !defined(MHD_socket_pair_nblk_) + int res1; + int res2; +#endif /* MHD_socket_nosignal_ || !MHD_socket_pair_nblk_ */ + +#ifdef MHD_socket_pair_nblk_ + if (! MHD_socket_pair_nblk_ (sv)) + { + free (urh); + return MHD_NO; + } +#else /* !MHD_socket_pair_nblk_ */ + if (! MHD_socket_pair_ (sv)) + { + free (urh); + return MHD_NO; + } + res1 = MHD_socket_nonblocking_(sv[0]); + res2 = MHD_socket_nonblocking_(sv[1]); + if ( (! res1) || (! res2) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to make loopback sockets non-blocking.\n")); +#endif + if (! res2) + { + /* Socketpair cannot be used. */ + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } + } +#endif /* !MHD_socket_pair_nblk_ */ +#ifdef MHD_socket_nosignal_ + res1 = MHD_socket_nosignal_(sv[0]); + res2 = MHD_socket_nosignal_(sv[1]); + if ( (! res1) || (! res2) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Failed to set SO_NOSIGPIPE on loopback sockets.\n")); +#endif +#ifndef MSG_NOSIGNAL + if (!res2) + { + /* Socketpair cannot be used. */ + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } +#endif /* ! MSG_NOSIGNAL */ + } +#endif /* MHD_socket_nosignal_ */ + if ( (! MHD_SCKT_FD_FITS_FDSET_ (sv[1], + NULL)) && + (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) ) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Socketpair descriptor larger than FD_SETSIZE: %d > %d\n"), + (int) sv[1], + (int) FD_SETSIZE); +#endif + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } + urh->app.socket = sv[0]; + urh->app.urh = urh; + urh->app.celi = MHD_EPOLL_STATE_UNREADY; + urh->mhd.socket = sv[1]; + urh->mhd.urh = urh; + urh->mhd.celi = MHD_EPOLL_STATE_UNREADY; + pool = connection->pool; + avail = MHD_pool_get_free (pool); + if (avail < RESERVE_EBUF_SIZE) + { + /* connection's pool is totally at the limit, + use our 'emergency' buffer of #RESERVE_EBUF_SIZE bytes. */ + avail = RESERVE_EBUF_SIZE; + buf = urh->e_buf; + } + else + { + /* Normal case: grab all remaining memory from the + connection's pool for the IO buffers; the connection + certainly won't need it anymore as we've upgraded + to another protocol. */ + buf = MHD_pool_allocate (pool, + avail, + MHD_NO); + } + /* use half the buffer for inbound, half for outbound */ + urh->in_buffer_size = avail / 2; + urh->out_buffer_size = avail - urh->in_buffer_size; + urh->in_buffer = buf; + urh->out_buffer = &buf[urh->in_buffer_size]; +#ifdef EPOLL_SUPPORT + /* Launch IO processing by the event loop */ + if (0 != (daemon->options & MHD_USE_EPOLL)) + { + /* We're running with epoll(), need to add the sockets + to the event set of the daemon's `epoll_upgrade_fd` */ + struct epoll_event event; + + mhd_assert (-1 != daemon->epoll_upgrade_fd); + /* First, add network socket */ + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; + event.data.ptr = &urh->app; + if (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_ADD, + connection->socket_fd, + &event)) + { +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } + + /* Second, add our end of the UNIX socketpair() */ + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; + event.data.ptr = &urh->mhd; + if (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_ADD, + urh->mhd.socket, + &event)) + { + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI; + event.data.ptr = &urh->app; + if (0 != epoll_ctl (daemon->epoll_upgrade_fd, + EPOLL_CTL_DEL, + connection->socket_fd, + &event)) + MHD_PANIC (_("Error cleaning up while handling epoll error")); +#ifdef HAVE_MESSAGES + MHD_DLOG (daemon, + _("Call to epoll_ctl failed: %s\n"), + MHD_socket_last_strerr_ ()); +#endif + MHD_socket_close_chk_ (sv[0]); + MHD_socket_close_chk_ (sv[1]); + free (urh); + return MHD_NO; + } + EDLL_insert (daemon->eready_urh_head, + daemon->eready_urh_tail, + urh); + urh->in_eready_list = true; + } +#endif /* EPOLL_SUPPORT */ + if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION) ) + { + /* This takes care of further processing for most event loops: + simply add to DLL for bi-direcitonal processing */ + DLL_insert (daemon->urh_head, + daemon->urh_tail, + urh); + } + /* In thread-per-connection mode, thread will switch to forwarding once + * connection.urh is not NULL and connection.state == MHD_CONNECTION_UPGRADE. + */ + } + else + { + urh->app.socket = MHD_INVALID_SOCKET; + urh->mhd.socket = MHD_INVALID_SOCKET; + /* Non-TLS connection do not hold any additional resources. */ + urh->clean_ready = true; + } +#else /* ! HTTPS_SUPPORT */ + urh->clean_ready = true; +#endif /* ! HTTPS_SUPPORT */ + connection->urh = urh; + /* As far as MHD's event loops are concerned, this connection is + suspended; it will be resumed once application is done by the + #MHD_upgrade_action() function */ + internal_suspend_connection_ (connection); + + /* hand over socket to application */ + response->upgrade_handler (response->upgrade_handler_cls, + connection, + connection->client_context, + connection->read_buffer, + rbo, +#ifdef HTTPS_SUPPORT + (0 == (daemon->options & MHD_USE_TLS) ) ? + connection->socket_fd : urh->app.socket, +#else /* ! HTTPS_SUPPORT */ + connection->socket_fd, +#endif /* ! HTTPS_SUPPORT */ + urh); + return MHD_YES; +} + + +/** + * Create a response object that can be used for 101 UPGRADE + * responses, for example to implement WebSockets. After sending the + * response, control over the data stream is given to the callback (which + * can then, for example, start some bi-directional communication). + * If the response is queued for multiple connections, the callback + * will be called for each connection. The callback + * will ONLY be called after the response header was successfully passed + * to the OS; if there are communication errors before, the usual MHD + * connection error handling code will be performed. + * + * Setting the correct HTTP code (i.e. MHD_HTTP_SWITCHING_PROTOCOLS) + * and setting correct HTTP headers for the upgrade must be done + * manually (this way, it is possible to implement most existing + * WebSocket versions using this API; in fact, this API might be useful + * for any protocol switch, not just WebSockets). Note that + * draft-ietf-hybi-thewebsocketprotocol-00 cannot be implemented this + * way as the header "HTTP/1.1 101 WebSocket Protocol Handshake" + * cannot be generated; instead, MHD will always produce "HTTP/1.1 101 + * Switching Protocols" (if the response code 101 is used). + * + * As usual, the response object can be extended with header + * information and then be used any number of times (as long as the + * header information is not connection-specific). + * + * @param upgrade_handler function to call with the 'upgraded' socket + * @param upgrade_handler_cls closure for @a upgrade_handler + * @return NULL on error (i.e. invalid arguments, out of memory) + */ +_MHD_EXTERN struct MHD_Response * +MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, + void *upgrade_handler_cls) +{ + struct MHD_Response *response; + + if (NULL == upgrade_handler) + return NULL; /* invalid request */ + response = MHD_calloc_ (1, sizeof (struct MHD_Response)); + if (NULL == response) + return NULL; + if (! MHD_mutex_init_ (&response->mutex)) + { + free (response); + return NULL; + } + response->upgrade_handler = upgrade_handler; + response->upgrade_handler_cls = upgrade_handler_cls; + response->total_size = MHD_SIZE_UNKNOWN; + response->reference_count = 1; + if (MHD_NO == + MHD_add_response_header (response, + MHD_HTTP_HEADER_CONNECTION, + "Upgrade")) + { + MHD_destroy_response (response); + return NULL; + } + return response; +} +#endif /* UPGRADE_SUPPORT */ + + +/** + * Destroy a response object and associated resources. Note that + * libmicrohttpd may keep some of the resources around if the response + * is still in the queue for some clients, so the memory may not + * necessarily be freed immediately. + * + * @param response response to destroy + * @ingroup response + */ +void +MHD_destroy_response (struct MHD_Response *response) +{ + struct MHD_HTTP_Header *pos; + + if (NULL == response) + return; + MHD_mutex_lock_chk_ (&response->mutex); + if (0 != --(response->reference_count)) + { + MHD_mutex_unlock_chk_ (&response->mutex); + return; + } + MHD_mutex_unlock_chk_ (&response->mutex); + MHD_mutex_destroy_chk_ (&response->mutex); + if (NULL != response->crfc) + response->crfc (response->crc_cls); + while (NULL != response->first_header) + { + pos = response->first_header; + response->first_header = pos->next; + free (pos->header); + free (pos->value); + free (pos); + } + free (response); +} + + +/** + * Increments the reference counter for the @a response. + * + * @param response object to modify + */ +void +MHD_increment_response_rc (struct MHD_Response *response) +{ + MHD_mutex_lock_chk_ (&response->mutex); + (response->reference_count)++; + MHD_mutex_unlock_chk_ (&response->mutex); +} + + +/* end of response.c */ diff --git a/src/microhttpd/response.h b/src/microhttpd/response.h new file mode 100644 index 0000000..3f4717d --- /dev/null +++ b/src/microhttpd/response.h @@ -0,0 +1,57 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Daniel Pittman and Christian Grothoff + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file response.h + * @brief Methods for managing response objects + * @author Daniel Pittman + * @author Christian Grothoff + */ + +#ifndef RESPONSE_H +#define RESPONSE_H + +/** + * Increments the reference counter for the @a response. + * + * @param response object to modify + */ +void +MHD_increment_response_rc (struct MHD_Response *response); + + +/** + * We are done sending the header of a given response + * to the client. Now it is time to perform the upgrade + * and hand over the connection to the application. + * @remark To be called only from thread that process connection's + * recv(), send() and response. Must be called right after sending + * response headers. + * + * @param response the response that was created for an upgrade + * @param connection the specific connection we are upgrading + * @return #MHD_YES on success, #MHD_NO on failure (will cause + * connection to be closed) + */ +int +MHD_response_execute_upgrade_ (struct MHD_Response *response, + struct MHD_Connection *connection); + + +#endif diff --git a/src/microhttpd/sysfdsetsize.c b/src/microhttpd/sysfdsetsize.c new file mode 100644 index 0000000..fe7fba7 --- /dev/null +++ b/src/microhttpd/sysfdsetsize.c @@ -0,0 +1,80 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/sysfdsetsize.c + * @brief Helper for obtaining FD_SETSIZE system default value + * @author Karlson2k (Evgeny Grin) + */ + + +#include "MHD_config.h" + +#ifdef FD_SETSIZE +/* FD_SETSIZE was defined before system headers. */ +/* To get system value of FD_SETSIZE, undefine FD_SETSIZE + here. */ +#undef FD_SETSIZE +#endif /* FD_SETSIZE */ + +#include +#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS) +#include +#endif /* OS_VXWORKS */ +#if HAVE_SYS_SELECT_H +#include +#endif /* HAVE_SYS_SELECT_H */ +#if HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ +#if HAVE_SYS_TIME_H +#include +#endif /* HAVE_SYS_TIME_H */ +#if HAVE_TIME_H +#include +#endif /* HAVE_TIME_H */ +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#if HAVE_SYS_SOCKET_H +#include +#endif /* HAVE_SYS_SOCKET_H */ + +#if defined(_WIN32) && !defined(__CYGWIN__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif /* _WIN32 && !__CYGWIN__ */ + +#ifndef FD_SETSIZE +#error FD_SETSIZE must be defined in system headers +#endif /* !FD_SETSIZE */ + +#include "sysfdsetsize.h" + +/** + * Get system default value of FD_SETSIZE + * @return system default value of FD_SETSIZE + */ +int +get_system_fdsetsize_value (void) +{ + return FD_SETSIZE; +} diff --git a/src/microhttpd/sysfdsetsize.h b/src/microhttpd/sysfdsetsize.h new file mode 100644 index 0000000..e3585b2 --- /dev/null +++ b/src/microhttpd/sysfdsetsize.h @@ -0,0 +1,36 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2015 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/sysfdsetsize.h + * @brief Helper for obtaining FD_SETSIZE system default value + * @author Karlson2k (Evgeny Grin) + */ + +#ifndef SYSFDSETSIZE_H +#define SYSFDSETSIZE_H 1 + +/** + * Get system default value of FD_SETSIZE + * @return system default value of FD_SETSIZE + */ +int +get_system_fdsetsize_value (void); + +#endif /* !SYSFDSETSIZE_H */ diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c new file mode 100644 index 0000000..e3b72bc --- /dev/null +++ b/src/microhttpd/test_daemon.c @@ -0,0 +1,238 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2017 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_daemon.c + * @brief Testcase for libmicrohttpd starts and stops + * @author Christian Grothoff + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + + +static int +testStartError () +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, NULL, NULL, NULL, NULL); + if (NULL != d) + { + MHD_stop_daemon (d); + fprintf (stderr, + "Succeeded to start without MHD_AccessHandlerCallback?\n"); + return 1; + } + return 0; +} + + +static int +apc_nothing (void *cls, + const struct sockaddr *addr, + socklen_t addrlen) +{ + (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */ + + return MHD_NO; +} + + +static int +apc_all (void *cls, + const struct sockaddr *addr, + socklen_t addrlen) +{ + (void)cls; (void)addr; (void)addrlen; /* Unused. Silent compiler warning. */ + + return MHD_YES; +} + + +static int +ahc_nothing (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + (void)cls;(void)connection;(void)url; /* Unused. Silent compiler warning. */ + (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ + + return MHD_NO; +} + + +static int +testStartStop () +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 0, + &apc_nothing, NULL, + &ahc_nothing, NULL, + MHD_OPTION_END); + if (NULL == d) + { + fprintf (stderr, + "Failed to start daemon on port %u\n", + 0); + exit (77); + } + MHD_stop_daemon (d); + return 0; +} + + +static int +testExternalRun () +{ + struct MHD_Daemon *d; + fd_set rs; + MHD_socket maxfd; + int i; + + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 0, + &apc_all, NULL, + &ahc_nothing, NULL, + MHD_OPTION_END); + + if (NULL == d) + { + fprintf (stderr, + "Failed to start daemon on port %u\n", + 0); + exit (77); + } + i = 0; + while (i < 15) + { + maxfd = 0; + FD_ZERO (&rs); + if (MHD_YES != MHD_get_fdset (d, &rs, &rs, &rs, &maxfd)) + { + MHD_stop_daemon (d); + fprintf (stderr, + "Failed in MHD_get_fdset()\n"); + return 256; + } + if (MHD_run (d) == MHD_NO) + { + MHD_stop_daemon (d); + fprintf (stderr, + "Failed in MHD_run()\n"); + return 8; + } + i++; + } + MHD_stop_daemon (d); + return 0; +} + + +static int +testThread () +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_INTERNAL_POLLING_THREAD, + 0, + &apc_all, NULL, + &ahc_nothing, NULL, + MHD_OPTION_END); + + if (NULL == d) + { + fprintf (stderr, + "Failed to start daemon on port %u\n", + 1082); + exit (77); + } + if (MHD_run (d) != MHD_NO) + { + fprintf (stderr, + "Failed in MHD_run()\n"); + return 32; + } + MHD_stop_daemon (d); + return 0; +} + + +static int +testMultithread () +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION, + 0, + &apc_all, NULL, + &ahc_nothing, NULL, + MHD_OPTION_END); + + if (NULL == d) + { + fprintf (stderr, + "Failed to start daemon on port %u\n", + 0); + exit (77); + } + if (MHD_run (d) != MHD_NO) + { + fprintf (stderr, + "Failed in MHD_run()\n"); + return 128; + } + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, + char *const *argv) +{ + int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + errorCount += testStartError (); + errorCount += testStartStop (); + errorCount += testExternalRun (); + errorCount += testThread (); + errorCount += testMultithread (); + if (0 != errorCount) + fprintf (stderr, + "Error (code: %u)\n", + errorCount); + return 0 != errorCount; /* 0 == pass */ +} diff --git a/src/microhttpd/test_helpers.h b/src/microhttpd/test_helpers.h new file mode 100644 index 0000000..4f015ef --- /dev/null +++ b/src/microhttpd/test_helpers.h @@ -0,0 +1,91 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/test_helpers.h + * @brief Static functions and macros helpers for testsuite. + * @author Karlson2k (Evgeny Grin) + */ + +#include + +/** + * Check whether program name contains specific @a marker string. + * Only last component in pathname is checked for marker presence, + * all leading directories names (if any) are ignored. Directories + * separators are handled correctly on both non-W32 and W32 + * platforms. + * @param prog_name program name, may include path + * @param marker marker to look for. + * @return zero if any parameter is NULL or empty string or + * @prog_name ends with slash or @marker is not found in + * program name, non-zero if @maker is found in program + * name. + */ +static int +has_in_name(const char *prog_name, const char *marker) +{ + size_t name_pos; + size_t pos; + + if (!prog_name || !marker || !prog_name[0] || !marker[0]) + return 0; + + pos = 0; + name_pos = 0; + while (prog_name[pos]) + { + if ('/' == prog_name[pos]) + name_pos = pos + 1; +#if defined(_WIN32) || defined(__CYGWIN__) + else if ('\\' == prog_name[pos]) + name_pos = pos + 1; +#endif /* _WIN32 || __CYGWIN__ */ + pos++; + } + if (name_pos == pos) + return 0; + return strstr(prog_name + name_pos, marker) != (char*)0; +} + +/** + * Check whether one of strings in array is equal to @a param. + * String @a argv[0] is ignored. + * @param argc number of strings in @a argv, as passed to main function + * @param argv array of strings, as passed to main function + * @param param parameter to look for. + * @return zero if @a argv is NULL, @a param is NULL or empty string, + * @a argc is less then 2 or @a param is not found in @a argv, + * non-zero if one of strings in @a argv is equal to @a param. + */ +static int +has_param(int argc, char * const argv[], const char * param) +{ + int i; + if (!argv || !param || !param[0]) + return 0; + + for(i = 1; i < argc; i++) + { + if(argv[i] && strcmp(argv[i], param) == 0) + return !0; + } + + return 0; +} diff --git a/src/microhttpd/test_http_reasons.c b/src/microhttpd/test_http_reasons.c new file mode 100644 index 0000000..a4dab63 --- /dev/null +++ b/src/microhttpd/test_http_reasons.c @@ -0,0 +1,133 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2017 Karlson2k (Evgeny Grin) + + This test tool 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 test tool 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/test_http_reasons.c + * @brief Unit tests for MHD_get_reason_phrase_for() function + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_options.h" +#include +#include "microhttpd.h" +#include "mhd_str.h" + +static int expect_result(int code, const char* expected) +{ + const char* const reason = MHD_get_reason_phrase_for(code); + if (MHD_str_equal_caseless_(reason, expected)) + return 0; + fprintf(stderr, "Incorrect reason returned for code %d:\n Returned: \"%s\" \tExpected: \"%s\"\n", + code, reason, expected); + return 1; +} + +static int expect_absent(int code) +{ + return expect_result(code, "unknown"); +} + +static int test_absent_codes(void) +{ + int errcount = 0; + errcount += expect_absent(0); + errcount += expect_absent(1); + errcount += expect_absent(50); + errcount += expect_absent(99); + errcount += expect_absent(600); + errcount += expect_absent(601); + errcount += expect_absent(900); + errcount += expect_absent(10000); + return errcount; +} + +static int test_1xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_CONTINUE, "continue"); + errcount += expect_result(MHD_HTTP_PROCESSING, "processing"); + errcount += expect_absent(110); + errcount += expect_absent(190); + return errcount; +} + +static int test_2xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_OK, "ok"); + errcount += expect_result(MHD_HTTP_ALREADY_REPORTED, "already reported"); + errcount += expect_absent(217); + errcount += expect_result(MHD_HTTP_IM_USED, "im used"); + errcount += expect_absent(230); + errcount += expect_absent(295); + return errcount; +} + +static int test_3xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_MULTIPLE_CHOICES, "multiple choices"); + errcount += expect_result(MHD_HTTP_SEE_OTHER, "see other"); + errcount += expect_result(MHD_HTTP_PERMANENT_REDIRECT, "permanent redirect"); + errcount += expect_absent(311); + errcount += expect_absent(399); + return errcount; +} + +static int test_4xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_BAD_REQUEST, "bad request"); + errcount += expect_result(MHD_HTTP_NOT_FOUND, "not found"); + errcount += expect_result(MHD_HTTP_URI_TOO_LONG, "uri too long"); + errcount += expect_result(MHD_HTTP_EXPECTATION_FAILED, "expectation failed"); + errcount += expect_result(MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, "request header fields too large"); + errcount += expect_absent(441); + errcount += expect_result(MHD_HTTP_NO_RESPONSE, "no response"); + errcount += expect_result(MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS, "unavailable for legal reasons"); + errcount += expect_absent(470); + errcount += expect_absent(493); + return errcount; +} + +static int test_5xx(void) +{ + int errcount = 0; + errcount += expect_result(MHD_HTTP_INTERNAL_SERVER_ERROR, "internal server error"); + errcount += expect_result(MHD_HTTP_BAD_GATEWAY, "bad gateway"); + errcount += expect_result(MHD_HTTP_HTTP_VERSION_NOT_SUPPORTED, "http version not supported"); + errcount += expect_result(MHD_HTTP_NETWORK_AUTHENTICATION_REQUIRED, "network authentication required"); + errcount += expect_absent(520); + errcount += expect_absent(597); + return errcount; +} + +int main(int argc, char * argv[]) +{ + int errcount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + errcount += test_absent_codes(); + errcount += test_1xx(); + errcount += test_2xx(); + errcount += test_3xx(); + errcount += test_4xx(); + errcount += test_5xx(); + return errcount == 0 ? 0 : 1; +} diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c new file mode 100644 index 0000000..3198c73 --- /dev/null +++ b/src/microhttpd/test_options.c @@ -0,0 +1,135 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/** + * @file mhds_get_test.c + * @brief Testcase for libmicrohttpd HTTPS GET operations + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" +#include "mhd_sockets.h" + +#define MHD_E_MEM "Error: memory error\n" +#define MHD_E_SERVER_INIT "Error: failed to start server\n" + +const int DEBUG_GNUTLS_LOG_LEVEL = 0; +const char *test_file_name = "https_test_file"; +const char test_file_data[] = "Hello World\n"; + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + (void)cls; + (void)connection; + (void)url; + (void)method; + (void)version; + (void)upload_data; + (void)upload_data_size; + (void)unused; + + return 0; +} + +static int +test_wrap_loc (char *test_name, int (*test) (void)) +{ + int ret; + + fprintf (stdout, "running test: %s ", test_name); + ret = test (); + if (ret == 0) + { + fprintf (stdout, "[pass]\n"); + } + else + { + fprintf (stdout, "[fail]\n"); + } + return ret; +} + + +/** + * Test daemon initialization with the MHD_OPTION_SOCK_ADDR option + */ +static int +test_ip_addr_option () +{ + struct MHD_Daemon *d; + struct sockaddr_in daemon_ip_addr; +#if HAVE_INET6 + struct sockaddr_in6 daemon_ip_addr6; +#endif + + memset (&daemon_ip_addr, 0, sizeof (struct sockaddr_in)); + daemon_ip_addr.sin_family = AF_INET; + daemon_ip_addr.sin_port = 0; + daemon_ip_addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + +#if HAVE_INET6 + memset (&daemon_ip_addr6, 0, sizeof (struct sockaddr_in6)); + daemon_ip_addr6.sin6_family = AF_INET6; + daemon_ip_addr6.sin6_port = 0; + daemon_ip_addr6.sin6_addr = in6addr_loopback; +#endif + + d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, + NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR, + &daemon_ip_addr, MHD_OPTION_END); + + if (d == 0) + return -1; + + MHD_stop_daemon (d); + +#if HAVE_INET6 + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6, 0, + NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR, + &daemon_ip_addr6, MHD_OPTION_END); + + if (d == 0) + return -1; + + MHD_stop_daemon (d); +#endif + + return 0; +} + +/* setup a temporary transfer test file */ +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + errorCount += test_wrap_loc ("ip addr option", &test_ip_addr_option); + + return errorCount != 0; +} diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c new file mode 100644 index 0000000..8edc5b2 --- /dev/null +++ b/src/microhttpd/test_postprocessor.c @@ -0,0 +1,353 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007,2013 Christian Grothoff + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_postprocessor.c + * @brief Testcase for postprocessor + * @author Christian Grothoff + */ + +#include "platform.h" +#include "microhttpd.h" +#include "internal.h" +#include +#include +#include +#include "mhd_compat.h" + +#ifndef WINDOWS +#include +#endif + +/** + * Array of values that the value checker "wants". + * Each series of checks should be terminated by + * five NULL-entries. + */ +const char *want[] = { +#define URL_DATA "abc=def&x=5" +#define URL_START 0 + "abc", NULL, NULL, NULL, "def", + "x", NULL, NULL, NULL, "5", +#define URL_END (URL_START + 10) + NULL, NULL, NULL, NULL, NULL, +#define FORM_DATA "--AaB03x\r\ncontent-disposition: form-data; name=\"field1\"\r\n\r\nJoe Blow\r\n--AaB03x\r\ncontent-disposition: form-data; name=\"pics\"; filename=\"file1.txt\"\r\nContent-Type: text/plain\r\nContent-Transfer-Encoding: binary\r\n\r\nfiledata\r\n--AaB03x--\r\n" +#define FORM_START (URL_END + 5) + "field1", NULL, NULL, NULL, "Joe Blow", + "pics", "file1.txt", "text/plain", "binary", "filedata", +#define FORM_END (FORM_START + 10) + NULL, NULL, NULL, NULL, NULL, +#define FORM_NESTED_DATA "--AaB03x\r\ncontent-disposition: form-data; name=\"field1\"\r\n\r\nJane Blow\r\n--AaB03x\r\ncontent-disposition: form-data; name=\"pics\"\r\nContent-type: multipart/mixed, boundary=BbC04y\r\n\r\n--BbC04y\r\nContent-disposition: attachment; filename=\"file1.txt\"\r\nContent-Type: text/plain\r\n\r\nfiledata1\r\n--BbC04y\r\nContent-disposition: attachment; filename=\"file2.gif\"\r\nContent-type: image/gif\r\nContent-Transfer-Encoding: binary\r\n\r\nfiledata2\r\n--BbC04y--\r\n--AaB03x--" +#define FORM_NESTED_START (FORM_END + 5) + "field1", NULL, NULL, NULL, "Jane Blow", + "pics", "file1.txt", "text/plain", NULL, "filedata1", + "pics", "file2.gif", "image/gif", "binary", "filedata2", +#define FORM_NESTED_END (FORM_NESTED_START + 15) + NULL, NULL, NULL, NULL, NULL, +#define URL_EMPTY_VALUE_DATA "key1=value1&key2=&key3=" +#define URL_EMPTY_VALUE_START (FORM_NESTED_END + 5) + "key1", NULL, NULL, NULL, "value1", + "key2", NULL, NULL, NULL, "", + "key3", NULL, NULL, NULL, "", +#define URL_EMPTY_VALUE_END (URL_EMPTY_VALUE_START + 15) + NULL, NULL, NULL, NULL, NULL +}; + +static int +mismatch (const char *a, const char *b) +{ + if (a == b) + return 0; + if ((a == NULL) || (b == NULL)) + return 1; + return 0 != strcmp (a, b); +} + +static int +value_checker (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, uint64_t off, size_t size) +{ + int *want_off = cls; + int idx = *want_off; + (void)kind; /* Unused. Silent compiler warning. */ + + +#if 0 + fprintf (stderr, + "VC: `%s' `%s' `%s' `%s' `%.*s'\n", + key, filename, content_type, transfer_encoding, + (int) size, + data); +#endif + if ( (0 != off) && (0 == size) ) + return MHD_YES; + if ((idx < 0) || + (want[idx] == NULL) || + (0 != strcmp (key, want[idx])) || + (mismatch (filename, want[idx + 1])) || + (mismatch (content_type, want[idx + 2])) || + (mismatch (transfer_encoding, want[idx + 3])) || + (0 != memcmp (data, &want[idx + 4][off], size))) + { + *want_off = -1; + return MHD_NO; + } + if (off + size == strlen (want[idx + 4])) + *want_off = idx + 5; + return MHD_YES; + +} + + +static int +test_urlencoding (void) +{ + struct MHD_Connection connection; + struct MHD_HTTP_Header header; + struct MHD_PostProcessor *pp; + unsigned int want_off = URL_START; + size_t i; + size_t delta; + size_t size; + + memset (&connection, 0, sizeof (struct MHD_Connection)); + memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + connection.headers_received = &header; + header.header = MHD_HTTP_HEADER_CONTENT_TYPE; + header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; + header.kind = MHD_HEADER_KIND; + pp = MHD_create_post_processor (&connection, + 1024, &value_checker, &want_off); + i = 0; + size = strlen (URL_DATA); + while (i < size) + { + delta = 1 + MHD_random_ () % (size - i); + MHD_post_process (pp, &URL_DATA[i], delta); + i += delta; + } + MHD_destroy_post_processor (pp); + if (want_off != URL_END) + return 1; + return 0; +} + + +static int +test_multipart_garbage (void) +{ + struct MHD_Connection connection; + struct MHD_HTTP_Header header; + struct MHD_PostProcessor *pp; + unsigned int want_off; + size_t size = strlen (FORM_DATA); + size_t splitpoint; + char xdata[size + 3]; + + /* fill in evil garbage at the beginning */ + xdata[0] = '-'; + xdata[1] = 'x'; + xdata[2] = '\r'; + memcpy (&xdata[3], FORM_DATA, size); + + size = strlen (FORM_DATA); + size += 3; + for (splitpoint = 1; splitpoint < size; splitpoint++) + { + want_off = FORM_START; + memset (&connection, 0, sizeof (struct MHD_Connection)); + memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + connection.headers_received = &header; + header.header = MHD_HTTP_HEADER_CONTENT_TYPE; + header.value = + MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA ", boundary=AaB03x"; + header.kind = MHD_HEADER_KIND; + pp = MHD_create_post_processor (&connection, + 1024, &value_checker, &want_off); + MHD_post_process (pp, xdata, splitpoint); + MHD_post_process (pp, &xdata[splitpoint], size - splitpoint); + MHD_destroy_post_processor (pp); + if (want_off != FORM_END) + return (int) splitpoint; + } + return 0; +} + + +static int +test_multipart_splits (void) +{ + struct MHD_Connection connection; + struct MHD_HTTP_Header header; + struct MHD_PostProcessor *pp; + unsigned int want_off; + size_t size; + size_t splitpoint; + + size = strlen (FORM_DATA); + for (splitpoint = 1; splitpoint < size; splitpoint++) + { + want_off = FORM_START; + memset (&connection, 0, sizeof (struct MHD_Connection)); + memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + connection.headers_received = &header; + header.header = MHD_HTTP_HEADER_CONTENT_TYPE; + header.value = + MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA ", boundary=AaB03x"; + header.kind = MHD_HEADER_KIND; + pp = MHD_create_post_processor (&connection, + 1024, &value_checker, &want_off); + MHD_post_process (pp, FORM_DATA, splitpoint); + MHD_post_process (pp, &FORM_DATA[splitpoint], size - splitpoint); + MHD_destroy_post_processor (pp); + if (want_off != FORM_END) + return (int) splitpoint; + } + return 0; +} + + +static int +test_multipart (void) +{ + struct MHD_Connection connection; + struct MHD_HTTP_Header header; + struct MHD_PostProcessor *pp; + unsigned int want_off = FORM_START; + size_t i; + size_t delta; + size_t size; + + memset (&connection, 0, sizeof (struct MHD_Connection)); + memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + connection.headers_received = &header; + header.header = MHD_HTTP_HEADER_CONTENT_TYPE; + header.value = + MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA ", boundary=AaB03x"; + header.kind = MHD_HEADER_KIND; + pp = MHD_create_post_processor (&connection, + 1024, &value_checker, &want_off); + i = 0; + size = strlen (FORM_DATA); + while (i < size) + { + delta = 1 + MHD_random_ () % (size - i); + MHD_post_process (pp, &FORM_DATA[i], delta); + i += delta; + } + MHD_destroy_post_processor (pp); + if (want_off != FORM_END) + return 2; + return 0; +} + + +static int +test_nested_multipart (void) +{ + struct MHD_Connection connection; + struct MHD_HTTP_Header header; + struct MHD_PostProcessor *pp; + unsigned int want_off = FORM_NESTED_START; + size_t i; + size_t delta; + size_t size; + + memset (&connection, 0, sizeof (struct MHD_Connection)); + memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + connection.headers_received = &header; + header.header = MHD_HTTP_HEADER_CONTENT_TYPE; + header.value = + MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA ", boundary=AaB03x"; + header.kind = MHD_HEADER_KIND; + pp = MHD_create_post_processor (&connection, + 1024, &value_checker, &want_off); + i = 0; + size = strlen (FORM_NESTED_DATA); + while (i < size) + { + delta = 1 + MHD_random_ () % (size - i); + MHD_post_process (pp, &FORM_NESTED_DATA[i], delta); + i += delta; + } + MHD_destroy_post_processor (pp); + if (want_off != FORM_NESTED_END) + return 4; + return 0; +} + + +static int +test_empty_value (void) +{ + struct MHD_Connection connection; + struct MHD_HTTP_Header header; + struct MHD_PostProcessor *pp; + unsigned int want_off = URL_EMPTY_VALUE_START; + size_t i; + size_t delta; + size_t size; + + memset (&connection, 0, sizeof (struct MHD_Connection)); + memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + connection.headers_received = &header; + header.header = MHD_HTTP_HEADER_CONTENT_TYPE; + header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; + header.kind = MHD_HEADER_KIND; + pp = MHD_create_post_processor (&connection, + 1024, &value_checker, &want_off); + i = 0; + size = strlen (URL_EMPTY_VALUE_DATA); + while (i < size) + { + delta = 1 + MHD_random_ () % (size - i); + MHD_post_process (pp, &URL_EMPTY_VALUE_DATA[i], delta); + i += delta; + } + MHD_destroy_post_processor (pp); + if (want_off != URL_EMPTY_VALUE_END) + return 8; + return 0; +} + + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + errorCount += test_multipart_splits (); + errorCount += test_multipart_garbage (); + errorCount += test_urlencoding (); + errorCount += test_multipart (); + errorCount += test_nested_multipart (); + errorCount += test_empty_value (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/microhttpd/test_postprocessor_amp.c b/src/microhttpd/test_postprocessor_amp.c new file mode 100644 index 0000000..ef27181 --- /dev/null +++ b/src/microhttpd/test_postprocessor_amp.c @@ -0,0 +1,50 @@ +#include "platform.h" +#include "microhttpd.h" +#include "internal.h" +#include +#include +#include + + +int check_post(void *cls, enum MHD_ValueKind kind, const char* key, + const char* filename, const char* content_type, + const char* content_encoding, const char* data, + uint64_t off, size_t size) +{ + (void)cls; (void)kind; (void)filename; (void)content_type; /* Unused. Silent compiler warning. */ + (void)content_encoding; (void)data; (void)off; (void)size; /* Unused. Silent compiler warning. */ + if ((0 != strcmp(key, "a")) && (0 != strcmp(key, "b"))) + { + printf("ERROR: got unexpected '%s'\n", key); + } + + return MHD_YES; +} + + +int +main (int argc, char *const *argv) +{ + struct MHD_Connection connection; + struct MHD_HTTP_Header header; + struct MHD_PostProcessor *pp; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + memset (&connection, 0, sizeof (struct MHD_Connection)); + memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + connection.headers_received = &header; + header.header = MHD_HTTP_HEADER_CONTENT_TYPE; + header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; + header.kind = MHD_HEADER_KIND; + + pp = MHD_create_post_processor (&connection, + 4096, &check_post, NULL); + + const char* post = "a=xx+xx+xxx+xxxxx+xxxx+xxxxxxxx+xxx+xxxxxx+xxx+xxx+xxxxxxx+xxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xxxxx%3D%22xxxxx%22%3E%0A+++++++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++++++++++%3Cxx+xxxxx%3D%22xxxx%22%3E%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%22%3Exxxxx%3A%3C%2Fx%3E%0A%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%22%3Exxx%3A%3C%2Fx%3E%0A%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%3B+xxxx-xxxxxx%3A+xxxx%3B%22%3Exxxxx+xxxxx%3A%3C%2Fx%3E%0A+++++++++++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++++++%3C%2Fxxxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxxx.xx%3C%2Fxxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A++++++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxx.xx%3C%2Fxxxx%3E%0A+++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3Bxxxx-xxxxxx%3A+xxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3Exxxx.xx%3C%2Fxxxx%3E%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++%3C%2Fxxxxx%3E%0A+++++++%3C%21--%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++xxx+xx+xxxxx+xxxxxxx+xxxxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A+++%3C%2Fxxx%3E%0A%0A%0A%0A+++%3Cxxx+xxxxx%3D%22xxxxxxxxx%22+xx%3D%22xxxxxxxxx%22%3E%3C%2Fxxx%3E%0A%0A+++%3Cxxx+xx%3D%22xxxx%22+xxxxx%3D%22xxxx%22%3E%0A+++++++%3Cxxxxx+xxxxx%3D%22xxxxxxxxx%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xx%3D%22xxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xx%3D%22xxxxxxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxxxxxx%22%3E%3C%2Fxx%3E%0A+++++++++++++++%3Cxx+xx%3D%22xxxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xx%3D%22xxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++%3C%2Fxxxxx%3E%0A+++%3C%2Fxxx%3E%0A%3C%2Fxxx%3E%0A%0A%3Cxxx+xx%3D%22xxxxxx%22%3E%3C%2Fxxx%3E%0A%0A%3C%2Fxxxx%3E%0A%3C%2Fxxxx%3E+&b=value"; + + MHD_post_process (pp, post, strlen(post)); + MHD_destroy_post_processor (pp); + + return 0; +} + diff --git a/src/microhttpd/test_postprocessor_large.c b/src/microhttpd/test_postprocessor_large.c new file mode 100644 index 0000000..13e8c78 --- /dev/null +++ b/src/microhttpd/test_postprocessor_large.c @@ -0,0 +1,109 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_postprocessor_large.c + * @brief Testcase with very large input for postprocessor + * @author Christian Grothoff + */ + +#include "platform.h" +#include "microhttpd.h" +#include "internal.h" +#include "mhd_compat.h" + +#ifndef WINDOWS +#include +#endif + +static int +value_checker (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *data, uint64_t off, size_t size) +{ + unsigned int *pos = cls; + (void)kind; (void)key; (void)filename; (void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding; (void)data; (void)off; /* Unused. Silent compiler warning. */ +#if 0 + fprintf (stderr, + "VC: %llu %u `%s' `%s' `%s' `%s' `%.*s'\n", + off, size, + key, filename, content_type, transfer_encoding, size, data); +#endif + if (size == 0) + return MHD_YES; + *pos += size; + return MHD_YES; + +} + + +static int +test_simple_large () +{ + struct MHD_Connection connection; + struct MHD_HTTP_Header header; + struct MHD_PostProcessor *pp; + size_t i; + size_t delta; + size_t size; + char data[102400]; + unsigned int pos; + + pos = 0; + memset (data, 'A', sizeof (data)); + memcpy (data, "key=", 4); + data[sizeof (data) - 1] = '\0'; + memset (&connection, 0, sizeof (struct MHD_Connection)); + memset (&header, 0, sizeof (struct MHD_HTTP_Header)); + connection.headers_received = &header; + header.header = MHD_HTTP_HEADER_CONTENT_TYPE; + header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED; + header.kind = MHD_HEADER_KIND; + pp = MHD_create_post_processor (&connection, 1024, &value_checker, &pos); + i = 0; + size = strlen (data); + while (i < size) + { + delta = 1 + MHD_random_ () % (size - i); + MHD_post_process (pp, &data[i], delta); + i += delta; + } + MHD_destroy_post_processor (pp); + if (pos != sizeof (data) - 5) /* minus 0-termination and 'key=' */ + return 1; + return 0; +} + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + errorCount += test_simple_large (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/microhttpd/test_shutdown_select.c b/src/microhttpd/test_shutdown_select.c new file mode 100644 index 0000000..934cde7 --- /dev/null +++ b/src/microhttpd/test_shutdown_select.c @@ -0,0 +1,387 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file microhttpd/test_shutdown_select.c + * @brief Test whether shutdown socket triggers select()/poll() + * @details On some platforms shutting down the socket in one thread + * trigger select() or poll() waiting for this socket in + * other thread. libmicrohttpd depend on this behavior on + * those platforms. This program check whether select() + * and poll() (if available) works as expected. + * @author Karlson2k (Evgeny Grin) + */ + +#include "MHD_config.h" +#include "platform.h" +#include "mhd_sockets.h" +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + +#ifdef HAVE_TIME_H +#include +#endif /* HAVE_TIME_H */ + +#if defined(MHD_USE_POSIX_THREADS) +#include +#endif /* MHD_USE_POSIX_THREADS */ + +#if defined(MHD_WINSOCK_SOCKETS) +#include +#include +#define sock_errno (WSAGetLastError()) +#elif defined(MHD_POSIX_SOCKETS) +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif /* HAVE_SYS_SOCKET_H */ +#ifdef HAVE_NETINET_IN_H +#include +#endif /* HAVE_NETINET_IN_H */ +#ifdef HAVE_ARPA_INET_H +#include +#endif /* HAVE_ARPA_INET_H */ +#ifdef HAVE_SYS_SELECT_H +#include +#endif /* HAVE_SYS_SELECT_H */ +#if defined(HAVE_POLL) && defined(HAVE_POLL_H) +#include +#endif /* HAVE_POLL && HAVE_POLL_H */ +#define sock_errno (errno) +#endif /* MHD_POSIX_SOCKETS */ + +#ifdef HAVE_STDBOOL_H +#include +#endif /* HAVE_STDBOOL_H */ + +#include "mhd_threads.h" + +#ifndef SOMAXCONN +#define SOMAXCONN 511 +#endif /* ! SOMAXCONN */ + +#if !defined(SHUT_RDWR) && defined(SD_BOTH) +#define SHUT_RDWR SD_BOTH +#endif + +static bool check_err; + + +static bool +has_in_name(const char *prog_name, const char *marker) +{ + size_t name_pos; + size_t pos; + + if (!prog_name || !marker) + return 0; + + pos = 0; + name_pos = 0; + while (prog_name[pos]) + { + if ('/' == prog_name[pos]) + name_pos = pos + 1; +#if defined(_WIN32) || defined(__CYGWIN__) + else if ('\\' == prog_name[pos]) + name_pos = pos + 1; +#endif /* _WIN32 || __CYGWIN__ */ + pos++; + } + if (name_pos == pos) + return true; + return strstr(prog_name + name_pos, marker) != NULL; +} + + +static MHD_socket +start_socket_listen(int domain) +{ +/* Create sockets similarly to daemon.c */ + MHD_socket fd; + int cloexec_set; + struct sockaddr_in sock_addr; + socklen_t addrlen; + +#ifdef MHD_WINSOCK_SOCKETS + unsigned long flags = 1; +#else /* MHD_POSIX_SOCKETS */ + int flags; +#endif /* MHD_POSIX_SOCKETS */ + +#if defined(MHD_POSIX_SOCKETS) && defined(SOCK_CLOEXEC) + fd = socket (domain, SOCK_STREAM | SOCK_CLOEXEC, 0); + cloexec_set = 1; +#elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT) + fd = WSASocketW (domain, SOCK_STREAM, 0, NULL, 0, WSA_FLAG_NO_HANDLE_INHERIT); + cloexec_set = 1; +#else /* !SOCK_CLOEXEC */ + fd = socket (domain, SOCK_STREAM, 0); + cloexec_set = 0; +#endif /* !SOCK_CLOEXEC */ + if ( (MHD_INVALID_SOCKET == fd) && (cloexec_set) ) + { + fd = socket (domain, SOCK_STREAM, 0); + cloexec_set = 0; + } + if (MHD_INVALID_SOCKET == fd) + { + fprintf (stderr, "Can't create socket: %u\n", + (unsigned)sock_errno); + return MHD_INVALID_SOCKET; + } + + if (!cloexec_set) + { +#ifdef MHD_WINSOCK_SOCKETS + if (!SetHandleInformation ((HANDLE)fd, HANDLE_FLAG_INHERIT, 0)) + fprintf (stderr, "Failed to make socket non-inheritable: %u\n", + (unsigned int)GetLastError ()); +#else /* MHD_POSIX_SOCKETS */ + flags = fcntl (fd, F_GETFD); + if ( ( (-1 == flags) || + ( (flags != (flags | FD_CLOEXEC)) && + (0 != fcntl (fd, F_SETFD, flags | FD_CLOEXEC)) ) ) ) + fprintf (stderr, "Failed to make socket non-inheritable: %s\n", + MHD_socket_last_strerr_ ()); +#endif /* MHD_POSIX_SOCKETS */ + } + + memset (&sock_addr, 0, sizeof (struct sockaddr_in)); + sock_addr.sin_family = AF_INET; + sock_addr.sin_port = htons (0); +#if HAVE_SOCKADDR_IN_SIN_LEN + sock_addr.sin_len = sizeof (struct sockaddr_in); +#endif + addrlen = sizeof (struct sockaddr_in); + + if (bind (fd, (const struct sockaddr*) &sock_addr, addrlen) < 0) + { + fprintf (stderr, "Failed to bind socket: %u\n", + (unsigned)sock_errno); + MHD_socket_close_chk_ (fd); + return MHD_INVALID_SOCKET; + } + +#ifdef MHD_WINSOCK_SOCKETS + if (0 != ioctlsocket (fd, FIONBIO, &flags)) + { + fprintf (stderr, "Failed to make socket non-blocking: %u\n", + (unsigned)sock_errno); + MHD_socket_close_chk_ (fd); + return MHD_INVALID_SOCKET; + } +#else /* MHD_POSIX_SOCKETS */ + flags = fcntl (fd, F_GETFL); + if ( ( (-1 == flags) || + ( (flags != (flags | O_NONBLOCK)) && + (0 != fcntl (fd, F_SETFL, flags | O_NONBLOCK)) ) ) ) + { + fprintf (stderr, "Failed to make socket non-blocking: %s\n", + MHD_socket_last_strerr_ ()); + MHD_socket_close_chk_ (fd); + return MHD_INVALID_SOCKET; + } +#endif /* MHD_POSIX_SOCKETS */ + + if (listen(fd, SOMAXCONN) < 0) + { + fprintf (stderr, "Failed to listen on socket: %u\n", + (unsigned)sock_errno); + MHD_socket_close_chk_ (fd); + return MHD_INVALID_SOCKET; + } + + return fd; +} + + +MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ +select_thread(void* data) +{ + /* use select() like in daemon.c */ + MHD_socket listen_sock = *((MHD_socket*)data); + fd_set rs, ws; + struct timeval timeout; + + FD_ZERO(&rs); + FD_ZERO(&ws); + FD_SET(listen_sock, &rs); + timeout.tv_usec = 0; + timeout.tv_sec = 7; + + check_err = (0 > MHD_SYS_select_(listen_sock + 1, &rs, &ws, NULL, &timeout)); + + return (MHD_THRD_RTRN_TYPE_)0; +} + + +#ifdef HAVE_POLL +MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_ +poll_thread(void* data) +{ + /* use poll() like in daemon.c */ + struct pollfd p[1]; + MHD_socket listen_sock = *((MHD_socket*)data); + + p[0].fd = listen_sock; + p[0].events = POLLIN; + p[0].revents = 0; + + check_err = (0 > MHD_sys_poll_ (p, 1, 7000)); + + return (MHD_THRD_RTRN_TYPE_)0; +} +#endif /* HAVE_POLL */ + + +static void +local_sleep(unsigned seconds) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + Sleep(seconds * 1000); +#else + unsigned seconds_left = seconds; + do + { + seconds_left = sleep(seconds_left); + } while (seconds_left > 0); +#endif +} + + +int +main (int argc, char *const *argv) +{ + int i; + time_t start_t, end_t; + int result = 0; + MHD_THRD_RTRN_TYPE_ (MHD_THRD_CALL_SPEC_ *test_func)(void* data); +#ifdef MHD_WINSOCK_SOCKETS + WORD ver_req; + WSADATA wsa_data; + int err; +#endif /* MHD_WINSOCK_SOCKETS */ + bool test_poll; + bool must_ignore; + (void)argc; /* Unused. Silent compiler warning. */ + + test_poll = has_in_name(argv[0], "_poll"); + must_ignore = has_in_name(argv[0], "_ignore"); + if (! test_poll) + test_func = &select_thread; + else + { +#ifndef HAVE_POLL + return 77; +#else /* ! HAVE_POLL */ + test_func = &poll_thread; +#endif /* ! HAVE_POLL */ + } + +#ifdef MHD_WINSOCK_SOCKETS + ver_req = MAKEWORD(2, 2); + + err = WSAStartup(ver_req, &wsa_data); + if (err != 0 || MAKEWORD(2, 2) != wsa_data.wVersion) + { + printf("WSAStartup() failed\n"); + WSACleanup(); + return 99; + } +#endif /* MHD_WINSOCK_SOCKETS */ + + /* try several times to ensure that accidental incoming connection + * didn't interfere with test results + */ + for (i = 0; i < 5 && result == 0; i++) + { + MHD_thread_handle_ sel_thrd; + /* fprintf(stdout, "Creating, binding and listening socket...\n"); */ + MHD_socket listen_socket = start_socket_listen (AF_INET); + if (MHD_INVALID_SOCKET == listen_socket) + return 99; + + check_err = true; + /* fprintf (stdout, "Starting select() thread...\n"); */ +#if defined(MHD_USE_POSIX_THREADS) + if (0 != pthread_create (&sel_thrd, NULL, test_func, &listen_socket)) + { + MHD_socket_close_chk_ (listen_socket); + fprintf (stderr, "Can't start thread\n"); + return 99; + } +#elif defined(MHD_USE_W32_THREADS) + sel_thrd = (HANDLE)_beginthreadex (NULL, 0, test_func, &listen_socket, 0, NULL); + if (0 == (sel_thrd)) + { + MHD_socket_close_chk_ (listen_socket); + fprintf (stderr, "Can't start select() thread\n"); + return 99; + } +#else +#error No threading lib available +#endif + /* fprintf (stdout, "Waiting...\n"); */ + local_sleep(1); /* make sure that select() is started */ + + /* fprintf (stdout, "Shutting down socket...\n"); */ + start_t = time (NULL); + shutdown (listen_socket, SHUT_RDWR); + + /* fprintf (stdout, "Waiting for thread to finish...\n"); */ + if (!MHD_join_thread_(sel_thrd)) + { + MHD_socket_close_chk_(listen_socket); + fprintf (stderr, "Can't join select() thread\n"); + return 99; + } + if (check_err) + { + MHD_socket_close_chk_(listen_socket); + fprintf (stderr, "Error in waiting thread\n"); + return 99; + } + end_t = time (NULL); + /* fprintf (stdout, "Thread finished.\n"); */ + MHD_socket_close_chk_(listen_socket); + + if (start_t == (time_t)-1 || end_t == (time_t)-1) + { + MHD_socket_close_chk_(listen_socket); + fprintf (stderr, "Can't get current time\n"); + return 99; + } + if (end_t - start_t > 3) + result++; + } + +#ifdef MHD_WINSOCK_SOCKETS + WSACleanup(); +#endif /* MHD_WINSOCK_SOCKETS */ + + return must_ignore ? (!result) : (result); +} diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c new file mode 100644 index 0000000..d2e160b --- /dev/null +++ b/src/microhttpd/test_start_stop.c @@ -0,0 +1,133 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2011 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_start_stop.c + * @brief test for #1901 (start+stop) + * @author Christian Grothoff + */ +#include "mhd_options.h" +#include "platform.h" +#include + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + (void)cls;(void)connection;(void)url; /* Unused. Silent compiler warning. */ + (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ + + return MHD_NO; +} + + +static int +testInternalGet (int poll_flag) +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + 0, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + MHD_stop_daemon (d); + return 0; +} + +static int +testMultithreadedGet (int poll_flag) +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + 0, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 2; + MHD_stop_daemon (d); + return 0; +} + +static int +testMultithreadedPoolGet (int poll_flag) +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + 0, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 4; + MHD_stop_daemon (d); + return 0; +} + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 0, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 8; + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + errorCount += testInternalGet (0); + errorCount += testMultithreadedGet (0); + errorCount += testMultithreadedPoolGet (0); + errorCount += testExternalGet (); + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) + { + errorCount += testInternalGet(MHD_USE_POLL); + errorCount += testMultithreadedGet(MHD_USE_POLL); + errorCount += testMultithreadedPoolGet(MHD_USE_POLL); + } + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) + { + errorCount += testInternalGet(MHD_USE_EPOLL); + errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL); + } + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/microhttpd/test_str.c b/src/microhttpd/test_str.c new file mode 100644 index 0000000..12e12a8 --- /dev/null +++ b/src/microhttpd/test_str.c @@ -0,0 +1,2852 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Karlson2k (Evgeny Grin) + + This test tool 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 test tool 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/unit_str_test.h + * @brief Unit tests for mhd_str functions + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_options.h" +#include +#include +#include +#ifdef HAVE_INTTYPES_H +#include +#else /* ! HAVE_INTTYPES_H */ +#define PRIu64 "llu" +#define PRIuPTR "u" +#define PRIX64 "llX" +#endif /* ! HAVE_INTTYPES_H */ +#include +#include "mhd_limits.h" +#include "mhd_str.h" +#include "test_helpers.h" + + +static int verbose = 0; /* verbose level (0-3)*/ + +/* Locale names to test. + * Functions must not depend of current current locale, + * so result must be the same in any locale. + */ +static const char * const locale_names[] = { + "C", + "", /* System default locale */ +#if defined(_WIN32) && !defined(__CYGWIN__) + ".OCP", /* W32 system default OEM code page */ + ".ACP", /* W32 system default ANSI code page */ + ".65001", /* UTF-8 */ + ".437", + ".850", + ".857", + ".866", + ".1250", + ".1251", + ".1252", + ".1254", + ".20866", /* number for KOI8-R */ + ".28591", /* number for ISO-8859-1 */ + ".28595", /* number for ISO-8859-5 */ + ".28599", /* number for ISO-8859-9 */ + ".28605", /* number for ISO-8859-15 */ + "en", + "english", + "en-US", + "English-US", + "en-US.437", + "English_United States.437", + "en-US.1252", + "English_United States.1252", + "English_United States.28591", + "English_United States.65001", + "fra", + "french", + "fr-FR", + "French_France", + "fr-FR.850", + "french_france.850", + "fr-FR.1252", + "French_france.1252", + "French_france.28605", + "French_France.65001", + "de", + "de-DE", + "de-DE.850", + "German_Germany.850", + "German_Germany.1250", + "de-DE.1252", + "German_Germany.1252", + "German_Germany.28605", + "German_Germany.65001", + "tr", + "trk", + "turkish", + "tr-TR", + "tr-TR.1254", + "Turkish_Turkey.1254", + "tr-TR.857", + "Turkish_Turkey.857", + "Turkish_Turkey.28599", + "Turkish_Turkey.65001", + "ru", + "ru-RU", + "Russian", + "ru-RU.866", + "Russian_Russia.866", + "ru-RU.1251", + "Russian_Russia.1251", + "Russian_Russia.20866", + "Russian_Russia.28595", + "Russian_Russia.65001", + "zh-Hans", + "zh-Hans.936", + "chinese-simplified" +#else /* ! _WIN32 || __CYGWIN__ */ + "C.UTF-8", + "POSIX", + "en", + "en_US", + "en_US.ISO-8859-1", + "en_US.ISO_8859-1", + "en_US.ISO8859-1", + "en_US.iso88591", + "en_US.ISO-8859-15", + "en_US.DIS_8859-15", + "en_US.ISO8859-15", + "en_US.iso885915", + "en_US.1252", + "en_US.CP1252", + "en_US.UTF-8", + "en_US.utf8", + "fr", + "fr_FR", + "fr_FR.850", + "fr_FR.IBM850", + "fr_FR.1252", + "fr_FR.CP1252", + "fr_FR.ISO-8859-1", + "fr_FR.ISO_8859-1", + "fr_FR.ISO8859-1", + "fr_FR.iso88591", + "fr_FR.ISO-8859-15", + "fr_FR.DIS_8859-15", + "fr_FR.ISO8859-15", + "fr_FR.iso8859-15", + "fr_FR.UTF-8", + "fr_FR.utf8", + "de", + "de_DE", + "de_DE.850", + "de_DE.IBM850", + "de_DE.1250", + "de_DE.CP1250", + "de_DE.1252", + "de_DE.CP1252", + "de_DE.ISO-8859-1", + "de_DE.ISO_8859-1", + "de_DE.ISO8859-1", + "de_DE.iso88591", + "de_DE.ISO-8859-15", + "de_DE.DIS_8859-15", + "de_DE.ISO8859-15", + "de_DE.iso885915", + "de_DE.UTF-8", + "de_DE.utf8", + "tr", + "tr_TR", + "tr_TR.1254", + "tr_TR.CP1254", + "tr_TR.857", + "tr_TR.IBM857", + "tr_TR.ISO-8859-9", + "tr_TR.ISO8859-9", + "tr_TR.iso88599", + "tr_TR.UTF-8", + "tr_TR.utf8", + "ru", + "ru_RU", + "ru_RU.1251", + "ru_RU.CP1251", + "ru_RU.866", + "ru_RU.IBM866", + "ru_RU.KOI8-R", + "ru_RU.koi8-r", + "ru_RU.KOI8-RU", + "ru_RU.ISO-8859-5", + "ru_RU.ISO_8859-5", + "ru_RU.ISO8859-5", + "ru_RU.iso88595", + "ru_RU.UTF-8", + "zh_CN", + "zh_CN.GB2312", + "zh_CN.UTF-8", +#endif /* ! _WIN32 || __CYGWIN__ */ +}; + +static const unsigned int locale_name_count = sizeof(locale_names) / sizeof(locale_names[0]); + + +/* + * Helper functions + */ + +int set_test_locale(unsigned int num) +{ + if (num >= locale_name_count) + return -1; + if (verbose > 2) + printf("Setting locale \"%s\":", locale_names[num]); + if (setlocale(LC_ALL, locale_names[num])) + { + if (verbose > 2) + printf(" succeed.\n"); + return 1; + } + if (verbose > 2) + printf(" failed.\n"); + return 0; +} + +const char * get_current_locale_str(void) +{ + char const * loc_str = setlocale(LC_ALL, NULL); + return loc_str ? loc_str : "unknown"; +} + +static char tmp_bufs[4][4*1024]; /* should be enough for testing */ +static size_t buf_idx = 0; + +/* print non-printable chars as char codes */ +char * n_prnt(const char * str) +{ + static char * buf; /* should be enough for testing */ + static const size_t buf_size = sizeof(tmp_bufs[0]); + const unsigned char * p = (const unsigned char*)str; + size_t w_pos = 0; + if (++buf_idx > 3) + buf_idx = 0; + buf = tmp_bufs[buf_idx]; + + while(*p && w_pos + 1 < buf_size) + { + const unsigned char c = *p; + if (c == '\\' || c == '"') + { + if (w_pos + 2 >= buf_size) + break; + buf[w_pos++] = '\\'; + buf[w_pos++] = c; + } + else if (c >= 0x20 && c <= 0x7E) + buf[w_pos++] = c; + else + { + if (w_pos + 4 >= buf_size) + break; + if (snprintf(buf + w_pos, buf_size - w_pos, "\\x%02hX", (short unsigned int)c) != 4) + break; + w_pos += 4; + } + p++; + } + if (*p) + { /* not full string is printed */ + /* enough space for "..." ? */ + if (w_pos + 3 > buf_size) + w_pos = buf_size - 4; + buf[w_pos++] = '.'; + buf[w_pos++] = '.'; + buf[w_pos++] = '.'; + } + buf[w_pos] = 0; + return buf; +} + + +struct str_with_len +{ + const char * const str; + const size_t len; +}; + +#define D_STR_W_LEN(s) {(s), (sizeof((s)) / sizeof(char)) - 1} + +/* + * String caseless equality functions tests + */ + +struct two_eq_strs +{ + const struct str_with_len s1; + const struct str_with_len s2; +}; + +static const struct two_eq_strs eq_strings[] = { + {D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`."), D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`.")}, + {D_STR_W_LEN("Simple string."), D_STR_W_LEN("Simple string.")}, + {D_STR_W_LEN("SIMPLE STRING."), D_STR_W_LEN("SIMPLE STRING.")}, + {D_STR_W_LEN("simple string."), D_STR_W_LEN("simple string.")}, + {D_STR_W_LEN("simple string."), D_STR_W_LEN("Simple String.")}, + {D_STR_W_LEN("sImPlE StRiNg."), D_STR_W_LEN("SiMpLe sTrInG.")}, + {D_STR_W_LEN("SIMPLE STRING."), D_STR_W_LEN("simple string.")}, + {D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz"), D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz")}, + {D_STR_W_LEN("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), D_STR_W_LEN("ABCDEFGHIJKLMNOPQRSTUVWXYZ")}, + {D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz"), D_STR_W_LEN("ABCDEFGHIJKLMNOPQRSTUVWXYZ")}, + {D_STR_W_LEN("zyxwvutsrqponMLKJIHGFEDCBA"), D_STR_W_LEN("ZYXWVUTSRQPONmlkjihgfedcba")}, + + {D_STR_W_LEN("Cha\x8cne pour le test."), + D_STR_W_LEN("Cha\x8cne pour le test.")}, /* "Chaîne pour le test." in CP850 */ + {D_STR_W_LEN("cha\x8cne pOur Le TEst."), + D_STR_W_LEN("Cha\x8cne poUr Le teST.")}, + {D_STR_W_LEN("Cha\xeene pour le test."), + D_STR_W_LEN("Cha\xeene pour le test.")}, /* "Chaîne pour le test." in CP1252/ISO-8859-1/ISO-8859-15 */ + {D_STR_W_LEN("CHa\xeene POUR le test."), + D_STR_W_LEN("Cha\xeeNe pour lE TEST.")}, + {D_STR_W_LEN("Cha\xc3\xaene pour le Test."), + D_STR_W_LEN("Cha\xc3\xaene pour le Test.")}, /* "Chaîne pour le test." in UTF-8 */ + {D_STR_W_LEN("ChA\xc3\xaene pouR lE TesT."), + D_STR_W_LEN("Cha\xc3\xaeNe Pour le teSt.")}, + + {D_STR_W_LEN(".Beispiel Zeichenfolge"), + D_STR_W_LEN(".Beispiel Zeichenfolge")}, + {D_STR_W_LEN(".bEisPiel ZEIchenfoLgE"), + D_STR_W_LEN(".BEiSpiEl zeIcheNfolge")}, + + {D_STR_W_LEN("Do\xa7rulama \x87izgi!"), + D_STR_W_LEN("Do\xa7rulama \x87izgi!")}, /* "Doğrulama çizgi!" in CP857 */ + {D_STR_W_LEN("Do\xa7rulama \x87IzgI!"), /* Spelling intentionally incorrect here */ + D_STR_W_LEN("Do\xa7rulama \x87izgi!")}, /* Note: 'i' is not caseless equal to 'I' in Turkish */ + {D_STR_W_LEN("Do\xf0rulama \xe7izgi!"), + D_STR_W_LEN("Do\xf0rulama \xe7izgi!")}, /* "Doğrulama çizgi!" in CP1254/ISO-8859-9 */ + {D_STR_W_LEN("Do\xf0rulamA \xe7Izgi!"), + D_STR_W_LEN("do\xf0rulama \xe7izgi!")}, + {D_STR_W_LEN("Do\xc4\x9frulama \xc3\xa7izgi!"), + D_STR_W_LEN("Do\xc4\x9frulama \xc3\xa7izgi!")}, /* "Doğrulama çizgi!" in UTF-8 */ + {D_STR_W_LEN("do\xc4\x9fruLAMA \xc3\xa7Izgi!"), /* Spelling intentionally incorrect here */ + D_STR_W_LEN("DO\xc4\x9frulama \xc3\xa7izgI!")}, /* Spelling intentionally incorrect here */ + + {D_STR_W_LEN("\x92\xa5\xe1\xe2\xae\xa2\xa0\xef \x91\xe2\xe0\xae\xaa\xa0."), + D_STR_W_LEN("\x92\xa5\xe1\xe2\xae\xa2\xa0\xef \x91\xe2\xe0\xae\xaa\xa0.")}, /* "Тестовая Строка." in CP866 */ + {D_STR_W_LEN("\xd2\xe5\xf1\xf2\xee\xe2\xe0\xff \xd1\xf2\xf0\xee\xea\xe0."), + D_STR_W_LEN("\xd2\xe5\xf1\xf2\xee\xe2\xe0\xff \xd1\xf2\xf0\xee\xea\xe0.")}, /* "Тестовая Строка." in CP1251 */ + {D_STR_W_LEN("\xf4\xc5\xd3\xd4\xcf\xd7\xc1\xd1 \xf3\xd4\xd2\xcf\xcb\xc1."), + D_STR_W_LEN("\xf4\xc5\xd3\xd4\xcf\xd7\xc1\xd1 \xf3\xd4\xd2\xcf\xcb\xc1.")}, /* "Тестовая Строка." in KOI8-R */ + {D_STR_W_LEN("\xc2\xd5\xe1\xe2\xde\xd2\xd0\xef \xc1\xe2\xe0\xde\xda\xd0."), + D_STR_W_LEN("\xc2\xd5\xe1\xe2\xde\xd2\xd0\xef \xc1\xe2\xe0\xde\xda\xd0.")}, /* "Тестовая Строка." in ISO-8859-5 */ + {D_STR_W_LEN("\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd0\xb0\xd1" + "\x8f \xd0\xa1\xd1\x82\xd1\x80\xd0\xbe\xd0\xba\xd0\xb0."), + D_STR_W_LEN("\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd0\xb0\xd1" + "\x8f \xd0\xa1\xd1\x82\xd1\x80\xd0\xbe\xd0\xba\xd0\xb0.")}, /* "Тестовая Строка." in UTF-8 */ + + {D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@[\\]" + "^_`{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90" + "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" + "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8" + "\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc" + "\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" + "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4" + "\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"), + D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@[\\]" + "^_`{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90" + "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4" + "\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8" + "\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc" + "\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" + "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4" + "\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")}, /* Full sequence without a-z */ + {D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@AB" + "CDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83" + "\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97" + "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab" + "\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3" + "\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" + "\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb" + "\xfc\xfd\xfe\xff"), + D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@AB" + "CDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83" + "\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97" + "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab" + "\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" + "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3" + "\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7" + "\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb" + "\xfc\xfd\xfe\xff")}, /* Full sequence */ + {D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@AB" + "CDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89" + "\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d" + "\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1" + "\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5" + "\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9" + "\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed" + "\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"), + D_STR_W_LEN("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" + "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,-./0123456789:;<=>?@ab" + "cdefghijklmnopqrstuvwxyz[\\]^_`{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89" + "\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d" + "\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1" + "\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5" + "\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9" + "\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed" + "\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")} /* Full with A/a match */ +}; + +struct two_neq_strs +{ + const struct str_with_len s1; + const struct str_with_len s2; + const size_t dif_pos; +}; + +static const struct two_neq_strs neq_strings[] = { + {D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`."), D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`"), 27}, + {D_STR_W_LEN(".1234567890!@~%&$@#{}[]\\/!?`."), D_STR_W_LEN("1234567890!@~%&$@#{}[]\\/!?`"), 0}, + {D_STR_W_LEN("Simple string."), D_STR_W_LEN("Simple ctring."), 7}, + {D_STR_W_LEN("simple string."), D_STR_W_LEN("simple string"), 13}, + {D_STR_W_LEN("simple strings"), D_STR_W_LEN("Simple String."), 13}, + {D_STR_W_LEN("sImPlE StRiNg."), D_STR_W_LEN("SYMpLe sTrInG."), 1}, + {D_STR_W_LEN("SIMPLE STRING."), D_STR_W_LEN("simple string.2"), 14}, + {D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz,"), D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz."), 26}, + {D_STR_W_LEN("abcdefghijklmnopqrstuvwxyz!"), D_STR_W_LEN("ABCDEFGHIJKLMNOPQRSTUVWXYZ?"), 26}, + {D_STR_W_LEN("zyxwvutsrqponwMLKJIHGFEDCBA"), D_STR_W_LEN("ZYXWVUTSRQPON%mlkjihgfedcba"), 13}, + + {D_STR_W_LEN("S\xbdur veulent plus d'\xbdufs."), /* "Sœur veulent plus d'œufs." in ISO-8859-15 */ + D_STR_W_LEN("S\xbcUR VEULENT PLUS D'\xbcUFS."), 1},/* "SŒUR VEULENT PLUS D'ŒUFS." in ISO-8859-15 */ + {D_STR_W_LEN("S\x9cur veulent plus d'\x9cufs."), /* "Sœur veulent plus d'œufs." in CP1252 */ + D_STR_W_LEN("S\x8cUR VEULENT PLUS D'\x8cUFS."), 1},/* "SŒUR VEULENT PLUS D'ŒUFS." in CP1252 */ + {D_STR_W_LEN("S\xc5\x93ur veulent plus d'\xc5\x93ufs."), /* "Sœur veulent plus d'œufs." in UTF-8 */ + D_STR_W_LEN("S\xc5\x92UR VEULENT PLUS D'\xc5\x92UFS."), 2},/* "SŒUR VEULENT PLUS D'ŒUFS." in UTF-8 */ + + {D_STR_W_LEN("Um ein sch\x94nes M\x84" "dchen zu k\x81ssen."), /* "Um ein schönes Mädchen zu küssen." in CP850 */ + D_STR_W_LEN("UM EIN SCH\x99NES M\x8e" "DCHEN ZU K\x9aSSEN."), 10},/* "UM EIN SCHÖNES MÄDCHEN ZU KÜSSEN." in CP850 */ + {D_STR_W_LEN("Um ein sch\xf6nes M\xe4" "dchen zu k\xfcssen."), /* "Um ein schönes Mädchen zu küssen." in ISO-8859-1/ISO-8859-15/CP1250/CP1252 */ + D_STR_W_LEN("UM EIN SCH\xd6NES M\xc4" "DCHEN ZU K\xdcSSEN."), 10},/* "UM EIN SCHÖNES MÄDCHEN ZU KÜSSEN." in ISO-8859-1/ISO-8859-15/CP1250/CP1252 */ + {D_STR_W_LEN("Um ein sch\xc3\xb6nes M\xc3\xa4" "dchen zu k\xc3\xbcssen."), /* "Um ein schönes Mädchen zu küssen." in UTF-8 */ + D_STR_W_LEN("UM EIN SCH\xc3\x96NES M\xc3\x84" "DCHEN ZU K\xc3\x9cSSEN."), 11},/* "UM EIN SCHÖNES MÄDCHEN ZU KÜSSEN." in UTF-8 */ + + {D_STR_W_LEN("\x98stanbul"), /* "İstanbul" in CP857 */ + D_STR_W_LEN("istanbul"), 0}, /* "istanbul" in CP857 */ + {D_STR_W_LEN("\xddstanbul"), /* "İstanbul" in ISO-8859-9/CP1254 */ + D_STR_W_LEN("istanbul"), 0}, /* "istanbul" in ISO-8859-9/CP1254 */ + {D_STR_W_LEN("\xc4\xb0stanbul"), /* "İstanbul" in UTF-8 */ + D_STR_W_LEN("istanbul"), 0}, /* "istanbul" in UTF-8 */ + {D_STR_W_LEN("Diyarbak\x8dr"), /* "Diyarbakır" in CP857 */ + D_STR_W_LEN("DiyarbakIR"), 8}, /* "DiyarbakIR" in CP857 */ + {D_STR_W_LEN("Diyarbak\xfdr"), /* "Diyarbakır" in ISO-8859-9/CP1254 */ + D_STR_W_LEN("DiyarbakIR"), 8}, /* "DiyarbakIR" in ISO-8859-9/CP1254 */ + {D_STR_W_LEN("Diyarbak\xc4\xb1r"), /* "Diyarbakır" in UTF-8 */ + D_STR_W_LEN("DiyarbakIR"), 8}, /* "DiyarbakIR" in UTF-8 */ + + {D_STR_W_LEN("\x92\xa5\xe1\xe2\xae\xa2\xa0\xef \x91\xe2\xe0\xae\xaa\xa0."), /* "Тестовая Строка." in CP866 */ + D_STR_W_LEN("\x92\x85\x91\x92\x8e\x82\x80\x9f \x91\x92\x90\x8e\x8a\x80."), 1}, /* "ТЕСТОВАЯ СТРОКА." in CP866 */ + {D_STR_W_LEN("\xd2\xe5\xf1\xf2\xee\xe2\xe0\xff \xd1\xf2\xf0\xee\xea\xe0."), /* "Тестовая Строка." in CP1251 */ + D_STR_W_LEN("\xd2\xc5\xd1\xd2\xce\xc2\xc0\xdf \xd1\xd2\xd0\xce\xca\xc0."), 1}, /* "ТЕСТОВАЯ СТРОКА." in CP1251 */ + {D_STR_W_LEN("\xf4\xc5\xd3\xd4\xcf\xd7\xc1\xd1 \xf3\xd4\xd2\xcf\xcb\xc1."), /* "Тестовая Строка." in KOI8-R */ + D_STR_W_LEN("\xf4\xe5\xf3\xf4\xef\xf7\xe1\xf1 \xf3\xf4\xf2\xef\xeb\xe1."), 1}, /* "ТЕСТОВАЯ СТРОКА." in KOI8-R */ + {D_STR_W_LEN("\xc2\xd5\xe1\xe2\xde\xd2\xd0\xef \xc1\xe2\xe0\xde\xda\xd0."), /* "Тестовая Строка." in ISO-8859-5 */ + D_STR_W_LEN("\xc2\xb5\xc1\xc2\xbe\xb2\xb0\xcf \xc1\xc2\xc0\xbe\xba\xb0."), 1}, /* "ТЕСТОВАЯ СТРОКА." in ISO-8859-5 */ + {D_STR_W_LEN("\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd0\xb0\xd1" + "\x8f \xd0\xa1\xd1\x82\xd1\x80\xd0\xbe\xd0\xba\xd0\xb0."), /* "Тестовая Строка." in UTF-8 */ + D_STR_W_LEN("\xd0\xa2\xd0\x95\xd0\xa1\xd0\xa2\xd0\x9e\xd0\x92\xd0\x90\xd0" + "\xaf \xd0\xa1\xd0\xa2\xd0\xa0\xd0\x9e\xd0\x9a\xd0\x90."), 3} /* "ТЕСТОВАЯ СТРОКА." in UTF-8 */ +}; + + +int check_eq_strings(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(eq_strings) / sizeof(eq_strings[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + const struct two_eq_strs * const t = eq_strings + i; + if (c_failed[i]) + continue; /* skip already failed checks */ + if (!MHD_str_equal_caseless_(t->s1.str, t->s2.str)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_(\"%s\", \"%s\") returned zero, while expected non-zero." + " Locale: %s\n", n_prnt(t->s1.str), n_prnt(t->s2.str), get_current_locale_str()); + } + else if (!MHD_str_equal_caseless_(t->s2.str, t->s1.str)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_(\"%s\", \"%s\") returned zero, while expected non-zero." + " Locale: %s\n", n_prnt(t->s2.str), n_prnt(t->s1.str), get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") != 0 && \\\n" + " MHD_str_equal_caseless_(\"%s\", \"%s\") != 0\n", n_prnt(t->s1.str), n_prnt(t->s2.str), + n_prnt(t->s2.str), n_prnt(t->s1.str)); + } + } + return t_failed; +} + +int check_neq_strings(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(neq_strings) / sizeof(neq_strings[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + const struct two_neq_strs * const t = neq_strings + i; + if (c_failed[i]) + continue; /* skip already failed checks */ + if (MHD_str_equal_caseless_(t->s1.str, t->s2.str)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_(\"%s\", \"%s\") returned non-zero, while expected zero." + " Locale: %s\n", n_prnt(t->s1.str), n_prnt(t->s2.str), get_current_locale_str()); + } + else if (MHD_str_equal_caseless_(t->s2.str, t->s1.str)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_(\"%s\", \"%s\") returned non-zero, while expected zero." + " Locale: %s\n", n_prnt(t->s2.str), n_prnt(t->s1.str), get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") == 0 && \\\n" + " MHD_str_equal_caseless_(\"%s\", \"%s\") == 0\n", n_prnt(t->s1.str), n_prnt(t->s2.str), + n_prnt(t->s2.str), n_prnt(t->s1.str)); + } + } + return t_failed; +} + +int check_eq_strings_n(void) +{ + size_t t_failed = 0; + size_t i, j, k; + static const size_t n_checks = sizeof(eq_strings) / sizeof(eq_strings[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t m_len; + const struct two_eq_strs * const t = eq_strings + i; + m_len = (t->s1.len > t->s2.len) ? t->s1.len : t->s2.len; + for(k = 0; k <= m_len + 1 && !c_failed[i]; k++) + { + if (!MHD_str_equal_caseless_n_(t->s1.str, t->s2.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned zero," + " while expected non-zero. Locale: %s\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), (unsigned int) k, get_current_locale_str()); + } + else if (!MHD_str_equal_caseless_n_(t->s2.str, t->s1.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned zero," + " while expected non-zero. Locale: %s\n", + n_prnt(t->s2.str), n_prnt(t->s1.str), (unsigned int) k, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" + " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0, where N is 0..%u\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), n_prnt(t->s2.str), n_prnt(t->s1.str), (unsigned int) m_len + 1); + } + } + return t_failed; +} + +int check_neq_strings_n(void) +{ + size_t t_failed = 0; + size_t i, j, k; + static const size_t n_checks = sizeof(neq_strings) / sizeof(neq_strings[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t m_len; + const struct two_neq_strs * const t = neq_strings + i; + m_len = t->s1.len > t->s2.len ? t->s1.len : t->s2.len; + if (t->dif_pos >= m_len) + { + fprintf(stderr, "ERROR: neq_strings[%u] has wrong dif_pos (%u): dif_pos is expected to be less than " + "s1.len (%u) or s2.len (%u).\n", (unsigned int) i, (unsigned int) t->dif_pos, + (unsigned int) t->s1.len, (unsigned int) t->s2.len); + return -1; + } + if (t->dif_pos > t->s1.len) + { + fprintf(stderr, "ERROR: neq_strings[%u] has wrong dif_pos (%u): dif_pos is expected to be less or " + "equal to s1.len (%u).\n", (unsigned int) i, (unsigned int) t->dif_pos, + (unsigned int) t->s1.len); + return -1; + } + if (t->dif_pos > t->s2.len) + { + fprintf(stderr, "ERROR: neq_strings[%u] has wrong dif_pos (%u): dif_pos is expected to be less or " + "equal to s2.len (%u).\n", (unsigned int) i, (unsigned int) t->dif_pos, + (unsigned int) t->s2.len); + return -1; + } + for(k = 0; k <= m_len + 1 && !c_failed[i]; k++) + { + if (k <= t->dif_pos) + { + if (!MHD_str_equal_caseless_n_(t->s1.str, t->s2.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned zero," + " while expected non-zero. Locale: %s\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), (unsigned int) k, get_current_locale_str()); + } + else if (!MHD_str_equal_caseless_n_(t->s2.str, t->s1.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned zero," + " while expected non-zero. Locale: %s\n", + n_prnt(t->s2.str), n_prnt(t->s1.str), (unsigned int) k, get_current_locale_str()); + } + } + else + { + if (MHD_str_equal_caseless_n_(t->s1.str, t->s2.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned non-zero," + " while expected zero. Locale: %s\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), (unsigned int) k, get_current_locale_str()); + } + else if (MHD_str_equal_caseless_n_(t->s2.str, t->s1.str, k)) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", %u) returned non-zero," + " while expected zero. Locale: %s\n", + n_prnt(t->s2.str), n_prnt(t->s1.str), (unsigned int) k, get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + { + printf("PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" + " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0, where N is 0..%u\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), n_prnt(t->s2.str), n_prnt(t->s1.str), + (unsigned int) t->dif_pos); + + printf("PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) == 0 && \\\n" + " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) == 0, where N is %u..%u\n", + n_prnt(t->s1.str), n_prnt(t->s2.str), n_prnt(t->s2.str), n_prnt(t->s1.str), + (unsigned int) t->dif_pos + 1, (unsigned int) m_len + 1); + } + } + } + return t_failed; +} + +/* + * Run eq/neq strings tests + */ +int run_eq_neq_str_tests(void) +{ + int str_equal_caseless_fails = 0; + int str_equal_caseless_n_fails = 0; + int res; + + res = check_eq_strings(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_eq_strings().\n"); + return 99; + } + str_equal_caseless_fails += res; + fprintf(stderr, "FAILED: testcase check_eq_strings() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_eq_strings() successfully passed.\n\n"); + + res = check_neq_strings(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_neq_strings().\n"); + return 99; + } + str_equal_caseless_fails += res; + fprintf(stderr, "FAILED: testcase check_neq_strings() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_neq_strings() successfully passed.\n\n"); + + if (str_equal_caseless_fails) + fprintf(stderr, "FAILED: function MHD_str_equal_caseless_() failed %d time%s.\n\n", + str_equal_caseless_fails, str_equal_caseless_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_str_equal_caseless_() successfully passed all checks.\n\n"); + + res = check_eq_strings_n(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_eq_strings_n().\n"); + return 99; + } + str_equal_caseless_n_fails += res; + fprintf(stderr, "FAILED: testcase check_eq_strings_n() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_eq_strings_n() successfully passed.\n\n"); + + res = check_neq_strings_n(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_neq_strings_n().\n"); + return 99; + } + str_equal_caseless_n_fails += res; + fprintf(stderr, "FAILED: testcase check_neq_strings_n() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_neq_strings_n() successfully passed.\n\n"); + + if (str_equal_caseless_n_fails) + fprintf(stderr, "FAILED: function MHD_str_equal_caseless_n_() failed %d time%s.\n\n", + str_equal_caseless_n_fails, str_equal_caseless_n_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_str_equal_caseless_n_() successfully passed all checks.\n\n"); + + if (str_equal_caseless_fails || str_equal_caseless_n_fails) + { + if (verbose > 0) + printf("At least one test failed.\n"); + + return 1; + } + + if (verbose > 0) + printf("All tests passed successfully.\n"); + + return 0; +} + +/* + * Digits in string -> value tests + */ + +struct str_with_value { + const struct str_with_len str; + const size_t num_of_digt; + const uint64_t val; +}; + +/* valid string for conversion to unsigned integer value */ +static const struct str_with_value dstrs_w_values[] = { + /* simplest strings */ + {D_STR_W_LEN("1"), 1, 1}, + {D_STR_W_LEN("0"), 1, 0}, + {D_STR_W_LEN("10000"), 5, 10000}, + + /* all digits */ + {D_STR_W_LEN("1234"), 4, 1234}, + {D_STR_W_LEN("4567"), 4, 4567}, + {D_STR_W_LEN("7890"), 4, 7890}, + {D_STR_W_LEN("8021"), 4, 8021}, + {D_STR_W_LEN("9754"), 4, 9754}, + {D_STR_W_LEN("6392"), 4, 6392}, + + /* various prefixes */ + {D_STR_W_LEN("00000000"), 8, 0}, + {D_STR_W_LEN("0755"), 4, 755}, /* not to be interpreted as octal value! */ + {D_STR_W_LEN("002"), 3, 2}, + {D_STR_W_LEN("0001"), 4, 1}, + {D_STR_W_LEN("00000000000000000000000031295483"), 32, 31295483}, + + /* numbers below and above limits */ + {D_STR_W_LEN("127"), 3, 127}, /* 0x7F, SCHAR_MAX */ + {D_STR_W_LEN("128"), 3, 128}, /* 0x80, SCHAR_MAX+1 */ + {D_STR_W_LEN("255"), 3, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("256"), 3, 256}, /* 0x100, UCHAR_MAX+1 */ + {D_STR_W_LEN("32767"), 5, 32767}, /* 0x7FFF, INT16_MAX */ + {D_STR_W_LEN("32768"), 5, 32768}, /* 0x8000, INT16_MAX+1 */ + {D_STR_W_LEN("65535"), 5, 65535}, /* 0xFFFF, UINT16_MAX */ + {D_STR_W_LEN("65536"), 5, 65536}, /* 0x10000, UINT16_MAX+1 */ + {D_STR_W_LEN("2147483647"), 10, 2147483647}, /* 0x7FFFFFFF, INT32_MAX */ + {D_STR_W_LEN("2147483648"), 10, UINT64_C(2147483648)}, /* 0x80000000, INT32_MAX+1 */ + {D_STR_W_LEN("4294967295"), 10, UINT64_C(4294967295)}, /* 0xFFFFFFFF, UINT32_MAX */ + {D_STR_W_LEN("4294967296"), 10, UINT64_C(4294967296)}, /* 0x100000000, UINT32_MAX+1 */ + {D_STR_W_LEN("9223372036854775807"), 19, UINT64_C(9223372036854775807)}, /* 0x7FFFFFFFFFFFFFFF, INT64_MAX */ + {D_STR_W_LEN("9223372036854775808"), 19, UINT64_C(9223372036854775808)}, /* 0x8000000000000000, INT64_MAX+1 */ + {D_STR_W_LEN("18446744073709551615"), 20, UINT64_C(18446744073709551615)}, /* 0xFFFFFFFFFFFFFFFF, UINT64_MAX */ + + /* random numbers */ + {D_STR_W_LEN("10186753"), 8, 10186753}, + {D_STR_W_LEN("144402566"), 9, 144402566}, + {D_STR_W_LEN("151903144"), 9, 151903144}, + {D_STR_W_LEN("139264621"), 9, 139264621}, + {D_STR_W_LEN("730348"), 6, 730348}, + {D_STR_W_LEN("21584377"), 8, 21584377}, + {D_STR_W_LEN("709"), 3, 709}, + {D_STR_W_LEN("54"), 2, 54}, + {D_STR_W_LEN("8452"), 4, 8452}, + {D_STR_W_LEN("17745098750013624977"), 20, UINT64_C(17745098750013624977)}, + {D_STR_W_LEN("06786878769931678000"), 20, UINT64_C(6786878769931678000)}, + + /* non-digit suffixes */ + {D_STR_W_LEN("1234oa"), 4, 1234}, + {D_STR_W_LEN("20h"), 2, 20}, /* not to be interpreted as hex value! */ + {D_STR_W_LEN("0x1F"), 1, 0}, /* not to be interpreted as hex value! */ + {D_STR_W_LEN("0564`~}"), 4, 564}, + {D_STR_W_LEN("7240146.724"), 7, 7240146}, + {D_STR_W_LEN("2,9"), 1, 2}, + {D_STR_W_LEN("200+1"), 3, 200}, + {D_STR_W_LEN("1a"), 1, 1}, + {D_STR_W_LEN("2E"), 1, 2}, + {D_STR_W_LEN("6c"), 1, 6}, + {D_STR_W_LEN("8F"), 1, 8}, + {D_STR_W_LEN("287416997! And the not too long string."), 9, 287416997} +}; + +/* strings that should overflow uint64_t */ +const struct str_with_len str_ovflw[] = { + D_STR_W_LEN("18446744073709551616"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("18446744073709551620"), + D_STR_W_LEN("18446744083709551615"), + D_STR_W_LEN("19234761020556472143"), + D_STR_W_LEN("184467440737095516150"), + D_STR_W_LEN("1844674407370955161500"), + D_STR_W_LEN("000018446744073709551616"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("20000000000000000000"), + D_STR_W_LEN("020000000000000000000"), + D_STR_W_LEN("0020000000000000000000"), + D_STR_W_LEN("100000000000000000000"), + D_STR_W_LEN("434532891232591226417"), + D_STR_W_LEN("99999999999999999999"), + D_STR_W_LEN("18446744073709551616abcd"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("20000000000000000000 suffix"), + D_STR_W_LEN("020000000000000000000x") +}; + +/* strings that should not be convertible to numeric value */ +const struct str_with_len str_no_num[] = { + D_STR_W_LEN("zero"), + D_STR_W_LEN("one"), + D_STR_W_LEN("\xb9\xb2\xb3"), /* superscript "123" in ISO-8859-1/CP1252 */ + D_STR_W_LEN("\xc2\xb9\xc2\xb2\xc2\xb3"), /* superscript "123" in UTF-8 */ + D_STR_W_LEN("\xd9\xa1\xd9\xa2\xd9\xa3"), /* Arabic-Indic "١٢٣" in UTF-8 */ + D_STR_W_LEN("\xdb\xb1\xdb\xb2\xdb\xb3"), /* Ext Arabic-Indic "۱۲۳" in UTF-8 */ + D_STR_W_LEN("\xe0\xa5\xa7\xe0\xa5\xa8\xe0\xa5\xa9"), /* Devanagari "१२३" in UTF-8 */ + D_STR_W_LEN("\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89"), /* Chinese "一二三" in UTF-8 */ + D_STR_W_LEN("\xd2\xbb\xb6\xfe\xc8\xfd"), /* Chinese "一二三" in GB2312/CP936 */ + D_STR_W_LEN("\x1B\x24\x29\x41\x0E\x52\x3B\x36\x7E\x48\x7D\x0F") /* Chinese "一二三" in ISO-2022-CN */ +}; + +/* valid hex string for conversion to unsigned integer value */ +static const struct str_with_value xdstrs_w_values[] = { + /* simplest strings */ + {D_STR_W_LEN("1"), 1, 0x1}, + {D_STR_W_LEN("0"), 1, 0x0}, + {D_STR_W_LEN("10000"), 5, 0x10000}, + + /* all digits */ + {D_STR_W_LEN("1234"), 4, 0x1234}, + {D_STR_W_LEN("4567"), 4, 0x4567}, + {D_STR_W_LEN("7890"), 4, 0x7890}, + {D_STR_W_LEN("8021"), 4, 0x8021}, + {D_STR_W_LEN("9754"), 4, 0x9754}, + {D_STR_W_LEN("6392"), 4, 0x6392}, + {D_STR_W_LEN("abcd"), 4, 0xABCD}, + {D_STR_W_LEN("cdef"), 4, 0xCDEF}, + {D_STR_W_LEN("FEAB"), 4, 0xFEAB}, + {D_STR_W_LEN("BCED"), 4, 0xBCED}, + {D_STR_W_LEN("bCeD"), 4, 0xBCED}, + {D_STR_W_LEN("1A5F"), 4, 0x1A5F}, + {D_STR_W_LEN("12AB"), 4, 0x12AB}, + {D_STR_W_LEN("CD34"), 4, 0xCD34}, + {D_STR_W_LEN("56EF"), 4, 0x56EF}, + {D_STR_W_LEN("7a9f"), 4, 0x7A9F}, + + /* various prefixes */ + {D_STR_W_LEN("00000000"), 8, 0x0}, + {D_STR_W_LEN("0755"), 4, 0x755}, /* not to be interpreted as octal value! */ + {D_STR_W_LEN("002"), 3, 0x2}, + {D_STR_W_LEN("0001"), 4, 0x1}, + {D_STR_W_LEN("00a"), 3, 0xA}, + {D_STR_W_LEN("0F"), 2, 0xF}, + {D_STR_W_LEN("0000000000000000000000003A29e4C3"), 32, 0x3A29E4C3}, + + /* numbers below and above limits */ + {D_STR_W_LEN("7F"), 2, 127}, /* 0x7F, SCHAR_MAX */ + {D_STR_W_LEN("7f"), 2, 127}, /* 0x7F, SCHAR_MAX */ + {D_STR_W_LEN("80"), 2, 128}, /* 0x80, SCHAR_MAX+1 */ + {D_STR_W_LEN("fF"), 2, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("Ff"), 2, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("FF"), 2, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("ff"), 2, 255}, /* 0xFF, UCHAR_MAX */ + {D_STR_W_LEN("100"), 3, 256}, /* 0x100, UCHAR_MAX+1 */ + {D_STR_W_LEN("7fff"), 4, 32767}, /* 0x7FFF, INT16_MAX */ + {D_STR_W_LEN("7FFF"), 4, 32767}, /* 0x7FFF, INT16_MAX */ + {D_STR_W_LEN("7Fff"), 4, 32767}, /* 0x7FFF, INT16_MAX */ + {D_STR_W_LEN("8000"), 4, 32768}, /* 0x8000, INT16_MAX+1 */ + {D_STR_W_LEN("ffff"), 4, 65535}, /* 0xFFFF, UINT16_MAX */ + {D_STR_W_LEN("FFFF"), 4, 65535}, /* 0xFFFF, UINT16_MAX */ + {D_STR_W_LEN("FffF"), 4, 65535}, /* 0xFFFF, UINT16_MAX */ + {D_STR_W_LEN("10000"), 5, 65536}, /* 0x10000, UINT16_MAX+1 */ + {D_STR_W_LEN("7FFFFFFF"), 8, 2147483647}, /* 0x7FFFFFFF, INT32_MAX */ + {D_STR_W_LEN("7fffffff"), 8, 2147483647}, /* 0x7FFFFFFF, INT32_MAX */ + {D_STR_W_LEN("7FFffFff"), 8, 2147483647}, /* 0x7FFFFFFF, INT32_MAX */ + {D_STR_W_LEN("80000000"), 8, UINT64_C(2147483648)}, /* 0x80000000, INT32_MAX+1 */ + {D_STR_W_LEN("FFFFFFFF"), 8, UINT64_C(4294967295)}, /* 0xFFFFFFFF, UINT32_MAX */ + {D_STR_W_LEN("ffffffff"), 8, UINT64_C(4294967295)}, /* 0xFFFFFFFF, UINT32_MAX */ + {D_STR_W_LEN("FfFfFfFf"), 8, UINT64_C(4294967295)}, /* 0xFFFFFFFF, UINT32_MAX */ + {D_STR_W_LEN("100000000"), 9, UINT64_C(4294967296)}, /* 0x100000000, UINT32_MAX+1 */ + {D_STR_W_LEN("7fffffffffffffff"), 16, UINT64_C(9223372036854775807)}, /* 0x7FFFFFFFFFFFFFFF, INT64_MAX */ + {D_STR_W_LEN("7FFFFFFFFFFFFFFF"), 16, UINT64_C(9223372036854775807)}, /* 0x7FFFFFFFFFFFFFFF, INT64_MAX */ + {D_STR_W_LEN("7FfffFFFFffFFffF"), 16, UINT64_C(9223372036854775807)}, /* 0x7FFFFFFFFFFFFFFF, INT64_MAX */ + {D_STR_W_LEN("8000000000000000"), 16, UINT64_C(9223372036854775808)}, /* 0x8000000000000000, INT64_MAX+1 */ + {D_STR_W_LEN("ffffffffffffffff"), 16, UINT64_C(18446744073709551615)}, /* 0xFFFFFFFFFFFFFFFF, UINT64_MAX */ + {D_STR_W_LEN("FFFFFFFFFFFFFFFF"), 16, UINT64_C(18446744073709551615)}, /* 0xFFFFFFFFFFFFFFFF, UINT64_MAX */ + {D_STR_W_LEN("FffFffFFffFFfFFF"), 16, UINT64_C(18446744073709551615)}, /* 0xFFFFFFFFFFFFFFFF, UINT64_MAX */ + + /* random numbers */ + {D_STR_W_LEN("10186753"), 8, 0x10186753}, + {D_STR_W_LEN("144402566"), 9, 0x144402566}, + {D_STR_W_LEN("151903144"), 9, 0x151903144}, + {D_STR_W_LEN("139264621"), 9, 0x139264621}, + {D_STR_W_LEN("730348"), 6, 0x730348}, + {D_STR_W_LEN("21584377"), 8, 0x21584377}, + {D_STR_W_LEN("709"), 3, 0x709}, + {D_STR_W_LEN("54"), 2, 0x54}, + {D_STR_W_LEN("8452"), 4, 0x8452}, + {D_STR_W_LEN("22353EC6"), 8, 0x22353EC6}, + {D_STR_W_LEN("307F1655"), 8, 0x307F1655}, + {D_STR_W_LEN("1FCB7226"), 8, 0x1FCB7226}, + {D_STR_W_LEN("82480560"), 8, 0x82480560}, + {D_STR_W_LEN("7386D95"), 7, 0x7386D95}, + {D_STR_W_LEN("EC3AB"), 5, 0xEC3AB}, + {D_STR_W_LEN("6DD05"), 5, 0x6DD05}, + {D_STR_W_LEN("C5DF"), 4, 0xC5DF}, + {D_STR_W_LEN("6CE"), 3, 0x6CE}, + {D_STR_W_LEN("CE6"), 3, 0xCE6}, + {D_STR_W_LEN("ce6"), 3, 0xCE6}, + {D_STR_W_LEN("F27"), 3, 0xF27}, + {D_STR_W_LEN("8497D54277D7E1"), 14, UINT64_C(37321639124785121)}, + {D_STR_W_LEN("8497d54277d7e1"), 14, UINT64_C(37321639124785121)}, + {D_STR_W_LEN("8497d54277d7E1"), 14, UINT64_C(37321639124785121)}, + {D_STR_W_LEN("8C8112D0A06"), 11, UINT64_C(9655374645766)}, + {D_STR_W_LEN("8c8112d0a06"), 11, UINT64_C(9655374645766)}, + {D_STR_W_LEN("8c8112d0A06"), 11, UINT64_C(9655374645766)}, + {D_STR_W_LEN("1774509875001362"), 16, UINT64_C(1690064375898968930)}, + {D_STR_W_LEN("0678687876998000"), 16, UINT64_C(466237428027981824)}, + + /* non-digit suffixes */ + {D_STR_W_LEN("1234oa"), 4, 0x1234}, + {D_STR_W_LEN("20h"), 2, 0x20}, + {D_STR_W_LEN("2CH"), 2, 0x2C}, + {D_STR_W_LEN("2ch"), 2, 0x2C}, + {D_STR_W_LEN("0x1F"), 1, 0x0}, /* not to be interpreted as hex prefix! */ + {D_STR_W_LEN("0564`~}"), 4, 0x564}, + {D_STR_W_LEN("0A64`~}"), 4, 0xA64}, + {D_STR_W_LEN("056c`~}"), 4, 0X56C}, + {D_STR_W_LEN("7240146.724"), 7, 0x7240146}, + {D_STR_W_LEN("7E4c1AB.724"), 7, 0X7E4C1AB}, + {D_STR_W_LEN("F24B1B6.724"), 7, 0xF24B1B6}, + {D_STR_W_LEN("2,9"), 1, 0x2}, + {D_STR_W_LEN("a,9"), 1, 0xA}, + {D_STR_W_LEN("200+1"), 3, 0x200}, + {D_STR_W_LEN("2cc+1"), 3, 0x2CC}, + {D_STR_W_LEN("2cC+1"), 3, 0x2CC}, + {D_STR_W_LEN("27416997! And the not too long string."), 8, 0x27416997}, + {D_STR_W_LEN("27555416997! And the not too long string."), 11, 0x27555416997}, + {D_STR_W_LEN("416997And the not too long string."), 7, 0x416997A}, + {D_STR_W_LEN("0F4C3Dabstract addition to make string even longer"), 8, 0xF4C3DAB} +}; + +/* hex strings that should overflow uint64_t */ +const struct str_with_len strx_ovflw[] = { + D_STR_W_LEN("10000000000000000"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("10000000000000001"), + D_STR_W_LEN("10000000000000002"), + D_STR_W_LEN("1000000000000000A"), + D_STR_W_LEN("11000000000000000"), + D_STR_W_LEN("010000000000000000"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("000010000000000000000"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("20000000000000000000"), + D_STR_W_LEN("020000000000000000000"), + D_STR_W_LEN("0020000000000000000000"), + D_STR_W_LEN("20000000000000000"), + D_STR_W_LEN("A0000000000000000"), + D_STR_W_LEN("F0000000000000000"), + D_STR_W_LEN("a0000000000000000"), + D_STR_W_LEN("11111111111111111"), + D_STR_W_LEN("CcCcCCccCCccCCccC"), + D_STR_W_LEN("f0000000000000000"), + D_STR_W_LEN("100000000000000000000"), + D_STR_W_LEN("434532891232591226417"), + D_STR_W_LEN("10000000000000000a"), + D_STR_W_LEN("10000000000000000E"), + D_STR_W_LEN("100000000000000000 and nothing"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("100000000000000000xx"), /* 0x10000000000000000, UINT64_MAX+1 */ + D_STR_W_LEN("99999999999999999999"), + D_STR_W_LEN("18446744073709551616abcd"), + D_STR_W_LEN("20000000000000000000 suffix"), + D_STR_W_LEN("020000000000000000000x") +}; + + +int check_str_to_uint64_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(dstrs_w_values) / sizeof(dstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint64_t rv; + size_t rs; + const struct str_with_value * const t = dstrs_w_values + i; + + if (c_failed[i]) + continue; /* skip already failed checks */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: dstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + rv = 9435223; /* some random value */ + rs = MHD_str_to_uint64_(t->str.str, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") returned %" PRIuPTR ", while expecting %d." + " Locale: %s\n", n_prnt(t->str.str), rv, (intptr_t)rs, (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") converted string to value %" PRIu64 "," + " while expecting result %" PRIu64 ". Locale: %s\n", n_prnt(t->str.str), rv, rv, + t->val, get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") == %" PRIuPTR "\n", + n_prnt(t->str.str), rv, rs); + } + } + return t_failed; +} + + +int check_str_to_uint64_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint64_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint64_t rnd_val = 24941852; + size_t rs; + if (c >= '0' && c <= '9') + continue; /* skip digits */ + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint64_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_str_to_uint64_(test_str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(test_str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: %" PRIu64 ", after call %" PRIu64 "). Locale: %s\n", + n_prnt(test_str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_str_to_uint64_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_ovflw) / sizeof(str_ovflw[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_ovflw + i; + static const uint64_t rnd_val = 2; + uint64_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_str_to_uint64_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: %" PRIu64 ", after call %" PRIu64 "). Locale: %s\n", + n_prnt(t->str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_str_to_uint64_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint64_t rnd_val = 74218431; + uint64_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_str_to_uint64_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: %" PRIu64 ", after call %" PRIu64 "). Locale: %s\n", + n_prnt(t->str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_str_to_uint64_n_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(dstrs_w_values) / sizeof(dstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint64_t rv = 1235572; /* some random value */ + size_t rs = 0; + size_t len; + const struct str_with_value * const t = dstrs_w_values + i; + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: dstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + for (len = t->num_of_digt; len <= t->str.len + 1 && !c_failed[i]; len++) + { + rs = MHD_str_to_uint64_n_(t->str.str, len, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " returned %" PRIuPTR ", while expecting %d. Locale: %s\n", + n_prnt(t->str.str), (intptr_t)len, rv, (intptr_t)rs, + (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " converted string to value %" PRIu64 ", while expecting result %" PRIu64 + ". Locale: %s\n", n_prnt(t->str.str), (intptr_t)len, rv, rv, + t->val, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->%" PRIu64 ")" + " == %" PRIuPTR "\n", n_prnt(t->str.str), (intptr_t)t->num_of_digt, + (intptr_t)t->str.len + 1, rv, rs); + } + } + return t_failed; +} + + +int check_str_to_uint64_n_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint64_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint64_t rnd_val = 98372558; + size_t rs; + size_t len; + + if (c >= '0' && c <= '9') + continue; /* skip digits */ + + for (len = 0; len <= 5; len++) + { + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint64_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_str_to_uint64_n_(test_str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: %" PRIu64 ", after call %" PRIu64 ")." + " Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, test_val, rv, get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_str_to_uint64_n_(\"%s\", 0..5, &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_str_to_uint64_n_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_ovflw) / sizeof(str_ovflw[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_ovflw + i; + static const uint64_t rnd_val = 3; + size_t len; + + for (len = t->len; len <= t->len + 1; len++) + { + uint64_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_str_to_uint64_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: %" PRIu64 ", after call %" PRIu64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, test_val, rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), (uintptr_t)t->len, + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int check_str_to_uint64_n_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint64_t rnd_val = 43255654342; + size_t len; + + for (len = 0; len <= t->len + 1; len++) + { + uint64_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_str_to_uint64_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", ->%" PRIu64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: %" PRIu64 ", after call %" PRIu64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, test_val, rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_str_to_uint64_n_(\"%s\", 0..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int check_strx_to_uint32_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint32_t rv; + size_t rs; + const struct str_with_value * const t = xdstrs_w_values + i; + + if (t->val > UINT32_MAX) + continue; /* number is too high for this function */ + + if (c_failed[i]) + continue; /* skip already failed checks */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + rv = 1458532; /* some random value */ + rs = MHD_strx_to_uint32_(t->str.str, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting %d." + " Locale: %s\n", n_prnt(t->str.str), (uint64_t)rv, (intptr_t)rs, (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") converted string to value 0x%" PRIX64 "," + " while expecting result 0x%" PRIX64 ". Locale: %s\n", n_prnt(t->str.str), (uint64_t)rv, (uint64_t)rv, + t->val, get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR "\n", + n_prnt(t->str.str), (uint64_t)rv, rs); + } + } + return t_failed; +} + + +int check_strx_to_uint32_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint32_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint32_t rnd_val = 234234; + size_t rs; + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||(c >= 'a' && c <= 'f')) + continue; /* skip xdigits */ + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint32_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_strx_to_uint32_(test_str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(test_str), (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(test_str), (uint64_t)test_val, (uint64_t)rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_strx_to_uint32_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks1 = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]); + static const size_t n_checks = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]) + + sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + static const uint32_t rnd_val = 74218431; + uint32_t test_val; + const char * str; + if (i < n_checks1) + { + const struct str_with_len * const t = strx_ovflw + i; + str = t->str; + } + else + { + const struct str_with_value * const t = xdstrs_w_values + (i - n_checks1); + if (t->val <= UINT32_MAX) + continue; /* check only strings that should overflow uint32_t */ + str = t->str.str; + } + + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint32_t rv = test_val; + + rs = MHD_strx_to_uint32_(str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(str), (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(str), (uint64_t)test_val, (uint64_t)rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(str)); + } + } + return t_failed; +} + + +int check_strx_to_uint32_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint32_t rnd_val = 74218431; + uint32_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint32_t rv = test_val; + + rs = MHD_strx_to_uint32_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(t->str), (uint64_t)test_val, (uint64_t)rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_strx_to_uint32_n_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint32_t rv = 2352932; /* some random value */ + size_t rs = 0; + size_t len; + const struct str_with_value * const t = xdstrs_w_values + i; + + if (t->val > UINT32_MAX) + continue; /* number is too high for this function */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + for (len = t->num_of_digt; len <= t->str.len + 1 && !c_failed[i]; len++) + { + rs = MHD_strx_to_uint32_n_(t->str.str, len, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting %d. Locale: %s\n", + n_prnt(t->str.str), (intptr_t)len, (uint64_t)rv, (intptr_t)rs, + (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " converted string to value 0x%" PRIX64 ", while expecting result 0x%" PRIX64 + ". Locale: %s\n", n_prnt(t->str.str), (intptr_t)len, (uint64_t)rv, (uint64_t)rv, + t->val, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->0x%" PRIX64 ")" + " == %" PRIuPTR "\n", n_prnt(t->str.str), (intptr_t)t->num_of_digt, + (intptr_t)t->str.len + 1, (uint64_t)rv, rs); + } + } + return t_failed; +} + + +int check_strx_to_uint32_n_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint32_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint32_t rnd_val = 98372558; + size_t rs; + size_t len; + + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + continue; /* skip xdigits */ + + for (len = 0; len <= 5; len++) + { + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint32_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_strx_to_uint32_n_(test_str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, (uint64_t)test_val, (uint64_t)rv, get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_strx_to_uint32_n_(\"%s\", 0..5, &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_strx_to_uint32_n_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks1 = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]); + static const size_t n_checks = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]) + + sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + static const uint32_t rnd_val = 4; + size_t len; + const char * str; + size_t min_len, max_len; + if (i < n_checks1) + { + const struct str_with_len * const t = strx_ovflw + i; + str = t->str; + min_len = t->len; + max_len = t->len + 1; + } + else + { + const struct str_with_value * const t = xdstrs_w_values + (i - n_checks1); + if (t->val <= UINT32_MAX) + continue; /* check only strings that should overflow uint32_t */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) (i - n_checks1), (unsigned int) t->num_of_digt, + (unsigned int) t->str.len); + return -1; + } + str = t->str.str; + min_len = t->num_of_digt; + max_len = t->str.len + 1; + } + + for (len = min_len; len <= max_len; len++) + { + uint32_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint32_t rv = test_val; + + rs = MHD_strx_to_uint32_n_(str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(str), (uintptr_t)len, (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", n_prnt(str), (uintptr_t)len, (uint64_t)test_val, (uint64_t)rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(str), (uintptr_t)min_len, + (uintptr_t)max_len); + } + } + return t_failed; +} + + +int check_strx_to_uint32_n_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint32_t rnd_val = 3214314212UL; + size_t len; + + for (len = 0; len <= t->len + 1; len++) + { + uint32_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint32_t rv = test_val; + + rs = MHD_strx_to_uint32_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, (uint64_t)rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, (uint64_t)test_val, (uint64_t)rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint32_n_(\"%s\", 0..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int check_strx_to_uint64_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint64_t rv; + size_t rs; + const struct str_with_value * const t = xdstrs_w_values + i; + + if (c_failed[i]) + continue; /* skip already failed checks */ + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + rv = 1458532; /* some random value */ + rs = MHD_strx_to_uint64_(t->str.str, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting %d." + " Locale: %s\n", n_prnt(t->str.str), rv, (intptr_t)rs, (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") converted string to value 0x%" PRIX64 "," + " while expecting result 0x%" PRIX64 ". Locale: %s\n", n_prnt(t->str.str), rv, rv, + t->val, get_current_locale_str()); + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR "\n", + n_prnt(t->str.str), rv, rs); + } + } + return t_failed; +} + + +int check_strx_to_uint64_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint64_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint64_t rnd_val = 234234; + size_t rs; + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + continue; /* skip xdigits */ + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint64_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_strx_to_uint64_(test_str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(test_str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(test_str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_strx_to_uint64_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = strx_ovflw + i; + static const uint64_t rnd_val = 74218431; + uint64_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_strx_to_uint64_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(t->str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_strx_to_uint64_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint64_t rnd_val = 74218431; + uint64_t test_val; + + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_strx_to_uint64_(t->str, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") returned %" PRIuPTR ", while expecting zero." + " Locale: %s\n", n_prnt(t->str), rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_(\"%s\", &ret_val) modified value of ret_val" + " (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 "). Locale: %s\n", + n_prnt(t->str), test_val, rv, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(t->str)); + } + } + return t_failed; +} + + +int check_strx_to_uint64_n_valid(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(xdstrs_w_values) / sizeof(xdstrs_w_values[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + uint64_t rv = 2352932; /* some random value */ + size_t rs = 0; + size_t len; + const struct str_with_value * const t = xdstrs_w_values + i; + + if (t->str.len < t->num_of_digt) + { + fprintf(stderr, "ERROR: xdstrs_w_values[%u] has wrong num_of_digt (%u): num_of_digt is expected" + " to be less or equal to str.len (%u).\n", + (unsigned int) i, (unsigned int) t->num_of_digt, (unsigned int) t->str.len); + return -1; + } + for (len = t->num_of_digt; len <= t->str.len + 1 && !c_failed[i]; len++) + { + rs = MHD_strx_to_uint64_n_(t->str.str, len, &rv); + if (rs != t->num_of_digt) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting %d. Locale: %s\n", + n_prnt(t->str.str), (intptr_t)len, rv, (intptr_t)rs, + (int)t->num_of_digt, get_current_locale_str()); + } + if (rv != t->val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " converted string to value 0x%" PRIX64 ", while expecting result 0x%" PRIX64 + ". Locale: %s\n", n_prnt(t->str.str), (intptr_t)len, rv, rv, + t->val, get_current_locale_str()); + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->0x%" PRIX64 ")" + " == %" PRIuPTR "\n", n_prnt(t->str.str), (intptr_t)t->num_of_digt, + (intptr_t)t->str.len + 1, rv, rs); + } + } + return t_failed; +} + + +int check_strx_to_uint64_n_all_chars(void) +{ + static const size_t n_checks = 256; /* from 0 to 255 */ + int c_failed[n_checks]; + size_t t_failed = 0; + size_t j; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + unsigned int c; + uint64_t test_val; + + set_test_locale(j); /* setlocale() can be slow! */ + for(c = 0; c < n_checks; c++) + { + static const uint64_t rnd_val = 98372558; + size_t rs; + size_t len; + + if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + continue; /* skip xdigits */ + + for (len = 0; len <= 5; len++) + { + for(test_val = 0; test_val <= rnd_val&& !c_failed[c]; test_val += rnd_val) + { + char test_str[] = "0123"; + uint64_t rv = test_val; + + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + rs = MHD_strx_to_uint64_n_(test_str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[c] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", + n_prnt(test_str), (uintptr_t)len, test_val, rv, get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[c]) + { + char test_str[] = "0123"; + test_str[0] = (char) (unsigned char)c; /* replace first char with non-digit char */ + + printf("PASSED: MHD_strx_to_uint64_n_(\"%s\", 0..5, &ret_val) == 0, value of ret_val is unmodified\n", + n_prnt(test_str)); + } + } + } + return t_failed; +} + + +int check_strx_to_uint64_n_overflow(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(strx_ovflw) / sizeof(strx_ovflw[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = strx_ovflw + i; + static const uint64_t rnd_val = 4; + size_t len; + + for (len = t->len; len <= t->len + 1; len++) + { + uint64_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_strx_to_uint64_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, test_val, rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), (uintptr_t)t->len, + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int check_strx_to_uint64_n_no_val(void) +{ + size_t t_failed = 0; + size_t i, j; + static const size_t n_checks = sizeof(str_no_num) / sizeof(str_no_num[0]); + int c_failed[n_checks]; + + memset(c_failed, 0, sizeof(c_failed)); + + for(j = 0; j < locale_name_count; j++) + { + set_test_locale(j); /* setlocale() can be slow! */ + for(i = 0; i < n_checks; i++) + { + size_t rs; + const struct str_with_len * const t = str_no_num + i; + static const uint64_t rnd_val = 3214314212UL; + size_t len; + + for (len = 0; len <= t->len + 1; len++) + { + uint64_t test_val; + for(test_val = 0; test_val <= rnd_val && !c_failed[i]; test_val += rnd_val) + { + uint64_t rv = test_val; + + rs = MHD_strx_to_uint64_n_(t->str, len, &rv); + if (rs != 0) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", ->0x%" PRIX64 ")" + " returned %" PRIuPTR ", while expecting zero. Locale: %s\n", + n_prnt(t->str), (uintptr_t)len, rv, (uintptr_t)rs, get_current_locale_str()); + } + else if (rv != test_val) + { + t_failed++; + c_failed[i] = !0; + fprintf(stderr, "FAILED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR ", &ret_val)" + " modified value of ret_val (before call: 0x%" PRIX64 ", after call 0x%" PRIX64 ")." + " Locale: %s\n", n_prnt(t->str), (uintptr_t)len, test_val, rv, + get_current_locale_str()); + } + } + } + if (verbose > 1 && j == locale_name_count - 1 && !c_failed[i]) + printf("PASSED: MHD_strx_to_uint64_n_(\"%s\", 0..%" PRIuPTR ", &ret_val) == 0," + " value of ret_val is unmodified\n", n_prnt(t->str), + (uintptr_t)t->len + 1); + } + } + return t_failed; +} + + +int run_str_to_X_tests(void) +{ + int str_to_uint64_fails = 0; + int str_to_uint64_n_fails = 0; + int strx_to_uint32_fails = 0; + int strx_to_uint32_n_fails = 0; + int strx_to_uint64_fails = 0; + int strx_to_uint64_n_fails = 0; + int res; + + res = check_str_to_uint64_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_valid().\n"); + return 99; + } + str_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_valid() successfully passed.\n\n"); + + res = check_str_to_uint64_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_all_chars().\n"); + return 99; + } + str_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_all_chars() successfully passed.\n\n"); + + res = check_str_to_uint64_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_overflow().\n"); + return 99; + } + str_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_overflow() successfully passed.\n\n"); + + res = check_str_to_uint64_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_no_val().\n"); + return 99; + } + str_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_no_val() successfully passed.\n\n"); + + if (str_to_uint64_fails) + fprintf(stderr, "FAILED: function MHD_str_to_uint64_() failed %d time%s.\n\n", + str_to_uint64_fails, str_to_uint64_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_str_to_uint64_() successfully passed all checks.\n\n"); + + res = check_str_to_uint64_n_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_n_valid().\n"); + return 99; + } + str_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_n_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_n_valid() successfully passed.\n\n"); + + res = check_str_to_uint64_n_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_n_all_chars().\n"); + return 99; + } + str_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_n_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_n_all_chars() successfully passed.\n\n"); + + res = check_str_to_uint64_n_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_n_overflow().\n"); + return 99; + } + str_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_n_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_n_overflow() successfully passed.\n\n"); + + res = check_str_to_uint64_n_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_str_to_uint64_n_no_val().\n"); + return 99; + } + str_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_str_to_uint64_n_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_str_to_uint64_n_no_val() successfully passed.\n\n"); + + if (str_to_uint64_n_fails) + fprintf(stderr, "FAILED: function MHD_str_to_uint64_n_() failed %d time%s.\n\n", + str_to_uint64_n_fails, str_to_uint64_n_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_str_to_uint64_n_() successfully passed all checks.\n\n"); + + res = check_strx_to_uint32_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_valid().\n"); + return 99; + } + strx_to_uint32_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_valid() successfully passed.\n\n"); + + res = check_strx_to_uint32_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_all_chars().\n"); + return 99; + } + strx_to_uint32_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_all_chars() successfully passed.\n\n"); + + res = check_strx_to_uint32_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_overflow().\n"); + return 99; + } + strx_to_uint32_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_overflow() successfully passed.\n\n"); + + res = check_strx_to_uint32_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_no_val().\n"); + return 99; + } + strx_to_uint32_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_no_val() successfully passed.\n\n"); + + if (strx_to_uint32_fails) + fprintf(stderr, "FAILED: function MHD_strx_to_uint32_() failed %d time%s.\n\n", + strx_to_uint32_fails, strx_to_uint32_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_strx_to_uint32_() successfully passed all checks.\n\n"); + + res = check_strx_to_uint32_n_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_n_valid().\n"); + return 99; + } + strx_to_uint32_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_n_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_n_valid() successfully passed.\n\n"); + + res = check_strx_to_uint32_n_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_n_all_chars().\n"); + return 99; + } + strx_to_uint32_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_n_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_n_all_chars() successfully passed.\n\n"); + + res = check_strx_to_uint32_n_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_n_overflow().\n"); + return 99; + } + strx_to_uint32_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_n_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_n_overflow() successfully passed.\n\n"); + + res = check_strx_to_uint32_n_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint32_n_no_val().\n"); + return 99; + } + strx_to_uint32_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint32_n_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint32_n_no_val() successfully passed.\n\n"); + + if (strx_to_uint32_n_fails) + fprintf(stderr, "FAILED: function MHD_strx_to_uint32_n_() failed %d time%s.\n\n", + strx_to_uint32_n_fails, strx_to_uint32_n_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_strx_to_uint32_n_() successfully passed all checks.\n\n"); + + res = check_strx_to_uint64_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_valid().\n"); + return 99; + } + strx_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_valid() successfully passed.\n\n"); + + res = check_strx_to_uint64_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_all_chars().\n"); + return 99; + } + strx_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_all_chars() successfully passed.\n\n"); + + res = check_strx_to_uint64_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_overflow().\n"); + return 99; + } + strx_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_overflow() successfully passed.\n\n"); + + res = check_strx_to_uint64_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_no_val().\n"); + return 99; + } + strx_to_uint64_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_no_val() successfully passed.\n\n"); + + if (strx_to_uint64_fails) + fprintf(stderr, "FAILED: function MHD_strx_to_uint64_() failed %d time%s.\n\n", + strx_to_uint64_fails, strx_to_uint64_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_strx_to_uint64_() successfully passed all checks.\n\n"); + + res = check_strx_to_uint64_n_valid(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_n_valid().\n"); + return 99; + } + strx_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_n_valid() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_n_valid() successfully passed.\n\n"); + + res = check_strx_to_uint64_n_all_chars(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_n_all_chars().\n"); + return 99; + } + strx_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_n_all_chars() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_n_all_chars() successfully passed.\n\n"); + + res = check_strx_to_uint64_n_overflow(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_n_overflow().\n"); + return 99; + } + strx_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_n_overflow() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_n_overflow() successfully passed.\n\n"); + + res = check_strx_to_uint64_n_no_val(); + if (res != 0) + { + if (res < 0) + { + fprintf(stderr, "ERROR: test internal error in check_strx_to_uint64_n_no_val().\n"); + return 99; + } + strx_to_uint64_n_fails += res; + fprintf(stderr, "FAILED: testcase check_strx_to_uint64_n_no_val() failed.\n\n"); + } + else if (verbose > 1) + printf("PASSED: testcase check_strx_to_uint64_n_no_val() successfully passed.\n\n"); + + if (strx_to_uint64_n_fails) + fprintf(stderr, "FAILED: function MHD_strx_to_uint64_n_() failed %d time%s.\n\n", + strx_to_uint64_n_fails, strx_to_uint64_n_fails == 1 ? "" : "s"); + else if (verbose > 0) + printf("PASSED: function MHD_strx_to_uint64_n_() successfully passed all checks.\n\n"); + + if (str_to_uint64_fails || str_to_uint64_n_fails || + strx_to_uint32_fails || strx_to_uint32_n_fails || + strx_to_uint64_fails || strx_to_uint64_n_fails) + { + if (verbose > 0) + printf("At least one test failed.\n"); + + return 1; + } + + if (verbose > 0) + printf("All tests passed successfully.\n"); + + return 0; +} + + +int main(int argc, char * argv[]) +{ + if (has_param(argc, argv, "-v") || has_param(argc, argv, "--verbose") || has_param(argc, argv, "--verbose1")) + verbose = 1; + if (has_param(argc, argv, "-vv") || has_param(argc, argv, "--verbose2")) + verbose = 2; + if (has_param(argc, argv, "-vvv") || has_param(argc, argv, "--verbose3")) + verbose = 3; + + if (has_in_name(argv[0], "_to_value")) + return run_str_to_X_tests(); + + return run_eq_neq_str_tests(); +} diff --git a/src/microhttpd/test_str_token.c b/src/microhttpd/test_str_token.c new file mode 100644 index 0000000..15f3f40 --- /dev/null +++ b/src/microhttpd/test_str_token.c @@ -0,0 +1,118 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2017 Karlson2k (Evgeny Grin) + + This test tool 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 test tool 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/** + * @file microhttpd/test_str_token.c + * @brief Unit tests for some mhd_str functions + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_options.h" +#include +#include "mhd_str.h" + + +static int +expect_found_n(const char *str, const char *token, size_t token_len) +{ + if (!MHD_str_has_token_caseless_(str, token, token_len)) + { + fprintf(stderr, "MHD_str_has_token_caseless_() FAILED:\n\tMHD_str_has_token_caseless_(%s, %s, %lu) return false\n", + str, token, (unsigned long) token_len); + return 1; + } + return 0; +} + +#define expect_found(s,t) expect_found_n((s),(t),MHD_STATICSTR_LEN_(t)) + +static int +expect_not_found_n(const char *str, const char *token, size_t token_len) +{ + if (MHD_str_has_token_caseless_(str, token, token_len)) + { + fprintf(stderr, "MHD_str_has_token_caseless_() FAILED:\n\tMHD_str_has_token_caseless_(%s, %s, %lu) return true\n", + str, token, (unsigned long) token_len); + return 1; + } + return 0; +} + +#define expect_not_found(s,t) expect_not_found_n((s),(t),MHD_STATICSTR_LEN_(t)) + +int check_match(void) +{ + int errcount = 0; + errcount += expect_found("string", "string"); + errcount += expect_found("String", "string"); + errcount += expect_found("string", "String"); + errcount += expect_found("strinG", "String"); + errcount += expect_found("\t strinG", "String"); + errcount += expect_found("strinG\t ", "String"); + errcount += expect_found(" \t tOkEn ", "toKEN"); + errcount += expect_found("not token\t, tOkEn ", "toKEN"); + errcount += expect_found("not token,\t tOkEn, more token", "toKEN"); + errcount += expect_found("not token,\t tOkEn\t, more token", "toKEN"); + errcount += expect_found(",,,,,,test,,,,", "TESt"); + errcount += expect_found(",,,,,\t,test,,,,", "TESt"); + errcount += expect_found(",,,,,,test, ,,,", "TESt"); + errcount += expect_found(",,,,,, test,,,,", "TESt"); + errcount += expect_found(",,,,,, test not,test,,", "TESt"); + errcount += expect_found(",,,,,, test not,,test,,", "TESt"); + errcount += expect_found(",,,,,, test not ,test,,", "TESt"); + errcount += expect_found(",,,,,, test", "TESt"); + errcount += expect_found(",,,,,, test ", "TESt"); + errcount += expect_found("no test,,,,,, test ", "TESt"); + return errcount; +} + +int check_not_match(void) +{ + int errcount = 0; + errcount += expect_not_found("strin", "string"); + errcount += expect_not_found("Stringer", "string"); + errcount += expect_not_found("sstring", "String"); + errcount += expect_not_found("string", "Strin"); + errcount += expect_not_found("\t( strinG", "String"); + errcount += expect_not_found(")strinG\t ", "String"); + errcount += expect_not_found(" \t tOkEn t ", "toKEN"); + errcount += expect_not_found("not token\t, tOkEner ", "toKEN"); + errcount += expect_not_found("not token,\t tOkEns, more token", "toKEN"); + errcount += expect_not_found("not token,\t tOkEns\t, more token", "toKEN"); + errcount += expect_not_found(",,,,,,testing,,,,", "TESt"); + errcount += expect_not_found(",,,,,\t,test,,,,", "TESting"); + errcount += expect_not_found("tests,,,,,,quest, ,,,", "TESt"); + errcount += expect_not_found(",,,,,, testы,,,,", "TESt"); + errcount += expect_not_found(",,,,,, test not,хtest,,", "TESt"); + errcount += expect_not_found("testing,,,,,, test not,,test2,,", "TESt"); + errcount += expect_not_found(",testi,,,,, test not ,test,,", "TESting"); + errcount += expect_not_found(",,,,,,2 test", "TESt"); + errcount += expect_not_found(",,,,,,test test ", "test"); + errcount += expect_not_found("no test,,,,,, test test", "test"); + return errcount; +} + +int main(int argc, char * argv[]) +{ + int errcount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + errcount += check_match(); + errcount += check_not_match(); + return errcount == 0 ? 0 : 1; +} diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c new file mode 100644 index 0000000..db2efe3 --- /dev/null +++ b/src/microhttpd/test_upgrade.c @@ -0,0 +1,1272 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Christian Grothoff + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_upgrade.c + * @brief Testcase for libmicrohttpd upgrading a connection + * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) + */ + +#include "mhd_options.h" +#include +#include +#include +#include +#include +#include +#ifndef WINDOWS +#include +#endif +#ifdef HAVE_STDBOOL_H +#include +#endif /* HAVE_STDBOOL_H */ + +#include "mhd_sockets.h" +#ifdef HAVE_NETINET_IP_H +#include +#endif /* HAVE_NETINET_IP_H */ + +#include "platform.h" +#include "microhttpd.h" + +#include "test_helpers.h" + +#ifdef HTTPS_SUPPORT +#include +#include "../testcurl/https/tls_test_keys.h" + +#if defined(HAVE_FORK) && defined(HAVE_WAITPID) +#include +#include +#endif /* HAVE_FORK && HAVE_WAITPID */ +#endif /* HTTPS_SUPPORT */ + +static int verbose = 0; + +enum tls_tool +{ + TLS_CLI_NO_TOOL = 0, + TLS_CLI_GNUTLS, + TLS_CLI_OPENSSL, + TLS_LIB_GNUTLS +}; + +enum tls_tool use_tls_tool; + +#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) +/** + * Fork child that connects via GnuTLS-CLI to our @a port. Allows us to + * talk to our port over a socket in @a sp without having to worry + * about TLS. + * + * @param location where the socket is returned + * @return -1 on error, otherwise PID of TLS child process + */ +static pid_t +gnutlscli_connect (int *sock, + uint16_t port) +{ + pid_t chld; + int sp[2]; + char destination[30]; + + if (0 != socketpair (AF_UNIX, + SOCK_STREAM, + 0, + sp)) + return -1; + chld = fork (); + if (0 != chld) + { + *sock = sp[1]; + MHD_socket_close_chk_ (sp[0]); + return chld; + } + MHD_socket_close_chk_ (sp[1]); + (void) close (0); + (void) close (1); + dup2 (sp[0], 0); + dup2 (sp[0], 1); + MHD_socket_close_chk_ (sp[0]); + if (TLS_CLI_GNUTLS == use_tls_tool) + { + snprintf (destination, + sizeof(destination), + "%u", + (unsigned int) port); + execlp ("gnutls-cli", + "gnutls-cli", + "--insecure", + "-p", + destination, + "127.0.0.1", + (char *) NULL); + } + else if (TLS_CLI_OPENSSL == use_tls_tool) + { + snprintf (destination, + sizeof(destination), + "127.0.0.1:%u", + (unsigned int) port); + execlp ("openssl", + "openssl", + "s_client", + "-connect", + destination, + "-verify", + "1", + (char *) NULL); + } + _exit (1); +} +#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ + + +/** + * Wrapper structure for plain&TLS sockets + */ +struct wr_socket_strc +{ + /** + * Real network socket + */ + MHD_socket fd; + + /** + * Type of this socket + */ + enum wr_type + { + wr_invalid = 0, + wr_plain = 1, + wr_tls = 2 + } t; +#ifdef HTTPS_SUPPORT + /** + * TLS credentials + */ + gnutls_certificate_credentials_t tls_crd; + + /** + * TLS session. + */ + gnutls_session_t tls_s; + + /** + * TLS handshake already succeed? + */ + bool tls_connected; +#endif +}; + + +/** + * Pseudo type for plain&TLS sockets + */ +typedef struct wr_socket_strc* wr_socket; + + +/** + * Invalid value of wr_socket + */ +#define WR_BAD (NULL) + + +/** + * Get underlying real socket. + * @return FD of real socket + */ +#define wr_fd(s) ((s)->fd) + + +/** + * Create wr_socket with plain TCP underlying socket + * @return created socket on success, WR_BAD otherwise + */ +static wr_socket +wr_create_plain_sckt(void) +{ + wr_socket s = (wr_socket)malloc(sizeof(struct wr_socket_strc)); + if (WR_BAD == s) + return WR_BAD; + s->t = wr_plain; + s->fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (MHD_INVALID_SOCKET != s->fd) + return s; + free(s); + return WR_BAD; +} + + +/** + * Create wr_socket with TLS TCP underlying socket + * @return created socket on success, WR_BAD otherwise + */ +static wr_socket +wr_create_tls_sckt(void) +{ +#ifdef HTTPS_SUPPORT + wr_socket s = (wr_socket)malloc(sizeof(struct wr_socket_strc)); + if (WR_BAD == s) + return WR_BAD; + s->t = wr_tls; + s->tls_connected = 0; + s->fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (MHD_INVALID_SOCKET != s->fd) + { + if (GNUTLS_E_SUCCESS == gnutls_init (&(s->tls_s), GNUTLS_CLIENT)) + { + if (GNUTLS_E_SUCCESS == gnutls_set_default_priority (s->tls_s)) + { + if (GNUTLS_E_SUCCESS == gnutls_certificate_allocate_credentials (&(s->tls_crd))) + { + if (GNUTLS_E_SUCCESS == gnutls_credentials_set (s->tls_s, GNUTLS_CRD_CERTIFICATE, s->tls_crd)) + { +#if GNUTLS_VERSION_NUMBER+0 >= 0x030109 + gnutls_transport_set_int (s->tls_s, (int)(s->fd)); +#else /* GnuTLS before 3.1.9 */ + gnutls_transport_set_ptr (s->tls_s, (gnutls_transport_ptr_t)(intptr_t)(s->fd)); +#endif /* GnuTLS before 3.1.9 */ + return s; + } + gnutls_certificate_free_credentials (s->tls_crd); + } + } + gnutls_deinit (s->tls_s); + } + (void)MHD_socket_close_ (s->fd); + } + free(s); +#endif /* HTTPS_SUPPORT */ + return WR_BAD; +} + + +/** + * Create wr_socket with plain TCP underlying socket + * from already created TCP socket. + * @param plain_sk real TCP socket + * @return created socket on success, WR_BAD otherwise + */ +static wr_socket +wr_create_from_plain_sckt(MHD_socket plain_sk) +{ + wr_socket s = (wr_socket)malloc(sizeof(struct wr_socket_strc)); + + if (WR_BAD == s) + return WR_BAD; + s->t = wr_plain; + s->fd = plain_sk; + return s; +} + + +/** + * Connect socket to specified address. + * @param s socket to use + * @param addr address to connect + * @param length of sturcture pointed by @a addr + * @return zero on success, -1 otherwise. + */ +static int +wr_connect(wr_socket s, + const struct sockaddr *addr, + int length) +{ + if (0 != connect (s->fd, addr, length)) + return -1; + if (wr_plain == s->t) + return 0; +#ifdef HTTPS_SUPPORT + if (wr_tls == s->t) + { + /* Do not try handshake here as + * it require processing on MHD side and + * when testing with "external" polling, + * test will call MHD processing only + * after return from wr_connect(). */ + s->tls_connected = 0; + return 0; + } +#endif /* HTTPS_SUPPORT */ + return -1; +} + +#ifdef HTTPS_SUPPORT +/* Only to be called from wr_send() and wr_recv() ! */ +static bool wr_handshake(wr_socket s) +{ + int res = gnutls_handshake (s->tls_s); + if (GNUTLS_E_SUCCESS == res) + s->tls_connected = true; + else if (GNUTLS_E_AGAIN == res) + MHD_socket_set_error_ (MHD_SCKT_EAGAIN_); + else + MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ + return s->tls_connected; +} +#endif /* HTTPS_SUPPORT */ + + +/** + * Send data to remote by socket. + * @param s the socket to use + * @param buf the buffer with data to send + * @param len the length of data in @a buf + * @return number of bytes were sent if succeed, + * -1 if failed. Use #MHD_socket_get_error_() + * to get socket error. + */ +static ssize_t +wr_send (wr_socket s, + const void *buf, + size_t len) +{ + if (wr_plain == s->t) + return MHD_send_(s->fd, buf, len); +#ifdef HTTPS_SUPPORT + if (wr_tls == s->t) + { + ssize_t ret; + if (!s->tls_connected && !wr_handshake (s)) + return -1; + + ret = gnutls_record_send (s->tls_s, buf, len); + if (ret > 0) + return ret; + if (GNUTLS_E_AGAIN == ret) + MHD_socket_set_error_ (MHD_SCKT_EAGAIN_); + else + MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ + } +#endif /* HTTPS_SUPPORT */ + return -1; +} + + +/** + * Receive data from remote by socket. + * @param s the socket to use + * @param buf the buffer to store received data + * @param len the length of @a buf + * @return number of bytes were received if succeed, + * -1 if failed. Use #MHD_socket_get_error_() + * to get socket error. + */ +static ssize_t +wr_recv (wr_socket s, + void *buf, + size_t len) +{ + if (wr_plain == s->t) + return MHD_recv_ (s->fd, buf, len); +#ifdef HTTPS_SUPPORT + if (wr_tls == s->t) + { + ssize_t ret; + if (!s->tls_connected && !wr_handshake (s)) + return -1; + + ret = gnutls_record_recv (s->tls_s, buf, len); + if (ret > 0) + return ret; + if (GNUTLS_E_AGAIN == ret) + MHD_socket_set_error_ (MHD_SCKT_EAGAIN_); + else + MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ + } +#endif /* HTTPS_SUPPORT */ + return -1; +} + + +/** + * Close socket and release allocated resourced + * @param s the socket to close + * @return zero on succeed, -1 otherwise + */ +static int +wr_close (wr_socket s) +{ + int ret = (MHD_socket_close_(s->fd)) ? 0 : -1; +#ifdef HTTPS_SUPPORT + if (wr_tls == s->t) + { + gnutls_deinit (s->tls_s); + gnutls_certificate_free_credentials (s->tls_crd); + } +#endif /* HTTPS_SUPPORT */ + free(s); + return ret; +} + + +/** + * Thread we use to run the interaction with the upgraded socket. + */ +static pthread_t pt; + +/** + * Will be set to the upgraded socket. + */ +static wr_socket usock; + +/** + * Thread we use to run the interaction with the upgraded socket. + */ +static pthread_t pt_client; + +/** + * Flag set to 1 once the test is finished. + */ +static volatile bool done; + + +static void +notify_completed_cb (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + (void)cls; (void)connection; /* Unused. Silent compiler warning. */ + if ( (toe != MHD_REQUEST_TERMINATED_COMPLETED_OK) && + (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && + (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) + abort (); + if (! pthread_equal (**((pthread_t**)con_cls), pthread_self ())) + abort (); + free (*con_cls); + *con_cls = NULL; +} + + +/** + * Logging callback. + * + * @param cls logging closure (NULL) + * @param uri access URI + * @param connection connection handle + * @return #TEST_PTR + */ +static void * +log_cb (void *cls, + const char *uri, + struct MHD_Connection *connection) +{ + pthread_t* ppth; + (void)cls; (void)connection; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (uri, + "/")) + abort (); + ppth = (pthread_t*) malloc (sizeof(pthread_t)); + if (NULL == ppth) + abort(); + *ppth = pthread_self (); + return (void *) ppth; +} + + +/** + * Function to check that MHD properly notifies about starting + * and stopping. + * + * @param cls client-defined closure + * @param connection connection handle + * @param socket_context socket-specific pointer where the + * client can associate some state specific + * to the TCP connection; note that this is + * different from the "con_cls" which is per + * HTTP request. The client can initialize + * during #MHD_CONNECTION_NOTIFY_STARTED and + * cleanup during #MHD_CONNECTION_NOTIFY_CLOSED + * and access in the meantime using + * #MHD_CONNECTION_INFO_SOCKET_CONTEXT. + * @param toe reason for connection notification + * @see #MHD_OPTION_NOTIFY_CONNECTION + * @ingroup request + */ +static void +notify_connection_cb (void *cls, + struct MHD_Connection *connection, + void **socket_context, + enum MHD_ConnectionNotificationCode toe) +{ + static int started; + (void)cls; (void)connection; /* Unused. Silent compiler warning. */ + + switch (toe) + { + case MHD_CONNECTION_NOTIFY_STARTED: + if (MHD_NO != started) + abort (); + started = MHD_YES; + *socket_context = &started; + break; + case MHD_CONNECTION_NOTIFY_CLOSED: + if (MHD_YES != started) + abort (); + if (&started != *socket_context) + abort (); + *socket_context = NULL; + started = MHD_NO; + break; + } +} + + +/** + * Change socket to blocking. + * + * @param fd the socket to manipulate + * @return non-zero if succeeded, zero otherwise + */ +static void +make_blocking (MHD_socket fd) +{ +#if defined(MHD_POSIX_SOCKETS) + int flags; + + flags = fcntl (fd, F_GETFL); + if (-1 == flags) + return; + if ((flags & ~O_NONBLOCK) != flags) + if (-1 == fcntl (fd, F_SETFL, flags & ~O_NONBLOCK)) + abort (); +#elif defined(MHD_WINSOCK_SOCKETS) + unsigned long flags = 1; + + ioctlsocket (fd, FIONBIO, &flags); +#endif /* MHD_WINSOCK_SOCKETS */ + +} + + +static void +send_all (wr_socket sock, + const char *text) +{ + size_t len = strlen (text); + ssize_t ret; + size_t off; + + make_blocking (wr_fd (sock)); + for (off = 0; off < len; off += ret) + { + ret = wr_send (sock, + &text[off], + len - off); + if (0 > ret) + { + if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) + { + ret = 0; + continue; + } + abort (); + } + } +} + + +/** + * Read character-by-character until we + * get '\r\n\r\n'. + */ +static void +recv_hdr (wr_socket sock) +{ + unsigned int i; + char next; + char c; + ssize_t ret; + + make_blocking (wr_fd (sock)); + next = '\r'; + i = 0; + while (i < 4) + { + ret = wr_recv (sock, + &c, + 1); + if (0 > ret) + { + if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) + continue; + abort (); + } + if (0 == ret) + continue; + if (c == next) + { + i++; + if (next == '\r') + next = '\n'; + else + next = '\r'; + continue; + } + if (c == '\r') + { + i = 1; + next = '\n'; + continue; + } + i = 0; + next = '\r'; + } +} + + +static void +recv_all (wr_socket sock, + const char *text) +{ + size_t len = strlen (text); + char buf[len]; + ssize_t ret; + size_t off; + + make_blocking (wr_fd (sock)); + for (off = 0; off < len; off += ret) + { + ret = wr_recv (sock, + &buf[off], + len - off); + if (0 > ret) + { + if (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) + { + ret = 0; + continue; + } + abort (); + } + } + if (0 != strncmp (text, buf, len)) + abort(); +} + + +/** + * Main function for the thread that runs the interaction with + * the upgraded socket. + * + * @param cls the handle for the upgrade + */ +static void * +run_usock (void *cls) +{ + struct MHD_UpgradeResponseHandle *urh = cls; + + send_all (usock, + "Hello"); + recv_all (usock, + "World"); + send_all (usock, + "Finished"); + MHD_upgrade_action (urh, + MHD_UPGRADE_ACTION_CLOSE); + return NULL; +} + + +/** + * Main function for the thread that runs the client-side of the + * interaction with the upgraded socket. + * + * @param cls the client socket + */ +static void * +run_usock_client (void *cls) +{ + wr_socket *sock = cls; + + send_all (*sock, + "GET / HTTP/1.1\r\nConnection: Upgrade\r\n\r\n"); + recv_hdr (*sock); + recv_all (*sock, + "Hello"); + send_all (*sock, + "World"); + recv_all (*sock, + "Finished"); + wr_close (*sock); + done = true; + return NULL; +} + + +/** + * Function called after a protocol "upgrade" response was sent + * successfully and the socket should now be controlled by some + * protocol other than HTTP. + * + * Any data already received on the socket will be made available in + * @e extra_in. This can happen if the application sent extra data + * before MHD send the upgrade response. The application should + * treat data from @a extra_in as if it had read it from the socket. + * + * Note that the application must not close() @a sock directly, + * but instead use #MHD_upgrade_action() for special operations + * on @a sock. + * + * Except when in 'thread-per-connection' mode, implementations + * of this function should never block (as it will still be called + * from within the main event loop). + * + * @param cls closure, whatever was given to #MHD_create_response_for_upgrade(). + * @param connection original HTTP connection handle, + * giving the function a last chance + * to inspect the original HTTP request + * @param con_cls last value left in `con_cls` of the `MHD_AccessHandlerCallback` + * @param extra_in if we happened to have read bytes after the + * HTTP header already (because the client sent + * more than the HTTP header of the request before + * we sent the upgrade response), + * these are the extra bytes already read from @a sock + * by MHD. The application should treat these as if + * it had read them from @a sock. + * @param extra_in_size number of bytes in @a extra_in + * @param sock socket to use for bi-directional communication + * with the client. For HTTPS, this may not be a socket + * that is directly connected to the client and thus certain + * operations (TCP-specific setsockopt(), getsockopt(), etc.) + * may not work as expected (as the socket could be from a + * socketpair() or a TCP-loopback). The application is expected + * to perform read()/recv() and write()/send() calls on the socket. + * The application may also call shutdown(), but must not call + * close() directly. + * @param urh argument for #MHD_upgrade_action()s on this @a connection. + * Applications must eventually use this callback to (indirectly) + * perform the close() action on the @a sock. + */ +static void +upgrade_cb (void *cls, + struct MHD_Connection *connection, + void *con_cls, + const char *extra_in, + size_t extra_in_size, + MHD_socket sock, + struct MHD_UpgradeResponseHandle *urh) +{ + (void)cls; (void)connection; (void)con_cls; (void)extra_in; /* Unused. Silent compiler warning. */ + usock = wr_create_from_plain_sckt (sock); + if (0 != extra_in_size) + abort (); + if (0 != pthread_create (&pt, + NULL, + &run_usock, + urh)) + abort (); +} + + +/** + * A client has requested the given url using the given method + * (#MHD_HTTP_METHOD_GET, #MHD_HTTP_METHOD_PUT, + * #MHD_HTTP_METHOD_DELETE, #MHD_HTTP_METHOD_POST, etc). The callback + * must call MHD callbacks to provide content to give back to the + * client and return an HTTP status code (i.e. #MHD_HTTP_OK, + * #MHD_HTTP_NOT_FOUND, etc.). + * + * @param cls argument given together with the function + * pointer when the handler was registered with MHD + * @param url the requested url + * @param method the HTTP method used (#MHD_HTTP_METHOD_GET, + * #MHD_HTTP_METHOD_PUT, etc.) + * @param version the HTTP version string (i.e. + * #MHD_HTTP_VERSION_1_1) + * @param upload_data the data being uploaded (excluding HEADERS, + * for a POST that fits into memory and that is encoded + * with a supported encoding, the POST data will NOT be + * given in upload_data and is instead available as + * part of #MHD_get_connection_values; very large POST + * data *will* be made available incrementally in + * @a upload_data) + * @param upload_data_size set initially to the size of the + * @a upload_data provided; the method must update this + * value to the number of bytes NOT processed; + * @param con_cls pointer that the callback can set to some + * address and that will be preserved by MHD for future + * calls for this request; since the access handler may + * be called many times (i.e., for a PUT/POST operation + * with plenty of upload data) this allows the application + * to easily associate some request-specific state. + * If necessary, this state can be cleaned up in the + * global #MHD_RequestCompletedCallback (which + * can be set with the #MHD_OPTION_NOTIFY_COMPLETED). + * Initially, `*con_cls` will be NULL. + * @return #MHD_YES if the connection was handled successfully, + * #MHD_NO if the socket must be closed due to a serios + * error while handling the request + */ +static int +ahc_upgrade (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) +{ + struct MHD_Response *resp; + int ret; + (void)cls;(void)url;(void)method; /* Unused. Silent compiler warning. */ + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (NULL == *con_cls) + abort (); + if (! pthread_equal (**((pthread_t**)con_cls), pthread_self ())) + abort (); + resp = MHD_create_response_for_upgrade (&upgrade_cb, + NULL); + MHD_add_response_header (resp, + MHD_HTTP_HEADER_UPGRADE, + "Hello World Protocol"); + ret = MHD_queue_response (connection, + MHD_HTTP_SWITCHING_PROTOCOLS, + resp); + MHD_destroy_response (resp); + return ret; +} + + +/** + * Run the MHD external event loop using select. + * + * @param daemon daemon to run it for + */ +static void +run_mhd_select_loop (struct MHD_Daemon *daemon) +{ + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max_fd; + MHD_UNSIGNED_LONG_LONG to; + struct timeval tv; + + while (! done) + { + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + max_fd = -1; + to = 1000; + + if (MHD_YES != + MHD_get_fdset (daemon, + &rs, + &ws, + &es, + &max_fd)) + abort (); + (void) MHD_get_timeout (daemon, + &to); + if (1000 < to) + to = 1000; + tv.tv_sec = to / 1000; + tv.tv_usec = 1000 * (to % 1000); + if (0 > MHD_SYS_select_ (max_fd + 1, + &rs, + &ws, + &es, + &tv)) + abort (); + MHD_run_from_select (daemon, + &rs, + &ws, + &es); + } +} + +#ifdef HAVE_POLL + +/** + * Run the MHD external event loop using select. + * + * @param daemon daemon to run it for + */ +static void +run_mhd_poll_loop (struct MHD_Daemon *daemon) +{ + (void)daemon; /* Unused. Silent compiler warning. */ + abort (); /* currently not implementable with existing MHD API */ +} +#endif /* HAVE_POLL */ + + +#ifdef EPOLL_SUPPORT +/** + * Run the MHD external event loop using select. + * + * @param daemon daemon to run it for + */ +static void +run_mhd_epoll_loop (struct MHD_Daemon *daemon) +{ + const union MHD_DaemonInfo *di; + MHD_socket ep; + fd_set rs; + MHD_UNSIGNED_LONG_LONG to; + struct timeval tv; + + di = MHD_get_daemon_info (daemon, + MHD_DAEMON_INFO_EPOLL_FD); + ep = di->listen_fd; + while (! done) + { + FD_ZERO (&rs); + to = 1000; + + FD_SET (ep, &rs); + (void) MHD_get_timeout (daemon, + &to); + if (1000 < to) + to = 1000; + tv.tv_sec = to / 1000; + tv.tv_usec = 1000 * (to % 1000); + select (ep + 1, + &rs, + NULL, + NULL, + &tv); + MHD_run (daemon); + } +} +#endif /* EPOLL_SUPPORT */ + +/** + * Run the MHD external event loop using select. + * + * @param daemon daemon to run it for + */ +static void +run_mhd_loop (struct MHD_Daemon *daemon, + int flags) +{ + if (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL))) + run_mhd_select_loop (daemon); +#ifdef HAVE_POLL + else if (0 != (flags & MHD_USE_POLL)) + run_mhd_poll_loop (daemon); +#endif /* HAVE_POLL */ +#if EPOLL_SUPPORT + else if (0 != (flags & MHD_USE_EPOLL)) + run_mhd_epoll_loop (daemon); +#endif + else + abort (); +} + +static bool test_tls; + +/** + * Test upgrading a connection. + * + * @param flags which event loop style should be tested + * @param pool size of the thread pool, 0 to disable + */ +static int +test_upgrade (int flags, + unsigned int pool) +{ + struct MHD_Daemon *d = NULL; + wr_socket sock; + struct sockaddr_in sa; + const union MHD_DaemonInfo *real_flags; + const union MHD_DaemonInfo *dinfo; +#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) + pid_t pid = -1; +#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ + + done = false; + + if (!test_tls) + d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE, + MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT) ? + 0 : 1090, + NULL, NULL, + &ahc_upgrade, NULL, + MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, ¬ify_completed_cb, NULL, + MHD_OPTION_NOTIFY_CONNECTION, ¬ify_connection_cb, NULL, + MHD_OPTION_THREAD_POOL_SIZE, pool, + MHD_OPTION_END); +#ifdef HTTPS_SUPPORT + else + d = MHD_start_daemon (flags | MHD_USE_ERROR_LOG | MHD_ALLOW_UPGRADE | MHD_USE_TLS, + MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT) ? + 0 : 1090, + NULL, NULL, + &ahc_upgrade, NULL, + MHD_OPTION_URI_LOG_CALLBACK, &log_cb, NULL, + MHD_OPTION_NOTIFY_COMPLETED, ¬ify_completed_cb, NULL, + MHD_OPTION_NOTIFY_CONNECTION, ¬ify_connection_cb, NULL, + MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, + MHD_OPTION_THREAD_POOL_SIZE, pool, + MHD_OPTION_END); +#endif /* HTTPS_SUPPORT */ + if (NULL == d) + return 2; + real_flags = MHD_get_daemon_info(d, MHD_DAEMON_INFO_FLAGS); + if (NULL == real_flags) + abort (); + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + abort (); + if (!test_tls || TLS_LIB_GNUTLS == use_tls_tool) + { + sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); + if (WR_BAD == sock) + abort (); + sa.sin_family = AF_INET; + sa.sin_port = htons (dinfo->port); + sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (0 != wr_connect (sock, + (struct sockaddr *) &sa, + sizeof (sa))) + abort (); + } + else + { +#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) + MHD_socket tls_fork_sock; + if (-1 == (pid = gnutlscli_connect (&tls_fork_sock, dinfo->port))) + { + MHD_stop_daemon (d); + return 4; + } + sock = wr_create_from_plain_sckt (tls_fork_sock); + if (WR_BAD == sock) + abort (); +#else /* !HTTPS_SUPPORT || !HAVE_FORK || !HAVE_WAITPID */ + abort (); +#endif /* !HTTPS_SUPPORT || !HAVE_FORK || !HAVE_WAITPID */ + } + + if (0 != pthread_create (&pt_client, + NULL, + &run_usock_client, + &sock)) + abort (); + if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) ) + run_mhd_loop (d, real_flags->flags); + pthread_join (pt_client, + NULL); + pthread_join (pt, + NULL); +#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) + if (test_tls && TLS_LIB_GNUTLS != use_tls_tool) + waitpid (pid, NULL, 0); +#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, + char *const *argv) +{ + int error_count = 0; + int res; + + use_tls_tool = TLS_CLI_NO_TOOL; + test_tls = has_in_name(argv[0], "_tls"); + + verbose = 1; + if (has_param(argc, argv, "-q") || has_param(argc, argv, "--quiet")) + verbose = 0; + + if (test_tls) + { +#ifdef HTTPS_SUPPORT + if (has_param(argc, argv, "--use-gnutls-cli")) + use_tls_tool = TLS_CLI_GNUTLS; + else if (has_param(argc, argv, "--use-openssl")) + use_tls_tool = TLS_CLI_OPENSSL; + else if (has_param(argc, argv, "--use-gnutls-lib")) + use_tls_tool = TLS_LIB_GNUTLS; +#if defined(HAVE_FORK) && defined(HAVE_WAITPID) + else if (0 == system ("gnutls-cli --version 1> /dev/null 2> /dev/null")) + use_tls_tool = TLS_CLI_GNUTLS; + else if (0 == system ("openssl version 1> /dev/null 2> /dev/null")) + use_tls_tool = TLS_CLI_OPENSSL; +#endif /* HAVE_FORK && HAVE_WAITPID */ + else + use_tls_tool = TLS_LIB_GNUTLS; /* Should be available as MHD use it. */ + if (verbose) + { + switch (use_tls_tool) + { + case TLS_CLI_GNUTLS: + printf ("GnuTLS-CLI will be used for testing.\n"); + break; + case TLS_CLI_OPENSSL: + printf ("Command line version of OpenSSL will be used for testing.\n"); + break; + case TLS_LIB_GNUTLS: + printf ("GnuTLS library will be used for testing.\n"); + break; + default: + abort (); + } + } + if ( (TLS_LIB_GNUTLS == use_tls_tool) && + (GNUTLS_E_SUCCESS != gnutls_global_init()) ) + abort (); + +#else /* ! HTTPS_SUPPORT */ + fprintf (stderr, "HTTPS support was disabled by configure.\n"); + return 77; +#endif /* ! HTTPS_SUPPORT */ + } + + /* run tests */ + if (verbose) + printf ("Starting HTTP \"Upgrade\" tests with %s connections.\n", test_tls ? "TLS" : "plain"); + /* try external select */ + res = test_upgrade (0, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with external select, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with external select.\n"); + + /* Try external auto */ + res = test_upgrade (MHD_USE_AUTO, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with external 'auto', return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with external 'auto'.\n"); + +#ifdef EPOLL_SUPPORT + res = test_upgrade (MHD_USE_EPOLL, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with external select with EPOLL, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with external select with EPOLL.\n"); +#endif + + /* Test thread-per-connection */ + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with thread per connection, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with thread per connection.\n"); + + res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with thread per connection and 'auto', return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with thread per connection and 'auto'.\n"); +#ifdef HAVE_POLL + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with thread per connection and poll, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with thread per connection and poll.\n"); +#endif /* HAVE_POLL */ + + /* Test different event loops, with and without thread pool */ + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal select, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal select.\n"); + res = test_upgrade (MHD_USE_INTERNAL_POLLING_THREAD, + 2); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal select with thread pool, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal select with thread pool.\n"); + res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal 'auto' return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal 'auto'.\n"); + res = test_upgrade (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, + 2); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal 'auto' with thread pool, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal 'auto' with thread pool.\n"); +#ifdef HAVE_POLL + res = test_upgrade (MHD_USE_POLL_INTERNAL_THREAD, + 0); + error_count += res; + if (res) + fprintf (stderr, "FAILED: Upgrade with internal poll, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal poll.\n"); + res = test_upgrade (MHD_USE_POLL_INTERNAL_THREAD, + 2); + if (res) + fprintf (stderr, "FAILED: Upgrade with internal poll with thread pool, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal poll with thread pool.\n"); +#endif +#ifdef EPOLL_SUPPORT + res = test_upgrade (MHD_USE_EPOLL_INTERNAL_THREAD, + 0); + if (res) + fprintf (stderr, "FAILED: Upgrade with internal epoll, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal epoll.\n"); + res = test_upgrade (MHD_USE_EPOLL_INTERNAL_THREAD, + 2); + if (res) + fprintf (stderr, "FAILED: Upgrade with internal epoll, return code %d.\n", res); + else if (verbose) + printf ("PASSED: Upgrade with internal epoll.\n"); +#endif + /* report result */ + if (0 != error_count) + fprintf (stderr, + "Error (code: %u)\n", + error_count); +#ifdef HTTPS_SUPPORT + if (test_tls && (TLS_LIB_GNUTLS == use_tls_tool)) + gnutls_global_deinit(); +#endif /* HTTPS_SUPPORT */ + return error_count != 0; /* 0 == pass */ +} diff --git a/src/microhttpd/tsearch.c b/src/microhttpd/tsearch.c new file mode 100644 index 0000000..fe5fcd5 --- /dev/null +++ b/src/microhttpd/tsearch.c @@ -0,0 +1,143 @@ +/* + * Tree search generalized from Knuth (6.2.2) Algorithm T just like + * the AT&T man page says. + * + * The node_t structure is for internal use only, lint doesn't grok it. + * + * Written by reading the System V Interface Definition, not the code. + * + * Totally public domain. + */ + +#include "tsearch.h" +#include + + +typedef struct node +{ + const void *key; + struct node *llink; + struct node *rlink; +} node_t; + + +/* $NetBSD: tsearch.c,v 1.5 2005/11/29 03:12:00 christos Exp $ */ +/* find or insert datum into search tree */ +void * +tsearch (const void *vkey, /* key to be located */ + void **vrootp, /* address of tree root */ + int (*compar)(const void *, const void *)) +{ + node_t *q; + node_t **rootp = (node_t **)vrootp; + + if (NULL == rootp) + return NULL; + + while (*rootp != NULL) + { /* Knuth's T1: */ + int r; + + if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */ + return *rootp; /* we found it! */ + + rootp = (r < 0) ? + &(*rootp)->llink : /* T3: follow left branch */ + &(*rootp)->rlink; /* T4: follow right branch */ + } + + q = malloc (sizeof(node_t)); /* T5: key not found */ + if (q) + { /* make new node */ + *rootp = q; /* link new node to old */ + q->key = vkey; /* initialize new node */ + q->llink = q->rlink = NULL; + } + return q; +} + + +/* $NetBSD: tfind.c,v 1.5 2005/03/23 08:16:53 kleink Exp $ */ +/* find a node, or return NULL */ +void * +tfind (const void *vkey, /* key to be found */ + void * const *vrootp, /* address of the tree root */ + int (*compar)(const void *, const void *)) +{ + node_t * const *rootp = (node_t * const*)vrootp; + + if (NULL == rootp) + return NULL; + + while (*rootp != NULL) + { /* T1: */ + int r; + + if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */ + return *rootp; /* key found */ + rootp = (r < 0) ? + &(*rootp)->llink : /* T3: follow left branch */ + &(*rootp)->rlink; /* T4: follow right branch */ + } + return NULL; +} + + +/* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */ +/* + * delete node with given key + * + * vkey: key to be deleted + * vrootp: address of the root of the tree + * compar: function to carry out node comparisons + */ +void * +tdelete (const void * __restrict vkey, + void ** __restrict vrootp, + int (*compar)(const void *, const void *)) +{ + node_t **rootp = (node_t **)vrootp; + node_t *p; + node_t *q; + node_t *r; + int cmp; + + if (rootp == NULL || (p = *rootp) == NULL) + return NULL; + + while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) + { + p = *rootp; + rootp = (cmp < 0) ? + &(*rootp)->llink : /* follow llink branch */ + &(*rootp)->rlink; /* follow rlink branch */ + if (*rootp == NULL) + return NULL; /* key not found */ + } + r = (*rootp)->rlink; /* D1: */ + if ((q = (*rootp)->llink) == NULL) /* Left NULL? */ + { + q = r; + } + else if (r != NULL) + { /* Right link is NULL? */ + if (r->llink == NULL) + { /* D2: Find successor */ + r->llink = q; + q = r; + } + else + { /* D3: Find NULL link */ + for (q = r->llink; q->llink != NULL; q = r->llink) + r = q; + r->llink = q->rlink; + q->llink = (*rootp)->llink; + q->rlink = (*rootp)->rlink; + } + } + free(*rootp); /* D4: Free node */ + *rootp = q; /* link parent to new node */ + return p; +} + +/* end of tsearch.c */ diff --git a/src/microhttpd/tsearch.h b/src/microhttpd/tsearch.h new file mode 100644 index 0000000..aa18649 --- /dev/null +++ b/src/microhttpd/tsearch.h @@ -0,0 +1,38 @@ +/*- + * Written by J.T. Conklin + * Public domain. + * + * $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ + * $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $ + */ + +#ifndef _TSEARCH_H_ +#define _TSEARCH_H_ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + + +void * +tdelete (const void * __restrict, + void ** __restrict, + int (*)(const void *, const void *)); + + +void * +tfind (const void *, + void * const *, + int (*)(const void *, const void *)); + + +void * +tsearch (const void *, + void **, + int (*)(const void *, const void *)); + +#if defined(__cplusplus) +}; +#endif /* __cplusplus */ + +#endif /* !_TSEARCH_H_ */ diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am new file mode 100644 index 0000000..796ea9e --- /dev/null +++ b/src/testcurl/Makefile.am @@ -0,0 +1,308 @@ +# This Makefile.am is in the public domain +SUBDIRS = . + +if USE_COVERAGE + AM_CFLAGS = -fprofile-arcs -ftest-coverage +endif + +if ENABLE_HTTPS + SUBDIRS += https +endif + +AM_CPPFLAGS = \ +-DCPU_COUNT=$(CPU_COUNT) \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/microhttpd \ +-I$(top_srcdir)/src/include \ +$(LIBCURL_CPPFLAGS) + +if HAVE_CURL +check_PROGRAMS = \ + test_get \ + test_get_sendfile \ + test_urlparse \ + test_delete \ + test_put \ + test_process_headers \ + test_process_arguments \ + test_parse_cookies \ + test_large_put \ + test_get11 \ + test_get_sendfile11 \ + test_put11 \ + test_large_put11 \ + test_large_put_inc11 \ + test_long_header \ + test_long_header11 \ + test_get_chunked \ + test_put_chunked \ + test_iplimit11 \ + test_termination \ + test_timeout \ + test_callback \ + perf_get + +if HAVE_FORK_WAITPID +if HAVE_CURL_BINARY +check_PROGRAMS += test_get_response_cleanup +endif +endif + +if HAVE_POSIX_THREADS +check_PROGRAMS += \ + test_quiesce \ + test_concurrent_stop \ + perf_get_concurrent + +if HAVE_CURL_BINARY +check_PROGRAMS += test_quiesce_stream +endif +endif + +if HAVE_POSTPROCESSOR + check_PROGRAMS += \ + test_post \ + test_postform \ + test_post_loop \ + test_post11 \ + test_postform11 \ + test_post_loop11 +endif + +if ENABLE_DAUTH + check_PROGRAMS += \ + test_digestauth test_digestauth_with_arguments +endif + +TESTS = $(check_PROGRAMS) + +noinst_LIBRARIES = libcurl_version_check.a +endif + +libcurl_version_check_a_SOURCES = \ + curl_version_check.c + +test_concurrent_stop_SOURCES = \ + test_concurrent_stop.c +test_concurrent_stop_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +test_concurrent_stop_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + +test_get_SOURCES = \ + test_get.c +test_get_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_quiesce_SOURCES = \ + test_quiesce.c +test_quiesce_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +test_quiesce_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + +test_quiesce_stream_SOURCES = \ + test_quiesce_stream.c +test_quiesce_stream_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +test_quiesce_stream_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + +test_callback_SOURCES = \ + test_callback.c +test_callback_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +perf_get_SOURCES = \ + perf_get.c \ + gauger.h +perf_get_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +perf_get_concurrent_SOURCES = \ + perf_get_concurrent.c \ + gauger.h +perf_get_concurrent_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +perf_get_concurrent_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + +test_digestauth_SOURCES = \ + test_digestauth.c +test_digestauth_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_digestauth_with_arguments_SOURCES = \ + test_digestauth_with_arguments.c +test_digestauth_with_arguments_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_get_sendfile_SOURCES = \ + test_get_sendfile.c +test_get_sendfile_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_urlparse_SOURCES = \ + test_urlparse.c +test_urlparse_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get_response_cleanup_SOURCES = \ + test_get_response_cleanup.c +test_get_response_cleanup_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_get_chunked_SOURCES = \ + test_get_chunked.c +test_get_chunked_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post_SOURCES = \ + test_post.c +test_post_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_process_headers_SOURCES = \ + test_process_headers.c +test_process_headers_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_parse_cookies_SOURCES = \ + test_parse_cookies.c +test_parse_cookies_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_process_arguments_SOURCES = \ + test_process_arguments.c +test_process_arguments_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_postform_SOURCES = \ + test_postform.c +test_postform_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_post_loop_SOURCES = \ + test_post_loop.c +test_post_loop_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_delete_SOURCES = \ + test_delete.c +test_delete_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_SOURCES = \ + test_put.c +test_put_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_chunked_SOURCES = \ + test_put_chunked.c +test_put_chunked_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get11_SOURCES = \ + test_get.c +test_get11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get_sendfile11_SOURCES = \ + test_get_sendfile.c +test_get_sendfile11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post11_SOURCES = \ + test_post.c +test_post11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_postform11_SOURCES = \ + test_postform.c +test_postform11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_post_loop11_SOURCES = \ + test_post_loop.c +test_post_loop11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put11_SOURCES = \ + test_put.c +test_put11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_large_put_SOURCES = \ + test_large_put.c +test_large_put_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_large_put11_SOURCES = \ + test_large_put.c +test_large_put11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_large_put_inc11_SOURCES = \ + test_large_put.c +test_large_put_inc11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_long_header_SOURCES = \ + test_long_header.c +test_long_header_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_long_header11_SOURCES = \ + test_long_header.c +test_long_header11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_iplimit11_SOURCES = \ + test_iplimit.c +test_iplimit11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_termination_SOURCES = \ + test_termination.c +test_termination_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_timeout_SOURCES = \ + test_timeout.c +test_timeout_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ diff --git a/src/testcurl/Makefile.in b/src/testcurl/Makefile.in new file mode 100644 index 0000000..677c876 --- /dev/null +++ b/src/testcurl/Makefile.in @@ -0,0 +1,2156 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +@ENABLE_HTTPS_TRUE@am__append_1 = https +@HAVE_CURL_TRUE@check_PROGRAMS = test_get$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_get_sendfile$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_urlparse$(EXEEXT) test_delete$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_put$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_process_headers$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_process_arguments$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_parse_cookies$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_large_put$(EXEEXT) test_get11$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_get_sendfile11$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_put11$(EXEEXT) test_large_put11$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_large_put_inc11$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_long_header$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_long_header11$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_get_chunked$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_put_chunked$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_iplimit11$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_termination$(EXEEXT) \ +@HAVE_CURL_TRUE@ test_timeout$(EXEEXT) test_callback$(EXEEXT) \ +@HAVE_CURL_TRUE@ perf_get$(EXEEXT) $(am__EXEEXT_1) \ +@HAVE_CURL_TRUE@ $(am__EXEEXT_2) $(am__EXEEXT_3) \ +@HAVE_CURL_TRUE@ $(am__EXEEXT_4) $(am__EXEEXT_5) +@HAVE_CURL_BINARY_TRUE@@HAVE_CURL_TRUE@@HAVE_FORK_WAITPID_TRUE@am__append_2 = test_get_response_cleanup +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_3 = \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ test_quiesce \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ test_concurrent_stop \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ perf_get_concurrent + +@HAVE_CURL_BINARY_TRUE@@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__append_4 = test_quiesce_stream +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__append_5 = \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_postform \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post_loop \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post11 \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_postform11 \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post_loop11 + +@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@am__append_6 = \ +@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@ test_digestauth test_digestauth_with_arguments + +subdir = src/testcurl +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libcurl_version_check_a_AR = $(AR) $(ARFLAGS) +libcurl_version_check_a_LIBADD = +am_libcurl_version_check_a_OBJECTS = curl_version_check.$(OBJEXT) +libcurl_version_check_a_OBJECTS = \ + $(am_libcurl_version_check_a_OBJECTS) +@HAVE_CURL_BINARY_TRUE@@HAVE_CURL_TRUE@@HAVE_FORK_WAITPID_TRUE@am__EXEEXT_1 = test_get_response_cleanup$(EXEEXT) +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_2 = test_quiesce$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ test_concurrent_stop$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@ perf_get_concurrent$(EXEEXT) +@HAVE_CURL_BINARY_TRUE@@HAVE_CURL_TRUE@@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_3 = test_quiesce_stream$(EXEEXT) +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@am__EXEEXT_4 = \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_postform$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post_loop$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post11$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_postform11$(EXEEXT) \ +@HAVE_CURL_TRUE@@HAVE_POSTPROCESSOR_TRUE@ test_post_loop11$(EXEEXT) +@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@am__EXEEXT_5 = \ +@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@ test_digestauth$(EXEEXT) \ +@ENABLE_DAUTH_TRUE@@HAVE_CURL_TRUE@ test_digestauth_with_arguments$(EXEEXT) +am_perf_get_OBJECTS = perf_get.$(OBJEXT) +perf_get_OBJECTS = $(am_perf_get_OBJECTS) +perf_get_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am_perf_get_concurrent_OBJECTS = \ + perf_get_concurrent-perf_get_concurrent.$(OBJEXT) +perf_get_concurrent_OBJECTS = $(am_perf_get_concurrent_OBJECTS) +am__DEPENDENCIES_1 = +perf_get_concurrent_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +perf_get_concurrent_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(perf_get_concurrent_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_callback_OBJECTS = test_callback.$(OBJEXT) +test_callback_OBJECTS = $(am_test_callback_OBJECTS) +test_callback_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_concurrent_stop_OBJECTS = \ + test_concurrent_stop-test_concurrent_stop.$(OBJEXT) +test_concurrent_stop_OBJECTS = $(am_test_concurrent_stop_OBJECTS) +test_concurrent_stop_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_concurrent_stop_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_concurrent_stop_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_delete_OBJECTS = test_delete.$(OBJEXT) +test_delete_OBJECTS = $(am_test_delete_OBJECTS) +test_delete_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_digestauth_OBJECTS = test_digestauth.$(OBJEXT) +test_digestauth_OBJECTS = $(am_test_digestauth_OBJECTS) +test_digestauth_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_digestauth_with_arguments_OBJECTS = \ + test_digestauth_with_arguments.$(OBJEXT) +test_digestauth_with_arguments_OBJECTS = \ + $(am_test_digestauth_with_arguments_OBJECTS) +test_digestauth_with_arguments_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_get_OBJECTS = test_get.$(OBJEXT) +test_get_OBJECTS = $(am_test_get_OBJECTS) +test_get_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_get11_OBJECTS = test_get.$(OBJEXT) +test_get11_OBJECTS = $(am_test_get11_OBJECTS) +test_get11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_get_chunked_OBJECTS = test_get_chunked.$(OBJEXT) +test_get_chunked_OBJECTS = $(am_test_get_chunked_OBJECTS) +test_get_chunked_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_get_response_cleanup_OBJECTS = \ + test_get_response_cleanup.$(OBJEXT) +test_get_response_cleanup_OBJECTS = \ + $(am_test_get_response_cleanup_OBJECTS) +test_get_response_cleanup_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_get_sendfile_OBJECTS = test_get_sendfile.$(OBJEXT) +test_get_sendfile_OBJECTS = $(am_test_get_sendfile_OBJECTS) +test_get_sendfile_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_get_sendfile11_OBJECTS = test_get_sendfile.$(OBJEXT) +test_get_sendfile11_OBJECTS = $(am_test_get_sendfile11_OBJECTS) +test_get_sendfile11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_iplimit11_OBJECTS = test_iplimit.$(OBJEXT) +test_iplimit11_OBJECTS = $(am_test_iplimit11_OBJECTS) +test_iplimit11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_large_put_OBJECTS = test_large_put.$(OBJEXT) +test_large_put_OBJECTS = $(am_test_large_put_OBJECTS) +test_large_put_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_large_put11_OBJECTS = test_large_put.$(OBJEXT) +test_large_put11_OBJECTS = $(am_test_large_put11_OBJECTS) +test_large_put11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_large_put_inc11_OBJECTS = test_large_put.$(OBJEXT) +test_large_put_inc11_OBJECTS = $(am_test_large_put_inc11_OBJECTS) +test_large_put_inc11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_long_header_OBJECTS = test_long_header.$(OBJEXT) +test_long_header_OBJECTS = $(am_test_long_header_OBJECTS) +test_long_header_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_long_header11_OBJECTS = test_long_header.$(OBJEXT) +test_long_header11_OBJECTS = $(am_test_long_header11_OBJECTS) +test_long_header11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_parse_cookies_OBJECTS = test_parse_cookies.$(OBJEXT) +test_parse_cookies_OBJECTS = $(am_test_parse_cookies_OBJECTS) +test_parse_cookies_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_post_OBJECTS = test_post.$(OBJEXT) +test_post_OBJECTS = $(am_test_post_OBJECTS) +test_post_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_post11_OBJECTS = test_post.$(OBJEXT) +test_post11_OBJECTS = $(am_test_post11_OBJECTS) +test_post11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_post_loop_OBJECTS = test_post_loop.$(OBJEXT) +test_post_loop_OBJECTS = $(am_test_post_loop_OBJECTS) +test_post_loop_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_post_loop11_OBJECTS = test_post_loop.$(OBJEXT) +test_post_loop11_OBJECTS = $(am_test_post_loop11_OBJECTS) +test_post_loop11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_postform_OBJECTS = test_postform.$(OBJEXT) +test_postform_OBJECTS = $(am_test_postform_OBJECTS) +test_postform_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_postform11_OBJECTS = test_postform.$(OBJEXT) +test_postform11_OBJECTS = $(am_test_postform11_OBJECTS) +test_postform11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_process_arguments_OBJECTS = test_process_arguments.$(OBJEXT) +test_process_arguments_OBJECTS = $(am_test_process_arguments_OBJECTS) +test_process_arguments_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_process_headers_OBJECTS = test_process_headers.$(OBJEXT) +test_process_headers_OBJECTS = $(am_test_process_headers_OBJECTS) +test_process_headers_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_put_OBJECTS = test_put.$(OBJEXT) +test_put_OBJECTS = $(am_test_put_OBJECTS) +test_put_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_put11_OBJECTS = test_put.$(OBJEXT) +test_put11_OBJECTS = $(am_test_put11_OBJECTS) +test_put11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_put_chunked_OBJECTS = test_put_chunked.$(OBJEXT) +test_put_chunked_OBJECTS = $(am_test_put_chunked_OBJECTS) +test_put_chunked_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_quiesce_OBJECTS = test_quiesce-test_quiesce.$(OBJEXT) +test_quiesce_OBJECTS = $(am_test_quiesce_OBJECTS) +test_quiesce_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_quiesce_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_quiesce_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_quiesce_stream_OBJECTS = \ + test_quiesce_stream-test_quiesce_stream.$(OBJEXT) +test_quiesce_stream_OBJECTS = $(am_test_quiesce_stream_OBJECTS) +test_quiesce_stream_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) +test_quiesce_stream_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_quiesce_stream_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_termination_OBJECTS = test_termination.$(OBJEXT) +test_termination_OBJECTS = $(am_test_termination_OBJECTS) +test_termination_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_timeout_OBJECTS = test_timeout.$(OBJEXT) +test_timeout_OBJECTS = $(am_test_timeout_OBJECTS) +test_timeout_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_urlparse_OBJECTS = test_urlparse.$(OBJEXT) +test_urlparse_OBJECTS = $(am_test_urlparse_OBJECTS) +test_urlparse_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libcurl_version_check_a_SOURCES) $(perf_get_SOURCES) \ + $(perf_get_concurrent_SOURCES) $(test_callback_SOURCES) \ + $(test_concurrent_stop_SOURCES) $(test_delete_SOURCES) \ + $(test_digestauth_SOURCES) \ + $(test_digestauth_with_arguments_SOURCES) $(test_get_SOURCES) \ + $(test_get11_SOURCES) $(test_get_chunked_SOURCES) \ + $(test_get_response_cleanup_SOURCES) \ + $(test_get_sendfile_SOURCES) $(test_get_sendfile11_SOURCES) \ + $(test_iplimit11_SOURCES) $(test_large_put_SOURCES) \ + $(test_large_put11_SOURCES) $(test_large_put_inc11_SOURCES) \ + $(test_long_header_SOURCES) $(test_long_header11_SOURCES) \ + $(test_parse_cookies_SOURCES) $(test_post_SOURCES) \ + $(test_post11_SOURCES) $(test_post_loop_SOURCES) \ + $(test_post_loop11_SOURCES) $(test_postform_SOURCES) \ + $(test_postform11_SOURCES) $(test_process_arguments_SOURCES) \ + $(test_process_headers_SOURCES) $(test_put_SOURCES) \ + $(test_put11_SOURCES) $(test_put_chunked_SOURCES) \ + $(test_quiesce_SOURCES) $(test_quiesce_stream_SOURCES) \ + $(test_termination_SOURCES) $(test_timeout_SOURCES) \ + $(test_urlparse_SOURCES) +DIST_SOURCES = $(libcurl_version_check_a_SOURCES) $(perf_get_SOURCES) \ + $(perf_get_concurrent_SOURCES) $(test_callback_SOURCES) \ + $(test_concurrent_stop_SOURCES) $(test_delete_SOURCES) \ + $(test_digestauth_SOURCES) \ + $(test_digestauth_with_arguments_SOURCES) $(test_get_SOURCES) \ + $(test_get11_SOURCES) $(test_get_chunked_SOURCES) \ + $(test_get_response_cleanup_SOURCES) \ + $(test_get_sendfile_SOURCES) $(test_get_sendfile11_SOURCES) \ + $(test_iplimit11_SOURCES) $(test_large_put_SOURCES) \ + $(test_large_put11_SOURCES) $(test_large_put_inc11_SOURCES) \ + $(test_long_header_SOURCES) $(test_long_header11_SOURCES) \ + $(test_parse_cookies_SOURCES) $(test_post_SOURCES) \ + $(test_post11_SOURCES) $(test_post_loop_SOURCES) \ + $(test_post_loop11_SOURCES) $(test_postform_SOURCES) \ + $(test_postform11_SOURCES) $(test_process_arguments_SOURCES) \ + $(test_process_headers_SOURCES) $(test_put_SOURCES) \ + $(test_put11_SOURCES) $(test_put_chunked_SOURCES) \ + $(test_quiesce_SOURCES) $(test_quiesce_stream_SOURCES) \ + $(test_termination_SOURCES) $(test_timeout_SOURCES) \ + $(test_urlparse_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + check recheck distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DIST_SUBDIRS = . https +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +SUBDIRS = . $(am__append_1) +@USE_COVERAGE_TRUE@AM_CFLAGS = -fprofile-arcs -ftest-coverage +AM_CPPFLAGS = \ +-DCPU_COUNT=$(CPU_COUNT) \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/microhttpd \ +-I$(top_srcdir)/src/include \ +$(LIBCURL_CPPFLAGS) + +@HAVE_CURL_TRUE@TESTS = $(check_PROGRAMS) +@HAVE_CURL_TRUE@noinst_LIBRARIES = libcurl_version_check.a +libcurl_version_check_a_SOURCES = \ + curl_version_check.c + +test_concurrent_stop_SOURCES = \ + test_concurrent_stop.c + +test_concurrent_stop_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +test_concurrent_stop_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + +test_get_SOURCES = \ + test_get.c + +test_get_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_quiesce_SOURCES = \ + test_quiesce.c + +test_quiesce_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +test_quiesce_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + +test_quiesce_stream_SOURCES = \ + test_quiesce_stream.c + +test_quiesce_stream_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +test_quiesce_stream_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + +test_callback_SOURCES = \ + test_callback.c + +test_callback_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +perf_get_SOURCES = \ + perf_get.c \ + gauger.h + +perf_get_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +perf_get_concurrent_SOURCES = \ + perf_get_concurrent.c \ + gauger.h + +perf_get_concurrent_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +perf_get_concurrent_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) @LIBCURL@ + +test_digestauth_SOURCES = \ + test_digestauth.c + +test_digestauth_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_digestauth_with_arguments_SOURCES = \ + test_digestauth_with_arguments.c + +test_digestauth_with_arguments_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_get_sendfile_SOURCES = \ + test_get_sendfile.c + +test_get_sendfile_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_urlparse_SOURCES = \ + test_urlparse.c + +test_urlparse_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get_response_cleanup_SOURCES = \ + test_get_response_cleanup.c + +test_get_response_cleanup_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la + +test_get_chunked_SOURCES = \ + test_get_chunked.c + +test_get_chunked_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post_SOURCES = \ + test_post.c + +test_post_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_process_headers_SOURCES = \ + test_process_headers.c + +test_process_headers_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_parse_cookies_SOURCES = \ + test_parse_cookies.c + +test_parse_cookies_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_process_arguments_SOURCES = \ + test_process_arguments.c + +test_process_arguments_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_postform_SOURCES = \ + test_postform.c + +test_postform_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_post_loop_SOURCES = \ + test_post_loop.c + +test_post_loop_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_delete_SOURCES = \ + test_delete.c + +test_delete_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_SOURCES = \ + test_put.c + +test_put_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_chunked_SOURCES = \ + test_put_chunked.c + +test_put_chunked_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get11_SOURCES = \ + test_get.c + +test_get11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get_sendfile11_SOURCES = \ + test_get_sendfile.c + +test_get_sendfile11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post11_SOURCES = \ + test_post.c + +test_post11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_postform11_SOURCES = \ + test_postform.c + +test_postform11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_post_loop11_SOURCES = \ + test_post_loop.c + +test_post_loop11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put11_SOURCES = \ + test_put.c + +test_put11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_large_put_SOURCES = \ + test_large_put.c + +test_large_put_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_large_put11_SOURCES = \ + test_large_put.c + +test_large_put11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_large_put_inc11_SOURCES = \ + test_large_put.c + +test_large_put_inc11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_long_header_SOURCES = \ + test_long_header.c + +test_long_header_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_long_header11_SOURCES = \ + test_long_header.c + +test_long_header11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_iplimit11_SOURCES = \ + test_iplimit.c + +test_iplimit11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_termination_SOURCES = \ + test_termination.c + +test_termination_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_timeout_SOURCES = \ + test_timeout.c + +test_timeout_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/testcurl/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/testcurl/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libcurl_version_check.a: $(libcurl_version_check_a_OBJECTS) $(libcurl_version_check_a_DEPENDENCIES) $(EXTRA_libcurl_version_check_a_DEPENDENCIES) + $(AM_V_at)-rm -f libcurl_version_check.a + $(AM_V_AR)$(libcurl_version_check_a_AR) libcurl_version_check.a $(libcurl_version_check_a_OBJECTS) $(libcurl_version_check_a_LIBADD) + $(AM_V_at)$(RANLIB) libcurl_version_check.a + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +perf_get$(EXEEXT): $(perf_get_OBJECTS) $(perf_get_DEPENDENCIES) $(EXTRA_perf_get_DEPENDENCIES) + @rm -f perf_get$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(perf_get_OBJECTS) $(perf_get_LDADD) $(LIBS) + +perf_get_concurrent$(EXEEXT): $(perf_get_concurrent_OBJECTS) $(perf_get_concurrent_DEPENDENCIES) $(EXTRA_perf_get_concurrent_DEPENDENCIES) + @rm -f perf_get_concurrent$(EXEEXT) + $(AM_V_CCLD)$(perf_get_concurrent_LINK) $(perf_get_concurrent_OBJECTS) $(perf_get_concurrent_LDADD) $(LIBS) + +test_callback$(EXEEXT): $(test_callback_OBJECTS) $(test_callback_DEPENDENCIES) $(EXTRA_test_callback_DEPENDENCIES) + @rm -f test_callback$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_callback_OBJECTS) $(test_callback_LDADD) $(LIBS) + +test_concurrent_stop$(EXEEXT): $(test_concurrent_stop_OBJECTS) $(test_concurrent_stop_DEPENDENCIES) $(EXTRA_test_concurrent_stop_DEPENDENCIES) + @rm -f test_concurrent_stop$(EXEEXT) + $(AM_V_CCLD)$(test_concurrent_stop_LINK) $(test_concurrent_stop_OBJECTS) $(test_concurrent_stop_LDADD) $(LIBS) + +test_delete$(EXEEXT): $(test_delete_OBJECTS) $(test_delete_DEPENDENCIES) $(EXTRA_test_delete_DEPENDENCIES) + @rm -f test_delete$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_delete_OBJECTS) $(test_delete_LDADD) $(LIBS) + +test_digestauth$(EXEEXT): $(test_digestauth_OBJECTS) $(test_digestauth_DEPENDENCIES) $(EXTRA_test_digestauth_DEPENDENCIES) + @rm -f test_digestauth$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_digestauth_OBJECTS) $(test_digestauth_LDADD) $(LIBS) + +test_digestauth_with_arguments$(EXEEXT): $(test_digestauth_with_arguments_OBJECTS) $(test_digestauth_with_arguments_DEPENDENCIES) $(EXTRA_test_digestauth_with_arguments_DEPENDENCIES) + @rm -f test_digestauth_with_arguments$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_digestauth_with_arguments_OBJECTS) $(test_digestauth_with_arguments_LDADD) $(LIBS) + +test_get$(EXEEXT): $(test_get_OBJECTS) $(test_get_DEPENDENCIES) $(EXTRA_test_get_DEPENDENCIES) + @rm -f test_get$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get_OBJECTS) $(test_get_LDADD) $(LIBS) + +test_get11$(EXEEXT): $(test_get11_OBJECTS) $(test_get11_DEPENDENCIES) $(EXTRA_test_get11_DEPENDENCIES) + @rm -f test_get11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get11_OBJECTS) $(test_get11_LDADD) $(LIBS) + +test_get_chunked$(EXEEXT): $(test_get_chunked_OBJECTS) $(test_get_chunked_DEPENDENCIES) $(EXTRA_test_get_chunked_DEPENDENCIES) + @rm -f test_get_chunked$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get_chunked_OBJECTS) $(test_get_chunked_LDADD) $(LIBS) + +test_get_response_cleanup$(EXEEXT): $(test_get_response_cleanup_OBJECTS) $(test_get_response_cleanup_DEPENDENCIES) $(EXTRA_test_get_response_cleanup_DEPENDENCIES) + @rm -f test_get_response_cleanup$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get_response_cleanup_OBJECTS) $(test_get_response_cleanup_LDADD) $(LIBS) + +test_get_sendfile$(EXEEXT): $(test_get_sendfile_OBJECTS) $(test_get_sendfile_DEPENDENCIES) $(EXTRA_test_get_sendfile_DEPENDENCIES) + @rm -f test_get_sendfile$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get_sendfile_OBJECTS) $(test_get_sendfile_LDADD) $(LIBS) + +test_get_sendfile11$(EXEEXT): $(test_get_sendfile11_OBJECTS) $(test_get_sendfile11_DEPENDENCIES) $(EXTRA_test_get_sendfile11_DEPENDENCIES) + @rm -f test_get_sendfile11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get_sendfile11_OBJECTS) $(test_get_sendfile11_LDADD) $(LIBS) + +test_iplimit11$(EXEEXT): $(test_iplimit11_OBJECTS) $(test_iplimit11_DEPENDENCIES) $(EXTRA_test_iplimit11_DEPENDENCIES) + @rm -f test_iplimit11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_iplimit11_OBJECTS) $(test_iplimit11_LDADD) $(LIBS) + +test_large_put$(EXEEXT): $(test_large_put_OBJECTS) $(test_large_put_DEPENDENCIES) $(EXTRA_test_large_put_DEPENDENCIES) + @rm -f test_large_put$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_large_put_OBJECTS) $(test_large_put_LDADD) $(LIBS) + +test_large_put11$(EXEEXT): $(test_large_put11_OBJECTS) $(test_large_put11_DEPENDENCIES) $(EXTRA_test_large_put11_DEPENDENCIES) + @rm -f test_large_put11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_large_put11_OBJECTS) $(test_large_put11_LDADD) $(LIBS) + +test_large_put_inc11$(EXEEXT): $(test_large_put_inc11_OBJECTS) $(test_large_put_inc11_DEPENDENCIES) $(EXTRA_test_large_put_inc11_DEPENDENCIES) + @rm -f test_large_put_inc11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_large_put_inc11_OBJECTS) $(test_large_put_inc11_LDADD) $(LIBS) + +test_long_header$(EXEEXT): $(test_long_header_OBJECTS) $(test_long_header_DEPENDENCIES) $(EXTRA_test_long_header_DEPENDENCIES) + @rm -f test_long_header$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_long_header_OBJECTS) $(test_long_header_LDADD) $(LIBS) + +test_long_header11$(EXEEXT): $(test_long_header11_OBJECTS) $(test_long_header11_DEPENDENCIES) $(EXTRA_test_long_header11_DEPENDENCIES) + @rm -f test_long_header11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_long_header11_OBJECTS) $(test_long_header11_LDADD) $(LIBS) + +test_parse_cookies$(EXEEXT): $(test_parse_cookies_OBJECTS) $(test_parse_cookies_DEPENDENCIES) $(EXTRA_test_parse_cookies_DEPENDENCIES) + @rm -f test_parse_cookies$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_parse_cookies_OBJECTS) $(test_parse_cookies_LDADD) $(LIBS) + +test_post$(EXEEXT): $(test_post_OBJECTS) $(test_post_DEPENDENCIES) $(EXTRA_test_post_DEPENDENCIES) + @rm -f test_post$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_post_OBJECTS) $(test_post_LDADD) $(LIBS) + +test_post11$(EXEEXT): $(test_post11_OBJECTS) $(test_post11_DEPENDENCIES) $(EXTRA_test_post11_DEPENDENCIES) + @rm -f test_post11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_post11_OBJECTS) $(test_post11_LDADD) $(LIBS) + +test_post_loop$(EXEEXT): $(test_post_loop_OBJECTS) $(test_post_loop_DEPENDENCIES) $(EXTRA_test_post_loop_DEPENDENCIES) + @rm -f test_post_loop$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_post_loop_OBJECTS) $(test_post_loop_LDADD) $(LIBS) + +test_post_loop11$(EXEEXT): $(test_post_loop11_OBJECTS) $(test_post_loop11_DEPENDENCIES) $(EXTRA_test_post_loop11_DEPENDENCIES) + @rm -f test_post_loop11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_post_loop11_OBJECTS) $(test_post_loop11_LDADD) $(LIBS) + +test_postform$(EXEEXT): $(test_postform_OBJECTS) $(test_postform_DEPENDENCIES) $(EXTRA_test_postform_DEPENDENCIES) + @rm -f test_postform$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_postform_OBJECTS) $(test_postform_LDADD) $(LIBS) + +test_postform11$(EXEEXT): $(test_postform11_OBJECTS) $(test_postform11_DEPENDENCIES) $(EXTRA_test_postform11_DEPENDENCIES) + @rm -f test_postform11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_postform11_OBJECTS) $(test_postform11_LDADD) $(LIBS) + +test_process_arguments$(EXEEXT): $(test_process_arguments_OBJECTS) $(test_process_arguments_DEPENDENCIES) $(EXTRA_test_process_arguments_DEPENDENCIES) + @rm -f test_process_arguments$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_process_arguments_OBJECTS) $(test_process_arguments_LDADD) $(LIBS) + +test_process_headers$(EXEEXT): $(test_process_headers_OBJECTS) $(test_process_headers_DEPENDENCIES) $(EXTRA_test_process_headers_DEPENDENCIES) + @rm -f test_process_headers$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_process_headers_OBJECTS) $(test_process_headers_LDADD) $(LIBS) + +test_put$(EXEEXT): $(test_put_OBJECTS) $(test_put_DEPENDENCIES) $(EXTRA_test_put_DEPENDENCIES) + @rm -f test_put$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_put_OBJECTS) $(test_put_LDADD) $(LIBS) + +test_put11$(EXEEXT): $(test_put11_OBJECTS) $(test_put11_DEPENDENCIES) $(EXTRA_test_put11_DEPENDENCIES) + @rm -f test_put11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_put11_OBJECTS) $(test_put11_LDADD) $(LIBS) + +test_put_chunked$(EXEEXT): $(test_put_chunked_OBJECTS) $(test_put_chunked_DEPENDENCIES) $(EXTRA_test_put_chunked_DEPENDENCIES) + @rm -f test_put_chunked$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_put_chunked_OBJECTS) $(test_put_chunked_LDADD) $(LIBS) + +test_quiesce$(EXEEXT): $(test_quiesce_OBJECTS) $(test_quiesce_DEPENDENCIES) $(EXTRA_test_quiesce_DEPENDENCIES) + @rm -f test_quiesce$(EXEEXT) + $(AM_V_CCLD)$(test_quiesce_LINK) $(test_quiesce_OBJECTS) $(test_quiesce_LDADD) $(LIBS) + +test_quiesce_stream$(EXEEXT): $(test_quiesce_stream_OBJECTS) $(test_quiesce_stream_DEPENDENCIES) $(EXTRA_test_quiesce_stream_DEPENDENCIES) + @rm -f test_quiesce_stream$(EXEEXT) + $(AM_V_CCLD)$(test_quiesce_stream_LINK) $(test_quiesce_stream_OBJECTS) $(test_quiesce_stream_LDADD) $(LIBS) + +test_termination$(EXEEXT): $(test_termination_OBJECTS) $(test_termination_DEPENDENCIES) $(EXTRA_test_termination_DEPENDENCIES) + @rm -f test_termination$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_termination_OBJECTS) $(test_termination_LDADD) $(LIBS) + +test_timeout$(EXEEXT): $(test_timeout_OBJECTS) $(test_timeout_DEPENDENCIES) $(EXTRA_test_timeout_DEPENDENCIES) + @rm -f test_timeout$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_timeout_OBJECTS) $(test_timeout_LDADD) $(LIBS) + +test_urlparse$(EXEEXT): $(test_urlparse_OBJECTS) $(test_urlparse_DEPENDENCIES) $(EXTRA_test_urlparse_DEPENDENCIES) + @rm -f test_urlparse$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_urlparse_OBJECTS) $(test_urlparse_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/curl_version_check.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_get.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_callback.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_delete.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_digestauth.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_digestauth_with_arguments.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_get.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_get_chunked.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_get_response_cleanup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_get_sendfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_iplimit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_large_put.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_long_header.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_parse_cookies.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_post.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_post_loop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_postform.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_process_arguments.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_process_headers.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_put.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_put_chunked.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_quiesce-test_quiesce.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_termination.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_timeout.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_urlparse.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +perf_get_concurrent-perf_get_concurrent.o: perf_get_concurrent.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perf_get_concurrent_CFLAGS) $(CFLAGS) -MT perf_get_concurrent-perf_get_concurrent.o -MD -MP -MF $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Tpo -c -o perf_get_concurrent-perf_get_concurrent.o `test -f 'perf_get_concurrent.c' || echo '$(srcdir)/'`perf_get_concurrent.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Tpo $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='perf_get_concurrent.c' object='perf_get_concurrent-perf_get_concurrent.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perf_get_concurrent_CFLAGS) $(CFLAGS) -c -o perf_get_concurrent-perf_get_concurrent.o `test -f 'perf_get_concurrent.c' || echo '$(srcdir)/'`perf_get_concurrent.c + +perf_get_concurrent-perf_get_concurrent.obj: perf_get_concurrent.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perf_get_concurrent_CFLAGS) $(CFLAGS) -MT perf_get_concurrent-perf_get_concurrent.obj -MD -MP -MF $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Tpo -c -o perf_get_concurrent-perf_get_concurrent.obj `if test -f 'perf_get_concurrent.c'; then $(CYGPATH_W) 'perf_get_concurrent.c'; else $(CYGPATH_W) '$(srcdir)/perf_get_concurrent.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Tpo $(DEPDIR)/perf_get_concurrent-perf_get_concurrent.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='perf_get_concurrent.c' object='perf_get_concurrent-perf_get_concurrent.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perf_get_concurrent_CFLAGS) $(CFLAGS) -c -o perf_get_concurrent-perf_get_concurrent.obj `if test -f 'perf_get_concurrent.c'; then $(CYGPATH_W) 'perf_get_concurrent.c'; else $(CYGPATH_W) '$(srcdir)/perf_get_concurrent.c'; fi` + +test_concurrent_stop-test_concurrent_stop.o: test_concurrent_stop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_concurrent_stop_CFLAGS) $(CFLAGS) -MT test_concurrent_stop-test_concurrent_stop.o -MD -MP -MF $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Tpo -c -o test_concurrent_stop-test_concurrent_stop.o `test -f 'test_concurrent_stop.c' || echo '$(srcdir)/'`test_concurrent_stop.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Tpo $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_concurrent_stop.c' object='test_concurrent_stop-test_concurrent_stop.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_concurrent_stop_CFLAGS) $(CFLAGS) -c -o test_concurrent_stop-test_concurrent_stop.o `test -f 'test_concurrent_stop.c' || echo '$(srcdir)/'`test_concurrent_stop.c + +test_concurrent_stop-test_concurrent_stop.obj: test_concurrent_stop.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_concurrent_stop_CFLAGS) $(CFLAGS) -MT test_concurrent_stop-test_concurrent_stop.obj -MD -MP -MF $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Tpo -c -o test_concurrent_stop-test_concurrent_stop.obj `if test -f 'test_concurrent_stop.c'; then $(CYGPATH_W) 'test_concurrent_stop.c'; else $(CYGPATH_W) '$(srcdir)/test_concurrent_stop.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Tpo $(DEPDIR)/test_concurrent_stop-test_concurrent_stop.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_concurrent_stop.c' object='test_concurrent_stop-test_concurrent_stop.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_concurrent_stop_CFLAGS) $(CFLAGS) -c -o test_concurrent_stop-test_concurrent_stop.obj `if test -f 'test_concurrent_stop.c'; then $(CYGPATH_W) 'test_concurrent_stop.c'; else $(CYGPATH_W) '$(srcdir)/test_concurrent_stop.c'; fi` + +test_quiesce-test_quiesce.o: test_quiesce.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_CFLAGS) $(CFLAGS) -MT test_quiesce-test_quiesce.o -MD -MP -MF $(DEPDIR)/test_quiesce-test_quiesce.Tpo -c -o test_quiesce-test_quiesce.o `test -f 'test_quiesce.c' || echo '$(srcdir)/'`test_quiesce.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quiesce-test_quiesce.Tpo $(DEPDIR)/test_quiesce-test_quiesce.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_quiesce.c' object='test_quiesce-test_quiesce.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_CFLAGS) $(CFLAGS) -c -o test_quiesce-test_quiesce.o `test -f 'test_quiesce.c' || echo '$(srcdir)/'`test_quiesce.c + +test_quiesce-test_quiesce.obj: test_quiesce.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_CFLAGS) $(CFLAGS) -MT test_quiesce-test_quiesce.obj -MD -MP -MF $(DEPDIR)/test_quiesce-test_quiesce.Tpo -c -o test_quiesce-test_quiesce.obj `if test -f 'test_quiesce.c'; then $(CYGPATH_W) 'test_quiesce.c'; else $(CYGPATH_W) '$(srcdir)/test_quiesce.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quiesce-test_quiesce.Tpo $(DEPDIR)/test_quiesce-test_quiesce.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_quiesce.c' object='test_quiesce-test_quiesce.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_CFLAGS) $(CFLAGS) -c -o test_quiesce-test_quiesce.obj `if test -f 'test_quiesce.c'; then $(CYGPATH_W) 'test_quiesce.c'; else $(CYGPATH_W) '$(srcdir)/test_quiesce.c'; fi` + +test_quiesce_stream-test_quiesce_stream.o: test_quiesce_stream.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_stream_CFLAGS) $(CFLAGS) -MT test_quiesce_stream-test_quiesce_stream.o -MD -MP -MF $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Tpo -c -o test_quiesce_stream-test_quiesce_stream.o `test -f 'test_quiesce_stream.c' || echo '$(srcdir)/'`test_quiesce_stream.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Tpo $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_quiesce_stream.c' object='test_quiesce_stream-test_quiesce_stream.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_stream_CFLAGS) $(CFLAGS) -c -o test_quiesce_stream-test_quiesce_stream.o `test -f 'test_quiesce_stream.c' || echo '$(srcdir)/'`test_quiesce_stream.c + +test_quiesce_stream-test_quiesce_stream.obj: test_quiesce_stream.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_stream_CFLAGS) $(CFLAGS) -MT test_quiesce_stream-test_quiesce_stream.obj -MD -MP -MF $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Tpo -c -o test_quiesce_stream-test_quiesce_stream.obj `if test -f 'test_quiesce_stream.c'; then $(CYGPATH_W) 'test_quiesce_stream.c'; else $(CYGPATH_W) '$(srcdir)/test_quiesce_stream.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Tpo $(DEPDIR)/test_quiesce_stream-test_quiesce_stream.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_quiesce_stream.c' object='test_quiesce_stream-test_quiesce_stream.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_quiesce_stream_CFLAGS) $(CFLAGS) -c -o test_quiesce_stream-test_quiesce_stream.obj `if test -f 'test_quiesce_stream.c'; then $(CYGPATH_W) 'test_quiesce_stream.c'; else $(CYGPATH_W) '$(srcdir)/test_quiesce_stream.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test_get.log: test_get$(EXEEXT) + @p='test_get$(EXEEXT)'; \ + b='test_get'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_get_sendfile.log: test_get_sendfile$(EXEEXT) + @p='test_get_sendfile$(EXEEXT)'; \ + b='test_get_sendfile'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_urlparse.log: test_urlparse$(EXEEXT) + @p='test_urlparse$(EXEEXT)'; \ + b='test_urlparse'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_delete.log: test_delete$(EXEEXT) + @p='test_delete$(EXEEXT)'; \ + b='test_delete'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_put.log: test_put$(EXEEXT) + @p='test_put$(EXEEXT)'; \ + b='test_put'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_process_headers.log: test_process_headers$(EXEEXT) + @p='test_process_headers$(EXEEXT)'; \ + b='test_process_headers'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_process_arguments.log: test_process_arguments$(EXEEXT) + @p='test_process_arguments$(EXEEXT)'; \ + b='test_process_arguments'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_parse_cookies.log: test_parse_cookies$(EXEEXT) + @p='test_parse_cookies$(EXEEXT)'; \ + b='test_parse_cookies'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_large_put.log: test_large_put$(EXEEXT) + @p='test_large_put$(EXEEXT)'; \ + b='test_large_put'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_get11.log: test_get11$(EXEEXT) + @p='test_get11$(EXEEXT)'; \ + b='test_get11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_get_sendfile11.log: test_get_sendfile11$(EXEEXT) + @p='test_get_sendfile11$(EXEEXT)'; \ + b='test_get_sendfile11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_put11.log: test_put11$(EXEEXT) + @p='test_put11$(EXEEXT)'; \ + b='test_put11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_large_put11.log: test_large_put11$(EXEEXT) + @p='test_large_put11$(EXEEXT)'; \ + b='test_large_put11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_large_put_inc11.log: test_large_put_inc11$(EXEEXT) + @p='test_large_put_inc11$(EXEEXT)'; \ + b='test_large_put_inc11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_long_header.log: test_long_header$(EXEEXT) + @p='test_long_header$(EXEEXT)'; \ + b='test_long_header'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_long_header11.log: test_long_header11$(EXEEXT) + @p='test_long_header11$(EXEEXT)'; \ + b='test_long_header11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_get_chunked.log: test_get_chunked$(EXEEXT) + @p='test_get_chunked$(EXEEXT)'; \ + b='test_get_chunked'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_put_chunked.log: test_put_chunked$(EXEEXT) + @p='test_put_chunked$(EXEEXT)'; \ + b='test_put_chunked'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_iplimit11.log: test_iplimit11$(EXEEXT) + @p='test_iplimit11$(EXEEXT)'; \ + b='test_iplimit11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_termination.log: test_termination$(EXEEXT) + @p='test_termination$(EXEEXT)'; \ + b='test_termination'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_timeout.log: test_timeout$(EXEEXT) + @p='test_timeout$(EXEEXT)'; \ + b='test_timeout'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_callback.log: test_callback$(EXEEXT) + @p='test_callback$(EXEEXT)'; \ + b='test_callback'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +perf_get.log: perf_get$(EXEEXT) + @p='perf_get$(EXEEXT)'; \ + b='perf_get'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_get_response_cleanup.log: test_get_response_cleanup$(EXEEXT) + @p='test_get_response_cleanup$(EXEEXT)'; \ + b='test_get_response_cleanup'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_quiesce.log: test_quiesce$(EXEEXT) + @p='test_quiesce$(EXEEXT)'; \ + b='test_quiesce'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_concurrent_stop.log: test_concurrent_stop$(EXEEXT) + @p='test_concurrent_stop$(EXEEXT)'; \ + b='test_concurrent_stop'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +perf_get_concurrent.log: perf_get_concurrent$(EXEEXT) + @p='perf_get_concurrent$(EXEEXT)'; \ + b='perf_get_concurrent'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_quiesce_stream.log: test_quiesce_stream$(EXEEXT) + @p='test_quiesce_stream$(EXEEXT)'; \ + b='test_quiesce_stream'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_post.log: test_post$(EXEEXT) + @p='test_post$(EXEEXT)'; \ + b='test_post'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_postform.log: test_postform$(EXEEXT) + @p='test_postform$(EXEEXT)'; \ + b='test_postform'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_post_loop.log: test_post_loop$(EXEEXT) + @p='test_post_loop$(EXEEXT)'; \ + b='test_post_loop'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_post11.log: test_post11$(EXEEXT) + @p='test_post11$(EXEEXT)'; \ + b='test_post11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_postform11.log: test_postform11$(EXEEXT) + @p='test_postform11$(EXEEXT)'; \ + b='test_postform11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_post_loop11.log: test_post_loop11$(EXEEXT) + @p='test_post_loop11$(EXEEXT)'; \ + b='test_post_loop11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_digestauth.log: test_digestauth$(EXEEXT) + @p='test_digestauth$(EXEEXT)'; \ + b='test_digestauth'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_digestauth_with_arguments.log: test_digestauth_with_arguments$(EXEEXT) + @p='test_digestauth_with_arguments$(EXEEXT)'; \ + b='test_digestauth_with_arguments'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(LIBRARIES) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-TESTS check-am clean clean-checkPROGRAMS clean-generic \ + clean-libtool clean-noinstLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + recheck tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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: diff --git a/src/testcurl/curl_version_check.c b/src/testcurl/curl_version_check.c new file mode 100644 index 0000000..dff143f --- /dev/null +++ b/src/testcurl/curl_version_check.c @@ -0,0 +1,176 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file curl_version_check.c + * @brief verify required cURL version is available to run tests + * @author Sagie Amir + */ + +#include "MHD_config.h" +#include "platform.h" +#include + +#ifndef WINDOWS +#include +#endif + +static int +parse_version_number (const char **s) +{ + int i = 0; + char num[17]; + + while (i < 16 && ((**s >= '0') & (**s <= '9'))) + { + num[i] = **s; + (*s)++; + i++; + } + + num[i] = '\0'; + + return atoi (num); +} + +const char * +parse_version_string (const char *s, int *major, int *minor, int *micro) +{ + if (!s) + return NULL; + *major = parse_version_number (&s); + if (*s != '.') + return NULL; + s++; + *minor = parse_version_number (&s); + if (*s != '.') + return NULL; + s++; + *micro = parse_version_number (&s); + return s; +} + +#ifdef HTTPS_SUPPORT +int +curl_uses_nss_ssl() +{ + return (strstr(curl_version(), " NSS/") != NULL) ? 0 : -1; +} +#endif /* HTTPS_SUPPORT */ + +/* + * check local libcurl version matches required version + */ +int +curl_check_version (const char *req_version) +{ + const char *ver; + const char *curl_ver; +#ifdef HTTPS_SUPPORT + const char *ssl_ver; + const char *req_ssl_ver; +#endif /* HTTPS_SUPPORT */ + + int loc_major, loc_minor, loc_micro; + int rq_major, rq_minor, rq_micro; + + ver = curl_version (); +#ifdef HAVE_MESSAGES + fprintf (stderr, "curl version: %s\n", ver); +#endif + /* + * this call relies on the cURL string to be of the exact following format : + * 'libcurl/7.16.4 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/0.6.5' OR + * 'libcurl/7.18.2 GnuTLS/2.4.0 zlib/1.2.3.3 libidn/0.6.5' + */ + curl_ver = strchr (ver, '/'); + if (curl_ver == NULL) + return -1; + curl_ver++; + /* Parse version numbers */ + if ( (NULL == parse_version_string (req_version, &rq_major, &rq_minor, &rq_micro)) || + (NULL == parse_version_string (curl_ver, &loc_major, &loc_minor, &loc_micro)) ) + return -1; + + /* Compare version numbers. */ + if ((loc_major > rq_major + || (loc_major == rq_major && loc_minor > rq_minor) + || (loc_major == rq_major && loc_minor == rq_minor + && loc_micro > rq_micro) || (loc_major == rq_major + && loc_minor == rq_minor + && loc_micro == rq_micro)) == 0) + { + fprintf (stderr, + "Error: running curl test depends on local libcurl version > %s\n", + req_version); + return -1; + } + + /* + * enforce required gnutls/openssl version. + * TODO use curl version string to assert use of gnutls + */ +#ifdef HTTPS_SUPPORT + ssl_ver = strchr (curl_ver, ' '); + if (ssl_ver == NULL) + return -1; + ssl_ver++; + if (strncmp ("GnuTLS", ssl_ver, strlen ("GNUtls")) == 0) + { + ssl_ver = strchr (ssl_ver, '/'); + req_ssl_ver = MHD_REQ_CURL_GNUTLS_VERSION; + } + else if (strncmp ("OpenSSL", ssl_ver, strlen ("OpenSSL")) == 0) + { + ssl_ver = strchr (ssl_ver, '/'); + req_ssl_ver = MHD_REQ_CURL_OPENSSL_VERSION; + } + else if (strncmp ("NSS", ssl_ver, strlen ("NSS")) == 0) + { + ssl_ver = strchr (ssl_ver, '/'); + req_ssl_ver = MHD_REQ_CURL_NSS_VERSION; + } + else + { + fprintf (stderr, "Error: unrecognized curl ssl library\n"); + return -1; + } + if (ssl_ver == NULL) + return -1; + ssl_ver++; + if ( (NULL == parse_version_string (req_ssl_ver, &rq_major, &rq_minor, &rq_micro)) || + (NULL == parse_version_string (ssl_ver, &loc_major, &loc_minor, &loc_micro)) ) + return -1; + + if ((loc_major > rq_major + || (loc_major == rq_major && loc_minor > rq_minor) + || (loc_major == rq_major && loc_minor == rq_minor + && loc_micro > rq_micro) || (loc_major == rq_major + && loc_minor == rq_minor + && loc_micro == rq_micro)) == 0) + { + fprintf (stderr, + "Error: running curl test depends on local libcurl SSL version > %s\n", + req_ssl_ver); + return -1; + } +#endif /* HTTPS_SUPPORT */ + return 0; +} diff --git a/src/testcurl/gauger.h b/src/testcurl/gauger.h new file mode 100644 index 0000000..6698f5d --- /dev/null +++ b/src/testcurl/gauger.h @@ -0,0 +1,86 @@ +/** --------------------------------------------------------------------------- + * This software is in the public domain, furnished "as is", without technical + * support, and with no warranty, express or implied, as to its usefulness for + * any purpose. + * + * gauger.h + * Interface for C programs to log remotely to a gauger server + * + * Author: Bartlomiej Polot + * -------------------------------------------------------------------------*/ +#ifndef __GAUGER_H__ +#define __GAUGER_H__ + +#ifndef WINDOWS + +#include +#include +#include + +#define GAUGER(category, counter, value, unit)\ +{\ + const char * __gauger_v[10]; \ + char __gauger_s[32];\ + pid_t __gauger_p;\ + if(!(__gauger_p=fork())){\ + if(!fork()){ \ + sprintf(__gauger_s,"%Lf", (long double) (value));\ + __gauger_v[0] = "gauger";\ + __gauger_v[1] = "-n";\ + __gauger_v[2] = counter; \ + __gauger_v[3] = "-d";\ + __gauger_v[4] = __gauger_s;\ + __gauger_v[5] = "-u";\ + __gauger_v[6] = unit; \ + __gauger_v[7] = "-c";\ + __gauger_v[8] = category; \ + __gauger_v[9] = (char *)NULL;\ + execvp("gauger", (char*const*) __gauger_v); \ + _exit(1);\ + }else{\ + _exit(0);\ + }\ + }else{\ + waitpid(__gauger_p,NULL,0);\ + }\ +} + +#define GAUGER_ID(category, counter, value, unit, id)\ +{\ + char* __gauger_v[12];\ + char __gauger_s[32];\ + pid_t __gauger_p;\ + if(!(__gauger_p=fork())){\ + if(!fork()){\ + sprintf(__gauger_s,"%Lf", (long double) (value));\ + __gauger_v[0] = "gauger";\ + __gauger_v[1] = "-n";\ + __gauger_v[2] = counter;\ + __gauger_v[3] = "-d";\ + __gauger_v[4] = __gauger_s;\ + __gauger_v[5] = "-u";\ + __gauger_v[6] = unit;\ + __gauger_v[7] = "-i";\ + __gauger_v[8] = id;\ + __gauger_v[9] = "-c";\ + __gauger_v[10] = category;\ + __gauger_v[11] = (char *)NULL;\ + execvp("gauger",__gauger_v);\ + perror("gauger");\ + _exit(1);\ + }else{\ + _exit(0);\ + }\ + }else{\ + waitpid(__gauger_p,NULL,0);\ + }\ +} + +#else + +#define GAUGER_ID(category, counter, value, unit, id) {} +#define GAUGER(category, counter, value, unit) {} + +#endif /* WINDOWS */ + +#endif diff --git a/src/testcurl/https/Makefile.am b/src/testcurl/https/Makefile.am new file mode 100644 index 0000000..875770b --- /dev/null +++ b/src/testcurl/https/Makefile.am @@ -0,0 +1,175 @@ +# This Makefile.am is in the public domain +SUBDIRS = . + +if USE_COVERAGE + AM_CFLAGS = --coverage +endif + +if HAVE_GNUTLS_SNI + TEST_HTTPS_SNI = test_https_sni +endif + +if HAVE_POSIX_THREADS + HTTPS_PARALLEL_TESTS = test_https_get_parallel \ + test_https_get_parallel_threads +endif + +CPU_COUNT_DEF = -DCPU_COUNT=$(CPU_COUNT) + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/include \ + -I$(top_srcdir)/src/microhttpd \ + -I$(top_srcdir)/src/platform \ + $(LIBCURL_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +check_PROGRAMS = \ + test_tls_options \ + test_tls_authentication \ + test_https_multi_daemon \ + test_https_get \ + $(TEST_HTTPS_SNI) \ + test_https_get_select \ + $(HTTPS_PARALLEL_TESTS) \ + test_https_session_info \ + test_https_time_out \ + test_empty_response + +EXTRA_DIST = cert.pem key.pem \ + host1.crt host1.key host2.crt host2.key + +TESTS = \ + test_tls_options \ + test_https_multi_daemon \ + test_https_get \ + $(TEST_HTTPS_SNI) \ + test_https_get_select \ + $(HTTPS_PARALLEL_TESTS) \ + test_https_session_info \ + test_https_time_out \ + test_tls_authentication \ + test_empty_response + + +test_https_time_out_SOURCES = \ + test_https_time_out.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_https_time_out_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_tls_options_SOURCES = \ + test_tls_options.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_tls_options_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_get_parallel_SOURCES = \ + test_https_get_parallel.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_https_get_parallel_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) +test_https_get_parallel_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +test_https_get_parallel_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_empty_response_SOURCES = \ + test_empty_response.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_empty_response_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_get_parallel_threads_SOURCES = \ + test_https_get_parallel_threads.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_https_get_parallel_threads_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) +test_https_get_parallel_threads_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) +test_https_get_parallel_threads_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_tls_authentication_SOURCES = \ + test_tls_authentication.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_tls_authentication_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_session_info_SOURCES = \ + test_https_session_info.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_https_session_info_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_multi_daemon_SOURCES = \ + test_https_multi_daemon.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_https_multi_daemon_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_get_SOURCES = \ + test_https_get.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_https_get_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +if HAVE_GNUTLS_SNI +test_https_sni_SOURCES = \ + test_https_sni.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_https_sni_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -DABS_SRCDIR=\"$(abs_srcdir)\" +test_https_sni_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ +endif + +test_https_get_select_SOURCES = \ + test_https_get_select.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c +test_https_get_select_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + diff --git a/src/testcurl/https/Makefile.in b/src/testcurl/https/Makefile.in new file mode 100644 index 0000000..9ba7f41 --- /dev/null +++ b/src/testcurl/https/Makefile.in @@ -0,0 +1,1613 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = test_tls_options$(EXEEXT) \ + test_tls_authentication$(EXEEXT) \ + test_https_multi_daemon$(EXEEXT) test_https_get$(EXEEXT) \ + $(am__EXEEXT_1) test_https_get_select$(EXEEXT) $(am__EXEEXT_2) \ + test_https_session_info$(EXEEXT) test_https_time_out$(EXEEXT) \ + test_empty_response$(EXEEXT) +TESTS = test_tls_options$(EXEEXT) test_https_multi_daemon$(EXEEXT) \ + test_https_get$(EXEEXT) $(am__EXEEXT_1) \ + test_https_get_select$(EXEEXT) $(am__EXEEXT_2) \ + test_https_session_info$(EXEEXT) test_https_time_out$(EXEEXT) \ + test_tls_authentication$(EXEEXT) test_empty_response$(EXEEXT) +subdir = src/testcurl/https +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@HAVE_GNUTLS_SNI_TRUE@am__EXEEXT_1 = test_https_sni$(EXEEXT) +@HAVE_POSIX_THREADS_TRUE@am__EXEEXT_2 = \ +@HAVE_POSIX_THREADS_TRUE@ test_https_get_parallel$(EXEEXT) \ +@HAVE_POSIX_THREADS_TRUE@ test_https_get_parallel_threads$(EXEEXT) +am_test_empty_response_OBJECTS = test_empty_response.$(OBJEXT) \ + tls_test_common.$(OBJEXT) +test_empty_response_OBJECTS = $(am_test_empty_response_OBJECTS) +am__DEPENDENCIES_1 = +test_empty_response_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am_test_https_get_OBJECTS = test_https_get.$(OBJEXT) \ + tls_test_common.$(OBJEXT) +test_https_get_OBJECTS = $(am_test_https_get_OBJECTS) +test_https_get_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_test_https_get_parallel_OBJECTS = \ + test_https_get_parallel-test_https_get_parallel.$(OBJEXT) \ + test_https_get_parallel-tls_test_common.$(OBJEXT) +test_https_get_parallel_OBJECTS = \ + $(am_test_https_get_parallel_OBJECTS) +test_https_get_parallel_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +test_https_get_parallel_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_https_get_parallel_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_test_https_get_parallel_threads_OBJECTS = test_https_get_parallel_threads-test_https_get_parallel_threads.$(OBJEXT) \ + test_https_get_parallel_threads-tls_test_common.$(OBJEXT) +test_https_get_parallel_threads_OBJECTS = \ + $(am_test_https_get_parallel_threads_OBJECTS) +test_https_get_parallel_threads_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +test_https_get_parallel_threads_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_https_get_select_OBJECTS = test_https_get_select.$(OBJEXT) \ + tls_test_common.$(OBJEXT) +test_https_get_select_OBJECTS = $(am_test_https_get_select_OBJECTS) +test_https_get_select_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_test_https_multi_daemon_OBJECTS = \ + test_https_multi_daemon.$(OBJEXT) tls_test_common.$(OBJEXT) +test_https_multi_daemon_OBJECTS = \ + $(am_test_https_multi_daemon_OBJECTS) +test_https_multi_daemon_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_test_https_session_info_OBJECTS = \ + test_https_session_info.$(OBJEXT) tls_test_common.$(OBJEXT) +test_https_session_info_OBJECTS = \ + $(am_test_https_session_info_OBJECTS) +test_https_session_info_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__test_https_sni_SOURCES_DIST = test_https_sni.c tls_test_keys.h \ + tls_test_common.h tls_test_common.c +@HAVE_GNUTLS_SNI_TRUE@am_test_https_sni_OBJECTS = \ +@HAVE_GNUTLS_SNI_TRUE@ test_https_sni-test_https_sni.$(OBJEXT) \ +@HAVE_GNUTLS_SNI_TRUE@ test_https_sni-tls_test_common.$(OBJEXT) +test_https_sni_OBJECTS = $(am_test_https_sni_OBJECTS) +@HAVE_GNUTLS_SNI_TRUE@test_https_sni_DEPENDENCIES = $(top_builddir)/src/testcurl/libcurl_version_check.a \ +@HAVE_GNUTLS_SNI_TRUE@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ +@HAVE_GNUTLS_SNI_TRUE@ $(am__DEPENDENCIES_1) \ +@HAVE_GNUTLS_SNI_TRUE@ $(am__DEPENDENCIES_1) +am_test_https_time_out_OBJECTS = test_https_time_out.$(OBJEXT) \ + tls_test_common.$(OBJEXT) +test_https_time_out_OBJECTS = $(am_test_https_time_out_OBJECTS) +test_https_time_out_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_test_tls_authentication_OBJECTS = \ + test_tls_authentication.$(OBJEXT) tls_test_common.$(OBJEXT) +test_tls_authentication_OBJECTS = \ + $(am_test_tls_authentication_OBJECTS) +test_tls_authentication_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_test_tls_options_OBJECTS = test_tls_options.$(OBJEXT) \ + tls_test_common.$(OBJEXT) +test_tls_options_OBJECTS = $(am_test_tls_options_OBJECTS) +test_tls_options_DEPENDENCIES = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_empty_response_SOURCES) $(test_https_get_SOURCES) \ + $(test_https_get_parallel_SOURCES) \ + $(test_https_get_parallel_threads_SOURCES) \ + $(test_https_get_select_SOURCES) \ + $(test_https_multi_daemon_SOURCES) \ + $(test_https_session_info_SOURCES) $(test_https_sni_SOURCES) \ + $(test_https_time_out_SOURCES) \ + $(test_tls_authentication_SOURCES) $(test_tls_options_SOURCES) +DIST_SOURCES = $(test_empty_response_SOURCES) \ + $(test_https_get_SOURCES) $(test_https_get_parallel_SOURCES) \ + $(test_https_get_parallel_threads_SOURCES) \ + $(test_https_get_select_SOURCES) \ + $(test_https_multi_daemon_SOURCES) \ + $(test_https_session_info_SOURCES) \ + $(am__test_https_sni_SOURCES_DIST) \ + $(test_https_time_out_SOURCES) \ + $(test_tls_authentication_SOURCES) $(test_tls_options_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + check recheck distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +SUBDIRS = . +@USE_COVERAGE_TRUE@AM_CFLAGS = --coverage +@HAVE_GNUTLS_SNI_TRUE@TEST_HTTPS_SNI = test_https_sni +@HAVE_POSIX_THREADS_TRUE@HTTPS_PARALLEL_TESTS = test_https_get_parallel \ +@HAVE_POSIX_THREADS_TRUE@ test_https_get_parallel_threads + +CPU_COUNT_DEF = -DCPU_COUNT=$(CPU_COUNT) +AM_CPPFLAGS = \ + -I$(top_srcdir)/src/include \ + -I$(top_srcdir)/src/microhttpd \ + -I$(top_srcdir)/src/platform \ + $(LIBCURL_CPPFLAGS) $(GNUTLS_CPPFLAGS) + +EXTRA_DIST = cert.pem key.pem \ + host1.crt host1.key host2.crt host2.key + +test_https_time_out_SOURCES = \ + test_https_time_out.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_https_time_out_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_tls_options_SOURCES = \ + test_tls_options.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_tls_options_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_get_parallel_SOURCES = \ + test_https_get_parallel.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_https_get_parallel_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) + +test_https_get_parallel_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +test_https_get_parallel_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_empty_response_SOURCES = \ + test_empty_response.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_empty_response_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_get_parallel_threads_SOURCES = \ + test_https_get_parallel_threads.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_https_get_parallel_threads_CPPFLAGS = \ + $(AM_CPPFLAGS) $(CPU_COUNT_DEF) + +test_https_get_parallel_threads_CFLAGS = \ + $(PTHREAD_CFLAGS) $(AM_CFLAGS) + +test_https_get_parallel_threads_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(PTHREAD_LIBS) $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_tls_authentication_SOURCES = \ + test_tls_authentication.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_tls_authentication_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_session_info_SOURCES = \ + test_https_session_info.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_https_session_info_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_multi_daemon_SOURCES = \ + test_https_multi_daemon.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_https_multi_daemon_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_get_SOURCES = \ + test_https_get.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_https_get_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +@HAVE_GNUTLS_SNI_TRUE@test_https_sni_SOURCES = \ +@HAVE_GNUTLS_SNI_TRUE@ test_https_sni.c \ +@HAVE_GNUTLS_SNI_TRUE@ tls_test_keys.h \ +@HAVE_GNUTLS_SNI_TRUE@ tls_test_common.h \ +@HAVE_GNUTLS_SNI_TRUE@ tls_test_common.c + +@HAVE_GNUTLS_SNI_TRUE@test_https_sni_CPPFLAGS = \ +@HAVE_GNUTLS_SNI_TRUE@ $(AM_CPPFLAGS) \ +@HAVE_GNUTLS_SNI_TRUE@ -DABS_SRCDIR=\"$(abs_srcdir)\" + +@HAVE_GNUTLS_SNI_TRUE@test_https_sni_LDADD = \ +@HAVE_GNUTLS_SNI_TRUE@ $(top_builddir)/src/testcurl/libcurl_version_check.a \ +@HAVE_GNUTLS_SNI_TRUE@ $(top_builddir)/src/microhttpd/libmicrohttpd.la \ +@HAVE_GNUTLS_SNI_TRUE@ $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +test_https_get_select_SOURCES = \ + test_https_get_select.c \ + tls_test_keys.h \ + tls_test_common.h \ + tls_test_common.c + +test_https_get_select_LDADD = \ + $(top_builddir)/src/testcurl/libcurl_version_check.a \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + $(GNUTLS_LDFLAGS) $(GNUTLS_LIBS) @LIBGCRYPT_LIBS@ @LIBCURL@ + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/testcurl/https/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/testcurl/https/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_empty_response$(EXEEXT): $(test_empty_response_OBJECTS) $(test_empty_response_DEPENDENCIES) $(EXTRA_test_empty_response_DEPENDENCIES) + @rm -f test_empty_response$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_empty_response_OBJECTS) $(test_empty_response_LDADD) $(LIBS) + +test_https_get$(EXEEXT): $(test_https_get_OBJECTS) $(test_https_get_DEPENDENCIES) $(EXTRA_test_https_get_DEPENDENCIES) + @rm -f test_https_get$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_https_get_OBJECTS) $(test_https_get_LDADD) $(LIBS) + +test_https_get_parallel$(EXEEXT): $(test_https_get_parallel_OBJECTS) $(test_https_get_parallel_DEPENDENCIES) $(EXTRA_test_https_get_parallel_DEPENDENCIES) + @rm -f test_https_get_parallel$(EXEEXT) + $(AM_V_CCLD)$(test_https_get_parallel_LINK) $(test_https_get_parallel_OBJECTS) $(test_https_get_parallel_LDADD) $(LIBS) + +test_https_get_parallel_threads$(EXEEXT): $(test_https_get_parallel_threads_OBJECTS) $(test_https_get_parallel_threads_DEPENDENCIES) $(EXTRA_test_https_get_parallel_threads_DEPENDENCIES) + @rm -f test_https_get_parallel_threads$(EXEEXT) + $(AM_V_CCLD)$(test_https_get_parallel_threads_LINK) $(test_https_get_parallel_threads_OBJECTS) $(test_https_get_parallel_threads_LDADD) $(LIBS) + +test_https_get_select$(EXEEXT): $(test_https_get_select_OBJECTS) $(test_https_get_select_DEPENDENCIES) $(EXTRA_test_https_get_select_DEPENDENCIES) + @rm -f test_https_get_select$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_https_get_select_OBJECTS) $(test_https_get_select_LDADD) $(LIBS) + +test_https_multi_daemon$(EXEEXT): $(test_https_multi_daemon_OBJECTS) $(test_https_multi_daemon_DEPENDENCIES) $(EXTRA_test_https_multi_daemon_DEPENDENCIES) + @rm -f test_https_multi_daemon$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_https_multi_daemon_OBJECTS) $(test_https_multi_daemon_LDADD) $(LIBS) + +test_https_session_info$(EXEEXT): $(test_https_session_info_OBJECTS) $(test_https_session_info_DEPENDENCIES) $(EXTRA_test_https_session_info_DEPENDENCIES) + @rm -f test_https_session_info$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_https_session_info_OBJECTS) $(test_https_session_info_LDADD) $(LIBS) + +test_https_sni$(EXEEXT): $(test_https_sni_OBJECTS) $(test_https_sni_DEPENDENCIES) $(EXTRA_test_https_sni_DEPENDENCIES) + @rm -f test_https_sni$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_https_sni_OBJECTS) $(test_https_sni_LDADD) $(LIBS) + +test_https_time_out$(EXEEXT): $(test_https_time_out_OBJECTS) $(test_https_time_out_DEPENDENCIES) $(EXTRA_test_https_time_out_DEPENDENCIES) + @rm -f test_https_time_out$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_https_time_out_OBJECTS) $(test_https_time_out_LDADD) $(LIBS) + +test_tls_authentication$(EXEEXT): $(test_tls_authentication_OBJECTS) $(test_tls_authentication_DEPENDENCIES) $(EXTRA_test_tls_authentication_DEPENDENCIES) + @rm -f test_tls_authentication$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_tls_authentication_OBJECTS) $(test_tls_authentication_LDADD) $(LIBS) + +test_tls_options$(EXEEXT): $(test_tls_options_OBJECTS) $(test_tls_options_DEPENDENCIES) $(EXTRA_test_tls_options_DEPENDENCIES) + @rm -f test_tls_options$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_tls_options_OBJECTS) $(test_tls_options_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_empty_response.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_get.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_get_parallel-test_https_get_parallel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_get_parallel-tls_test_common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_get_parallel_threads-test_https_get_parallel_threads.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_get_parallel_threads-tls_test_common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_get_select.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_multi_daemon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_session_info.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_sni-test_https_sni.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_sni-tls_test_common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_https_time_out.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_tls_authentication.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_tls_options.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test_common.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +test_https_get_parallel-test_https_get_parallel.o: test_https_get_parallel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_CFLAGS) $(CFLAGS) -MT test_https_get_parallel-test_https_get_parallel.o -MD -MP -MF $(DEPDIR)/test_https_get_parallel-test_https_get_parallel.Tpo -c -o test_https_get_parallel-test_https_get_parallel.o `test -f 'test_https_get_parallel.c' || echo '$(srcdir)/'`test_https_get_parallel.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_get_parallel-test_https_get_parallel.Tpo $(DEPDIR)/test_https_get_parallel-test_https_get_parallel.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_https_get_parallel.c' object='test_https_get_parallel-test_https_get_parallel.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_CFLAGS) $(CFLAGS) -c -o test_https_get_parallel-test_https_get_parallel.o `test -f 'test_https_get_parallel.c' || echo '$(srcdir)/'`test_https_get_parallel.c + +test_https_get_parallel-test_https_get_parallel.obj: test_https_get_parallel.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_CFLAGS) $(CFLAGS) -MT test_https_get_parallel-test_https_get_parallel.obj -MD -MP -MF $(DEPDIR)/test_https_get_parallel-test_https_get_parallel.Tpo -c -o test_https_get_parallel-test_https_get_parallel.obj `if test -f 'test_https_get_parallel.c'; then $(CYGPATH_W) 'test_https_get_parallel.c'; else $(CYGPATH_W) '$(srcdir)/test_https_get_parallel.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_get_parallel-test_https_get_parallel.Tpo $(DEPDIR)/test_https_get_parallel-test_https_get_parallel.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_https_get_parallel.c' object='test_https_get_parallel-test_https_get_parallel.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_CFLAGS) $(CFLAGS) -c -o test_https_get_parallel-test_https_get_parallel.obj `if test -f 'test_https_get_parallel.c'; then $(CYGPATH_W) 'test_https_get_parallel.c'; else $(CYGPATH_W) '$(srcdir)/test_https_get_parallel.c'; fi` + +test_https_get_parallel-tls_test_common.o: tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_CFLAGS) $(CFLAGS) -MT test_https_get_parallel-tls_test_common.o -MD -MP -MF $(DEPDIR)/test_https_get_parallel-tls_test_common.Tpo -c -o test_https_get_parallel-tls_test_common.o `test -f 'tls_test_common.c' || echo '$(srcdir)/'`tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_get_parallel-tls_test_common.Tpo $(DEPDIR)/test_https_get_parallel-tls_test_common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls_test_common.c' object='test_https_get_parallel-tls_test_common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_CFLAGS) $(CFLAGS) -c -o test_https_get_parallel-tls_test_common.o `test -f 'tls_test_common.c' || echo '$(srcdir)/'`tls_test_common.c + +test_https_get_parallel-tls_test_common.obj: tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_CFLAGS) $(CFLAGS) -MT test_https_get_parallel-tls_test_common.obj -MD -MP -MF $(DEPDIR)/test_https_get_parallel-tls_test_common.Tpo -c -o test_https_get_parallel-tls_test_common.obj `if test -f 'tls_test_common.c'; then $(CYGPATH_W) 'tls_test_common.c'; else $(CYGPATH_W) '$(srcdir)/tls_test_common.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_get_parallel-tls_test_common.Tpo $(DEPDIR)/test_https_get_parallel-tls_test_common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls_test_common.c' object='test_https_get_parallel-tls_test_common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_CFLAGS) $(CFLAGS) -c -o test_https_get_parallel-tls_test_common.obj `if test -f 'tls_test_common.c'; then $(CYGPATH_W) 'tls_test_common.c'; else $(CYGPATH_W) '$(srcdir)/tls_test_common.c'; fi` + +test_https_get_parallel_threads-test_https_get_parallel_threads.o: test_https_get_parallel_threads.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_threads_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) -MT test_https_get_parallel_threads-test_https_get_parallel_threads.o -MD -MP -MF $(DEPDIR)/test_https_get_parallel_threads-test_https_get_parallel_threads.Tpo -c -o test_https_get_parallel_threads-test_https_get_parallel_threads.o `test -f 'test_https_get_parallel_threads.c' || echo '$(srcdir)/'`test_https_get_parallel_threads.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_get_parallel_threads-test_https_get_parallel_threads.Tpo $(DEPDIR)/test_https_get_parallel_threads-test_https_get_parallel_threads.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_https_get_parallel_threads.c' object='test_https_get_parallel_threads-test_https_get_parallel_threads.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_threads_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) -c -o test_https_get_parallel_threads-test_https_get_parallel_threads.o `test -f 'test_https_get_parallel_threads.c' || echo '$(srcdir)/'`test_https_get_parallel_threads.c + +test_https_get_parallel_threads-test_https_get_parallel_threads.obj: test_https_get_parallel_threads.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_threads_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) -MT test_https_get_parallel_threads-test_https_get_parallel_threads.obj -MD -MP -MF $(DEPDIR)/test_https_get_parallel_threads-test_https_get_parallel_threads.Tpo -c -o test_https_get_parallel_threads-test_https_get_parallel_threads.obj `if test -f 'test_https_get_parallel_threads.c'; then $(CYGPATH_W) 'test_https_get_parallel_threads.c'; else $(CYGPATH_W) '$(srcdir)/test_https_get_parallel_threads.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_get_parallel_threads-test_https_get_parallel_threads.Tpo $(DEPDIR)/test_https_get_parallel_threads-test_https_get_parallel_threads.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_https_get_parallel_threads.c' object='test_https_get_parallel_threads-test_https_get_parallel_threads.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_threads_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) -c -o test_https_get_parallel_threads-test_https_get_parallel_threads.obj `if test -f 'test_https_get_parallel_threads.c'; then $(CYGPATH_W) 'test_https_get_parallel_threads.c'; else $(CYGPATH_W) '$(srcdir)/test_https_get_parallel_threads.c'; fi` + +test_https_get_parallel_threads-tls_test_common.o: tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_threads_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) -MT test_https_get_parallel_threads-tls_test_common.o -MD -MP -MF $(DEPDIR)/test_https_get_parallel_threads-tls_test_common.Tpo -c -o test_https_get_parallel_threads-tls_test_common.o `test -f 'tls_test_common.c' || echo '$(srcdir)/'`tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_get_parallel_threads-tls_test_common.Tpo $(DEPDIR)/test_https_get_parallel_threads-tls_test_common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls_test_common.c' object='test_https_get_parallel_threads-tls_test_common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_threads_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) -c -o test_https_get_parallel_threads-tls_test_common.o `test -f 'tls_test_common.c' || echo '$(srcdir)/'`tls_test_common.c + +test_https_get_parallel_threads-tls_test_common.obj: tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_threads_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) -MT test_https_get_parallel_threads-tls_test_common.obj -MD -MP -MF $(DEPDIR)/test_https_get_parallel_threads-tls_test_common.Tpo -c -o test_https_get_parallel_threads-tls_test_common.obj `if test -f 'tls_test_common.c'; then $(CYGPATH_W) 'tls_test_common.c'; else $(CYGPATH_W) '$(srcdir)/tls_test_common.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_get_parallel_threads-tls_test_common.Tpo $(DEPDIR)/test_https_get_parallel_threads-tls_test_common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls_test_common.c' object='test_https_get_parallel_threads-tls_test_common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_get_parallel_threads_CPPFLAGS) $(CPPFLAGS) $(test_https_get_parallel_threads_CFLAGS) $(CFLAGS) -c -o test_https_get_parallel_threads-tls_test_common.obj `if test -f 'tls_test_common.c'; then $(CYGPATH_W) 'tls_test_common.c'; else $(CYGPATH_W) '$(srcdir)/tls_test_common.c'; fi` + +test_https_sni-test_https_sni.o: test_https_sni.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_sni_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_https_sni-test_https_sni.o -MD -MP -MF $(DEPDIR)/test_https_sni-test_https_sni.Tpo -c -o test_https_sni-test_https_sni.o `test -f 'test_https_sni.c' || echo '$(srcdir)/'`test_https_sni.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_sni-test_https_sni.Tpo $(DEPDIR)/test_https_sni-test_https_sni.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_https_sni.c' object='test_https_sni-test_https_sni.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_sni_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_https_sni-test_https_sni.o `test -f 'test_https_sni.c' || echo '$(srcdir)/'`test_https_sni.c + +test_https_sni-test_https_sni.obj: test_https_sni.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_sni_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_https_sni-test_https_sni.obj -MD -MP -MF $(DEPDIR)/test_https_sni-test_https_sni.Tpo -c -o test_https_sni-test_https_sni.obj `if test -f 'test_https_sni.c'; then $(CYGPATH_W) 'test_https_sni.c'; else $(CYGPATH_W) '$(srcdir)/test_https_sni.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_sni-test_https_sni.Tpo $(DEPDIR)/test_https_sni-test_https_sni.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test_https_sni.c' object='test_https_sni-test_https_sni.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_sni_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_https_sni-test_https_sni.obj `if test -f 'test_https_sni.c'; then $(CYGPATH_W) 'test_https_sni.c'; else $(CYGPATH_W) '$(srcdir)/test_https_sni.c'; fi` + +test_https_sni-tls_test_common.o: tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_sni_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_https_sni-tls_test_common.o -MD -MP -MF $(DEPDIR)/test_https_sni-tls_test_common.Tpo -c -o test_https_sni-tls_test_common.o `test -f 'tls_test_common.c' || echo '$(srcdir)/'`tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_sni-tls_test_common.Tpo $(DEPDIR)/test_https_sni-tls_test_common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls_test_common.c' object='test_https_sni-tls_test_common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_sni_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_https_sni-tls_test_common.o `test -f 'tls_test_common.c' || echo '$(srcdir)/'`tls_test_common.c + +test_https_sni-tls_test_common.obj: tls_test_common.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_sni_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_https_sni-tls_test_common.obj -MD -MP -MF $(DEPDIR)/test_https_sni-tls_test_common.Tpo -c -o test_https_sni-tls_test_common.obj `if test -f 'tls_test_common.c'; then $(CYGPATH_W) 'tls_test_common.c'; else $(CYGPATH_W) '$(srcdir)/tls_test_common.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_https_sni-tls_test_common.Tpo $(DEPDIR)/test_https_sni-tls_test_common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tls_test_common.c' object='test_https_sni-tls_test_common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_https_sni_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_https_sni-tls_test_common.obj `if test -f 'tls_test_common.c'; then $(CYGPATH_W) 'tls_test_common.c'; else $(CYGPATH_W) '$(srcdir)/tls_test_common.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test_tls_options.log: test_tls_options$(EXEEXT) + @p='test_tls_options$(EXEEXT)'; \ + b='test_tls_options'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_https_multi_daemon.log: test_https_multi_daemon$(EXEEXT) + @p='test_https_multi_daemon$(EXEEXT)'; \ + b='test_https_multi_daemon'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_https_get.log: test_https_get$(EXEEXT) + @p='test_https_get$(EXEEXT)'; \ + b='test_https_get'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_https_sni.log: test_https_sni$(EXEEXT) + @p='test_https_sni$(EXEEXT)'; \ + b='test_https_sni'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_https_get_select.log: test_https_get_select$(EXEEXT) + @p='test_https_get_select$(EXEEXT)'; \ + b='test_https_get_select'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_https_get_parallel.log: test_https_get_parallel$(EXEEXT) + @p='test_https_get_parallel$(EXEEXT)'; \ + b='test_https_get_parallel'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_https_get_parallel_threads.log: test_https_get_parallel_threads$(EXEEXT) + @p='test_https_get_parallel_threads$(EXEEXT)'; \ + b='test_https_get_parallel_threads'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_https_session_info.log: test_https_session_info$(EXEEXT) + @p='test_https_session_info$(EXEEXT)'; \ + b='test_https_session_info'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_https_time_out.log: test_https_time_out$(EXEEXT) + @p='test_https_time_out$(EXEEXT)'; \ + b='test_https_time_out'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_tls_authentication.log: test_tls_authentication$(EXEEXT) + @p='test_tls_authentication$(EXEEXT)'; \ + b='test_tls_authentication'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_empty_response.log: test_empty_response$(EXEEXT) + @p='test_empty_response$(EXEEXT)'; \ + b='test_empty_response'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-TESTS check-am clean clean-checkPROGRAMS clean-generic \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ + uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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: diff --git a/src/testcurl/https/cert.pem b/src/testcurl/https/cert.pem new file mode 100644 index 0000000..2c766df --- /dev/null +++ b/src/testcurl/https/cert.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICpjCCAZCgAwIBAgIESEPtjjALBgkqhkiG9w0BAQUwADAeFw0wODA2MDIxMjU0 +MzhaFw0wOTA2MDIxMjU0NDZaMAAwggEfMAsGCSqGSIb3DQEBAQOCAQ4AMIIBCQKC +AQC03TyUvK5HmUAirRp067taIEO4bibh5nqolUoUdo/LeblMQV+qnrv/RNAMTx5X +fNLZ45/kbM9geF8qY0vsPyQvP4jumzK0LOJYuIwmHaUm9vbXnYieILiwCuTgjaud +3VkZDoQ9fteIo+6we9UTpVqZpxpbLulBMh/VsvX0cPJ1VFC7rT59o9hAUlFf9jX/ +GmKdYI79MtgVx0OPBjmmSD6kicBBfmfgkO7bIGwlRtsIyMznxbHu6VuoX/eVxrTv +rmCwgEXLWRZ6ru8MQl5YfqeGXXRVwMeXU961KefbuvmEPccgCxm8FZ1C1cnDHFXh +siSgAzMBjC/b6KVhNQ4KnUdZAgMBAAGjLzAtMAwGA1UdEwEB/wQCMAAwHQYDVR0O +BBYEFJcUvpjvE5fF/yzUshkWDpdYiQh/MAsGCSqGSIb3DQEBBQOCAQEARP7eKSB2 +RNd6XjEjK0SrxtoTnxS3nw9sfcS7/qD1+XHdObtDFqGNSjGYFB3Gpx8fpQhCXdoN +8QUs3/5ZVa5yjZMQewWBgz8kNbnbH40F2y81MHITxxCe1Y+qqHWwVaYLsiOTqj2/ +0S3QjEJ9tvklmg7JX09HC4m5QRYfWBeQLD1u8ZjA1Sf1xJriomFVyRLI2VPO2bNe +JDMXWuP+8kMC7gEvUnJ7A92Y2yrhu3QI3bjPk8uSpHea19Q77tul1UVBJ5g+zpH3 +OsF5p0MyaVf09GTzcLds5nE/osTdXGUyHJapWReVmPm3Zn6gqYlnzD99z+DPIgIV +RhZvQx74NQnS6g== +-----END CERTIFICATE----- diff --git a/src/testcurl/https/host1.crt b/src/testcurl/https/host1.crt new file mode 100644 index 0000000..d9b8b99 --- /dev/null +++ b/src/testcurl/https/host1.crt @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICWTCCAcICCQDc4McLp7j56DANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJa +WjETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 +cyBQdHkgTHRkMQ4wDAYDVQQDDAVob3N0MTEZMBcGCSqGSIb3DQEJARYKdGVzdEBo +b3N0MTAgFw0xMzExMTcxNTE2MzdaGA8yMTEzMTAyNDE1MTYzN1owcDELMAkGA1UE +BhMCWloxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdp +ZGdpdHMgUHR5IEx0ZDEOMAwGA1UEAwwFaG9zdDExGTAXBgkqhkiG9w0BCQEWCnRl +c3RAaG9zdDEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKxYiRUzfQnekQn3 +6e+hP/mt/JEkiFzX5TV+E19ue2v4tc7lf+SoLEk2dVt5tGQkHjIGeFFNwCLrgXoi +h3KfP4R1IYe7NFbM+lFVwPceF3inJ75dZD80BxaXQANeh0yC/DhaVJUFNaof2S4+ +7xd8zTL6M11gME+XmR8uaDvW7EBtAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAf62m +Nstj9p9u8T5A5fRnJWfoglH/zfm7IHzht0Wi047O3NFZJ0pOPqV97HuErUA5oBGg +qswnyRGyGMcvL08Bki7Q6NkY7K0ON3lq+ofTkIAHlOKMF+Y/otbjuIDHBfo63tmE +uOcr8XDQGu9R0cfh+qLgicJQd/8cFBhxsL0ls6I= +-----END CERTIFICATE----- diff --git a/src/testcurl/https/host1.key b/src/testcurl/https/host1.key new file mode 100644 index 0000000..f549a4d --- /dev/null +++ b/src/testcurl/https/host1.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQCsWIkVM30J3pEJ9+nvoT/5rfyRJIhc1+U1fhNfbntr+LXO5X/k +qCxJNnVbebRkJB4yBnhRTcAi64F6Iodynz+EdSGHuzRWzPpRVcD3Hhd4pye+XWQ/ +NAcWl0ADXodMgvw4WlSVBTWqH9kuPu8XfM0y+jNdYDBPl5kfLmg71uxAbQIDAQAB +AoGBAJvq9QmjLSnymtCj4pYSEai2iNpebKdiAlEkoC4j67DArupgohWhN398ryt0 +rYgzTMYBKHSVnI969AYkmtlNzM1yNckRQb/G/tWrkl9re28y2nbAExtHbvLoTk2C +a/EEl1Op+JZNzLoSje7IQMVZoArD3d4aUbfux4XzlO2eRNmZAkEA2pV49QgcOTOJ +PrR5cgekonNdeMtkbZm9dhxgDk9IsYkC0iOxjn/IbeCQN3wuTQ5/yLoiiQ/CQ8w5 +JndF/XpICwJBAMnY37BSRb+XKZeJWP0yjqyFJwzHXkh6IsoSF2OOXSixdiMpthLh +IPzvo6Qxsnha4VvwuDxljHzQFPgMT//CTGcCQQDMs9S+LKU50JDEX4Goj43X8RBl +cp0Poz3yYap3XDqowLYalADRgcvzUq3cuHgoA98Z3W9ASrjUg2o2ItcyBhV3AkAK +bCBgwl7Hnc6P/I+Tw2CKl/WEO2cq5uOU+4opodg9maw39JdqMiW56cXRXJ+Sh17L +mIpq0/OFHll21WvsEORRAkAnDDn/vmW25PSxPVY7tKKJCCkmtBeLQpySfpDgBF+O +QvvokKs2COivc50rmOYNvD1WSsAOspdaSoZUgFw5ikti +-----END RSA PRIVATE KEY----- diff --git a/src/testcurl/https/host2.crt b/src/testcurl/https/host2.crt new file mode 100644 index 0000000..ac28b0e --- /dev/null +++ b/src/testcurl/https/host2.crt @@ -0,0 +1,15 @@ +-----BEGIN CERTIFICATE----- +MIICWTCCAcICCQCJ9nhDYTUBKjANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJa +WjETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 +cyBQdHkgTHRkMQ4wDAYDVQQDDAVob3N0MjEZMBcGCSqGSIb3DQEJARYKdGVzdEBo +b3N0MjAgFw0xMzExMTcxNTE2NDNaGA8yMTEzMTAyNDE1MTY0M1owcDELMAkGA1UE +BhMCWloxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdp +ZGdpdHMgUHR5IEx0ZDEOMAwGA1UEAwwFaG9zdDIxGTAXBgkqhkiG9w0BCQEWCnRl +c3RAaG9zdDIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALVK8QKMvU96iNL2 +66PKm6xXw9NPHDn+o1TLF1CQRxXMrBYUrObk0961+3n3Z3BXOFHKfSV4E55CpVyz +D1Wcadlt3B9z3ke3HOi0lEa1xNJTMQK/QT3Fx/NURmNg5s9HAsqY4ocb9KHaF5Ex +0TgC0L0aRP0cK1x2TgPEHBNcgGl9AgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAEXOi +9rSmVrTN5olIdowctr1vWbGwRCjCnAFXDsqakcDASNthr15LB5kr/mrA3olJjbZh +o+JDvWMY6FN8r1QXW0RL9/obbHxtJpwvAmYVMY9jrR8Rpo38p4RfXlN85g3q9PVx +5IGLaOqLf4hSnKArFL/fzXwxX9b5HBCKlXfiuqM= +-----END CERTIFICATE----- diff --git a/src/testcurl/https/host2.key b/src/testcurl/https/host2.key new file mode 100644 index 0000000..4bbd617 --- /dev/null +++ b/src/testcurl/https/host2.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICWwIBAAKBgQC1SvECjL1PeojS9uujypusV8PTTxw5/qNUyxdQkEcVzKwWFKzm +5NPetft592dwVzhRyn0leBOeQqVcsw9VnGnZbdwfc95HtxzotJRGtcTSUzECv0E9 +xcfzVEZjYObPRwLKmOKHG/Sh2heRMdE4AtC9GkT9HCtcdk4DxBwTXIBpfQIDAQAB +AoGAR5Do6TfDt69IefdNeCAQKg2PWUg+fUpfEacGciAyX5GnUSQiSReF58HxHumi +ZL+ZlPgZRQRMwknO23Q4FnSjd66A3E9iHLqkWxRFJWME6E7zgtBrIjctnNu9uYM9 +cw4R6qmXOL7C5sK00KXF2ep8+s+JjrZz61o85QnGGRYA94ECQQDbG6f1B8NKY9T1 +1GDR/++rJbdTVQlZQcKSXMumpU6V3mEV0O9GkYaZzoYvWa3kx6c0np4karrm3QWa +u5E0q1YdAkEA09FPcmzVvIR0+sMWca8QJ/tJUxD6qYo8vLOpO4wt4iTPhGBEU+Q5 +cgXmde3/plVsp0vYxK/NG5XZkoC1fbuC4QJATRGxRlLwsl3jLoUBeVxY5Q5jKYCj +xS2ITwss5vUGa1jJNW9EesH9YmRudoFI1UwU2EFixtRz4Xik3ARV0vzhUQJAfabT +50ASxqMYtczW2peMEPurMqCG4d4ES7iUMqPkcBuAErn8rntbbH19igWmOyi/rLp8 +m6jiFnQdPiAmCbEbYQJAFAKiQl2ZOe3gkSh8MaQilD8Ppog6rod4SQiSmRNsDWPi +IxqXneaGDWhzynC9xr4SwuJ9D5VxW1phNyiveDuYXw== +-----END RSA PRIVATE KEY----- diff --git a/src/testcurl/https/key.pem b/src/testcurl/https/key.pem new file mode 100644 index 0000000..a5848ee --- /dev/null +++ b/src/testcurl/https/key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAtN08lLyuR5lAIq0adOu7WiBDuG4m4eZ6qJVKFHaPy3m5TEFf +qp67/0TQDE8eV3zS2eOf5GzPYHhfKmNL7D8kLz+I7psytCziWLiMJh2lJvb2152I +niC4sArk4I2rnd1ZGQ6EPX7XiKPusHvVE6VamacaWy7pQTIf1bL19HDydVRQu60+ +faPYQFJRX/Y1/xpinWCO/TLYFcdDjwY5pkg+pInAQX5n4JDu2yBsJUbbCMjM58Wx +7ulbqF/3lca0765gsIBFy1kWeq7vDEJeWH6nhl10VcDHl1PetSnn27r5hD3HIAsZ +vBWdQtXJwxxV4bIkoAMzAYwv2+ilYTUOCp1HWQIDAQABAoIBAArOQv3R7gmqDspj +lDaTFOz0C4e70QfjGMX0sWnakYnDGn6DU19iv3GnX1S072ejtgc9kcJ4e8VUO79R +EmqpdRR7k8dJr3RTUCyjzf/C+qiCzcmhCFYGN3KRHA6MeEnkvRuBogX4i5EG1k5l +/5t+YBTZBnqXKWlzQLKoUAiMLPg0eRWh+6q7H4N7kdWWBmTpako7TEqpIwuEnPGx +u3EPuTR+LN6lF55WBePbCHccUHUQaXuav18NuDkcJmCiMArK9SKb+h0RqLD6oMI/ +dKD6n8cZXeMBkK+C8U/K0sN2hFHACsu30b9XfdnljgP9v+BP8GhnB0nCB6tNBCPo +32srOwECgYEAxWh3iBT4lWqL6bZavVbnhmvtif4nHv2t2/hOs/CAq8iLAw0oWGZc ++JEZTUDMvFRlulr0kcaWra+4fN3OmJnjeuFXZq52lfMgXBIKBmoSaZpIh2aDY1Rd +RbEse7nQl9hTEPmYspiXLGtnAXW7HuWqVfFFP3ya8rUS3t4d07Hig8ECgYEA6ou6 +OHiBRTbtDqLIv8NghARc/AqwNWgEc9PelCPe5bdCOLBEyFjqKiT2MttnSSUc2Zob +XhYkHC6zN1Mlq30N0e3Q61YK9LxMdU1vsluXxNq2rfK1Scb1oOlOOtlbV3zA3VRF +hV3t1nOA9tFmUrwZi0CUMWJE/zbPAyhwWotKyZkCgYEAh0kFicPdbABdrCglXVae +SnfSjVwYkVuGd5Ze0WADvjYsVkYBHTvhgRNnRJMg+/vWz3Sf4Ps4rgUbqK8Vc20b +AU5G6H6tlCvPRGm0ZxrwTWDHTcuKRVs+pJE8C/qWoklE/AAhjluWVoGwUMbPGuiH +6Gf1bgHF6oj/Sq7rv/VLZ8ECgYBeq7ml05YyLuJutuwa4yzQ/MXfghzv4aVyb0F3 +QCdXR6o2IYgR6jnSewrZKlA9aPqFJrwHNR6sNXlnSmt5Fcf/RWO/qgJQGLUv3+rG +7kuLTNDR05azSdiZc7J89ID3Bkb+z2YkV+6JUiPq/Ei1+nDBEXb/m+/HqALU/nyj +P3gXeQKBgBusb8Rbd+KgxSA0hwY6aoRTPRt8LNvXdsB9vRcKKHUFQvxUWiUSS+L9 +/Qu1sJbrUquKOHqksV5wCnWnAKyJNJlhHuBToqQTgKXjuNmVdYSe631saiI7PHyC +eRJ6DxULPxABytJrYCRrNqmXi5TCiqR2mtfalEMOPxz8rUU8dYyx +-----END RSA PRIVATE KEY----- diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c new file mode 100644 index 0000000..27cb1e3 --- /dev/null +++ b/src/testcurl/https/test_empty_response.c @@ -0,0 +1,237 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2013 Christian Grothoff + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/** + * @file test_empty_response.c + * @brief Testcase for libmicrohttpd HTTPS GET operations with emtpy reply + * @author Christian Grothoff + */ +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +extern const char srv_key_pem[]; +extern const char srv_self_signed_cert_pem[]; + +static int oneone; + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + struct MHD_Response *response; + int ret; + (void)cls;(void)url;(void)method;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ + + response = MHD_create_response_from_buffer (0, NULL, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testInternalSelectGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + int maxposixs; /* Max socket number unused on W32 */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3000; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | MHD_USE_INTERNAL_POLLING_THREAD, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_END); + if (d == NULL) + return 256; + + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + char *aes256_sha = "AES256-SHA"; + if (curl_uses_nss_ssl() == 0) + { + aes256_sha = "rsa_aes_256_sha"; + } + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + /* TLS options */ + curl_easy_setopt (c, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); + curl_easy_setopt (c, CURLOPT_SSL_CIPHER_LIST, aes256_sha); + curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 0); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 != maxposixs) + { + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + } + else + (void)sleep (1); + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != 0) + return 8192; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + if (!testsuite_curl_global_init ()) + return 99; + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + if (0 != (errorCount = testInternalSelectGet ())) + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); + curl_global_cleanup (); + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c new file mode 100644 index 0000000..61c2564 --- /dev/null +++ b/src/testcurl/https/test_https_get.c @@ -0,0 +1,117 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_https_get.c + * @brief Testcase for libmicrohttpd HTTPS GET operations + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +extern const char srv_signed_cert_pem[]; +extern const char srv_signed_key_pem[]; + +/* perform a HTTP GET request via SSL/TLS */ +static int +test_secure_get (FILE * test_fd, + const char *cipher_suite, + int proto_version) +{ + int ret; + struct MHD_Daemon *d; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3041; + + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, port, + NULL, NULL, &http_ahc, NULL, + MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, + MHD_OPTION_END); + + if (d == NULL) + { + fprintf (stderr, MHD_E_SERVER_INIT); + return -1; + } + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return -1; } + port = (int)dinfo->port; + } + + ret = test_https_transfer (test_fd, port, cipher_suite, proto_version); + + MHD_stop_daemon (d); + return ret; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + const char *aes256_sha_tlsv1 = "AES256-SHA"; + (void)argc; /* Unused. Silent compiler warning. */ + +#ifdef MHD_HTTPS_REQUIRE_GRYPT + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + if (!testsuite_curl_global_init ()) + return 99; + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + + if (curl_uses_nss_ssl() == 0) + { + aes256_sha_tlsv1 = "rsa_aes_256_sha"; + } + + errorCount += + test_secure_get (NULL, aes256_sha_tlsv1, CURL_SSLVERSION_TLSv1); + print_test_result (errorCount, argv[0]); + + curl_global_cleanup (); + + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/test_https_get_parallel.c b/src/testcurl/https/test_https_get_parallel.c new file mode 100644 index 0000000..27c2317 --- /dev/null +++ b/src/testcurl/https/test_https_get_parallel.c @@ -0,0 +1,200 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_https_get_parallel.c + * @brief Testcase for libmicrohttpd HTTPS GET operations + * @author Sagie Amir + * @author Christian Grothoff + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 4 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 4 +#endif + +extern const char srv_key_pem[]; +extern const char srv_self_signed_cert_pem[]; + +int curl_check_version (const char *req_version, ...); + + +/** + * used when spawning multiple threads executing curl server requests + * + */ +static void * +https_transfer_thread_adapter (void *args) +{ + static int nonnull; + struct https_test_data *cargs = args; + int ret; + + /* time spread incomming requests */ + usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX)); + ret = test_https_transfer (NULL, cargs->port, + cargs->cipher_suite, cargs->proto_version); + if (ret == 0) + return NULL; + return &nonnull; +} + + +/** + * Test non-parallel requests. + * + * @return: 0 upon all client requests returning '0', -1 otherwise. + * + * TODO : make client_count a parameter - number of curl client threads to spawn + */ +static int +test_single_client (void *cls, int port, const char *cipher_suite, + int curl_proto_version) +{ + void *client_thread_ret; + struct https_test_data client_args = + { NULL, port, cipher_suite, curl_proto_version }; + (void)cls; /* Unused. Silent compiler warning. */ + + client_thread_ret = https_transfer_thread_adapter (&client_args); + if (client_thread_ret != NULL) + return -1; + return 0; +} + + +/** + * Test parallel request handling. + * + * @return: 0 upon all client requests returning '0', -1 otherwise. + * + * TODO : make client_count a parameter - numver of curl client threads to spawn + */ +static int +test_parallel_clients (void * cls, int port, const char *cipher_suite, + int curl_proto_version) +{ + int i; + int client_count = (CPU_COUNT - 1); + void *client_thread_ret; + pthread_t client_arr[client_count]; + struct https_test_data client_args = + { NULL, port, cipher_suite, curl_proto_version }; + (void)cls; /* Unused. Silent compiler warning. */ + + for (i = 0; i < client_count; ++i) + { + if (pthread_create (&client_arr[i], NULL, + &https_transfer_thread_adapter, &client_args) != 0) + { + fprintf (stderr, "Error: failed to spawn test client threads.\n"); + return -1; + } + } + + /* check all client requests fulfilled correctly */ + for (i = 0; i < client_count; ++i) + { + if ((pthread_join (client_arr[i], &client_thread_ret) != 0) || + (client_thread_ret != NULL)) + return -1; + } + + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + const char *aes256_sha = "AES256-SHA"; + int port; + (void)argc; /* Unused. Silent compiler warning. */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3020; + + /* initialize random seed used by curl clients */ + unsigned int iseed = (unsigned int) time (NULL); + srand (iseed); + if (!testsuite_curl_global_init ()) + return 99; + + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + return 77; + } + if (curl_uses_nss_ssl() == 0) + aes256_sha = "rsa_aes_256_sha"; +#ifdef EPOLL_SUPPORT + errorCount += + test_wrap ("single threaded daemon, single client, epoll", &test_single_client, + NULL, port, + MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL, + aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, + srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, + srv_self_signed_cert_pem, MHD_OPTION_END); +#endif + errorCount += + test_wrap ("single threaded daemon, single client", &test_single_client, + NULL, port, + MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, + aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, + srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, + srv_self_signed_cert_pem, MHD_OPTION_END); +#ifdef EPOLL_SUPPORT + errorCount += + test_wrap ("single threaded daemon, parallel clients, epoll", + &test_parallel_clients, NULL, port, + MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL, + aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, + srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, + srv_self_signed_cert_pem, MHD_OPTION_END); +#endif + errorCount += + test_wrap ("single threaded daemon, parallel clients", + &test_parallel_clients, NULL, port, + MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, + aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, + srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, + srv_self_signed_cert_pem, MHD_OPTION_END); + + curl_global_cleanup (); + if (errorCount != 0) + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/test_https_get_parallel_threads.c b/src/testcurl/https/test_https_get_parallel_threads.c new file mode 100644 index 0000000..c9fc8ff --- /dev/null +++ b/src/testcurl/https/test_https_get_parallel_threads.c @@ -0,0 +1,203 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file tls_thread_mode_test.c + * @brief Testcase for libmicrohttpd HTTPS GET operations + * @author Sagie Amir + * @author Christian Grothoff + * + * TODO: add test for external select! + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 4 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 4 +#endif + +extern const char srv_key_pem[]; +extern const char srv_self_signed_cert_pem[]; + +int curl_check_version (const char *req_version, ...); + +/** + * used when spawning multiple threads executing curl server requests + * + */ +static void * +https_transfer_thread_adapter (void *args) +{ + static int nonnull; + struct https_test_data *cargs = args; + int ret; + + /* time spread incomming requests */ + usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX)); + ret = test_https_transfer (cargs->cls, cargs->port, + cargs->cipher_suite, cargs->proto_version); + if (ret == 0) + return NULL; + return &nonnull; +} + +/** + * Test non-parallel requests. + * + * @return: 0 upon all client requests returning '0', -1 otherwise. + * + * TODO : make client_count a parameter - numver of curl client threads to spawn + */ +static int +test_single_client (void *cls, int port, const char *cipher_suite, + int curl_proto_version) +{ + void *client_thread_ret; + struct https_test_data client_args = + { NULL, port, cipher_suite, curl_proto_version }; + (void)cls; /* Unused. Silent compiler warning. */ + + client_thread_ret = https_transfer_thread_adapter (&client_args); + if (client_thread_ret != NULL) + return -1; + return 0; +} + + +/** + * Test parallel request handling. + * + * @return: 0 upon all client requests returning '0', -1 otherwise. + * + * TODO : make client_count a parameter - numver of curl client threads to spawn + */ +static int +test_parallel_clients (void *cls, int port, const char *cipher_suite, + int curl_proto_version) +{ + int i; + int client_count = (CPU_COUNT - 1); + void *client_thread_ret; + pthread_t client_arr[client_count]; + struct https_test_data client_args = + { NULL, port, cipher_suite, curl_proto_version }; + (void)cls; /* Unused. Silent compiler warning. */ + + for (i = 0; i < client_count; ++i) + { + if (pthread_create (&client_arr[i], NULL, + &https_transfer_thread_adapter, &client_args) != 0) + { + fprintf (stderr, "Error: failed to spawn test client threads.\n"); + + return -1; + } + } + + /* check all client requests fulfilled correctly */ + for (i = 0; i < client_count; ++i) + { + if ((pthread_join (client_arr[i], &client_thread_ret) != 0) || + (client_thread_ret != NULL)) + return -1; + } + + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + const char *ssl_version; + int port; + (void)argc; /* Unused. Silent compiler warning. */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3010; + + /* initialize random seed used by curl clients */ + unsigned int iseed = (unsigned int) time (NULL); + +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + srand (iseed); + if (!testsuite_curl_global_init ()) + return 99; + ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version; + if (NULL == ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + if (0 != strncmp (ssl_version, "GnuTLS", 6)) + { + fprintf (stderr, "This test can be run only with libcurl-gnutls.\n"); + curl_global_cleanup (); + return 77; + } + + char *aes256_sha = "AES256-SHA"; + if (curl_uses_nss_ssl() == 0) + { + aes256_sha = "rsa_aes_256_sha"; + } + + errorCount += + test_wrap ("multi threaded daemon, single client", &test_single_client, + NULL, port, + MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, + aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, + srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, + srv_self_signed_cert_pem, MHD_OPTION_END); + + errorCount += + test_wrap ("multi threaded daemon, parallel client", + &test_parallel_clients, NULL, port, + MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, + aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, + srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, + srv_self_signed_cert_pem, MHD_OPTION_END); + + if (errorCount != 0) + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); + + curl_global_cleanup (); + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c new file mode 100644 index 0000000..64be861 --- /dev/null +++ b/src/testcurl/https/test_https_get_select.c @@ -0,0 +1,270 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/** + * @file test_https_get_select.c + * @brief Testcase for libmicrohttpd HTTPS GET operations + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +extern const char srv_key_pem[]; +extern const char srv_self_signed_cert_pem[]; + +static int oneone; + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testExternalGet (int flags) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + const char *aes256_sha = "AES256-SHA"; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3030; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | flags, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + + if (curl_uses_nss_ssl() == 0) + aes256_sha = "rsa_aes_256_sha"; + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + /* TLS options */ + curl_easy_setopt (c, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); + curl_easy_setopt (c, CURLOPT_SSL_CIPHER_LIST, aes256_sha); + curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 0); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 != maxposixs) + { + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + } + else + (void)sleep (1); + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + if (!testsuite_curl_global_init ()) + return 99; + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + +#ifdef EPOLL_SUPPORT + errorCount += testExternalGet (MHD_USE_EPOLL); +#endif + errorCount += testExternalGet (0); + curl_global_cleanup (); + if (errorCount != 0) + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], errorCount); + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/test_https_multi_daemon.c b/src/testcurl/https/test_https_multi_daemon.c new file mode 100644 index 0000000..130fa9d --- /dev/null +++ b/src/testcurl/https/test_https_multi_daemon.c @@ -0,0 +1,171 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/** + * @file mhds_multi_daemon_test.c + * @brief Testcase for libmicrohttpd multiple HTTPS daemon scenario + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +extern const char srv_key_pem[]; +extern const char srv_self_signed_cert_pem[]; + +/* + * assert initiating two separate daemons and having one shut down + * doesn't affect the other + */ +static int +test_concurent_daemon_pair (void *cls, + const char *cipher_suite, + int proto_version) +{ + int ret; + struct MHD_Daemon *d1; + struct MHD_Daemon *d2; + int port1, port2; + (void)cls; /* Unused. Silent compiler warning. */ + + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port1 = port2 = 0; + else + { + port1 = 3050; + port2 = 3051; + } + + d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, port1, + NULL, NULL, &http_ahc, NULL, + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_END); + + if (d1 == NULL) + { + fprintf (stderr, MHD_E_SERVER_INIT); + return -1; + } + if (0 == port1) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d1, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d1); return -1; } + port1 = (int)dinfo->port; + } + + d2 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, port2, + NULL, NULL, &http_ahc, NULL, + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_END); + + if (d2 == NULL) + { + MHD_stop_daemon (d1); + fprintf (stderr, MHD_E_SERVER_INIT); + return -1; + } + if (0 == port2) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d2, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { + MHD_stop_daemon (d1); + MHD_stop_daemon (d2); + return -1; + } + port2 = (int)dinfo->port; + } + + ret = + test_daemon_get (NULL, cipher_suite, proto_version, port1, 0); + ret += + test_daemon_get (NULL, cipher_suite, proto_version, + port2, 0); + + MHD_stop_daemon (d2); + ret += + test_daemon_get (NULL, cipher_suite, proto_version, port1, 0); + MHD_stop_daemon (d1); + return ret; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + FILE *cert; + const char *aes256_sha = "AES256-SHA"; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + +#ifdef MHD_HTTPS_REQUIRE_GRYPT + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + if (!testsuite_curl_global_init ()) + return 99; + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + if ((cert = setup_ca_cert ()) == NULL) + { + fprintf (stderr, MHD_E_TEST_FILE_CREAT); + curl_global_cleanup (); + return 99; + } + + if (curl_uses_nss_ssl() == 0) + { + aes256_sha = "rsa_aes_256_sha"; + } + + errorCount += + test_concurent_daemon_pair (NULL, aes256_sha, CURL_SSLVERSION_TLSv1); + + print_test_result (errorCount, "concurent_daemon_pair"); + + curl_global_cleanup (); + fclose (cert); + if (0 != remove (ca_cert_file_name)) + fprintf (stderr, + "Failed to remove `%s'\n", + ca_cert_file_name); + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c new file mode 100644 index 0000000..a58c7f7 --- /dev/null +++ b/src/testcurl/https/test_https_session_info.c @@ -0,0 +1,225 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2016 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/** + * @file mhds_session_info_test.c + * @brief Testcase for libmicrohttpd HTTPS connection querying operations + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +extern const char srv_key_pem[]; +extern const char srv_self_signed_cert_pem[]; + +struct MHD_Daemon *d; + +/* + * HTTP access handler call back + * used to query negotiated security parameters + */ +static int +query_session_ahc (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, + const char *version, const char *upload_data, + size_t *upload_data_size, void **ptr) +{ + struct MHD_Response *response; + int ret; + (void)cls;(void)url;(void)method;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (NULL == *ptr) + { + *ptr = (void*)&query_session_ahc; + return MHD_YES; + } + + if (GNUTLS_TLS1_1 != + (ret = MHD_get_connection_info + (connection, + MHD_CONNECTION_INFO_PROTOCOL)->protocol)) + { + if (GNUTLS_TLS1_2 == ret) + { + /* as usual, TLS implementations sometimes don't + quite do what was asked, just mildly complain... */ + fprintf (stderr, + "Warning: requested TLS 1.1, got TLS 1.2\n"); + } + else + { + /* really different version... */ + fprintf (stderr, + "Error: requested protocol mismatch (wanted %d, got %d)\n", + GNUTLS_TLS1_1, + ret); + return -1; + } + } + + response = MHD_create_response_from_buffer (strlen (EMPTY_PAGE), + (void *) EMPTY_PAGE, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +/** + * negotiate a secure connection with server & query negotiated security parameters + */ +#if LIBCURL_VERSION_NUM >= 0x072200 +static int +test_query_session () +{ + CURL *c; + struct CBC cbc; + CURLcode errornum; + char url[256]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3060; + + if (NULL == (cbc.buf = malloc (sizeof (char) * 255))) + return 16; + cbc.size = 255; + cbc.pos = 0; + + /* setup test */ + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, port, + NULL, NULL, &query_session_ahc, NULL, + MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128", + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_END); + + if (d == NULL) + { + free (cbc.buf); + return 2; + } + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + + const char *aes256_sha = "AES256-SHA"; + if (curl_uses_nss_ssl() == 0) + { + aes256_sha = "rsa_aes_256_sha"; + } + + gen_test_file_url (url, + sizeof (url), + port); + c = curl_easy_init (); +#if DEBUG_HTTPS_TEST + curl_easy_setopt (c, CURLOPT_VERBOSE, 1); +#endif + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 10L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 10L); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_FILE, &cbc); + /* TLS options */ + curl_easy_setopt (c, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1); + curl_easy_setopt (c, CURLOPT_SSL_CIPHER_LIST, aes256_sha); + /* currently skip any peer authentication */ + curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 0); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + + MHD_stop_daemon (d); + curl_easy_cleanup (c); + free (cbc.buf); + return -1; + } + + curl_easy_cleanup (c); + MHD_stop_daemon (d); + free (cbc.buf); + return 0; +} +#endif + +int +main (int argc, char *const *argv) +{ +#if LIBCURL_VERSION_NUM >= 0x072200 + unsigned int errorCount = 0; + const char *ssl_version; + (void)argc; /* Unused. Silent compiler warning. */ + +#ifdef MHD_HTTPS_REQUIRE_GRYPT + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + if (!testsuite_curl_global_init ()) + return 99; + + ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version; + if (NULL == ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + if (0 != strncmp (ssl_version, "GnuTLS", 6)) + { + fprintf (stderr, "This test can be run only with libcurl-gnutls.\n"); + curl_global_cleanup (); + return 77; + } + errorCount += test_query_session (); + print_test_result (errorCount, argv[0]); + curl_global_cleanup (); + return errorCount != 0 ? 1 : 0; +#else /* LIBCURL_VERSION_NUM < 0x072200 */ + return 77; +#endif /* LIBCURL_VERSION_NUM < 0x072200 */ +} diff --git a/src/testcurl/https/test_https_sni.c b/src/testcurl/https/test_https_sni.c new file mode 100644 index 0000000..6963d62 --- /dev/null +++ b/src/testcurl/https/test_https_sni.c @@ -0,0 +1,323 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2013, 2016 Christian Grothoff + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_https_sni.c + * @brief Testcase for libmicrohttpd HTTPS with SNI operations + * @author Christian Grothoff + */ +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" +#include + +/* This test only works with GnuTLS >= 3.0 */ +#if GNUTLS_VERSION_MAJOR >= 3 + +#include + +/** + * A hostname, server key and certificate. + */ +struct Hosts +{ + struct Hosts *next; + const char *hostname; + gnutls_pcert_st pcrt; + gnutls_privkey_t key; +}; + + +/** + * Linked list of supported TLDs and respective certificates. + */ +static struct Hosts *hosts; + +/* Load the certificate and the private key. + * (This code is largely taken from GnuTLS). + */ +static void +load_keys(const char *hostname, + const char *CERT_FILE, + const char *KEY_FILE) +{ + int ret; + gnutls_datum_t data; + struct Hosts *host; + + host = malloc (sizeof (struct Hosts)); + if (NULL == host) + abort (); + host->hostname = hostname; + host->next = hosts; + hosts = host; + + ret = gnutls_load_file (CERT_FILE, &data); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading certificate file %s.\n", + CERT_FILE); + exit (1); + } + ret = + gnutls_pcert_import_x509_raw (&host->pcrt, &data, GNUTLS_X509_FMT_PEM, + 0); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading certificate file: %s\n", + gnutls_strerror (ret)); + exit (1); + } + gnutls_free (data.data); + + ret = gnutls_load_file (KEY_FILE, &data); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading key file %s.\n", + KEY_FILE); + exit (1); + } + + gnutls_privkey_init (&host->key); + ret = + gnutls_privkey_import_x509_raw (host->key, + &data, GNUTLS_X509_FMT_PEM, + NULL, 0); + if (ret < 0) + { + fprintf (stderr, + "*** Error loading key file: %s\n", + gnutls_strerror (ret)); + exit (1); + } + gnutls_free (data.data); +} + + + +/** + * @param session the session we are giving a cert for + * @param req_ca_dn NULL on server side + * @param nreqs length of req_ca_dn, and thus 0 on server side + * @param pk_algos NULL on server side + * @param pk_algos_length 0 on server side + * @param pcert list of certificates (to be set) + * @param pcert_length length of pcert (to be set) + * @param pkey the private key (to be set) + */ +static int +sni_callback (gnutls_session_t session, + const gnutls_datum_t* req_ca_dn, + int nreqs, + const gnutls_pk_algorithm_t* pk_algos, + int pk_algos_length, + gnutls_pcert_st** pcert, + unsigned int *pcert_length, + gnutls_privkey_t * pkey) +{ + char name[256]; + size_t name_len; + struct Hosts *host; + unsigned int type; + (void)req_ca_dn;(void)nreqs;(void)pk_algos;(void)pk_algos_length; /* Unused. Silent compiler warning. */ + + name_len = sizeof (name); + if (GNUTLS_E_SUCCESS != + gnutls_server_name_get (session, + name, + &name_len, + &type, + 0 /* index */)) + return -1; + for (host = hosts; NULL != host; host = host->next) + if (0 == strncmp (name, host->hostname, name_len)) + break; + if (NULL == host) + { + fprintf (stderr, + "Need certificate for %.*s\n", + (int) name_len, + name); + return -1; + } +#if 0 + fprintf (stderr, + "Returning certificate for %.*s\n", + (int) name_len, + name); +#endif + *pkey = host->key; + *pcert_length = 1; + *pcert = &host->pcrt; + return 0; +} + + +/* perform a HTTP GET request via SSL/TLS */ +static int +do_get (const char *url, int port) +{ + CURL *c; + struct CBC cbc; + CURLcode errornum; + size_t len; + struct curl_slist *dns_info; + char buf[256]; + + len = strlen (test_data); + if (NULL == (cbc.buf = malloc (sizeof (char) * len))) + { + fprintf (stderr, MHD_E_MEM); + return -1; + } + cbc.size = len; + cbc.pos = 0; + + c = curl_easy_init (); +#if DEBUG_HTTPS_TEST + curl_easy_setopt (c, CURLOPT_VERBOSE, 1); +#endif + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 10L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 10L); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_FILE, &cbc); + + /* perform peer authentication */ + /* TODO merge into send_curl_req */ + curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 2); + sprintf(buf, "host1:%d:127.0.0.1", port); + dns_info = curl_slist_append (NULL, buf); + sprintf(buf, "host2:%d:127.0.0.1", port); + dns_info = curl_slist_append (dns_info, buf); + curl_easy_setopt (c, CURLOPT_RESOLVE, dns_info); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + free (cbc.buf); + curl_slist_free_all (dns_info); + return errornum; + } + + curl_easy_cleanup (c); + curl_slist_free_all (dns_info); + if (memcmp (cbc.buf, test_data, len) != 0) + { + fprintf (stderr, "Error: local file & received file differ.\n"); + free (cbc.buf); + return -1; + } + + free (cbc.buf); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int error_count = 0; + struct MHD_Daemon *d; + int port; + (void)argc; /* Unused. Silent compiler warning. */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3060; + +#ifdef MHD_HTTPS_REQUIRE_GRYPT + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + if (!testsuite_curl_global_init ()) + return 99; + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + + load_keys ("host1", ABS_SRCDIR "/host1.crt", ABS_SRCDIR "/host1.key"); + load_keys ("host2", ABS_SRCDIR "/host2.crt", ABS_SRCDIR "/host2.key"); + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, + port, + NULL, NULL, + &http_ahc, NULL, + MHD_OPTION_HTTPS_CERT_CALLBACK, &sni_callback, + MHD_OPTION_END); + if (d == NULL) + { + fprintf (stderr, MHD_E_SERVER_INIT); + return -1; + } + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return -1; } + port = (int)dinfo->port; + } + if (0 != do_get ("https://host1/", port)) + error_count++; + if (0 != do_get ("https://host2/", port)) + error_count++; + + MHD_stop_daemon (d); + curl_global_cleanup (); + if (error_count != 0) + fprintf (stderr, "Failed test: %s, error: %u.\n", argv[0], error_count); + return (0 != error_count) ? 1 : 0; +} + + +#else + +int main (void) +{ + fprintf (stderr, + "SNI not supported by GnuTLS < 3.0\n"); + return 77; +} +#endif diff --git a/src/testcurl/https/test_https_time_out.c b/src/testcurl/https/test_https_time_out.c new file mode 100644 index 0000000..e46923e --- /dev/null +++ b/src/testcurl/https/test_https_time_out.c @@ -0,0 +1,165 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/** + * @file test_https_time_out.c + * @brief: daemon TLS alert response test-case + * + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" +#include "tls_test_common.h" +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "mhd_sockets.h" /* only macros used */ + + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +extern const char srv_key_pem[]; +extern const char srv_self_signed_cert_pem[]; + +static const int TIME_OUT = 3; + +static int +test_tls_session_time_out (gnutls_session_t session, int port) +{ + int ret; + MHD_socket sd; + struct sockaddr_in sa; + + sd = socket (AF_INET, SOCK_STREAM, 0); + if (sd == MHD_INVALID_SOCKET) + { + fprintf (stderr, "Failed to create socket: %s\n", strerror (errno)); + return -1; + } + + memset (&sa, '\0', sizeof (struct sockaddr_in)); + sa.sin_family = AF_INET; + sa.sin_port = htons (port); + sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + + gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) (intptr_t) sd); + + ret = connect (sd, (struct sockaddr *) &sa, sizeof (struct sockaddr_in)); + + if (ret < 0) + { + fprintf (stderr, "Error: %s\n", MHD_E_FAILED_TO_CONNECT); + MHD_socket_close_chk_ (sd); + return -1; + } + + ret = gnutls_handshake (session); + if (ret < 0) + { + fprintf (stderr, "Handshake failed\n"); + MHD_socket_close_chk_ (sd); + return -1; + } + + (void)sleep (TIME_OUT + 1); + + /* check that server has closed the connection */ + /* TODO better RST trigger */ + if (send (sd, "", 1, 0) == 0) + { + fprintf (stderr, "Connection failed to time-out\n"); + MHD_socket_close_chk_ (sd); + return -1; + } + + MHD_socket_close_chk_ (sd); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + int errorCount = 0;; + struct MHD_Daemon *d; + gnutls_session_t session; + gnutls_datum_t key; + gnutls_datum_t cert; + gnutls_certificate_credentials_t xcred; + int port; + (void)argc; /* Unused. Silent compiler warning. */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3070; + +#ifdef MHD_HTTPS_REQUIRE_GRYPT + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + gnutls_global_init (); + gnutls_global_set_log_level (11); + + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, port, + NULL, NULL, &http_dummy_ahc, NULL, + MHD_OPTION_CONNECTION_TIMEOUT, TIME_OUT, + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_END); + + if (NULL == d) + { + fprintf (stderr, MHD_E_SERVER_INIT); + return -1; + } + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return -1; } + port = (int)dinfo->port; + } + + if (0 != setup_session (&session, &key, &cert, &xcred)) + { + fprintf (stderr, "failed to setup session\n"); + return 1; + } + errorCount += test_tls_session_time_out (session, port); + teardown_session (session, &key, &cert, xcred); + + print_test_result (errorCount, argv[0]); + + MHD_stop_daemon (d); + gnutls_global_deinit (); + + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/test_tls_authentication.c b/src/testcurl/https/test_tls_authentication.c new file mode 100644 index 0000000..7a6cd9a --- /dev/null +++ b/src/testcurl/https/test_tls_authentication.c @@ -0,0 +1,129 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/** + * @file tls_authentication_test.c + * @brief Testcase for libmicrohttpd HTTPS GET operations + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +extern const char srv_signed_cert_pem[]; +extern const char srv_signed_key_pem[]; + + + +/* perform a HTTP GET request via SSL/TLS */ +static int +test_secure_get (void * cls, char *cipher_suite, int proto_version) +{ + int ret; + struct MHD_Daemon *d; + int port; + (void)cls; /* Unused. Silent compiler warning. */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3070; + + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | + MHD_USE_ERROR_LOG, port, + NULL, NULL, &http_ahc, NULL, + MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, + MHD_OPTION_END); + + if (d == NULL) + { + fprintf (stderr, MHD_E_SERVER_INIT); + return -1; + } + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return -1; } + port = (int)dinfo->port; + } + + ret = test_daemon_get (NULL, cipher_suite, proto_version, port, 0); + + MHD_stop_daemon (d); + return ret; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + char *aes256_sha = "AES256-SHA"; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + +#ifdef MHD_HTTPS_REQUIRE_GRYPT + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + if (!testsuite_curl_global_init ()) + return 99; + if (NULL == curl_version_info (CURLVERSION_NOW)->ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + curl_global_cleanup (); + return 77; + } + + if (setup_ca_cert () == NULL) + { + fprintf (stderr, MHD_E_TEST_FILE_CREAT); + curl_global_cleanup (); + return 99; + } + + if (curl_uses_nss_ssl() == 0) + { + aes256_sha = "rsa_aes_256_sha"; + } + + errorCount += + test_secure_get (NULL, aes256_sha, CURL_SSLVERSION_TLSv1); + + print_test_result (errorCount, argv[0]); + + curl_global_cleanup (); + if (0 != remove (ca_cert_file_name)) + fprintf (stderr, + "Failed to remove `%s'\n", + ca_cert_file_name); + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/test_tls_options.c b/src/testcurl/https/test_tls_options.c new file mode 100644 index 0000000..e3b427d --- /dev/null +++ b/src/testcurl/https/test_tls_options.c @@ -0,0 +1,167 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2010, 2016 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file tls_daemon_options_test.c + * @brief Testcase for libmicrohttpd HTTPS GET operations + * @author Sagie Amir + */ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#include +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +#include "tls_test_common.h" + +extern const char srv_key_pem[]; +extern const char srv_self_signed_cert_pem[]; + +int curl_check_version (const char *req_version, ...); + +/** + * test server refuses to negotiate connections with unsupported protocol versions + * + */ +static int +test_unmatching_ssl_version (void * cls, int port, const char *cipher_suite, + int curl_req_ssl_version) +{ + struct CBC cbc; + (void)cls; /* Unused. Silent compiler warning. */ + if (NULL == (cbc.buf = malloc (sizeof (char) * 256))) + { + fprintf (stderr, "Error: failed to allocate: %s\n", + strerror (errno)); + return -1; + } + cbc.size = 256; + cbc.pos = 0; + + char url[255]; + if (gen_test_file_url (url, + sizeof (url), + port)) + { + free (cbc.buf); + fprintf (stderr, + "Internal error in gen_test_file_url\n"); + return -1; + } + + /* assert daemon *rejected* request */ + if (CURLE_OK == + send_curl_req (url, &cbc, cipher_suite, curl_req_ssl_version)) + { + free (cbc.buf); + fprintf (stderr, "cURL failed to reject request despite SSL version missmatch!\n"); + return -1; + } + + free (cbc.buf); + return 0; +} + + +/* setup a temporary transfer test file */ +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + const char *ssl_version; + int daemon_flags = + MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG; + int port; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 3010; + +#ifdef MHD_HTTPS_REQUIRE_GRYPT + gcry_control (GCRYCTL_DISABLE_SECMEM, 0); + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + if (curl_check_version (MHD_REQ_CURL_VERSION)) + { + return 77; + } + ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version; + if (NULL == ssl_version) + { + fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n"); + return 77; + } + if (0 != strncmp (ssl_version, "GnuTLS", 6)) + { + fprintf (stderr, "This test can be run only with libcurl-gnutls.\n"); + return 77; + } + + if (!testsuite_curl_global_init ()) + return 99; + + const char *aes128_sha = "AES128-SHA"; + const char *aes256_sha = "AES256-SHA"; + if (curl_uses_nss_ssl() == 0) + { + aes128_sha = "rsa_aes_128_sha"; + aes256_sha = "rsa_aes_256_sha"; + } + + + if (0 != + test_wrap ("TLS1.0-AES-SHA1", + &test_https_transfer, NULL, port, daemon_flags, + aes128_sha, + CURL_SSLVERSION_TLSv1, + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+AES-128-CBC:+SHA1:+RSA:+COMP-NULL", + MHD_OPTION_END)) + { + fprintf (stderr, "TLS1.0-AES-SHA1 test failed\n"); + errorCount++; + } + fprintf (stderr, + "The following handshake should fail (and print an error message)...\n"); + if (0 != + test_wrap ("TLS1.0 vs SSL3", + &test_unmatching_ssl_version, NULL, port, daemon_flags, + aes256_sha, + CURL_SSLVERSION_SSLv3, + MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, + MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, + MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+AES-256-CBC:+SHA1:+RSA:+COMP-NULL", + MHD_OPTION_END)) + { + fprintf (stderr, "TLS1.0 vs SSL3 test failed\n"); + errorCount++; + } + curl_global_cleanup (); + + return errorCount != 0 ? 1 : 0; +} diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c new file mode 100644 index 0000000..a3a7df2 --- /dev/null +++ b/src/testcurl/https/tls_test_common.c @@ -0,0 +1,546 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +/** + * @file tls_test_common.c + * @brief Common tls test functions + * @author Sagie Amir + */ +#include "tls_test_common.h" +#include "tls_test_keys.h" + + +FILE * +setup_ca_cert () +{ + FILE *cert_fd; + + if (NULL == (cert_fd = fopen (ca_cert_file_name, "wb+"))) + { + fprintf (stderr, "Error: failed to open `%s': %s\n", + ca_cert_file_name, strerror (errno)); + return NULL; + } + if (fwrite (ca_cert_pem, sizeof (char), strlen (ca_cert_pem) + 1, cert_fd) + != strlen (ca_cert_pem) + 1) + { + fprintf (stderr, "Error: failed to write `%s. %s'\n", + ca_cert_file_name, strerror (errno)); + fclose (cert_fd); + return NULL; + } + if (fflush (cert_fd)) + { + fprintf (stderr, "Error: failed to flush ca cert file stream. %s\n", + strerror (errno)); + fclose (cert_fd); + return NULL; + } + return cert_fd; +} + + +/* + * test HTTPS transfer + */ +int +test_daemon_get (void *cls, + const char *cipher_suite, int proto_version, + int port, + int ver_peer) +{ + CURL *c; + struct CBC cbc; + CURLcode errornum; + char url[255]; + size_t len; + (void)cls; /* Unused. Silent compiler warning. */ + + len = strlen (test_data); + if (NULL == (cbc.buf = malloc (sizeof (char) * len))) + { + fprintf (stderr, MHD_E_MEM); + return -1; + } + cbc.size = len; + cbc.pos = 0; + + /* construct url - this might use doc_path */ + gen_test_file_url (url, + sizeof (url), + port); + + c = curl_easy_init (); +#if DEBUG_HTTPS_TEST + curl_easy_setopt (c, CURLOPT_VERBOSE, 1); +#endif + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 10L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 10L); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_FILE, &cbc); + + /* TLS options */ + curl_easy_setopt (c, CURLOPT_SSLVERSION, proto_version); + curl_easy_setopt (c, CURLOPT_SSL_CIPHER_LIST, cipher_suite); + + /* perform peer authentication */ + /* TODO merge into send_curl_req */ + curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, ver_peer); + if (ver_peer) + curl_easy_setopt (c, CURLOPT_CAINFO, ca_cert_file_name); + curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 0); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + free (cbc.buf); + return errornum; + } + + curl_easy_cleanup (c); + + if (memcmp (cbc.buf, test_data, len) != 0) + { + fprintf (stderr, "Error: local file & received file differ.\n"); + free (cbc.buf); + return -1; + } + + free (cbc.buf); + return 0; +} + + +void +print_test_result (int test_outcome, char *test_name) +{ + if (test_outcome != 0) + fprintf (stderr, "running test: %s [fail: %u]\n", test_name, (unsigned int)test_outcome); +#if 0 + else + fprintf (stdout, "running test: %s [pass]\n", test_name); +#endif +} + +size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +/** + * HTTP access handler call back + */ +int +http_ahc (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + struct MHD_Response *response; + int ret; + (void)cls;(void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (method, MHD_HTTP_METHOD_GET)) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + *ptr = NULL; /* reset when done */ + response = MHD_create_response_from_buffer (strlen (test_data), + (void *) test_data, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + +/* HTTP access handler call back */ +int +http_dummy_ahc (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, const char *version, + const char *upload_data, size_t *upload_data_size, + void **ptr) +{ + (void)cls;(void)connection;(void)url;(void)method;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size;(void)ptr; /* Unused. Silent compiler warning. */ + return 0; +} + +/** + * send a test http request to the daemon + * @param url + * @param cbc - may be null + * @param cipher_suite + * @param proto_version + * @return + */ +/* TODO have test wrap consider a NULL cbc */ +int +send_curl_req (char *url, struct CBC * cbc, const char *cipher_suite, + int proto_version) +{ + CURL *c; + CURLcode errornum; + c = curl_easy_init (); +#if DEBUG_HTTPS_TEST + curl_easy_setopt (c, CURLOPT_VERBOSE, CURL_VERBOS_LEVEL); +#endif + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 60L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 60L); + + if (cbc != NULL) + { + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_FILE, cbc); + } + + /* TLS options */ + curl_easy_setopt (c, CURLOPT_SSLVERSION, proto_version); + curl_easy_setopt (c, CURLOPT_SSL_CIPHER_LIST, cipher_suite); + + /* currently skip any peer authentication */ + curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 0); + + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + return errornum; + } + curl_easy_cleanup (c); + + return CURLE_OK; +} + + +/** + * compile test file url pointing to the current running directory path + * + * @param[out] url - char buffer into which the url is compiled + * @param url_len number of bytes available in url + * @param port port to use for the test + * @return -1 on error + */ +int +gen_test_file_url (char *url, + size_t url_len, + int port) +{ + int ret = 0; + char *doc_path; + size_t doc_path_len; + /* setup test file path, url */ +#ifdef PATH_MAX + doc_path_len = PATH_MAX > 4096 ? 4096 : PATH_MAX; +#else /* ! PATH_MAX */ + doc_path_len = 4096; +#endif /* ! PATH_MAX */ +#ifdef WINDOWS + size_t i; +#endif /* ! WINDOWS */ + if (NULL == (doc_path = malloc (doc_path_len))) + { + fprintf (stderr, MHD_E_MEM); + return -1; + } + if (NULL == getcwd (doc_path, doc_path_len)) + { + fprintf (stderr, + "Error: failed to get working directory. %s\n", + strerror (errno)); + free (doc_path); + return -1; + } +#ifdef WINDOWS + for (i = 0; i < doc_path_len; i++) + { + if (doc_path[i] == 0) + break; + if (doc_path[i] == '\\') + { + doc_path[i] = '/'; + } + if (doc_path[i] != ':') + continue; + if (i == 0) + break; + doc_path[i] = doc_path[i - 1]; + doc_path[i - 1] = '/'; + } +#endif + /* construct url */ + if (snprintf (url, + url_len, + "%s:%d%s/%s", + "https://127.0.0.1", + port, + doc_path, + "urlpath") >= (long long)url_len) + ret = -1; + + free (doc_path); + return ret; +} + + +/** + * test HTTPS file transfer + */ +int +test_https_transfer (void *cls, + int port, + const char *cipher_suite, + int proto_version) +{ + int len; + int ret = 0; + struct CBC cbc; + char url[255]; + (void)cls; /* Unused. Silent compiler warning. */ + + len = strlen (test_data); + if (NULL == (cbc.buf = malloc (sizeof (char) * len))) + { + fprintf (stderr, MHD_E_MEM); + return -1; + } + cbc.size = len; + cbc.pos = 0; + + if (gen_test_file_url (url, + sizeof (url), + port)) + { + ret = -1; + goto cleanup; + } + + if (CURLE_OK != + send_curl_req (url, &cbc, cipher_suite, proto_version)) + { + ret = -1; + goto cleanup; + } + + /* compare test file & daemon responce */ + if ( (len != strlen (test_data)) || + (memcmp (cbc.buf, + test_data, + len) != 0) ) + { + fprintf (stderr, "Error: local file & received file differ.\n"); + ret = -1; + } +cleanup: + free (cbc.buf); + return ret; +} + +/** + * setup test case + * + * @param d + * @param daemon_flags + * @param arg_list + * @return port number on success or zero on failure + */ +int +setup_testcase (struct MHD_Daemon **d, int port, int daemon_flags, va_list arg_list) +{ + *d = MHD_start_daemon_va (daemon_flags, port, + NULL, NULL, &http_ahc, NULL, arg_list); + + if (*d == NULL) + { + fprintf (stderr, MHD_E_SERVER_INIT); + return 0; + } + + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (*d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { + MHD_stop_daemon (*d); + return 0; + } + port = (int)dinfo->port; + } + + return port; +} + +void +teardown_testcase (struct MHD_Daemon *d) +{ + MHD_stop_daemon (d); +} + +int +setup_session (gnutls_session_t * session, + gnutls_datum_t * key, + gnutls_datum_t * cert, + gnutls_certificate_credentials_t * xcred) +{ + int ret; + const char *err_pos; + + gnutls_certificate_allocate_credentials (xcred); + key->size = strlen (srv_key_pem) + 1; + key->data = malloc (key->size); + if (NULL == key->data) + { + gnutls_certificate_free_credentials (*xcred); + return -1; + } + memcpy (key->data, srv_key_pem, key->size); + cert->size = strlen (srv_self_signed_cert_pem) + 1; + cert->data = malloc (cert->size); + if (NULL == cert->data) + { + gnutls_certificate_free_credentials (*xcred); + free (key->data); + return -1; + } + memcpy (cert->data, srv_self_signed_cert_pem, cert->size); + gnutls_certificate_set_x509_key_mem (*xcred, cert, key, + GNUTLS_X509_FMT_PEM); + gnutls_init (session, GNUTLS_CLIENT); + ret = gnutls_priority_set_direct (*session, + "NORMAL", &err_pos); + if (ret < 0) + { + gnutls_deinit (*session); + gnutls_certificate_free_credentials (*xcred); + free (key->data); + return -1; + } + gnutls_credentials_set (*session, + GNUTLS_CRD_CERTIFICATE, + *xcred); + return 0; +} + +int +teardown_session (gnutls_session_t session, + gnutls_datum_t * key, + gnutls_datum_t * cert, + gnutls_certificate_credentials_t xcred) +{ + free (key->data); + key->data = NULL; + key->size = 0; + free (cert->data); + cert->data = NULL; + cert->size = 0; + gnutls_deinit (session); + gnutls_certificate_free_credentials (xcred); + return 0; +} + +/* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */ +int +test_wrap (const char *test_name, int + (*test_function) (void * cls, int port, const char *cipher_suite, + int proto_version), void * cls, + int port, + int daemon_flags, const char *cipher_suite, int proto_version, ...) +{ + int ret; + va_list arg_list; + struct MHD_Daemon *d; + (void)cls; /* Unused. Silent compiler warning. */ + + va_start (arg_list, proto_version); + port = setup_testcase (&d, port, daemon_flags, arg_list); + if (0 == port) + { + va_end (arg_list); + fprintf (stderr, "Failed to setup testcase %s\n", test_name); + return -1; + } +#if 0 + fprintf (stdout, "running test: %s ", test_name); +#endif + ret = test_function (NULL, port, cipher_suite, proto_version); +#if 0 + if (ret == 0) + { + fprintf (stdout, "[pass]\n"); + } + else + { + fprintf (stdout, "[fail]\n"); + } +#endif + teardown_testcase (d); + va_end (arg_list); + return ret; +} + +int testsuite_curl_global_init (void) +{ + CURLcode res; +#if LIBCURL_VERSION_NUM >= 0x073800 + if (CURLSSLSET_OK != curl_global_sslset(CURLSSLBACKEND_GNUTLS, NULL, NULL)) + { + if (CURLSSLSET_TOO_LATE == curl_global_sslset(CURLSSLBACKEND_OPENSSL, NULL, NULL)) + fprintf (stderr, "WARNING: libcurl was already initialised.\n"); + } +#endif /* LIBCURL_VERSION_NUM >= 0x07380 */ + res = curl_global_init (CURL_GLOBAL_ALL); + if (CURLE_OK != res) + { + fprintf (stderr, "libcurl initialisation error: %s\n", curl_easy_strerror(res)); + return 0; + } + return 1; +} diff --git a/src/testcurl/https/tls_test_common.h b/src/testcurl/https/tls_test_common.h new file mode 100644 index 0000000..490239e --- /dev/null +++ b/src/testcurl/https/tls_test_common.h @@ -0,0 +1,155 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#ifndef TLS_TEST_COMMON_H_ +#define TLS_TEST_COMMON_H_ + +#include "platform.h" +#include "microhttpd.h" +#include +#include +#include +#include + +/* this enables verbos CURL version checking */ +#define DEBUG_HTTPS_TEST 0 +#define CURL_VERBOS_LEVEL 0 + +#define test_data "Hello World\n" +#define ca_cert_file_name "tmp_ca_cert.pem" + +#define EMPTY_PAGE "Empty pageEmpty page" +#define PAGE_NOT_FOUND "File not foundFile not found" + +#define MHD_E_MEM "Error: memory error\n" +#define MHD_E_SERVER_INIT "Error: failed to start server\n" +#define MHD_E_TEST_FILE_CREAT "Error: failed to setup test file\n" +#define MHD_E_CERT_FILE_CREAT "Error: failed to setup test certificate\n" +#define MHD_E_KEY_FILE_CREAT "Error: failed to setup test certificate\n" +#define MHD_E_FAILED_TO_CONNECT "Error: server connection could not be established\n" + +/* TODO rm if unused */ +struct https_test_data +{ + void *cls; + int port; + const char *cipher_suite; + int proto_version; +}; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +struct CipherDef +{ + int options[2]; + char *curlname; +}; + + +int +curl_check_version (const char *req_version, ...); + +int +curl_uses_nss_ssl (void); + + +FILE * +setup_ca_cert (void); + +/** + * perform cURL request for file + */ +int +test_daemon_get (void * cls, + const char *cipher_suite, int proto_version, + int port, int ver_peer); + +void +print_test_result (int test_outcome, char *test_name); + +size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx); + +int +http_ahc (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, const char *upload_data, + const char *version, size_t *upload_data_size, void **ptr); + +int +http_dummy_ahc (void *cls, struct MHD_Connection *connection, + const char *url, const char *method, const char *upload_data, + const char *version, size_t *upload_data_size, + void **ptr); + + +/** + * compile test file url pointing to the current running directory path + * + * @param[out] url - char buffer into which the url is compiled + * @param url_len number of bytes available in @a url + * @param port port to use for the test + * @return -1 on error + */ +int +gen_test_file_url (char *url, + size_t url_len, + int port); + +int +send_curl_req (char *url, struct CBC *cbc, const char *cipher_suite, + int proto_version); + +int +test_https_transfer (void *cls, int port, const char *cipher_suite, int proto_version); + +int +setup_testcase (struct MHD_Daemon **d, int port, int daemon_flags, va_list arg_list); + +void +teardown_testcase (struct MHD_Daemon *d); + + +int +setup_session (gnutls_session_t * session, + gnutls_datum_t * key, + gnutls_datum_t * cert, + gnutls_certificate_credentials_t * xcred); + +int +teardown_session (gnutls_session_t session, + gnutls_datum_t * key, + gnutls_datum_t * cert, + gnutls_certificate_credentials_t xcred); + +int +test_wrap (const char *test_name, int + (*test_function) (void * cls, int port, const char *cipher_suite, + int proto_version), void * cls, + int port, + int daemon_flags, const char *cipher_suite, int proto_version, ...); + +int testsuite_curl_global_init (void); + +#endif /* TLS_TEST_COMMON_H_ */ diff --git a/src/testcurl/https/tls_test_keys.h b/src/testcurl/https/tls_test_keys.h new file mode 100644 index 0000000..b6e37ee --- /dev/null +++ b/src/testcurl/https/tls_test_keys.h @@ -0,0 +1,173 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2006, 2007, 2008 Christian Grothoff (and other contributing authors) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MHD_TLS_TEST_KEYS_H +#define MHD_TLS_TEST_KEYS_H + +/* Test Certificates */ + +/* Certificate Authority key */ +const char ca_key_pem[] = "-----BEGIN RSA PRIVATE KEY-----\n" + "MIIEowIBAAKCAQEA0EdlP613rjFvEj93tGo9fzBoKWU3CW+AbbfcJ397C89MyZ9J\n" + "rlxyLGfa6qVX7CFVNmzgWWfcl2tHlw/fZmWtf/SFgrlkldvuGyY8H3n2HuMsWz/E\n" + "h7n5VgwBX8NsP4eZNmikepxpr1mYx25K8FjnsKjAR9jGUSV8UfZ7VLIY0x/yqe+3\n" + "32oqc4D/wJbV1AwwvC5Xf9rvHJwcZg57eqbDCL/4GDDk7d9Gark4XK6ZG+FnnxQn\n" + "4a4jIdf4FoPp9s0EieHrHwYzs/uBqmfCSF4wXiaO8bmEwtbAsVbZH74Le7ggUbEe\n" + "o+jan9XK0dE88AIImGzgoBnlic/Rr7J8OWA+iwIDAQABAoIBAEICZqXkUdpsw2F6\n" + "qPMOergNPO3lrKg6ZO8hBs6j2fj3tcPuzljK5sqJDboxNejZ9Zo+rmnXf3Oj5fgL\n" + "6UcYMYEsm4W/QRA3uEJ1fzeQnT7Ty9KNprlHaSzquCLEGlIWJSo3xu0vFlWjJUcL\n" + "fwemfaOhD/OVUeEU6s5FOngwy6pZUsOajs3fNRtwBGuuXjniKZZlpSf2Wqu3xpHZ\n" + "31OF1V0ycUCGPPFtpmUCtnZhS9L8QBTkNtfTIdXv6SfoBRFm0oXb0uL5HGft6yc7\n" + "eYRXIscllQciqG3ymJ/y9o0E3A0YsBVauQyi7OEk+Kg8uoYOBkZCIY69hoN2Znlk\n" + "OY5S5Z0CgYEA3j8pRAJzvc827KcX4vJf05HYD4aCyaI80fNmx1DgXfglTSGLQ361\n" + "6i05YW8WtIvgkma3wF+jJOckBCW/7iq8wAX7Kz75WKGRyyTEb0wSfjx0G8grxX4d\n" + "7sTIAAOnQj5WT6E/bkqxQZAYnVtIPxKtSlwts0H/bjPVYwSFchHK7t8CgYEA7+ks\n" + "C0EMjF8CDeCfvbOUGiiqAvU3G20LEC3WlJM3AU+J9Jzp6AMkgaIA8J5oNdsbFBn4\n" + "N12JPOO+7WRUk6Av8bsh4faE36ThnHohgAL8guRU7jIXvsFyO5yiY7/o/0lES0/V\n" + "6xkh/Epj4MReuCGkiD9ifCVAo+dhHskeE9qbYdUCgYA4yBpa7eV0UUTPIcHQkew5\n" + "ucFh9hPkQDcZzP4tXlR0rbmaAz/5dp4zvmoyopdCeZpezS+VTtn3y7Y/+QUYbILc\n" + "7KpHWkeKhX0iUbp+VQlEh12C25mTU62CG3SdzFEnc5XJsoDqRNsUzSP80B2dP8BW\n" + "h0aFzg7csRGLwtP1WOZoMQKBgQCrgsKd+Q8Dexh421DXyX3jhZalLrEKxlXWZy60\n" + "YNo98aLqYRNHbpe2pR6O5nARsGYXZMlyq0flY9um0sc0Epyz79g1NoufZrxzpUw1\n" + "u+zRlnKxJtaa5KjJvRzKuvPTLYnJXXXM8Na/Cl+E3F3qvQJm9QlvPyKLCmsAGz+J\n" + "agsTUQKBgC0wqqJ6b1tbrAD8AVeeAn/IiP1rxYpc3x2s6ikFO2FMHXHC9wgrRPOc\n" + "mkokV+DrUOv3I/7jG8wQA/FmBUPy562a1bObIKzg6CPXzrN68AmNnOIVU+H8fdxI\n" + "iGyfT8WNpcRmtN11v34qXHwOWGQhpyyk2yNa8VIBSpkShq/EseZ1\n" + "-----END RSA PRIVATE KEY-----\n"; + +/* Certificate Authority cert */ +const char ca_cert_pem[] = "-----BEGIN CERTIFICATE-----\n" + "MIIC6DCCAdKgAwIBAgIES0KCvTALBgkqhkiG9w0BAQUwFzEVMBMGA1UEAxMMdGVz\n" + "dF9jYV9jZXJ0MB4XDTEwMDEwNTAwMDcyNVoXDTQ1MDMxMjAwMDcyNVowFzEVMBMG\n" + "A1UEAxMMdGVzdF9jYV9jZXJ0MIIBHzALBgkqhkiG9w0BAQEDggEOADCCAQkCggEA\n" + "0EdlP613rjFvEj93tGo9fzBoKWU3CW+AbbfcJ397C89MyZ9JrlxyLGfa6qVX7CFV\n" + "NmzgWWfcl2tHlw/fZmWtf/SFgrlkldvuGyY8H3n2HuMsWz/Eh7n5VgwBX8NsP4eZ\n" + "Nmikepxpr1mYx25K8FjnsKjAR9jGUSV8UfZ7VLIY0x/yqe+332oqc4D/wJbV1Aww\n" + "vC5Xf9rvHJwcZg57eqbDCL/4GDDk7d9Gark4XK6ZG+FnnxQn4a4jIdf4FoPp9s0E\n" + "ieHrHwYzs/uBqmfCSF4wXiaO8bmEwtbAsVbZH74Le7ggUbEeo+jan9XK0dE88AII\n" + "mGzgoBnlic/Rr7J8OWA+iwIDAQABo0MwQTAPBgNVHRMBAf8EBTADAQH/MA8GA1Ud\n" + "DwEB/wQFAwMHBAAwHQYDVR0OBBYEFP2olB4s2T/xuoQ5pT2RKojFwZo2MAsGCSqG\n" + "SIb3DQEBBQOCAQEAebD5m+vZkVXa8y+QZ5GtsiR9gpH+LKtdWBjk1kmfSgvQI/xA\n" + "aDCV/9BhdNGIBOTYGkln8urWd7g2Mj3TwKEAfNTUFpAsrBAlSSLTGYCSt72S2NsS\n" + "L/qUxmj1W6X95UHXCo49mSZx3LlaY3mz1L87gq/kK0XpzA3g2uF25jt84RvshsXy\n" + "clOc+eRrVETqFZqer96WB7kzFTv+qmROQKmW8X4a2A5r5Jl4vRwOz5/rEeB9Qs0K\n" + "rmK8+5HgvWd80WB8BtfFtZfoY/hHVM8nLD3ELVJrOKiTeIACunQFyT5lV0QkdmSA\n" + "CGInU7jzs8nu+s2avf6j+eVZUbVJ+dFMApTJgg==\n" + "-----END CERTIFICATE-----\n"; + +/* test server CA signed certificates */ +const char srv_signed_cert_pem[] = "-----BEGIN CERTIFICATE-----\n" + "MIIDGzCCAgWgAwIBAgIES0KCvTALBgkqhkiG9w0BAQUwFzEVMBMGA1UEAxMMdGVz\n" + "dF9jYV9jZXJ0MB4XDTEwMDEwNTAwMDcyNVoXDTQ1MDMxMjAwMDcyNVowFzEVMBMG\n" + "A1UEAxMMdGVzdF9jYV9jZXJ0MIIBHzALBgkqhkiG9w0BAQEDggEOADCCAQkCggEA\n" + "vfTdv+3fgvVTKRnP/HVNG81cr8TrUP/iiyuve/THMzvFXhCW+K03KwEku55QvnUn\n" + "dwBfU/ROzLlv+5hotgiDRNFT3HxurmhouySBrJNJv7qWp8ILq4sw32vo0fbMu5BZ\n" + "F49bUXK9L3kW2PdhTtSQPWHEzNrCxO+YgCilKHkY3vQNfdJ020Q5EAAEseD1YtWC\n" + "IpRvJzYlZMpjYB1ubTl24kwrgOKUJYKqM4jmF4DVQp4oOK/6QYGGh1QmHRPAy3CB\n" + "II6sbb+sZT9cAqU6GYQVB35lm4XAgibXV6KgmpVxVQQ69U6xyoOl204xuekZOaG9\n" + "RUPId74Rtmwfi1TLbBzo2wIDAQABo3YwdDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQM\n" + "MAoGCCsGAQUFBwMBMA8GA1UdDwEB/wQFAwMHIAAwHQYDVR0OBBYEFOFi4ilKOP1d\n" + "XHlWCMwmVKr7mgy8MB8GA1UdIwQYMBaAFP2olB4s2T/xuoQ5pT2RKojFwZo2MAsG\n" + "CSqGSIb3DQEBBQOCAQEAHVWPxazupbOkG7Did+dY9z2z6RjTzYvurTtEKQgzM2Vz\n" + "GQBA+3pZ3c5mS97fPIs9hZXfnQeelMeZ2XP1a+9vp35bJjZBBhVH+pqxjCgiUflg\n" + "A3Zqy0XwwVCgQLE2HyaU3DLUD/aeIFK5gJaOSdNTXZLv43K8kl4cqDbMeRpVTbkt\n" + "YmG4AyEOYRNKGTqMEJXJoxD5E3rBUNrVI/XyTjYrulxbNPcMWEHKNeeqWpKDYTFo\n" + "Bb01PCthGXiq/4A2RLAFosadzRa8SBpoSjPPfZ0b2w4MJpReHqKbR5+T2t6hzml6\n" + "4ToyOKPDmamiTuN5KzLN3cw7DQlvWMvqSOChPLnA3Q==\n" + "-----END CERTIFICATE-----\n"; + +/* test server key */ +const char srv_signed_key_pem[] = "-----BEGIN RSA PRIVATE KEY-----\n" + "MIIEowIBAAKCAQEAvfTdv+3fgvVTKRnP/HVNG81cr8TrUP/iiyuve/THMzvFXhCW\n" + "+K03KwEku55QvnUndwBfU/ROzLlv+5hotgiDRNFT3HxurmhouySBrJNJv7qWp8IL\n" + "q4sw32vo0fbMu5BZF49bUXK9L3kW2PdhTtSQPWHEzNrCxO+YgCilKHkY3vQNfdJ0\n" + "20Q5EAAEseD1YtWCIpRvJzYlZMpjYB1ubTl24kwrgOKUJYKqM4jmF4DVQp4oOK/6\n" + "QYGGh1QmHRPAy3CBII6sbb+sZT9cAqU6GYQVB35lm4XAgibXV6KgmpVxVQQ69U6x\n" + "yoOl204xuekZOaG9RUPId74Rtmwfi1TLbBzo2wIDAQABAoIBADu09WSICNq5cMe4\n" + "+NKCLlgAT1NiQpLls1gKRbDhKiHU9j8QWNvWWkJWrCya4QdUfLCfeddCMeiQmv3K\n" + "lJMvDs+5OjJSHFoOsGiuW2Ias7IjnIojaJalfBml6frhJ84G27IXmdz6gzOiTIer\n" + "DjeAgcwBaKH5WwIay2TxIaScl7AwHBauQkrLcyb4hTmZuQh6ArVIN6+pzoVuORXM\n" + "bpeNWl2l/HSN3VtUN6aCAKbN/X3o0GavCCMn5Fa85uJFsab4ss/uP+2PusU71+zP\n" + "sBm6p/2IbGvF5k3VPDA7X5YX61sukRjRBihY8xSnNYx1UcoOsX6AiPnbhifD8+xQ\n" + "Tlf8oJUCgYEA0BTfzqNpr9Wxw5/QXaSdw7S/0eP5a0C/nwURvmfSzuTD4equzbEN\n" + "d+dI/s2JMxrdj/I4uoAfUXRGaabevQIjFzC9uyE3LaOyR2zhuvAzX+vVcs6bSXeU\n" + "pKpCAcN+3Z3evMaX2f+z/nfSUAl2i4J2R+/LQAWJW4KwRky/m+cxpfUCgYEA6bN1\n" + "b73bMgM8wpNt6+fcmS+5n0iZihygQ2U2DEud8nZJL4Nrm1dwTnfZfJBnkGj6+0Q0\n" + "cOwj2KS0/wcEdJBP0jucU4v60VMhp75AQeHqidIde0bTViSRo3HWKXHBIFGYoU3T\n" + "LyPyKndbqsOObnsFXHn56Nwhr2HLf6nw4taGQY8CgYBoSW36FLCNbd6QGvLFXBGt\n" + "2lMhEM8az/K58kJ4WXSwOLtr6MD/WjNT2tkcy0puEJLm6BFCd6A6pLn9jaKou/92\n" + "SfltZjJPb3GUlp9zn5tAAeSSi7YMViBrfuFiHObij5LorefBXISLjuYbMwL03MgH\n" + "Ocl2JtA2ywMp2KFXs8GQWQKBgFyIVv5ogQrbZ0pvj31xr9HjqK6d01VxIi+tOmpB\n" + "4ocnOLEcaxX12BzprW55ytfOCVpF1jHD/imAhb3YrHXu0fwe6DXYXfZV4SSG2vB7\n" + "IB9z14KBN5qLHjNGFpMQXHSMek+b/ftTU0ZnPh9uEM5D3YqRLVd7GcdUhHvG8P8Q\n" + "C9aXAoGBAJtID6h8wOGMP0XYX5YYnhlC7dOLfk8UYrzlp3xhqVkzKthTQTj6wx9R\n" + "GtC4k7U1ki8oJsfcIlBNXd768fqDVWjYju5rzShMpo8OCTS6ipAblKjCxPPVhIpv\n" + "tWPlbSn1qj6wylstJ5/3Z+ZW5H4wIKp5jmLiioDhcP0L/Ex3Zx8O\n" + "-----END RSA PRIVATE KEY-----\n"; + +/* test server self signed certificates */ +const char srv_self_signed_cert_pem[] = "-----BEGIN CERTIFICATE-----\n" + "MIIC+jCCAeSgAwIBAgIES0KCvTALBgkqhkiG9w0BAQUwFzEVMBMGA1UEAxMMdGVz\n" + "dF9jYV9jZXJ0MB4XDTEwMDEwNTAwMDcyNVoXDTQ1MDMxMjAwMDcyNVowFzEVMBMG\n" + "A1UEAxMMdGVzdF9jYV9jZXJ0MIIBHzALBgkqhkiG9w0BAQEDggEOADCCAQkCggEA\n" + "tDEagv3p9OUhUL55jMucxjNK9N5cuozhcnrwDfBSU6oVrqm5kPqO1I7Cggzw68Y5\n" + "jhTcBi4FXmYOZppm1R3MhSJ5JSi/67Q7X4J5rnJLXYGN27qjMpnoGQ/2xmsNG/is\n" + "i+h/2vbtPU+WP9SEJnTfPLLpZ7KqCAk7FUUzKsuLx3/SOKtdkrWxPKwYTgnDEN6D\n" + "JL7tEzCnG5DFc4mQ7YW9PaRdC3rS1T8PvQ3jB2BUnohM0cFvKRuiU35tU7h7CPbL\n" + "4L66VglXoiwqmgcrwI2U968bD0+wRQ5c5bzNoshJOzN6CTMh1IhbklSh/Z6FA/e8\n" + "hj0yVo2tdllXuJGVs3PIEwIDAQABo1UwUzAMBgNVHRMBAf8EAjAAMBMGA1UdJQQM\n" + "MAoGCCsGAQUFBwMBMA8GA1UdDwEB/wQFAwMHIAAwHQYDVR0OBBYEFDfU7pAv9LYn\n" + "n7jb4WHl4+Vgi2FnMAsGCSqGSIb3DQEBBQOCAQEAkaembPQMmv6OOjbIod8zTatr\n" + "x5Bwkwp3TOE1NRyy2OytzFIYRUkNrZYlcmrxcbNNycIK41CNVXbriFCF8gcmIq9y\n" + "vaKZn8Gcy+vGggv+1BP9IAPBGKRwSi0wmq9JoGE8hx+qqTpRSdfbM/cps/09hicO\n" + "0EIR7kWEbvnpMBcMKYOtYE9Gce7rdSMWVAsKc174xn8vW6TxCUvmWFv5DPg5HG1v\n" + "y1SUX73qafRo+W6FN4UC/DHfwRhF8RSKEnVbmgDVCs6GHdKBjU2qRgYyj6nWZqK1\n" + "XFUTWgia+Fl3D9vlsXaFcSZKA0Bq1eojl0B0AfeYAxTFwPWXscKvt/bXZfH8bg==\n" + "-----END CERTIFICATE-----\n"; + +/* test server key */ +const char srv_key_pem[] = "-----BEGIN RSA PRIVATE KEY-----\n" + "MIIEpAIBAAKCAQEAtDEagv3p9OUhUL55jMucxjNK9N5cuozhcnrwDfBSU6oVrqm5\n" + "kPqO1I7Cggzw68Y5jhTcBi4FXmYOZppm1R3MhSJ5JSi/67Q7X4J5rnJLXYGN27qj\n" + "MpnoGQ/2xmsNG/isi+h/2vbtPU+WP9SEJnTfPLLpZ7KqCAk7FUUzKsuLx3/SOKtd\n" + "krWxPKwYTgnDEN6DJL7tEzCnG5DFc4mQ7YW9PaRdC3rS1T8PvQ3jB2BUnohM0cFv\n" + "KRuiU35tU7h7CPbL4L66VglXoiwqmgcrwI2U968bD0+wRQ5c5bzNoshJOzN6CTMh\n" + "1IhbklSh/Z6FA/e8hj0yVo2tdllXuJGVs3PIEwIDAQABAoIBAAEtcg+LFLGtoxjq\n" + "b+tFttBJfbRcfdG6ocYqBGmUXF+MgFs573DHX3sHNOQxlaNHtSgIclF1eYgNZFFt\n" + "VLIoBFTzfEQXoFosPUDoEuqVMeXLttmD7P2jwL780XJLZ4Xj6GY07npq1iGBcEZf\n" + "yCcdoyGkr9jgc5Auyis8DStGg/jfUBC4NBvF0GnuuNPAdYRPKUpKw9EatI+FdMjy\n" + "BuroD90fhdkK8EwMEVb9P17bdIc1MCIZFpUE9YHjVdK/oxCUhQ8KRfdbI4JU5Zh3\n" + "UtO6Jm2wFuP3VmeVpPvE/C2rxI70pyl6HMSiFGNc0rhJYCQ+yhohWj7nZ67H4vLx\n" + "plv5LxkCgYEAz7ewou8oFafDAMNoxaqKudvUg+lxXewdLDKaYBF5ACi9uAPCJ+v7\n" + "M5c/fvPFn/XHzo7xaXbtTAH3Z5xzBs+80OsvL+e1Ut4xR+ELRkybknh/s2wQeABk\n" + "Kb0vA59ukQGj12LV5phZMaVoXe6KJ7hZnN62d3K6m1wGE/k58i4pPLUCgYEA3hN8\n" + "G95zW7g0jVdSr+KUeVmephph9yh8Yb+3I3ojwOIv6d45TopGx8pFZlnBAMZf1ZQx\n" + "DIhzJNnaqZy/4w7RNaOGWnPA/5f+MIoHBiLGEEmfHC3lt087Yp9OuwDUHwpETYdV\n" + "o+KBCvVh60Et3bZUgF/1k/3YXxn8J5dsmJsjNqcCgYBLflyRa1BrRnTGMz9CEDCp\n" + "Si9b3h1Y4Hbd2GppHhCXMTd6yMrpDYhYANGQB3M9Juv+s88j4JhwNoq/uonH4Pqk\n" + "B8Y3qAQr4RuSH0WkwDUOsALhqBX4N1QwI1USAQEDbNAqeP5698X7GD3tXcQSmZrg\n" + "O8WfdjBCRNjkq4EW9xX/vQKBgQDONtmwJ0iHiu2BseyeVo/4fzfKlgUSNQ4K1rOA\n" + "xhIdMeu8Bxa/z7caHsGC4SVPSuYCtbE2Kh6BwapChcPJXCD45fgEViiJLuJiwEj1\n" + "caTpyvNsf1IoffJvCe9ZxtMyX549P8ZOgC3Dt0hN5CBrGLwu2Ox5l+YrqT10pi+5\n" + "JZX1UQKBgQCrcXrdkkDAc/a4+PxNRpJRLcU4fhv8/lr+UWItE8eUe7bd25bTQfQm\n" + "VpNKc/kAJ66PjIED6fy3ADhd2y4naT2a24uAgQ/M494J68qLnGh6K4JU/09uxR2v\n" + "1i2q/4FNLdFFk1XP4iNnTHRLZ+NYr2p5Y9RcvQfTjOauz8Ahav0lyg==\n" + "-----END RSA PRIVATE KEY-----\n"; + +#endif diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c new file mode 100644 index 0000000..9857817 --- /dev/null +++ b/src/testcurl/perf_get.c @@ -0,0 +1,600 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009, 2011 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file perf_get.c + * @brief benchmark simple GET operations (sequential access). + * Note that we run libcurl in the same process at the + * same time, so the execution time given is the combined + * time for both MHD and libcurl; it is quite possible + * that more time is spend with libcurl than with MHD, + * so the performance scores calculated with this code + * should NOT be used to compare with other HTTP servers + * (since MHD is actually better); only the relative + * scores between MHD versions are meaningful. + * Furthermore, this code ONLY tests MHD processing + * a single request at a time. This is again + * not universally meaningful (i.e. when comparing + * multithreaded vs. single-threaded or select/poll). + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#include "gauger.h" + +#ifndef WINDOWS +#include +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +/** + * How many rounds of operations do we do for each + * test? + */ +#define ROUNDS 500 + +/** + * Do we use HTTP 1.1? + */ +static int oneone; + +/** + * Response to return (re-used). + */ +static struct MHD_Response *response; + +/** + * Time this round was started. + */ +static unsigned long long start_time; + + +/** + * Get the current timestamp + * + * @return current time in ms + */ +static unsigned long long +now () +{ + struct timeval tv; + + gettimeofday (&tv, NULL); + return (((unsigned long long) tv.tv_sec * 1000LL) + + ((unsigned long long) tv.tv_usec / 1000LL)); +} + + +/** + * Start the timer. + */ +static void +start_timer() +{ + start_time = now (); +} + + +/** + * Stop the timer and report performance + * + * @param desc description of the threading mode we used + */ +static void +stop (const char *desc) +{ + double rps = ((double) (ROUNDS * 1000)) / ((double) (now() - start_time)); + + fprintf (stderr, + "Sequential GETs using %s: %f %s\n", + desc, + rps, + "requests/s"); + GAUGER (desc, + "Sequential GETs", + rps, + "requests/s"); +} + + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static size_t +copyBuffer (void *ptr, + size_t size, size_t nmemb, + void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + int ret; + (void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testInternalGet (int port, int poll_flag) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + unsigned int i; + char url[64]; + + if (MHD_NO != MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + + cbc.buf = buf; + cbc.size = 2048; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/hello_world", port); + start_timer (); + for (i=0;iport) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/hello_world", port); + start_timer (); + for (i=0;iport) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/hello_world", port); + start_timer (); + for (i=0;iport) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/hello_world", port); + start_timer (); + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + for (i=0;imsg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + } + /* two possibilities here; as select sets are + tiny, this makes virtually no difference + in actual runtime right now, even though the + number of select calls is virtually cut in half + (and 'select' is the most expensive of our system + calls according to 'strace') */ + if (0) + MHD_run (d); + else + MHD_run_from_select (d, &rs, &ws, &es); + } + if (NULL != c) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + fprintf (stderr, "Timeout!?\n"); + } + } + stop ("external select"); + if (multi != NULL) + { + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + int port = 1130; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (oneone) + port += 15; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + response = MHD_create_response_from_buffer (strlen ("/hello_world"), + "/hello_world", + MHD_RESPMEM_MUST_COPY); + errorCount += testExternalGet (port++); + errorCount += testInternalGet (port++, MHD_USE_AUTO); + errorCount += testMultithreadedGet (port++, MHD_USE_AUTO); + errorCount += testMultithreadedPoolGet (port++, MHD_USE_AUTO); + errorCount += testInternalGet (port++, 0); + errorCount += testMultithreadedGet (port++, 0); + errorCount += testMultithreadedPoolGet (port++, 0); + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) + { + errorCount += testInternalGet(port++, MHD_USE_POLL); + errorCount += testMultithreadedGet(port++, MHD_USE_POLL); + errorCount += testMultithreadedPoolGet(port++, MHD_USE_POLL); + } + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) + { + errorCount += testInternalGet(port++, MHD_USE_EPOLL); + errorCount += testMultithreadedPoolGet(port++, MHD_USE_EPOLL); + } + MHD_destroy_response (response); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c new file mode 100644 index 0000000..49ed1ba --- /dev/null +++ b/src/testcurl/perf_get_concurrent.c @@ -0,0 +1,495 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009, 2011 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file perf_get_concurrent.c + * @brief benchmark concurrent GET operations + * Note that we run libcurl on the machine at the + * same time, so the execution time may be influenced + * by the concurrent activity; it is quite possible + * that more time is spend with libcurl than with MHD, + * so the performance scores calculated with this code + * should NOT be used to compare with other HTTP servers + * (since MHD is actually better); only the relative + * scores between MHD versions are meaningful. + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#include +#include "gauger.h" + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +/** + * How many rounds of operations do we do for each + * test (total number of requests will be ROUNDS * PAR). + */ +#define ROUNDS 500 + +/** + * How many requests do we do in parallel? + */ +#define PAR CPU_COUNT + +/** + * Do we use HTTP 1.1? + */ +static int oneone; + +/** + * Response to return (re-used). + */ +static struct MHD_Response *response; + +/** + * Time this round was started. + */ +static unsigned long long start_time; + +/** + * Set to 1 if the worker threads are done. + */ +static volatile int signal_done; + + +/** + * Get the current timestamp + * + * @return current time in ms + */ +static unsigned long long +now () +{ + struct timeval tv; + + gettimeofday (&tv, NULL); + return (((unsigned long long) tv.tv_sec * 1000LL) + + ((unsigned long long) tv.tv_usec / 1000LL)); +} + + +/** + * Start the timer. + */ +static void +start_timer() +{ + start_time = now (); +} + + +/** + * Stop the timer and report performance + * + * @param desc description of the threading mode we used + */ +static void +stop (const char *desc) +{ + double rps = ((double) (PAR * ROUNDS * 1000)) / ((double) (now() - start_time)); + + fprintf (stderr, + "Parallel GETs using %s: %f %s\n", + desc, + rps, + "requests/s"); + GAUGER (desc, + "Parallel GETs", + rps, + "requests/s"); +} + + +static size_t +copyBuffer (void *ptr, + size_t size, size_t nmemb, + void *ctx) +{ + (void)ptr;(void)ctx; /* Unused. Silent compiler warning. */ + return size * nmemb; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + int ret; + (void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static void * +thread_gets (void *param) +{ + CURL *c; + CURLcode errornum; + unsigned int i; + char * const url = (char*) param; + + for (i=0;i= 0; j--) + pthread_join(par[j], NULL); + return "pthread_create error"; + } + } + for (j=0;jport) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + start_timer (); + ret_val = do_gets ((void*)(intptr_t)port); + if (!ret_val) + stop (test_desc); + MHD_stop_daemon (d); + if (ret_val) + { + fprintf (stderr, + "Error performing %s test: %s\n", test_desc, ret_val); + return 4; + } + return 0; +} + + +static int +testMultithreadedGet (int port, int poll_flag) +{ + struct MHD_Daemon *d; + const char * const test_desc = ((poll_flag & MHD_USE_AUTO) ? "internal thread with 'auto' and thread per connection" : + (poll_flag & MHD_USE_POLL) ? "internal thread with poll() and thread per connection" : + (poll_flag & MHD_USE_EPOLL) ? "internal thread with epoll and thread per connection" + : "internal thread with select() and thread per connection"); + const char * ret_val; + + if (MHD_NO != MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + + signal_done = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + start_timer (); + ret_val = do_gets ((void*)(intptr_t)port); + if (!ret_val) + stop (test_desc); + MHD_stop_daemon (d); + if (ret_val) + { + fprintf (stderr, + "Error performing %s test: %s\n", test_desc, ret_val); + return 4; + } + return 0; +} + + +static int +testMultithreadedPoolGet (int port, int poll_flag) +{ + struct MHD_Daemon *d; + const char * const test_desc = ((poll_flag & MHD_USE_AUTO) ? "internal thread pool with 'auto'" : + (poll_flag & MHD_USE_POLL) ? "internal thread pool with poll()" : + (poll_flag & MHD_USE_EPOLL) ? "internal thread poll with epoll" : "internal thread pool with select()"); + const char * ret_val; + + if (MHD_NO != MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + + signal_done = 0 ; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + start_timer (); + ret_val = do_gets ((void*)(intptr_t)port); + if (!ret_val) + stop (test_desc); + MHD_stop_daemon (d); + if (ret_val) + { + fprintf (stderr, + "Error performing %s test: %s\n", test_desc, ret_val); + return 4; + } + return 0; +} + + +static int +testExternalGet (int port) +{ + struct MHD_Daemon *d; + pthread_t pid; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max; + struct timeval tv; + MHD_UNSIGNED_LONG_LONG tt; + int tret; + char *ret_val; + int ret = 0; + + if (MHD_NO != MHD_is_feature_supported(MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + + signal_done = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + if (0 != pthread_create (&pid, NULL, + &do_gets, (void*)(intptr_t)port)) + { + MHD_stop_daemon(d); + return 512; + } + start_timer (); + + while (0 == signal_done) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + MHD_stop_daemon (d); + return 4096; + } + tret = MHD_get_timeout (d, &tt); + if (MHD_YES != tret) tt = 1; + tv.tv_sec = tt / 1000; + tv.tv_usec = 1000 * (tt % 1000); + if (-1 == select (max + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR == errno) + continue; + fprintf (stderr, + "select failed: %s\n", + strerror (errno)); +#else + if (WSAEINVAL == WSAGetLastError() && 0 == rs.fd_count && 0 == ws.fd_count && 0 == es.fd_count) + { + Sleep (1000); + continue; + } +#endif + ret |= 1024; + break; + } + MHD_run_from_select(d, &rs, &ws, &es); + } + + stop ("external select"); + MHD_stop_daemon (d); + if (0 != pthread_join(pid, (void**)&ret_val) || + NULL != ret_val) + { + fprintf (stderr, + "%s\n", ret_val); + ret |= 8; + } + if (ret) + fprintf (stderr, "Error performing test.\n"); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + int port = 1100; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (oneone) + port += 15; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + response = MHD_create_response_from_buffer (strlen ("/hello_world"), + "/hello_world", + MHD_RESPMEM_MUST_COPY); + errorCount += testInternalGet (port++, 0); + errorCount += testMultithreadedGet (port++, 0); + errorCount += testMultithreadedPoolGet (port++, 0); + errorCount += testExternalGet (port++); + errorCount += testInternalGet (port++, MHD_USE_AUTO); + errorCount += testMultithreadedGet (port++, MHD_USE_AUTO); + errorCount += testMultithreadedPoolGet (port++, MHD_USE_AUTO); + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) + { + errorCount += testInternalGet (port++, MHD_USE_POLL); + errorCount += testMultithreadedGet (port++, MHD_USE_POLL); + errorCount += testMultithreadedPoolGet (port++, MHD_USE_POLL); + } + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) + { + errorCount += testInternalGet (port++, MHD_USE_EPOLL); + errorCount += testMultithreadedPoolGet (port++, MHD_USE_EPOLL); + } + MHD_destroy_response (response); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c new file mode 100644 index 0000000..5b9daf0 --- /dev/null +++ b/src/testcurl/test_callback.c @@ -0,0 +1,244 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009, 2011 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +/** + * @file test_callback.c + * @brief Testcase for MHD not calling the callback too often + * @author Jan Seeger + * @author Christian Grothoff + */ +#include "MHD_config.h" +#include "platform.h" +#include +#include + +struct callback_closure +{ + unsigned int called; +}; + + +static ssize_t +called_twice(void *cls, uint64_t pos, char *buf, size_t max) +{ + struct callback_closure *cls2 = cls; + (void)pos; /* Unused. Silent compiler warning. */ + + if (cls2->called == 0) + { + memset(buf, 0, max); + strcat(buf, "test"); + cls2->called = 1; + return strlen(buf); + } + if (cls2->called == 1) + { + cls2->called = 2; + return MHD_CONTENT_READER_END_OF_STREAM; + } + fprintf(stderr, + "Handler called after returning END_OF_STREAM!\n"); + return MHD_CONTENT_READER_END_WITH_ERROR; +} + + +static int +callback(void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls) +{ + struct callback_closure *cbc = calloc(1, sizeof(struct callback_closure)); + struct MHD_Response *r; + int ret; + (void)cls;(void)url; /* Unused. Silent compiler warning. */ + (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size;(void)con_cls; /* Unused. Silent compiler warning. */ + + r = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024, + &called_twice, cbc, + &free); + if (NULL == r) + { + free (cbc); + return MHD_NO; + } + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + r); + MHD_destroy_response (r); + return ret; +} + + +static size_t +discard_buffer (void *ptr, + size_t size, + size_t nmemb, + void *ctx) +{ + (void)ptr;(void)ctx; /* Unused. Silent compiler warning. */ + return size * nmemb; +} + + +int +main(int argc, char **argv) +{ + struct MHD_Daemon *d; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + CURL *c; + CURLM *multi; + CURLMcode mret; + struct CURLMsg *msg; + int running; + struct timeval tv; + int extra; + int port; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1140; + + d = MHD_start_daemon(0, + port, + NULL, + NULL, + &callback, + NULL, + MHD_OPTION_END); + if (d == NULL) + return 32; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 48; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &discard_buffer); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + extra = 10; + while ( (c != NULL) || (--extra > 0) ) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO(&ws); + FD_ZERO(&rs); + FD_ZERO(&es); + curl_multi_perform (multi, &running); + if (NULL != multi) + { + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 3; + } + } + if (MHD_YES != + MHD_get_fdset(d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + if (NULL != multi) + { + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + } + MHD_run(d); + } + MHD_stop_daemon(d); + return 0; +} diff --git a/src/testcurl/test_concurrent_stop.c b/src/testcurl/test_concurrent_stop.c new file mode 100644 index 0000000..3409d47 --- /dev/null +++ b/src/testcurl/test_concurrent_stop.c @@ -0,0 +1,299 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009, 2011, 2015, 2016 Christian Grothoff + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_concurrent_stop.c + * @brief test stopping server while concurrent GETs are ongoing + * @author Christian Grothoff + */ +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#include +#include "gauger.h" + +#ifdef CPU_COUNT +#undef CPU_COUNT +#endif +#define CPU_COUNT 40 + + +/** + * How many rounds of operations do we do for each + * test (total number of requests will be ROUNDS * PAR). + */ +#define ROUNDS 50000 + +/** + * How many requests do we do in parallel? + */ +#define PAR CPU_COUNT + +/** + * Do we use HTTP 1.1? + */ +static int oneone; + +/** + * Response to return (re-used). + */ +static struct MHD_Response *response; + + +static size_t +copyBuffer (void *ptr, + size_t size, size_t nmemb, + void *ctx) +{ + (void)ptr;(void)ctx; /* Unused. Silent compiler warning. */ + return size * nmemb; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + int ret; + (void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + if (ret == MHD_NO) + abort (); + return ret; +} + +static void +clean_curl(void * param) +{ + if (param) + { + CURL * const c = *((CURL **)param); + if (c) + curl_easy_cleanup (c); + } +} + +static void * +thread_gets (void *param) +{ + CURL *c; + CURLcode errornum; + unsigned int i; + char * const url = (char*) param; + int pth_olst; + if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &pth_olst) || + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &pth_olst) ) + { + fprintf(stderr, + "pthread_setcancelstate()/pthread_setcanceltype() failed.\n"); + _exit(99); + } + + for (i=0;i= 0; j--) + { + pthread_cancel(par[j]); + pthread_join(par[j], NULL); + } + _exit(99); + } + } + (void)sleep (1); + for (j=0;jport) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + p = start_gets (port); + (void)sleep (1); + MHD_stop_daemon (d); + pthread_join (p, NULL); + return 0; +} + + +static int +testMultithreadedPoolGet (int port, + int poll_flag) +{ + struct MHD_Daemon *d; + pthread_t p; + + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + port, + NULL, NULL, + &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + p = start_gets (port); + (void)sleep (1); + MHD_stop_daemon (d); + pthread_join (p, NULL); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + int port; + (void)argc; /* Unused. Silent compiler warning. */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1142; + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != port && oneone) + port += 5; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + response = MHD_create_response_from_buffer (strlen ("/hello_world"), + "/hello_world", + MHD_RESPMEM_MUST_COPY); + errorCount += testMultithreadedGet (port, 0); + if (0 != port) port++; + errorCount += testMultithreadedPoolGet (port, 0); + MHD_destroy_response (response); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c new file mode 100644 index 0000000..70f0f50 --- /dev/null +++ b/src/testcurl/test_delete.c @@ -0,0 +1,523 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2016 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_delete.c + * @brief Testcase for libmicrohttpd DELETE operations + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + unsigned int *pos = ptr; + unsigned int wrt; + + wrt = size * nmemb; + if (wrt > 8 - (*pos)) + wrt = 8 - (*pos); + memcpy (stream, &("Hello123"[*pos]), wrt); + (*pos) += wrt; + return wrt; +} + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcasecmp ("DELETE", method)) + return MHD_NO; /* unexpected method */ + if ((*done) == 0) + { + if (*upload_data_size != 8) + return MHD_YES; /* not yet ready */ + if (0 == memcmp (upload_data, "Hello123", 8)) + { + *upload_data_size = 0; + } + else + { + printf ("Invalid upload data `%8s'!\n", upload_data); + return MHD_NO; + } + *done = 1; + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), (void*) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testInternalDelete () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1152; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + + +static int +testMultithreadedDelete () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1153; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + +static int +testMultithreadedPoolDelete () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1154; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + + +static int +testExternalDelete () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + unsigned int pos = 0; + int done_flag = 0; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1154; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalDelete (); + errorCount += testMultithreadedDelete (); + errorCount += testMultithreadedPoolDelete (); + errorCount += testExternalDelete (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c new file mode 100644 index 0000000..48c7a87 --- /dev/null +++ b/src/testcurl/test_digestauth.c @@ -0,0 +1,276 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2010 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_digestauth.c + * @brief Testcase for libmicrohttpd Digest Auth + * @author Amr Ali + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#ifdef HAVE_GCRYPT_H +#include +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + +#ifndef WINDOWS +#include +#include +#else +#include +#endif + +#define PAGE "libmicrohttpd demoAccess granted" + +#define DENIED "libmicrohttpd demoAccess denied" + +#define MY_OPAQUE "11733b200778ce33060f31c9af70a870ba96ddd4" + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **unused) +{ + struct MHD_Response *response; + char *username; + const char *password = "testpass"; + const char *realm = "test@example.com"; + int ret; + (void)cls;(void)url; /* Unused. Silent compiler warning. */ + (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ + + username = MHD_digest_auth_get_username (connection); + if ( (username == NULL) || + (0 != strcmp (username, "testuser")) ) + { + response = MHD_create_response_from_buffer (strlen (DENIED), + DENIED, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_auth_fail_response(connection, realm, + MY_OPAQUE, + response, + MHD_NO); + MHD_destroy_response(response); + return ret; + } + ret = MHD_digest_auth_check(connection, realm, + username, + password, + 300); + free(username); + if ( (ret == MHD_INVALID_NONCE) || + (ret == MHD_NO) ) + { + response = MHD_create_response_from_buffer(strlen (DENIED), + DENIED, + MHD_RESPMEM_PERSISTENT); + if (NULL == response) + return MHD_NO; + ret = MHD_queue_auth_fail_response(connection, realm, + MY_OPAQUE, + response, + (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); + MHD_destroy_response(response); + return ret; + } + response = MHD_create_response_from_buffer (strlen(PAGE), + PAGE, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; +} + + +static int +testDigestAuth () +{ + CURL *c; + CURLcode errornum; + struct MHD_Daemon *d; + struct CBC cbc; + char buf[2048]; + char rnd[8]; + int port; + char url[128]; +#ifndef WINDOWS + int fd; + size_t len; + size_t off = 0; +#endif /* ! WINDOWS */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1165; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; +#ifndef WINDOWS + fd = open("/dev/urandom", O_RDONLY); + if (-1 == fd) + { + fprintf(stderr, "Failed to open `%s': %s\n", + "/dev/urandom", + strerror(errno)); + return 1; + } + while (off < 8) + { + len = read(fd, rnd, 8); + if (len == (size_t)-1) + { + fprintf(stderr, "Failed to read `%s': %s\n", + "/dev/urandom", + strerror(errno)); + (void) close(fd); + return 1; + } + off += len; + } + (void) close(fd); +#else + { + HCRYPTPROV cc; + BOOL b; + b = CryptAcquireContext (&cc, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); + if (b == 0) + { + fprintf (stderr, "Failed to acquire crypto provider context: %lu\n", + GetLastError ()); + return 1; + } + b = CryptGenRandom (cc, 8, (BYTE*)rnd); + if (b == 0) + { + fprintf (stderr, "Failed to generate 8 random bytes: %lu\n", + GetLastError ()); + } + CryptReleaseContext (cc, 0); + if (b == 0) + return 1; + } +#endif + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, PAGE, + MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd, + MHD_OPTION_NONCE_NC_SIZE, 300, + MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/bar%%20 foo?a=bü%%20", port); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + curl_easy_setopt (c, CURLOPT_USERPWD, "testuser:testpass"); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen (PAGE)) + return 4; + if (0 != strncmp (PAGE, cbc.buf, strlen (PAGE))) + return 8; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#ifdef HAVE_GCRYPT_H + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ +if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testDigestAuth (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c new file mode 100644 index 0000000..107d225 --- /dev/null +++ b/src/testcurl/test_digestauth_with_arguments.c @@ -0,0 +1,271 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2010, 2012 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_digestauth_with_arguments.c + * @brief Testcase for libmicrohttpd Digest Auth with arguments + * @author Amr Ali + */ +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#ifdef HAVE_GCRYPT_H +#include +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + +#ifndef WINDOWS +#include +#include +#else +#include +#endif + +#define PAGE "libmicrohttpd demoAccess granted" + +#define DENIED "libmicrohttpd demoAccess denied" + +#define MY_OPAQUE "11733b200778ce33060f31c9af70a870ba96ddd4" + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + struct MHD_Response *response; + char *username; + const char *password = "testpass"; + const char *realm = "test@example.com"; + int ret; + (void)cls;(void)url; /* Unused. Silent compiler warning. */ + (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ + + username = MHD_digest_auth_get_username(connection); + if ( (username == NULL) || + (0 != strcmp (username, "testuser")) ) + { + response = MHD_create_response_from_buffer(strlen (DENIED), + DENIED, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_auth_fail_response(connection, realm, + MY_OPAQUE, + response, + MHD_NO); + MHD_destroy_response(response); + return ret; + } + ret = MHD_digest_auth_check(connection, realm, + username, + password, + 300); + free(username); + if ( (ret == MHD_INVALID_NONCE) || + (ret == MHD_NO) ) + { + response = MHD_create_response_from_buffer(strlen (DENIED), + DENIED, + MHD_RESPMEM_PERSISTENT); + if (NULL == response) + return MHD_NO; + ret = MHD_queue_auth_fail_response(connection, realm, + MY_OPAQUE, + response, + (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); + MHD_destroy_response(response); + return ret; + } + response = MHD_create_response_from_buffer(strlen(PAGE), PAGE, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + MHD_destroy_response(response); + return ret; +} + + +static int +testDigestAuth () +{ + CURL *c; + CURLcode errornum; + struct MHD_Daemon *d; + struct CBC cbc; + char buf[2048]; + char rnd[8]; + int port; + char url[128]; +#ifndef WINDOWS + int fd; + size_t len; + size_t off = 0; +#endif /* ! WINDOWS */ + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1160; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; +#ifndef WINDOWS + fd = open("/dev/urandom", O_RDONLY); + if (-1 == fd) + { + fprintf(stderr, "Failed to open `%s': %s\n", + "/dev/urandom", + strerror(errno)); + return 1; + } + while (off < 8) + { + len = read(fd, rnd, 8); + if (len == (size_t)-1) + { + fprintf(stderr, "Failed to read `%s': %s\n", + "/dev/urandom", + strerror(errno)); + (void) close(fd); + return 1; + } + off += len; + } + (void) close(fd); +#else + { + HCRYPTPROV cc; + BOOL b; + b = CryptAcquireContext (&cc, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); + if (b == 0) + { + fprintf (stderr, "Failed to acquire crypto provider context: %lu\n", + GetLastError ()); + return 1; + } + b = CryptGenRandom (cc, 8, (BYTE*)rnd); + if (b == 0) + { + fprintf (stderr, "Failed to generate 8 random bytes: %lu\n", + GetLastError ()); + } + CryptReleaseContext (cc, 0); + if (b == 0) + return 1; + } +#endif + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, PAGE, + MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd, + MHD_OPTION_NONCE_NC_SIZE, 300, + MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/foo?key=value", port); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + curl_easy_setopt (c, CURLOPT_USERPWD, "testuser:testpass"); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen (PAGE)) + return 4; + if (0 != strncmp (PAGE, cbc.buf, strlen (PAGE))) + return 8; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#ifdef HAVE_GCRYPT_H + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testDigestAuth (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c new file mode 100644 index 0000000..081859f --- /dev/null +++ b/src/testcurl/test_get.c @@ -0,0 +1,774 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009, 2011 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_get.c + * @brief Testcase for libmicrohttpd GET operations + * TODO: test parsing of query + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#include "mhd_sockets.h" /* only macros used */ + + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +#ifndef WINDOWS +#include +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +static int oneone; +static int global_port; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcasecmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testInternalGet (int poll_flag) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + + if ( (0 == global_port) && + (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) ) + { + global_port = 1220; + if (oneone) + global_port += 20; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + global_port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == global_port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + global_port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + + +static int +testMultithreadedGet (int poll_flag) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + + if ( (0 == global_port) && + (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) ) + { + global_port = 1221; + if (oneone) + global_port += 20; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + global_port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == global_port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + global_port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + + +static int +testMultithreadedPoolGet (int poll_flag) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + + if ( (0 == global_port) && + (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) ) + { + global_port = 1222; + if (oneone) + global_port += 20; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + global_port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == global_port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + global_port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + + if ( (0 == global_port) && + (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) ) + { + global_port = 1223; + if (oneone) + global_port += 20; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + global_port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == global_port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + global_port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + +static int +testUnknownPortGet (int poll_flag) +{ + struct MHD_Daemon *d; + const union MHD_DaemonInfo *di; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + struct sockaddr_in addr; + socklen_t addr_len = sizeof(addr); + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_port = 0; + addr.sin_addr.s_addr = INADDR_ANY; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + 0, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_SOCK_ADDR, &addr, + MHD_OPTION_END); + if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + { + di = MHD_get_daemon_info (d, MHD_DAEMON_INFO_LISTEN_FD); + if (di == NULL) + return 65536; + + if (0 != getsockname(di->listen_fd, (struct sockaddr *) &addr, &addr_len)) + return 131072; + + if (addr.sin_family != AF_INET) + return 26214; + port = (int)ntohs(addr.sin_port); + } + else + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + + snprintf(buf, sizeof(buf), "http://127.0.0.1:%d/hello_world", + port); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, buf); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 524288; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 1048576; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 2097152; + return 0; +} + + +static int +testStopRace (int poll_flag) +{ + struct sockaddr_in sin; + MHD_socket fd; + struct MHD_Daemon *d; + + if ( (0 == global_port) && + (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) ) + { + global_port = 1224; + if (oneone) + global_port += 20; + } + + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + global_port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == global_port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + global_port = (int)dinfo->port; + } + + fd = socket (PF_INET, SOCK_STREAM, 0); + if (fd == MHD_INVALID_SOCKET) + { + fprintf(stderr, "socket error\n"); + return 256; + } + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(global_port); + sin.sin_addr.s_addr = htonl(0x7f000001); + + if (connect (fd, (struct sockaddr *)(&sin), sizeof(sin)) < 0) + { + fprintf(stderr, "connect error\n"); + MHD_socket_close_chk_ (fd); + return 512; + } + + /* printf("Waiting\n"); */ + /* Let the thread get going. */ + usleep(500000); + + /* printf("Stopping daemon\n"); */ + MHD_stop_daemon (d); + + MHD_socket_close_chk_ (fd); + + /* printf("good\n"); */ + return 0; +} + + +static int +ahc_empty (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + struct MHD_Response *response; + int ret; + (void)cls;(void)url;(void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcasecmp ("GET", method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + response = MHD_create_response_from_buffer (0, + NULL, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +curlExcessFound(CURL *c, curl_infotype type, char *data, size_t size, void *cls) +{ + static const char *excess_found = "Excess found"; + const size_t str_size = strlen (excess_found); + (void)c; /* Unused. Silent compiler warning. */ + + if (CURLINFO_TEXT == type + && size >= str_size + && 0 == strncmp(excess_found, data, str_size)) + *(int *)cls = 1; + return 0; +} + + +static int +testEmptyGet (int poll_flag) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int excess_found = 0; + + if ( (0 == global_port) && + (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) ) + { + global_port = 1225; + if (oneone) + global_port += 20; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + global_port, NULL, NULL, &ahc_empty, NULL, MHD_OPTION_END); + if (d == NULL) + return 4194304; + if (0 == global_port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + global_port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)global_port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_DEBUGFUNCTION, &curlExcessFound); + curl_easy_setopt (c, CURLOPT_DEBUGDATA, &excess_found); + curl_easy_setopt (c, CURLOPT_VERBOSE, 1); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 8388608; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != 0) + return 16777216; + if (excess_found) + return 33554432; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + global_port = 0; + errorCount += testInternalGet (0); + errorCount += testMultithreadedGet (0); + errorCount += testMultithreadedPoolGet (0); + errorCount += testUnknownPortGet (0); + errorCount += testStopRace (0); + errorCount += testExternalGet (); + errorCount += testEmptyGet (0); + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) + { + errorCount += testInternalGet(MHD_USE_POLL); + errorCount += testMultithreadedGet(MHD_USE_POLL); + errorCount += testMultithreadedPoolGet(MHD_USE_POLL); + errorCount += testUnknownPortGet(MHD_USE_POLL); + errorCount += testStopRace(MHD_USE_POLL); + errorCount += testEmptyGet(MHD_USE_POLL); + } + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) + { + errorCount += testInternalGet(MHD_USE_EPOLL); + errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL); + errorCount += testUnknownPortGet(MHD_USE_EPOLL); + errorCount += testEmptyGet(MHD_USE_EPOLL); + } + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c new file mode 100644 index 0000000..5d48fdc --- /dev/null +++ b/src/testcurl/test_get_chunked.c @@ -0,0 +1,514 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_get_chunked.c + * @brief Testcase for libmicrohttpd GET operations with chunked content encoding + * TODO: + * - how to test that chunking was actually used? + * - use CURLOPT_HEADERFUNCTION to validate + * footer was sent + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static size_t +copyBuffer (void *ptr, + size_t size, + size_t nmemb, + void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + + +/** + * MHD content reader callback that returns data in chunks. + */ +static ssize_t +crc (void *cls, + uint64_t pos, + char *buf, + size_t max) +{ + struct MHD_Response **responseptr = cls; + + if (pos == 128 * 10) + { + MHD_add_response_footer (*responseptr, + "Footer", + "working"); + return MHD_CONTENT_READER_END_OF_STREAM; + } + if (max < 128) + abort (); /* should not happen in this testcase... */ + memset (buf, 'A' + (pos / 128), 128); + return 128; +} + + +/** + * Dummy function that frees the "responseptr". + */ +static void +crcf (void *ptr) +{ + free (ptr); +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + const char *me = cls; + struct MHD_Response *response; + struct MHD_Response **responseptr; + int ret; + (void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + responseptr = malloc (sizeof (struct MHD_Response *)); + if (NULL == responseptr) + return MHD_NO; + response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, + 1024, + &crc, + responseptr, + &crcf); + if (NULL == response) + { + free (responseptr); + return MHD_NO; + } + *responseptr = response; + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + return ret; +} + + +static int +validate (struct CBC cbc, int ebase) +{ + int i; + char buf[128]; + + if (cbc.pos != 128 * 10) + return ebase; + + for (i = 0; i < 10; i++) + { + memset (buf, 'A' + i, 128); + if (0 != memcmp (buf, &cbc.buf[i * 128], 128)) + { + fprintf (stderr, + "Got `%.*s'\nWant `%.*s'\n", + 128, buf, 128, &cbc.buf[i * 128]); + return ebase * 2; + } + } + return 0; +} + +static int +testInternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1170; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return validate (cbc, 4); +} + +static int +testMultithreadedGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1171; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return validate (cbc, 64); +} + +static int +testMultithreadedPoolGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1172; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return validate (cbc, 64); +} + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1173; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 5L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + return validate (cbc, 8192); +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalGet (); + errorCount += testMultithreadedGet (); + errorCount += testMultithreadedPoolGet (); + errorCount += testExternalGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_get_response_cleanup.c b/src/testcurl/test_get_response_cleanup.c new file mode 100644 index 0000000..8cb4f4a --- /dev/null +++ b/src/testcurl/test_get_response_cleanup.c @@ -0,0 +1,415 @@ +/* DO NOT CHANGE THIS LINE */ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_get_response_cleanup.c + * @brief Testcase for libmicrohttpd response cleanup + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef _WIN32 +#include +#endif /* _WIN32 */ + +#ifndef WINDOWS +#include +#include +#endif + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +#define TESTSTR "/* DO NOT CHANGE THIS LINE */" + +static int oneone; + +static int ok; + + +static pid_t +fork_curl (const char *url) +{ + pid_t ret; + + ret = fork(); + if (ret != 0) + return ret; + execlp ("curl", "curl", "-s", "-N", "-o", "/dev/null", "-GET", url, NULL); + fprintf (stderr, + "Failed to exec curl: %s\n", + strerror (errno)); + _exit (-1); +} + + +static void +kill_curl (pid_t pid) +{ + int status; + + //fprintf (stderr, "Killing curl\n"); + kill (pid, SIGTERM); + waitpid (pid, &status, 0); +} + + +static ssize_t +push_callback (void *cls, uint64_t pos, char *buf, size_t max) +{ + (void)cls;(void)pos; /* Unused. Silent compiler warning. */ + + if (max == 0) + return 0; + buf[0] = 'd'; + return 1; +} + + +static void +push_free_callback (void *cls) +{ + int *ok = cls; + + //fprintf (stderr, "Cleanup callback called!\n"); + *ok = 0; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + //fprintf (stderr, "In CB: %s!\n", method); + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, + 32 * 1024, + &push_callback, + &ok, + &push_free_callback); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testInternalGet () +{ + struct MHD_Daemon *d; + pid_t curl; + int port; + char url[127]; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1180; + if (oneone) + port += 10; + } + + ok = 1; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/", port); + curl = fork_curl (url); + (void)sleep (1); + kill_curl (curl); + (void)sleep (1); + /* fprintf (stderr, "Stopping daemon!\n"); */ + MHD_stop_daemon (d); + if (ok != 0) + return 2; + return 0; +} + + +static int +testMultithreadedGet () +{ + struct MHD_Daemon *d; + pid_t curl; + int port; + char url[127]; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1181; + if (oneone) + port += 10; + } + + ok = 1; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 2, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/", port); + //fprintf (stderr, "Forking cURL!\n"); + curl = fork_curl (url); + (void)sleep (1); + kill_curl (curl); + (void)sleep (1); + curl = fork_curl (url); + (void)sleep (1); + if (ok != 0) + { + kill_curl (curl); + MHD_stop_daemon (d); + return 64; + } + kill_curl (curl); + (void)sleep (1); + //fprintf (stderr, "Stopping daemon!\n"); + MHD_stop_daemon (d); + if (ok != 0) + return 32; + + return 0; +} + + +static int +testMultithreadedPoolGet () +{ + struct MHD_Daemon *d; + pid_t curl; + int port; + char url[127]; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1182; + if (oneone) + port += 10; + } + + ok = 1; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 64; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/", port); + curl = fork_curl (url); + (void)sleep (1); + kill_curl (curl); + (void)sleep (1); + //fprintf (stderr, "Stopping daemon!\n"); + MHD_stop_daemon (d); + if (ok != 0) + return 128; + return 0; +} + + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket max; + time_t start; + struct timeval tv; + pid_t curl; + int port; + char url[127]; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1183; + if (oneone) + port += 10; + } + + ok = 1; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + sprintf(url, "http://127.0.0.1:%d/", port); + curl = fork_curl (url); + + start = time (NULL); + while ((time (NULL) - start < 2)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (max + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } + MHD_run (d); + } + kill_curl (curl); + start = time (NULL); + while ((time (NULL) - start < 2)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (max + 1, &rs, &ws, &es, &tv)) + { + if (EINTR != errno) + abort (); + } + MHD_run (d); + } + /* fprintf (stderr, "Stopping daemon!\n"); */ + MHD_stop_daemon (d); + if (ok != 0) + return 1024; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + +#ifndef _WIN32 + /* Solaris has no way to disable SIGPIPE on socket disconnect. */ + if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTOSUPPRESS_SIGPIPE)) + { + struct sigaction act; + + act.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &act, NULL); + } +#endif /* _WIN32 */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + errorCount += testInternalGet (); + errorCount += testMultithreadedGet (); + errorCount += testMultithreadedPoolGet (); + errorCount += testExternalGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c new file mode 100644 index 0000000..6718106 --- /dev/null +++ b/src/testcurl/test_get_sendfile.c @@ -0,0 +1,612 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +/** + * @file test_get_sendfile.c + * @brief Testcase for libmicrohttpd response from FD + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#include +#include +#include "mhd_sockets.h" + +#ifndef WINDOWS +#include +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +#define TESTSTR "This is the content of the test file we are sending using sendfile (if available)" + +static char *sourcefile; + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + int fd; + (void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + fd = open (sourcefile, O_RDONLY); + if (fd == -1) + { + fprintf (stderr, "Failed to open `%s': %s\n", + sourcefile, + strerror (errno)); + exit (1); + } + response = MHD_create_response_from_fd (strlen (TESTSTR), fd); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testInternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1200; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen (TESTSTR)) + return 4; + if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) + return 8; + return 0; +} + + +static int +testMultithreadedGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1201; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen (TESTSTR)) + return 64; + if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) + return 128; + return 0; +} + + +static int +testMultithreadedPoolGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1202; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen (TESTSTR)) + return 64; + if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) + return 128; + return 0; +} + + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1203; + if (oneone) + port += 10; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen (TESTSTR)) + return 8192; + if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) + return 16384; + return 0; +} + + +static int +testUnknownPortGet () +{ + struct MHD_Daemon *d; + const union MHD_DaemonInfo *di; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + struct sockaddr_in addr; + socklen_t addr_len = sizeof(addr); + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_port = 0; + addr.sin_addr.s_addr = INADDR_ANY; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 0, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_SOCK_ADDR, &addr, + MHD_OPTION_END); + if (d == NULL) + return 32768; + + if (MHD_NO == MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + { + di = MHD_get_daemon_info (d, MHD_DAEMON_INFO_LISTEN_FD); + if (di == NULL) + return 65536; + + if (0 != getsockname(di->listen_fd, (struct sockaddr *) &addr, &addr_len)) + return 131072; + + if (addr.sin_family != AF_INET) + return 26214; + port = (int)ntohs(addr.sin_port); + } + else + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + + snprintf(buf, sizeof(buf), "http://127.0.0.1:%d/", + port); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, buf); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 524288; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen (TESTSTR)) + return 1048576; + if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) + return 2097152; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + const char *tmp; + FILE *f; + (void)argc; /* Unused. Silent compiler warning. */ + + if ( (NULL == (tmp = getenv ("TMPDIR"))) && + (NULL == (tmp = getenv ("TMP"))) && + (NULL == (tmp = getenv ("TEMP"))) ) + tmp = "/tmp"; + sourcefile = malloc (strlen (tmp) + 32); + sprintf (sourcefile, + "%s/%s", + tmp, + "test-mhd-sendfile"); + f = fopen (sourcefile, "w"); + if (NULL == f) + { + fprintf (stderr, "failed to write test file\n"); + free (sourcefile); + return 1; + } + fwrite (TESTSTR, strlen (TESTSTR), 1, f); + fclose (f); + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalGet (); + errorCount += testMultithreadedGet (); + errorCount += testMultithreadedPoolGet (); + errorCount += testExternalGet (); + errorCount += testUnknownPortGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + unlink (sourcefile); + free (sourcefile); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c new file mode 100644 index 0000000..32f7e36 --- /dev/null +++ b/src/testcurl/test_iplimit.c @@ -0,0 +1,352 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_iplimit.c + * @brief Testcase for libmicrohttpd GET operations + * TODO: test parsing of query + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + +static int +testMultithreadedGet () +{ + struct MHD_Daemon *d; + char buf[2048]; + int k; + unsigned int success; + unsigned int failure; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1260; + if (oneone) + port += 5; + } + + /* Test only valid for HTTP/1.1 (uses persistent connections) */ + if (!oneone) + return 0; + + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, + &ahc_echo, "GET", + MHD_OPTION_PER_IP_CONNECTION_LIMIT, 2, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + + for (k = 0; k < 3; ++k) + { + struct CBC cbc[3]; + CURL *cenv[3]; + int i; + + success = 0; + failure = 0; + for (i = 0; i < 3; ++i) + { + CURL *c; + CURLcode errornum; + + cenv[i] = c = curl_easy_init (); + cbc[i].buf = buf; + cbc[i].size = 2048; + cbc[i].pos = 0; + + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc[i]); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_FORBID_REUSE, 0L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + errornum = curl_easy_perform (c); + if (CURLE_OK == errornum) + success++; + else + failure++; + } + + /* Cleanup the environments */ + for (i = 0; i < 3; ++i) + curl_easy_cleanup (cenv[i]); + if ( (2 != success) || + (1 != failure) ) + { + fprintf (stderr, + "Unexpected number of success (%u) or failure (%u)\n", + success, + failure); + MHD_stop_daemon (d); + return 32; + } + + (void)sleep(2); + + for (i = 0; i < 2; ++i) + { + if (cbc[i].pos != strlen ("/hello_world")) + { + MHD_stop_daemon (d); + return 64; + } + if (0 != strncmp ("/hello_world", cbc[i].buf, strlen ("/hello_world"))) + { + MHD_stop_daemon (d); + return 128; + } + } + } + MHD_stop_daemon (d); + return 0; +} + +static int +testMultithreadedPoolGet () +{ + struct MHD_Daemon *d; + char buf[2048]; + int k; + int port; + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1261; + if (oneone) + port += 5; + } + + /* Test only valid for HTTP/1.1 (uses persistent connections) */ + if (!oneone) + return 0; + + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_PER_IP_CONNECTION_LIMIT, 2, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + + for (k = 0; k < 3; ++k) + { + struct CBC cbc[3]; + CURL *cenv[3]; + int i; + + for (i = 0; i < 3; ++i) + { + CURL *c; + CURLcode errornum; + + cenv[i] = c = curl_easy_init (); + cbc[i].buf = buf; + cbc[i].size = 2048; + cbc[i].pos = 0; + + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc[i]); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_FORBID_REUSE, 0L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + errornum = curl_easy_perform (c); + if ( ( (CURLE_OK != errornum) && (i < 2) ) || + ( (CURLE_OK == errornum) && (i == 2) ) ) + { + int j; + + /* First 2 should succeed */ + if (i < 2) + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + + /* Last request should have failed */ + else + fprintf (stderr, + "No error on IP address over limit\n"); + + for (j = 0; j < i; ++j) + curl_easy_cleanup (cenv[j]); + MHD_stop_daemon (d); + return 32; + } + } + + /* Cleanup the environments */ + for (i = 0; i < 3; ++i) + curl_easy_cleanup (cenv[i]); + + (void)sleep(2); + + for (i = 0; i < 2; ++i) + { + if (cbc[i].pos != strlen ("/hello_world")) + { + MHD_stop_daemon (d); + return 64; + } + if (0 != strncmp ("/hello_world", cbc[i].buf, strlen ("/hello_world"))) + { + MHD_stop_daemon (d); + return 128; + } + } + + + } + MHD_stop_daemon (d); + return 0; +} + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount |= testMultithreadedGet (); + errorCount |= testMultithreadedPoolGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c new file mode 100644 index 0000000..b7a87c8 --- /dev/null +++ b/src/testcurl/test_large_put.c @@ -0,0 +1,657 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_large_put.c + * @brief Testcase for libmicrohttpd PUT operations + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#include "test_helpers.h" + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +static int oneone; +static int incr_read; /* Use incremental read */ +static int verbose; /* Be verbose */ + +#define PUT_SIZE (256 * 1024) + +static char *put_buffer; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +char* +alloc_init(size_t buf_size) +{ + static const char template[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz"; + static const size_t templ_size = sizeof(template) / sizeof(char) - 1; + char *buf; + char *fill_ptr; + size_t to_fill; + + buf = malloc(buf_size); + if (NULL == buf) + return NULL; + + fill_ptr = buf; + to_fill = buf_size; + while (to_fill > 0) + { + const size_t to_copy = to_fill > templ_size ? templ_size : to_fill; + memcpy (fill_ptr, template, to_copy); + fill_ptr += to_copy; + to_fill -= to_copy; + } + return buf; +} + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + size_t *pos = (size_t *)ptr; + size_t wrt; + + wrt = size * nmemb; + /* Check for overflow. */ + if (wrt / size != nmemb) + return 0; + if (wrt > PUT_SIZE - (*pos)) + wrt = PUT_SIZE - (*pos); + memcpy (stream, &put_buffer[*pos], wrt); + (*pos) += wrt; + return wrt; +} + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **pparam) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + static size_t processed; + (void)version; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("PUT", method)) + return MHD_NO; /* unexpected method */ + if ((*done) == 0) + { + size_t *pproc; + if (NULL == *pparam) + { + processed = 0; + *pparam = &processed; /* Safe as long as only one parallel request served. */ + } + pproc = (size_t*) *pparam; + + if (0 == *upload_data_size) + return MHD_YES; /* No data to process. */ + + if (*pproc + *upload_data_size > PUT_SIZE) + { + fprintf (stderr, "Incoming data larger than expected.\n"); + return MHD_NO; + } + if ( (!incr_read) && (*upload_data_size != PUT_SIZE) ) + return MHD_YES; /* Wait until whole request is received. */ + + if (0 != memcmp(upload_data, put_buffer + (*pproc), *upload_data_size)) + { + fprintf (stderr, "Incoming data does not match sent data.\n"); + return MHD_NO; + } + *pproc += *upload_data_size; + *upload_data_size = 0; /* Current block of data is fully processed. */ + + if (PUT_SIZE == *pproc) + *done = 1; /* Whole request is processed. */ + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testPutInternalThread (unsigned int add_flag) +{ + struct MHD_Daemon *d; + CURL *c; + struct CBC cbc; + size_t pos = 0; + int done_flag = 0; + CURLcode errornum; + char buf[2048]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1270; + if (oneone) + port += 10; + if (incr_read) + port += 20; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | add_flag, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)), + MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + +static int +testPutThreadPerConn (unsigned int add_flag) +{ + struct MHD_Daemon *d; + CURL *c; + struct CBC cbc; + size_t pos = 0; + int done_flag = 0; + CURLcode errornum; + char buf[2048]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1271; + if (oneone) + port += 10; + if (incr_read) + port += 20; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | + MHD_USE_ERROR_LOG | add_flag, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)), + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + { + fprintf (stderr, "Got invalid response `%.*s'\n", (int)cbc.pos, cbc.buf); + return 64; + } + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + +static int +testPutThreadPool (unsigned int add_flag) +{ + struct MHD_Daemon *d; + CURL *c; + struct CBC cbc; + size_t pos = 0; + int done_flag = 0; + CURLcode errornum; + char buf[2048]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1272; + if (oneone) + port += 10; + if (incr_read) + port += 20; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | add_flag, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)), + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + { + fprintf (stderr, "Got invalid response `%.*s'\n", (int)cbc.pos, cbc.buf); + return 64; + } + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + +static int +testPutExternal (void) +{ + struct MHD_Daemon *d; + CURL *c; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + size_t pos = 0; + int done_flag = 0; + char buf[2048]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1273; + if (oneone) + port += 10; + if (incr_read) + port += 20; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + multi = NULL; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t)(incr_read ? 1024 : (PUT_SIZE * 4)), + MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + { + fprintf (stderr, "Got invalid response `%.*s'\n", (int)cbc.pos, cbc.buf); + return 8192; + } + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + unsigned int lastErr; + + oneone = has_in_name(argv[0], "11"); + incr_read = has_in_name(argv[0], "_inc"); + verbose = has_param(argc, argv, "-v"); + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 99; + put_buffer = alloc_init (PUT_SIZE); + if (NULL == put_buffer) + return 99; + lastErr = testPutInternalThread (0); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread with select().\n"); + errorCount += lastErr; + lastErr = testPutThreadPerConn (0); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread per connection with select().\n"); + errorCount += lastErr; + lastErr = testPutThreadPool (0); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with thread pool per connection with select().\n"); + errorCount += lastErr; + lastErr = testPutExternal (); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with external select().\n"); + errorCount += lastErr; + if (MHD_is_feature_supported(MHD_FEATURE_POLL)) + { + lastErr = testPutInternalThread (MHD_USE_POLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread with poll().\n"); + errorCount += lastErr; + lastErr = testPutThreadPerConn (MHD_USE_POLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread per connection with poll().\n"); + errorCount += lastErr; + lastErr = testPutThreadPool (MHD_USE_POLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with thread pool per connection with poll().\n"); + errorCount += lastErr; + } + if (MHD_is_feature_supported(MHD_FEATURE_EPOLL)) + { + lastErr = testPutInternalThread (MHD_USE_EPOLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with internal thread with epoll.\n"); + errorCount += lastErr; + lastErr = testPutThreadPool (MHD_USE_EPOLL); + if (verbose && 0 != lastErr) + fprintf (stderr, "Error during testing with thread pool per connection with epoll.\n"); + errorCount += lastErr; + } + free (put_buffer); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + else if (verbose) + printf ("All checks passed successfully.\n"); + curl_global_cleanup (); + return (errorCount == 0) ? 0 : 1; +} diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c new file mode 100644 index 0000000..49b183d --- /dev/null +++ b/src/testcurl/test_long_header.c @@ -0,0 +1,295 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_long_header.c + * @brief Testcase for libmicrohttpd handling of very long headers + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +/** + * We will set the memory available per connection to + * half of this value, so the actual value does not have + * to be big at all... + */ +#define VERY_LONG (1024*10) + +static int oneone; + +static int +apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen) +{ + (void)cls;(void)addr;(void)addrlen; /* Unused. Silent compiler warning. */ + return MHD_YES; +} + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + (void)ptr;(void)ctx; /* Unused. Silent compiler warning. */ + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testLongUrlGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + char *url; + long code; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1330; + if (oneone) + port += 5; + } + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + port, + &apc_all, + NULL, + &ahc_echo, + "GET", + MHD_OPTION_CONNECTION_MEMORY_LIMIT, + (size_t) (VERY_LONG / 2), MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + url = malloc (VERY_LONG); + if (url == NULL) + { + MHD_stop_daemon (d); + return 1; + } + memset (url, 'a', VERY_LONG); + url[VERY_LONG - 1] = '\0'; + memcpy (url, "http://127.0.0.1/", strlen ("http://127.0.0.1/")); + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK == curl_easy_perform (c)) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + free (url); + return 2; + } + if (CURLE_OK != curl_easy_getinfo (c, CURLINFO_RESPONSE_CODE, &code)) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + free (url); + return 4; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + free (url); + if (code != MHD_HTTP_URI_TOO_LONG) + return 8; + return 0; +} + + +static int +testLongHeaderGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + char *url; + long code; + struct curl_slist *header = NULL; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1331; + if (oneone) + port += 5; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + port, + &apc_all, + NULL, + &ahc_echo, + "GET", + MHD_OPTION_CONNECTION_MEMORY_LIMIT, + (size_t) (VERY_LONG / 2), MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + url = malloc (VERY_LONG); + if (url == NULL) + { + MHD_stop_daemon (d); + return 16; + } + memset (url, 'a', VERY_LONG); + url[VERY_LONG - 1] = '\0'; + url[VERY_LONG / 2] = ':'; + url[VERY_LONG / 2 + 1] = ' '; + header = curl_slist_append (header, url); + + curl_easy_setopt (c, CURLOPT_HTTPHEADER, header); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK == curl_easy_perform (c)) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + curl_slist_free_all (header); + free (url); + return 32; + } + if (CURLE_OK != curl_easy_getinfo (c, CURLINFO_RESPONSE_CODE, &code)) + { + curl_slist_free_all (header); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + free (url); + return 64; + } + curl_slist_free_all (header); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + free (url); + if (code != MHD_HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE) + return 128; + return 0; +} + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testLongUrlGet (); + errorCount += testLongHeaderGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_parse_cookies.c b/src/testcurl/test_parse_cookies.c new file mode 100644 index 0000000..3e2c181 --- /dev/null +++ b/src/testcurl/test_parse_cookies.c @@ -0,0 +1,286 @@ + +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_parse_cookies.c + * @brief Testcase for HTTP cookie parsing + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + const char *hdr; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + + hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name1"); + if ((hdr == NULL) || (0 != strcmp (hdr, "var1"))) + abort (); + hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name2"); + if ((hdr == NULL) || (0 != strcmp (hdr, "var2"))) + abort (); + hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name3"); + if ((hdr == NULL) || (0 != strcmp (hdr, ""))) + abort (); + hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name4"); + if ((hdr == NULL) || (0 != strcmp (hdr, "var4 with spaces"))) + abort (); + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1340; + if (oneone) + port += 5; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + /* note that the string below intentionally uses the + various ways cookies can be specified to exercise the + parser! Do not change! */ + curl_easy_setopt (c, CURLOPT_COOKIE, + "name1=var1; name2=var2,name3 ;name4=\"var4 with spaces\";"); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testExternalGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c new file mode 100644 index 0000000..6b91b9c --- /dev/null +++ b/src/testcurl/test_post.c @@ -0,0 +1,786 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_post.c + * @brief Testcase for libmicrohttpd POST operations using URL-encoding + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +#define POST_DATA "name=daniel&project=curl" + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static void +completed_cb (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct MHD_PostProcessor *pp = *con_cls; + (void)cls;(void)connection;(void)toe; /* Unused. Silent compiler warning. */ + + if (NULL != pp) + MHD_destroy_post_processor (pp); + *con_cls = NULL; +} + + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + + +/** + * Note that this post_iterator is not perfect + * in that it fails to support incremental processing. + * (to be fixed in the future) + */ +static int +post_iterator (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *value, uint64_t off, size_t size) +{ + int *eok = cls; + (void)kind;(void)filename;(void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding;(void)off; /* Unused. Silent compiler warning. */ + + if ((0 == strcasecmp (key, "name")) && + (size == strlen ("daniel")) && (0 == strncmp (value, "daniel", size))) + (*eok) |= 1; + if ((0 == strcasecmp (key, "project")) && + (size == strlen ("curl")) && (0 == strncmp (value, "curl", size))) + (*eok) |= 2; + return MHD_YES; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int eok; + struct MHD_Response *response; + struct MHD_PostProcessor *pp; + int ret; + (void)cls;(void)version; /* Unused. Silent compiler warning. */ + + if (0 != strcasecmp ("POST", method)) + { + printf ("METHOD: %s\n", method); + return MHD_NO; /* unexpected method */ + } + pp = *unused; + if (pp == NULL) + { + eok = 0; + pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); + *unused = pp; + } + MHD_post_process (pp, upload_data, *upload_data_size); + if ((eok == 3) && (0 == *upload_data_size)) + { + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + MHD_destroy_post_processor (pp); + *unused = NULL; + return ret; + } + *upload_data_size = 0; + return MHD_YES; +} + + +static int +testInternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1370; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + +static int +testMultithreadedPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1371; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + +static int +testMultithreadedPoolPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1372; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + +static int +testExternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1373; + if (oneone) + port += 10; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + +static int +ahc_cancel (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + struct MHD_Response *response; + int ret; + (void)cls;(void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcasecmp ("POST", method)) + { + fprintf (stderr, + "Unexpected method `%s'\n", method); + return MHD_NO; + } + + if (*unused == NULL) + { + *unused = "wibble"; + /* We don't want the body. Send a 500. */ + response = MHD_create_response_from_buffer (0, NULL, + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response(connection, 500, response); + if (ret != MHD_YES) + fprintf(stderr, "Failed to queue response\n"); + MHD_destroy_response(response); + return ret; + } + else + { + fprintf(stderr, + "In ahc_cancel again. This should not happen.\n"); + return MHD_NO; + } +} + +struct CRBC +{ + const char *buffer; + size_t size; + size_t pos; +}; + + +static size_t +readBuffer(void *p, size_t size, size_t nmemb, void *opaque) +{ + struct CRBC *data = opaque; + size_t required = size * nmemb; + size_t left = data->size - data->pos; + + if (required > left) + required = left; + + memcpy(p, data->buffer + data->pos, required); + data->pos += required; + + return required/size; +} + + +static size_t +slowReadBuffer(void *p, size_t size, size_t nmemb, void *opaque) +{ + (void)sleep(1); + return readBuffer(p, size, nmemb, opaque); +} + + +#define FLAG_EXPECT_CONTINUE 1 +#define FLAG_CHUNKED 2 +#define FLAG_FORM_DATA 4 +#define FLAG_SLOW_READ 8 +#define FLAG_COUNT 16 + + +static int +testMultithreadedPostCancelPart(int flags) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + struct curl_slist *headers = NULL; + long response_code; + CURLcode cc; + int result = 0; + struct CRBC crbc; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1374; + if (oneone) + port += 10; + } + + /* Don't test features that aren't available with HTTP/1.0 in + * HTTP/1.0 mode. */ + if (!oneone && (flags & (FLAG_EXPECT_CONTINUE | FLAG_CHUNKED))) + return 0; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_cancel, NULL, + MHD_OPTION_END); + if (d == NULL) + return 32768; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + + crbc.buffer = "Test content"; + crbc.size = strlen(crbc.buffer); + crbc.pos = 0; + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, (flags & FLAG_SLOW_READ) ? &slowReadBuffer : &readBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &crbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, NULL); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, crbc.size); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + if (flags & FLAG_CHUNKED) + headers = curl_slist_append(headers, "Transfer-Encoding: chunked"); + if (!(flags & FLAG_FORM_DATA)) + headers = curl_slist_append(headers, "Content-Type: application/octet-stream"); + if (flags & FLAG_EXPECT_CONTINUE) + headers = curl_slist_append(headers, "Expect: 100-Continue"); + curl_easy_setopt(c, CURLOPT_HTTPHEADER, headers); + + if (CURLE_HTTP_RETURNED_ERROR != (errornum = curl_easy_perform (c))) + { +#ifdef _WIN32 + curl_version_info_data *curlverd = curl_version_info(CURLVERSION_NOW); + if (0 != (flags & FLAG_SLOW_READ) && CURLE_RECV_ERROR == errornum && + (curlverd == NULL || curlverd->ares_num < 0x073100) ) + { /* libcurl up to version 7.49.0 didn't have workaround for WinSock bug */ + fprintf (stderr, "Ignored curl_easy_perform expected failure on W32 with \"slow read\".\n"); + result = 0; + } + else +#else /* ! _WIN32 */ + if(1) +#endif /* ! _WIN32 */ + { + fprintf (stderr, + "flibbet curl_easy_perform didn't fail as expected: `%s' %d\n", + curl_easy_strerror (errornum), errornum); + result = 65536; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + curl_slist_free_all(headers); + return result; + } + + if (CURLE_OK != (cc = curl_easy_getinfo(c, CURLINFO_RESPONSE_CODE, &response_code))) + { + fprintf(stderr, "curl_easy_getinfo failed: '%s'\n", curl_easy_strerror(errornum)); + result = 65536; + } + + if (!result && (response_code != 500)) + { + fprintf(stderr, "Unexpected response code: %ld\n", response_code); + result = 131072; + } + + if (!result && (cbc.pos != 0)) + result = 262144; + + curl_easy_cleanup (c); + MHD_stop_daemon (d); + curl_slist_free_all(headers); + return result; +} + + +static int +testMultithreadedPostCancel() +{ + int result = 0; + int flags; + for(flags = 0; flags < FLAG_COUNT; ++flags) + result |= testMultithreadedPostCancelPart(flags); + return result; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testMultithreadedPostCancel (); + errorCount += testInternalPost (); + errorCount += testMultithreadedPost (); + errorCount += testMultithreadedPoolPost (); + errorCount += testExternalPost (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c new file mode 100644 index 0000000..5ed5743 --- /dev/null +++ b/src/testcurl/test_post_loop.c @@ -0,0 +1,612 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_post_loop.c + * @brief Testcase for libmicrohttpd POST operations using URL-encoding + * @author Christian Grothoff (inspired by bug report #1296) + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +#define POST_DATA "\n\n1\n\n" + +#define LOOPCOUNT 1000 + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **mptr) +{ + static int marker; + struct MHD_Response *response; + int ret; + (void)cls;(void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("POST", method)) + { + printf ("METHOD: %s\n", method); + return MHD_NO; /* unexpected method */ + } + if ((*mptr != NULL) && (0 == *upload_data_size)) + { + if (*mptr != &marker) + abort (); + response = MHD_create_response_from_buffer (2, "OK", + MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + *mptr = NULL; + return ret; + } + if (strlen (POST_DATA) != *upload_data_size) + return MHD_YES; + *upload_data_size = 0; + *mptr = ▮ + return MHD_YES; +} + + +static int +testInternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int i; + char url[1024]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1350; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + for (i = 0; i < LOOPCOUNT; i++) + { + if (99 == i % 100) + fprintf (stderr, "."); + c = curl_easy_init (); + cbc.pos = 0; + buf[0] = '\0'; + sprintf (url, "http://127.0.0.1:%d/hw%d", port, i); + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + if ((buf[0] != 'O') || (buf[1] != 'K')) + { + MHD_stop_daemon (d); + return 4; + } + } + MHD_stop_daemon (d); + if (LOOPCOUNT >= 99) + fprintf (stderr, "\n"); + return 0; +} + +static int +testMultithreadedPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int i; + char url[1024]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1351; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + for (i = 0; i < LOOPCOUNT; i++) + { + if (99 == i % 100) + fprintf (stderr, "."); + c = curl_easy_init (); + cbc.pos = 0; + buf[0] = '\0'; + sprintf (url, "http://127.0.0.1:%d/hw%d", port, i); + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + if ((buf[0] != 'O') || (buf[1] != 'K')) + { + MHD_stop_daemon (d); + return 64; + } + } + MHD_stop_daemon (d); + if (LOOPCOUNT >= 99) + fprintf (stderr, "\n"); + return 0; +} + +static int +testMultithreadedPoolPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int i; + char url[1024]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1352; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + for (i = 0; i < LOOPCOUNT; i++) + { + if (99 == i % 100) + fprintf (stderr, "."); + c = curl_easy_init (); + cbc.pos = 0; + buf[0] = '\0'; + sprintf (url, "http://127.0.0.1:%d/hw%d", port, i); + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + if ((buf[0] != 'O') || (buf[1] != 'K')) + { + MHD_stop_daemon (d); + return 64; + } + } + MHD_stop_daemon (d); + if (LOOPCOUNT >= 99) + fprintf (stderr, "\n"); + return 0; +} + +static int +testExternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int i; + unsigned long long timeout; + long ctimeout; + char url[1024]; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1353; + if (oneone) + port += 10; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + for (i = 0; i < LOOPCOUNT; i++) + { + if (99 == i % 100) + fprintf (stderr, "."); + c = curl_easy_init (); + cbc.pos = 0; + buf[0] = '\0'; + sprintf (url, "http://127.0.0.1:%d/hw%d", port, i); + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + while (CURLM_CALL_MULTI_PERFORM == + curl_multi_perform (multi, &running)); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + if (MHD_NO == MHD_get_timeout (d, &timeout)) + timeout = 100; /* 100ms == INFTY -- CURL bug... */ + if ((CURLM_OK == curl_multi_timeout (multi, &ctimeout)) && + (ctimeout < (long long)timeout) && (ctimeout >= 0)) + timeout = ctimeout; + if ( (c == NULL) || (running == 0) ) + timeout = 0; /* terminate quickly... */ + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { + if (EINTR == errno) + continue; + fprintf (stderr, + "select failed: %s\n", + strerror (errno)); + break; + } + while (CURLM_CALL_MULTI_PERFORM == + curl_multi_perform (multi, &running)); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + } + MHD_run (d); + } + if (c != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + } + if ((buf[0] != 'O') || (buf[1] != 'K')) + { + curl_multi_cleanup (multi); + MHD_stop_daemon (d); + return 8192; + } + } + curl_multi_cleanup (multi); + MHD_stop_daemon (d); + if (LOOPCOUNT >= 99) + fprintf (stderr, "\n"); + return 0; +} + + +/** + * Time this round was started. + */ +static unsigned long long start_time; + + +/** + * Get the current timestamp + * + * @return current time in ms + */ +static unsigned long long +now () +{ + struct timeval tv; + + gettimeofday (&tv, NULL); + return (((unsigned long long) tv.tv_sec * 1000LL) + + ((unsigned long long) tv.tv_usec / 1000LL)); +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + start_time = now(); + errorCount += testInternalPost (); + fprintf (stderr, + oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n", + "internal select", + (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0)); + GAUGER ("internal select", + oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)", + (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0), + "requests/s"); + start_time = now(); + errorCount += testMultithreadedPost (); + fprintf (stderr, + oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n", + "multithreaded post", + (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0)); + GAUGER ("Multithreaded select", + oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)", + (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0), + "requests/s"); + start_time = now(); + errorCount += testMultithreadedPoolPost (); + fprintf (stderr, + oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n", + "thread with pool", + (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0)); + GAUGER ("thread with pool", + oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)", + (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0), + "requests/s"); + start_time = now(); + errorCount += testExternalPost (); + fprintf (stderr, + oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n", + "external select", + (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0)); + GAUGER ("external select", + oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)", + (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0), + "requests/s"); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c new file mode 100644 index 0000000..f94ed1f --- /dev/null +++ b/src/testcurl/test_postform.c @@ -0,0 +1,600 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_postform.c + * @brief Testcase for libmicrohttpd POST operations using multipart/postform data + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#ifdef HAVE_GCRYPT_H +#include +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + +#ifndef WINDOWS +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static void +completed_cb (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct MHD_PostProcessor *pp = *con_cls; + (void)cls;(void)connection;(void)toe; /* Unused. Silent compiler warning. */ + + if (NULL != pp) + MHD_destroy_post_processor (pp); + *con_cls = NULL; +} + + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + + +/** + * Note that this post_iterator is not perfect + * in that it fails to support incremental processing. + * (to be fixed in the future) + */ +static int +post_iterator (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *value, uint64_t off, size_t size) +{ + int *eok = cls; + (void)kind;(void)filename;(void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding;(void)off; /* Unused. Silent compiler warning. */ + +#if 0 + fprintf (stderr, "PI sees %s-%.*s\n", key, size, value); +#endif + if ((0 == strcmp (key, "name")) && + (size == strlen ("daniel")) && (0 == strncmp (value, "daniel", size))) + (*eok) |= 1; + if ((0 == strcmp (key, "project")) && + (size == strlen ("curl")) && (0 == strncmp (value, "curl", size))) + (*eok) |= 2; + return MHD_YES; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int eok; + struct MHD_Response *response; + struct MHD_PostProcessor *pp; + int ret; + (void)cls;(void)version; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("POST", method)) + { + printf ("METHOD: %s\n", method); + return MHD_NO; /* unexpected method */ + } + pp = *unused; + if (pp == NULL) + { + eok = 0; + pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); + if (pp == NULL) + abort (); + *unused = pp; + } + MHD_post_process (pp, upload_data, *upload_data_size); + if ((eok == 3) && (0 == *upload_data_size)) + { + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + MHD_destroy_post_processor (pp); + *unused = NULL; + return ret; + } + *upload_data_size = 0; + return MHD_YES; +} + +static struct curl_httppost * +make_form () +{ + struct curl_httppost *post = NULL; + struct curl_httppost *last = NULL; + + curl_formadd (&post, &last, CURLFORM_COPYNAME, "name", + CURLFORM_COPYCONTENTS, "daniel", CURLFORM_END); + curl_formadd (&post, &last, CURLFORM_COPYNAME, "project", + CURLFORM_COPYCONTENTS, "curl", CURLFORM_END); + return post; +} + + +static int +testInternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + struct curl_httppost *pd; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1390; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + pd = make_form (); + curl_easy_setopt (c, CURLOPT_HTTPPOST, pd); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + curl_formfree (pd); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + curl_formfree (pd); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + +static int +testMultithreadedPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + struct curl_httppost *pd; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1390; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + pd = make_form (); + curl_easy_setopt (c, CURLOPT_HTTPPOST, pd); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 5L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + curl_formfree (pd); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + curl_formfree (pd); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + +static int +testMultithreadedPoolPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + struct curl_httppost *pd; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1391; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + pd = make_form (); + curl_easy_setopt (c, CURLOPT_HTTPPOST, pd); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 5L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + curl_formfree (pd); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + curl_formfree (pd); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + +static int +testExternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + struct curl_httppost *pd; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1392; + if (oneone) + port += 10; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + pd = make_form (); + curl_easy_setopt (c, CURLOPT_HTTPPOST, pd); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + curl_formfree (pd); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_formfree (pd); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + curl_formfree (pd); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + curl_formfree (pd); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, + curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + curl_formfree (pd); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + +#ifdef MHD_HTTPS_REQUIRE_GRYPT +#ifdef HAVE_GCRYPT_H + gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); +#ifdef GCRYCTL_INITIALIZATION_FINISHED + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif +#endif +#endif /* MHD_HTTPS_REQUIRE_GRYPT */ + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalPost (); + errorCount += testMultithreadedPost (); + errorCount += testMultithreadedPoolPost (); + errorCount += testExternalPost (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_process_arguments.c b/src/testcurl/test_process_arguments.c new file mode 100644 index 0000000..4f29574 --- /dev/null +++ b/src/testcurl/test_process_arguments.c @@ -0,0 +1,286 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2013 Christian Grothoff + + libmicrohttpd 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 3, or (at your + option) any later version. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_process_arguments.c + * @brief Testcase for HTTP URI arguments + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + const char *hdr; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + hdr = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "k"); + if ((hdr == NULL) || (0 != strcmp (hdr, "v x"))) + abort (); + hdr = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, "hash"); + if ((hdr == NULL) || (0 != strcmp (hdr, "#foo"))) + abort (); + hdr = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, "space"); + if ((hdr == NULL) || (0 != strcmp (hdr, "\240bar"))) + abort (); + if (3 != MHD_get_connection_values (connection, + MHD_GET_ARGUMENT_KIND, + NULL, NULL)) + abort (); + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1410; + if (oneone) + port += 5; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, + "http://127.0.0.1/hello+world?k=v+x&hash=%23foo&space=%A0bar"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello+world")) + return 8192; + if (0 != strncmp ("/hello+world", cbc.buf, strlen ("/hello+world"))) + return 16384; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testExternalGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_process_headers.c b/src/testcurl/test_process_headers.c new file mode 100644 index 0000000..d123c44 --- /dev/null +++ b/src/testcurl/test_process_headers.c @@ -0,0 +1,531 @@ + +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_process_headers.c + * @brief Testcase for HTTP header access + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value) +{ + if ((0 == strcmp (key, MHD_HTTP_HEADER_HOST)) && + (0 == strncmp (value, "127.0.0.1", strlen("127.0.0.1"))) && (kind == MHD_HEADER_KIND)) + { + *((int *) cls) = 1; + return MHD_NO; + } + return MHD_YES; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + const char *hdr; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + ret = 0; + MHD_get_connection_values (connection, MHD_HEADER_KIND, &kv_cb, &ret); + if (ret != 1) + abort (); + hdr = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, "NotFound"); + if (hdr != NULL) + abort (); + hdr = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, MHD_HTTP_HEADER_ACCEPT); + if ((hdr == NULL) || (0 != strcmp (hdr, "*/*"))) + abort (); + hdr = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, MHD_HTTP_HEADER_HOST); + if ((hdr == NULL) || (0 != strncmp (hdr, "127.0.0.1", strlen("127.0.0.1")))) + abort (); + MHD_set_connection_value (connection, + MHD_HEADER_KIND, "FakeHeader", "NowPresent"); + hdr = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, "FakeHeader"); + if ((hdr == NULL) || (0 != strcmp (hdr, "NowPresent"))) + abort (); + + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + if (NULL == response) + abort (); + MHD_add_response_header (response, "MyHeader", "MyValue"); + hdr = MHD_get_response_header (response, "MyHeader"); + if (0 != strcmp ("MyValue", hdr)) + abort (); + MHD_add_response_header (response, "MyHeader", "MyValueToo"); + if (MHD_YES != MHD_del_response_header (response, "MyHeader", "MyValue")) + abort (); + hdr = MHD_get_response_header (response, "MyHeader"); + if (0 != strcmp ("MyValueToo", hdr)) + abort (); + if (1 != MHD_get_response_headers (response, NULL, NULL)) + abort (); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testInternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1420; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + +static int +testMultithreadedGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1421; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + +static int +testMultithreadedPoolGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1422; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + return 0; +} + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1423; + if (oneone) + port += 10; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + errorCount += testInternalGet (); + errorCount += testMultithreadedGet (); + errorCount += testMultithreadedPoolGet (); + errorCount += testExternalGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c new file mode 100644 index 0000000..83c4a12 --- /dev/null +++ b/src/testcurl/test_put.c @@ -0,0 +1,534 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_put.c + * @brief Testcase for libmicrohttpd PUT operations + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + unsigned int *pos = ptr; + unsigned int wrt; + + wrt = size * nmemb; + if (wrt > 8 - (*pos)) + wrt = 8 - (*pos); + memcpy (stream, &("Hello123"[*pos]), wrt); + (*pos) += wrt; + return wrt; +} + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcasecmp ("PUT", method)) + return MHD_NO; /* unexpected method */ + if ((*done) == 0) + { + if (*upload_data_size != 8) + return MHD_YES; /* not yet ready */ + if (0 == memcmp (upload_data, "Hello123", 8)) + { + *upload_data_size = 0; + } + else + { + printf ("Invalid upload data `%8s'!\n", upload_data); + return MHD_NO; + } + *done = 1; + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), (void*) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testInternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1450; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + +static int +testMultithreadedPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1451; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + +static int +testMultithreadedPoolPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1452; + if (oneone) + port += 10; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + + +static int +testExternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + unsigned int pos = 0; + int done_flag = 0; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1453; + if (oneone) + port += 10; + } + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); +curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalPut (); + errorCount += testMultithreadedPut (); + errorCount += testMultithreadedPoolPut (); + errorCount += testExternalPut (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c new file mode 100644 index 0000000..479079f --- /dev/null +++ b/src/testcurl/test_put_chunked.c @@ -0,0 +1,527 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_put_chunked.c + * @brief Testcase for libmicrohttpd PUT operations with chunked encoding + * for the upload data + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + unsigned int *pos = ptr; + unsigned int wrt; + + wrt = size * nmemb; + if (wrt > 8 - (*pos)) + wrt = 8 - (*pos); + if (wrt > 4) + wrt = 4; /* only send half at first => force multiple chunks! */ + memcpy (stream, &("Hello123"[*pos]), wrt); + (*pos) += wrt; + return wrt; +} + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + int have; + (void)version;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("PUT", method)) + return MHD_NO; /* unexpected method */ + if ((*done) < 8) + { + have = *upload_data_size; + if (have + *done > 8) + { + printf ("Invalid upload data `%8s'!\n", upload_data); + return MHD_NO; + } + if (0 == memcmp (upload_data, &"Hello123"[*done], have)) + { + *done += have; + *upload_data_size = 0; + } + else + { + printf ("Invalid upload data `%8s'!\n", upload_data); + return MHD_NO; + } +#if 0 + fprintf (stderr, "Not ready for response: %u/%u\n", *done, 8); +#endif + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testInternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1440; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + /* by not giving the file size, we force chunking! */ + /* + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + */ + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + +static int +testMultithreadedPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1441; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + /* by not giving the file size, we force chunking! */ + /* + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + */ + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + +static int +testMultithreadedPoolPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1442; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + /* by not giving the file size, we force chunking! */ + /* + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + */ + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + + +static int +testExternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + unsigned int pos = 0; + int done_flag = 0; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1443; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + /* by not giving the file size, we force chunking! */ + /* + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + */ + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (multi != NULL)) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (running == 0) + { + msg = curl_multi_info_read (multi, &running); + if (msg == NULL) + break; + if (msg->msg == CURLMSG_DONE) + { + if (msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, + curl_easy_strerror (msg->data.result)); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + if (multi != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalPut (); + errorCount += testMultithreadedPut (); + errorCount += testMultithreadedPoolPut (); + errorCount += testExternalPut (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c new file mode 100644 index 0000000..f9fd969 --- /dev/null +++ b/src/testcurl/test_quiesce.c @@ -0,0 +1,552 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2013, 2015 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +/** + * @file test_quiesce.c + * @brief Testcase for libmicrohttpd quiescing + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include +#include +#include +#include "mhd_sockets.h" /* only macros used */ + + +#ifndef WINDOWS +#include +#include +#endif + +#if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 +#undef CPU_COUNT +#endif +#if !defined(CPU_COUNT) +#define CPU_COUNT 2 +#endif + + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static int port; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static void +request_completed (void *cls, struct MHD_Connection *connection, + void **con_cls, enum MHD_RequestTerminationCode code) +{ + (void)connection;(void)con_cls;(void)code; /* Unused. Silent compiler warning. */ + int *done = (int *)cls; + *done = 1; +} + + +static void * +ServeOneRequest(void *param) +{ + struct MHD_Daemon *d; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket fd, max; + time_t start; + struct timeval tv; + int done = 0; + + fd = (MHD_socket) (intptr_t) param; + + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 0, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_LISTEN_SOCKET, fd, + MHD_OPTION_NOTIFY_COMPLETED, &request_completed, &done, + MHD_OPTION_END); + if (d == NULL) + return "MHD_start_daemon() failed"; + + start = time (NULL); + while ((time (NULL) - start < 5) && done == 0) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + MHD_stop_daemon (d); + MHD_socket_close_chk_(fd); + return "MHD_get_fdset() failed"; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == MHD_SYS_select_ (max + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + MHD_run (d); + } + fd = MHD_quiesce_daemon (d); + if (MHD_INVALID_SOCKET == fd) + { + MHD_stop_daemon (d); + return "MHD_quiesce_daemon() failed in ServeOneRequest()"; + } + MHD_stop_daemon (d); + return done ? NULL : "Requests was not served by ServeOneRequest()"; +} + + +static CURL * +setupCURL (void *cbc) +{ + CURL *c; + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + return c; +} + + +static int +testGet (int type, int pool_count, int poll_flag) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + MHD_socket fd; + pthread_t thrd; + const char *thrdRet; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1480; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + if (pool_count > 0) { + d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag, + port, NULL, NULL, &ahc_echo, "GET", + MHD_OPTION_THREAD_POOL_SIZE, pool_count, MHD_OPTION_END); + + } else { + d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + } + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + + c = setupCURL(&cbc); + + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + + if (cbc.pos != strlen ("/hello_world")) { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4; + } + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 8; + } + + fd = MHD_quiesce_daemon (d); + if (MHD_INVALID_SOCKET == fd) + { + fprintf (stderr, + "MHD_quiesce_daemon failed.\n"); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + if (0 != pthread_create(&thrd, NULL, &ServeOneRequest, (void*)(intptr_t) fd)) + { + fprintf (stderr, "pthread_create failed\n"); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 16; + } + + cbc.pos = 0; + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + + if (0 != pthread_join(thrd, (void**)&thrdRet)) + { + fprintf (stderr, "pthread_join failed\n"); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 16; + } + if (NULL != thrdRet) + { + fprintf (stderr, "ServeOneRequest() error: %s\n", thrdRet); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 16; + } + + if (cbc.pos != strlen ("/hello_world")) + { + fprintf(stderr, "%s\n", cbc.buf); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + MHD_socket_close_chk_(fd); + return 4; + } + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + { + fprintf(stderr, "%s\n", cbc.buf); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + MHD_socket_close_chk_(fd); + return 8; + } + + /* at this point, the forked server quit, and the new + * server has quiesced, so new requests should fail + */ + if (CURLE_OK == (errornum = curl_easy_perform (c))) + { + fprintf (stderr, "curl_easy_perform should fail\n"); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + MHD_socket_close_chk_(fd); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + MHD_socket_close_chk_(fd); + + return 0; +} + + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + MHD_socket maxsock; +#ifdef MHD_WINSOCK_SOCKETS + int maxposixs; /* Max socket number unused on W32 */ +#else /* MHD_POSIX_SOCKETS */ +#define maxposixs maxsock +#endif /* MHD_POSIX_SOCKETS */ + int running; + struct CURLMsg *msg; + time_t start; + struct timeval tv; + int i; + MHD_socket fd; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1481; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + port, + NULL, NULL, + &ahc_echo, "GET", + MHD_OPTION_END); + if (d == NULL) + return 256; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = setupCURL(&cbc); + + multi = curl_multi_init (); + if (multi == NULL) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 512; + } + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 1024; + } + + for (i = 0; i < 2; i++) + { + start = time (NULL); + while ( (time (NULL) - start < 5) && + (NULL != multi) ) + { + maxsock = MHD_INVALID_SOCKET; + maxposixs = -1; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) + { +#ifdef MHD_POSIX_SOCKETS + if (EINTR != errno) + abort (); +#else + if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) + abort (); + Sleep (1000); +#endif + } + curl_multi_perform (multi, &running); + if (0 == running) + { + msg = curl_multi_info_read (multi, &running); + if (NULL == msg) + break; + if (msg->msg == CURLMSG_DONE) + { + if (i == 0 && msg->data.result != CURLE_OK) + printf ("%s failed at %s:%d: `%s'\n", + "curl_multi_perform", + __FILE__, + __LINE__, + curl_easy_strerror (msg->data.result)); + else if ( (i == 1) && + (msg->data.result == CURLE_OK) ) + printf ("%s should have failed at %s:%d\n", + "curl_multi_perform", + __FILE__, + __LINE__); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + c = NULL; + multi = NULL; + } + } + MHD_run (d); + } + + if (0 == i) + { + /* quiesce the daemon on the 1st iteration, so the 2nd should fail */ + fd = MHD_quiesce_daemon(d); + if (MHD_INVALID_SOCKET == fd) + { + fprintf (stderr, + "MHD_quiesce_daemon failed.\n"); + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + c = setupCURL (&cbc); + multi = curl_multi_init (); + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32768; + } + } + } + if (NULL != multi) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + curl_multi_cleanup (multi); + } + MHD_stop_daemon (d); + MHD_socket_close_chk_ (fd); + if (cbc.pos != strlen ("/hello_world")) + return 8192; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 16384; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, 0, 0); + errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, 0, 0); + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, CPU_COUNT, 0); + errorCount += testExternalGet (); + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_POLL)) + { + errorCount += testGet(MHD_USE_INTERNAL_POLLING_THREAD, 0, MHD_USE_POLL); + errorCount += testGet (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, 0, MHD_USE_POLL); + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, CPU_COUNT, MHD_USE_POLL); + } + if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) + { + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, 0, MHD_USE_EPOLL); + errorCount += testGet (MHD_USE_INTERNAL_POLLING_THREAD, CPU_COUNT, MHD_USE_EPOLL); + } + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testcurl/test_quiesce_stream.c b/src/testcurl/test_quiesce_stream.c new file mode 100644 index 0000000..f908545 --- /dev/null +++ b/src/testcurl/test_quiesce_stream.c @@ -0,0 +1,237 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2016 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +/** + * @file test_quiesce_stream.c + * @brief Testcase for libmicrohttpd quiescing + * @author Markus Doppelbauer + * @author Christian Grothoff + * @author Karlson2k (Evgeny Grin) + */ +#include "mhd_options.h" +#include +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#elif defined(_WIN32) +#include +#define sleep(s) (Sleep((s)*1000), 0) +#endif /* _WIN32 */ + + +static volatile unsigned int request_counter; + + +static void +http_PanicCallback (void *cls, + const char *file, + unsigned int line, + const char *reason) +{ + (void)cls; /* Unused. Silent compiler warning. */ + fprintf( stderr, + "PANIC: exit process: %s at %s:%u\n", + reason, + file, + line); + exit (EXIT_FAILURE); +} + + +static void * +resume_connection (void *arg) +{ + struct MHD_Connection *connection = arg; + + /* fprintf (stderr, "Calling resume\n"); */ + MHD_resume_connection (connection); + return NULL; +} + + +static void +suspend_connection (struct MHD_Connection *connection) +{ + pthread_t thread_id; + + /* fprintf (stderr, "Calling suspend\n"); */ + MHD_suspend_connection (connection); + int status = pthread_create (&thread_id, + NULL, + &resume_connection, + connection); + if (0 != status) + { + fprintf (stderr, + "Could not create thead\n"); + exit( EXIT_FAILURE ); + } + pthread_detach (thread_id); +} + + +struct ContentReaderUserdata +{ + int bytes_written; + struct MHD_Connection *connection; +}; + + +static ssize_t +http_ContentReaderCallback (void *cls, + uint64_t pos, + char *buf, + size_t max) +{ + static const char alphabet[] = "\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + struct ContentReaderUserdata *userdata = cls; + (void)pos;(void)max; /* Unused. Silent compiler warning. */ + + if( userdata->bytes_written >= 1024) + { + fprintf( stderr, + "finish: %d\n", + request_counter); + return MHD_CONTENT_READER_END_OF_STREAM; + } + userdata->bytes_written++; + buf[0] = alphabet[userdata->bytes_written % (sizeof(alphabet) - 1)]; + suspend_connection (userdata->connection); + + return 1; +} + + +static int +http_AccessHandlerCallback (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + size_t *upload_data_size, + void **con_cls ) +{ + int ret; + (void)cls;(void)url; /* Unused. Silent compiler warning. */ + (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + /* Never respond on first call */ + if (NULL == *con_cls) + { + fprintf (stderr, + "start: %d\n", + ++request_counter); + + struct ContentReaderUserdata *userdata = malloc (sizeof(struct ContentReaderUserdata)); + + if (NULL == userdata) + return MHD_NO; + userdata->bytes_written = 0; + userdata->connection = connection; + *con_cls = userdata; + return MHD_YES; + } + + /* Second call: create response */ + struct MHD_Response *response + = MHD_create_response_from_callback (-1, + 32 * 1024, + &http_ContentReaderCallback, + *con_cls, + NULL); + ret = MHD_queue_response (connection, + MHD_HTTP_OK, + response); + MHD_destroy_response (response); + + suspend_connection (connection); + return ret; +} + + +int +main(void) +{ + int port; + char command_line[1024]; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1470; + + /* Panic callback */ + MHD_set_panic_func (&http_PanicCallback, + NULL); + + /* Flags */ + unsigned int daemon_flags + = MHD_USE_INTERNAL_POLLING_THREAD + | MHD_USE_AUTO + | MHD_ALLOW_SUSPEND_RESUME + | MHD_USE_ITC; + + /* Create daemon */ + struct MHD_Daemon *daemon = MHD_start_daemon (daemon_flags, + port, + NULL, + NULL, + &http_AccessHandlerCallback, + NULL, + MHD_OPTION_END); + if (NULL == daemon) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (daemon, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (daemon); return 32; } + port = (int)dinfo->port; + } + sprintf(command_line, "curl -s http://127.0.0.1:%d", port); + + if (0 != system (command_line)) + { + MHD_stop_daemon (daemon); + return 1; + } + /* wait for a request */ + while (0 == request_counter) + (void)sleep (1); + + fprintf (stderr, + "quiesce\n"); + MHD_quiesce_daemon (daemon); + + /* wait a second */ + (void)sleep (1); + + fprintf (stderr, + "stopping daemon\n"); + MHD_stop_daemon (daemon); + + return 0; +} diff --git a/src/testcurl/test_termination.c b/src/testcurl/test_termination.c new file mode 100644 index 0000000..6f633c8 --- /dev/null +++ b/src/testcurl/test_termination.c @@ -0,0 +1,143 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2009 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_termination.c + * @brief Testcase for libmicrohttpd tolerating client not closing immediately + * @author hollosig + */ + +#include "platform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef __MINGW32__ +#include +#include +#endif + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +static int +connection_handler (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t * upload_data_size, + void **ptr) +{ + static int i; + (void)cls;(void)url; /* Unused. Silent compiler warning. */ + (void)method;(void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (*ptr == NULL) + { + *ptr = &i; + return MHD_YES; + } + + if (*upload_data_size != 0) + { + (*upload_data_size) = 0; + return MHD_YES; + } + + struct MHD_Response *response = + MHD_create_response_from_buffer (strlen ("Response"), "Response", + MHD_RESPMEM_PERSISTENT); + int ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + + return ret; +} + +static size_t +write_data (void *ptr, size_t size, size_t nmemb, void *stream) +{ + (void)ptr;(void)stream; /* Unused. Silent compiler warning. */ + return size * nmemb; +} + +int +main (void) +{ + struct MHD_Daemon *daemon; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + port = 1490; + + + daemon = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, + NULL, connection_handler, NULL, MHD_OPTION_END); + + if (daemon == NULL) + { + fprintf (stderr, "Daemon cannot be started!"); + exit (1); + } + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (daemon, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (daemon); return 32; } + port = (int)dinfo->port; + } + + CURL *curl = curl_easy_init (); + /* curl_easy_setopt(curl, CURLOPT_POST, 1L); */ + char url[255]; + sprintf (url, "http://127.0.0.1:%d", port); + curl_easy_setopt (curl, CURLOPT_URL, url); + curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, write_data); + + CURLcode success = curl_easy_perform (curl); + if (success != 0) + { + fprintf (stderr, "CURL Error"); + exit (1); + } + /* CPU used to go crazy here */ + (void)sleep (1); + + curl_easy_cleanup (curl); + MHD_stop_daemon (daemon); + + return 0; +} diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c new file mode 100644 index 0000000..7621cfd --- /dev/null +++ b/src/testcurl/test_timeout.c @@ -0,0 +1,336 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_timeout.c + * @brief Testcase for libmicrohttpd PUT operations + * @author Matthias Wachs + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +static int oneone; + +static int withTimeout = 1; + +static int withoutTimeout = 1; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static void +termination_cb (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + int *test = cls; + (void)connection;(void)con_cls; /* Unused. Silent compiler warning. */ + + switch (toe) + { + case MHD_REQUEST_TERMINATED_COMPLETED_OK : + if (test == &withoutTimeout) + { + withoutTimeout = 0; + } + break; + case MHD_REQUEST_TERMINATED_WITH_ERROR : + case MHD_REQUEST_TERMINATED_READ_ERROR : + break; + case MHD_REQUEST_TERMINATED_TIMEOUT_REACHED : + if (test == &withTimeout) + { + withTimeout = 0; + } + break; + case MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN: + break; + case MHD_REQUEST_TERMINATED_CLIENT_ABORT: + break; + } +} + + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + unsigned int *pos = ptr; + unsigned int wrt; + + wrt = size * nmemb; + if (wrt > 8 - (*pos)) + wrt = 8 - (*pos); + memcpy (stream, &("Hello123"[*pos]), wrt); + (*pos) += wrt; + return wrt; +} + + +static size_t +putBuffer_fail (void *stream, size_t size, size_t nmemb, void *ptr) +{ + (void)stream;(void)size;(void)nmemb;(void)ptr; /* Unused. Silent compiler warning. */ + return 0; +} + + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("PUT", method)) + return MHD_NO; /* unexpected method */ + if ((*done) == 0) + { + if (*upload_data_size != 8) + return MHD_YES; /* not yet ready */ + if (0 == memcmp (upload_data, "Hello123", 8)) + { + *upload_data_size = 0; + } + else + { + printf ("Invalid upload data `%8s'!\n", upload_data); + return MHD_NO; + } + *done = 1; + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testWithoutTimeout () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1500; + if (oneone) + port += 5; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_CONNECTION_TIMEOUT, 2, + MHD_OPTION_NOTIFY_COMPLETED, &termination_cb, &withTimeout, + MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + return 0; +} + +static int +testWithTimeout () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int done_flag = 0; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1501; + if (oneone) + port += 5; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + port, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_CONNECTION_TIMEOUT, 2, + MHD_OPTION_NOTIFY_COMPLETED, &termination_cb, &withoutTimeout, + MHD_OPTION_END); + if (d == NULL) + return 16; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer_fail); + curl_easy_setopt (c, CURLOPT_READDATA, &testWithTimeout); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (errornum == CURLE_GOT_NOTHING) + /* mhd had the timeout */ + return 0; + else + /* curl had the timeout first */ + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 64; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 16; + errorCount += testWithoutTimeout (); + errorCount += testWithTimeout (); + if (errorCount != 0) + fprintf (stderr, + "Error during test execution (code: %u)\n", + errorCount); + curl_global_cleanup (); + if ((withTimeout == 0) && (withoutTimeout == 0)) + return 0; + else + return errorCount; /* 0 == pass */ +} diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c new file mode 100644 index 0000000..8675f19 --- /dev/null +++ b/src/testcurl/test_urlparse.c @@ -0,0 +1,213 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2009, 2011 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_urlparse.c + * @brief Testcase for libmicrohttpd url parsing + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + +#ifndef WINDOWS +#include +#include +#endif + +static int oneone; + +static int matches; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +test_values (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *value) +{ + (void)cls;(void)kind; /* Unused. Silent compiler warning. */ + if ( (0 == strcmp (key, "a")) && + (0 == strcmp (value, "b")) ) + matches += 1; + if ( (0 == strcmp (key, "c")) && + (0 == strcmp (value, "")) ) + matches += 2; + if ( (0 == strcmp (key, "d")) && + (NULL == value) ) + matches += 4; + return MHD_YES; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + MHD_get_connection_values (connection, + MHD_GET_ARGUMENT_KIND, + &test_values, + NULL); + *unused = NULL; + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testInternalGet (int poll_flag) +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLcode errornum; + int port; + + if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) + port = 0; + else + { + port = 1510; + if (oneone) + port += 5; + } + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG | poll_flag, + port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + if (0 == port) + { + const union MHD_DaemonInfo *dinfo; + dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); + if (NULL == dinfo || 0 == dinfo->port) + { MHD_stop_daemon (d); return 32; } + port = (int)dinfo->port; + } + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world?a=b&c=&d"); + curl_easy_setopt (c, CURLOPT_PORT, (long)port); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + setting NOSIGNAL results in really weird + crashes on my system!*/ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 2; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 4; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 8; + if (matches != 7) + return 16; + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalGet (0); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testzzuf/Makefile.am b/src/testzzuf/Makefile.am new file mode 100644 index 0000000..329fe04 --- /dev/null +++ b/src/testzzuf/Makefile.am @@ -0,0 +1,109 @@ +# This Makefile.am is in the public domain +SUBDIRS = . + +if USE_COVERAGE + AM_CFLAGS = -fprofile-arcs -ftest-coverage +endif + + +AM_CPPFLAGS = -I$(top_srcdir)/src/include \ + $(LIBCURL_CPPFLAGS) + +EXTRA_DIST = README socat.c + +check_PROGRAMS = \ + test_get \ + test_get_chunked \ + test_post \ + test_post_form \ + test_put \ + test_put_chunked \ + test_put_large \ + test_get11 \ + test_post11 \ + test_post_form11 \ + test_put11 \ + test_put_large11 \ + test_long_header + +TESTS = $(check_PROGRAMS) + +test_get_SOURCES = \ + test_get.c +test_get_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get_chunked_SOURCES = \ + test_get_chunked.c +test_get_chunked_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post_SOURCES = \ + test_post.c +test_post_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post_form_SOURCES = \ + test_post_form.c +test_post_form_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_SOURCES = \ + test_put.c +test_put_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_chunked_SOURCES = \ + test_put_chunked.c +test_put_chunked_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_large_SOURCES = \ + test_put_large.c +test_put_large_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + + + +test_get11_SOURCES = \ + test_get.c +test_get11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post11_SOURCES = \ + test_post.c +test_post11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post_form11_SOURCES = \ + test_post_form.c +test_post_form11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put11_SOURCES = \ + test_put.c +test_put11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_large11_SOURCES = \ + test_put_large.c +test_put_large11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_long_header_SOURCES = \ + test_long_header.c +test_long_header_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ diff --git a/src/testzzuf/Makefile.in b/src/testzzuf/Makefile.in new file mode 100644 index 0000000..261d7ef --- /dev/null +++ b/src/testzzuf/Makefile.in @@ -0,0 +1,1432 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 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@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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 = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = test_get$(EXEEXT) test_get_chunked$(EXEEXT) \ + test_post$(EXEEXT) test_post_form$(EXEEXT) test_put$(EXEEXT) \ + test_put_chunked$(EXEEXT) test_put_large$(EXEEXT) \ + test_get11$(EXEEXT) test_post11$(EXEEXT) \ + test_post_form11$(EXEEXT) test_put11$(EXEEXT) \ + test_put_large11$(EXEEXT) test_long_header$(EXEEXT) +subdir = src/testzzuf +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_link_flag.m4 \ + $(top_srcdir)/m4/ax_count_cpus.m4 \ + $(top_srcdir)/m4/ax_have_epoll.m4 \ + $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mhd_shutdown_socket_trigger.m4 \ + $(top_srcdir)/m4/mhd_sys_extentions.m4 $(top_srcdir)/m4/pkg.m4 \ + $(top_srcdir)/m4/search_h.m4 $(top_srcdir)/m4/tsearch.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/MHD_config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_test_get_OBJECTS = test_get.$(OBJEXT) +test_get_OBJECTS = $(am_test_get_OBJECTS) +test_get_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am_test_get11_OBJECTS = test_get.$(OBJEXT) +test_get11_OBJECTS = $(am_test_get11_OBJECTS) +test_get11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_get_chunked_OBJECTS = test_get_chunked.$(OBJEXT) +test_get_chunked_OBJECTS = $(am_test_get_chunked_OBJECTS) +test_get_chunked_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_long_header_OBJECTS = test_long_header.$(OBJEXT) +test_long_header_OBJECTS = $(am_test_long_header_OBJECTS) +test_long_header_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_post_OBJECTS = test_post.$(OBJEXT) +test_post_OBJECTS = $(am_test_post_OBJECTS) +test_post_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_post11_OBJECTS = test_post.$(OBJEXT) +test_post11_OBJECTS = $(am_test_post11_OBJECTS) +test_post11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_post_form_OBJECTS = test_post_form.$(OBJEXT) +test_post_form_OBJECTS = $(am_test_post_form_OBJECTS) +test_post_form_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_post_form11_OBJECTS = test_post_form.$(OBJEXT) +test_post_form11_OBJECTS = $(am_test_post_form11_OBJECTS) +test_post_form11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_put_OBJECTS = test_put.$(OBJEXT) +test_put_OBJECTS = $(am_test_put_OBJECTS) +test_put_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_put11_OBJECTS = test_put.$(OBJEXT) +test_put11_OBJECTS = $(am_test_put11_OBJECTS) +test_put11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_put_chunked_OBJECTS = test_put_chunked.$(OBJEXT) +test_put_chunked_OBJECTS = $(am_test_put_chunked_OBJECTS) +test_put_chunked_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_put_large_OBJECTS = test_put_large.$(OBJEXT) +test_put_large_OBJECTS = $(am_test_put_large_OBJECTS) +test_put_large_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +am_test_put_large11_OBJECTS = test_put_large.$(OBJEXT) +test_put_large11_OBJECTS = $(am_test_put_large11_OBJECTS) +test_put_large11_DEPENDENCIES = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_get_SOURCES) $(test_get11_SOURCES) \ + $(test_get_chunked_SOURCES) $(test_long_header_SOURCES) \ + $(test_post_SOURCES) $(test_post11_SOURCES) \ + $(test_post_form_SOURCES) $(test_post_form11_SOURCES) \ + $(test_put_SOURCES) $(test_put11_SOURCES) \ + $(test_put_chunked_SOURCES) $(test_put_large_SOURCES) \ + $(test_put_large11_SOURCES) +DIST_SOURCES = $(test_get_SOURCES) $(test_get11_SOURCES) \ + $(test_get_chunked_SOURCES) $(test_long_header_SOURCES) \ + $(test_post_SOURCES) $(test_post11_SOURCES) \ + $(test_post_form_SOURCES) $(test_post_form11_SOURCES) \ + $(test_put_SOURCES) $(test_put11_SOURCES) \ + $(test_put_chunked_SOURCES) $(test_put_large_SOURCES) \ + $(test_put_large11_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + check recheck distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +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 = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_COUNT = @CPU_COUNT@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMPTY_VAR = @EMPTY_VAR@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GNULIB_TSEARCH = @GNULIB_TSEARCH@ +GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ +GNUTLS_CPPFLAGS = @GNUTLS_CPPFLAGS@ +GNUTLS_LDFLAGS = @GNUTLS_LDFLAGS@ +GNUTLS_LIBS = @GNUTLS_LIBS@ +GREP = @GREP@ +HAVE_CURL_BINARY = @HAVE_CURL_BINARY@ +HAVE_MAKEINFO_BINARY = @HAVE_MAKEINFO_BINARY@ +HAVE_TSEARCH = @HAVE_TSEARCH@ +HIDDEN_VISIBILITY_CFLAGS = @HIDDEN_VISIBILITY_CFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_VERSION_AGE = @LIB_VERSION_AGE@ +LIB_VERSION_CURRENT = @LIB_VERSION_CURRENT@ +LIB_VERSION_REVISION = @LIB_VERSION_REVISION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MHD_LIBDEPS = @MHD_LIBDEPS@ +MHD_LIBDEPS_PKGCFG = @MHD_LIBDEPS_PKGCFG@ +MHD_LIB_CFLAGS = @MHD_LIB_CFLAGS@ +MHD_LIB_CPPFLAGS = @MHD_LIB_CPPFLAGS@ +MHD_LIB_LDFLAGS = @MHD_LIB_LDFLAGS@ +MHD_REQ_PRIVATE = @MHD_REQ_PRIVATE@ +MHD_W32_DLL_SUFF = @MHD_W32_DLL_SUFF@ +MKDIR_P = @MKDIR_P@ +MS_LIB_TOOL = @MS_LIB_TOOL@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@ +PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@ +PACKAGE_VERSION_SUBMINOR = @PACKAGE_VERSION_SUBMINOR@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +RC = @RC@ +REPLACE_TSEARCH = @REPLACE_TSEARCH@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +_libcurl_config = @_libcurl_config@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_socat = @have_socat@ +have_zzuf = @have_zzuf@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_cv_objdir = @lt_cv_objdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# This Makefile.am is in the public domain +SUBDIRS = . +@USE_COVERAGE_TRUE@AM_CFLAGS = -fprofile-arcs -ftest-coverage +AM_CPPFLAGS = -I$(top_srcdir)/src/include \ + $(LIBCURL_CPPFLAGS) + +EXTRA_DIST = README socat.c +TESTS = $(check_PROGRAMS) +test_get_SOURCES = \ + test_get.c + +test_get_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get_chunked_SOURCES = \ + test_get_chunked.c + +test_get_chunked_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post_SOURCES = \ + test_post.c + +test_post_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post_form_SOURCES = \ + test_post_form.c + +test_post_form_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_SOURCES = \ + test_put.c + +test_put_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_chunked_SOURCES = \ + test_put_chunked.c + +test_put_chunked_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_large_SOURCES = \ + test_put_large.c + +test_put_large_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_get11_SOURCES = \ + test_get.c + +test_get11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post11_SOURCES = \ + test_post.c + +test_post11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_post_form11_SOURCES = \ + test_post_form.c + +test_post_form11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put11_SOURCES = \ + test_put.c + +test_put11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_put_large11_SOURCES = \ + test_put_large.c + +test_put_large11_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +test_long_header_SOURCES = \ + test_long_header.c + +test_long_header_LDADD = \ + $(top_builddir)/src/microhttpd/libmicrohttpd.la \ + @LIBCURL@ + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/testzzuf/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/testzzuf/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_get$(EXEEXT): $(test_get_OBJECTS) $(test_get_DEPENDENCIES) $(EXTRA_test_get_DEPENDENCIES) + @rm -f test_get$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get_OBJECTS) $(test_get_LDADD) $(LIBS) + +test_get11$(EXEEXT): $(test_get11_OBJECTS) $(test_get11_DEPENDENCIES) $(EXTRA_test_get11_DEPENDENCIES) + @rm -f test_get11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get11_OBJECTS) $(test_get11_LDADD) $(LIBS) + +test_get_chunked$(EXEEXT): $(test_get_chunked_OBJECTS) $(test_get_chunked_DEPENDENCIES) $(EXTRA_test_get_chunked_DEPENDENCIES) + @rm -f test_get_chunked$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_get_chunked_OBJECTS) $(test_get_chunked_LDADD) $(LIBS) + +test_long_header$(EXEEXT): $(test_long_header_OBJECTS) $(test_long_header_DEPENDENCIES) $(EXTRA_test_long_header_DEPENDENCIES) + @rm -f test_long_header$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_long_header_OBJECTS) $(test_long_header_LDADD) $(LIBS) + +test_post$(EXEEXT): $(test_post_OBJECTS) $(test_post_DEPENDENCIES) $(EXTRA_test_post_DEPENDENCIES) + @rm -f test_post$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_post_OBJECTS) $(test_post_LDADD) $(LIBS) + +test_post11$(EXEEXT): $(test_post11_OBJECTS) $(test_post11_DEPENDENCIES) $(EXTRA_test_post11_DEPENDENCIES) + @rm -f test_post11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_post11_OBJECTS) $(test_post11_LDADD) $(LIBS) + +test_post_form$(EXEEXT): $(test_post_form_OBJECTS) $(test_post_form_DEPENDENCIES) $(EXTRA_test_post_form_DEPENDENCIES) + @rm -f test_post_form$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_post_form_OBJECTS) $(test_post_form_LDADD) $(LIBS) + +test_post_form11$(EXEEXT): $(test_post_form11_OBJECTS) $(test_post_form11_DEPENDENCIES) $(EXTRA_test_post_form11_DEPENDENCIES) + @rm -f test_post_form11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_post_form11_OBJECTS) $(test_post_form11_LDADD) $(LIBS) + +test_put$(EXEEXT): $(test_put_OBJECTS) $(test_put_DEPENDENCIES) $(EXTRA_test_put_DEPENDENCIES) + @rm -f test_put$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_put_OBJECTS) $(test_put_LDADD) $(LIBS) + +test_put11$(EXEEXT): $(test_put11_OBJECTS) $(test_put11_DEPENDENCIES) $(EXTRA_test_put11_DEPENDENCIES) + @rm -f test_put11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_put11_OBJECTS) $(test_put11_LDADD) $(LIBS) + +test_put_chunked$(EXEEXT): $(test_put_chunked_OBJECTS) $(test_put_chunked_DEPENDENCIES) $(EXTRA_test_put_chunked_DEPENDENCIES) + @rm -f test_put_chunked$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_put_chunked_OBJECTS) $(test_put_chunked_LDADD) $(LIBS) + +test_put_large$(EXEEXT): $(test_put_large_OBJECTS) $(test_put_large_DEPENDENCIES) $(EXTRA_test_put_large_DEPENDENCIES) + @rm -f test_put_large$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_put_large_OBJECTS) $(test_put_large_LDADD) $(LIBS) + +test_put_large11$(EXEEXT): $(test_put_large11_OBJECTS) $(test_put_large11_DEPENDENCIES) $(EXTRA_test_put_large11_DEPENDENCIES) + @rm -f test_put_large11$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_put_large11_OBJECTS) $(test_put_large11_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_get.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_get_chunked.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_long_header.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_post.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_post_form.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_put.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_put_chunked.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_put_large.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test_get.log: test_get$(EXEEXT) + @p='test_get$(EXEEXT)'; \ + b='test_get'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_get_chunked.log: test_get_chunked$(EXEEXT) + @p='test_get_chunked$(EXEEXT)'; \ + b='test_get_chunked'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_post.log: test_post$(EXEEXT) + @p='test_post$(EXEEXT)'; \ + b='test_post'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_post_form.log: test_post_form$(EXEEXT) + @p='test_post_form$(EXEEXT)'; \ + b='test_post_form'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_put.log: test_put$(EXEEXT) + @p='test_put$(EXEEXT)'; \ + b='test_put'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_put_chunked.log: test_put_chunked$(EXEEXT) + @p='test_put_chunked$(EXEEXT)'; \ + b='test_put_chunked'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_put_large.log: test_put_large$(EXEEXT) + @p='test_put_large$(EXEEXT)'; \ + b='test_put_large'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_get11.log: test_get11$(EXEEXT) + @p='test_get11$(EXEEXT)'; \ + b='test_get11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_post11.log: test_post11$(EXEEXT) + @p='test_post11$(EXEEXT)'; \ + b='test_post11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_post_form11.log: test_post_form11$(EXEEXT) + @p='test_post_form11$(EXEEXT)'; \ + b='test_post_form11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_put11.log: test_put11$(EXEEXT) + @p='test_put11$(EXEEXT)'; \ + b='test_put11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_put_large11.log: test_put_large11$(EXEEXT) + @p='test_put_large11$(EXEEXT)'; \ + b='test_put_large11'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test_long_header.log: test_long_header$(EXEEXT) + @p='test_long_header$(EXEEXT)'; \ + b='test_long_header'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +distdir: $(DISTFILES) + @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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-TESTS check-am clean clean-checkPROGRAMS clean-generic \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ + uninstall uninstall-am + +.PRECIOUS: Makefile + + +# 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: diff --git a/src/testzzuf/README b/src/testzzuf/README new file mode 100644 index 0000000..5ee1569 --- /dev/null +++ b/src/testzzuf/README @@ -0,0 +1,13 @@ +Testcases in this directory require zzuf and socat. + +zzuf is used to randomly mess with the TCP connection between the CURL +clients and the MHD server. The goal is to expose problems in MHD's +error handling (by introducing random syntax errors). socat is +used to listen on port 11081 and forward the randomzied stream to +port 11080 where MHD is waiting. + +As a result, the testcases in this directory do NOT check that +whatever CURL returns is what was expected -- random modifications to +the TCP stream can have random effects ;-). Testcases "fail" if the +code crashes or hangs indefinitely. + diff --git a/src/testzzuf/socat.c b/src/testzzuf/socat.c new file mode 100644 index 0000000..b21f2c6 --- /dev/null +++ b/src/testzzuf/socat.c @@ -0,0 +1,113 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2008,2016 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file socat.c + * @brief Code to fork-exec zzuf and start the socat process + * @author Christian Grothoff + */ + +#include +#include +#include +#include + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif /* !WIN32_LEAN_AND_MEAN */ +#include +#endif + + +/** + * A larger loop count will run more random tests -- + * which would be good, except that it may take too + * long for most user's patience. So this small + * value is the default. + */ +#define LOOP_COUNT 10 + +#define CURL_TIMEOUT 50L + +static pid_t zzuf_pid; + +static void +zzuf_socat_start () +{ + int status; + char *const args[] = { + "zzuf", + "--ratio=0.0:0.75", + "-n", + "-A", + "socat", + "-lf", + "/dev/null", + "TCP4-LISTEN:11081,reuseaddr,fork", + "TCP4:127.0.0.1:11080", + NULL, + }; + zzuf_pid = fork (); + if (zzuf_pid == -1) + { + fprintf (stderr, "fork failed: %s\n", strerror (errno)); + exit (1); + } + if (zzuf_pid != 0) + { + (void)sleep (1); /* allow zzuf and socat to start */ + status = 0; + if (0 < waitpid (zzuf_pid, &status, WNOHANG)) + { + if (WIFEXITED (status)) + fprintf (stderr, + "zzuf died with status code %d!\n", + WEXITSTATUS (status)); + if (WIFSIGNALED (status)) + fprintf (stderr, + "zzuf died from signal %d!\n", WTERMSIG (status)); + exit (1); + } + return; + } + setpgid (0, 0); + execvp ("zzuf", args); + fprintf (stderr, "execution of `zzuf' failed: %s\n", strerror (errno)); + zzuf_pid = 0; /* fork failed */ + exit (1); +} + + +static void +zzuf_socat_stop () +{ + int status; + if (zzuf_pid != 0) + { + if (0 != killpg (zzuf_pid, SIGINT)) + fprintf (stderr, "Failed to killpg: %s\n", strerror (errno)); + kill (zzuf_pid, SIGINT); + waitpid (zzuf_pid, &status, 0); + (void)sleep (1); /* allow socat to also die in peace */ + } +} + +/* end of socat.c */ diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c new file mode 100644 index 0000000..7e116d0 --- /dev/null +++ b/src/testzzuf/test_get.c @@ -0,0 +1,316 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_get.c + * @brief Testcase for libmicrohttpd GET operations + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#include "socat.c" + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int ptr; + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&ptr != *unused) + { + *unused = &ptr; + return MHD_YES; + } + *unused = NULL; + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + if (ret == MHD_NO) + abort (); + return ret; +} + + +static int +testInternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + +static int +testMultithreadedGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 16; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + int max; + int running; + time_t start; + struct timeval tv; + int i; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (c != NULL)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + select (max + 1, &rs, &ws, &es, &tv); + curl_multi_perform (multi, &running); + if (running == 0) + { + curl_multi_info_read (multi, &running); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + MHD_run (d); + } + if (c != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + } + } + fprintf (stderr, "\n"); + curl_multi_cleanup (multi); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalGet (); + errorCount += testMultithreadedGet (); + errorCount += testExternalGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testzzuf/test_get_chunked.c b/src/testzzuf/test_get_chunked.c new file mode 100644 index 0000000..e36145e --- /dev/null +++ b/src/testzzuf/test_get_chunked.c @@ -0,0 +1,333 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_get_chunked.c + * @brief Testcase for libmicrohttpd GET operations with chunked content encoding + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#include "socat.c" + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +/** + * MHD content reader callback that returns + * data in chunks. + */ +static ssize_t +crc (void *cls, uint64_t pos, char *buf, size_t max) +{ + struct MHD_Response **responseptr = cls; + + if (pos == 128 * 10) + { + MHD_add_response_header (*responseptr, "Footer", "working"); + return MHD_CONTENT_READER_END_OF_STREAM; + } + if (max < 128) + abort (); /* should not happen in this testcase... */ + memset (buf, 'A' + (pos / 128), 128); + return 128; +} + +/** + * Dummy function that does nothing. + */ +static void +crcf (void *ptr) +{ + free (ptr); +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, void **ptr) +{ + static int aptr; + const char *me = cls; + struct MHD_Response *response; + struct MHD_Response **responseptr; + int ret; + (void)url;(void)version; /* Unused. Silent compiler warning. */ + (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + if (&aptr != *ptr) + { + /* do never respond on first call */ + *ptr = &aptr; + return MHD_YES; + } + responseptr = malloc (sizeof (struct MHD_Response *)); + response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, + 1024, + &crc, responseptr, &crcf); + *responseptr = response; + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + +static int +testInternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 1; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + +static int +testMultithreadedGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 16; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + +static int +testExternalGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + int max; + int running; + time_t start; + struct timeval tv; + int i; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); + if (d == NULL) + return 256; + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (c != NULL)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + select (max + 1, &rs, &ws, &es, &tv); + curl_multi_perform (multi, &running); + if (running == 0) + { + curl_multi_info_read (multi, &running); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + MHD_run (d); + } + if (c != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + } + } + fprintf (stderr, "\n"); + curl_multi_cleanup (multi); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalGet (); + errorCount += testMultithreadedGet (); + errorCount += testExternalGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testzzuf/test_long_header.c b/src/testzzuf/test_long_header.c new file mode 100644 index 0000000..c4e5cf8 --- /dev/null +++ b/src/testzzuf/test_long_header.c @@ -0,0 +1,239 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_long_header.c + * @brief Testcase for libmicrohttpd handling of very long headers + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#include "socat.c" + +/** + * We will set the memory available per connection to + * half of this value, so the actual value does not have + * to be big at all... + */ +#define VERY_LONG (1024*10) + +static int oneone; + +static int +apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen) +{ + (void)cls;(void)addr;(void)addrlen; /* Unused. Silent compiler warning. */ + return MHD_YES; +} + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + (void)ptr;(void)ctx; /* Unused. Silent compiler warning. */ + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + const char *me = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)upload_data; /* Unused. Silent compiler warning. */ + (void)upload_data_size;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcmp (me, method)) + return MHD_NO; /* unexpected method */ + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testLongUrlGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + char *url; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, + &apc_all, + NULL, + &ahc_echo, + "GET", + MHD_OPTION_CONNECTION_MEMORY_LIMIT, + (size_t) (VERY_LONG / 2), MHD_OPTION_END); + + if (d == NULL) + return 1; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + c = curl_easy_init (); + url = malloc (VERY_LONG); + memset (url, 'a', VERY_LONG); + url[VERY_LONG - 1] = '\0'; + memcpy (url, "http://127.0.0.1:11081/", + strlen ("http://127.0.0.1:11081/")); + curl_easy_setopt (c, CURLOPT_URL, url); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + + MHD_stop_daemon (d); + free (url); + return 0; +} + + +static int +testLongHeaderGet () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + char *url; + struct curl_slist *header = NULL; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, + &apc_all, + NULL, + &ahc_echo, + "GET", + MHD_OPTION_CONNECTION_MEMORY_LIMIT, + (size_t) (VERY_LONG / 2), MHD_OPTION_END); + if (d == NULL) + return 16; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + url = malloc (VERY_LONG); + memset (url, 'a', VERY_LONG); + url[VERY_LONG - 1] = '\0'; + url[VERY_LONG / 2] = ':'; + url[VERY_LONG / 2 + 1] = ' '; + header = curl_slist_append (header, url); + + curl_easy_setopt (c, CURLOPT_HTTPHEADER, header); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_slist_free_all (header); + header = NULL; + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + + MHD_stop_daemon (d); + free (url); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testLongUrlGet (); + errorCount += testLongHeaderGet (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testzzuf/test_post.c b/src/testzzuf/test_post.c new file mode 100644 index 0000000..9a4a8e9 --- /dev/null +++ b/src/testzzuf/test_post.c @@ -0,0 +1,399 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_post.c + * @brief Testcase for libmicrohttpd POST operations using URL-encoding + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + + +#include "socat.c" + +#define POST_DATA "name=daniel&project=curl" + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static void +completed_cb (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct MHD_PostProcessor *pp = *con_cls; + (void)cls;(void)connection;(void)toe; /* Unused. Silent compiler warning. */ + + if (NULL != pp) + MHD_destroy_post_processor (pp); + *con_cls = NULL; +} + + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + + +/** + * Note that this post_iterator is not perfect + * in that it fails to support incremental processing. + * (to be fixed in the future) + */ +static int +post_iterator (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *value, uint64_t off, size_t size) +{ + int *eok = cls; + (void)kind;(void)filename;(void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding;(void)off; /* Unused. Silent compiler warning. */ + + if ((0 == strcmp (key, "name")) && + (size == strlen ("daniel")) && (0 == strncmp (value, "daniel", size))) + (*eok) |= 1; + if ((0 == strcmp (key, "project")) && + (size == strlen ("curl")) && (0 == strncmp (value, "curl", size))) + (*eok) |= 2; + return MHD_YES; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int eok; + struct MHD_Response *response; + struct MHD_PostProcessor *pp; + int ret; + (void)cls;(void)version; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("POST", method)) + { + return MHD_NO; /* unexpected method */ + } + pp = *unused; + if (pp == NULL) + { + eok = 0; + pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); + *unused = pp; + } + MHD_post_process (pp, upload_data, *upload_data_size); + if ((eok == 3) && (0 == *upload_data_size)) + { + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + MHD_destroy_post_processor (pp); + *unused = NULL; + return ret; + } + *upload_data_size = 0; + return MHD_YES; +} + + +static int +testInternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 1; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + + return 0; +} + +static int +testMultithreadedPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 16; + + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + + MHD_stop_daemon (d); + return 0; +} + + +static int +testExternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + int max; + int running; + time_t start; + struct timeval tv; + int i; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_ERROR_LOG */ , + 1082, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 256; + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); + curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, strlen (POST_DATA)); + curl_easy_setopt (c, CURLOPT_POST, 1L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (c != NULL)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + select (max + 1, &rs, &ws, &es, &tv); + curl_multi_perform (multi, &running); + if (running == 0) + { + curl_multi_info_read (multi, &running); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + MHD_run (d); + } + if (c != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + } + + } + fprintf (stderr, "\n"); + curl_multi_cleanup (multi); + zzuf_socat_stop (); + + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalPost (); + errorCount += testMultithreadedPost (); + errorCount += testExternalPost (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c new file mode 100644 index 0000000..fe248d4 --- /dev/null +++ b/src/testzzuf/test_post_form.c @@ -0,0 +1,415 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_post_form.c + * @brief Testcase for libmicrohttpd POST operations using multipart/postform data + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + + +#include "socat.c" + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + + +static void +completed_cb (void *cls, + struct MHD_Connection *connection, + void **con_cls, + enum MHD_RequestTerminationCode toe) +{ + struct MHD_PostProcessor *pp = *con_cls; + (void)cls;(void)connection;(void)toe; /* Unused. Silent compiler warning. */ + + if (NULL != pp) + MHD_destroy_post_processor (pp); + *con_cls = NULL; +} + + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +/** + * Note that this post_iterator is not perfect + * in that it fails to support incremental processing. + * (to be fixed in the future) + */ +static int +post_iterator (void *cls, + enum MHD_ValueKind kind, + const char *key, + const char *filename, + const char *content_type, + const char *transfer_encoding, + const char *value, uint64_t off, size_t size) +{ + int *eok = cls; + (void)kind;(void)filename;(void)content_type; /* Unused. Silent compiler warning. */ + (void)transfer_encoding;(void)off; /* Unused. Silent compiler warning. */ + + if (key == NULL) + return MHD_YES; +#if 0 + fprintf (stderr, "PI sees %s-%.*s\n", key, size, value); +#endif + if ((0 == strcmp (key, "name")) && + (size == strlen ("daniel")) && (0 == strncmp (value, "daniel", size))) + (*eok) |= 1; + if ((0 == strcmp (key, "project")) && + (size == strlen ("curl")) && (0 == strncmp (value, "curl", size))) + (*eok) |= 2; + return MHD_YES; +} + + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + static int eok; + struct MHD_Response *response; + struct MHD_PostProcessor *pp; + int ret; + (void)cls;(void)version; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("POST", method)) + { + return MHD_NO; /* unexpected method */ + } + pp = *unused; + if (pp == NULL) + { + eok = 0; + pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); + if (pp == NULL) + return MHD_NO; + *unused = pp; + } + MHD_post_process (pp, upload_data, *upload_data_size); + if ((eok == 3) && (0 == *upload_data_size)) + { + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + MHD_destroy_post_processor (pp); + *unused = NULL; + return ret; + } + *upload_data_size = 0; + return MHD_YES; +} + +static struct curl_httppost * +make_form () +{ + struct curl_httppost *post = NULL; + struct curl_httppost *last = NULL; + + curl_formadd (&post, &last, CURLFORM_COPYNAME, "name", + CURLFORM_COPYCONTENTS, "daniel", CURLFORM_END); + curl_formadd (&post, &last, CURLFORM_COPYNAME, "project", + CURLFORM_COPYCONTENTS, "curl", CURLFORM_END); + return post; +} + + +static int +testInternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int i; + struct curl_httppost *pd; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 1; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + pd = make_form (); + curl_easy_setopt (c, CURLOPT_HTTPPOST, pd); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + curl_formfree (pd); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + +static int +testMultithreadedPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + int i; + struct curl_httppost *pd; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 16; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + pd = make_form (); + curl_easy_setopt (c, CURLOPT_HTTPPOST, pd); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + curl_formfree (pd); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + +static int +testExternalPost () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + int max; + int running; + time_t start; + struct timeval tv; + struct curl_httppost *pd; + int i; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_ERROR_LOG */ , + 1082, NULL, NULL, &ahc_echo, NULL, + MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, + MHD_OPTION_END); + if (d == NULL) + return 256; + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:1082/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + pd = make_form (); + curl_easy_setopt (c, CURLOPT_HTTPPOST, pd); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_formfree (pd); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (c != NULL)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + curl_formfree (pd); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + curl_formfree (pd); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + select (max + 1, &rs, &ws, &es, &tv); + curl_multi_perform (multi, &running); + if (running == 0) + { + curl_multi_info_read (multi, &running); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + MHD_run (d); + } + if (c != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + } + curl_formfree (pd); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalPost (); + errorCount += testMultithreadedPost (); + errorCount += testExternalPost (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testzzuf/test_put.c b/src/testzzuf/test_put.c new file mode 100644 index 0000000..cfe12de --- /dev/null +++ b/src/testzzuf/test_put.c @@ -0,0 +1,363 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_put.c + * @brief Testcase for libmicrohttpd PUT operations + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + + +#include "socat.c" + +static int oneone; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + unsigned int *pos = ptr; + unsigned int wrt; + + wrt = size * nmemb; + if (wrt > 8 - (*pos)) + wrt = 8 - (*pos); + memcpy (stream, &("Hello123"[*pos]), wrt); + (*pos) += wrt; + return wrt; +} + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("PUT", method)) + return MHD_NO; /* unexpected method */ + if ((*done) == 0) + { + if (*upload_data_size != 8) + return MHD_YES; /* not yet ready */ + if (0 == memcmp (upload_data, "Hello123", 8)) + { + *upload_data_size = 0; + } + else + { + printf ("Invalid upload data `%8s'!\n", upload_data); + return MHD_NO; + } + *done = 1; + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testInternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 1; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + +static int +testMultithreadedPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 16; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + +static int +testExternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + int max; + int running; + time_t start; + struct timeval tv; + unsigned int pos = 0; + int done_flag = 0; + int i; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_ERROR_LOG */ , + 11080, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 256; + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (c != NULL)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + select (max + 1, &rs, &ws, &es, &tv); + curl_multi_perform (multi, &running); + if (running == 0) + { + curl_multi_info_read (multi, &running); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + MHD_run (d); + } + if (c != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + } + } + fprintf (stderr, "\n"); + curl_multi_cleanup (multi); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalPut (); + errorCount += testMultithreadedPut (); + errorCount += testExternalPut (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testzzuf/test_put_chunked.c b/src/testzzuf/test_put_chunked.c new file mode 100644 index 0000000..72a9f31 --- /dev/null +++ b/src/testzzuf/test_put_chunked.c @@ -0,0 +1,373 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file daemontest_put_chunked.c + * @brief Testcase for libmicrohttpd PUT operations with chunked encoding + * for the upload data + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#include "socat.c" + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + unsigned int *pos = ptr; + unsigned int wrt; + + wrt = size * nmemb; + if (wrt > 8 - (*pos)) + wrt = 8 - (*pos); + if (wrt > 4) + wrt = 4; /* only send half at first => force multiple chunks! */ + memcpy (stream, &("Hello123"[*pos]), wrt); + (*pos) += wrt; + return wrt; +} + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + int have; + (void)version;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("PUT", method)) + return MHD_NO; /* unexpected method */ + if ((*done) < 8) + { + have = *upload_data_size; + if (have + *done > 8) + { + return MHD_NO; + } + if (0 == memcmp (upload_data, &"Hello123"[*done], have)) + { + *done += have; + *upload_data_size = 0; + } + else + { + return MHD_NO; + } +#if 0 + fprintf (stderr, "Not ready for response: %u/%u\n", *done, 8); +#endif + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testInternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 11080, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 1; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11080/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + /* by not giving the file size, we force chunking! */ + /* + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + */ + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + +static int +testMultithreadedPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + CURLcode errornum; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, + 11081, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 16; + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + /* by not giving the file size, we force chunking! */ + /* + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + */ + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + if (CURLE_OK != (errornum = curl_easy_perform (c))) + { + fprintf (stderr, + "curl_easy_perform failed: `%s'\n", + curl_easy_strerror (errornum)); + curl_easy_cleanup (c); + MHD_stop_daemon (d); + return 32; + } + curl_easy_cleanup (c); + MHD_stop_daemon (d); + if (cbc.pos != strlen ("/hello_world")) + return 64; + if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world"))) + return 128; + + return 0; +} + + +static int +testExternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + char buf[2048]; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + int max; + int running; + time_t start; + struct timeval tv; + unsigned int pos = 0; + int done_flag = 0; + int i; + + multi = NULL; + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_ERROR_LOG, + 11082, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 256; + + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11082/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + /* by not giving the file size, we force chunking! */ + /* + curl_easy_setopt (c, CURLOPT_INFILESIZE_LARGE, (curl_off_t) 8L); + */ + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (c != NULL)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + select (max + 1, &rs, &ws, &es, &tv); + curl_multi_perform (multi, &running); + if (running == 0) + { + curl_multi_info_read (multi, &running); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + MHD_run (d); + } + if (c != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + } + } + fprintf (stderr, "\n"); + curl_multi_cleanup (multi); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; (void)argv; /* Unused. Silent compiler warning. */ + + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + errorCount += testInternalPut (); + errorCount += testMultithreadedPut (); + errorCount += testExternalPut (); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/src/testzzuf/test_put_large.c b/src/testzzuf/test_put_large.c new file mode 100644 index 0000000..540c37f --- /dev/null +++ b/src/testzzuf/test_put_large.c @@ -0,0 +1,384 @@ +/* + This file is part of libmicrohttpd + Copyright (C) 2007, 2008 Christian Grothoff + + libmicrohttpd 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. + + libmicrohttpd 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 libmicrohttpd; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/** + * @file test_put_large.c + * @brief Testcase for libmicrohttpd PUT operations + * @author Christian Grothoff + */ + +#include "MHD_config.h" +#include "platform.h" +#include +#include +#include +#include +#include + +#ifndef WINDOWS +#include +#endif + +#include "socat.c" + +static int oneone; + +/** + * Do not make this much larger since we will hit the + * MHD default buffer limit and the test code is not + * written for incremental upload processing... + */ +#define PUT_SIZE (256 * 1024) + +static char *put_buffer; + +struct CBC +{ + char *buf; + size_t pos; + size_t size; +}; + +static size_t +putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) +{ + unsigned int *pos = ptr; + unsigned int wrt; + + wrt = size * nmemb; + if (wrt > PUT_SIZE - (*pos)) + wrt = PUT_SIZE - (*pos); + memcpy (stream, &put_buffer[*pos], wrt); + (*pos) += wrt; + return wrt; +} + +static size_t +copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) +{ + struct CBC *cbc = ctx; + + if (cbc->pos + size * nmemb > cbc->size) + return 0; /* overflow */ + memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); + cbc->pos += size * nmemb; + return size * nmemb; +} + +static int +ahc_echo (void *cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, size_t *upload_data_size, + void **unused) +{ + int *done = cls; + struct MHD_Response *response; + int ret; + (void)version;(void)unused; /* Unused. Silent compiler warning. */ + + if (0 != strcmp ("PUT", method)) + return MHD_NO; /* unexpected method */ + if ((*done) == 0) + { + if (*upload_data_size != PUT_SIZE) + { +#if 0 + fprintf (stderr, + "Waiting for more data (%u/%u)...\n", + *upload_data_size, PUT_SIZE); +#endif + return MHD_YES; /* not yet ready */ + } + if (0 == memcmp (upload_data, put_buffer, PUT_SIZE)) + { + *upload_data_size = 0; + } + else + { + return MHD_NO; + } + *done = 1; + return MHD_YES; + } + response = MHD_create_response_from_buffer (strlen (url), + (void *) url, + MHD_RESPMEM_MUST_COPY); + ret = MHD_queue_response (connection, MHD_HTTP_OK, response); + MHD_destroy_response (response); + return ret; +} + + +static int +testInternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + char buf[2048]; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 1; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + +static int +testMultithreadedPut () +{ + struct MHD_Daemon *d; + CURL *c; + struct CBC cbc; + unsigned int pos = 0; + int done_flag = 0; + char buf[2048]; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD /* | MHD_USE_ERROR_LOG */ , + 11080, + NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); + if (d == NULL) + return 16; + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + curl_easy_perform (c); + curl_easy_cleanup (c); + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 0; +} + + +static int +testExternalPut () +{ + struct MHD_Daemon *d; + CURL *c; + struct CBC cbc; + CURLM *multi; + CURLMcode mret; + fd_set rs; + fd_set ws; + fd_set es; + int max; + int running; + time_t start; + struct timeval tv; + unsigned int pos = 0; + int done_flag = 0; + char buf[2048]; + int i; + + cbc.buf = buf; + cbc.size = 2048; + cbc.pos = 0; + multi = NULL; + d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_ERROR_LOG */, + 11080, + NULL, NULL, &ahc_echo, &done_flag, + MHD_OPTION_CONNECTION_MEMORY_LIMIT, + (size_t) (PUT_SIZE * 4), MHD_OPTION_END); + if (d == NULL) + return 256; + multi = curl_multi_init (); + if (multi == NULL) + { + MHD_stop_daemon (d); + return 512; + } + zzuf_socat_start (); + for (i = 0; i < LOOP_COUNT; i++) + { + fprintf (stderr, "."); + + c = curl_easy_init (); + curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1:11081/hello_world"); + curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); + curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); + curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); + curl_easy_setopt (c, CURLOPT_READDATA, &pos); + curl_easy_setopt (c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (c, CURLOPT_INFILESIZE, (long) PUT_SIZE); + curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); + curl_easy_setopt (c, CURLOPT_TIMEOUT_MS, CURL_TIMEOUT); + if (oneone) + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); + else + curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT_MS, CURL_TIMEOUT); + /* NOTE: use of CONNECTTIMEOUT without also + * setting NOSIGNAL results in really weird + * crashes on my system! */ + curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); + + + + mret = curl_multi_add_handle (multi, c); + if (mret != CURLM_OK) + { + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 1024; + } + start = time (NULL); + while ((time (NULL) - start < 5) && (c != NULL)) + { + max = 0; + FD_ZERO (&rs); + FD_ZERO (&ws); + FD_ZERO (&es); + curl_multi_perform (multi, &running); + mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); + if (mret != CURLM_OK) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 2048; + } + if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) + { + curl_multi_remove_handle (multi, c); + curl_multi_cleanup (multi); + curl_easy_cleanup (c); + zzuf_socat_stop (); + MHD_stop_daemon (d); + return 4096; + } + tv.tv_sec = 0; + tv.tv_usec = 1000; + select (max + 1, &rs, &ws, &es, &tv); + curl_multi_perform (multi, &running); + if (running == 0) + { + curl_multi_info_read (multi, &running); + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + c = NULL; + } + MHD_run (d); + } + if (c != NULL) + { + curl_multi_remove_handle (multi, c); + curl_easy_cleanup (c); + } + } + fprintf (stderr, "\n"); + zzuf_socat_stop (); + curl_multi_cleanup (multi); + MHD_stop_daemon (d); + return 0; +} + + +int +main (int argc, char *const *argv) +{ + unsigned int errorCount = 0; + (void)argc; /* Unused. Silent compiler warning. */ + + oneone = (NULL != strrchr (argv[0], (int) '/')) ? + (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0; + if (0 != curl_global_init (CURL_GLOBAL_WIN32)) + return 2; + put_buffer = malloc (PUT_SIZE); + memset (put_buffer, 1, PUT_SIZE); + errorCount += testInternalPut (); + errorCount += testMultithreadedPut (); + errorCount += testExternalPut (); + free (put_buffer); + if (errorCount != 0) + fprintf (stderr, "Error (code: %u)\n", errorCount); + curl_global_cleanup (); + return errorCount != 0; /* 0 == pass */ +} diff --git a/test-driver b/test-driver new file mode 100755 index 0000000..8e575b0 --- /dev/null +++ b/test-driver @@ -0,0 +1,148 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2013-07-13.22; # UTC + +# Copyright (C) 2011-2014 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, see . + +# 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. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <$log_file 2>&1 +estatus=$? + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>$log_file + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# 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-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/w32/VS2013/hellobrowser.vcxproj b/w32/VS2013/hellobrowser.vcxproj new file mode 100644 index 0000000..450f148 --- /dev/null +++ b/w32/VS2013/hellobrowser.vcxproj @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {310F39BD-A2D6-44FF-8344-37ADD0524CBD} + Win32Proj + hellobrowser + + + + x64 + + + Application + true + v120 + Unicode + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2013/hellobrowser.vcxproj.filters b/w32/VS2013/hellobrowser.vcxproj.filters new file mode 100644 index 0000000..ef5a1fd --- /dev/null +++ b/w32/VS2013/hellobrowser.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/w32/VS2013/largepost.vcxproj b/w32/VS2013/largepost.vcxproj new file mode 100644 index 0000000..7931548 --- /dev/null +++ b/w32/VS2013/largepost.vcxproj @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {77A27E6D-9A39-40B8-961B-40E63DB7FA65} + Win32Proj + largepost + + + + x64 + + + Application + true + v120 + Unicode + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2013/libmicrohttpd.sln b/w32/VS2013/libmicrohttpd.sln new file mode 100644 index 0000000..873914a --- /dev/null +++ b/w32/VS2013/libmicrohttpd.sln @@ -0,0 +1,175 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellobrowser", "hellobrowser.vcxproj", "{310F39BD-A2D6-44FF-8344-37ADD0524CBD}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmicrohttpd", "libmicrohttpd.vcxproj", "{9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simplepost", "simplepost.vcxproj", "{294D5317-E983-4682-8DB5-678EA4645E11}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "largepost", "largepost.vcxproj", "{77A27E6D-9A39-40B8-961B-40E63DB7FA65}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug-dll|Win32 = Debug-dll|Win32 + Debug-dll|x64 = Debug-dll|x64 + Debug-dll-xp|Win32 = Debug-dll-xp|Win32 + Debug-dll-xp|x64 = Debug-dll-xp|x64 + Debug-static|Win32 = Debug-static|Win32 + Debug-static|x64 = Debug-static|x64 + Debug-static-xp|Win32 = Debug-static-xp|Win32 + Debug-static-xp|x64 = Debug-static-xp|x64 + Release-dll|Win32 = Release-dll|Win32 + Release-dll|x64 = Release-dll|x64 + Release-dll-xp|Win32 = Release-dll-xp|Win32 + Release-dll-xp|x64 = Release-dll-xp|x64 + Release-static|Win32 = Release-static|Win32 + Release-static|x64 = Release-static|x64 + Release-static-xp|Win32 = Release-static-xp|Win32 + Release-static-xp|x64 = Release-static-xp|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.Build.0 = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.ActiveCfg = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.Build.0 = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.Build.0 = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.ActiveCfg = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.Build.0 = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.ActiveCfg = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.Build.0 = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.Build.0 = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.ActiveCfg = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.Build.0 = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.ActiveCfg = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.Build.0 = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.Build.0 = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.ActiveCfg = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.Build.0 = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.ActiveCfg = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.Build.0 = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.ActiveCfg = Release-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.Build.0 = Release-static-xp|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.Build.0 = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.Build.0 = Release-static|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/w32/VS2013/libmicrohttpd.vcxproj b/w32/VS2013/libmicrohttpd.vcxproj new file mode 100644 index 0000000..fe94a58 --- /dev/null +++ b/w32/VS2013/libmicrohttpd.vcxproj @@ -0,0 +1,149 @@ + + + + + + Debug-dll-xp + Win32 + + + Debug-dll-xp + x64 + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static-xp + Win32 + + + Debug-static-xp + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll-xp + Win32 + + + Release-dll-xp + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static-xp + Win32 + + + Release-static-xp + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + Win32Proj + libmicrohttpd + + + + x64 + + + StaticLibrary + true + v120 + Unicode + + + StaticLibrary + true + v120_xp + Unicode + + + DynamicLibrary + true + v120 + Unicode + + + DynamicLibrary + true + v120_xp + Unicode + + + StaticLibrary + false + v120 + true + Unicode + + + StaticLibrary + false + v120_xp + true + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + DynamicLibrary + false + v120_xp + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2013/libmicrohttpd.vcxproj.filters b/w32/VS2013/libmicrohttpd.vcxproj.filters new file mode 100644 index 0000000..63f58bf --- /dev/null +++ b/w32/VS2013/libmicrohttpd.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/w32/VS2013/simplepost.vcxproj b/w32/VS2013/simplepost.vcxproj new file mode 100644 index 0000000..8775bc9 --- /dev/null +++ b/w32/VS2013/simplepost.vcxproj @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {294D5317-E983-4682-8DB5-678EA4645E11} + Win32Proj + simplepost + + + + x64 + + + Application + true + v120 + Unicode + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2015/hellobrowser.vcxproj b/w32/VS2015/hellobrowser.vcxproj new file mode 100644 index 0000000..d546c5d --- /dev/null +++ b/w32/VS2015/hellobrowser.vcxproj @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {310F39BD-A2D6-44FF-8344-37ADD0524CBD} + Win32Proj + hellobrowser + + + + x64 + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2015/hellobrowser.vcxproj.filters b/w32/VS2015/hellobrowser.vcxproj.filters new file mode 100644 index 0000000..ef5a1fd --- /dev/null +++ b/w32/VS2015/hellobrowser.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/w32/VS2015/largepost.vcxproj b/w32/VS2015/largepost.vcxproj new file mode 100644 index 0000000..c73bf22 --- /dev/null +++ b/w32/VS2015/largepost.vcxproj @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {77A27E6D-9A39-40B8-961B-40E63DB7FA65} + Win32Proj + largepost + + + + x64 + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2015/libmicrohttpd.sln b/w32/VS2015/libmicrohttpd.sln new file mode 100644 index 0000000..70a7beb --- /dev/null +++ b/w32/VS2015/libmicrohttpd.sln @@ -0,0 +1,175 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellobrowser", "hellobrowser.vcxproj", "{310F39BD-A2D6-44FF-8344-37ADD0524CBD}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmicrohttpd", "libmicrohttpd.vcxproj", "{9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simplepost", "simplepost.vcxproj", "{294D5317-E983-4682-8DB5-678EA4645E11}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "largepost", "largepost.vcxproj", "{77A27E6D-9A39-40B8-961B-40E63DB7FA65}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug-dll|Win32 = Debug-dll|Win32 + Debug-dll|x64 = Debug-dll|x64 + Debug-dll-xp|Win32 = Debug-dll-xp|Win32 + Debug-dll-xp|x64 = Debug-dll-xp|x64 + Debug-static|Win32 = Debug-static|Win32 + Debug-static|x64 = Debug-static|x64 + Debug-static-xp|Win32 = Debug-static-xp|Win32 + Debug-static-xp|x64 = Debug-static-xp|x64 + Release-dll|Win32 = Release-dll|Win32 + Release-dll|x64 = Release-dll|x64 + Release-dll-xp|Win32 = Release-dll-xp|Win32 + Release-dll-xp|x64 = Release-dll-xp|x64 + Release-static|Win32 = Release-static|Win32 + Release-static|x64 = Release-static|x64 + Release-static-xp|Win32 = Release-static-xp|Win32 + Release-static-xp|x64 = Release-static-xp|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.Build.0 = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.ActiveCfg = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.Build.0 = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.Build.0 = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.ActiveCfg = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.Build.0 = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.ActiveCfg = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.Build.0 = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.Build.0 = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.ActiveCfg = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.Build.0 = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.ActiveCfg = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.Build.0 = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.Build.0 = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.ActiveCfg = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.Build.0 = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.ActiveCfg = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.Build.0 = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.ActiveCfg = Release-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.Build.0 = Release-static-xp|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.Build.0 = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.Build.0 = Release-static|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/w32/VS2015/libmicrohttpd.vcxproj b/w32/VS2015/libmicrohttpd.vcxproj new file mode 100644 index 0000000..75d4233 --- /dev/null +++ b/w32/VS2015/libmicrohttpd.vcxproj @@ -0,0 +1,149 @@ + + + + + + Debug-dll-xp + Win32 + + + Debug-dll-xp + x64 + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static-xp + Win32 + + + Debug-static-xp + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll-xp + Win32 + + + Release-dll-xp + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static-xp + Win32 + + + Release-static-xp + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + Win32Proj + libmicrohttpd + + + + x64 + + + StaticLibrary + true + v140 + Unicode + + + StaticLibrary + true + v140_xp + Unicode + + + DynamicLibrary + true + v140 + Unicode + + + DynamicLibrary + true + v140_xp + Unicode + + + StaticLibrary + false + v140 + true + Unicode + + + StaticLibrary + false + v140_xp + true + Unicode + + + DynamicLibrary + false + v140 + true + Unicode + + + DynamicLibrary + false + v140_xp + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2015/libmicrohttpd.vcxproj.filters b/w32/VS2015/libmicrohttpd.vcxproj.filters new file mode 100644 index 0000000..63f58bf --- /dev/null +++ b/w32/VS2015/libmicrohttpd.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/w32/VS2015/simplepost.vcxproj b/w32/VS2015/simplepost.vcxproj new file mode 100644 index 0000000..8d1c1b3 --- /dev/null +++ b/w32/VS2015/simplepost.vcxproj @@ -0,0 +1,91 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {294D5317-E983-4682-8DB5-678EA4645E11} + Win32Proj + simplepost + + + + x64 + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2017/hellobrowser.vcxproj b/w32/VS2017/hellobrowser.vcxproj new file mode 100644 index 0000000..ed29e61 --- /dev/null +++ b/w32/VS2017/hellobrowser.vcxproj @@ -0,0 +1,73 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {310F39BD-A2D6-44FF-8344-37ADD0524CBD} + Win32Proj + hellobrowser + + + + x64 + + + Application + true + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2017/hellobrowser.vcxproj.filters b/w32/VS2017/hellobrowser.vcxproj.filters new file mode 100644 index 0000000..ef5a1fd --- /dev/null +++ b/w32/VS2017/hellobrowser.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/w32/VS2017/largepost.vcxproj b/w32/VS2017/largepost.vcxproj new file mode 100644 index 0000000..c9141f8 --- /dev/null +++ b/w32/VS2017/largepost.vcxproj @@ -0,0 +1,73 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {77A27E6D-9A39-40B8-961B-40E63DB7FA65} + Win32Proj + largepost + + + + x64 + + + Application + true + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2017/libmicrohttpd.sln b/w32/VS2017/libmicrohttpd.sln new file mode 100644 index 0000000..3971e46 --- /dev/null +++ b/w32/VS2017/libmicrohttpd.sln @@ -0,0 +1,175 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.9 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellobrowser", "hellobrowser.vcxproj", "{310F39BD-A2D6-44FF-8344-37ADD0524CBD}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmicrohttpd", "libmicrohttpd.vcxproj", "{9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simplepost", "simplepost.vcxproj", "{294D5317-E983-4682-8DB5-678EA4645E11}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "largepost", "largepost.vcxproj", "{77A27E6D-9A39-40B8-961B-40E63DB7FA65}" + ProjectSection(ProjectDependencies) = postProject + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} = {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug-dll|Win32 = Debug-dll|Win32 + Debug-dll|x64 = Debug-dll|x64 + Debug-dll-xp|Win32 = Debug-dll-xp|Win32 + Debug-dll-xp|x64 = Debug-dll-xp|x64 + Debug-static|Win32 = Debug-static|Win32 + Debug-static|x64 = Debug-static|x64 + Debug-static-xp|Win32 = Debug-static-xp|Win32 + Debug-static-xp|x64 = Debug-static-xp|x64 + Release-dll|Win32 = Release-dll|Win32 + Release-dll|x64 = Release-dll|x64 + Release-dll-xp|Win32 = Release-dll-xp|Win32 + Release-dll-xp|x64 = Release-dll-xp|x64 + Release-static|Win32 = Release-static|Win32 + Release-static|x64 = Release-static|x64 + Release-static-xp|Win32 = Release-static-xp|Win32 + Release-static-xp|x64 = Release-static-xp|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|Win32.Build.0 = Debug-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.ActiveCfg = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-dll-xp|x64.Build.0 = Debug-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static|x64.Build.0 = Debug-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.ActiveCfg = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|Win32.Build.0 = Debug-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.ActiveCfg = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Debug-static-xp|x64.Build.0 = Debug-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll|x64.Build.0 = Release-dll|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.ActiveCfg = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|Win32.Build.0 = Release-dll-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.ActiveCfg = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-dll-xp|x64.Build.0 = Release-dll-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|Win32.Build.0 = Release-static|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.ActiveCfg = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static|x64.Build.0 = Release-static|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.ActiveCfg = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|Win32.Build.0 = Release-static-xp|Win32 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.ActiveCfg = Release-static-xp|x64 + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A}.Release-static-xp|x64.Build.0 = Release-static-xp|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static|x64.Build.0 = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {310F39BD-A2D6-44FF-8344-37ADD0524CBD}.Release-static-xp|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static|x64.Build.0 = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {294D5317-E983-4682-8DB5-678EA4645E11}.Release-static-xp|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.ActiveCfg = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|Win32.Build.0 = Debug-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.ActiveCfg = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-dll-xp|x64.Build.0 = Debug-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.ActiveCfg = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|Win32.Build.0 = Debug-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.ActiveCfg = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Debug-static-xp|x64.Build.0 = Debug-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.ActiveCfg = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|Win32.Build.0 = Release-dll|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.ActiveCfg = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-dll-xp|x64.Build.0 = Release-dll|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static|x64.Build.0 = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.ActiveCfg = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|Win32.Build.0 = Release-static|Win32 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.ActiveCfg = Release-static|x64 + {77A27E6D-9A39-40B8-961B-40E63DB7FA65}.Release-static-xp|x64.Build.0 = Release-static|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/w32/VS2017/libmicrohttpd.vcxproj b/w32/VS2017/libmicrohttpd.vcxproj new file mode 100644 index 0000000..004004d --- /dev/null +++ b/w32/VS2017/libmicrohttpd.vcxproj @@ -0,0 +1,107 @@ + + + + + + Debug-dll-xp + Win32 + + + Debug-dll-xp + x64 + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static-xp + Win32 + + + Debug-static-xp + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll-xp + Win32 + + + Release-dll-xp + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static-xp + Win32 + + + Release-static-xp + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {9CFB0342-A9E7-483E-BEE5-A1DE22584C5A} + Win32Proj + libmicrohttpd + + + + x64 + + + StaticLibrary + DynamicLibrary + true + false + v141 + v141_xp + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/VS2017/libmicrohttpd.vcxproj.filters b/w32/VS2017/libmicrohttpd.vcxproj.filters new file mode 100644 index 0000000..63f58bf --- /dev/null +++ b/w32/VS2017/libmicrohttpd.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/w32/VS2017/simplepost.vcxproj b/w32/VS2017/simplepost.vcxproj new file mode 100644 index 0000000..cfd12aa --- /dev/null +++ b/w32/VS2017/simplepost.vcxproj @@ -0,0 +1,73 @@ + + + + + + Debug-dll + Win32 + + + Debug-dll + x64 + + + Debug-static + Win32 + + + Debug-static + x64 + + + Release-dll + Win32 + + + Release-dll + x64 + + + Release-static + Win32 + + + Release-static + x64 + + + + + {294D5317-E983-4682-8DB5-678EA4645E11} + Win32Proj + simplepost + + + + x64 + + + Application + true + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/w32/common/MHD_config.h b/w32/common/MHD_config.h new file mode 100644 index 0000000..21db7ea --- /dev/null +++ b/w32/common/MHD_config.h @@ -0,0 +1,162 @@ +/* MHD_config.h for W32 */ +/* Created manually. */ + +/* *** Basic OS/compiler information *** */ + +/* This is a Windows system */ +#define WINDOWS 1 + +/* Define if MS VC compiler is used */ +#define MSVC 1 + +/* Define to 1 if your C compiler supports inline functions. */ +#define INLINE_FUNC 1 + +/* Define to prefix which will be used with MHD inline functions. */ +#define _MHD_static_inline static __forceinline + + +/* *** MHD configuration *** */ +/* Undef to disable feature */ + +/* Enable basic Auth support */ +#define BAUTH_SUPPORT 1 + +/* Enable digest Auth support */ +#define DAUTH_SUPPORT 1 + +/* Enable postprocessor.c */ +#define HAVE_POSTPROCESSOR 1 + +/* Enable error messages */ +#define HAVE_MESSAGES 1 + +/* Enable HTTP Upgrade support. */ +#define UPGRADE_SUPPORT 1 + +/* *** OS features *** */ + +/* Provides IPv6 headers */ +#define HAVE_INET6 1 + +/* Define to use socketpair for inter-thread communication */ +#define _MHD_ITC_SOCKETPAIR 1 + +/* define to use W32 threads */ +#define MHD_USE_W32_THREADS 1 + +#ifndef _WIN32_WINNT +/* MHD supports Windows XP and later W32 systems*/ +#define _WIN32_WINNT 0x0501 +#endif /* _WIN32_WINNT */ + +/* winsock poll is available only on Vista and later */ +#if _WIN32_WINNT >= 0x0600 +#define HAVE_POLL 1 +#endif /* _WIN32_WINNT >= 0x0600 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WS2TCPIP_H 1 + +/* Define to 1 if you have the `_lseeki64' function. */ +#define HAVE___LSEEKI64 1 + +/* Define to 1 if you have the `gmtime_s' function in W32 form. */ +#define HAVE_W32_GMTIME_S 1 + +/* Define to 1 if you have the usable `calloc' function. */ +#define HAVE_CALLOC 1 + +#if _MSC_VER >= 1900 /* snprintf() supported natively since VS2015 */ +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 +#endif + +#if _MSC_VER >= 1800 +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 +#endif + + +/* *** Headers information *** */ +/* Not really important as not used by code currently */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MATH_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +#if _MSC_VER+0 >= 1800 /* VS 2013 and later */ +/* Define to 1 if you have the header file and defines + 'bool' type. */ +#define HAVE_STDBOOL_H 1 +#else /* before VS 2013 */ + +/* Define to type name which will be used as boolean type. */ +#define bool int + +/* Define to value interpreted by compiler as boolean "false", if "false" is + not defined by system headers. */ +#define false 0 + +/* Define to value interpreted by compiler as boolean "true", if "true" is not + defined by system headers. */ +#define true (!0) +#endif /* before VS 2013 */ + + +/* *** Other useful staff *** */ + +#define _GNU_SOURCE 1 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + + +/* End of MHD_config.h */ diff --git a/w32/common/apps-build-settings.vcxproj b/w32/common/apps-build-settings.vcxproj new file mode 100644 index 0000000..45e7ed7 --- /dev/null +++ b/w32/common/apps-build-settings.vcxproj @@ -0,0 +1,32 @@ + + + + $(ProjectName)_d + + + $(ProjectName)-dll_d + + + $(ProjectName) + + + $(ProjectName)-dll + + + + _CONSOLE;%(PreprocessorDefinitions) + + + Console + + + + + + MultiThreadedDebug + MultiThreadedDebugDLL + MultiThreaded + MultiThreadedDLL + + + diff --git a/w32/common/common-build-settings.vcxproj b/w32/common/common-build-settings.vcxproj new file mode 100644 index 0000000..362340c --- /dev/null +++ b/w32/common/common-build-settings.vcxproj @@ -0,0 +1,100 @@ + + + + + 0 + 1 + + + $(SolutionDir);$(MhdW32Common);$(MhdSrc)include;$(IncludePath) + + + $(SolutionDir)$(ProjectName)\$(Configuration)\ + $(SolutionDir)Output\ + + + $(SolutionDir)$(ProjectName)\$(Configuration)\$(Platform)\ + $(SolutionDir)Output\$(Platform)\ + + + true + + + false + + + + NotUsing + Level3 + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + 4996 + 4013 + $(IntDir)$(TargetName).pdb + ProgramDatabase + + + true + + + + + _WIN32_WINNT=0x0600;%(PreprocessorDefinitions) + + + 6.00 + + + 6.00 + + + + + _WIN32_WINNT=0x0501;%(PreprocessorDefinitions) + + + 5.01 + + + 5.01 + + + + + _WIN32_WINNT=0x0502;%(PreprocessorDefinitions) + + + 5.02 + + + 5.02 + + + + + Disabled + true + + + _DEBUG;%(PreprocessorDefinitions) + + + + + Full + true + true + AnySuitable + Speed + true + + + true + true + UseLinkTimeCodeGeneration + + + NDEBUG;%(PreprocessorDefinitions) + + + diff --git a/w32/common/gen_dll_res.ps1 b/w32/common/gen_dll_res.ps1 new file mode 100644 index 0000000..92560ee --- /dev/null +++ b/w32/common/gen_dll_res.ps1 @@ -0,0 +1,38 @@ +param ([string]$BasePath = ".\") + +$Host.SetShouldExit(111) # Set non-zero return code until task successfully finished +$ErrorActionPreference = "Stop" # Stop on any error + +Remove-Variable MHD_ver,MHD_ver_major,MHD_ver_minor,MHD_ver_patchlev -ErrorAction:SilentlyContinue + +Write-Output "Processing: ${BasePath}..\..\configure.ac" +foreach($line in Get-Content "${BasePath}..\..\configure.ac") +{ + if ($line -match '^AC_INIT\(\[(?:GNU )?libmicrohttpd\],\[((\d+).(\d+).(\d+))\]') + { + [string]$MHD_ver = $Matches[1].ToString() + [string]$MHD_ver_major = $Matches[2].ToString() + [string]$MHD_ver_minor = $Matches[3].ToString() + [string]$MHD_ver_patchlev = $Matches[4].ToString() + break + } +} +if ("$MHD_ver" -eq "" -or "$MHD_ver_major" -eq "" -or "$MHD_ver_minor" -eq "" -or "$MHD_ver_patchlev" -eq "") +{ + Throw "Can't find MHD version in ${BasePath}..\..\configure.ac" +} + +Write-Output "Detected MHD version: $MHD_ver" + +Write-Output "Generating ${BasePath}microhttpd_dll_res_vc.rc" +Get-Content "${BasePath}microhttpd_dll_res_vc.rc.in" | ForEach-Object { + $_ -replace '@PACKAGE_VERSION_MAJOR@',"$MHD_ver_major" ` + -replace '@PACKAGE_VERSION_MINOR@', "$MHD_ver_minor" ` + -replace '@PACKAGE_VERSION_SUBMINOR@', "$MHD_ver_patchlev" ` + -replace '@PACKAGE_VERSION@', "$MHD_ver" +} | Out-File -FilePath "${BasePath}microhttpd_dll_res_vc.rc" -Force + +$Host.SetShouldExit(0) # Reset return code + +Write-Output "${BasePath}microhttpd_dll_res_vc.rc was generated " +exit 0 # Exit with success code diff --git a/w32/common/hellobrowser-files.vcxproj b/w32/common/hellobrowser-files.vcxproj new file mode 100644 index 0000000..f7caefb --- /dev/null +++ b/w32/common/hellobrowser-files.vcxproj @@ -0,0 +1,11 @@ + + + + + + + + {9cfb0342-a9e7-483e-bee5-a1de22584c5a} + + + diff --git a/w32/common/hellobrowser-filters.vcxproj b/w32/common/hellobrowser-filters.vcxproj new file mode 100644 index 0000000..1438494 --- /dev/null +++ b/w32/common/hellobrowser-filters.vcxproj @@ -0,0 +1,14 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + diff --git a/w32/common/libmicrohttpd-build-settings.vcxproj b/w32/common/libmicrohttpd-build-settings.vcxproj new file mode 100644 index 0000000..97d84a8 --- /dev/null +++ b/w32/common/libmicrohttpd-build-settings.vcxproj @@ -0,0 +1,55 @@ + + + + ResourceCompile + + + $(ProjectName)_d + $(ProjectName) + + + $(ProjectName)-dll_d + $(ProjectName)-dll + + + + BUILDING_MHD_LIB;%(PreprocessorDefinitions) + + + WINDOWS + + + Windows + + + Copy headers to output + xcopy /F /I /Y "$(MhdSrc)include\microhttpd.h" "$(OutputPath)" + $(OutputPath)microhttpd.h;%(Outputs) + $(MhdSrc)include\microhttpd.h + + + + + _LIB;MHD_W32LIB;%(PreprocessorDefinitions) + MultiThreadedDebug + MultiThreaded + + + Ws2_32.lib + + + xcopy /F /I /Y "$(IntermediateOutputPath)$(TargetName).pdb" "$(OutputPath)" + Copy .pdb to output directory + + + + + _USRDLL;MHD_W32DLL;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + MultiThreadedDLL + + + Ws2_32.lib;%(AdditionalDependencies) + + + diff --git a/w32/common/libmicrohttpd-files.vcxproj b/w32/common/libmicrohttpd-files.vcxproj new file mode 100644 index 0000000..6f1e03b --- /dev/null +++ b/w32/common/libmicrohttpd-files.vcxproj @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + true + false + Document + PowerShell.exe -Version 3.0 -NonInteractive -NoProfile -ExecutionPolicy Bypass -File "$(MhdW32Common)gen_dll_res.ps1" -BasePath "$(MhdW32Common)\" + Generating .dll description resource + $(MhdW32Common)microhttpd_dll_res_vc.rc + $(MhdW32Common)gen_dll_res.ps1;$(MhdRoot)configure.ac + + + diff --git a/w32/common/libmicrohttpd-filters.vcxproj b/w32/common/libmicrohttpd-filters.vcxproj new file mode 100644 index 0000000..d0c4707 --- /dev/null +++ b/w32/common/libmicrohttpd-filters.vcxproj @@ -0,0 +1,161 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {df5ad836-e372-437b-a0e3-299d3675d6b4} + in + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + + + Template Files + + + diff --git a/w32/common/microhttpd_dll_res_vc.rc b/w32/common/microhttpd_dll_res_vc.rc new file mode 100644 index 0000000..b31fc55 --- /dev/null +++ b/w32/common/microhttpd_dll_res_vc.rc @@ -0,0 +1,42 @@ +/* W32 resources for .dll */ + +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,9,59,0 + PRODUCTVERSION 0,9,59,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#if defined(_DEBUG) + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0 +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "04090000" /* Lang = US English, Charset = ASCII */ + BEGIN + VALUE "ProductName", "GNU libmicrohttpd\0" + VALUE "ProductVersion", "0.9.59\0" + VALUE "FileVersion", "0.9.59\0" + VALUE "FileDescription", "GNU libmicrohttpd dll for Windows (VC build)\0" + VALUE "InternalName", "libmicrohttpd\0" +#if defined(_DEBUG) + VALUE "OriginalFilename", "libmicrohttpd-dll_d.dll\0" +#else + VALUE "OriginalFilename", "libmicrohttpd-dll.dll\0" +#endif + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "LegalCopyright", "Copyright (C) 2007-2017 Christian Grothoff and project contributors\0" + VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0 /* US English, ASCII */ + END +END diff --git a/w32/common/microhttpd_dll_res_vc.rc.in b/w32/common/microhttpd_dll_res_vc.rc.in new file mode 100644 index 0000000..97a650d --- /dev/null +++ b/w32/common/microhttpd_dll_res_vc.rc.in @@ -0,0 +1,42 @@ +/* W32 resources for .dll */ + +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +VS_VERSION_INFO VERSIONINFO + FILEVERSION @PACKAGE_VERSION_MAJOR@,@PACKAGE_VERSION_MINOR@,@PACKAGE_VERSION_SUBMINOR@,0 + PRODUCTVERSION @PACKAGE_VERSION_MAJOR@,@PACKAGE_VERSION_MINOR@,@PACKAGE_VERSION_SUBMINOR@,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#if defined(_DEBUG) + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0 +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "04090000" /* Lang = US English, Charset = ASCII */ + BEGIN + VALUE "ProductName", "GNU libmicrohttpd\0" + VALUE "ProductVersion", "@PACKAGE_VERSION@\0" + VALUE "FileVersion", "@PACKAGE_VERSION@\0" + VALUE "FileDescription", "GNU libmicrohttpd dll for Windows (VC build)\0" + VALUE "InternalName", "libmicrohttpd\0" +#if defined(_DEBUG) + VALUE "OriginalFilename", "libmicrohttpd-dll_d.dll\0" +#else + VALUE "OriginalFilename", "libmicrohttpd-dll.dll\0" +#endif + VALUE "CompanyName", "Free Software Foundation\0" + VALUE "LegalCopyright", "Copyright (C) 2007-2017 Christian Grothoff and project contributors\0" + VALUE "Comments", "http://www.gnu.org/software/libmicrohttpd/\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0 /* US English, ASCII */ + END +END diff --git a/w32/common/vs_dirs.props b/w32/common/vs_dirs.props new file mode 100644 index 0000000..f8d1c7a --- /dev/null +++ b/w32/common/vs_dirs.props @@ -0,0 +1,9 @@ + + + + $(SolutionDir)..\..\ + $(SolutionDir)..\..\src\ + $(SolutionDir)..\ + $(MhdW32Dir)common\ + +