diff options
61 files changed, 1000 insertions, 3136 deletions
diff --git a/.gitignore b/.gitignore deleted file mode 100644 index f79120e..0000000 --- a/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -.deps/ -.libs/ -Makefile -Makefile.in -*.exe -*.la -*.lo -*.o - -/aclocal.m4 -/autom4te.cache/ -/build-aux/ -/config.* -/configure -/configure~ -/libtool -stamp-h1 - -/libHX.pc diff --git a/LICENSE.GPL3 b/LICENSE.GPL3 deleted file mode 100644 index 4432540..0000000 --- a/LICENSE.GPL3 +++ /dev/null @@ -1,676 +0,0 @@ - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, 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 -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - 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, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If 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 convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU 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 -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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 <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. - diff --git a/LICENSE.LGPL2 b/LICENSE.LGPL2 deleted file mode 100644 index 5ab7695..0000000 --- a/LICENSE.LGPL2 +++ /dev/null @@ -1,504 +0,0 @@ - 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. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/LICENSE.LGPL3 b/LICENSE.LGPL3 deleted file mode 100644 index fc8a5de..0000000 --- a/LICENSE.LGPL3 +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - 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 that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU 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 as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/LICENSE.MIT b/LICENSE.MIT deleted file mode 100644 index 26f131d..0000000 --- a/LICENSE.MIT +++ /dev/null @@ -1,20 +0,0 @@ -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 (including the -next paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS -BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Makefile.am b/Makefile.am index 6c9d27e..3d02bf3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,18 +5,6 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include src pkgconfig_DATA = libHX.pc +EXTRA_DIST = doc/api.rst doc/assorted.txt doc/bitmaps.rst doc/changelog.rst doc/const_cast.c doc/dirstamp.rst doc/files_and_dirs.rst doc/generator.cpp doc/helper_headers.rst doc/history.rst doc/init.rst doc/inline_clist.rst doc/inline_list.rst doc/install.rst doc/libHX_Documentation.rst doc/linked_list.rst doc/macros.rst doc/maps.rst doc/memory_container.rst doc/misc_functions.rst doc/option_parsing.rst doc/process_management.rst doc/random_numbers.rst doc/shconfig.rst doc/socket_functions.rst doc/string_formatter.rst doc/string_ops.rst doc/strlcpy-timing.rst doc/time_functions.rst doc/typecheck_casts.rst doc/ux-file.rst doc/ux-mmap.rst ${pkgconfig_DATA}: ${top_builddir}/config.status - -tmpdir := $(shell mktemp -dtu) -packer = xz -packext = .tar.xz - -.PHONY: tarball -tarball: -# do not use mkdir_p here. - mkdir ${tmpdir} - cd ${top_srcdir} && git archive --prefix=${PACKAGE_NAME}-${PACKAGE_VERSION}/ HEAD | tar -C ${tmpdir} -x - cd ${tmpdir}/${PACKAGE_NAME}-${PACKAGE_VERSION} && autoreconf -fi && rm -Rf autom4te.cache - tar --use=${packer} -C ${tmpdir} -cf ${PACKAGE_NAME}-${PACKAGE_VERSION}${packext} --owner=root --group=root ${PACKAGE_NAME}-${PACKAGE_VERSION}/ - rm -Rf ${tmpdir} diff --git a/Makefile.in b/Makefile.in index b720a82..b3403df 100644 --- a/Makefile.in +++ b/Makefile.in @@ -198,7 +198,8 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/build-aux/ltmain.sh \ $(top_srcdir)/build-aux/missing COPYING build-aux/ar-lib \ build-aux/compile build-aux/config.guess build-aux/config.sub \ - build-aux/install-sh build-aux/ltmain.sh build-aux/missing + build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh \ + build-aux/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -274,7 +275,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -378,9 +378,7 @@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include src pkgconfig_DATA = libHX.pc -tmpdir := $(shell mktemp -dtu) -packer = xz -packext = .tar.xz +EXTRA_DIST = doc/api.rst doc/assorted.txt doc/bitmaps.rst doc/changelog.rst doc/const_cast.c doc/dirstamp.rst doc/files_and_dirs.rst doc/generator.cpp doc/helper_headers.rst doc/history.rst doc/init.rst doc/inline_clist.rst doc/inline_list.rst doc/install.rst doc/libHX_Documentation.rst doc/linked_list.rst doc/macros.rst doc/maps.rst doc/memory_container.rst doc/misc_functions.rst doc/option_parsing.rst doc/process_management.rst doc/random_numbers.rst doc/shconfig.rst doc/socket_functions.rst doc/string_formatter.rst doc/string_ops.rst doc/strlcpy-timing.rst doc/time_functions.rst doc/typecheck_casts.rst doc/ux-file.rst doc/ux-mmap.rst all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -900,15 +898,6 @@ uninstall-am: uninstall-pkgconfigDATA ${pkgconfig_DATA}: ${top_builddir}/config.status -.PHONY: tarball -tarball: -# do not use mkdir_p here. - mkdir ${tmpdir} - cd ${top_srcdir} && git archive --prefix=${PACKAGE_NAME}-${PACKAGE_VERSION}/ HEAD | tar -C ${tmpdir} -x - cd ${tmpdir}/${PACKAGE_NAME}-${PACKAGE_VERSION} && autoreconf -fi && rm -Rf autom4te.cache - tar --use=${packer} -C ${tmpdir} -cf ${PACKAGE_NAME}-${PACKAGE_VERSION}${packext} --owner=root --group=root ${PACKAGE_NAME}-${PACKAGE_VERSION}/ - rm -Rf ${tmpdir} - # 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/README.rst b/README.rst deleted file mode 100644 index 3ac5e61..0000000 --- a/README.rst +++ /dev/null @@ -1,8 +0,0 @@ -libHX collects many useful day-to-day functions, intended to reduce the amount -of otherwise repeatedly open-coded instructions. - -It has maps, deques, linked lists, string formatting and autoresizing, option -and config file parsing, type checking casts (for C), directory traversal, etc. - -There is more documentation in the aptly-named directory ``doc``. -The entrypoint is `doc/libHX_Documentation.rst <doc/libHX_Documentation.rst>`_. diff --git a/assorted/.gitignore b/assorted/.gitignore deleted file mode 100644 index 7c16b0a..0000000 --- a/assorted/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/unit2any diff --git a/assorted/Makefile.am b/assorted/Makefile.am deleted file mode 100644 index fc3c7f1..0000000 --- a/assorted/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Makefile -*- - -AM_CPPFLAGS = -I${top_srcdir}/include - -noinst_PROGRAMS = unit2any - -unit2any_LDADD = ../src/libHX.la diff --git a/assorted/deque2.c b/assorted/deque2.c deleted file mode 100644 index e5c4798..0000000 --- a/assorted/deque2.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * libHX/assorted/deque2.c - * Copyright Jan Engelhardt, 2002-2007 - * - * This file is part of libHX. libHX 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 or (at your option) any later version. - * - * deque2.c: - * Assorted DEQUE functions that are not deemed to be useful in the - * (compiled) library at this time. - */ -#include <stdio.h> -#include <libHX.h> - -EXPORT_SYMBOL struct HXdeque_node *HXdeque_rfind(struct HXdeque *dq, - const void *ptr) -{ - struct HXdeque_node *trav; - for (trav = dq->last; trav != NULL; trav = trav->prev) - if (trav->ptr == ptr) - return trav; - return NULL; -} - -EXPORT_SYMBOL void *HXdeque_rget(struct HXdeque *dq, const void *ptr) -{ - struct HXdeque_node *trav; - for (trav = dq->last; trav != NULL; trav = trav->prev) - if (trav->ptr == ptr) - return trav->ptr; - return NULL; -} - -EXPORT_SYMBOL void *HXdeque_sget(struct HXdeque *dq, const char *s) -{ - struct HXdeque_node *trav; - for (trav = dq->first; trav != NULL; trav = trav->next) - if (strcmp(trav->ptr, s) == 0) - return trav->ptr; - return NULL; -} - -EXPORT_SYMBOL struct HXdeque_node *HXdeque_dup(struct HXdeque *dq) -{ - /* - * Duplicate the object on top of the stack by popping it off and - * adding it again, twice. - */ - if (dq->last == NULL) - return NULL; - - /* - * The mathematical axiomatic definition is that the last element is - * popped off and pushed twice. We optimize by simply "looking" at the - * last and push it again. - */ - return HXdeque_push(dq, dq->last->ptr); -} - -EXPORT_SYMBOL struct HXdeque_node *HXdeque_rdup(struct HXdeque *dq) -{ - /* Same as HXdeque_dup(), but works on the bottom of the stack */ - if (dq->first == NULL) - return NULL; - return HXdeque_unshift(dq, dq->first->ptr); -} - -EXPORT_SYMBOL struct HXdeque_node *HXdeque_toprr(struct HXdeque *dq) -{ - /* - * Rotates the topmost three items right ([bottom]...CBA[top] => - * [bottom]...ACB[top]). Also works if there are only two items in the - * stack. - */ - struct HXdeque_node *p = dq->last; - if (p == NULL) - return NULL; - HXdeque_down(p); - HXdeque_down(p); - return p; -} - -EXPORT_SYMBOL struct HXdeque_node *HXdeque_toprl(struct HXdeque *dq) -{ - /* Rotates the topmost three items left (...CBA => ...BAC) */ - struct HXdeque_node *p = dq->last; - if (p == NULL) - return NULL; - if (p->Prev != NULL) p = p->Prev; - if (p->Prev != NULL) p = p->Prev; - HXdeque_up(p); - HXdeque_up(p); - return p; -} - -EXPORT_SYMBOL struct HXdeque_node *HXdeque_botrr(struct HXdeque *dq) -{ - /* (CBA... => ...ACB) */ - struct HXdeque_node *p = dq->first; - if (p == NULL) - return NULL; - if (p->Prev != NULL) p = p->Prev; - if (p->Prev != NULL) p = p->Prev; - HXdeque_down(p); - HXdeque_down(p); - return p; -} - -EXPORT_SYMBOL struct HXdeque_node *HXdeque_botrl(struct HXdeque *dq) -{ - struct HXdeque_node *p = dq->first; - if (p == NULL) - return NULL; - HXdeque_up(p); - HXdeque_up(p); - return p; -} diff --git a/assorted/pack.c b/assorted/pack.c deleted file mode 100644 index 9eec65e..0000000 --- a/assorted/pack.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * libHX/assorted/pack.c - * Copyright Jan Engelhardt, 1999-2005 - * - * This file is part of libHX. libHX 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 or (at your option) any later version. - */ -#include <sys/types.h> -#include <stdarg.h> -#include <stdint.h> -#include <string.h> - -size_t HX_pack(char *buf, size_t buflen, const char *fmt, ...) -{ - char *obp = buf; - int run = 1; - va_list ap; - va_start(ap, fmt); - - while (run && *fmt != '\0') { - switch (*fmt++) { - case 'A': /* string with up to 255 chars */ - case 'a': { - const char *src = va_arg(ap, const char *); - size_t slen = strlen(src) & 0xFF; - if (buflen < slen + 1) { - run = 0; - break; - } - *buf++ = slen; - memcpy(buf, src, slen); - buf += slen; - buflen -= slen + 1; - break; - } - case 'C': /* unsigned char */ - case 'c': - if (buflen-- < 1) { - run = 0; - break; - } - /* - * Minimum object's size being pushed on the stack is 2 - * bytes since short int is promoted to int when passed - * thru va_arg and stays uncasted. (FIXME) - */ - *buf++ = va_arg(ap, unsigned int); - break; - case 'H': /* unsigned short */ - case 'h': - if (buflen < sizeof(uint16_t)) { - run = 0; - break; - } - *((uint16_t *)buf) = va_arg(ap, uint16_t); - buf += sizeof(uint16_t); - buflen -= sizeof(uint16_t); - break; - case 'L': /* unsigned long */ - case 'l': - if (buflen < sizeof(uint32_t)) { - run = 0; - break; - } - *((uint32_t *)buf) = va_arg(ap, uint32_t); - buf += sizeof(uint32_t); - buflen -= sizeof(uint32_t); - break; - case 'S': /* string with up to 65535 chars */ - case 's': { - const char *src = va_arg(ap, const char *); - size_t slen = strlen(src) & 0xFFFF; - if (buflen < slen + 2) { - run = 0; - break; - } - *((unsigned short *)buf) = slen; - memcpy(buf += 2, src, slen); - buf += slen; - buflen -= slen + 2; - break; - } - case 'V': /* fixed size string */ - case 'v': { - void *src = va_arg(ap, void *); - size_t slen = va_arg(ap, size_t); - if (buflen < slen) { - run = 0; - break; - } - memcpy(buf, src, slen); - buf += slen; - buflen -= slen; - break; - } - } /* switch */ - } - - va_end(ap); - return buf - obp; -} diff --git a/assorted/tofrac.c b/assorted/tofrac.c deleted file mode 100644 index e4c1480..0000000 --- a/assorted/tofrac.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * libHX/assorted/tofrac.c - * Copyright Jan Engelhardt, 1999-2010 - * - * This file is part of libHX. libHX 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 or (at your option) any later version. - */ -/* - * Calculates a readable fraction (i.e. 1/3) from arg and puts the - * *numerator into num, the denominator into *denom. Since the fraction - * is found out by an iterative loop, you can specify the minimum value - * of the denominator in *num and the maximum value of the denominator - * into *denom before calling the function. - * - * If a suitable fraction has been found (within the range of the - * minimum / maximum denominator, *num and *denom will be overwritten - * with the results and true is returned; false for no success. - * - * You need to re-put your min/max denom values into *num and *denom - * then. - */ -#include <sys/types.h> -#include <limits.h> -#include <math.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> - -/* This simplistic version does not deal with negative numbers. */ - -static bool HX_tofrac(double arg, unsigned long *num, unsigned long *denom) -{ - unsigned long i, min_denom = *num, max_denom = *denom; - double j, s; - - /* - * This tries all possible denominators until @arg multiplied by @i - * gives a number that has a fractional part of 0, which is when we - * found the optimal fraction. - */ - for (i = min_denom; i < max_denom; ++i) { - s = arg * i; - modf(s, &j); - if (s == j) { - *num = j; - *denom = i; - return true; - } - } - return false; -} - -int main(int argc, const char **argv) -{ - unsigned long d = 1, n = ULONG_MAX; - - if (argc < 2) { - fprintf(stderr, "Usage: %s 3.141592\n", *argv); - return EXIT_FAILURE; - } - - if (!HX_tofrac(strtod(argv[1], NULL), &d, &n)) { - fprintf(stderr, "Our algorithm was too weak :-)\n"); - return EXIT_FAILURE; - } - - printf("%lu/%lu\n", d, n); - return EXIT_SUCCESS; -} diff --git a/assorted/unit2any.c b/assorted/unit2any.c deleted file mode 100644 index 74e87d3..0000000 --- a/assorted/unit2any.c +++ /dev/null @@ -1,49 +0,0 @@ -#include <stdbool.h> -#include <stdlib.h> -#include <libHX/option.h> - -static double dpi = 96; - -static void px2any(const struct HXoptcb *cbi) -{ - double px = cbi->data_dbl; - - printf("%f px are (at %f DPI) equal to:\n", px, dpi); - printf("\t%f inch\n", px / dpi); - printf("\t%f pt\n", px * 72 / dpi); - printf("\t%f cm\n", px * 2.54 / dpi); -} - -static void pt2any(const struct HXoptcb *cbi) -{ - double pt = cbi->data_dbl; - - printf("%f pt are equal to:\n", pt); - printf("\t%f inch\n", pt / 72); - printf("\t%f px (at %f DPI)\n", dpi * pt / 72, dpi); - printf("\t%f cm\n", pt * 2.54 / 72); -} - -static const struct HXoption option_table[] = { - {.sh = 'D', .ln = "dpi", .type = HXTYPE_DOUBLE, .ptr = &dpi, - .help = "Resolution (default: 96 dpi)"}, - {.sh = 'P', .ln = "px", .type = HXTYPE_DOUBLE, .cb = px2any}, - {.sh = 'p', .ln = "pt", .type = HXTYPE_DOUBLE, .cb = pt2any}, - HXOPT_AUTOHELP, - HXOPT_TABLEEND, -}; - -static bool get_options(int *argc, const char ***argv) -{ -} - -int main(int argc, const char **argv) -{ - int ret; - - ret = HX_getopt(option_table, &argc, &argv, HXOPT_USAGEONERR); - if (ret != HXOPT_ERR_SUCCESS) - return EXIT_FAILURE; - - -} diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh index 2a50d7f..0f0a2da 100755 --- a/build-aux/ltmain.sh +++ b/build-aux/ltmain.sh @@ -1,12 +1,12 @@ -#! /usr/bin/env sh +#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in -## by inline-source v2019-02-19.15 +## by inline-source v2014-01-03.01 -# libtool (GNU libtool) 2.4.7 +# libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 -# Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. +# 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. @@ -31,8 +31,8 @@ PROGRAM=libtool PACKAGE=libtool -VERSION=2.4.7 -package_revision=2.4.7 +VERSION=2.4.6 +package_revision=2.4.6 ## ------ ## @@ -64,25 +64,34 @@ package_revision=2.4.7 # libraries, which are installed to $pkgauxdir. # Set a version string for this script. -scriptversion=2019-02-19.15; # UTC +scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 -# This is free software. There is NO warranty; not even for -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# -# Copyright (C) 2004-2019, 2021 Bootstrap Authors -# -# This file is dual licensed under the terms of the MIT license -# <https://opensource.org/license/MIT>, and GPL version 2 or later -# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of -# these licenses when using or redistributing this software or any of -# the files within it. See the URLs above, or the file `LICENSE` -# included in the Bootstrap distribution for the full license texts. +# 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. -# Please report bugs or propose patches to: -# <https://github.com/gnulib-modules/bootstrap/issues> +# 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 <http://www.gnu.org/licenses/>. + +# Please report bugs or propose patches to gary@gnu.org. ## ------ ## @@ -130,12 +139,9 @@ do _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done -# These NLS vars are set unconditionally (bootstrap issue #24). Unset those -# in case the environment reset is needed later and the $save_* variant is not -# defined (see the code above). -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' @@ -153,26 +159,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# func_unset VAR -# -------------- -# Portably unset VAR. -# In some shells, an 'unset VAR' statement leaves a non-zero return -# status if VAR is already unset, which might be problematic if the -# statement is used at the end of a function (thus poisoning its return -# value) or when 'set -e' is active (causing even a spurious abort of -# the script in this case). -func_unset () -{ - { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; } -} - - -# Make sure CDPATH doesn't cause `cd` commands to output the target dir. -func_unset CDPATH - -# Make sure ${,E,F}GREP behave sanely. -func_unset GREP_OPTIONS - ## ------------------------- ## ## Locate command utilities. ## @@ -273,7 +259,7 @@ test -z "$SED" && { rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin" + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } @@ -309,7 +295,7 @@ test -z "$GREP" && { rm -f conftest.in conftest.tmp conftest.nl conftest.out } - func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin" + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } @@ -374,35 +360,6 @@ sed_double_backslash="\ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" -# require_check_ifs_backslash -# --------------------------- -# Check if we can use backslash as IFS='\' separator, and set -# $check_ifs_backshlash_broken to ':' or 'false'. -require_check_ifs_backslash=func_require_check_ifs_backslash -func_require_check_ifs_backslash () -{ - _G_save_IFS=$IFS - IFS='\' - _G_check_ifs_backshlash='a\\b' - for _G_i in $_G_check_ifs_backshlash - do - case $_G_i in - a) - check_ifs_backshlash_broken=false - ;; - '') - break - ;; - *) - check_ifs_backshlash_broken=: - break - ;; - esac - done - IFS=$_G_save_IFS - require_check_ifs_backslash=: -} - ## ----------------- ## ## Global variables. ## @@ -623,16 +580,16 @@ if test yes = "$_G_HAVE_PLUSEQ_OP"; then { $debug_cmd - func_quote_arg pretty "$2" - eval "$1+=\\ \$func_quote_arg_result" + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd - func_quote_arg pretty "$2" - eval "$1=\$$1\\ \$func_quote_arg_result" + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi @@ -1134,203 +1091,85 @@ func_relative_path () } -# func_quote_portable EVAL ARG -# ---------------------------- -# Internal function to portably implement func_quote_arg. Note that we still -# keep attention to performance here so we as much as possible try to avoid -# calling sed binary (so far O(N) complexity as long as func_append is O(1)). -func_quote_portable () +# 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 - $require_check_ifs_backslash - - func_quote_portable_result=$2 - - # one-time-loop (easy break) - while true - do - if $1; then - func_quote_portable_result=`$ECHO "$2" | $SED \ - -e "$sed_double_quote_subst" -e "$sed_double_backslash"` - break - fi - - # Quote for eval. - case $func_quote_portable_result in + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in *[\\\`\"\$]*) - # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string - # contains the shell wildcard characters. - case $check_ifs_backshlash_broken$func_quote_portable_result in - :*|*[\[\*\?]*) - func_quote_portable_result=`$ECHO "$func_quote_portable_result" \ - | $SED "$sed_quote_subst"` - break - ;; - esac + _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 - func_quote_portable_old_IFS=$IFS - for _G_char in '\' '`' '"' '$' - do - # STATE($1) PREV($2) SEPARATOR($3) - set start "" "" - func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy - IFS=$_G_char - for _G_part in $func_quote_portable_result - do - case $1 in - quote) - func_append func_quote_portable_result "$3$2" - set quote "$_G_part" "\\$_G_char" - ;; - start) - set first "" "" - func_quote_portable_result= - ;; - first) - set quote "$_G_part" "" - ;; - esac - done - done - IFS=$func_quote_portable_old_IFS + 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 - break - done - func_quote_portable_unquoted_result=$func_quote_portable_result - case $func_quote_portable_result 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. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_portable_result=\"$func_quote_portable_result\" - ;; - 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_quotefast_eval ARG -# ----------------------- -# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', -# but optimized for speed. Result is stored in $func_quotefast_eval. -if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then - printf -v _GL_test_printf_tilde %q '~' - if test '\~' = "$_GL_test_printf_tilde"; then - func_quotefast_eval () - { - printf -v func_quotefast_eval_result %q "$1" - } - else - # Broken older Bash implementations. Make those faster too if possible. - func_quotefast_eval () - { - case $1 in - '~'*) - func_quote_portable false "$1" - func_quotefast_eval_result=$func_quote_portable_result - ;; - *) - printf -v func_quotefast_eval_result %q "$1" - ;; - esac - } - fi -else - func_quotefast_eval () - { - func_quote_portable false "$1" - func_quotefast_eval_result=$func_quote_portable_result - } -fi - +# 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 -# func_quote_arg MODEs ARG -# ------------------------ -# Quote one ARG to be evaled later. MODEs argument may contain zero or more -# specifiers listed below separated by ',' character. This function returns two -# values: -# i) func_quote_arg_result -# double-quoted (when needed), suitable for a subsequent eval -# ii) func_quote_arg_unquoted_result -# has all characters that are still active within double -# quotes backslashified. Available only if 'unquoted' is specified. -# -# Available modes: -# ---------------- -# 'eval' (default) -# - escape shell special characters -# 'expand' -# - the same as 'eval'; but do not quote variable references -# 'pretty' -# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might -# be used later in func_quote to get output like: 'echo "a b"' instead -# of 'echo a\ b'. This is slower than default on some shells. -# 'unquoted' -# - produce also $func_quote_arg_unquoted_result which does not contain -# wrapping double-quotes. -# -# Examples for 'func_quote_arg pretty,unquoted string': -# -# string | *_result | *_unquoted_result -# ------------+-----------------------+------------------- -# " | \" | \" -# a b | "a b" | a b -# "a b" | "\"a b\"" | \"a b\" -# * | "*" | * -# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" -# -# Examples for 'func_quote_arg pretty,unquoted,expand string': -# -# string | *_result | *_unquoted_result -# --------------+---------------------+-------------------- -# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" -func_quote_arg () -{ - _G_quote_expand=false - case ,$1, in - *,expand,*) - _G_quote_expand=: - ;; + case $1 in + *[\\\`\"]*) + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + *) + _G_arg=$1 ;; esac - case ,$1, in - *,pretty,*|*,expand,*|*,unquoted,*) - func_quote_portable $_G_quote_expand "$2" - func_quote_arg_result=$func_quote_portable_result - func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result - ;; - *) - # Faster quote-for-eval for some shells. - func_quotefast_eval "$2" - func_quote_arg_result=$func_quotefast_eval_result + 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 MODEs ARGs... -# ------------------------ -# Quote all ARGs to be evaled later and join them into single command. See -# func_quote_arg's description for more info. -func_quote () -{ - $debug_cmd - _G_func_quote_mode=$1 ; shift - func_quote_result= - while test 0 -lt $#; do - func_quote_arg "$_G_func_quote_mode" "$1" - if test -n "$func_quote_result"; then - func_append func_quote_result " $func_quote_arg_result" - else - func_append func_quote_result "$func_quote_arg_result" - fi - shift - done + func_quote_for_expand_result=$_G_arg } @@ -1376,8 +1215,8 @@ func_show_eval () _G_cmd=$1 _G_fail_exp=${2-':'} - func_quote_arg pretty,expand "$_G_cmd" - eval "func_notquiet $func_quote_arg_result" + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" @@ -1402,8 +1241,8 @@ func_show_eval_locale () _G_fail_exp=${2-':'} $opt_quiet || { - func_quote_arg expand,pretty "$_G_cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$_G_cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { @@ -1530,26 +1369,30 @@ func_lt_ver () # 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 -# This is free software. There is NO warranty; not even for -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# -# Copyright (C) 2010-2019, 2021 Bootstrap Authors -# -# This file is dual licensed under the terms of the MIT license -# <https://opensource.org/license/MIT>, and GPL version 2 or later -# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of -# these licenses when using or redistributing this software or any of -# the files within it. See the URLs above, or the file `LICENSE` -# included in the Bootstrap distribution for the full license texts. +# 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. -# Please report bugs or propose patches to: -# <https://github.com/gnulib-modules/bootstrap/issues> +# 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. -# Set a version string for this script. -scriptversion=2019-02-19.15; # UTC +# 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 <http://www.gnu.org/licenses/>. + +# Please report bugs or propose patches to gary@gnu.org. ## ------ ## @@ -1572,7 +1415,7 @@ scriptversion=2019-02-19.15; # UTC # # 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 '# Copyright'. +# 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 @@ -1584,7 +1427,7 @@ scriptversion=2019-02-19.15; # UTC # to display verbose messages only when your user has specified # '--verbose'. # -# After sourcing this file, you can plug in processing for additional +# 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. @@ -1633,8 +1476,8 @@ fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## # This section contains functions for adding, removing, and running hooks -# in the main code. A hook is just a list of function names that can be -# run in order later on. +# 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 # ----------------------- @@ -1667,8 +1510,7 @@ func_add_hook () # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ -# Remove HOOK_FUNC from the list of hook functions to be called by -# FUNC_NAME. +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd @@ -1677,28 +1519,10 @@ func_remove_hook () } -# func_propagate_result FUNC_NAME_A FUNC_NAME_B -# --------------------------------------------- -# If the *_result variable of FUNC_NAME_A _is set_, assign its value to -# *_result variable of FUNC_NAME_B. -func_propagate_result () -{ - $debug_cmd - - func_propagate_result_result=: - if eval "test \"\${${1}_result+set}\" = set" - then - eval "${2}_result=\$${1}_result" - else - func_propagate_result_result=false - fi -} - - # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. -# It's assumed that the list of hook functions contains nothing more +# 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. @@ -1708,19 +1532,22 @@ func_run_hooks () case " $hookable_fns " in *" $1 "*) ;; - *) func_fatal_error "'$1' does not support hook functions." ;; + *) 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 - func_unset "${_G_hook}_result" - eval $_G_hook '${1+"$@"}' - func_propagate_result $_G_hook func_run_hooks - if $func_propagate_result_result; then - eval set dummy "$func_run_hooks_result"; shift - fi + 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 } @@ -1730,18 +1557,10 @@ func_run_hooks () ## --------------- ## # In order to add your own option parsing hooks, you must accept the -# full positional parameter list from your hook function. You may remove -# or edit any options that you action, and then pass back the remaining -# unprocessed options in '<hooked_function_name>_result', escaped -# suitably for 'eval'. -# -# The '<hooked_function_name>_result' variable is automatically unset -# before your hook gets called; for best performance, only set the -# *_result variable when necessary (i.e. don't call the 'func_quote' -# function unnecessarily because it can be an expensive operation on some -# machines). -# -# Like this: +# full positional parameter list in your hook function, remove any +# options that you action, and then pass back the remaining unprocessed +# options in '<hooked_function_name>_result', escaped suitably for +# 'eval'. Like this: # # my_options_prep () # { @@ -1751,8 +1570,9 @@ func_run_hooks () # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' -# # No change in '$@' (ignored completely by this hook). Leave -# # my_options_prep_result variable intact. +# +# func_quote_for_eval ${1+"$@"} +# my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # @@ -1761,36 +1581,25 @@ func_run_hooks () # { # $debug_cmd # -# args_changed=false -# -# # Note that, for efficiency, we parse as many options as we can +# # 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=: -# args_changed=: -# ;; +# --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 -# args_changed=: # ;; -# *) # Make sure the first unrecognised option "$_G_opt" -# # is added back to "$@" in case we need it later, -# # if $args_changed was set to 'true'. -# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; +# *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # -# # Only call 'func_quote' here if we processed at least one argument. -# if $args_changed; then -# func_quote eval ${1+"$@"} -# my_silent_option_result=$func_quote_result -# fi +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # @@ -1801,26 +1610,17 @@ func_run_hooks () # # $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 also need to manually amend $usage_message to reflect the extra +# 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_finish [ARG]... -# ---------------------------- -# Finishing the option parse loop (call 'func_options' hooks ATM). -func_options_finish () -{ - $debug_cmd - - func_run_hooks func_options ${1+"$@"} - func_propagate_result func_run_hooks func_options_finish -} - - # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the @@ -1830,27 +1630,17 @@ func_options () { $debug_cmd - _G_options_quoted=false + 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"} - for my_func in options_prep parse_options validate_options options_finish - do - func_unset func_${my_func}_result - func_unset func_run_hooks_result - eval func_$my_func '${1+"$@"}' - func_propagate_result func_$my_func func_options - if $func_propagate_result_result; then - eval set dummy "$func_options_result"; shift - _G_options_quoted=: - fi - done + eval func_run_hooks func_options \ + ${func_validate_options_result+"$func_validate_options_result"} - $_G_options_quoted || { - # As we (func_options) are top-level options-parser function and - # nobody quoted "$@" for us yet, we need to do it explicitly for - # caller. - func_quote eval ${1+"$@"} - func_options_result=$func_quote_result - } + # save modified positional parameters for caller + func_options_result=$func_run_hooks_result } @@ -1859,8 +1649,9 @@ func_options () # 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 propagate that back to rest of this script, then the complete -# modified list must be put in 'func_run_hooks_result' before returning. +# 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 () { @@ -1871,7 +1662,9 @@ func_options_prep () opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} - func_propagate_result func_run_hooks func_options_prep + + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result } @@ -1883,32 +1676,25 @@ func_parse_options () { $debug_cmd - _G_parse_options_requote=false + 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+"$@"} - func_propagate_result func_run_hooks func_parse_options - if $func_propagate_result_result; then - eval set dummy "$func_parse_options_result"; shift - # Even though we may have changed "$@", we passed the "$@" array - # down into the hook and it quoted it for us (because we are in - # this if-branch). No need to quote it again. - _G_parse_options_requote=false - fi + + # 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 - # We expect that one of the options parsed in this function matches - # and thus we remove _G_opt from "$@" and need to re-quote. - _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' - func_echo "enabling shell trace mode" >&2 + func_echo "enabling shell trace mode" $debug_cmd ;; @@ -1918,10 +1704,7 @@ func_parse_options () ;; --warnings|--warning|-W) - if test $# = 0 && func_missing_arg $_G_opt; then - _G_parse_options_requote=: - break - fi + test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above @@ -1974,24 +1757,15 @@ func_parse_options () shift ;; - --) _G_parse_options_requote=: ; break ;; + --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; - *) set dummy "$_G_opt" ${1+"$@"}; shift - _G_match_parse_options=false - break - ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac - - if $_G_match_parse_options; then - _G_parse_options_requote=: - fi done - if $_G_parse_options_requote; then - # save modified positional parameters for caller - func_quote eval ${1+"$@"} - func_parse_options_result=$func_quote_result - fi + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result } @@ -2008,10 +1782,12 @@ func_validate_options () test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} - func_propagate_result func_run_hooks func_validate_options # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE + + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result } @@ -2067,8 +1843,8 @@ func_missing_arg () # func_split_equals STRING # ------------------------ -# Set func_split_equals_lhs and func_split_equals_rhs shell variables -# after splitting STRING at the '=' sign. +# 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 \ @@ -2083,9 +1859,8 @@ then func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} - if test "x$func_split_equals_lhs" = "x$1"; then - func_split_equals_rhs= - fi + 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. @@ -2095,7 +1870,7 @@ else func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= - test "x$func_split_equals_lhs=" = "x$1" \ + test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals @@ -2121,7 +1896,7 @@ else { $debug_cmd - func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'` + func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt @@ -2163,44 +1938,31 @@ func_usage_message () # func_version # ------------ # Echo version message to standard output and exit. -# The version message is extracted from the calling file's header -# comments, with leading '# ' stripped: -# 1. First display the progname and version -# 2. Followed by the header comment line matching /^# Written by / -# 3. Then a blank line followed by the first following line matching -# /^# Copyright / -# 4. Immediately followed by any lines between the previous matches, -# except lines preceding the intervening completely blank line. -# For example, see the header comments of this file. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' - /^# Written by /!b - s|^# ||; p; n - - :fwd2blnk - /./ { - n - b fwd2blnk + /(C)/!b go + :more + /\./!{ + N + s|\n# | | + b more } - p; n - - :holdwrnt - s|^# || - s|^# *$|| - /^Copyright /!{ - /./H - n - b holdwrnt + :go + /^# Written by /,/# warranty; / { + s|^# || + s|^# *$|| + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + p } - - s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| - G - s|\(\n\)\n*|\1|g - p; q' < "$progpath" + /^# Written by / { + s|^# || + p + } + /^warranty; /q' < "$progpath" exit $? } @@ -2210,12 +1972,12 @@ func_version () # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# 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.7' +scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... @@ -2306,7 +2068,7 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname (GNU libtool) 2.4.7 + version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` @@ -2362,7 +2124,7 @@ fi # a configuration failure hint, and exit. func_fatal_configuration () { - func_fatal_error ${1+"$@"} \ + func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } @@ -2508,8 +2270,6 @@ libtool_options_prep () nonopt= preserve_args= - _G_rc_lt_options_prep=: - # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) @@ -2533,16 +2293,11 @@ libtool_options_prep () uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; - *) - _G_rc_lt_options_prep=false - ;; esac - if $_G_rc_lt_options_prep; then - # Pass back the list of options. - func_quote eval ${1+"$@"} - libtool_options_prep_result=$func_quote_result - fi + # 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 @@ -2554,12 +2309,9 @@ libtool_parse_options () { $debug_cmd - _G_rc_lt_parse_options=false - # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do - _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in @@ -2634,20 +2386,15 @@ libtool_parse_options () func_append preserve_args " $_G_opt" ;; - # An option not handled by this hook function: - *) set dummy "$_G_opt" ${1+"$@"} ; shift - _G_match_lt_parse_options=false - break - ;; + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac - $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done - if $_G_rc_lt_parse_options; then - # save modified positional parameters for caller - func_quote eval ${1+"$@"} - libtool_parse_options_result=$func_quote_result - fi + + # 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 @@ -2704,8 +2451,8 @@ libtool_validate_options () } # Pass back the unparsed argument list - func_quote eval ${1+"$@"} - libtool_validate_options_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options @@ -3671,8 +3418,8 @@ func_mode_compile () esac done - func_quote_arg pretty "$libobj" - test "X$libobj" != "X$func_quote_arg_result" \ + 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" "/" "" @@ -3745,8 +3492,8 @@ compiler." func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result - func_quote_arg pretty "$srcfile" - qsrcfile=$func_quote_arg_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 @@ -3901,8 +3648,7 @@ This mode accepts the following additional options: -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 - -Xcompiler FLAG pass FLAG directly to the compiler + -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. @@ -4008,8 +3754,6 @@ The following components of LINK-COMMAND are treated specially: -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wa,FLAG - -Xassembler FLAG pass linker-specific FLAG directly to the assembler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) @@ -4352,8 +4096,8 @@ func_mode_install () case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. - func_quote_arg pretty "$nonopt" - install_prog="$func_quote_arg_result " + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " arg=$1 shift else @@ -4363,8 +4107,8 @@ func_mode_install () # The real first argument should be the name of the installation program. # Aesthetically quote it. - func_quote_arg pretty "$arg" - func_append install_prog "$func_quote_arg_result" + 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=: ;; @@ -4421,12 +4165,12 @@ func_mode_install () esac # Aesthetically quote the argument. - func_quote_arg pretty "$arg" - func_append install_prog " $func_quote_arg_result" + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then - func_quote_arg pretty "$arg2" + func_quote_for_eval "$arg2" fi - func_append install_shared_prog " $func_quote_arg_result" + func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -4437,8 +4181,8 @@ func_mode_install () if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else - func_quote_arg pretty "$install_override_mode" - func_append install_shared_prog " -m $func_quote_arg_result" + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi @@ -4734,8 +4478,8 @@ func_mode_install () relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { - func_quote_arg expand,pretty "$relink_command" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else @@ -5514,8 +5258,7 @@ else if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" - func_quote_arg pretty "$ECHO" - qECHO=$func_quote_arg_result + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. @@ -5525,7 +5268,7 @@ func_fallback_echo () \$1 _LTECHO_EOF' } - ECHO=$qECHO + ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to @@ -6868,9 +6611,9 @@ func_mode_link () while test "$#" -gt 0; do arg=$1 shift - func_quote_arg pretty,unquoted "$arg" - qarg=$func_quote_arg_unquoted_result - func_append libtool_args " $func_quote_arg_result" + 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 @@ -7106,13 +6849,6 @@ func_mode_link () prev= continue ;; - xassembler) - func_append compiler_flags " -Xassembler $qarg" - prev= - func_append compile_command " -Xassembler $qarg" - func_append finalize_command " -Xassembler $qarg" - continue - ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" @@ -7283,7 +7019,7 @@ func_mode_link () # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; @@ -7303,7 +7039,7 @@ func_mode_link () esac elif test X-lc_r = "X$arg"; then case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -7333,20 +7069,8 @@ func_mode_link () prev=xcompiler continue ;; - # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199. - -pthread) - case $host in - *solaris2*) ;; - *) - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - ;; - esac - continue - ;; - -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ + + -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" @@ -7487,9 +7211,9 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_arg pretty "$flag" - func_append arg " $func_quote_arg_result" - func_append compiler_flags " $func_quote_arg_result" + 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" @@ -7503,21 +7227,16 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_arg pretty "$flag" - func_append arg " $wl$func_quote_arg_result" - func_append compiler_flags " $wl$func_quote_arg_result" - func_append linker_flags " $func_quote_arg_result" + 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 ;; - -Xassembler) - prev=xassembler - continue - ;; - -Xcompiler) prev=xcompiler continue @@ -7535,8 +7254,8 @@ func_mode_link () # -msg_* for osf cc -msg_*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: @@ -7553,17 +7272,12 @@ func_mode_link () # -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 - # -fuse-ld=* Linker select flags for GCC - # -Wa,* Pass flags directly to the assembler -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=*|-fuse-ld=*|-Wa,*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) + 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" @@ -7584,15 +7298,15 @@ func_mode_link () continue else # Otherwise treat like 'Some other compiler flag' below - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; *.$objext) @@ -7712,8 +7426,8 @@ func_mode_link () *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; esac # arg @@ -8918,7 +8632,7 @@ func_mode_link () test CXX = "$tagname" && { case $host_os in linux*) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi @@ -9091,7 +8805,7 @@ func_mode_link () # case $version_type in # correct linux to gnu/linux during the next big refactor - darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none) + darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor @@ -9182,7 +8896,7 @@ func_mode_link () versuffix=.$current.$revision ;; - freebsd-elf | midnightbsd-elf) + freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision @@ -9408,7 +9122,7 @@ func_mode_link () *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) @@ -10219,8 +9933,8 @@ EOF for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { - func_quote_arg expand,pretty "$cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10313,8 +10027,8 @@ EOF eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { - func_quote_arg expand,pretty "$cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10788,13 +10502,12 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_arg pretty "$var_value" - relink_command="$var=$func_quote_arg_result; export $var; $relink_command" + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done - func_quote eval cd "`pwd`" - func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)" - relink_command=$func_quote_arg_unquoted_result + 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. @@ -11034,15 +10747,13 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_arg pretty,unquoted "$var_value" - relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" + 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. - func_quote eval cd "`pwd`" - relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - func_quote_arg pretty,unquoted "$relink_command" - relink_command=$func_quote_arg_unquoted_result + 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 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for libHX 4.14. +# Generated by GNU Autoconf 2.71 for libHX 4.17. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, @@ -618,8 +618,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libHX' PACKAGE_TARNAME='libhx' -PACKAGE_VERSION='4.14' -PACKAGE_STRING='libHX 4.14' +PACKAGE_VERSION='4.17' +PACKAGE_STRING='libHX 4.17' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -686,7 +686,6 @@ MANIFEST_TOOL RANLIB DLLTOOL OBJDUMP -FILECMD LN_S NM ac_ct_DUMPBIN @@ -1375,7 +1374,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libHX 4.14 to adapt to many kinds of systems. +\`configure' configures libHX 4.17 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1446,7 +1445,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libHX 4.14:";; + short | recursive ) echo "Configuration of libHX 4.17:";; esac cat <<\_ACEOF @@ -1561,7 +1560,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libHX configure 4.14 +libHX configure 4.17 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2195,7 +2194,7 @@ 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 libHX $as_me 4.14, which was +It was created by libHX $as_me 4.17, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3684,7 +3683,7 @@ fi # Define the identity of the package. PACKAGE='libhx' - VERSION='4.14' + VERSION='4.17' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -5894,38 +5893,6 @@ unknown) ;; esac -# Check whether --enable-static was given. -if test ${enable_static+y} -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 $as_nop - enable_static=no -fi - - - - - - - - - case `pwd` in *\ * | *\ *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 @@ -5934,8 +5901,8 @@ esac -macro_version='2.4.7' -macro_revision='2.4.7' +macro_version='2.4.6' +macro_revision='2.4.6' @@ -6563,13 +6530,13 @@ else 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 + 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 + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 @@ -6707,7 +6674,7 @@ esac fi fi - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | $SED '1q'` in + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; @@ -6811,7 +6778,7 @@ else $as_nop lt_cv_sys_max_cmd_len=8192; ;; - bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + 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` @@ -6854,7 +6821,7 @@ else $as_nop 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/.*[ ]//'` + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi @@ -7060,114 +7027,6 @@ esac if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}file", so it can be a program name with args. -set dummy ${ac_tool_prefix}file; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_FILECMD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$FILECMD"; then - ac_cv_prog_FILECMD="$FILECMD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - 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_FILECMD="${ac_tool_prefix}file" - printf "%s\n" "$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 -FILECMD=$ac_cv_prog_FILECMD -if test -n "$FILECMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FILECMD" >&5 -printf "%s\n" "$FILECMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_FILECMD"; then - ac_ct_FILECMD=$FILECMD - # Extract the first word of "file", so it can be a program name with args. -set dummy file; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_FILECMD+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_FILECMD"; then - ac_cv_prog_ac_ct_FILECMD="$ac_ct_FILECMD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - 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_FILECMD="file" - printf "%s\n" "$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_FILECMD=$ac_cv_prog_ac_ct_FILECMD -if test -n "$ac_ct_FILECMD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FILECMD" >&5 -printf "%s\n" "$ac_ct_FILECMD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_FILECMD" = x; then - FILECMD=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - FILECMD=$ac_ct_FILECMD - fi -else - FILECMD="$ac_cv_prog_FILECMD" -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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -7310,7 +7169,7 @@ beos*) 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='$FILECMD -L' + lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; @@ -7344,14 +7203,14 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | dragonfly* | midnightbsd*) +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=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac @@ -7365,7 +7224,7 @@ haiku*) ;; hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=$FILECMD + 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' @@ -7412,7 +7271,7 @@ netbsd*) newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; @@ -7785,29 +7644,13 @@ esac fi : ${AR=ar} +: ${AR_FLAGS=cru} -# Use ARFLAGS variable as AR's operation code to sync the variable naming with -# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have -# higher priority because thats what people were doing historically (setting -# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS -# variable obsoleted/removed. - -test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} -lt_ar_flags=$AR_FLAGS - - - - - - -# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override -# by AR_FLAGS because that was never working and AR_FLAGS is about to die. - @@ -8224,7 +8067,7 @@ 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'" + 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'" @@ -8242,20 +8085,20 @@ 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_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_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_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'"\ @@ -8279,7 +8122,7 @@ for ac_symprfx in "" "_"; do 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++ or ICC, + # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ @@ -8297,9 +8140,9 @@ for ac_symprfx in "" "_"; do " 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'" + 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'" + 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 @@ -8502,7 +8345,7 @@ case $with_sysroot in #( fi ;; #( /*) - lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( @@ -8627,7 +8470,7 @@ ia64-*-hpux*) ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; @@ -8648,7 +8491,7 @@ ia64-*-hpux*) printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; @@ -8660,7 +8503,7 @@ ia64-*-hpux*) ;; esac else - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; @@ -8686,7 +8529,7 @@ mips64*-*linux*) printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; @@ -8694,7 +8537,7 @@ mips64*-*linux*) emul="${emul}64" ;; esac - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; @@ -8702,7 +8545,7 @@ mips64*-*linux*) emul="${emul}ltsmip" ;; esac - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; @@ -8726,14 +8569,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `$FILECMD conftest.o` in + 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 `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; @@ -8841,7 +8684,7 @@ printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - case `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) @@ -9624,8 +9467,8 @@ 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 $AR_FLAGS libconftest.a conftest.o" >&5 - $AR $AR_FLAGS libconftest.a conftest.o 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 @@ -9652,12 +9495,17 @@ printf "%s\n" "$lt_cv_ld_force_load" >&6; } _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) - case $MACOSX_DEPLOYMENT_TARGET,$host in - 10.[012],*|,*powerpc*-darwin[5-8]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - *) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 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 @@ -9765,6 +9613,36 @@ func_stripname_cnf () # Set options +# Check whether --enable-static was given. +if test ${enable_static+y} +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 $as_nop + enable_static=no +fi + + + + + + + @@ -10025,8 +9903,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC and -# ICC, which need '.lib'). +# 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 @@ -10538,7 +10416,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-qstaticlink' ;; *) - case `$CC -V 2>&1 | $SED 5q` in + 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' @@ -10961,15 +10839,15 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time + # 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++ or Intel C++ Compiler. + # 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++ or ICC) + # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) @@ -11021,7 +10899,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries whole_archive_flag_spec= fi supports_anon_versioning=no - case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + 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 ... @@ -11133,7 +11011,6 @@ _LT_EOF 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 - file_list_spec='@' ;; interix[3-9]*) @@ -11148,7 +11025,7 @@ _LT_EOF # 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' + 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) @@ -11191,7 +11068,7 @@ _LT_EOF compiler_needs_object=yes ;; esac - case `$CC -V 2>&1 | $SED 5q` in + 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 @@ -11203,7 +11080,7 @@ _LT_EOF 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~ + 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 @@ -11219,7 +11096,7 @@ _LT_EOF 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~ + 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 @@ -11351,7 +11228,7 @@ _LT_EOF 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 == "L") || (\$ 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' + 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 @@ -11622,12 +11499,12 @@ fi cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using - # Microsoft Visual C++ or Intel C++ Compiler. + # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl* | icl*) - # Native MSVC or ICC + cl*) + # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes @@ -11668,7 +11545,7 @@ fi fi' ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. @@ -11709,8 +11586,8 @@ fi 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" + 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 @@ -11744,7 +11621,7 @@ fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -11995,7 +11872,6 @@ printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } 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 - file_list_spec='@' ;; osf3*) @@ -12688,7 +12564,7 @@ cygwin* | mingw* | pw32* | cegcc*) 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' + 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" ;; @@ -12698,14 +12574,14 @@ cygwin* | mingw* | pw32* | cegcc*) ;; 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' + 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* | *,icl*) - # Native MSVC or ICC + *,cl*) + # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -12724,7 +12600,7 @@ cygwin* | mingw* | pw32* | cegcc*) 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|^ ||'` + 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 @@ -12761,7 +12637,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -12794,7 +12670,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly* | midnightbsd*) +freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -13947,41 +13823,30 @@ striplib= old_striplib= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 printf %s "checking whether stripping libraries is possible... " >&6; } -if test -z "$STRIP"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -else - if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +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" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - else - case $host_os in - darwin*) - # FIXME - insert some real tests, host_os isn't really good enough +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" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - ;; - freebsd*) - if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fi - ;; - *) + else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - ;; - esac - fi + fi + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; + esac fi @@ -14751,8 +14616,8 @@ fi cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl* | ,icl* | no,icl*) - # Native MSVC or ICC + ,cl* | no,cl*) + # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' @@ -14843,11 +14708,11 @@ fi output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds_CXX="$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_CXX="$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" + archive_expsym_cmds_CXX="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_CXX="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" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$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" - archive_expsym_cmds_CXX="$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" + archive_expsym_cmds_CXX="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 @@ -14882,7 +14747,6 @@ fi emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes - file_list_spec_CXX='@' ;; dgux*) @@ -14913,7 +14777,7 @@ fi archive_cmds_need_lc_CXX=no ;; - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes @@ -15050,7 +14914,7 @@ fi # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$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_CXX='$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' + archive_expsym_cmds_CXX='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 @@ -15190,13 +15054,13 @@ fi archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $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 + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' @@ -15853,7 +15717,7 @@ lt_prog_compiler_static_CXX= ;; esac ;; - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -15936,7 +15800,7 @@ lt_prog_compiler_static_CXX= lt_prog_compiler_static_CXX='-qstaticlink' ;; *) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' @@ -16323,7 +16187,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$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_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 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' + export_symbols_cmds_CXX='`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*) @@ -16331,7 +16195,7 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries ;; cygwin* | mingw* | cegcc*) case $cc_basename in - cl* | icl*) + cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) @@ -16679,7 +16543,7 @@ cygwin* | mingw* | pw32* | cegcc*) 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' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) @@ -16688,14 +16552,14 @@ cygwin* | mingw* | pw32* | cegcc*) ;; 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' + 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* | *,icl*) - # Native MSVC or ICC + *,cl*) + # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -16714,7 +16578,7 @@ cygwin* | mingw* | pw32* | cegcc*) 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|^ ||'` + 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 @@ -16751,7 +16615,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -16783,7 +16647,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly* | midnightbsd*) +freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -18771,7 +18635,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libHX $as_me 4.14, which was +This file was extended by libHX $as_me 4.17, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18839,7 +18703,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -libHX config.status 4.14 +libHX config.status 4.17 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" @@ -18968,9 +18832,9 @@ AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $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"`' @@ -19002,7 +18866,6 @@ lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_q 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"`' -FILECMD='`$ECHO "$FILECMD" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $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"`' @@ -19011,7 +18874,6 @@ want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $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"`' -lt_ar_flags='`$ECHO "$lt_ar_flags" | $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"`' @@ -19186,7 +19048,6 @@ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ -FILECMD \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ @@ -19195,6 +19056,7 @@ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ +AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ @@ -20100,13 +19962,13 @@ available_tags='CXX ' # ### BEGIN LIBTOOL CONFIG -# Whether or not to build static libraries. -build_old_libs=$enable_static - # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision +# Whether or not to build static libraries. +build_old_libs=$enable_static + # Whether or not to build shared libraries. build_libtool_libs=$enable_shared @@ -20183,9 +20045,6 @@ 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 -# A file(cmd) program that detects file types. -FILECMD=$lt_FILECMD - # An object symbol dumper. OBJDUMP=$lt_OBJDUMP @@ -20210,11 +20069,8 @@ sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR -# Flags to create an archive (by configure). -lt_ar_flags=$lt_ar_flags - # Flags to create an archive. -AR_FLAGS=\${ARFLAGS-"\$lt_ar_flags"} +AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec @@ -20604,7 +20460,7 @@ ltmain=$ac_aux_dir/ltmain.sh # 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" \ + sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || diff --git a/configure.ac b/configure.ac index 92c72c7..bb658ea 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libHX], [4.14]) +AC_INIT([libHX], [4.17]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) @@ -10,8 +10,7 @@ AM_PROG_CC_C_O AC_PROG_CXX m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -AC_DISABLE_STATIC -AM_PROG_LIBTOOL +LT_INIT([disable-static]) saved_CXXFLAGS="$CXXFLAGS" regular_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_REENTRANT" diff --git a/doc/api.rst b/doc/api.rst index 5a3efe5..a645fdd 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -9,6 +9,9 @@ Function reference ====== ====== ====== ======================================== RMV MinVer FirstA Name ====== ====== ====== ======================================== +4.16 4.16 4.16 HX_strtoull_nsec +4.15 4.15 4.15 HX_flpr +4.15 4.15 4.15 HX_flprf 4.11 4.11 4.11 HX_addrport_split 4.11 4.11 4.11 HX_inet_connect 4.11 4.11 4.11 HX_inet_listen diff --git a/doc/changelog.rst b/doc/changelog.rst index 26c4d06..2e0cf0f 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,9 +1,39 @@ +v4.17 (2023-11-12) +================== + +Changes: + +* socket: set SOCK_CLOEXEC on all sockets + + +v4.16 (2023-11-02) +================== + +Enhancements: + +* Add ``HX_strtoull_nsec`` to parse time period and emit nanoseconds +* doc: specify return value and semantics for ``HXio_fullread``, + ``HXio_fullwrite``, ``HX_sendfile`` + + +v4.15 (2023-09-24) +================== + +Enhancements: + +* Add functions to compute Least Positive Residue (``HX_flpr``, ``HX_flprf``) + +Fixes: + +* Make ``HX_strrtrim`` work on strings longer than ``INT_MAX`` + + v4.14 (2023-07-14) ================== Fixes: -* socket: make HX_addrport_split work on portless bracketed hostspec +* socket: make ``HX_addrport_split`` work on portless bracketed hostspec v4.13 (2023-06-21) @@ -11,8 +41,8 @@ v4.13 (2023-06-21) Fixes: -* io: do not fail HX_mkdir when a component is a symlink to a directory -* xml_helper: fix infinite recursion in xml_getnsprop +* io: do not fail ``HX_mkdir`` when a component is a symlink to a directory +* xml_helper: fix infinite recursion in ``xml_getnsprop`` v4.12 (2023-02-27) @@ -20,7 +50,7 @@ v4.12 (2023-02-27) Fixes: -* Plug a memory leak in HX_inet_listen +* Plug a memory leak in ``HX_inet_listen`` v4.11 (2023-02-26) @@ -28,8 +58,8 @@ v4.11 (2023-02-26) Enhancements: -* socket: add HX_addrport_split, HX_inet_connect, HX_inet_listen, - HX_local_listen +* socket: add ``HX_addrport_split``, ``HX_inet_connect``, ``HX_inet_listen``, + ``HX_local_listen`` v4.10 (2023-01-29) @@ -37,7 +67,7 @@ v4.10 (2023-01-29) Fixes: -* format: plug a memory leak relating to func_entry_clone +* format: plug a memory leak relating to ``func_entry_clone`` * Resolve mingw build failure @@ -46,13 +76,14 @@ v4.9 (2023-01-23) Enhancements: -* socket: add sockaddr_is_local, ipaddr_is_local functions +* socket: add ``sockaddr_is_local``, ``ipaddr_is_local`` functions Fixes: -* format: avoid return value truncation from HXformat_aprintf, HXformat_sprintf -* format: avoid calling HXmc_length on a non-hxmc object -* format: add new variations of printf functions returning ssize_t +* format: avoid return value truncation from ``HXformat_aprintf``, + ``HXformat_sprintf`` +* format: avoid calling ``HXmc_length`` on a non-hxmc object +* format: add new variations of printf functions returning ``ssize_t`` * Resolve Coverity-SCAN reports @@ -61,7 +92,7 @@ v4.8 (2022-12-03) Enhancements: -* io: call posix_fadvise when slurping files +* io: call ``posix_fadvise`` when slurping files Fixes: @@ -73,11 +104,11 @@ v4.7 (2022-10-21) Enhancements: -* string: new quoting modes HXQUOTE_BASE64URL & HXQUOTE_BASE64IMAP +* string: new quoting modes ``HXQUOTE_BASE64URL`` & ``HXQUOTE_BASE64IMAP`` Fixes: -* socket: make HX_socket_from_env functional on OpenBSD +* socket: make ``HX_socket_from_env`` functional on OpenBSD v4.6 (2022-06-27) @@ -85,8 +116,8 @@ v4.6 (2022-06-27) Enhancements: -* HX_slurp_fd/HX_slurp_file now supports reading from files reporting their - own size as 0 (e.g. ttys, /proc special files). +* ``HX_slurp_fd``/``HX_slurp_file`` now supports reading from files reporting + their own size as 0 (e.g. ttys, ``/proc`` special files). v4.5 (2022-04-10) @@ -132,8 +163,8 @@ v4.1 (2021-10-13) Fixes: -* io: fix a use-after-free in conjunction with HX_realpath / - fix missing NULLing of a pointer within HX_readlink +* io: fix a use-after-free in conjunction with ``HX_realpath`` / + fix missing NULLing of a pointer within ``HX_readlink`` v4.0 (2021-10-03) diff --git a/doc/files_and_dirs.rst b/doc/files_and_dirs.rst index a4fdc59..a18b5a4 100644 --- a/doc/files_and_dirs.rst +++ b/doc/files_and_dirs.rst @@ -180,11 +180,44 @@ Filedescriptor helpers ssize_t HXio_fullwrite(int fd, const void *buf, size_t size, unsigned int flags); ssize_t HX_sendfile(int dst, int src, size_t count); -Since plain ``read``(2) and ``write``(2) may process only part of the buffer — -even more likely so with sockets —, libHX provides two functions that calls -these in a loop to retry said operations until the full amount has been -processed. Since read and write can also be used with socket file descriptors, -so can these. +``HXio_fullread`` calls ``read``(2) in a loop so long as to completely read +``size`` bytes, and thereby masking short read behavior that the *read* system +call is allowed to exhibit. On success, the return value indicates the number +of bytes read, which may be shorter than ``size`` if EOF was encountered. On +error, the return value is negative (but no particular one value). + +``HXio_fullwrite`` calls ``write``(2) in a loop so long as to completely write +``size`` bytes, and thereby masking short write behavior that the *write* +system call is allowed to exhibit. On success, the return value is the same as +``size``, as there is never an EOF condition for writes. On error, the return +value is negative. + +There is no way with just HXio_fullwrite to know the number of bytes that were +read up to the point that the error occurred. This was a subconscious design +choice in 2010. The reasoning (as of 2023) goes: If the file descriptor is not +seekable, like a socket or pipe, what are you going to do anyway but abort? You +cannot recall the data that was sent, the peer already knows how much was sent +thanks to their socket interface. The peer also either caused the abort itself +(e.g. by closing the read end of a pipe), or is made aware of connection +severing (will see EOF). If the file descriptor is seekable, there is no "peer" +and one can ``lseek`` back and retract the data. + +The HXio_fullread API mirrors that of HXio_fullwrite for API consistency. Input +is often discarded and an error shown instead. However, we acknowledge there +might be a legitimate case (e.g. wanting to render an incoming image even if +incomplete), but in this case, HXio_fullread is not for you. ``HX_sendfile`` wraps ``sendfile``(2) for the same reason; in addition, it falls back to a read-write loop on platforms which do not offer sendfile. +``HX_sendfile`` will transfer at most ``SSIZE_MAX`` bytes in one call. A user +wishing to emit somewhat more (e.g. still less than ``SIZE_MAX``) will have to +write a loop around HXio_sendfile, just like for sendfile. On success, the +return value is the request number of bytes. On error, the return value may be +a negative errno (``errno`` is set too), or it may be the number of bytes from +a partially-completed send. + + .. code-block:: c + + ssize_t ret = HX_sendfile(dst, src, count); + if (ret < 0 || (ssize_t)ret < count) + fprintf(stderr, "sendfile: %s\n", strerror(errno)); diff --git a/doc/misc_functions.rst b/doc/misc_functions.rst index 43dacfe..c988f37 100644 --- a/doc/misc_functions.rst +++ b/doc/misc_functions.rst @@ -8,6 +8,8 @@ Miscellaneous functions int HX_ffs(unsigned long z); int HX_fls(unsigned long z); + float HX_flprf(float x, float y); + double HX_flpr(double x, double y); void HX_zvecfree(char **); unsigned int HX_zveclen(const char *const *); @@ -20,6 +22,9 @@ Miscellaneous functions Finds the last (most-significant) bit in a value and returns its position, or ``-1`` to indicate failure. +``HX_flpr``, ``HX_flprf`` + Computes the Least Positive Residue of the modulo operation x % y. + ``HX_zvecfree`` Frees the supplied Z-vector array. (Frees all array elements from the first element to (excluding) the first ``NULL`` element.) diff --git a/doc/process_management.rst b/doc/process_management.rst index 8fe282b..d999608 100644 --- a/doc/process_management.rst +++ b/doc/process_management.rst @@ -202,7 +202,17 @@ User identity control #include <libHX/proc.h> - int HXproc_switch_user(const char *user, const char *group); + enum HXproc_su_status { + HXPROC_INITGROUPS_FAILED = -5, + HXPROC_SETGID_FAILED = -4, + HXPROC_SETUID_FAILED = -3, + HXPROC_GROUP_NOT_FOUND = -2, + HXPROC_USER_NOT_FOUND = -1, + HXPROC_SU_NOOP = 0, + HXPROC_SU_SUCCESS = 1, + }; + + enum HXproc_su_status HXproc_switch_user(const char *user, const char *group); ``HXproc_switch_user`` is a wrapper for changing process identity to an unprivileged user. This utilizes ``setuid``, and possibly ``setgid`` plus @@ -217,6 +227,9 @@ process group(s) will change to the the user's group(s) — both primary and secondary — provided a user was specified (see above). When ``gruop`` is the empty string, no change of process group identity occurs. +The return value is an enum indicating failure with values <0, and success with +>=0. + Process information =================== diff --git a/doc/socket_functions.rst b/doc/socket_functions.rst index 5d55cf8..fef6e7c 100644 --- a/doc/socket_functions.rst +++ b/doc/socket_functions.rst @@ -31,27 +31,31 @@ Socket functions system defaults. (It may choose whatever protocol is offered by the system.) ``oflags`` is a bitset which may contain ``O_NONBLOCK``, else must be 0. Upon success, a socket file descriptor is returned. Upon - failure, a negative errno code is returned. + failure, a negative errno code is returned. The socket will have + ``SOCK_CLOEXEC`` set by default if the platform supports it. ``HX_inet_listen`` The function first resolves ``host`` using ``getaddrinfo()` with ``AI_PASSIVE``, then using ``HX_socket_from_env`` looks in the environment for a matching socket to pick up, and otherwise uses the first result from getaddrinfo to create a new socket. Upon error, a - negative errno value is returned. + negative errno value is returned. The socket will have ``SOCK_CLOEXEC`` + set by default if the platform supports it. ``HX_local_listen`` The function creates a local system-specific socket. Using ``HX_socket_from_env``, it will attempt to pick up a matching socket from the environment, and otherwise create a new socket. Upon error, a - negative errno value is returned. + negative errno value is returned. The socket will have ``SOCK_CLOEXEC`` + set by default if the platform supports it. ``HX_socket_from_env`` The function looks up the current process's file descriptors for a socket that is listening and which matches the given addrinfo and (optionally) intf if the latter is not NULL``. Upon success, the fd number is returned, or -1 if no file descriptor matched. No errors are - signalled. + signalled. Before this function returns a file descriptor, it sets + ``SOCK_CLOEXEC``. ``HX_sockaddr_is_local`` Attempts to determine if the given socket address refers to a local diff --git a/doc/string_ops.rst b/doc/string_ops.rst index 9bb711f..d818d2d 100644 --- a/doc/string_ops.rst +++ b/doc/string_ops.rst @@ -456,17 +456,20 @@ Conversion from/to human-readable durations with units #include <libHX/string.h> unsigned long long HX_strtoull_sec(const char *s, char **end); + unsigned long long HX_strtoull_nsec(const char *s, char **end); char *HX_unit_seconds(char *out, size_t outsize, unsigned long long seconds, unsigned int flags); -``HX_strtoull_sec`` converts a time duration with units, such as ``"15min30s"`` -into an all-seconds value. The recognized unit strings are: ``years``, -``year``, ``y``, ``months``, ``month``, ``days``, ``day``, ``d``, ``hours``, -``hour``, ``h``, ``minutes``, ``minute``, ``min``, ``seconds``, ``second``, -``s`` and the empty string (for seconds). When parsing stops at any point, -``*end`` is set to the location, similar to how the ``strtoull`` C function -would. +``HX_strtoull_sec`` and ``HX_strtoull_nsec`` convert a time duration with +units, such as ``"15min30s"`` into an all-seconds and all-nanoseconds value, +respectively. The recognized unit strings are: ``years``, ``year``, ``y``, +``months``, ``month``, ``days``, ``day``, ``d``, ``hours``, ``hour``, ``h``, +``minutes``, ``minute``, ``min``, ``seconds``, ``second``, ``s``, the empty +string (to mean seconds), ``msec``, ``ms``, ``µsec``, ``µs``, ``nsec`` and +``ns``. Negative durations are not supported. Support for fractions is +implementation-defined. When parsing stops at any point, ``*end`` is set to the +location, similar to how the ``strtoull`` C function would. One year is defined to be 365.25 days of 86400 seconds; one month is defined to be 1/12 such a year. This is consistent with the units employed by systemd. diff --git a/include/Makefile.in b/include/Makefile.in index 525f047..40582cf 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -202,7 +202,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff --git a/include/libHX/misc.h b/include/libHX/misc.h index 23607d2..1d49c7f 100644 --- a/include/libHX/misc.h +++ b/include/libHX/misc.h @@ -59,6 +59,8 @@ extern const char *HX_dlerror(void); */ extern int HX_ffs(unsigned long); extern int HX_fls(unsigned long); +extern float HX_flprf(float, float); +extern double HX_flpr(double, double); #ifndef HX_HEXDUMP_DECLARATION #define HX_HEXDUMP_DECLARATION 1 extern void HX_hexdump(FILE *, const void *, unsigned int); diff --git a/include/libHX/string.h b/include/libHX/string.h index 9e78cd0..4da3619 100644 --- a/include/libHX/string.h +++ b/include/libHX/string.h @@ -103,6 +103,7 @@ extern unsigned long long HX_strtoull_unit(const char *, char **, unsigned int e extern char *HX_unit_size(char *out, size_t bufsize, unsigned long long size, unsigned int divisor, unsigned int cutoff); extern char *HX_unit_size_cu(char *out, size_t bufsize, unsigned long long size, unsigned int divisor); extern unsigned long long HX_strtoull_sec(const char *s, char **); +extern unsigned long long HX_strtoull_nsec(const char *s, char **); extern char *HX_unit_seconds(char *out, size_t bufsize, unsigned long long seconds, unsigned int flags); static __inline__ void *HX_memdup(const void *buf, size_t len) diff --git a/libHX.pc.in b/libHX.pc.in index 989adc3..1aca480 100644 --- a/libHX.pc.in +++ b/libHX.pc.in @@ -9,4 +9,4 @@ Description: Useful collection of routines for C and C++ programming Version: @PACKAGE_VERSION@ Cflags: -I${includedir} Libs: -L${libdir} -lHX -Libs.private: @libdl_LIBS@ @libpthread_LIBS@ @librt_LIBS@ +Libs.private: @libdl_LIBS@ @libpthread_LIBS@ @librt_LIBS@ @libsocket_LIBS@ diff --git a/m4/.gitignore b/m4/.gitignore deleted file mode 100644 index 64d9bbc..0000000 --- a/m4/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/libtool.m4 -/lt*.m4 diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 717e769..4e87d34 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1,7 +1,6 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # -# Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software -# Foundation, Inc. +# 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 @@ -32,7 +31,7 @@ m4_define([_LT_COPYING], [dnl # along with this program. If not, see <http://www.gnu.org/licenses/>. ]) -# serial 59 LT_INIT +# serial 58 LT_INIT # LT_PREREQ(VERSION) @@ -182,7 +181,6 @@ 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_DECL_FILECMD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl @@ -221,8 +219,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC and -# ICC, which need '.lib'). +# 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 @@ -779,7 +777,7 @@ _LT_EOF # 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" \ + sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || @@ -1043,8 +1041,8 @@ 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 $AR_FLAGS libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR $AR_FLAGS libconftest.a conftest.o 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 @@ -1068,12 +1066,17 @@ _LT_EOF _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) - case $MACOSX_DEPLOYMENT_TARGET,$host in - 10.[[012]],*|,*powerpc*-darwin[[5-8]]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - *) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 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 @@ -1122,12 +1125,12 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], 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" + _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" + _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 @@ -1241,8 +1244,7 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], -[m4_require([_LT_DECL_SED])dnl -AC_MSG_CHECKING([for 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 @@ -1259,7 +1261,7 @@ case $with_sysroot in #( fi ;; #( /*) - lt_sysroot=`echo "$with_sysroot" | $SED -e "$sed_quote_subst"` + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( @@ -1289,7 +1291,7 @@ ia64-*-hpux*) # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; @@ -1306,7 +1308,7 @@ ia64-*-hpux*) echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; @@ -1318,7 +1320,7 @@ ia64-*-hpux*) ;; esac else - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; @@ -1340,7 +1342,7 @@ mips64*-*linux*) echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; @@ -1348,7 +1350,7 @@ mips64*-*linux*) emul="${emul}64" ;; esac - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; @@ -1356,7 +1358,7 @@ mips64*-*linux*) emul="${emul}ltsmip" ;; esac - case `$FILECMD conftest.$ac_objext` in + case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; @@ -1376,14 +1378,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `$FILECMD conftest.o` in + 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 `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; @@ -1451,7 +1453,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - case `$FILECMD conftest.o` in + case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) @@ -1490,22 +1492,9 @@ need_locks=$enable_libtool_lock m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} +: ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) - -# Use ARFLAGS variable as AR's operation code to sync the variable naming with -# Automake. If both AR_FLAGS and ARFLAGS are specified, AR_FLAGS should have -# higher priority because thats what people were doing historically (setting -# ARFLAGS for automake and AR_FLAGS for libtool). FIXME: Make the AR_FLAGS -# variable obsoleted/removed. - -test ${AR_FLAGS+y} || AR_FLAGS=${ARFLAGS-cr} -lt_ar_flags=$AR_FLAGS -_LT_DECL([], [lt_ar_flags], [0], [Flags to create an archive (by configure)]) - -# Make AR_FLAGS overridable by 'make ARFLAGS='. Don't try to run-time override -# by AR_FLAGS because that was never working and AR_FLAGS is about to die. -_LT_DECL([], [AR_FLAGS], [\@S|@{ARFLAGS-"\@S|@lt_ar_flags"}], - [Flags to create an archive]) +_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 @@ -1724,7 +1713,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; - bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + 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` @@ -1767,7 +1756,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl 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/.*[[ ]]//'` + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi @@ -2217,35 +2206,26 @@ m4_defun([_LT_CMD_STRIPLIB], striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -z "$STRIP"; then - AC_MSG_RESULT([no]) +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 - if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) - else - case $host_os in - darwin*) - # FIXME - insert some real tests, host_os isn't really good enough +# 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]) - ;; - freebsd*) - if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then - old_striplib="$STRIP --strip-debug" - striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) + else AC_MSG_RESULT([no]) - ;; - esac - fi + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) @@ -2568,7 +2548,7 @@ cygwin* | mingw* | pw32* | cegcc*) 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' + 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"]) ;; @@ -2578,14 +2558,14 @@ m4_if([$1], [],[ ;; 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' + 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* | *,icl*) - # Native MSVC or ICC + *,cl*) + # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' @@ -2604,7 +2584,7 @@ m4_if([$1], [],[ 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|^ ||'` + 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 @@ -2641,7 +2621,7 @@ m4_if([$1], [],[ ;; *) - # Assume MSVC and ICC wrapper + # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -2674,7 +2654,7 @@ dgux*) shlibpath_var=LD_LIBRARY_PATH ;; -freebsd* | dragonfly* | midnightbsd*) +freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then @@ -3473,7 +3453,7 @@ beos*) 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='$FILECMD -L' + lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; @@ -3507,14 +3487,14 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | dragonfly* | midnightbsd*) +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=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac @@ -3528,7 +3508,7 @@ haiku*) ;; hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=$FILECMD + 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' @@ -3575,7 +3555,7 @@ netbsd*) newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=$FILECMD + lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; @@ -3702,13 +3682,13 @@ else 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 + 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 + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 @@ -3734,7 +3714,7 @@ else # 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 + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; @@ -3974,7 +3954,7 @@ 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'" + 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'" @@ -3992,20 +3972,20 @@ 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_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_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_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'"\ @@ -4029,7 +4009,7 @@ for ac_symprfx in "" "_"; do 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++ or ICC, + # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ @@ -4047,9 +4027,9 @@ for ac_symprfx in "" "_"; do " 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'" + 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'" + 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 @@ -4336,7 +4316,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -4419,7 +4399,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) - case `$CC -V 2>&1 | $SED 5q` in + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' @@ -4755,7 +4735,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) - case `$CC -V 2>&1 | $SED 5q` in + 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' @@ -4938,7 +4918,7 @@ m4_if([$1], [CXX], [ 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 == "L") || (\$ 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' + _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*) @@ -4946,7 +4926,7 @@ m4_if([$1], [CXX], [ ;; cygwin* | mingw* | cegcc*) case $cc_basename in - cl* | icl*) + cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) @@ -5003,15 +4983,15 @@ dnl Note also adjust exclude_expsyms for C++ above. case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time + # 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++ or Intel C++ Compiler. + # 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++ or ICC) + # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) @@ -5063,7 +5043,7 @@ dnl Note also adjust exclude_expsyms for C++ above. _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no - case `$LD -v | $SED -e 's/([[^)]]\+)\s\+//' 2>&1` in + 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 ... @@ -5175,7 +5155,6 @@ _LT_EOF 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 - _LT_TAGVAR(file_list_spec, $1)='@' ;; interix[[3-9]]*) @@ -5190,7 +5169,7 @@ _LT_EOF # 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' + _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) @@ -5233,7 +5212,7 @@ _LT_EOF _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac - case `$CC -V 2>&1 | $SED 5q` in + 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 @@ -5245,7 +5224,7 @@ _LT_EOF 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~ + 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 @@ -5261,7 +5240,7 @@ _LT_EOF _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~ + 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 @@ -5393,7 +5372,7 @@ _LT_EOF 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 == "L") || (\$ 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' + _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 @@ -5576,12 +5555,12 @@ _LT_EOF cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using - # Microsoft Visual C++ or Intel C++ Compiler. + # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl* | icl*) - # Native MSVC or ICC + cl*) + # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes @@ -5622,7 +5601,7 @@ _LT_EOF fi' ;; *) - # Assume MSVC and ICC wrapper + # 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. @@ -5670,7 +5649,7 @@ _LT_EOF ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly* | midnightbsd*) + 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 @@ -5881,7 +5860,6 @@ _LT_EOF 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 - _LT_TAGVAR(file_list_spec, $1)='@' ;; osf3*) @@ -6652,8 +6630,8 @@ if test yes != "$_lt_caught_CXX_error"; then cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl* | ,icl* | no,icl*) - # Native MSVC or ICC + ,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)=' ' @@ -6751,7 +6729,6 @@ if test yes != "$_lt_caught_CXX_error"; then 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 - _LT_TAGVAR(file_list_spec, $1)='@' ;; dgux*) @@ -6782,7 +6759,7 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; - freebsd* | dragonfly* | midnightbsd*) + freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes @@ -6919,7 +6896,7 @@ if test yes != "$_lt_caught_CXX_error"; then # 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' + _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 @@ -7059,13 +7036,13 @@ if test yes != "$_lt_caught_CXX_error"; then _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~ + 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 + case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' @@ -8211,14 +8188,6 @@ _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) -# _LT_DECL_FILECMD -# ---------------- -# Check for a file(cmd) program that can be used to detect file type and magic -m4_defun([_LT_DECL_FILECMD], -[AC_CHECK_TOOL([FILECMD], [file], [:]) -_LT_DECL([], [FILECMD], [1], [A file(cmd) program that detects file types]) -])# _LD_DECL_FILECMD - # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 index b0b5e9c..94b0829 100644 --- a/m4/ltoptions.m4 +++ b/m4/ltoptions.m4 @@ -1,7 +1,7 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free -# Software Foundation, Inc. +# 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 diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 index 902508b..48bc934 100644 --- a/m4/ltsugar.m4 +++ b/m4/ltsugar.m4 @@ -1,6 +1,6 @@ # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 index b155d0a..fa04b52 100644 --- a/m4/ltversion.m4 +++ b/m4/ltversion.m4 @@ -1,7 +1,6 @@ # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, -# Inc. +# 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 @@ -10,15 +9,15 @@ # @configure_input@ -# serial 4245 ltversion.m4 +# serial 4179 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.4.7]) -m4_define([LT_PACKAGE_REVISION], [2.4.7]) +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.7' -macro_revision='2.4.7' +[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 index 0f7a875..c6b26f8 100644 --- a/m4/lt~obsolete.m4 +++ b/m4/lt~obsolete.m4 @@ -1,7 +1,7 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free -# Software Foundation, Inc. +# 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 @@ -1,12 +0,0 @@ -#!/bin/sh -topdir="${0%/*}" -if [ "$topdir" = "$0" ]; then - topdir=. -fi -abstopdir=$(readlink -f "$topdir") -if [ ! -e "${topdir}/configure" ]; then - cd "$topdir" - autoreconf -fi - cd - -fi -exec "$topdir/configure" CFLAGS="-O0 -ggdb3" CXXFLAGS="-O0 -ggdb3" "$@" diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 89edb97..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -/hxdirstamp -/t?-cast -/t?-compile -/t?-deque -/t?-dir -/t?-format -/t?-intdiff -/t?-io -/t?-link -/t?-list -/t?-list2 -/t?-map -/t?-memmem -/t?-misc -/t?-netio -/t?-option -/t?-other -/t?-proc -/t?-rand -/t?-realpath -/t?-shconfig -/t?-socket -/t?-strchr2 -/t?-string -/t?-strquote -/t?-switchuser -/t?-time - -# automake tests -*.log -*.trs diff --git a/src/Makefile.am b/src/Makefile.am index f7ff4f6..ac68f74 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,8 +12,8 @@ endif libHX_la_SOURCES = deque.c dl.c format.c io.c map.c \ mc.c misc.c opt.c proc.c \ rand.c socket.c string.c time.c -libHX_la_LIBADD = ${libdl_LIBS} -lm ${libpthread_LIBS} ${librt_LIBS} -libHX_la_LDFLAGS = -no-undefined -version-info 37:0:5 +libHX_la_LIBADD = ${libdl_LIBS} -lm ${libpthread_LIBS} ${librt_LIBS} ${libsocket_LIBS} +libHX_la_LDFLAGS = -no-undefined -version-info 38:0:6 if WITH_GNU_LD libHX_la_LDFLAGS += -Wl,--version-script=${srcdir}/libHX.map endif diff --git a/src/Makefile.in b/src/Makefile.in index 43f7444..d349749 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -165,7 +165,8 @@ am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libHX_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) am__libHX_la_SOURCES_DIST = deque.c dl.c format.c io.c map.c mc.c \ misc.c opt.c proc.c rand.c socket.c string.c time.c ux-file.c \ ux-mmap.c @@ -671,7 +672,6 @@ EGREP = @EGREP@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FILECMD = @FILECMD@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -779,8 +779,8 @@ lib_LTLIBRARIES = libHX.la $(am__append_1) libHX_la_SOURCES = deque.c dl.c format.c io.c map.c mc.c misc.c opt.c \ proc.c rand.c socket.c string.c time.c $(am__append_3) libHX_la_LIBADD = ${libdl_LIBS} -lm ${libpthread_LIBS} ${librt_LIBS} \ - $(am__append_4) -libHX_la_LDFLAGS = -no-undefined -version-info 37:0:5 $(am__append_2) + ${libsocket_LIBS} $(am__append_4) +libHX_la_LDFLAGS = -no-undefined -version-info 38:0:6 $(am__append_2) EXTRA_libHX_la_DEPENDENCIES = libHX.map libHX_rtcheck_la_SOURCES = rtcheck.c libHX_rtcheck_la_LIBADD = ${libdl_LIBS} @@ -655,7 +655,7 @@ static ssize_t HX_sendfile_rw(int dst, int src, size_t count) { static const size_t bufsize = 0x10000; size_t xferd = 0; - ssize_t ret; + ssize_t ret = 0; void *buf = malloc(bufsize); if (buf == nullptr) return -ENOMEM; @@ -665,16 +665,13 @@ static ssize_t HX_sendfile_rw(int dst, int src, size_t count) size_t readsize = bufsize; if (count < readsize) readsize = count; + /* Return value of fullread/write is same as read/write(2). */ ret = HXio_fullread(src, buf, readsize); - if (ret < 0) { - errno = -ret; + if (ret < 0) break; - } ret = HXio_fullwrite(dst, buf, ret); - if (ret < 0) { - errno = -ret; + if (ret < 0) break; - } xferd += ret; count -= ret; } diff --git a/src/libHX.map b/src/libHX.map index 33415fa..37bfe0f 100644 --- a/src/libHX.map +++ b/src/libHX.map @@ -167,3 +167,14 @@ global: HX_inet_listen; HX_local_listen; } LIBHX_4.9; + +LIBHX_4.15 { +global: + HX_flpr; + HX_flprf; +} LIBHX_4.11; + +LIBHX_4.16 { +global: + HX_strtoull_nsec; +} LIBHX_4.15; @@ -7,6 +7,7 @@ * General Public License as published by the Free Software Foundation; * either version 2.1 or (at your option) any later version. */ +#include <math.h> /* fmod */ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -88,3 +89,19 @@ EXPORT_SYMBOL void HX_zvecfree(char **args) free(*travp); free(args); } + +EXPORT_SYMBOL float HX_flprf(float x, float y) +{ + float r = fmodf(x, y); + if (r < 0) + r += y; + return r; +} + +EXPORT_SYMBOL double HX_flpr(double x, double y) +{ + double r = fmod(x, y); + if (r < 0) + r += y; + return r; +} diff --git a/src/socket.c b/src/socket.c index 0b6f674..e2ad9ed 100644 --- a/src/socket.c +++ b/src/socket.c @@ -41,12 +41,17 @@ #else # define STUPIDWIN(x) (x) #endif -#if defined(__sunos__) && !defined(SO_PROTOCOL) +#if defined(__sun) && !defined(SO_PROTOCOL) # define SO_PROTOCOL SO_PROTOTYPE #endif #ifndef AI_V4MAPPED # define AI_V4MAPPED 0 #endif +#ifdef SOCK_CLOEXEC +# define PLATFORM_SKFLAGS SOCK_CLOEXEC +#else +# define PLATFORM_SKFLAGS 0 +#endif /** * Return the pointer to the singular colon character, any other input @@ -152,7 +157,8 @@ int HX_inet_connect(const char *host, uint16_t port, unsigned int oflags) if (ret != 0) ; for (const struct addrinfo *r = aires; r != nullptr; r = r->ai_next) { - int fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol); + int fd = socket(r->ai_family, r->ai_socktype | PLATFORM_SKFLAGS, + r->ai_protocol); if (fd < 0) { if (saved_errno == 0) saved_errno = errno; @@ -195,7 +201,8 @@ int HX_inet_connect(const char *host, uint16_t port, unsigned int oflags) static int HX_gai_listen(const struct addrinfo *r) { - int fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol); + int fd = socket(r->ai_family, r->ai_socktype | PLATFORM_SKFLAGS, + r->ai_protocol); if (fd < 0) return -2; static const int y = 1; @@ -282,7 +289,7 @@ int HX_local_listen(const char *path) if (!S_ISSOCK(sb.st_mode)) return -ENOTSOCK; - int testfd = socket(AF_LOCAL, SOCK_STREAM, 0); + int testfd = socket(AF_LOCAL, SOCK_STREAM | PLATFORM_SKFLAGS, 0); if (testfd < 0) return -errno; ret = connect(testfd, r.ai_addr, r.ai_addrlen); @@ -388,8 +395,12 @@ EXPORT_SYMBOL int HX_socket_from_env(const struct addrinfo *ai, const char *intf top_fd = x; } for (int fd = 3; fd < top_fd; ++fd) - if (try_sk_from_env(fd, ai, intf) == fd) + if (try_sk_from_env(fd, ai, intf) == fd) { +#ifdef SOCK_CLOEXEC + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC); +#endif return fd; + } errno = ENOENT; return -1; } @@ -415,7 +426,7 @@ static int linux_sockaddr_local3(int sk, const void *buf, size_t bufsize) static int linux_sockaddr_local2(const struct sockaddr *sa, socklen_t sl) { - int sk = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); + int sk = socket(AF_NETLINK, SOCK_DGRAM | PLATFORM_SKFLAGS, NETLINK_ROUTE); if (sk < 0) return -errno; struct { @@ -474,7 +485,7 @@ static int openbsd_sockaddr_local3(int rsk, const void *buf, size_t bufsize) static int openbsd_sockaddr_local2(const struct sockaddr *sa, socklen_t sl) { - int sk = socket(AF_ROUTE, SOCK_RAW, AF_UNSPEC); + int sk = socket(AF_ROUTE, SOCK_RAW | PLATFORM_SKFLAGS, AF_UNSPEC); if (sk < 0) return -errno; struct { diff --git a/src/string.c b/src/string.c index ae19271..4abd694 100644 --- a/src/string.c +++ b/src/string.c @@ -9,7 +9,7 @@ */ #include <errno.h> #include <limits.h> -#include <math.h> +#include <math.h> /* nextafter */ #include <stdbool.h> #include <stddef.h> #include <stdint.h> @@ -476,7 +476,7 @@ EXPORT_SYMBOL char *HX_strrev(char *s) EXPORT_SYMBOL size_t HX_strrtrim(char *expr) { - int i = strlen(expr), s = 0; + size_t i = strlen(expr), s = 0; while (i-- && HX_isspace(expr[i])) ++s; expr[++i] = '\0'; @@ -1037,55 +1037,63 @@ EXPORT_SYMBOL unsigned long long HX_strtoull_unit(const char *s, #define SECONDS_PER_YEAR 31557600 #define SECONDS_PER_MONTH 2629800 +#define NSEC_PER_SECOND 1000000000ULL static const struct { const char name[8]; unsigned int len; - uint32_t mult; + uint32_t s_mult; + uint64_t ns_mult; } time_multiplier[] = { - {"seconds", 7, 1}, - {"second", 6, 1}, - {"sec", 3, 1}, - {"s", 1, 1}, - {"minutes", 7, 60}, - {"minute", 6, 60}, - {"min", 3, 60}, - {"hours", 5, 3600}, - {"hour", 4, 3600}, - {"h", 1, 3600}, - {"days", 4, 86400}, - {"day", 3, 86400}, - {"d", 1, 86400}, - {"weeks", 5, 604800}, - {"week", 4, 604800}, - {"months", 6, SECONDS_PER_MONTH}, - {"month", 5, SECONDS_PER_MONTH}, - {"years", 5, SECONDS_PER_YEAR}, - {"year", 4, SECONDS_PER_YEAR}, - {"y", 1, SECONDS_PER_YEAR}, + {"seconds", 7, 1, 1 * NSEC_PER_SECOND}, + {"second", 6, 1, 1 * NSEC_PER_SECOND}, + {"sec", 3, 1, 1 * NSEC_PER_SECOND}, + {"s", 1, 1, 1 * NSEC_PER_SECOND}, + {"minutes", 7, 60, 60 * NSEC_PER_SECOND}, + {"minute", 6, 60, 60 * NSEC_PER_SECOND}, + {"min", 3, 60, 60 * NSEC_PER_SECOND}, + {"hours", 5, 3600, 3600 * NSEC_PER_SECOND}, + {"hour", 4, 3600, 3600 * NSEC_PER_SECOND}, + {"h", 1, 3600, 3600 * NSEC_PER_SECOND}, + {"days", 4, 86400, 86400 * NSEC_PER_SECOND}, + {"day", 3, 86400, 86400 * NSEC_PER_SECOND}, + {"d", 1, 86400, 86400 * NSEC_PER_SECOND}, + {"weeks", 5, 604800, 604800 * NSEC_PER_SECOND}, + {"week", 4, 604800, 604800 * NSEC_PER_SECOND}, + {"months", 6, SECONDS_PER_MONTH, SECONDS_PER_MONTH * NSEC_PER_SECOND}, + {"month", 5, SECONDS_PER_MONTH, SECONDS_PER_MONTH * NSEC_PER_SECOND}, + {"years", 5, SECONDS_PER_YEAR, SECONDS_PER_YEAR * NSEC_PER_SECOND}, + {"year", 4, SECONDS_PER_YEAR, SECONDS_PER_YEAR * NSEC_PER_SECOND}, + {"y", 1, SECONDS_PER_YEAR, SECONDS_PER_YEAR * NSEC_PER_SECOND}, + {"msec", 4, 0, 1000000}, + {"ms", 2, 0, 1000000}, + {"µsec", 5, 0, 1000}, + {"µs", 3, 0, 1000}, + {"nsec", 4, 0, 1}, + {"ns", 2, 0, 1}, + {"", 0, 1, NSEC_PER_SECOND}, }; -EXPORT_SYMBOL unsigned long long HX_strtoull_sec(const char *s, char **out_end) +static unsigned long long HX_strtoull_time(const char *s, char **out_end, bool nsec) { - unsigned long long seconds = 0; + unsigned long long quant = 0; while (*s != '\0') { while (HX_isspace(*s)) ++s; - if (*s == '-') { + if (*s == '-') break; - } char *end = nullptr; unsigned long long num = strtoull(s, &end, 10); + double frac = 0; + bool have_frac = *end == '.'; + if (have_frac) + frac = strtod(s, &end); if (end == s) break; s = end; while (HX_isspace(*s)) ++s; - if (!HX_isalpha(*s)) { - seconds += num; - continue; - } unsigned int i; for (i = 0; i < ARRAY_SIZE(time_multiplier); ++i) if (strncmp(s, time_multiplier[i].name, @@ -1094,12 +1102,26 @@ EXPORT_SYMBOL unsigned long long HX_strtoull_sec(const char *s, char **out_end) break; if (i == ARRAY_SIZE(time_multiplier)) break; - seconds += num * time_multiplier[i].mult; + unsigned long long mult = nsec ? time_multiplier[i].ns_mult : time_multiplier[i].s_mult; + if (have_frac) + quant += frac * mult; + else + quant += num * mult; s += time_multiplier[i].len; } if (out_end != nullptr) *out_end = const_cast(char *, s); - return seconds; + return quant; +} + +EXPORT_SYMBOL unsigned long long HX_strtoull_sec(const char *s, char **out_end) +{ + return HX_strtoull_time(s, out_end, false); +} + +EXPORT_SYMBOL unsigned long long HX_strtoull_nsec(const char *s, char **out_end) +{ + return HX_strtoull_time(s, out_end, true); } EXPORT_SYMBOL char *HX_unit_seconds(char *out, size_t outsize, diff --git a/src/tc-cast.c b/src/tc-cast.c index 2c58805..36bf8b0 100644 --- a/src/tc-cast.c +++ b/src/tc-cast.c @@ -77,7 +77,7 @@ static void c_constA(void) int main(void) { if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; c_signed(); c_reinterpret(); c_static(); @@ -86,5 +86,5 @@ int main(void) c_const3(); c_constA(); HX_exit(); - return 0; + return EXIT_SUCCESS; } diff --git a/src/tc-compile.c b/src/tc-compile.c index d2b0d09..d60ff21 100644 --- a/src/tc-compile.c +++ b/src/tc-compile.c @@ -17,7 +17,7 @@ int main(void) unsigned char bmchar[HXbitmap_size(unsigned char, 256)] = {0}; if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; printf("sizeof bmllong:\t%" HX_SIZET_FMT "u, array_size: %" HX_SIZET_FMT "u\n", sizeof(bmllong), ARRAY_SIZE(bmllong)); printf("sizeof bmlong:\t%" HX_SIZET_FMT "u, array_size: %" HX_SIZET_FMT "u\n", diff --git a/src/tc-dir.c b/src/tc-dir.c index 12cbacd..ec44977 100644 --- a/src/tc-dir.c +++ b/src/tc-dir.c @@ -25,7 +25,7 @@ static void lookatdir(const char *dname) int main(int argc, const char **argv) { if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; if (argc == 1) { /* On Windows VCRT, "/" yields nothing, "c:/" is needed */ lookatdir("/"); diff --git a/src/tc-io.c b/src/tc-io.c index 639ebcc..77baf01 100644 --- a/src/tc-io.c +++ b/src/tc-io.c @@ -20,7 +20,10 @@ static void sf(void) return; } ssize_t ret = HX_sendfile(dst, src, SIZE_MAX); - printf("sendfile transferred %zd bytes\n", ret); + if (ret < 0) + printf("sendfile: %s\n", strerror(errno)); + else + printf("sendfile transferred %zd bytes\n", ret); close(dst); close(src); } diff --git a/src/tc-list.c b/src/tc-list.c index 2fd6380..e8a30b6 100644 --- a/src/tc-list.c +++ b/src/tc-list.c @@ -22,7 +22,7 @@ union list_encap { static HXCLIST_HEAD(strings_ct); -static void l_init(unsigned int max, bool unshift) +static int l_init(unsigned int max, bool unshift) { static const char *const msg[] = {"Pushing", "Unshifting"}; struct text_object *obj; @@ -34,7 +34,7 @@ static void l_init(unsigned int max, bool unshift) #else obj = malloc(sizeof(*obj)); if (obj == NULL) - abort(); + return EXIT_FAILURE; #endif HXlist_init(&obj->list); obj->id[0] = HX_irand('a', 'z'+1); @@ -48,6 +48,7 @@ static void l_init(unsigned int max, bool unshift) else HXclist_push(&strings_ct, &obj->list); } + return EXIT_SUCCESS; } static void l_traverse(void) @@ -137,16 +138,17 @@ static void l_shift(void) #pragma GCC diagnostic pop } -int main(int argc, const char **argv) +static int runner(int argc, const char **argv) { unsigned int max = 10; if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; if (argc >= 2) max = strtoul(argv[1], NULL, 0); - - l_init(max, HX_rand() & 1); + int ret = l_init(max, HX_rand() & 1); + if (ret != EXIT_SUCCESS) + return ret; l_traverse(); l_dump(HX_rand() & 1); l_empty(); @@ -154,3 +156,11 @@ int main(int argc, const char **argv) HX_exit(); return EXIT_SUCCESS; } + +int main(int argc, const char **argv) +{ + int ret = runner(argc, argv); + if (ret != EXIT_FAILURE) + fprintf(stderr, "FAILED\n"); + return ret; +} diff --git a/src/tc-map.c b/src/tc-map.c index 0037c83..e9e896f 100644 --- a/src/tc-map.c +++ b/src/tc-map.c @@ -205,7 +205,7 @@ static void tmap_trav_speed(struct HXmap *map) tmap_ipop(); } -static void tmap_flat(const struct HXmap *map) +static int tmap_flat(const struct HXmap *map) { struct HXmap_node *nodes; unsigned int i; @@ -215,12 +215,13 @@ static void tmap_flat(const struct HXmap *map) nodes = HXmap_keysvalues(map); if (nodes == NULL) { perror("HXmap_keysvalues"); - abort(); + return EXIT_FAILURE; } for (i = 0; i < map->items; ++i) tmap_printf("%u. %s -> %s\n", i, nodes[i].skey, nodes[i].sdata); tmap_ipop(); free(nodes); + return EXIT_SUCCESS; } static void tmap_trav(struct HXmap *map) @@ -251,7 +252,7 @@ static void tmap_trav(struct HXmap *map) HXmap_travfree(iter); } -static void tmap_generic_tests(enum HXmap_type type, +static int tmap_generic_tests(enum HXmap_type type, unsigned long (*hash_fn)(const void *, size_t), const char *hash_name) { struct HXmap_ops ops = {.k_hash = hash_fn}; @@ -265,10 +266,13 @@ static void tmap_generic_tests(enum HXmap_type type, tmap_flush(map, false); tmap_add_rand(map, 2); - tmap_flat(map); + int ret = tmap_flat(map); + if (ret != EXIT_SUCCESS) + return ret; tmap_trav(map); tmap_flush(map, true); HXmap_free(map); + return EXIT_SUCCESS; } static int tmap_strtolcmp(const void *a, const void *b, size_t z) @@ -722,15 +726,16 @@ static void tmap_zero(void) fprintf(stderr, "eek!\n"); } -int main(void) +static int runner(void) { if (HX_init() <= 0) - abort(); - + return EXIT_FAILURE; tmap_zero(); tmap_printf("* HXhashmap\n"); - tmap_generic_tests(HXMAPT_HASH, HXhash_djb2, "DJB2"); + int ret = tmap_generic_tests(HXMAPT_HASH, HXhash_djb2, "DJB2"); + if (ret != EXIT_SUCCESS) + return ret; tmap_generic_tests(HXMAPT_HASH, HXhash_jlookup3s, "JL3"); tmap_hmap_test_1(); @@ -742,3 +747,11 @@ int main(void) HX_exit(); return EXIT_SUCCESS; } + +int main(void) +{ + int ret = runner(); + if (ret != EXIT_SUCCESS) + fprintf(stderr, "FAILED\n"); + return ret; +} diff --git a/src/tc-memmem.c b/src/tc-memmem.c index a4f272e..1a56f1b 100644 --- a/src/tc-memmem.c +++ b/src/tc-memmem.c @@ -14,14 +14,14 @@ static unsigned int size = 1048576 * 64; static const char filler_text[] = "Slhrdlu cringle tongle flonging blobbity bleep blingmangl"; -static void long_scan(void) +static int long_scan(void) { struct timespec start, stop, delta; char *filler2, *p; filler2 = malloc(size); if (filler2 == NULL) - abort(); + return EXIT_FAILURE; memset(filler2, 'l', size); filler2[size-2] = 'a'; @@ -32,19 +32,20 @@ static void long_scan(void) HX_timespec_sub(&delta, &stop, &start); printf("long_scan: " HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&delta)); free(filler2); + return EXIT_SUCCESS; } -int main(void) +static int runner(void) { unsigned int i; char *haystack; struct timespec start, stop, delta; if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; haystack = malloc(size); if (haystack == NULL) - abort(); + return EXIT_FAILURE; memset(haystack, 'A', size); haystack[size-1] = haystack[size-2] = 'Z'; printf("Init done\n"); @@ -55,8 +56,11 @@ int main(void) printf("%p\n", HX_memmem(filler_text, strlen(filler_text), "ngl", 3)); printf("%p\n", HX_memmem(filler_text, strlen(filler_text), "ngl", 3)); - long_scan(); - + int ret = long_scan(); + if (ret != EXIT_SUCCESS) { + free(haystack); + return ret; + } for (i = 0; i < 10; ++i) { printf("Search length %u...", i); clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start); @@ -66,6 +70,15 @@ int main(void) printf(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&delta)); } + free(haystack); HX_exit(); return EXIT_SUCCESS; } + +int main(void) +{ + int ret = runner(); + if (ret != EXIT_FAILURE) + fprintf(stderr, "FAILED\n"); + return ret; +} diff --git a/src/tc-misc.c b/src/tc-misc.c index 5b043d4..d422f21 100644 --- a/src/tc-misc.c +++ b/src/tc-misc.c @@ -8,13 +8,13 @@ #include <libHX/init.h> #include <libHX/misc.h> -int main(int argc, const char **argv) +static int runner(int argc, const char **argv) { unsigned int n; struct stat sa, sb; if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; printf("%d\n", HX_ffs(0)); for (n = 1; ; n <<= 1) { printf("%08x = %d\n", n, HX_ffs(n)); @@ -30,12 +30,23 @@ int main(int argc, const char **argv) if (argc >= 3) { if (stat(argv[1], &sa) < 0 || - stat(argv[2], &sb) < 0) + stat(argv[2], &sb) < 0) { perror("stat"); - else + return EXIT_FAILURE; + } else { printf("Difference: %ld\n", HX_time_compare(&sa, &sb, 'm')); + return EXIT_FAILURE; + } } HX_exit(); return EXIT_SUCCESS; } + +int main(int argc, const char **argv) +{ + int ret = runner(argc, argv); + if (ret != EXIT_FAILURE) + fprintf(stderr, "FAILED\n"); + return ret; +} diff --git a/src/tc-netio.c b/src/tc-netio.c index 5d3c22e..4510d0a 100644 --- a/src/tc-netio.c +++ b/src/tc-netio.c @@ -19,34 +19,47 @@ #endif #include <libHX/init.h> #include <libHX/io.h> +#include "internal.h" -int main(void) +static int runner(void) { const char id[] = "SSH-2.0-OpenSSH_9.9"; - struct addrinfo *res; + struct addrinfo *res = nullptr; int fd, ret; if ((ret = HX_init()) <= 0) { fprintf(stderr, "HX_init: %s\n", strerror(-ret)); - abort(); + return EXIT_FAILURE; } fd = socket(AF_INET6, SOCK_STREAM, 0); if (fd < 0) { perror("socket"); - abort(); + return EXIT_FAILURE; } if (getaddrinfo("::1", "22", NULL, &res) < 0) { perror("getaddrinfo"); - abort(); + close(fd); + return EXIT_FAILURE; } if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) { perror("connect"); - abort(); + freeaddrinfo(res); + close(fd); + return EXIT_FAILURE; } if (HXio_fullwrite(fd, id, strlen(id)) < 0) perror("write"); + freeaddrinfo(res); close(fd); HX_exit(); return EXIT_SUCCESS; } + +int main(void) +{ + int ret = runner(); + if (ret != EXIT_SUCCESS) + fprintf(stderr, "FAILED\n"); + return ret; +} diff --git a/src/tc-option.c b/src/tc-option.c index db3d3f4..83271e0 100644 --- a/src/tc-option.c +++ b/src/tc-option.c @@ -99,7 +99,7 @@ static void t_empty_argv(void) int main(int argc, const char **argv) { if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; printf("Return value of HX_getopt: %d\n", HX_getopt(table, &argc, &argv, HXOPT_USAGEONERR)); t_empty_argv(); diff --git a/src/tc-proc.c b/src/tc-proc.c index 19c8b18..c17b232 100644 --- a/src/tc-proc.c +++ b/src/tc-proc.c @@ -51,7 +51,7 @@ static void t_async1(void) int main(void) { if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; printf("top fd: %d\n", HXproc_top_fd()); /* let it fail - test verbosity */ diff --git a/src/tc-rand.c b/src/tc-rand.c index 149f18e..c581372 100644 --- a/src/tc-rand.c +++ b/src/tc-rand.c @@ -12,7 +12,7 @@ int main(void) unsigned int i; if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; for (i = 0; i < 15; ++i) { printf("%d ", HX_irand(i, i)); printf("%.1f ", HX_drand(i, i)); diff --git a/src/tc-shconfig.c b/src/tc-shconfig.c index 556f90f..3717c15 100644 --- a/src/tc-shconfig.c +++ b/src/tc-shconfig.c @@ -26,7 +26,7 @@ static void t_shconfig(const char *file) fprintf(stderr, "Read error %s: %s\n", file, strerror(errno)); } -static void t_shconfig2(const char *file) +static int t_shconfig2(const char *file) { const struct HXmap_node *node; struct HXmap_trav *trav; @@ -35,15 +35,16 @@ static void t_shconfig2(const char *file) map = HX_shconfig_map(file); if (map == NULL) { fprintf(stderr, "HX_shconfig_map: %s\n", strerror(errno)); - abort(); + return EXIT_FAILURE; } trav = HXmap_travinit(map, HXMAP_NOFLAGS); while ((node = HXmap_traverse(trav)) != NULL) printf("\t\"%s\" -> \"%s\"\n", node->skey, node->sdata); HXmap_travfree(trav); + return EXIT_SUCCESS; } -int main(int argc, const char **argv) +static int runner(int argc, const char **argv) { int ret; @@ -53,7 +54,17 @@ int main(int argc, const char **argv) return EXIT_FAILURE; } t_shconfig((argc >= 2) ? argv[1] : "tc-shconf.c"); - t_shconfig2((argc >= 2) ? argv[1] : "tc-shconf.c"); + ret = t_shconfig2((argc >= 2) ? argv[1] : "tc-shconf.c"); + if (ret != EXIT_SUCCESS) + return ret; HX_exit(); return EXIT_SUCCESS; } + +int main(int argc, const char **argv) +{ + int ret = runner(argc, argv); + if (ret != EXIT_SUCCESS) + fprintf(stderr, "FAILED\n"); + return ret; +} diff --git a/src/tc-string.c b/src/tc-string.c index 9bf668b..1c7ed09 100644 --- a/src/tc-string.c +++ b/src/tc-string.c @@ -21,14 +21,14 @@ #include <libHX/string.h> #include "internal.h" -static void t_mc(void) +static int t_mc(void) { hxmc_t *s, *old_s; s = HXmc_meminit(NULL, 4096); printf("%" HX_SIZET_FMT "u\n", HXmc_length(s)); if (HXmc_length(s) != 0) - abort(); + return EXIT_FAILURE; old_s = s; HXmc_trunc(&s, 8192); if (old_s != s) @@ -37,6 +37,7 @@ static void t_mc(void) HXmc_setlen(&s, 16384); printf("Length is now %" HX_SIZET_FMT "u\n", HXmc_length(s)); HXmc_free(s); + return EXIT_SUCCESS; } static void t_path(void) @@ -60,13 +61,12 @@ static void t_path(void) } } -static void t_strcpy(void) +static int t_strcpy(void) { hxmc_t *vp = NULL; HXmc_strcpy(&vp, NULL); - if (vp != NULL) - abort(); + return vp == nullptr ? EXIT_SUCCESS : EXIT_FAILURE; } static void t_strdup(void) @@ -291,7 +291,7 @@ static void t_strlcpy2(void) assert(a[0] == 49 && a[0] == a[1] && a[1] == a[2]); } -static void t_units(void) +static int t_units(void) { static const struct { unsigned long long num; @@ -320,18 +320,19 @@ static void t_units(void) printf("\t%llu -> %s\n", vt[i].num, buf); if (strcmp(buf, vt[i].exp_1024) != 0) { printf("\texpected %s\n", vt[i].exp_1024); - abort(); + return EXIT_FAILURE; } HX_unit_size(buf, ARRAY_SIZE(buf), vt[i].num, 1000, 9120); printf("\t%llu -> %s\n", vt[i].num, buf); if (strcmp(buf, vt[i].exp_1000) != 0) { printf("\texpected %s\n", vt[i].exp_1000); - abort(); + return EXIT_FAILURE; } } + return EXIT_SUCCESS; } -static void t_units_cu(void) +static int t_units_cu(void) { static const struct { unsigned long long num; @@ -360,18 +361,19 @@ static void t_units_cu(void) printf("\t%llu -> %s\n", vt[i].num, buf); if (strcmp(buf, vt[i].exp_1024) != 0) { printf("\texpected %s\n", vt[i].exp_1024); - abort(); + return EXIT_FAILURE; } HX_unit_size_cu(buf, ARRAY_SIZE(buf), vt[i].num, 1000); printf("\t%llu -> %s\n", vt[i].num, buf); if (strcmp(buf, vt[i].exp_1000) != 0) { printf("\texpected %s\n", vt[i].exp_1000); - abort(); + return EXIT_FAILURE; } } + return EXIT_SUCCESS; } -static void t_units_strto(void) +static int t_units_strto(void) { static const struct { const char input[24]; @@ -416,8 +418,9 @@ static void t_units_strto(void) unsigned long long q = HX_strtoull_unit(vt[i].input, &end, vt[i].exponent); printf("%s -> %llu __ %s\n", vt[i].input, q, end); if (q != vt[i].expect_out || strcmp(end, vt[i].expect_rem) != 0) - printf("BUG\n"); + return EXIT_FAILURE; } + return EXIT_SUCCESS; } static void t_time_units(void) @@ -454,25 +457,30 @@ static void t_time_units(void) static void t_time_strto(void) { + #define NS_PER_S 1000000000ULL static const struct { const char *input; - unsigned long long expect_out; - const char expect_rem[4]; + unsigned long long expect_s, expect_ns; + const char expect_rem[8]; } vt[] = { - {"1y1month1week1d1h1min1s ", 31557600+2629800+86400*8+3600+60+1, ""}, - {" -1d", 0, "-1d"}, - {"1 -", 1, "-"}, - {"1s", 1, ""}, - {"1min", 60, ""}, - {"0", 0, ""}, + {"29µs", 0, 29000, ""}, + {"1y", 31557600, NS_PER_S * 31557600, ""}, + {"1y1month1week1d1h1min1s ", 31557600+2629800+86400*8+3600+60+1, NS_PER_S * (31557600+2629800+86400*8+3600+60+1), ""}, + {" -1d", 0, 0, "-1d"}, + {"1 -", 1, NS_PER_S, "-"}, + {"12.5 hours .5 hours 240 minutes 25200 seconds", 86400, NS_PER_S * 86400, ""}, + {"1s", 1, NS_PER_S, ""}, + {"1min", 60, 60 * NS_PER_S, ""}, + {"0", 0, 0, ""}, }; char *end; printf("===== t_time_strto\n"); for (size_t i = 0; i < ARRAY_SIZE(vt); ++i) { unsigned long long q = HX_strtoull_sec(vt[i].input, &end); - printf("\"%s\" => %llus + \"%s\"\n", vt[i].input, q, end); - if (q != vt[i].expect_out) - printf("\tBUG: expected %llus\n", vt[i].expect_out); + unsigned long long qn = HX_strtoull_nsec(vt[i].input, &end); + printf("\"%s\" => %llus [%lluns] + \"%s\"\n", vt[i].input, q, qn, end); + if (q != vt[i].expect_s || qn != vt[i].expect_ns) + printf("\tBUG: expected %llus [%lluns]\n", vt[i].expect_s, vt[i].expect_ns); if (strcmp(end, vt[i].expect_rem) != 0) printf("\tBUG: expected remainder \"%s\"\n", vt[i].expect_rem); } @@ -507,14 +515,14 @@ static int t_strmid(void) #undef T } -int main(int argc, const char **argv) +static int runner(int argc, const char **argv) { hxmc_t *tx = NULL; const char *file = (argc >= 2) ? argv[1] : "tx-string.cpp"; FILE *fp; if (HX_init() <= 0) - abort(); + return EXIT_FAILURE; int ret = t_strmid(); if (ret != EXIT_SUCCESS) return EXIT_FAILURE; @@ -528,9 +536,13 @@ int main(int argc, const char **argv) fclose(fp); } - t_mc(); + ret = t_mc(); + if (ret != EXIT_SUCCESS) + return EXIT_FAILURE; t_path(); - t_strcpy(); + ret = t_strcpy(); + if (ret != EXIT_SUCCESS) + return EXIT_FAILURE; t_strncat(); t_strnlen(); t_strdup(); @@ -538,9 +550,15 @@ int main(int argc, const char **argv) t_strtrim(); t_split(); t_split2(); - t_units(); - t_units_cu(); - t_units_strto(); + ret = t_units(); + if (ret != EXIT_SUCCESS) + return EXIT_FAILURE; + ret = t_units_cu(); + if (ret != EXIT_SUCCESS) + return EXIT_FAILURE; + ret = t_units_strto(); + if (ret != EXIT_SUCCESS) + return EXIT_FAILURE; t_time_units(); t_time_strto(); t_strlcpy(); @@ -549,3 +567,11 @@ int main(int argc, const char **argv) HX_exit(); return EXIT_SUCCESS; } + +int main(int argc, const char **argv) +{ + int ret = runner(argc, argv); + if (ret != EXIT_FAILURE) + fprintf(stderr, "FAILED\n"); + return ret; +} diff --git a/src/tc-switchuser.c b/src/tc-switchuser.c index 1763527..4cc5604 100644 --- a/src/tc-switchuser.c +++ b/src/tc-switchuser.c @@ -19,7 +19,7 @@ static const struct HXoption options_table[] = { HXOPT_TABLEEND, }; -int main(int argc, const char **argv) +static int runner(int argc, const char **argv) { HX_getopt(options_table, &argc, &argv, HXOPT_USAGEONERR); const char *user = user_name != NULL ? user_name : "-"; @@ -27,12 +27,12 @@ int main(int argc, const char **argv) switch (HXproc_switch_user(user_name, group_name)) { case HXPROC_USER_NOT_FOUND: if (user_name == NULL) - abort(); /* impossible outcomes */ + return EXIT_FAILURE; /* impossible outcomes */ printf("No such user \"%s\": %s\n", user_name, strerror(errno)); break; case HXPROC_GROUP_NOT_FOUND: if (group_name == NULL || *group_name == '\0') - abort(); /* impossible outcome */ + return EXIT_FAILURE; /* impossible outcome */ printf("No such group \"%s\": %s\n", group_name, strerror(errno)); break; case HXPROC_SETUID_FAILED: @@ -64,6 +64,14 @@ int main(int argc, const char **argv) } return EXIT_SUCCESS; } + +int main(int argc, const char **argv) +{ + int ret = runner(argc, argv); + if (ret != EXIT_SUCCESS) + fprintf(stderr, "FAILED\n"); + return ret; +} #else int main(void) { diff --git a/src/tc-time.c b/src/tc-time.c index 5097cde..e810233 100644 --- a/src/tc-time.c +++ b/src/tc-time.c @@ -207,7 +207,7 @@ static void print_op2(const struct timespec *r, const struct timespec *a, printf(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(r)); } -static void test_add(void) +static int test_add(void) { const struct timespec *a, *b; struct timespec r, s; @@ -220,13 +220,14 @@ static void test_add(void) HX_timespec_add_DIVQ(&s, a, b); print_op2(&r, a, "+Q", b); if (r.tv_sec != s.tv_sec || r.tv_nsec != s.tv_nsec) - abort(); + return EXIT_FAILURE; HX_timespec_sub(&r, a, b); print_op2(&r, a, "- ", b); printf("----------\n"); } } printf("\n"); + return EXIT_SUCCESS; } static void test_adds_nz(time_t s, add_func_t fn) @@ -303,7 +304,7 @@ static void test_adds(void) printf("\n"); } -static void test_mul(void) +static int test_mul(void) { struct timespec r, s; unsigned int i; @@ -324,7 +325,7 @@ static void test_mul(void) printf(HX_TIMESPEC_FMT "\n", HX_TIMESPEC_EXP(&s)); if (r.tv_sec != s.tv_sec || r.tv_nsec != s.tv_nsec) - abort(); + return EXIT_FAILURE; } for (k = -3; k <= 3; k += 0.1) { @@ -341,6 +342,7 @@ static void test_mul(void) } printf("\n"); + return EXIT_SUCCESS; } static void test_muls_1i(const char *text, mul_func_t fn) @@ -386,18 +388,29 @@ static void test_muls(void) printf("\n"); } -int main(void) +static int runner(void) { if (HX_init() <= 0) - abort(); - + return EXIT_FAILURE; test_basic(); test_same(); test_neg(); - test_add(); - test_mul(); + int ret = test_add(); + if (ret != EXIT_SUCCESS) + return ret; + ret = test_mul(); + if (ret != EXIT_SUCCESS) + return ret; test_adds(); test_muls(); HX_exit(); return EXIT_SUCCESS; } + +int main(void) +{ + int ret = runner(); + if (ret != EXIT_SUCCESS) + fprintf(stderr, "FAILED\n"); + return ret; +} diff --git a/src/tc-xml.c b/src/tc-xml.c deleted file mode 100644 index 49b24ad..0000000 --- a/src/tc-xml.c +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: MIT -#include <stdbool.h> -#include <stdio.h> -#include <libxml/parser.h> -#include <libHX/defs.h> -#include <libHX/libxml_helper.h> - -int main(void) -{ - xmlDoc *doc; - xmlNode *root, *etc, *node; - char *result = NULL; - int size = 0; - - doc = xmlNewDoc(NULL); - root = xmlNewDocNode(doc, NULL, "root", NULL); - xmlDocSetRootElement(doc, root); - xml_newnode(root, "empty", NULL); - etc = xml_newnode(root, "filled", NULL); - xml_newnode(etc, "a", "1234 bytes"); - node = xml_newnode(etc, "b", "0 bytes"); - xml_newnode(node, "extra", NULL); - xmlDocDumpFormatMemory(doc, reinterpret_cast(xmlChar **, &result), - &size, true); - xmlSaveFileEnc("test.xml", doc, "utf-8"); - if (result != NULL) - printf("%.*s\n", size, result); - return 0; -} diff --git a/src/uxcompat.h b/src/uxcompat.h deleted file mode 100644 index e735c50..0000000 --- a/src/uxcompat.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef _LIBHX_UXCOMPAT_H -#define _LIBHX_UXCOMPAT_H 1 - -#if defined(__cplusplus) && __cplusplus >= 201100UL -# include <cstddef> -# include <cstdint> -#else -# include <stddef.h> -# include <stdint.h> -#endif -#include <sys/stat.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef ENOSYS -# define ENOSYS 38 /* Function not implemented */ -#endif - -#ifndef S_IFLNK -# define S_IFLNK 0xA000 -#endif -#ifndef S_IFSOCK -# define S_IFSOCK 0xC000 -#endif -#ifndef S_IFBLK -# define S_IFBLK 0x6000 -#endif -#ifndef S_IFCHR -# define S_IFCHR 0x2000 -#endif -#ifndef S_IFIFO -# define S_IFIFO 0x1000 -#endif -#ifndef S_ISBLK -# define S_ISBLK(__mode) (((__mode) & S_IFMT) == S_IFBLK) -#endif -#ifndef S_ISCHR -# define S_ISCHR(__mode) (((__mode) & S_IFMT) == S_IFCHR) -#endif -#ifndef S_ISDIR -# define S_ISDIR(__mode) (((__mode) & S_IFMT) == S_IFDIR) -#endif -#ifndef S_ISREG -# define S_ISREG(__mode) (((__mode) & S_IFMT) == S_IFREG) -#endif -#ifndef S_ISLNK -# define S_ISLNK(__mode) (((__mode) & S_IFMT) == S_IFLNK) -#endif -#ifndef S_ISFIFO -# define S_ISFIFO(__mode) (((__mode) & S_IFMT) == S_IFIFO) -#endif -#ifndef S_ISSOCK -# define S_ISSOCK(__mode) (((__mode) & S_IFMT) == S_IFSOCK) -#endif -#ifndef S_IRGRP -# define S_IRGRP 00040 -#endif -#ifndef S_IWGRP -# define S_IWGRP 00020 -#endif -#ifndef S_IROTH -# define S_IROTH 00004 -#endif -#ifndef S_IWOTH -# define S_IWOTH 00002 -#endif - -struct stat; - -/* - * UX-FILE.C - */ -extern int chown(const char *, long, long); -extern int fchmod(int, long); -extern int fchown(int, long, long); -extern int lchown(const char *, long, long); -extern int lstat(const char *, struct stat *); -extern int mkfifo(const char *, long); -extern int mknod(const char *, long, long); -extern int readlink(const char *, char *, size_t); -extern int symlink(const char *, const char *); - -/* - * UX-MMAP.C - */ -#ifdef _WIN32 -# define MAP_FAILED reinterpret_cast(void *, static_cast(intptr_t, -1)) -# define PROT_NONE 0x0 -# define PROT_READ 0x1 -# define PROT_WRITE 0x2 -# define PROT_EXEC 0x4 -# define MAP_SHARED 0x1 -# define MAP_PRIVATE 0x2 -extern void *mmap(void *, size_t, int, int, int, off_t); -extern int munmap(void *, size_t); -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* _LIBHX_UXCOMPAT_H */ |