diff -ruNp m4-1.4.9/COPYING m4-1.4.10/COPYING --- m4-1.4.9/COPYING 2007-03-23 06:54:13.000000000 -0600 +++ m4-1.4.10/COPYING 2007-07-09 21:15:36.000000000 -0600 @@ -1,285 +1,626 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to + 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 -this service 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 make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. +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 give the recipients all the rights that -you have. 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. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +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. - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + 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. - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -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 Program or any portion -of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -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 Program, 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 Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) 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; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, 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 executable. However, as a -special exception, the source code 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. - -If distribution of executable or 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 counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. 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 Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program 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 to + "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. - 7. 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 + 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 -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 Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program 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 Program. - -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. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program 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. +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. - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will + 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 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 Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, 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 - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. - - 12. 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 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. + 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 + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + 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 @@ -287,15 +628,15 @@ free software which everyone can redistr 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 -convey the exclusion of warranty; and each file should have at least +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. Copyright (C) - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -303,37 +644,31 @@ the "copyright" line and a pointer to wh MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + You should have received a copy of the GNU General Public License + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Copyright (C) + 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, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This 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. +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 +. + + 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 +. diff -ruNp m4-1.4.9/ChangeLog m4-1.4.10/ChangeLog --- m4-1.4.9/ChangeLog 2007-03-23 14:33:12.000000000 -0600 +++ m4-1.4.10/ChangeLog 2007-07-09 21:50:13.000000000 -0600 @@ -1,3 +1,180 @@ +2007-07-09 Eric Blake + + Release 1.4.10: + * doc/Makefile.am (m4_TEXINFOS): Distribute gpl-3.0.texi. + * Makefile.am (EXTRA_DIST): Distribute gnulib diffs. + * configure.ac (AC_INIT): Bump version number. + * NEWS: Describe changes since 1.4.9. + + * src/format.c: Missed a GPLv3 conversion. + + Avoid undefined behavior of %.*c in printf. + * src/format.c (format): Special case %c. + * TODO: Document that more remains to be done. + * NEWS: Document the fix. + +2007-07-05 Eric Blake + + Fix up gnulib-tool usage. + * m4/gnulib-cache.m4: Change local-dir to local, not `.'. + * version-etc.c.diff: Move to... + * local/lib/version-etc.c.diff: ...here. + * gpl-3.0.texi.diff: Move to... + * local/doc/gpl-3.0.texi.diff: ...here. + +2007-07-04 Eric Blake + + Upgrade to GPL version 3 or later. + * bootstrap: Pick up GPLv3. + * m4/gnulib-cache.m4: Augment with 'gnulib-tool + --local-dir=. --import gpl-3.0'. + * doc/m4.texinfo (Copying This Package): New appendix. + * NEWS: Mention this change. + * README: Mention why some files still claim to be version 2. + * version-etc.c.diff: New file, to make sure --version claims + correct GPL version. Temporary until gnulib makes move. + * gpl-3.0.texi.diff: New file, to allow inclusion of GPLv3 as + appendix, rather than section, of the manual. + * GNUmakefile: Update to new license. + * Makefile.am: Likewise. + * Makefile.maint: Likewise. + * commit: Likewise. + * configure.ac: Likewise. + * checks/Makefile.in: Likewise. + * doc/Makefile.am: Likewise. + * examples/Makefile.am: Likewise. + * src/Makefile.am: Likewise. + * src/builtin.c: Likewise. + * src/debug.c: Likewise. + * src/eval.c: Likewise. + * src/freeze.c: Likewise. + * src/input.c: Likewise. + * src/m4.c: Likewise. + * src/m4.h: Likewise. + * src/macro.c: Likewise. + * src/output.c: Likewise. + * src/path.c: Likewise. + * src/stackovf.c: Likewise. + * src/symtab.c: Likewise. + +2007-06-26 Eric Blake + + * m4/gnulib-cache.m4: Augment with 'gnulib-tool --import assert'. + +2007-06-26 Karl Berry (tiny change) + + Match Free Software Directory categories. + * doc/m4.texinfo (dircategory): Update. + +2007-05-31 Eric Blake + + * src/output.c (output_text): Fix regression from 2007-05-28. + * doc/m4.texinfo (History): Mention 1.4.10. + (Format): Make testsuite output easier to debug. + +2007-05-29 Eric Blake + + Start 1.4.9c. + * configure.ac (AC_INIT): Bump version number. + * NEWS: Start changes since 1.4.9b, and fix typo. + + Beta Release 1.4.9b: + * configure.ac (AC_INIT): Bump version number. + * NEWS: Describe changes since 1.4.9. + + Improve format support. + * m4/gnulib-cache.m4: Augment with 'gnulib-tool --import + vasprintf-posix'. + * src/format.c (format): Parse %'hhd, %a, %A. Avoid calling + printf with too few arguments, as in format(%*.*d,-1,-1,1). + * doc/m4.texinfo (Format): Expand tests, and improve + documentation. + * NEWS: Document this change. + +2007-05-28 Eric Blake + + Fix large diversion corner cases, including 1.4.8 regression. + * src/output.c (m4_tmpfile, m4_tmpopen): Simplify use of errno. + (make_room_for): Use NULL, not 0, for pointers. + (insert_diversion_helper): Avoid using rewind. + (freeze_diversions): Allow freezing large diversions. + * NEWS: Document this fix. + + Also run gnulib unit tests during make check. + * m4/gnulib-cache.m4: Augment with 'gnulib-tool + --tests-base=tests --with-tests'. + * configure.ac (AC_CONFIG_FILES): Build gnulib testdir. + * Makefile.am (SUBDIRS): Run gnulib tests before ours. + +2007-05-25 Eric Blake + + Backport prompts in examples from head. + * src/macro.c (expand_macro): Shorten message. + * doc/m4.texinfo (Manual, Command line files, Comments) + (Inhibiting Invocation, Macro Arguments, Macro expansion, Indir) + (Builtin, Shift, Forloop, Foreach, Dumpdef, Trace, Debug Levels) + (Debug Output, Include, Format, Syscmd, Mkstemp, Location) + (Using frozen files, Improved forloop, Improved foreach): Add + prompts to examples. + * checks/get-them: Ignore prompts in examples. + + Fix sync line interaction with multiline comments. + * doc/m4.texinfo (Other Incompatibilities): Add example, and + document bug in --syncline/divert interaction. + (Preprocessor features): Augment test. + * src/m4.h (output_text): Export. + (shipout_text, next_token): Add parameter. + * src/freeze.c (reload_frozen_state): Don't interfere with + synclines when reloading state. + * src/output.c (output_text): Export. + (shipout_text): Take new parameter for start line of token. + Output at most one syncline per token. + * src/input.c (next_token): Report line where multiline tokens + start. + * src/macro.c (expand_input, expand_token, expand_argument): + Adjust callers so that line is passed from input to output. + * NEWS: Document this fix. + Reported by Sergey Poznyakoff. + + Test -s in testsuite. + * doc/m4.texinfo (Preprocessor features): Add a test. + * checks/get-them: Support extra options in testsuite. + * checks/check-them (examples): Use extra options. + * THANKS: Update. + Reported by Sergey Poznyakoff. + +2007-05-24 Eric Blake + + Support POSIX flush semantics on all platforms. + * m4/gnulib-cache.m4: Remove closeout, and augment with + 'gnulib-tool --import closein fflush'. + * src/m4.h (includes): Use closein, not closeout. + * src/m4.c (main): Ensure stdin is flushed when not all input is + consumed. + (process_file): No return needed. + * src/debug.c (debug_flush_files): Rely on gnulib module, rather + than excluding mingw. + * NEWS: Document this change. + + Work around cygwin and mingw fseeko bugs. + * m4/gnulib-cache.m4: Augment with 'gnulib-tool --import fseeko'. + * src/debug.c (debug_flush_files): Prefer fseeko over fseek. + +2007-04-25 Eric Blake + + Fix negative division within eval, regression of 2007-01-06. + * doc/m4.texinfo (Eval): Catch this bug. + * src/eval.c (mult_term): Fix it. + * NEWS: Document this. + * THANKS: Update. + Reported by Cesar Strauss. + +2007-04-23 Eric Blake + + Start 1.4.9a. + * configure.ac (AC_INIT): Bump version number. + * NEWS: Start changes since 1.4.9. + 2007-03-23 Eric Blake Release 1.4.9: @@ -3595,7 +3772,7 @@ Mon Jan 22 21:08:52 1990 Rene' Seindal ----- - $Revision: 1.1.1.1.2.258 $ $Date: 2007/03/23 20:33:12 $ + $Revision: 1.1.1.1.2.278 $ $Date: 2007/07/10 03:50:13 $ Local Variables: coding: utf-8 diff -ruNp m4-1.4.9/GNUmakefile m4-1.4.10/GNUmakefile --- m4-1.4.9/GNUmakefile 2006-07-01 19:34:24.000000000 -0600 +++ m4-1.4.10/GNUmakefile 2007-07-04 21:56:02.000000000 -0600 @@ -4,11 +4,11 @@ # It is necessary if you want to build targets usually of interest # only to the maintainer. -# Copyright (C) 2001, 2003, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2006, 2007 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# 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, diff -ruNp m4-1.4.9/Makefile.am m4-1.4.10/Makefile.am --- m4-1.4.9/Makefile.am 2007-03-02 19:32:22.000000000 -0700 +++ m4-1.4.10/Makefile.am 2007-07-09 21:29:49.000000000 -0600 @@ -1,11 +1,11 @@ ## This file is part of GNU M4. ## -## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006 Free Software +## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software ## Foundation, Inc. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or +## 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, @@ -20,9 +20,10 @@ ## ## Written by Gary V. Vaughan -SUBDIRS = . examples lib src doc checks +SUBDIRS = . examples lib src doc tests checks EXTRA_DIST = bootstrap c-boxes.el gendocs.sh GNUmakefile Makefile.maint \ - m4/gnulib-cache.m4 + m4/gnulib-cache.m4 local/doc/gpl-3.0.texi.diff \ + local/lib/version-etc.c.diff DISTCLEANFILES = stamp-h ## maintainer-clean should remove as much as possible that ./bootstrap can ## recreate. In the m4 directory, keep only gnulib-cache.m4. diff -ruNp m4-1.4.9/Makefile.in m4-1.4.10/Makefile.in --- m4-1.4.9/Makefile.in 2007-03-23 07:32:35.000000000 -0600 +++ m4-1.4.10/Makefile.in 2007-07-09 21:30:00.000000000 -0600 @@ -38,36 +38,48 @@ DIST_COMMON = README $(am__configure_dep INSTALL NEWS THANKS TODO config.guess config.sub depcomp \ install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ - $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/closein.m4 \ $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ - $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ - $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ - $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/inline.m4 \ + $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ + $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ + $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ + $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/localcharset.m4 \ - $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ - $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ - $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ - $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ + $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/printf-frexp.m4 \ + $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ + $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ + $(top_srcdir)/m4/sig_atomic_t.m4 $(top_srcdir)/m4/signal_h.m4 \ + $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/signbit.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ @@ -105,13 +117,6 @@ DIST_ARCHIVES = $(distdir).tar.gz $(dist GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print -ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ -ABSOLUTE_STDLIB_H = @ABSOLUTE_STDLIB_H@ -ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ -ABSOLUTE_SYS_TIME_H = @ABSOLUTE_SYS_TIME_H@ -ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@ -ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@ -ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ @@ -139,30 +144,80 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ +FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREXP = @GNULIB_FREXP@ +GNULIB_FREXPL = @GNULIB_FREXPL@ +GNULIB_FSEEK = @GNULIB_FSEEK@ +GNULIB_FSEEKO = @GNULIB_FSEEKO@ +GNULIB_FTELL = @GNULIB_FTELL@ +GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LDEXPL = @GNULIB_LDEXPL@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ +GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ +GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ +GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ +GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ +GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ +HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ +HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ +HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ +HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ +HAVE_DECL_SINL = @HAVE_DECL_SINL@ +HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ +HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_FSEEKO = @HAVE_FSEEKO@ +HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_IO_H = @HAVE_IO_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SIGSET_T = @HAVE_SIGSET_T@ +HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ @@ -171,24 +226,40 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_VASPRINTF = @HAVE_VASPRINTF@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE__BOOL = @HAVE__BOOL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ +NEXT_FLOAT_H = @NEXT_FLOAT_H@ +NEXT_MATH_H = @NEXT_MATH_H@ +NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDIO_H = @NEXT_STDIO_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -201,9 +272,30 @@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREXP = @REPLACE_FREXP@ +REPLACE_FREXPL = @REPLACE_FREXPL@ +REPLACE_FSEEK = @REPLACE_FSEEK@ +REPLACE_FSEEKO = @REPLACE_FSEEKO@ +REPLACE_FTELL = @REPLACE_FTELL@ +REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ +REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ +REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ +REPLACE_VPRINTF = @REPLACE_VPRINTF@ +REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ +REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ @@ -267,9 +359,10 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = . examples lib src doc checks +SUBDIRS = . examples lib src doc tests checks EXTRA_DIST = bootstrap c-boxes.el gendocs.sh GNUmakefile Makefile.maint \ - m4/gnulib-cache.m4 + m4/gnulib-cache.m4 local/doc/gpl-3.0.texi.diff \ + local/lib/version-etc.c.diff DISTCLEANFILES = stamp-h MAINTAINERCLEANFILES = COPYING INSTALL Makefile.in aclocal.m4 \ diff -ruNp m4-1.4.9/Makefile.maint m4-1.4.10/Makefile.maint --- m4-1.4.9/Makefile.maint 2006-08-25 08:01:34.000000000 -0600 +++ m4-1.4.10/Makefile.maint 2007-07-04 21:56:02.000000000 -0600 @@ -1,10 +1,10 @@ ## Makefile.maint -- Makefile rules for m4 maintainers -*-Makefile-*- ## -## Copyright (C) 2004, 2005, 2006 Free Software Foundation +## Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or +## 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, diff -ruNp m4-1.4.9/NEWS m4-1.4.10/NEWS --- m4-1.4.9/NEWS 2007-03-23 06:41:17.000000000 -0600 +++ m4-1.4.10/NEWS 2007-07-09 21:09:07.000000000 -0600 @@ -2,6 +2,34 @@ GNU M4 NEWS - User visible changes. Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +Version 1.4.10 - 09 Jul 2007, by Eric Blake (CVS version 1.4.9c) + +* Upgrade from GPL version 2 to GPL version 3 or later. +* A number of portability improvements inherited from gnulib. +* Avoid undefined behavior introduced in 1.4.9b in the `format' builtin + when handling %c. However, this area of code has never been documented, + and currently does not match the POSIX behavior of printf(1), so it may + have further changes in the next version. + +Version 1.4.9b - 29 May 2007, by Eric Blake (CVS version 1.4.9a) + +* Fix regression introduced in 1.4.9 in the `eval' builtin when performing + division. +* Fix regression introduced in 1.4.8 in the `-F' option that made it + impossible to freeze more than 512 kibibytes of diverted text. +* The synclines option `-s' no longer generates sync lines in the middle of + multiline comments or quoted strings. +* Work around a number of corner-case POSIX compliance bugs in various + broken stdio libraries. In particular, the `syscmd' builtin behaves + more predictably when stdin is seekable. +* The `format' builtin now understands formats such as %a, %A, and %'hhd, + and works around a number of platform printf bugs. Furthermore, the + sequence format(%*.*d,-1,-1,1) no longer outputs random data. However, + some non-compliant platforms such as mingw still have known bugs in + strtod that may cause testsuite failures. +* The testsuite is improved to also run gnulib portability tests for the + features that M4 imports from gnulib. + Version 1.4.9 - 23 Mar 2007, by Eric Blake (CVS version 1.4.8c) * Minor documentation and portability cleanups. diff -ruNp m4-1.4.9/README m4-1.4.10/README --- m4-1.4.9/README 2007-03-02 19:32:22.000000000 -0700 +++ m4-1.4.10/README 2007-07-04 21:56:02.000000000 -0600 @@ -23,7 +23,12 @@ from trivial test files to rather advanc use m4 seriously, you might find useful material down there. See file `BACKLOG' for a summary of pending mail and articles. -See file `COPYING' for copying conditions. +See file `COPYING' for copying conditions. Note that M4 is distributed +under the GNU Public License version 3 or later. Some files in the +distribution are copied from the gnulib project, and hence bear the +designation version 2 or later because they are unmodified from gnulib; +however, if you modify these files using M4 rather than gnulib as the +source, you must update the license to be GPLv3 or later. See file `INSTALL' for compilation and installation instructions. See file `NEWS' for a list of major changes in the current release. See file `THANKS' for a list of contributors. diff -ruNp m4-1.4.9/THANKS m4-1.4.10/THANKS --- m4-1.4.9/THANKS 2007-03-23 06:40:02.000000000 -0600 +++ m4-1.4.10/THANKS 2007-05-29 19:34:53.000000000 -0600 @@ -23,6 +23,7 @@ Bjorn R. Bjornsson brb@falcon.is Bob Badour bob@badour.net Brendan Kehoe brendan@cygnus.com Bruno Haible bruno@clisp.org +Cesar Strauss cestrauss@gmail.com Chris McGuire chris@wso.net Damian Menscher menscher@uiuc.edu Dan Jacobson jidanni@jidanni.org @@ -89,6 +90,7 @@ Roland McGrath roland@gnu.ai.mit.edu Sami Liedes sliedes@cc.hut.fi Santiago Vila sanvila@debian.org Scott Bartram deneb!scottb +Sergey Poznyakoff gray@gnu.org.ua Simon Leinen simon@lia.di.epfl.ch Skip Montanaro skip@automatrix.com Stepan Kasal kasal@ucw.cz diff -ruNp m4-1.4.9/TODO m4-1.4.10/TODO --- m4-1.4.9/TODO 2007-03-02 19:32:22.000000000 -0700 +++ m4-1.4.10/TODO 2007-07-09 21:07:04.000000000 -0600 @@ -4,6 +4,9 @@ Tell if you feel like v of these ideas, listed more or less in decreasing order of priority. * Features or problems + - Fix format() builtin to handle %c more like printf(1) in the shell + http://lists.gnu.org/archive/html/bug-m4/2007-05/msg00047.html + Also, gnulib needs help to overcome mingw bugs related to format(). - Update documentation from accumulated mail about it - Study synclines at the very beginning of each diverted sequence - Make eval work on bignums - the 32 bits limit is artificial @@ -34,7 +37,7 @@ mode: outline outline-regexp: " *[-+*.] \\| " End: -Copyright (C) 2000, 2006 Free Software Foundation, Inc. +Copyright (C) 2000, 2006, 2007 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or diff -ruNp m4-1.4.9/aclocal.m4 m4-1.4.10/aclocal.m4 --- m4-1.4.9/aclocal.m4 2007-03-23 07:32:14.000000000 -0600 +++ m4-1.4.10/aclocal.m4 2007-07-09 21:14:48.000000000 -0600 @@ -860,11 +860,11 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -m4_include([m4/absolute-header.m4]) m4_include([m4/alloca.m4]) -m4_include([m4/allocsa.m4]) +m4_include([m4/assert.m4]) m4_include([m4/cloexec.m4]) m4_include([m4/close-stream.m4]) +m4_include([m4/closein.m4]) m4_include([m4/closeout.m4]) m4_include([m4/codeset.m4]) m4_include([m4/config-h.m4]) @@ -874,29 +874,50 @@ m4_include([m4/error.m4]) m4_include([m4/exitfail.m4]) m4_include([m4/extensions.m4]) m4_include([m4/fatal-signal.m4]) +m4_include([m4/fflush.m4]) +m4_include([m4/float_h.m4]) m4_include([m4/fpending.m4]) +m4_include([m4/fpieee.m4]) +m4_include([m4/fpurge.m4]) +m4_include([m4/freading.m4]) m4_include([m4/free.m4]) +m4_include([m4/frexp.m4]) +m4_include([m4/frexpl.m4]) +m4_include([m4/fseeko.m4]) +m4_include([m4/ftello.m4]) m4_include([m4/getopt.m4]) m4_include([m4/gettimeofday.m4]) m4_include([m4/gl_list.m4]) m4_include([m4/glibc21.m4]) m4_include([m4/gnulib-common.m4]) m4_include([m4/gnulib-comp.m4]) +m4_include([m4/include_next.m4]) m4_include([m4/inline.m4]) m4_include([m4/intmax_t.m4]) m4_include([m4/inttypes_h.m4]) +m4_include([m4/isnan.m4]) +m4_include([m4/isnanf.m4]) +m4_include([m4/isnanl.m4]) +m4_include([m4/ldexpl.m4]) m4_include([m4/localcharset.m4]) -m4_include([m4/longdouble.m4]) m4_include([m4/longlong.m4]) +m4_include([m4/lseek.m4]) +m4_include([m4/malloca.m4]) +m4_include([m4/math_h.m4]) m4_include([m4/mbrtowc.m4]) m4_include([m4/mbstate_t.m4]) m4_include([m4/mkdtemp.m4]) m4_include([m4/mkstemp.m4]) m4_include([m4/pathmax.m4]) +m4_include([m4/printf-frexp.m4]) +m4_include([m4/printf-frexpl.m4]) +m4_include([m4/printf.m4]) m4_include([m4/quotearg.m4]) m4_include([m4/regex.m4]) m4_include([m4/sig_atomic_t.m4]) +m4_include([m4/signal_h.m4]) m4_include([m4/signalblocking.m4]) +m4_include([m4/signbit.m4]) m4_include([m4/size_max.m4]) m4_include([m4/ssize_t.m4]) m4_include([m4/stdarg.m4]) @@ -904,6 +925,7 @@ m4_include([m4/stdbool.m4]) m4_include([m4/stdint.m4]) m4_include([m4/stdint_h.m4]) m4_include([m4/stdio-safer.m4]) +m4_include([m4/stdio_h.m4]) m4_include([m4/stdlib-safer.m4]) m4_include([m4/stdlib_h.m4]) m4_include([m4/strtol.m4]) @@ -916,6 +938,7 @@ m4_include([m4/unistd-safer.m4]) m4_include([m4/unistd_h.m4]) m4_include([m4/unlocked-io.m4]) m4_include([m4/vasnprintf.m4]) +m4_include([m4/vasprintf-posix.m4]) m4_include([m4/vasprintf.m4]) m4_include([m4/wchar.m4]) m4_include([m4/wchar_t.m4]) diff -ruNp m4-1.4.9/bootstrap m4-1.4.10/bootstrap --- m4-1.4.9/bootstrap 2007-03-02 19:32:22.000000000 -0700 +++ m4-1.4.10/bootstrap 2007-07-04 21:56:03.000000000 -0600 @@ -1,15 +1,15 @@ #! /bin/sh -# bootstrap (GNU M4) version 2006-09-21 +# bootstrap (GNU M4) version 2007-07-04 # Written by Gary V. Vaughan -# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2006, 2007 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 2 of the License, or +# 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 @@ -255,7 +255,7 @@ func_update "$gnulibdir"/build-aux/insta func_update "$gnulibdir"/build-aux/mdate-sh doc/mdate-sh func_update "$gnulibdir"/build-aux/missing missing func_update "$gnulibdir"/build-aux/texinfo.tex doc/texinfo.tex -func_update "$gnulibdir"/doc/COPYING COPYING +func_update "$gnulibdir"/doc/COPYINGv3 COPYING func_update "$gnulibdir"/doc/INSTALL INSTALL exit 0 diff -ruNp m4-1.4.9/checks/001.comments m4-1.4.10/checks/001.comments --- m4-1.4.9/checks/001.comments 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/001.comments 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:918: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -`quoted text' # `commented text' -dnl @result{}quoted text # `commented text' -`quoting inhibits' `#' `comments' -dnl @result{}quoting inhibits # comments diff -ruNp m4-1.4.9/checks/001.preprocess m4-1.4.10/checks/001.preprocess --- m4-1.4.9/checks/001.preprocess 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/001.preprocess 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,38 @@ +dnl @ ../doc/m4.texinfo:684: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -s +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`twoline', `1 +2') +dnl @result{}#line 2 "stdin" +dnl @result{} +changecom(`/*', `*/') +dnl @result{} +define(`comment', `/*1 +2*/') +dnl @result{}#line 5 +dnl @result{} +dnl no line +hello +dnl @result{}#line 7 +dnl @result{}hello +twoline +dnl @result{}1 +dnl @result{}#line 8 +dnl @result{}2 +comment +dnl @result{}/*1 +dnl @result{}2*/ +one comment `two +three' +dnl @result{}#line 10 +dnl @result{}one /*1 +dnl @result{}2*/ two +dnl @result{}three +goodbye +dnl @result{}#line 12 +dnl @result{}goodbye diff -ruNp m4-1.4.9/checks/002.command_li m4-1.4.10/checks/002.command_li --- m4-1.4.9/checks/002.command_li 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/002.command_li 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:888: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -Dbar=hello foo -Dbar=world foo +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +dnl @result{}hello +dnl @result{}world diff -ruNp m4-1.4.9/checks/002.input_proc m4-1.4.10/checks/002.input_proc --- m4-1.4.9/checks/002.input_proc 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/002.input_proc 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:1003: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changequote([,])dnl -define([gl_STRING_MODULE_INDICATOR], - [ - dnl comment - GNULIB_]translit([$1],[a-z],[A-Z])[=1 - ])dnl - gl_STRING_MODULE_INDICATOR([strcase]) -dnl @result{} -dnl @result{} GNULIB_strcase=1 -dnl @result{} diff -ruNp m4-1.4.9/checks/003.comments m4-1.4.10/checks/003.comments --- m4-1.4.9/checks/003.comments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/003.comments 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:983: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +`quoted text' # `commented text' +dnl @result{}quoted text # `commented text' +`quoting inhibits' `#' `comments' +dnl @result{}quoting inhibits # comments diff -ruNp m4-1.4.9/checks/003.input_proc m4-1.4.10/checks/003.input_proc --- m4-1.4.9/checks/003.input_proc 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/003.input_proc 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:1079: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changequote([,])dnl -define([gl_STRING_MODULE_INDICATOR], - [dnl comment - GNULIB_[]translit([$1], [a-z], [A-Z])=1dnl -])dnl - gl_STRING_MODULE_INDICATOR([strcase]) -dnl @result{} GNULIB_STRCASE=1 diff -ruNp m4-1.4.9/checks/004.inhibiting m4-1.4.10/checks/004.inhibiting --- m4-1.4.9/checks/004.inhibiting 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/004.inhibiting 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1204: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval -dnl @result{}eval -eval(`1') -dnl @result{}1 diff -ruNp m4-1.4.9/checks/004.input_proc m4-1.4.10/checks/004.input_proc --- m4-1.4.9/checks/004.input_proc 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/004.input_proc 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:1069: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changequote([,])dnl +define([gl_STRING_MODULE_INDICATOR], + [ + dnl comment + GNULIB_]translit([$1],[a-z],[A-Z])[=1 + ])dnl + gl_STRING_MODULE_INDICATOR([strcase]) +dnl @result{} +dnl @result{} GNULIB_strcase=1 +dnl @result{} diff -ruNp m4-1.4.9/checks/005.inhibiting m4-1.4.10/checks/005.inhibiting --- m4-1.4.9/checks/005.inhibiting 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/005.inhibiting 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1237: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -`divert' -dnl @result{}divert -`d'ivert -dnl @result{}divert -di`ver't -dnl @result{}divert -div`'ert -dnl @result{}divert diff -ruNp m4-1.4.9/checks/005.input_proc m4-1.4.10/checks/005.input_proc --- m4-1.4.9/checks/005.input_proc 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/005.input_proc 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:1145: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changequote([,])dnl +define([gl_STRING_MODULE_INDICATOR], + [dnl comment + GNULIB_[]translit([$1], [a-z], [A-Z])=1dnl +])dnl + gl_STRING_MODULE_INDICATOR([strcase]) +dnl @result{} GNULIB_STRCASE=1 diff -ruNp m4-1.4.9/checks/006.inhibiting m4-1.4.10/checks/006.inhibiting --- m4-1.4.9/checks/006.inhibiting 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/006.inhibiting 2007-07-05 08:26:40.000000000 -0600 @@ -1,11 +1,12 @@ -dnl @ ../doc/m4.texinfo:1251: Origin of test +dnl @ ../doc/m4.texinfo:1270: Origin of test dnl @ expected status: 0 +dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -`'divert -dnl @result{} -divert`' -dnl @result{} +eval +dnl @result{}eval +eval(`1') +dnl @result{}1 diff -ruNp m4-1.4.9/checks/007.inhibiting m4-1.4.10/checks/007.inhibiting --- m4-1.4.9/checks/007.inhibiting 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/007.inhibiting 2007-07-05 08:26:40.000000000 -0600 @@ -1,13 +1,16 @@ -dnl @ ../doc/m4.texinfo:1267: Origin of test +dnl @ ../doc/m4.texinfo:1286: Origin of test dnl @ expected status: 0 +dnl @ extra options: -P dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`x', `substr(ab') -dnl @result{} -define(`y', `cde, `3', `2')') -dnl @result{} -x`'y -dnl @result{}de +eval +dnl @result{}eval +eval(`1') +dnl @result{}eval(1) +m4_eval +dnl @result{}m4_eval +m4_eval(`1') +dnl @result{}1 diff -ruNp m4-1.4.9/checks/008.inhibiting m4-1.4.10/checks/008.inhibiting --- m4-1.4.9/checks/008.inhibiting 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/008.inhibiting 2007-07-05 08:26:40.000000000 -0600 @@ -1,13 +1,16 @@ -dnl @ ../doc/m4.texinfo:1280: Origin of test +dnl @ ../doc/m4.texinfo:1317: Origin of test dnl @ expected status: 0 +dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`macro', `m') -dnl @result{} -macro(`m')macro -dnl @result{}mmacro -macro(`m')`'macro -dnl @result{}mm +`divert' +dnl @result{}divert +`d'ivert +dnl @result{}divert +di`ver't +dnl @result{}divert +div`'ert +dnl @result{}divert diff -ruNp m4-1.4.9/checks/009.inhibiting m4-1.4.10/checks/009.inhibiting --- m4-1.4.9/checks/009.inhibiting 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/009.inhibiting 2007-07-05 08:26:40.000000000 -0600 @@ -1,13 +1,12 @@ -dnl @ ../doc/m4.texinfo:1292: Origin of test +dnl @ ../doc/m4.texinfo:1331: Origin of test dnl @ expected status: 0 +dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`macro', `di$1') +`'divert dnl @result{} -macro(`v')`ert' -dnl @result{}divert -macro(`v')ert +divert`' dnl @result{} diff -ruNp m4-1.4.9/checks/010.inhibiting m4-1.4.10/checks/010.inhibiting --- m4-1.4.9/checks/010.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/010.inhibiting 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1347: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`x', `substr(ab') +dnl @result{} +define(`y', `cde, `3', `2')') +dnl @result{} +x`'y +dnl @result{}de diff -ruNp m4-1.4.9/checks/010.macro_argu m4-1.4.10/checks/010.macro_argu --- m4-1.4.9/checks/010.macro_argu 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/010.macro_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,24 +0,0 @@ -dnl @ ../doc/m4.texinfo:1324: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`macro', `$1') -dnl @result{} -macro( unquoted leading space lost) -dnl @result{}unquoted leading space lost -macro(` quoted leading space kept') -dnl @result{} quoted leading space kept -macro( - divert `unquoted space kept after expansion') -dnl @result{} unquoted space kept after expansion -macro(macro(` -')`whitespace from expansion kept') -dnl @result{} -dnl @result{}whitespace from expansion kept -macro(`unquoted trailing whitespace kept' -) -dnl @result{}unquoted trailing whitespace kept -dnl @result{} diff -ruNp m4-1.4.9/checks/011.inhibiting m4-1.4.10/checks/011.inhibiting --- m4-1.4.9/checks/011.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/011.inhibiting 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1360: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`macro', `m') +dnl @result{} +macro(`m')macro +dnl @result{}mmacro +macro(`m')`'macro +dnl @result{}mm diff -ruNp m4-1.4.9/checks/011.macro_argu m4-1.4.10/checks/011.macro_argu --- m4-1.4.9/checks/011.macro_argu 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/011.macro_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:1372: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', `1') -dnl @result{} -f(define(`f', `2')) -dnl @result{}1 -f -dnl @result{}2 diff -ruNp m4-1.4.9/checks/012.inhibiting m4-1.4.10/checks/012.inhibiting --- m4-1.4.9/checks/012.inhibiting 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/012.inhibiting 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1372: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`macro', `di$1') +dnl @result{} +macro(`v')`ert' +dnl @result{}divert +macro(`v')ert +dnl @result{} diff -ruNp m4-1.4.9/checks/012.macro_argu m4-1.4.10/checks/012.macro_argu --- m4-1.4.9/checks/012.macro_argu 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/012.macro_argu 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1384: Origin of test -dnl @ expected status: 1 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -hello world -dnl @result{}hello world -define( -dnl @error{}m4:stdin:2: ERROR: end of file in argument list diff -ruNp m4-1.4.9/checks/013.macro_argu m4-1.4.10/checks/013.macro_argu --- m4-1.4.9/checks/013.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/013.macro_argu 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:1404: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`macro', `$1') +dnl @result{} +macro( unquoted leading space lost) +dnl @result{}unquoted leading space lost +macro(` quoted leading space kept') +dnl @result{} quoted leading space kept +macro( + divert `unquoted space kept after expansion') +dnl @result{} unquoted space kept after expansion +macro(macro(` +')`whitespace from expansion kept') +dnl @result{} +dnl @result{}whitespace from expansion kept +macro(`unquoted trailing whitespace kept' +) +dnl @result{}unquoted trailing whitespace kept +dnl @result{} diff -ruNp m4-1.4.9/checks/013.quoting_ar m4-1.4.10/checks/013.quoting_ar --- m4-1.4.9/checks/013.quoting_ar 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/013.quoting_ar 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:1443: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`active', `ACT, IVE') -dnl @result{} -define(`show', `$1 $1') -dnl @result{} -show(active) -dnl @result{}ACT ACT -show(`active') -dnl @result{}ACT, IVE ACT, IVE -show(``active'') -dnl @result{}active active diff -ruNp m4-1.4.9/checks/014.define m4-1.4.10/checks/014.define --- m4-1.4.9/checks/014.define 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/014.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1517: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello world.') -dnl @result{} -foo -dnl @result{}Hello world. diff -ruNp m4-1.4.9/checks/014.macro_argu m4-1.4.10/checks/014.macro_argu --- m4-1.4.9/checks/014.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/014.macro_argu 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:1432: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +index(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `index' +dnl @result{}0 +index(`abc',) +dnl @result{}0 +index(`abc', `b', `ignored') +dnl @error{}m4:stdin:3: Warning: excess arguments to builtin `index' ignored +dnl @result{}1 diff -ruNp m4-1.4.9/checks/015.define m4-1.4.10/checks/015.define --- m4-1.4.9/checks/015.define 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/015.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:1534: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(foo, one) -dnl @result{} -define(foo, two) -dnl @result{} -one -dnl @result{}two diff -ruNp m4-1.4.9/checks/015.macro_argu m4-1.4.10/checks/015.macro_argu --- m4-1.4.9/checks/015.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/015.macro_argu 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1445: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -Q +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +index(`abc') +dnl @result{}0 +index(`abc',) +dnl @result{}0 +index(`abc', `b', `ignored') +dnl @result{}1 diff -ruNp m4-1.4.9/checks/016.define m4-1.4.10/checks/016.define --- m4-1.4.9/checks/016.define 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/016.define 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:1568: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`array', `defn(format(``array[%d]'', `$1'))') -dnl @result{} -define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') -dnl @result{} -array_set(`4', `array element no. 4') -dnl @result{} -array_set(`17', `array element no. 17') -dnl @result{} -array(`4') -dnl @result{}array element no. 4 -array(eval(`10 + 7')) -dnl @result{}array element no. 17 diff -ruNp m4-1.4.9/checks/016.macro_argu m4-1.4.10/checks/016.macro_argu --- m4-1.4.9/checks/016.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/016.macro_argu 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1475: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', `1') +dnl @result{} +f(define(`f', `2')) +dnl @result{}1 +f +dnl @result{}2 diff -ruNp m4-1.4.9/checks/017.arguments m4-1.4.10/checks/017.arguments --- m4-1.4.9/checks/017.arguments 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/017.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1602: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', `$2, $1') -dnl @result{} -exch(`arg1', `arg2') -dnl @result{}arg2, arg1 diff -ruNp m4-1.4.9/checks/017.macro_argu m4-1.4.10/checks/017.macro_argu --- m4-1.4.9/checks/017.macro_argu 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/017.macro_argu 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1487: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +hello world +dnl @result{}hello world +define( +dnl @error{}m4:stdin:2: ERROR: end of file in argument list diff -ruNp m4-1.4.9/checks/018.arguments m4-1.4.10/checks/018.arguments --- m4-1.4.9/checks/018.arguments 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/018.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:1612: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', `$2, $1') -dnl @result{} -define(exch(``expansion text'', ``macro'')) -dnl @result{} -macro -dnl @result{}expansion text diff -ruNp m4-1.4.9/checks/018.quoting_ar m4-1.4.10/checks/018.quoting_ar --- m4-1.4.9/checks/018.quoting_ar 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/018.quoting_ar 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:1546: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`active', `ACT, IVE') +dnl @result{} +define(`show', `$1 $1') +dnl @result{} +show(active) +dnl @result{}ACT ACT +show(`active') +dnl @result{}ACT, IVE ACT, IVE +show(``active'') +dnl @result{}active active diff -ruNp m4-1.4.9/checks/019.arguments m4-1.4.10/checks/019.arguments --- m4-1.4.9/checks/019.arguments 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/019.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1628: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`test', ``Macro name: $0'') -dnl @result{} -test -dnl @result{}Macro name: test diff -ruNp m4-1.4.9/checks/019.macro_expa m4-1.4.10/checks/019.macro_expa --- m4-1.4.9/checks/019.macro_expa 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/019.macro_expa 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:1574: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -Dbar=Hello -Dfoo=bar +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +foo +dnl @result{}Hello diff -ruNp m4-1.4.9/checks/020.arguments m4-1.4.10/checks/020.arguments --- m4-1.4.9/checks/020.arguments 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/020.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1638: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `This is macro `foo'.') -dnl @result{} -foo -dnl @result{}This is macro foo. diff -ruNp m4-1.4.9/checks/020.define m4-1.4.10/checks/020.define --- m4-1.4.9/checks/020.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/020.define 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1622: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Hello world.') +dnl @result{} +foo +dnl @result{}Hello world. diff -ruNp m4-1.4.9/checks/021.arguments m4-1.4.10/checks/021.arguments --- m4-1.4.9/checks/021.arguments 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/021.arguments 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1673: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `single quoted $`'{1} output') -dnl @result{} -define(`bar', ``double quoted $'`{2} output'') -dnl @result{} -foo(`a', `b') -dnl @result{}single quoted ${1} output -bar(`a', `b') -dnl @result{}double quoted ${2} output diff -ruNp m4-1.4.9/checks/021.define m4-1.4.10/checks/021.define --- m4-1.4.9/checks/021.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/021.define 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1639: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(foo, one) +dnl @result{} +define(foo, two) +dnl @result{} +one +dnl @result{}two diff -ruNp m4-1.4.9/checks/022.define m4-1.4.10/checks/022.define --- m4-1.4.9/checks/022.define 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/022.define 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:1673: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`array', `defn(format(``array[%d]'', `$1'))') +dnl @result{} +define(`array_set', `define(format(``array[%d]'', `$1'), `$2')') +dnl @result{} +array_set(`4', `array element no. 4') +dnl @result{} +array_set(`17', `array element no. 17') +dnl @result{} +array(`4') +dnl @result{}array element no. 4 +array(eval(`10 + 7')) +dnl @result{}array element no. 17 diff -ruNp m4-1.4.9/checks/022.pseudo_arg m4-1.4.10/checks/022.pseudo_arg --- m4-1.4.9/checks/022.pseudo_arg 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/022.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,22 +0,0 @@ -dnl @ ../doc/m4.texinfo:1721: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`nargs', `$#') -dnl @result{} -nargs -dnl @result{}0 -nargs() -dnl @result{}1 -nargs(`arg1', `arg2', `arg3') -dnl @result{}3 -nargs(`commas can be quoted, like this') -dnl @result{}1 -nargs(arg1#inside comments, commas do not separate arguments -still arg1) -dnl @result{}1 -nargs((unquoted parentheses, like this, group arguments)) -dnl @result{}1 diff -ruNp m4-1.4.9/checks/023.arguments m4-1.4.10/checks/023.arguments --- m4-1.4.9/checks/023.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/023.arguments 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1707: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`exch', `$2, $1') +dnl @result{} +exch(`arg1', `arg2') +dnl @result{}arg2, arg1 diff -ruNp m4-1.4.9/checks/023.pseudo_arg m4-1.4.10/checks/023.pseudo_arg --- m4-1.4.9/checks/023.pseudo_arg 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/023.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:1743: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl Attempt to define a macro to just `$#' -define(underquoted, $#) -oops) -dnl @result{} -underquoted -dnl @result{}0) -dnl @result{}oops diff -ruNp m4-1.4.9/checks/024.arguments m4-1.4.10/checks/024.arguments --- m4-1.4.9/checks/024.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/024.arguments 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:1717: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`exch', `$2, $1') +dnl @result{} +define(exch(``expansion text'', ``macro'')) +dnl @result{} +macro +dnl @result{}expansion text diff -ruNp m4-1.4.9/checks/024.pseudo_arg m4-1.4.10/checks/024.pseudo_arg --- m4-1.4.9/checks/024.pseudo_arg 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/024.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1756: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$*') -dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.9/checks/025.arguments m4-1.4.10/checks/025.arguments --- m4-1.4.9/checks/025.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/025.arguments 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1733: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`test', ``Macro name: $0'') +dnl @result{} +test +dnl @result{}Macro name: test diff -ruNp m4-1.4.9/checks/025.pseudo_arg m4-1.4.10/checks/025.pseudo_arg --- m4-1.4.9/checks/025.pseudo_arg 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/025.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:1767: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$@') -dnl @result{} -echo(arg1, arg2, arg3 , arg4) -dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.9/checks/026.arguments m4-1.4.10/checks/026.arguments --- m4-1.4.9/checks/026.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/026.arguments 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1743: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `This is macro `foo'.') +dnl @result{} +foo +dnl @result{}This is macro foo. diff -ruNp m4-1.4.9/checks/026.pseudo_arg m4-1.4.10/checks/026.pseudo_arg --- m4-1.4.9/checks/026.pseudo_arg 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/026.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:1777: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo1', `$*') -dnl @result{} -define(`echo2', `$@') -dnl @result{} -define(`foo', `This is macro `foo'.') -dnl @result{} -echo1(foo) -dnl @result{}This is macro This is macro foo.. -echo1(`foo') -dnl @result{}This is macro foo. -echo2(foo) -dnl @result{}This is macro foo. -echo2(`foo') -dnl @result{}foo diff -ruNp m4-1.4.9/checks/027.arguments m4-1.4.10/checks/027.arguments --- m4-1.4.9/checks/027.arguments 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/027.arguments 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:1778: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `single quoted $`'{1} output') +dnl @result{} +define(`bar', ``double quoted $'`{2} output'') +dnl @result{} +foo(`a', `b') +dnl @result{}single quoted ${1} output +bar(`a', `b') +dnl @result{}double quoted ${2} output diff -ruNp m4-1.4.9/checks/027.pseudo_arg m4-1.4.10/checks/027.pseudo_arg --- m4-1.4.9/checks/027.pseudo_arg 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/027.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:1799: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo1', `$*') -dnl @result{} -define(`echo2', `$@') -dnl @result{} -define(`foo', `bar') -dnl @result{} -echo1(#foo'foo -foo) -dnl @result{}#foo'foo -dnl @result{}bar -echo2(#foo'foo -foo) -dnl @result{}#foobar -dnl @result{}bar' diff -ruNp m4-1.4.9/checks/028.pseudo_arg m4-1.4.10/checks/028.pseudo_arg --- m4-1.4.9/checks/028.pseudo_arg 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/028.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 @@ -1,11 +1,23 @@ -dnl @ ../doc/m4.texinfo:1820: Origin of test +dnl @ ../doc/m4.texinfo:1826: Origin of test dnl @ expected status: 0 +dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', `$$$ hello $$$') +define(`nargs', `$#') dnl @result{} -foo -dnl @result{}$$$ hello $$$ +nargs +dnl @result{}0 +nargs() +dnl @result{}1 +nargs(`arg1', `arg2', `arg3') +dnl @result{}3 +nargs(`commas can be quoted, like this') +dnl @result{}1 +nargs(arg1#inside comments, commas do not separate arguments +still arg1) +dnl @result{}1 +nargs((unquoted parentheses, like this, group arguments)) +dnl @result{}1 diff -ruNp m4-1.4.9/checks/029.pseudo_arg m4-1.4.10/checks/029.pseudo_arg --- m4-1.4.9/checks/029.pseudo_arg 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/029.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 @@ -1,27 +1,15 @@ -dnl @ ../doc/m4.texinfo:1836: Origin of test +dnl @ ../doc/m4.texinfo:1848: Origin of test dnl @ expected status: 0 +dnl @ extra options: dnl @ Copyright (C) 2006, 2007 Free Software Foundation dnl @ This file is free software; the Free Software Foundation dnl @ gives unlimited permission to copy and/or distribute it dnl @ with or without modifications, as long as this notice dnl @ is preserved. -define(`foo', `no nested quote: $1') +dnl Attempt to define a macro to just `$#' +define(underquoted, $#) +oops) dnl @result{} -foo(`arg') -dnl @result{}no nested quote: arg -define(`foo', `nested quote around $: `$'1') -dnl @result{} -foo(`arg') -dnl @result{}nested quote around $: $1 -define(`foo', `nested empty quote after $: $`'1') -dnl @result{} -foo(`arg') -dnl @result{}nested empty quote after $: $1 -define(`foo', `nested quote around next character: $`1'') -dnl @result{} -foo(`arg') -dnl @result{}nested quote around next character: $1 -define(`foo', `nested quote around both: `$1'') -dnl @result{} -foo(`arg') -dnl @result{}nested quote around both: arg +underquoted +dnl @result{}0) +dnl @result{}oops diff -ruNp m4-1.4.9/checks/030.pseudo_arg m4-1.4.10/checks/030.pseudo_arg --- m4-1.4.9/checks/030.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/030.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1861: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$*') +dnl @result{} +echo(arg1, arg2, arg3 , arg4) +dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.9/checks/030.undefine m4-1.4.10/checks/030.undefine --- m4-1.4.9/checks/030.undefine 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/030.undefine 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:1875: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -foo bar blah -dnl @result{}foo bar blah -define(`foo', `some')define(`bar', `other')define(`blah', `text') -dnl @result{} -foo bar blah -dnl @result{}some other text -undefine(`foo') -dnl @result{} -foo bar blah -dnl @result{}foo other text -undefine(`bar', `blah') -dnl @result{} -foo bar blah -dnl @result{}foo bar blah diff -ruNp m4-1.4.9/checks/031.pseudo_arg m4-1.4.10/checks/031.pseudo_arg --- m4-1.4.9/checks/031.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/031.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1872: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$@') +dnl @result{} +echo(arg1, arg2, arg3 , arg4) +dnl @result{}arg1,arg2,arg3 ,arg4 diff -ruNp m4-1.4.9/checks/031.undefine m4-1.4.10/checks/031.undefine --- m4-1.4.9/checks/031.undefine 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/031.undefine 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:1895: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', ``$0':$1') -dnl @result{} -f(f(f(undefine(`f')`hello world'))) -dnl @result{}f:f:f:hello world -f(`bye') -dnl @result{}f(bye) diff -ruNp m4-1.4.9/checks/032.defn m4-1.4.10/checks/032.defn --- m4-1.4.9/checks/032.defn 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/032.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:1934: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`zap', defn(`undefine')) -dnl @result{} -zap(`undefine') -dnl @result{} -undefine(`zap') -dnl @result{}undefine(zap) diff -ruNp m4-1.4.9/checks/032.pseudo_arg m4-1.4.10/checks/032.pseudo_arg --- m4-1.4.9/checks/032.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/032.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:1882: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo1', `$*') +dnl @result{} +define(`echo2', `$@') +dnl @result{} +define(`foo', `This is macro `foo'.') +dnl @result{} +echo1(foo) +dnl @result{}This is macro This is macro foo.. +echo1(`foo') +dnl @result{}This is macro foo. +echo2(foo) +dnl @result{}This is macro foo. +echo2(`foo') +dnl @result{}foo diff -ruNp m4-1.4.9/checks/033.defn m4-1.4.10/checks/033.defn --- m4-1.4.9/checks/033.defn 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/033.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:1951: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `This is `$0'') -dnl @result{} -define(`bar', defn(`foo')) -dnl @result{} -bar -dnl @result{}This is bar diff -ruNp m4-1.4.9/checks/033.pseudo_arg m4-1.4.10/checks/033.pseudo_arg --- m4-1.4.9/checks/033.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/033.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:1904: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo1', `$*') +dnl @result{} +define(`echo2', `$@') +dnl @result{} +define(`foo', `bar') +dnl @result{} +echo1(#foo'foo +foo) +dnl @result{}#foo'foo +dnl @result{}bar +echo2(#foo'foo +foo) +dnl @result{}#foobar +dnl @result{}bar' diff -ruNp m4-1.4.9/checks/034.defn m4-1.4.10/checks/034.defn --- m4-1.4.9/checks/034.defn 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/034.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:1963: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`string', `The macro dnl is very useful -') -dnl @result{} -string -dnl @result{}The macro -defn(`string') -dnl @result{}The macro dnl is very useful -dnl @result{} diff -ruNp m4-1.4.9/checks/034.pseudo_arg m4-1.4.10/checks/034.pseudo_arg --- m4-1.4.9/checks/034.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/034.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:1925: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `$$$ hello $$$') +dnl @result{} +foo +dnl @result{}$$$ hello $$$ diff -ruNp m4-1.4.9/checks/035.defn m4-1.4.10/checks/035.defn --- m4-1.4.9/checks/035.defn 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/035.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:1982: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', a'a) -dnl @result{} -define(`a', `A') -dnl @result{} -define(`echo', `$@') -dnl @result{} -foo -dnl @result{}A'A -defn(`foo') -dnl @result{}aA' -echo(foo) -dnl @result{}AA' diff -ruNp m4-1.4.9/checks/035.pseudo_arg m4-1.4.10/checks/035.pseudo_arg --- m4-1.4.9/checks/035.pseudo_arg 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/035.pseudo_arg 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:1941: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `no nested quote: $1') +dnl @result{} +foo(`arg') +dnl @result{}no nested quote: arg +define(`foo', `nested quote around $: `$'1') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around $: $1 +define(`foo', `nested empty quote after $: $`'1') +dnl @result{} +foo(`arg') +dnl @result{}nested empty quote after $: $1 +define(`foo', `nested quote around next character: $`1'') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around next character: $1 +define(`foo', `nested quote around both: `$1'') +dnl @result{} +foo(`arg') +dnl @result{}nested quote around both: arg diff -ruNp m4-1.4.9/checks/036.defn m4-1.4.10/checks/036.defn --- m4-1.4.9/checks/036.defn 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/036.defn 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2003: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -defn(`defn') -dnl @result{} -define(defn(`divnum'), `cannot redefine a builtin token') -dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored -dnl @result{} -divnum -dnl @result{}0 diff -ruNp m4-1.4.9/checks/036.undefine m4-1.4.10/checks/036.undefine --- m4-1.4.9/checks/036.undefine 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/036.undefine 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:1980: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +foo bar blah +dnl @result{}foo bar blah +define(`foo', `some')define(`bar', `other')define(`blah', `text') +dnl @result{} +foo bar blah +dnl @result{}some other text +undefine(`foo') +dnl @result{} +foo bar blah +dnl @result{}foo other text +undefine(`bar', `blah') +dnl @result{} +foo bar blah +dnl @result{}foo bar blah diff -ruNp m4-1.4.9/checks/037.pushdef m4-1.4.10/checks/037.pushdef --- m4-1.4.9/checks/037.pushdef 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/037.pushdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -dnl @ ../doc/m4.texinfo:2044: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Expansion one.') -dnl @result{} -foo -dnl @result{}Expansion one. -pushdef(`foo', `Expansion two.') -dnl @result{} -foo -dnl @result{}Expansion two. -pushdef(`foo', `Expansion three.') -dnl @result{} -pushdef(`foo', `Expansion four.') -dnl @result{} -popdef(`foo') -dnl @result{} -foo -dnl @result{}Expansion three. -popdef(`foo', `foo') -dnl @result{} -foo -dnl @result{}Expansion one. -popdef(`foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.9/checks/037.undefine m4-1.4.10/checks/037.undefine --- m4-1.4.9/checks/037.undefine 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/037.undefine 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2000: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', ``$0':$1') +dnl @result{} +f(f(f(undefine(`f')`hello world'))) +dnl @result{}f:f:f:hello world +f(`bye') +dnl @result{}f(bye) diff -ruNp m4-1.4.9/checks/038.defn m4-1.4.10/checks/038.defn --- m4-1.4.9/checks/038.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/038.defn 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2039: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`zap', defn(`undefine')) +dnl @result{} +zap(`undefine') +dnl @result{} +undefine(`zap') +dnl @result{}undefine(zap) diff -ruNp m4-1.4.9/checks/038.pushdef m4-1.4.10/checks/038.pushdef --- m4-1.4.9/checks/038.pushdef 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/038.pushdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -dnl @ ../doc/m4.texinfo:2081: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Expansion one.') -dnl @result{} -foo -dnl @result{}Expansion one. -pushdef(`foo', `Expansion two.') -dnl @result{} -foo -dnl @result{}Expansion two. -define(`foo', `Second expansion two.') -dnl @result{} -foo -dnl @result{}Second expansion two. -undefine(`foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.9/checks/039.defn m4-1.4.10/checks/039.defn --- m4-1.4.9/checks/039.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/039.defn 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2056: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `This is `$0'') +dnl @result{} +define(`bar', defn(`foo')) +dnl @result{} +bar +dnl @result{}This is bar diff -ruNp m4-1.4.9/checks/039.indir m4-1.4.10/checks/039.indir --- m4-1.4.9/checks/039.indir 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/039.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2130: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`$$internal$macro', `Internal macro (name `$0')') -dnl @result{} -$$internal$macro -dnl @result{}$$internal$macro -indir(`$$internal$macro') -dnl @result{}Internal macro (name $$internal$macro) diff -ruNp m4-1.4.9/checks/040.defn m4-1.4.10/checks/040.defn --- m4-1.4.9/checks/040.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/040.defn 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2068: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`string', `The macro dnl is very useful +') +dnl @result{} +string +dnl @result{}The macro +defn(`string') +dnl @result{}The macro dnl is very useful +dnl @result{} diff -ruNp m4-1.4.9/checks/040.indir m4-1.4.10/checks/040.indir --- m4-1.4.9/checks/040.indir 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/040.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2150: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', `1') -dnl @result{} -f(define(`f', `2')) -dnl @result{}1 -indir(`f', define(`f', `3')) -dnl @result{}3 -indir(`f', undefine(`f')) -dnl @error{}m4:stdin:4: undefined macro `f' -dnl @result{} diff -ruNp m4-1.4.9/checks/041.defn m4-1.4.10/checks/041.defn --- m4-1.4.9/checks/041.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/041.defn 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:2087: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', a'a) +dnl @result{} +define(`a', `A') +dnl @result{} +define(`echo', `$@') +dnl @result{} +foo +dnl @result{}A'A +defn(`foo') +dnl @result{}aA' +echo(foo) +dnl @result{}AA' diff -ruNp m4-1.4.9/checks/041.indir m4-1.4.10/checks/041.indir --- m4-1.4.9/checks/041.indir 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/041.indir 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:2167: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -indir(defn(`defn'), `divnum') -dnl @error{}m4:stdin:1: Warning: indir: invalid macro name ignored -dnl @result{} -indir(`define', defn(`defn'), `divnum') -dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored -dnl @result{} -indir(`define', `foo', defn(`divnum')) -dnl @result{} -foo -dnl @result{}0 -indir(`divert', defn(`foo')) -dnl @error{}m4:stdin:5: empty string treated as 0 in builtin `divert' -dnl @result{} diff -ruNp m4-1.4.9/checks/042.builtin m4-1.4.10/checks/042.builtin --- m4-1.4.9/checks/042.builtin 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/042.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -dnl @ ../doc/m4.texinfo:2204: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -pushdef(`define', `hidden') -dnl @result{} -undefine(`undefine') -dnl @result{} -define(`foo', `bar') -dnl @result{}hidden -foo -dnl @result{}foo -builtin(`define', `foo', defn(`divnum')) -dnl @result{} -foo -dnl @result{}0 -builtin(`define', `foo', `BAR') -dnl @result{} -foo -dnl @result{}BAR -undefine(`foo') -dnl @result{}undefine(foo) -foo -dnl @result{}BAR -builtin(`undefine', `foo') -dnl @result{} -foo -dnl @result{}foo diff -ruNp m4-1.4.9/checks/042.defn m4-1.4.10/checks/042.defn --- m4-1.4.9/checks/042.defn 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/042.defn 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:2108: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +defn(`defn') +dnl @result{} +define(defn(`divnum'), `cannot redefine a builtin token') +dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +dnl @result{} +divnum +dnl @result{}0 diff -ruNp m4-1.4.9/checks/043.builtin m4-1.4.10/checks/043.builtin --- m4-1.4.9/checks/043.builtin 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/043.builtin 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:2240: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -builtin -dnl @result{}builtin -builtin() -dnl @error{}m4:stdin:2: undefined builtin `' -dnl @result{} -builtin(`builtin') -dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' -dnl @result{} -builtin(`builtin',) -dnl @error{}m4:stdin:4: undefined builtin `' -dnl @result{} diff -ruNp m4-1.4.9/checks/043.pushdef m4-1.4.10/checks/043.pushdef --- m4-1.4.9/checks/043.pushdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/043.pushdef 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:2149: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Expansion one.') +dnl @result{} +foo +dnl @result{}Expansion one. +pushdef(`foo', `Expansion two.') +dnl @result{} +foo +dnl @result{}Expansion two. +pushdef(`foo', `Expansion three.') +dnl @result{} +pushdef(`foo', `Expansion four.') +dnl @result{} +popdef(`foo') +dnl @result{} +foo +dnl @result{}Expansion three. +popdef(`foo', `foo') +dnl @result{} +foo +dnl @result{}Expansion one. +popdef(`foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.9/checks/044.ifdef m4-1.4.10/checks/044.ifdef --- m4-1.4.9/checks/044.ifdef 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/044.ifdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2287: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`foo', ``foo' is defined', ``foo' is not defined') -dnl @result{}foo is not defined -define(`foo', `') -dnl @result{} -ifdef(`foo', ``foo' is defined', ``foo' is not defined') -dnl @result{}foo is defined -ifdef(`no_such_macro', `yes', `no', `extra argument') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored -dnl @result{}no diff -ruNp m4-1.4.9/checks/044.pushdef m4-1.4.10/checks/044.pushdef --- m4-1.4.9/checks/044.pushdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/044.pushdef 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:2186: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Expansion one.') +dnl @result{} +foo +dnl @result{}Expansion one. +pushdef(`foo', `Expansion two.') +dnl @result{} +foo +dnl @result{}Expansion two. +define(`foo', `Second expansion two.') +dnl @result{} +foo +dnl @result{}Second expansion two. +undefine(`foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.9/checks/045.ifelse m4-1.4.10/checks/045.ifelse --- m4-1.4.9/checks/045.ifelse 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/045.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:2335: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`some comments') -dnl @result{} -ifelse(`foo', `bar') -dnl @error{}m4:stdin:2: Warning: too few arguments to builtin `ifelse' -dnl @result{} diff -ruNp m4-1.4.9/checks/045.indir m4-1.4.10/checks/045.indir --- m4-1.4.9/checks/045.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/045.indir 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2235: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`$$internal$macro', `Internal macro (name `$0')') +dnl @result{} +$$internal$macro +dnl @result{}$$internal$macro +indir(`$$internal$macro') +dnl @result{}Internal macro (name $$internal$macro) diff -ruNp m4-1.4.9/checks/046.ifelse m4-1.4.10/checks/046.ifelse --- m4-1.4.9/checks/046.ifelse 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/046.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2345: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`foo', `bar', `true') -dnl @result{} -ifelse(`foo', `foo', `true') -dnl @result{}true -define(`foo', `bar') -dnl @result{} -ifelse(foo, `bar', `true', `false') -dnl @result{}true -ifelse(foo, `foo', `true', `false') -dnl @result{}false diff -ruNp m4-1.4.9/checks/046.indir m4-1.4.10/checks/046.indir --- m4-1.4.9/checks/046.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/046.indir 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2255: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', `1') +dnl @result{} +f(define(`f', `2')) +dnl @result{}1 +indir(`f', define(`f', `3')) +dnl @result{}3 +indir(`f', undefine(`f')) +dnl @error{}m4:stdin:4: undefined macro `f' +dnl @result{} diff -ruNp m4-1.4.9/checks/047.ifelse m4-1.4.10/checks/047.ifelse --- m4-1.4.9/checks/047.ifelse 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/047.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:2365: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') -dnl @result{} -foo -dnl @result{}foo -foo() -dnl @result{}arguments:1 -foo(`a', `b', `c') -dnl @result{}arguments:3 diff -ruNp m4-1.4.9/checks/047.indir m4-1.4.10/checks/047.indir --- m4-1.4.9/checks/047.indir 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/047.indir 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,21 @@ +dnl @ ../doc/m4.texinfo:2273: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +indir(defn(`defn'), `divnum') +dnl @error{}m4:stdin:1: Warning: indir: invalid macro name ignored +dnl @result{} +indir(`define', defn(`defn'), `divnum') +dnl @error{}m4:stdin:2: Warning: define: invalid macro name ignored +dnl @result{} +indir(`define', `foo', defn(`divnum')) +dnl @result{} +foo +dnl @result{}0 +indir(`divert', defn(`foo')) +dnl @error{}m4:stdin:5: empty string treated as 0 in builtin `divert' +dnl @result{} diff -ruNp m4-1.4.9/checks/048.builtin m4-1.4.10/checks/048.builtin --- m4-1.4.9/checks/048.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/048.builtin 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:2311: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +pushdef(`define', `hidden') +dnl @result{} +undefine(`undefine') +dnl @result{} +define(`foo', `bar') +dnl @result{}hidden +foo +dnl @result{}foo +builtin(`define', `foo', defn(`divnum')) +dnl @result{} +foo +dnl @result{}0 +builtin(`define', `foo', `BAR') +dnl @result{} +foo +dnl @result{}BAR +undefine(`foo') +dnl @result{}undefine(foo) +foo +dnl @result{}BAR +builtin(`undefine', `foo') +dnl @result{} +foo +dnl @result{}foo diff -ruNp m4-1.4.9/checks/048.ifelse m4-1.4.10/checks/048.ifelse --- m4-1.4.9/checks/048.ifelse 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/048.ifelse 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2386: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifelse(`foo', `bar', `third', `gnu', `gnats') -dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored -dnl @result{}gnu -ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') -dnl @result{} -ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') -dnl @result{}seventh -ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored -dnl @result{}7 diff -ruNp m4-1.4.9/checks/049.builtin m4-1.4.10/checks/049.builtin --- m4-1.4.9/checks/049.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/049.builtin 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2344: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -P +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4_builtin(`divnum') +dnl @result{}0 +m4_builtin(`m4_divnum') +dnl @error{}m4:stdin:2: undefined builtin `m4_divnum' +dnl @result{} +m4_indir(`divnum') +dnl @error{}m4:stdin:3: undefined macro `divnum' +dnl @result{} +m4_indir(`m4_divnum') +dnl @result{}0 diff -ruNp m4-1.4.9/checks/049.shift m4-1.4.10/checks/049.shift --- m4-1.4.9/checks/049.shift 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/049.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:2426: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -shift -dnl @result{}shift -shift(`bar') -dnl @result{} -shift(`foo', `bar', `baz') -dnl @result{}bar,baz diff -ruNp m4-1.4.9/checks/050.builtin m4-1.4.10/checks/050.builtin --- m4-1.4.9/checks/050.builtin 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/050.builtin 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:2362: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +builtin +dnl @result{}builtin +builtin() +dnl @error{}m4:stdin:2: undefined builtin `' +dnl @result{} +builtin(`builtin') +dnl @error{}m4:stdin:3: Warning: too few arguments to builtin `builtin' +dnl @result{} +builtin(`builtin',) +dnl @error{}m4:stdin:4: undefined builtin `' +dnl @result{} diff -ruNp m4-1.4.9/checks/050.shift m4-1.4.10/checks/050.shift --- m4-1.4.9/checks/050.shift 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/050.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2443: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', - `reverse(shift($@)), `$1'')') -dnl @result{} -reverse -dnl @result{} -reverse(`foo') -dnl @result{}foo -reverse(`foo', `bar', `gnats', `and gnus') -dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.9/checks/051.ifdef m4-1.4.10/checks/051.ifdef --- m4-1.4.9/checks/051.ifdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/051.ifdef 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2409: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`foo', ``foo' is defined', ``foo' is not defined') +dnl @result{}foo is not defined +define(`foo', `') +dnl @result{} +ifdef(`foo', ``foo' is defined', ``foo' is not defined') +dnl @result{}foo is defined +ifdef(`no_such_macro', `yes', `no', `extra argument') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored +dnl @result{}no diff -ruNp m4-1.4.9/checks/051.shift m4-1.4.10/checks/051.shift --- m4-1.4.9/checks/051.shift 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/051.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,24 +0,0 @@ -dnl @ ../doc/m4.texinfo:2475: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`quote.m4') -dnl @result{} --quote-dquote-dquote_elt- -dnl @result{}---- --quote()-dquote()-dquote_elt()- -dnl @result{}--`'-`'- --quote(`1')-dquote(`1')-dquote_elt(`1')- -dnl @result{}-1-`1'-`1'- --quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- -dnl @result{}-1,2-`1',`2'-`1',`2'- -define(`n', `$#')dnl --n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- -dnl @result{}-1-1-2- -dquote(dquote_elt(`1', `2')) -dnl @result{}``1'',``2'' -dquote_elt(dquote(`1', `2')) -dnl @result{}``1',`2'' diff -ruNp m4-1.4.9/checks/052.ifelse m4-1.4.10/checks/052.ifelse --- m4-1.4.9/checks/052.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/052.ifelse 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:2457: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`some comments') +dnl @result{} +ifelse(`foo', `bar') +dnl @error{}m4:stdin:2: Warning: too few arguments to builtin `ifelse' +dnl @result{} diff -ruNp m4-1.4.9/checks/052.shift m4-1.4.10/checks/052.shift --- m4-1.4.9/checks/052.shift 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/052.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2506: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`quote.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# quote(args) - convert args to single-quoted string -dnl @result{}define(`quote', `ifelse(`$#', `0', `', ``$*'')') -dnl @result{}# dquote(args) - convert args to quoted list of quoted strings -dnl @result{}define(`dquote', ``$@'') -dnl @result{}# dquote_elt(args) - convert args to list of double-quoted strings -dnl @result{}define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', -dnl @result{} ```$1'',$0(shift($@))')') -dnl @result{}divert`'dnl diff -ruNp m4-1.4.9/checks/053.ifelse m4-1.4.10/checks/053.ifelse --- m4-1.4.9/checks/053.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/053.ifelse 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2467: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`foo', `bar', `true') +dnl @result{} +ifelse(`foo', `foo', `true') +dnl @result{}true +define(`foo', `bar') +dnl @result{} +ifelse(foo, `bar', `true', `false') +dnl @result{}true +ifelse(foo, `foo', `true', `false') +dnl @result{}false diff -ruNp m4-1.4.9/checks/053.shift m4-1.4.10/checks/053.shift --- m4-1.4.9/checks/053.shift 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/053.shift 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2535: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`argn', `ifelse(`$1', 1, ``$2'', - `argn(decr(`$1'), shift(shift($@)))')') -dnl @result{} -argn(`1', `a') -dnl @result{}a -define(`foo', `argn(`11', $@)') -dnl @result{} -foo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l') -dnl @result{}k diff -ruNp m4-1.4.9/checks/054.forloop m4-1.4.10/checks/054.forloop --- m4-1.4.9/checks/054.forloop 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/054.forloop 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:2566: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`forloop.m4') -dnl @result{} -forloop(`i', `1', `8', `i ') -dnl @result{}1 2 3 4 5 6 7 8 diff -ruNp m4-1.4.9/checks/054.ifelse m4-1.4.10/checks/054.ifelse --- m4-1.4.9/checks/054.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/054.ifelse 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2487: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') +dnl @result{} +foo +dnl @result{}foo +foo() +dnl @result{}arguments:1 +foo(`a', `b', `c') +dnl @result{}arguments:3 diff -ruNp m4-1.4.9/checks/055.forloop m4-1.4.10/checks/055.forloop --- m4-1.4.9/checks/055.forloop 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/055.forloop 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2575: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`forloop.m4') -dnl @result{} -forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') -') -dnl @result{} (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) -dnl @result{} (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) -dnl @result{} (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) -dnl @result{} (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) -dnl @result{} diff -ruNp m4-1.4.9/checks/055.ifelse m4-1.4.10/checks/055.ifelse --- m4-1.4.9/checks/055.ifelse 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/055.ifelse 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2508: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`foo', `bar', `third', `gnu', `gnats') +dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored +dnl @result{}gnu +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') +dnl @result{} +ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') +dnl @result{}seventh +ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored +dnl @result{}7 diff -ruNp m4-1.4.9/checks/056.forloop m4-1.4.10/checks/056.forloop --- m4-1.4.9/checks/056.forloop 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/056.forloop 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:2601: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`forloop.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# forloop(var, from, to, stmt) - simple version -dnl @result{}define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') -dnl @result{}define(`_forloop', -dnl @result{} `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') -dnl @result{}divert`'dnl diff -ruNp m4-1.4.9/checks/056.shift m4-1.4.10/checks/056.shift --- m4-1.4.9/checks/056.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/056.shift 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:2548: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +shift +dnl @result{}shift +shift(`bar') +dnl @result{} +shift(`foo', `bar', `baz') +dnl @result{}bar,baz diff -ruNp m4-1.4.9/checks/057.foreach m4-1.4.10/checks/057.foreach --- m4-1.4.9/checks/057.foreach 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/057.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:2646: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreach.m4') -dnl @result{} -foreach(`x', (foo, bar, foobar), `Word was: x -')dnl -dnl @result{}Word was: foo -dnl @result{}Word was: bar -dnl @result{}Word was: foobar -include(`foreachq.m4') -dnl @result{} -foreachq(`x', `foo, bar, foobar', `Word was: x -')dnl -dnl @result{}Word was: foo -dnl @result{}Word was: bar -dnl @result{}Word was: foobar diff -ruNp m4-1.4.9/checks/057.shift m4-1.4.10/checks/057.shift --- m4-1.4.9/checks/057.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/057.shift 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2565: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', + `reverse(shift($@)), `$1'')') +dnl @result{} +reverse +dnl @result{} +reverse(`foo') +dnl @result{}foo +reverse(`foo', `bar', `gnats', `and gnus') +dnl @result{}and gnus, gnats, bar, foo diff -ruNp m4-1.4.9/checks/058.foreach m4-1.4.10/checks/058.foreach --- m4-1.4.9/checks/058.foreach 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/058.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:2667: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreach.m4') -dnl @result{} -define(`_case', ` $1) - $2=" $1";; -')dnl -define(`_cat', `$1$2')dnl -case $`'1 in -dnl @result{}case $1 in -foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', - `_cat(`_case', x)')dnl -dnl @result{} a) -dnl @result{} vara=" a";; -dnl @result{} b) -dnl @result{} varb=" b";; -dnl @result{} c) -dnl @result{} varc=" c";; -esac -dnl @result{}esac diff -ruNp m4-1.4.9/checks/058.shift m4-1.4.10/checks/058.shift --- m4-1.4.9/checks/058.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/058.shift 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:2597: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`quote.m4') +dnl @result{} +-quote-dquote-dquote_elt- +dnl @result{}---- +-quote()-dquote()-dquote_elt()- +dnl @result{}--`'-`'- +-quote(`1')-dquote(`1')-dquote_elt(`1')- +dnl @result{}-1-`1'-`1'- +-quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- +dnl @result{}-1,2-`1',`2'-`1',`2'- +define(`n', `$#')dnl +-n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- +dnl @result{}-1-1-2- +dquote(dquote_elt(`1', `2')) +dnl @result{}``1'',``2'' +dquote_elt(dquote(`1', `2')) +dnl @result{}``1',`2'' diff -ruNp m4-1.4.9/checks/059.foreach m4-1.4.10/checks/059.foreach --- m4-1.4.9/checks/059.foreach 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/059.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:2695: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`foreach.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) -dnl @result{}# parenthesized list, simple version -dnl @result{}define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') -dnl @result{}define(`_arg1', `$1') -dnl @result{}define(`_foreach', `ifelse(`$2', `()', `', -dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') -dnl @result{}divert`'dnl diff -ruNp m4-1.4.9/checks/059.shift m4-1.4.10/checks/059.shift --- m4-1.4.9/checks/059.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/059.shift 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2629: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# quote(args) - convert args to single-quoted string +dnl @result{}define(`quote', `ifelse(`$#', `0', `', ``$*'')') +dnl @result{}# dquote(args) - convert args to quoted list of quoted strings +dnl @result{}define(`dquote', ``$@'') +dnl @result{}# dquote_elt(args) - convert args to list of double-quoted strings +dnl @result{}define(`dquote_elt', `ifelse(`$#', `0', `', `$#', `1', ```$1''', +dnl @result{} ```$1'',$0(shift($@))')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.9/checks/060.foreach m4-1.4.10/checks/060.foreach --- m4-1.4.9/checks/060.foreach 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/060.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:2720: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a', `1')define(`b', `2')define(`c', `3') -dnl @result{} -include(`foreach.m4') -dnl @result{} -include(`foreachq.m4') -dnl @result{} -foreach(`x', `(``a'', ``(b'', ``c)'')', `x -') -dnl @result{}1 -dnl @result{}(2)1 -dnl @result{} -dnl @result{}, x -dnl @result{}) -foreachq(`x', ```a'', ``(b'', ``c)''', `x -')dnl -dnl @result{}a -dnl @result{}(b -dnl @result{}c) diff -ruNp m4-1.4.9/checks/060.shift m4-1.4.10/checks/060.shift --- m4-1.4.9/checks/060.shift 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/060.shift 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2659: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`argn', `ifelse(`$1', 1, ``$2'', + `argn(decr(`$1'), shift(shift($@)))')') +dnl @result{} +argn(`1', `a') +dnl @result{}a +define(`foo', `argn(`11', $@)') +dnl @result{} +foo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l') +dnl @result{}k diff -ruNp m4-1.4.9/checks/061.foreach m4-1.4.10/checks/061.foreach --- m4-1.4.9/checks/061.foreach 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/061.foreach 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:2743: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`foreachq.m4')dnl -dnl @result{}include(`quote.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) -dnl @result{}# quoted list, simple version -dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') -dnl @result{}define(`_arg1', `$1') -dnl @result{}define(`_foreachq', `ifelse(quote($2), `', `', -dnl @result{} `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') -dnl @result{}divert`'dnl diff -ruNp m4-1.4.9/checks/061.forloop m4-1.4.10/checks/061.forloop --- m4-1.4.9/checks/061.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/061.forloop 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:2690: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `8', `i ') +dnl @result{}1 2 3 4 5 6 7 8 diff -ruNp m4-1.4.9/checks/062.dumpdef m4-1.4.10/checks/062.dumpdef --- m4-1.4.9/checks/062.dumpdef 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/062.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:2805: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello world.') -dnl @result{} -dumpdef(`foo') -dnl @error{}foo: `Hello world.' -dnl @result{} -dumpdef(`define') -dnl @error{}define: -dnl @result{} diff -ruNp m4-1.4.9/checks/062.forloop m4-1.4.10/checks/062.forloop --- m4-1.4.9/checks/062.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/062.forloop 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2700: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') +') +dnl @result{} (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8) +dnl @result{} (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8) +dnl @result{} (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8) +dnl @result{} (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8) +dnl @result{} diff -ruNp m4-1.4.9/checks/063.dumpdef m4-1.4.10/checks/063.dumpdef --- m4-1.4.9/checks/063.dumpdef 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/063.dumpdef 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:2821: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') -dnl @result{} -f(popdef(`f')dumpdef(`f')) -dnl @error{}f: ``$0'1' -dnl @result{}f2 -f(popdef(`f')dumpdef(`f')) -dnl @error{}m4:stdin:3: undefined macro `f' -dnl @result{}f1 diff -ruNp m4-1.4.9/checks/063.forloop m4-1.4.10/checks/063.forloop --- m4-1.4.9/checks/063.forloop 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/063.forloop 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:2727: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`forloop.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# forloop(var, from, to, stmt) - simple version +dnl @result{}define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') +dnl @result{}define(`_forloop', +dnl @result{} `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.9/checks/064.foreach m4-1.4.10/checks/064.foreach --- m4-1.4.9/checks/064.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/064.foreach 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:2773: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach.m4') +dnl @result{} +foreach(`x', (foo, bar, foobar), `Word was: x +')dnl +dnl @result{}Word was: foo +dnl @result{}Word was: bar +dnl @result{}Word was: foobar +include(`foreachq.m4') +dnl @result{} +foreachq(`x', `foo, bar, foobar', `Word was: x +')dnl +dnl @result{}Word was: foo +dnl @result{}Word was: bar +dnl @result{}Word was: foobar diff -ruNp m4-1.4.9/checks/064.trace m4-1.4.10/checks/064.trace --- m4-1.4.9/checks/064.trace 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/064.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:2863: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Hello World.') -dnl @result{} -define(`echo', `$@') -dnl @result{} -traceon(`foo', `echo') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `Hello World.' -dnl @result{}Hello World. -echo(`gnus', `and gnats') -dnl @error{}m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' -dnl @result{}gnus,and gnats diff -ruNp m4-1.4.9/checks/065.foreach m4-1.4.10/checks/065.foreach --- m4-1.4.9/checks/065.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/065.foreach 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:2795: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach.m4') +dnl @result{} +define(`_case', ` $1) + $2=" $1";; +')dnl +define(`_cat', `$1$2')dnl +case $`'1 in +dnl @result{}case $1 in +foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', + `_cat(`_case', x)')dnl +dnl @result{} a) +dnl @result{} vara=" a";; +dnl @result{} b) +dnl @result{} varb=" b";; +dnl @result{} c) +dnl @result{} varc=" c";; +esac +dnl @result{}esac diff -ruNp m4-1.4.9/checks/065.trace m4-1.4.10/checks/065.trace --- m4-1.4.9/checks/065.trace 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/065.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,34 +0,0 @@ -dnl @ ../doc/m4.texinfo:2888: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceoff(`foo') -dnl @result{} -traceon(`foo') -dnl @result{} -foo -dnl @result{}foo -define(`foo', `bar') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `bar' -dnl @result{}bar -undefine(`foo') -dnl @result{} -ifdef(`foo', `yes', `no') -dnl @result{}no -indir(`foo') -dnl @error{}m4:stdin:8: undefined macro `foo' -dnl @result{} -define(`foo', `blah') -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `blah' -dnl @result{}blah -traceoff -dnl @result{} -foo -dnl @result{}blah diff -ruNp m4-1.4.9/checks/066.foreach m4-1.4.10/checks/066.foreach --- m4-1.4.9/checks/066.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/066.foreach 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:2824: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`foreach.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) +dnl @result{}# parenthesized list, simple version +dnl @result{}define(`foreach', `pushdef(`$1')_foreach($@)popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreach', `ifelse(`$2', `()', `', +dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (shift$2), `$3')')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.9/checks/066.trace m4-1.4.10/checks/066.trace --- m4-1.4.9/checks/066.trace 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/066.trace 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:2921: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceon(`eval', `m4_divnum') -dnl @result{} -define(`m4_eval', defn(`eval')) -dnl @result{} -define(`m4_divnum', defn(`divnum')) -dnl @result{} -eval(divnum) -dnl @error{}m4trace: -1- eval(`0') -> `0' -dnl @result{}0 -m4_eval(m4_divnum) -dnl @error{}m4trace: -2- m4_divnum -> `0' -dnl @result{}0 diff -ruNp m4-1.4.9/checks/067.debug_leve m4-1.4.10/checks/067.debug_leve --- m4-1.4.9/checks/067.debug_leve 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/067.debug_leve 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:3028: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -traceon(`foo') -dnl @result{} -debugmode() -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -> `FOO' -dnl @result{}FOO -debugmode -dnl @result{} -foo -dnl @error{}m4trace: -1- foo -dnl @result{}FOO -debugmode(`+l') -dnl @result{} -foo -dnl @error{}m4trace:8: -1- foo -dnl @result{}FOO diff -ruNp m4-1.4.9/checks/067.foreach m4-1.4.10/checks/067.foreach --- m4-1.4.9/checks/067.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/067.foreach 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:2850: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a', `1')define(`b', `2')define(`c', `3') +dnl @result{} +include(`foreach.m4') +dnl @result{} +include(`foreachq.m4') +dnl @result{} +foreach(`x', `(``a'', ``(b'', ``c)'')', `x +') +dnl @result{}1 +dnl @result{}(2)1 +dnl @result{} +dnl @result{}, x +dnl @result{}) +foreachq(`x', ```a'', ``(b'', ``c)''', `x +')dnl +dnl @result{}a +dnl @result{}(b +dnl @result{}c) diff -ruNp m4-1.4.9/checks/068.debug_outp m4-1.4.10/checks/068.debug_outp --- m4-1.4.9/checks/068.debug_outp 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/068.debug_outp 1969-12-31 17:00:00.000000000 -0700 @@ -1,23 +0,0 @@ -dnl @ ../doc/m4.texinfo:3073: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -traceon(`divnum') -dnl @result{} -divnum(`extra') -dnl @error{}m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored -dnl @error{}m4trace: -1- divnum(`extra') -> `0' -dnl @result{}0 -debugfile() -dnl @result{} -divnum(`extra') -dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored -dnl @result{}0 -debugfile -dnl @result{} -divnum -dnl @error{}m4trace: -1- divnum -> `0' -dnl @result{}0 diff -ruNp m4-1.4.9/checks/068.foreach m4-1.4.10/checks/068.foreach --- m4-1.4.9/checks/068.foreach 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/068.foreach 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:2874: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`foreachq.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +dnl @result{}# quoted list, simple version +dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreachq', `ifelse(quote($2), `', `', +dnl @result{} `define(`$1', `_arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')') +dnl @result{}divert`'dnl diff -ruNp m4-1.4.9/checks/069.dnl m4-1.4.10/checks/069.dnl --- m4-1.4.9/checks/069.dnl 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/069.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:3125: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. -foo -dnl @result{}Macro foo. diff -ruNp m4-1.4.9/checks/069.dumpdef m4-1.4.10/checks/069.dumpdef --- m4-1.4.9/checks/069.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/069.dumpdef 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2937: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Hello world.') +dnl @result{} +dumpdef(`foo') +dnl @error{}foo: `Hello world.' +dnl @result{} +dumpdef(`define') +dnl @error{}define: +dnl @result{} diff -ruNp m4-1.4.9/checks/070.dnl m4-1.4.10/checks/070.dnl --- m4-1.4.9/checks/070.dnl 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/070.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:3143: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl(`args are ignored, but side effects occur', -define(`foo', `like this')) while this text is ignored: undefine(`foo') -dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored -See how `foo' was defined, foo? -dnl @result{}See how foo was defined, like this? diff -ruNp m4-1.4.9/checks/070.dumpdef m4-1.4.10/checks/070.dumpdef --- m4-1.4.9/checks/070.dumpdef 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/070.dumpdef 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:2954: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') +dnl @result{} +f(popdef(`f')dumpdef(`f')) +dnl @error{}f: ``$0'1' +dnl @result{}f2 +f(popdef(`f')dumpdef(`f')) +dnl @error{}m4:stdin:3: undefined macro `f' +dnl @result{}f1 diff -ruNp m4-1.4.9/checks/071.dnl m4-1.4.10/checks/071.dnl --- m4-1.4.9/checks/071.dnl 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/071.dnl 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3154: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`m4wrap(`2 hi -')0 hi dnl 1 hi') -dnl @result{} -define(`hi', `HI') -dnl @result{} -dnl @error{}m4:stdin:1: Warning: end of file treated as newline -dnl @result{}0 HI 2 HI diff -ruNp m4-1.4.9/checks/071.trace m4-1.4.10/checks/071.trace --- m4-1.4.9/checks/071.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/071.trace 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:2997: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Hello World.') +dnl @result{} +define(`echo', `$@') +dnl @result{} +traceon(`foo', `echo') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `Hello World.' +dnl @result{}Hello World. +echo(`gnus', `and gnats') +dnl @error{}m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' +dnl @result{}gnus,and gnats diff -ruNp m4-1.4.9/checks/072.changequot m4-1.4.10/checks/072.changequot --- m4-1.4.9/checks/072.changequot 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/072.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:3185: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changequote(`[', `]') -dnl @result{} -define([foo], [Macro [foo].]) -dnl @result{} -foo -dnl @result{}Macro foo. diff -ruNp m4-1.4.9/checks/072.trace m4-1.4.10/checks/072.trace --- m4-1.4.9/checks/072.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/072.trace 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3024: Origin of test +dnl @ expected status: 1 +dnl @ extra options: -dp -L3 -tifelse +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifelse(`one level') +dnl @error{}m4trace: -1- ifelse +dnl @result{} +ifelse(ifelse(ifelse(`three levels'))) +dnl @error{}m4trace: -3- ifelse +dnl @error{}m4trace: -2- ifelse +dnl @error{}m4trace: -1- ifelse +dnl @result{} +ifelse(ifelse(ifelse(ifelse(`four levels')))) +dnl @error{}m4:stdin:3: recursion limit of 3 exceeded, use -L to change it diff -ruNp m4-1.4.9/checks/073.changequot m4-1.4.10/checks/073.changequot --- m4-1.4.9/checks/073.changequot 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/073.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:3200: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a', `b') -dnl @result{} -«a» -dnl @result{}«b» -changequote(`«', `»') -dnl @result{} -«a» -dnl @result{}a diff -ruNp m4-1.4.9/checks/073.trace m4-1.4.10/checks/073.trace --- m4-1.4.9/checks/073.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/073.trace 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,35 @@ +dnl @ ../doc/m4.texinfo:3042: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceoff(`foo') +dnl @result{} +traceon(`foo') +dnl @result{} +foo +dnl @result{}foo +define(`foo', `bar') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `bar' +dnl @result{}bar +undefine(`foo') +dnl @result{} +ifdef(`foo', `yes', `no') +dnl @result{}no +indir(`foo') +dnl @error{}m4:stdin:8: undefined macro `foo' +dnl @result{} +define(`foo', `blah') +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `blah' +dnl @result{}blah +traceoff +dnl @result{} +foo +dnl @result{}blah diff -ruNp m4-1.4.9/checks/074.changequot m4-1.4.10/checks/074.changequot --- m4-1.4.9/checks/074.changequot 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/074.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:3215: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changequote(`[[[', `]]]') -dnl @result{} -define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) -dnl @result{} -foo -dnl @result{}Macro [[foo]]. diff -ruNp m4-1.4.9/checks/074.trace m4-1.4.10/checks/074.trace --- m4-1.4.9/checks/074.trace 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/074.trace 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:3076: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceon(`eval', `m4_divnum') +dnl @result{} +define(`m4_eval', defn(`eval')) +dnl @result{} +define(`m4_divnum', defn(`divnum')) +dnl @result{} +eval(divnum) +dnl @error{}m4trace: -1- eval(`0') -> `0' +dnl @result{}0 +m4_eval(m4_divnum) +dnl @error{}m4trace: -2- m4_divnum -> `0' +dnl @result{}0 diff -ruNp m4-1.4.9/checks/075.changequot m4-1.4.10/checks/075.changequot --- m4-1.4.9/checks/075.changequot 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/075.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:3237: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `Macro `FOO'.') -dnl @result{} -changequote(`', `') -dnl @result{} -foo -dnl @result{}Macro `FOO'. -`foo' -dnl @result{}`Macro `FOO'.' -changequote(`,) -dnl @result{} -foo -dnl @result{}Macro FOO. diff -ruNp m4-1.4.9/checks/075.debug_leve m4-1.4.10/checks/075.debug_leve --- m4-1.4.9/checks/075.debug_leve 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/075.debug_leve 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,27 @@ +dnl @ ../doc/m4.texinfo:3185: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -dp +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +traceon(`foo') +dnl @result{} +debugmode() +dnl @result{} +foo +dnl @error{}m4trace: -1- foo -> `FOO' +dnl @result{}FOO +debugmode +dnl @result{} +foo +dnl @error{}m4trace: -1- foo +dnl @result{}FOO +debugmode(`+l') +dnl @result{} +foo +dnl @error{}m4trace:8: -1- foo +dnl @result{}FOO diff -ruNp m4-1.4.9/checks/076.changequot m4-1.4.10/checks/076.changequot --- m4-1.4.9/checks/076.changequot 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/076.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -dnl @ ../doc/m4.texinfo:3270: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$@') -dnl @result{} -define(`hi', `HI') -dnl @result{} -changequote(`q', `Q') -dnl @result{} -q hi Q hi -dnl @result{}q HI Q HI -echo(hi) -dnl @result{}qHIQ -changequote -dnl @result{} -changequote(`-', `EOF') -dnl @result{} -- hi EOF hi -dnl @result{} hi HI -changequote -dnl @result{} -changequote(`1', `2') -dnl @result{} -hi1hi2 -dnl @result{}hi1hi2 -hi 1hi2 -dnl @result{}HI hi diff -ruNp m4-1.4.9/checks/076.debug_outp m4-1.4.10/checks/076.debug_outp --- m4-1.4.9/checks/076.debug_outp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/076.debug_outp 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,24 @@ +dnl @ ../doc/m4.texinfo:3231: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +traceon(`divnum') +dnl @result{} +divnum(`extra') +dnl @error{}m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored +dnl @error{}m4trace: -1- divnum(`extra') -> `0' +dnl @result{}0 +debugfile() +dnl @result{} +divnum(`extra') +dnl @error{}m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored +dnl @result{}0 +debugfile +dnl @result{} +divnum +dnl @error{}m4trace: -1- divnum -> `0' +dnl @result{}0 diff -ruNp m4-1.4.9/checks/077.changequot m4-1.4.10/checks/077.changequot --- m4-1.4.9/checks/077.changequot 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/077.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,29 +0,0 @@ -dnl @ ../doc/m4.texinfo:3303: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$#:$@:') -dnl @result{} -define(`hi', `HI') -dnl @result{} -changequote(`(',`)') -dnl @result{} -echo(hi) -dnl @result{}0::hi -changequote -dnl @result{} -changequote(`((', `))') -dnl @result{} -echo(hi) -dnl @result{}1:HI: -echo((hi)) -dnl @result{}0::hi -changequote -dnl @result{} -changequote(`,', `)') -dnl @result{} -echo(hi,hi)bye) -dnl @result{}1:HIhibye: diff -ruNp m4-1.4.9/checks/077.dnl m4-1.4.10/checks/077.dnl --- m4-1.4.9/checks/077.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/077.dnl 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:3284: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. +foo +dnl @result{}Macro foo. diff -ruNp m4-1.4.9/checks/078.changequot m4-1.4.10/checks/078.changequot --- m4-1.4.9/checks/078.changequot 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/078.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:3335: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`hi', `HI') -dnl @result{} -changequote(`""', `"') -dnl @result{} -""hi"""hi" -dnl @result{}hihi -""hi" ""hi" -dnl @result{}hi hi -""hi"" "hi" -dnl @result{}hi" "HI" -changequote -dnl @result{} -`hi`hi'hi' -dnl @result{}hi`hi'hi -changequote(`"', `"') -dnl @result{} -"hi"hi"hi" -dnl @result{}hiHIhi diff -ruNp m4-1.4.9/checks/078.dnl m4-1.4.10/checks/078.dnl --- m4-1.4.9/checks/078.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/078.dnl 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:3302: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +dnl(`args are ignored, but side effects occur', +define(`foo', `like this')) while this text is ignored: undefine(`foo') +dnl @error{}m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored +See how `foo' was defined, foo? +dnl @result{}See how foo was defined, like this? diff -ruNp m4-1.4.9/checks/079.changequot m4-1.4.10/checks/079.changequot --- m4-1.4.9/checks/079.changequot 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/079.changequot 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:3359: Origin of test -dnl @ expected status: 1 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -`hello world' -dnl @result{}hello world -`dangling quote -dnl @error{}m4:stdin:2: ERROR: end of file in string diff -ruNp m4-1.4.9/checks/079.dnl m4-1.4.10/checks/079.dnl --- m4-1.4.9/checks/079.dnl 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/079.dnl 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:3313: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`m4wrap(`2 hi +')0 hi dnl 1 hi') +dnl @result{} +define(`hi', `HI') +dnl @result{} +dnl @error{}m4:stdin:1: Warning: end of file treated as newline +dnl @result{}0 HI 2 HI diff -ruNp m4-1.4.9/checks/080.changecom m4-1.4.10/checks/080.changecom --- m4-1.4.9/checks/080.changecom 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/080.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:3386: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`comment', `COMMENT') -dnl @result{} -# A normal comment -dnl @result{}# A normal comment -changecom(`/*', `*/') -dnl @result{} -# Not a comment anymore -dnl @result{}# Not a COMMENT anymore -But: /* this is a comment now */ while this is not a comment -dnl @result{}But: /* this is a comment now */ while this is not a COMMENT diff -ruNp m4-1.4.9/checks/080.changequot m4-1.4.10/checks/080.changequot --- m4-1.4.9/checks/080.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/080.changequot 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3344: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changequote(`[', `]') +dnl @result{} +define([foo], [Macro [foo].]) +dnl @result{} +foo +dnl @result{}Macro foo. diff -ruNp m4-1.4.9/checks/081.changecom m4-1.4.10/checks/081.changecom --- m4-1.4.9/checks/081.changecom 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/081.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:3413: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`comment', `COMMENT') -dnl @result{} -changecom -dnl @result{} -# Not a comment anymore -dnl @result{}# Not a COMMENT anymore -changecom(`#', `') -dnl @result{} -# comment again -dnl @result{}# comment again diff -ruNp m4-1.4.9/checks/081.changequot m4-1.4.10/checks/081.changequot --- m4-1.4.9/checks/081.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/081.changequot 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3359: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a', `b') +dnl @result{} +«a» +dnl @result{}«b» +changequote(`«', `»') +dnl @result{} +«a» +dnl @result{}a diff -ruNp m4-1.4.9/checks/082.changecom m4-1.4.10/checks/082.changecom --- m4-1.4.9/checks/082.changecom 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/082.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:3432: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a', `b') -dnl @result{} -«a» -dnl @result{}«b» -changecom(`«', `»') -dnl @result{} -«a» -dnl @result{}«a» diff -ruNp m4-1.4.9/checks/082.changequot m4-1.4.10/checks/082.changequot --- m4-1.4.9/checks/082.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/082.changequot 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3374: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changequote(`[[[', `]]]') +dnl @result{} +define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) +dnl @result{} +foo +dnl @result{}Macro [[foo]]. diff -ruNp m4-1.4.9/checks/083.changecom m4-1.4.10/checks/083.changecom --- m4-1.4.9/checks/083.changecom 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/083.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:3455: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`hi', `HI') -dnl @result{} -define(`hi1hi2', `hello') -dnl @result{} -changecom(`q', `Q') -dnl @result{} -q hi Q hi -dnl @result{}q hi Q HI -changecom(`1', `2') -dnl @result{} -hi1hi2 -dnl @result{}hello -hi 1hi2 -dnl @result{}HI 1hi2 diff -ruNp m4-1.4.9/checks/083.changequot m4-1.4.10/checks/083.changequot --- m4-1.4.9/checks/083.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/083.changequot 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:3396: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `Macro `FOO'.') +dnl @result{} +changequote(`', `') +dnl @result{} +foo +dnl @result{}Macro `FOO'. +`foo' +dnl @result{}`Macro `FOO'.' +changequote(`,) +dnl @result{} +foo +dnl @result{}Macro FOO. diff -ruNp m4-1.4.9/checks/084.changecom m4-1.4.10/checks/084.changecom --- m4-1.4.9/checks/084.changecom 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/084.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,27 +0,0 @@ -dnl @ ../doc/m4.texinfo:3478: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$#:$@:') -dnl @result{} -define(`hi', `HI') -dnl @result{} -changecom(`(',`)') -dnl @result{} -echo(hi) -dnl @result{}0::(hi) -changecom -dnl @result{} -changecom(`((', `))') -dnl @result{} -echo(hi) -dnl @result{}1:HI: -echo((hi)) -dnl @result{}0::((hi)) -changecom(`,', `)') -dnl @result{} -echo(hi,hi)bye) -dnl @result{}1:HI,hi)bye: diff -ruNp m4-1.4.9/checks/084.changequot m4-1.4.10/checks/084.changequot --- m4-1.4.9/checks/084.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/084.changequot 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:3429: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$@') +dnl @result{} +define(`hi', `HI') +dnl @result{} +changequote(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q HI Q HI +echo(hi) +dnl @result{}qHIQ +changequote +dnl @result{} +changequote(`-', `EOF') +dnl @result{} +- hi EOF hi +dnl @result{} hi HI +changequote +dnl @result{} +changequote(`1', `2') +dnl @result{} +hi1hi2 +dnl @result{}hi1hi2 +hi 1hi2 +dnl @result{}HI hi diff -ruNp m4-1.4.9/checks/085.changecom m4-1.4.10/checks/085.changecom --- m4-1.4.9/checks/085.changecom 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/085.changecom 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:3504: Origin of test -dnl @ expected status: 1 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -changecom(`/*', `*/') -dnl @result{} -/*dangling comment -dnl @error{}m4:stdin:2: ERROR: end of file in comment diff -ruNp m4-1.4.9/checks/085.changequot m4-1.4.10/checks/085.changequot --- m4-1.4.9/checks/085.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/085.changequot 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:3462: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$#:$@:') +dnl @result{} +define(`hi', `HI') +dnl @result{} +changequote(`(',`)') +dnl @result{} +echo(hi) +dnl @result{}0::hi +changequote +dnl @result{} +changequote(`((', `))') +dnl @result{} +echo(hi) +dnl @result{}1:HI: +echo((hi)) +dnl @result{}0::hi +changequote +dnl @result{} +changequote(`,', `)') +dnl @result{} +echo(hi,hi)bye) +dnl @result{}1:HIhibye: diff -ruNp m4-1.4.9/checks/086.changequot m4-1.4.10/checks/086.changequot --- m4-1.4.9/checks/086.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/086.changequot 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:3494: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`hi', `HI') +dnl @result{} +changequote(`""', `"') +dnl @result{} +""hi"""hi" +dnl @result{}hihi +""hi" ""hi" +dnl @result{}hi hi +""hi"" "hi" +dnl @result{}hi" "HI" +changequote +dnl @result{} +`hi`hi'hi' +dnl @result{}hi`hi'hi +changequote(`"', `"') +dnl @result{} +"hi"hi"hi" +dnl @result{}hiHIhi diff -ruNp m4-1.4.9/checks/086.changeword m4-1.4.10/checks/086.changeword --- m4-1.4.9/checks/086.changeword 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/086.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:3557: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -changeword(`[_a-zA-Z0-9]+') -dnl @result{} -define(`1', `0')1 -dnl @result{}0 diff -ruNp m4-1.4.9/checks/087.changequot m4-1.4.10/checks/087.changequot --- m4-1.4.9/checks/087.changequot 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/087.changequot 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:3518: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +`hello world' +dnl @result{}hello world +`dangling quote +dnl @error{}m4:stdin:2: ERROR: end of file in string diff -ruNp m4-1.4.9/checks/087.changeword m4-1.4.10/checks/087.changeword --- m4-1.4.9/checks/087.changeword 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/087.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,18 +0,0 @@ -dnl @ ../doc/m4.texinfo:3570: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`_indir', defn(`indir')) -dnl @result{} -changeword(`_[_a-zA-Z0-9]*') -dnl @result{} -esyscmd(`foo') -dnl @result{}esyscmd(foo) -_indir(`esyscmd', `echo hi') -dnl @result{}hi -dnl @result{} diff -ruNp m4-1.4.9/checks/088.changecom m4-1.4.10/checks/088.changecom --- m4-1.4.9/checks/088.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/088.changecom 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3545: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`comment', `COMMENT') +dnl @result{} +# A normal comment +dnl @result{}# A normal comment +changecom(`/*', `*/') +dnl @result{} +# Not a comment anymore +dnl @result{}# Not a COMMENT anymore +But: /* this is a comment now */ while this is not a comment +dnl @result{}But: /* this is a comment now */ while this is not a COMMENT diff -ruNp m4-1.4.9/checks/088.changeword m4-1.4.10/checks/088.changeword --- m4-1.4.9/checks/088.changeword 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/088.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,39 +0,0 @@ -dnl @ ../doc/m4.texinfo:3589: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`foo -', `bar -') -dnl @result{} -dnl This example wants to recognize changeword, dnl, and `foo\n'. -dnl First, we check that our regexp will match. -regexp(`changeword', `[cd][a-z]*\|foo[ -]') -dnl @result{}0 -regexp(`foo -', `[cd][a-z]*\|foo[ -]') -dnl @result{}0 -regexp(`f', `[cd][a-z]*\|foo[ -]') -dnl @result{}-1 -foo -dnl @result{}foo -changeword(`[cd][a-z]*\|foo[ -]') -dnl @result{} -dnl Even though `foo\n' matches, we forgot to allow `f'. -foo -dnl @result{}foo -changeword(`[cd][a-z]*\|fo*[ -]?') -dnl @result{} -dnl Now we can call `foo\n'. -foo -dnl @result{}bar diff -ruNp m4-1.4.9/checks/089.changecom m4-1.4.10/checks/089.changecom --- m4-1.4.9/checks/089.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/089.changecom 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:3572: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`comment', `COMMENT') +dnl @result{} +changecom +dnl @result{} +# Not a comment anymore +dnl @result{}# Not a COMMENT anymore +changecom(`#', `') +dnl @result{} +# comment again +dnl @result{}# comment again diff -ruNp m4-1.4.9/checks/089.changeword m4-1.4.10/checks/089.changeword --- m4-1.4.9/checks/089.changeword 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/089.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,37 +0,0 @@ -dnl @ ../doc/m4.texinfo:3631: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`bar -', defn(`dnl'))dnl -define(`baz', `dnl -include(`foo') ignored -dnl')dnl -changeword(`\([_a-zA-Z][_a-zA-Z0-9]*\|bar -\)') -dnl @result{} -__file__:__line__ -dnl @result{}stdin:10 -include(`foo') ignored -__file__:__line__ -dnl @result{}stdin:12 -baz ignored -__file__:__line__ -dnl @result{}stdin:14 -define(`bar -', defn(`__file__')) -dnl @result{} -include(`foo') -dnl @result{}../examples/foo -define(`bar -', defn(`__line__')) -dnl @result{} -include(`foo') -dnl @result{}1 -__file__:__line__ -dnl @result{}stdin:21 diff -ruNp m4-1.4.9/checks/090.changecom m4-1.4.10/checks/090.changecom --- m4-1.4.9/checks/090.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/090.changecom 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3591: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a', `b') +dnl @result{} +«a» +dnl @result{}«b» +changecom(`«', `»') +dnl @result{} +«a» +dnl @result{}«a» diff -ruNp m4-1.4.9/checks/090.changeword m4-1.4.10/checks/090.changeword --- m4-1.4.9/checks/090.changeword 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/090.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:3669: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -ifdef(`__unix__', , - `errprint(` skipping: syscmd does not have unix semantics -')m4exit(`77')')dnl -changecom(`/*', `*/')dnl -define(`foo', `bar')dnl -changeword(`#\([_a-zA-Z0-9]*\)') -dnl @result{} -#esyscmd(`echo foo \#foo') -dnl @result{}foo bar -dnl @result{} diff -ruNp m4-1.4.9/checks/091.changecom m4-1.4.10/checks/091.changecom --- m4-1.4.9/checks/091.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/091.changecom 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:3614: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`hi', `HI') +dnl @result{} +define(`hi1hi2', `hello') +dnl @result{} +changecom(`q', `Q') +dnl @result{} +q hi Q hi +dnl @result{}q hi Q HI +changecom(`1', `2') +dnl @result{} +hi1hi2 +dnl @result{}hello +hi 1hi2 +dnl @result{}HI 1hi2 diff -ruNp m4-1.4.9/checks/091.changeword m4-1.4.10/checks/091.changeword --- m4-1.4.9/checks/091.changeword 2007-03-23 07:36:09.000000000 -0600 +++ m4-1.4.10/checks/091.changeword 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3706: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -ifdef(`changeword', `', `errprint(` skipping: no changeword support -')m4exit(`77')')dnl -define(`a', `errprint(`Hello')')dnl -changeword(`@\([_a-zA-Z0-9]*\)') -dnl @result{} -@a -dnl @result{}errprint(Hello) diff -ruNp m4-1.4.9/checks/092.changecom m4-1.4.10/checks/092.changecom --- m4-1.4.9/checks/092.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/092.changecom 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,28 @@ +dnl @ ../doc/m4.texinfo:3637: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$#:$@:') +dnl @result{} +define(`hi', `HI') +dnl @result{} +changecom(`(',`)') +dnl @result{} +echo(hi) +dnl @result{}0::(hi) +changecom +dnl @result{} +changecom(`((', `))') +dnl @result{} +echo(hi) +dnl @result{}1:HI: +echo((hi)) +dnl @result{}0::((hi)) +changecom(`,', `)') +dnl @result{} +echo(hi,hi)bye) +dnl @result{}1:HI,hi)bye: diff -ruNp m4-1.4.9/checks/092.m4wrap m4-1.4.10/checks/092.m4wrap --- m4-1.4.9/checks/092.m4wrap 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/092.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:3759: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleanup', `This is the `cleanup' action. -') -dnl @result{} -m4wrap(`cleanup') -dnl @result{} -This is the first and last normal input line. -dnl @result{}This is the first and last normal input line. -dnl @result{}This is the cleanup action. diff -ruNp m4-1.4.9/checks/093.changecom m4-1.4.10/checks/093.changecom --- m4-1.4.9/checks/093.changecom 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/093.changecom 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:3663: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +changecom(`/*', `*/') +dnl @result{} +/*dangling comment +dnl @error{}m4:stdin:2: ERROR: end of file in comment diff -ruNp m4-1.4.9/checks/093.m4wrap m4-1.4.10/checks/093.m4wrap --- m4-1.4.9/checks/093.m4wrap 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/093.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3788: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`f', `ifelse(`$1', `0', `Answer: 0!=1 -', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') -', `m4wrap(`f(decr(`$1'), `$2$1*')')')') -dnl @result{} -f(`10') -dnl @result{} -dnl @result{}Answer: 10*9*8*7*6*5*4*3*2*1=3628800 diff -ruNp m4-1.4.9/checks/094.changeword m4-1.4.10/checks/094.changeword --- m4-1.4.9/checks/094.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/094.changeword 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3716: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +changeword(`[_a-zA-Z0-9]+') +dnl @result{} +define(`1', `0')1 +dnl @result{}0 diff -ruNp m4-1.4.9/checks/094.m4wrap m4-1.4.10/checks/094.m4wrap --- m4-1.4.9/checks/094.m4wrap 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/094.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:3802: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`aa', `AA -') -dnl @result{} -m4wrap(`a')m4wrap(`a') -dnl @result{} -dnl @result{}AA diff -ruNp m4-1.4.9/checks/095.changeword m4-1.4.10/checks/095.changeword --- m4-1.4.9/checks/095.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/095.changeword 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,19 @@ +dnl @ ../doc/m4.texinfo:3729: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`_indir', defn(`indir')) +dnl @result{} +changeword(`_[_a-zA-Z0-9]*') +dnl @result{} +esyscmd(`foo') +dnl @result{}esyscmd(foo) +_indir(`esyscmd', `echo hi') +dnl @result{}hi +dnl @result{} diff -ruNp m4-1.4.9/checks/095.m4wrap m4-1.4.10/checks/095.m4wrap --- m4-1.4.9/checks/095.m4wrap 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/095.m4wrap 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:3817: Origin of test -dnl @ expected status: 1 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`m4wrap(`)')len(abc') -dnl @result{} -dnl @error{}m4:stdin:1: ERROR: end of file in argument list diff -ruNp m4-1.4.9/checks/096.changeword m4-1.4.10/checks/096.changeword --- m4-1.4.9/checks/096.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/096.changeword 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,40 @@ +dnl @ ../doc/m4.texinfo:3748: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`foo +', `bar +') +dnl @result{} +dnl This example wants to recognize changeword, dnl, and `foo\n'. +dnl First, we check that our regexp will match. +regexp(`changeword', `[cd][a-z]*\|foo[ +]') +dnl @result{}0 +regexp(`foo +', `[cd][a-z]*\|foo[ +]') +dnl @result{}0 +regexp(`f', `[cd][a-z]*\|foo[ +]') +dnl @result{}-1 +foo +dnl @result{}foo +changeword(`[cd][a-z]*\|foo[ +]') +dnl @result{} +dnl Even though `foo\n' matches, we forgot to allow `f'. +foo +dnl @result{}foo +changeword(`[cd][a-z]*\|fo*[ +]?') +dnl @result{} +dnl Now we can call `foo\n'. +foo +dnl @result{}bar diff -ruNp m4-1.4.9/checks/096.include m4-1.4.10/checks/096.include --- m4-1.4.9/checks/096.include 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/096.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:3859: Origin of test -dnl @ expected status: 1 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`none') -dnl @error{}m4:stdin:1: cannot open `none': No such file or directory -dnl @result{} -include() -dnl @error{}m4:stdin:2: cannot open `': No such file or directory -dnl @result{} -sinclude(`none') -dnl @result{} -sinclude() -dnl @result{} diff -ruNp m4-1.4.9/checks/097.changeword m4-1.4.10/checks/097.changeword --- m4-1.4.9/checks/097.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/097.changeword 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,38 @@ +dnl @ ../doc/m4.texinfo:3790: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`bar +', defn(`dnl'))dnl +define(`baz', `dnl +include(`foo') ignored +dnl')dnl +changeword(`\([_a-zA-Z][_a-zA-Z0-9]*\|bar +\)') +dnl @result{} +__file__:__line__ +dnl @result{}stdin:10 +include(`foo') ignored +__file__:__line__ +dnl @result{}stdin:12 +baz ignored +__file__:__line__ +dnl @result{}stdin:14 +define(`bar +', defn(`__file__')) +dnl @result{} +include(`foo') +dnl @result{}../examples/foo +define(`bar +', defn(`__line__')) +dnl @result{} +include(`foo') +dnl @result{}1 +__file__:__line__ +dnl @result{}stdin:21 diff -ruNp m4-1.4.9/checks/097.include m4-1.4.10/checks/097.include --- m4-1.4.9/checks/097.include 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/097.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3890: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -include(`incl.m4') -dnl @result{}Include file start -dnl @result{}FOO -dnl @result{}Include file end -dnl @result{} diff -ruNp m4-1.4.9/checks/098.changeword m4-1.4.10/checks/098.changeword --- m4-1.4.9/checks/098.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/098.changeword 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:3828: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +changecom(`/*', `*/')dnl +define(`foo', `bar')dnl +changeword(`#\([_a-zA-Z0-9]*\)') +dnl @result{} +#esyscmd(`echo foo \#foo') +dnl @result{}foo bar +dnl @result{} diff -ruNp m4-1.4.9/checks/098.include m4-1.4.10/checks/098.include --- m4-1.4.9/checks/098.include 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/098.include 1969-12-31 17:00:00.000000000 -0700 @@ -1,14 +0,0 @@ -dnl @ ../doc/m4.texinfo:3905: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`bar', include(`incl.m4')) -dnl @result{} -This is `bar': >>bar<< -dnl @result{}This is bar: >>Include file start -dnl @result{}foo -dnl @result{}Include file end -dnl @result{}<< diff -ruNp m4-1.4.9/checks/099.changeword m4-1.4.10/checks/099.changeword --- m4-1.4.9/checks/099.changeword 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/099.changeword 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:3865: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +ifdef(`changeword', `', `errprint(` skipping: no changeword support +')m4exit(`77')')dnl +define(`a', `errprint(`Hello')')dnl +changeword(`@\([_a-zA-Z0-9]*\)') +dnl @result{} +@a +dnl @result{}errprint(Hello) diff -ruNp m4-1.4.9/checks/099.diversions m4-1.4.10/checks/099.diversions --- m4-1.4.9/checks/099.diversions 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/099.diversions 1969-12-31 17:00:00.000000000 -0700 @@ -1,34 +0,0 @@ -dnl @ ../doc/m4.texinfo:3976: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`-1')define(`f', `.') -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -divert`'dnl -len(f) -dnl @result{}1048576 -divert(`1') -f -divert(`-1')undivert diff -ruNp m4-1.4.9/checks/100.diversions m4-1.4.10/checks/100.diversions --- m4-1.4.9/checks/100.diversions 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/100.diversions 1969-12-31 17:00:00.000000000 -0700 @@ -1,34 +0,0 @@ -dnl @ ../doc/m4.texinfo:4008: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`-1')define(`f', `.') -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -define(`f', defn(`f')defn(`f')) -divert`'dnl -len(f) -dnl @result{}1048576 -divert(`1') -f -m4exit diff -ruNp m4-1.4.9/checks/100.m4wrap m4-1.4.10/checks/100.m4wrap --- m4-1.4.9/checks/100.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/100.m4wrap 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:3918: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`cleanup', `This is the `cleanup' action. +') +dnl @result{} +m4wrap(`cleanup') +dnl @result{} +This is the first and last normal input line. +dnl @result{}This is the first and last normal input line. +dnl @result{}This is the cleanup action. diff -ruNp m4-1.4.9/checks/101.divert m4-1.4.10/checks/101.divert --- m4-1.4.9/checks/101.divert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/101.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4073: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted. -divert -dnl @result{} -This text is not diverted. -dnl @result{}This text is not diverted. -dnl @result{} -dnl @result{}This text is diverted. diff -ruNp m4-1.4.9/checks/101.m4wrap m4-1.4.10/checks/101.m4wrap --- m4-1.4.9/checks/101.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/101.m4wrap 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:3947: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`f', `ifelse(`$1', `0', `Answer: 0!=1 +', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') +', `m4wrap(`f(decr(`$1'), `$2$1*')')')') +dnl @result{} +f(`10') +dnl @result{} +dnl @result{}Answer: 10*9*8*7*6*5*4*3*2*1=3628800 diff -ruNp m4-1.4.9/checks/102.divert m4-1.4.10/checks/102.divert --- m4-1.4.9/checks/102.divert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/102.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4089: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`text', `TEXT') -dnl @result{} -divert(`1')`diverted text.' -divert -dnl @result{} -m4wrap(`Wrapped text precedes ') -dnl @result{} -dnl @result{}Wrapped TEXT precedes diverted text. diff -ruNp m4-1.4.9/checks/102.m4wrap m4-1.4.10/checks/102.m4wrap --- m4-1.4.9/checks/102.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/102.m4wrap 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:3961: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`aa', `AA +') +dnl @result{} +m4wrap(`a')m4wrap(`a') +dnl @result{} +dnl @result{}AA diff -ruNp m4-1.4.9/checks/103.divert m4-1.4.10/checks/103.divert --- m4-1.4.9/checks/103.divert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/103.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:4108: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`-1') -define(`foo', `Macro `foo'.') -define(`bar', `Macro `bar'.') -divert -dnl @result{} diff -ruNp m4-1.4.9/checks/103.m4wrap m4-1.4.10/checks/103.m4wrap --- m4-1.4.9/checks/103.m4wrap 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/103.m4wrap 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:3976: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`m4wrap(`)')len(abc') +dnl @result{} +dnl @error{}m4:stdin:1: ERROR: end of file in argument list diff -ruNp m4-1.4.9/checks/104.divert m4-1.4.10/checks/104.divert --- m4-1.4.9/checks/104.divert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/104.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4122: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(eval(`1<<28'))world -divert(`2')hello -dnl @result{}hello -dnl @result{}world diff -ruNp m4-1.4.9/checks/104.include m4-1.4.10/checks/104.include --- m4-1.4.9/checks/104.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/104.include 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4018: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`none') +dnl @error{}m4:stdin:1: cannot open `none': No such file or directory +dnl @result{} +include() +dnl @error{}m4:stdin:2: cannot open `': No such file or directory +dnl @result{} +sinclude(`none') +dnl @result{} +sinclude() +dnl @result{} diff -ruNp m4-1.4.9/checks/105.divert m4-1.4.10/checks/105.divert --- m4-1.4.9/checks/105.divert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/105.divert 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:4137: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -We decided to divert the stream for irrigation. -dnl @result{}We decided to the stream for irrigation. -define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') -dnl @result{} -divert(`-1') -Ignored text. -divert(`0') -dnl @result{} -We decided to divert the stream for irrigation. -dnl @result{}We decided to divert the stream for irrigation. diff -ruNp m4-1.4.9/checks/105.include m4-1.4.10/checks/105.include --- m4-1.4.9/checks/105.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/105.include 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4050: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +include(`incl.m4') +dnl @result{}Include file start +dnl @result{}FOO +dnl @result{}Include file end +dnl @result{} diff -ruNp m4-1.4.9/checks/106.include m4-1.4.10/checks/106.include --- m4-1.4.9/checks/106.include 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/106.include 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,15 @@ +dnl @ ../doc/m4.texinfo:4066: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`bar', include(`incl.m4')) +dnl @result{} +This is `bar': >>bar<< +dnl @result{}This is bar: >>Include file start +dnl @result{}foo +dnl @result{}Include file end +dnl @result{}<< diff -ruNp m4-1.4.9/checks/106.undivert m4-1.4.10/checks/106.undivert --- m4-1.4.9/checks/106.undivert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/106.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:4171: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted. -divert -dnl @result{} -This text is not diverted. -dnl @result{}This text is not diverted. -undivert(`1') -dnl @result{} -dnl @result{}This text is diverted. -dnl @result{} diff -ruNp m4-1.4.9/checks/107.diversions m4-1.4.10/checks/107.diversions --- m4-1.4.9/checks/107.diversions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/107.diversions 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,35 @@ +dnl @ ../doc/m4.texinfo:4138: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`-1')define(`f', `.') +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +divert`'dnl +len(f) +dnl @result{}1048576 +divert(`1') +f +divert(`-1')undivert diff -ruNp m4-1.4.9/checks/107.undivert m4-1.4.10/checks/107.undivert --- m4-1.4.9/checks/107.undivert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/107.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:4194: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1')diverted text -divert -dnl @result{} -undivert() -dnl @result{} -undivert(`0') -dnl @result{} -undivert -dnl @result{}diverted text -dnl @result{} diff -ruNp m4-1.4.9/checks/108.diversions m4-1.4.10/checks/108.diversions --- m4-1.4.9/checks/108.diversions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/108.diversions 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,35 @@ +dnl @ ../doc/m4.texinfo:4170: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`-1')define(`f', `.') +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +define(`f', defn(`f')defn(`f')) +divert`'dnl +len(f) +dnl @result{}1048576 +divert(`1') +f +m4exit diff -ruNp m4-1.4.9/checks/108.undivert m4-1.4.10/checks/108.undivert --- m4-1.4.9/checks/108.undivert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/108.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:4210: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -This text is diverted first. -divert(`0')undivert(`1')dnl -dnl @result{} -dnl @result{}This text is diverted first. -undivert(`1') -dnl @result{} -divert(`1') -This text is also diverted but not appended. -divert(`0')undivert(`1')dnl -dnl @result{} -dnl @result{}This text is also diverted but not appended. diff -ruNp m4-1.4.9/checks/109.divert m4-1.4.10/checks/109.divert --- m4-1.4.9/checks/109.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/109.divert 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4235: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted. +divert +dnl @result{} +This text is not diverted. +dnl @result{}This text is not diverted. +dnl @result{} +dnl @result{}This text is diverted. diff -ruNp m4-1.4.9/checks/109.undivert m4-1.4.10/checks/109.undivert --- m4-1.4.9/checks/109.undivert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/109.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4229: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1')one -divert(`2')two -divert(`3')three -divert(`2')undivert`'dnl -divert`'undivert`'dnl -dnl @result{}two -dnl @result{}one -dnl @result{}three diff -ruNp m4-1.4.9/checks/110.divert m4-1.4.10/checks/110.divert --- m4-1.4.9/checks/110.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/110.divert 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4251: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`text', `TEXT') +dnl @result{} +divert(`1')`diverted text.' +divert +dnl @result{} +m4wrap(`Wrapped text precedes ') +dnl @result{} +dnl @result{}Wrapped TEXT precedes diverted text. diff -ruNp m4-1.4.9/checks/110.undivert m4-1.4.10/checks/110.undivert --- m4-1.4.9/checks/110.undivert 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/110.undivert 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4250: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`bar', `BAR') -dnl @result{} -undivert(`foo') -dnl @result{}bar -dnl @result{} -include(`foo') -dnl @result{}BAR -dnl @result{} diff -ruNp m4-1.4.9/checks/111.divert m4-1.4.10/checks/111.divert --- m4-1.4.9/checks/111.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/111.divert 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:4270: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`-1') +define(`foo', `Macro `foo'.') +define(`bar', `Macro `bar'.') +divert +dnl @result{} diff -ruNp m4-1.4.9/checks/111.divnum m4-1.4.10/checks/111.divnum --- m4-1.4.9/checks/111.divnum 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/111.divnum 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:4274: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -Initial divnum -dnl @result{}Initial 0 -divert(`1') -Diversion one: divnum -divert(`2') -Diversion two: divnum -dnl @result{} -dnl @result{}Diversion one: 1 -dnl @result{} -dnl @result{}Diversion two: 2 diff -ruNp m4-1.4.9/checks/112.cleardiver m4-1.4.10/checks/112.cleardiver --- m4-1.4.9/checks/112.cleardiver 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/112.cleardiver 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:4300: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -divert(`1') -Diversion one: divnum -divert(`2') -Diversion two: divnum -divert(`-1') -undivert diff -ruNp m4-1.4.9/checks/112.divert m4-1.4.10/checks/112.divert --- m4-1.4.9/checks/112.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/112.divert 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4284: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(eval(`1<<28'))world +divert(`2')hello +dnl @result{}hello +dnl @result{}world diff -ruNp m4-1.4.9/checks/113.cleardiver m4-1.4.10/checks/113.cleardiver --- m4-1.4.9/checks/113.cleardiver 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/113.cleardiver 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4319: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleardivert', -`pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') -dnl @result{} diff -ruNp m4-1.4.9/checks/113.divert m4-1.4.10/checks/113.divert --- m4-1.4.9/checks/113.divert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/113.divert 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4299: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +We decided to divert the stream for irrigation. +dnl @result{}We decided to the stream for irrigation. +define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') +dnl @result{} +divert(`-1') +Ignored text. +divert(`0') +dnl @result{} +We decided to divert the stream for irrigation. +dnl @result{}We decided to divert the stream for irrigation. diff -ruNp m4-1.4.9/checks/114.len m4-1.4.10/checks/114.len --- m4-1.4.9/checks/114.len 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/114.len 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4359: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -len() -dnl @result{}0 -len(`abcdef') -dnl @result{}6 diff -ruNp m4-1.4.9/checks/114.undivert m4-1.4.10/checks/114.undivert --- m4-1.4.9/checks/114.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/114.undivert 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4333: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted. +divert +dnl @result{} +This text is not diverted. +dnl @result{}This text is not diverted. +undivert(`1') +dnl @result{} +dnl @result{}This text is diverted. +dnl @result{} diff -ruNp m4-1.4.9/checks/115.index_macr m4-1.4.10/checks/115.index_macr --- m4-1.4.9/checks/115.index_macr 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/115.index_macr 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:4381: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -index(`gnus, gnats, and armadillos', `nat') -dnl @result{}7 -index(`gnus, gnats, and armadillos', `dag') -dnl @result{}-1 diff -ruNp m4-1.4.9/checks/115.undivert m4-1.4.10/checks/115.undivert --- m4-1.4.9/checks/115.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/115.undivert 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4356: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1')diverted text +divert +dnl @result{} +undivert() +dnl @result{} +undivert(`0') +dnl @result{} +undivert +dnl @result{}diverted text +dnl @result{} diff -ruNp m4-1.4.9/checks/116.index_macr m4-1.4.10/checks/116.index_macr --- m4-1.4.9/checks/116.index_macr 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/116.index_macr 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4390: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -index(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `index' -dnl @result{}0 diff -ruNp m4-1.4.9/checks/116.undivert m4-1.4.10/checks/116.undivert --- m4-1.4.9/checks/116.undivert 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/116.undivert 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:4372: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(`1') +This text is diverted first. +divert(`0')undivert(`1')dnl +dnl @result{} +dnl @result{}This text is diverted first. +undivert(`1') +dnl @result{} +divert(`1') +This text is also diverted but not appended. +divert(`0')undivert(`1')dnl +dnl @result{} +dnl @result{}This text is also diverted but not appended. diff -ruNp m4-1.4.9/checks/117.regexp m4-1.4.10/checks/117.regexp --- m4-1.4.9/checks/117.regexp 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/117.regexp 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:4439: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -regexp(`GNUs not Unix', `\<[a-z]\w+') -dnl @result{}5 -regexp(`GNUs not Unix', `\a-c-a') -dnl @result{}<;>abcba -translit(`abcdef', `aabdef', `bcged') -dnl @result{}bgced diff -ruNp m4-1.4.9/checks/123.len m4-1.4.10/checks/123.len --- m4-1.4.9/checks/123.len 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/123.len 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4542: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +len() +dnl @result{}0 +len(`abcdef') +dnl @result{}6 diff -ruNp m4-1.4.9/checks/123.translit m4-1.4.10/checks/123.translit --- m4-1.4.9/checks/123.translit 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/123.translit 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:4573: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -translit(`«abc~', `~-»') -dnl @result{}abc diff -ruNp m4-1.4.9/checks/124.index_macr m4-1.4.10/checks/124.index_macr --- m4-1.4.9/checks/124.index_macr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/124.index_macr 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:4564: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +index(`gnus, gnats, and armadillos', `nat') +dnl @result{}7 +index(`gnus, gnats, and armadillos', `dag') +dnl @result{}-1 diff -ruNp m4-1.4.9/checks/124.translit m4-1.4.10/checks/124.translit --- m4-1.4.9/checks/124.translit 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/124.translit 1969-12-31 17:00:00.000000000 -0700 @@ -1,10 +0,0 @@ -dnl @ ../doc/m4.texinfo:4581: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -translit(`abc') -dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `translit' -dnl @result{}abc diff -ruNp m4-1.4.9/checks/125.index_macr m4-1.4.10/checks/125.index_macr --- m4-1.4.9/checks/125.index_macr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/125.index_macr 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4573: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +index(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `index' +dnl @result{}0 diff -ruNp m4-1.4.9/checks/125.patsubst m4-1.4.10/checks/125.patsubst --- m4-1.4.9/checks/125.patsubst 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/125.patsubst 1969-12-31 17:00:00.000000000 -0700 @@ -1,20 +0,0 @@ -dnl @ ../doc/m4.texinfo:4625: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -patsubst(`GNUs not Unix', `^', `OBS: ') -dnl @result{}OBS: GNUs not Unix -patsubst(`GNUs not Unix', `\<', `OBS: ') -dnl @result{}OBS: GNUs OBS: not OBS: Unix -patsubst(`GNUs not Unix', `\w*', `(\&)') -dnl @result{}(GNUs)() (not)() (Unix)() -patsubst(`GNUs not Unix', `\w+', `(\&)') -dnl @result{}(GNUs) (not) (Unix) -patsubst(`GNUs not Unix', `[A-Z][a-z]+') -dnl @result{}GN not -patsubst(`GNUs not Unix', `not', `NOT\') -dnl @error{}m4:stdin:6: Warning: trailing \ ignored in replacement -dnl @result{}GNUs NOT Unix diff -ruNp m4-1.4.9/checks/126.patsubst m4-1.4.10/checks/126.patsubst --- m4-1.4.9/checks/126.patsubst 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/126.patsubst 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:4654: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl -define(`downcase', `translit(`$*', `A-Z', `a-z')')dnl -define(`capitalize1', - `regexp(`$1', `^\(\w\)\(\w*\)', - `upcase(`\1')`'downcase(`\2')')')dnl -define(`capitalize', - `patsubst(`$1', `\w+', `capitalize1(`\&')')')dnl -capitalize(`GNUs not Unix') -dnl @result{}Gnus Not Unix diff -ruNp m4-1.4.9/checks/126.regexp m4-1.4.10/checks/126.regexp --- m4-1.4.9/checks/126.regexp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/126.regexp 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:4622: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +regexp(`GNUs not Unix', `\<[a-z]\w+') +dnl @result{}5 +regexp(`GNUs not Unix', `\a-c-a') +dnl @result{}<;>abcba +translit(`abcdef', `aabdef', `bcged') +dnl @result{}bgced diff -ruNp m4-1.4.9/checks/132.eval m4-1.4.10/checks/132.eval --- m4-1.4.9/checks/132.eval 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/132.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:4864: Origin of test -dnl @ expected status: 1 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`2 = 2') -dnl @error{}m4:stdin:1: Warning: recommend ==, not =, for equality operator -dnl @result{}1 -eval(`++0') -dnl @error{}m4:stdin:2: invalid operator in eval: ++0 -dnl @result{} -eval(`0 |= 1') -dnl @error{}m4:stdin:3: invalid operator in eval: 0 |= 1 -dnl @result{} diff -ruNp m4-1.4.9/checks/132.translit m4-1.4.10/checks/132.translit --- m4-1.4.9/checks/132.translit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/132.translit 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:4756: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +translit(`«abc~', `~-»') +dnl @result{}abc diff -ruNp m4-1.4.9/checks/133.eval m4-1.4.10/checks/133.eval --- m4-1.4.9/checks/133.eval 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/133.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -dnl @ ../doc/m4.texinfo:4897: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`1 == 2 > 0') -dnl @result{}1 -eval(`(1 == 2) > 0') -dnl @result{}0 -eval(`! 0 * 2') -dnl @result{}2 -eval(`! (0 * 2)') -dnl @result{}1 -eval(`1 | 1 ^ 1') -dnl @result{}1 -eval(`(1 | 1) ^ 1') -dnl @result{}0 -eval(`+ + - ~ ! ~ 0') -dnl @result{}1 -eval(`2 || 1 / 0') -dnl @result{}1 -eval(`0 || 1 / 0') -dnl @error{}m4:stdin:9: divide by zero in eval: 0 || 1 / 0 -dnl @result{} -eval(`0 && 1 % 0') -dnl @result{}0 -eval(`2 && 1 % 0') -dnl @error{}m4:stdin:11: modulo by zero in eval: 2 && 1 % 0 -dnl @result{} diff -ruNp m4-1.4.9/checks/133.translit m4-1.4.10/checks/133.translit --- m4-1.4.9/checks/133.translit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/133.translit 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4764: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +translit(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `translit' +dnl @result{}abc diff -ruNp m4-1.4.9/checks/134.eval m4-1.4.10/checks/134.eval --- m4-1.4.9/checks/134.eval 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/134.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,21 +0,0 @@ -dnl @ ../doc/m4.texinfo:4930: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`2 ** 3 ** 2') -dnl @result{}512 -eval(`(2 ** 3) ** 2') -dnl @result{}64 -eval(`0 ** 1') -dnl @result{}0 -eval(`2 ** 0') -dnl @result{}1 -eval(`0 ** 0') -dnl @result{} -dnl @error{}m4:stdin:5: divide by zero in eval: 0 ** 0 -eval(`4 ** -2') -dnl @error{}m4:stdin:6: negative exponent in eval: 4 ** -2 -dnl @result{} diff -ruNp m4-1.4.9/checks/134.patsubst m4-1.4.10/checks/134.patsubst --- m4-1.4.9/checks/134.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/134.patsubst 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,21 @@ +dnl @ ../doc/m4.texinfo:4808: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +patsubst(`GNUs not Unix', `^', `OBS: ') +dnl @result{}OBS: GNUs not Unix +patsubst(`GNUs not Unix', `\<', `OBS: ') +dnl @result{}OBS: GNUs OBS: not OBS: Unix +patsubst(`GNUs not Unix', `\w*', `(\&)') +dnl @result{}(GNUs)() (not)() (Unix)() +patsubst(`GNUs not Unix', `\w+', `(\&)') +dnl @result{}(GNUs) (not) (Unix) +patsubst(`GNUs not Unix', `[A-Z][a-z]+') +dnl @result{}GN not +patsubst(`GNUs not Unix', `not', `NOT\') +dnl @error{}m4:stdin:6: Warning: trailing \ ignored in replacement +dnl @result{}GNUs NOT Unix diff -ruNp m4-1.4.9/checks/135.eval m4-1.4.10/checks/135.eval --- m4-1.4.9/checks/135.eval 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/135.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:4966: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`-3 * 5') -dnl @result{}-15 -eval(index(`Hello world', `llo') >= 0) -dnl @result{}1 -eval(`0r1:0111 + 0b100 + 0r3:12') -dnl @result{}12 -define(`square', `eval(`($1) ** 2')') -dnl @result{} -square(`9') -dnl @result{}81 -square(square(`5')` + 1') -dnl @result{}676 -define(`foo', `666') -dnl @result{} -eval(`foo / 6') -dnl @error{}m4:stdin:8: bad expression in eval: foo / 6 -dnl @result{} -eval(foo / 6) -dnl @result{}111 diff -ruNp m4-1.4.9/checks/135.patsubst m4-1.4.10/checks/135.patsubst --- m4-1.4.9/checks/135.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/135.patsubst 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:4837: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`upcase', `translit(`$*', `a-z', `A-Z')')dnl +define(`downcase', `translit(`$*', `A-Z', `a-z')')dnl +define(`capitalize1', + `regexp(`$1', `^\(\w\)\(\w*\)', + `upcase(`\1')`'downcase(`\2')')')dnl +define(`capitalize', + `patsubst(`$1', `\w+', `capitalize1(`\&')')')dnl +capitalize(`GNUs not Unix') +dnl @result{}Gnus Not Unix diff -ruNp m4-1.4.9/checks/136.eval m4-1.4.10/checks/136.eval --- m4-1.4.9/checks/136.eval 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/136.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,25 +0,0 @@ -dnl @ ../doc/m4.texinfo:4999: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`max_int', eval(`0x7fffffff')) -dnl @result{} -define(`min_int', incr(max_int)) -dnl @result{} -eval(min_int` < 0') -dnl @result{}1 -eval(max_int` > 0') -dnl @result{}1 -ifelse(eval(min_int` / -1'), min_int, `overflow occurred') -dnl @result{}overflow occurred -min_int -dnl @result{}-2147483648 -eval(`0x80000000 % -1') -dnl @result{}0 -eval(`-4 >> 1') -dnl @result{}-2 -eval(`-4 >> 33') -dnl @result{}-2 diff -ruNp m4-1.4.9/checks/136.patsubst m4-1.4.10/checks/136.patsubst --- m4-1.4.9/checks/136.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/136.patsubst 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:4853: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`patreg', +`patsubst($@) +regexp($@)')dnl +patreg(`bar foo baz Foo', `foo\|Foo', `FOO') +dnl @result{}bar FOO baz FOO +dnl @result{}FOO +patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') +dnl @result{}bab abb 212 +dnl @result{}bab diff -ruNp m4-1.4.9/checks/137.eval m4-1.4.10/checks/137.eval --- m4-1.4.9/checks/137.eval 2007-03-23 07:36:10.000000000 -0600 +++ m4-1.4.10/checks/137.eval 1969-12-31 17:00:00.000000000 -0700 @@ -1,32 +0,0 @@ -dnl @ ../doc/m4.texinfo:5032: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -eval(`666', `10') -dnl @result{}666 -eval(`666', `11') -dnl @result{}556 -eval(`666', `6') -dnl @result{}3030 -eval(`666', `6', `10') -dnl @result{}0000003030 -eval(`-666', `6', `10') -dnl @result{}-0000003030 -eval(`10', `', `0') -dnl @result{}10 -`0r1:'eval(`10', `1', `11') -dnl @result{}0r1:01111111111 -eval(`10', `16') -dnl @result{}a -eval(`1', `37') -dnl @error{}m4:stdin:9: radix 37 in builtin `eval' out of range -dnl @result{} -eval(`1', , `-1') -dnl @error{}m4:stdin:10: negative width to builtin `eval' -dnl @result{} -eval() -dnl @error{}m4:stdin:11: empty string treated as 0 in builtin `eval' -dnl @result{}0 diff -ruNp m4-1.4.9/checks/137.patsubst m4-1.4.10/checks/137.patsubst --- m4-1.4.9/checks/137.patsubst 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/137.patsubst 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4867: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +patsubst(`abc') +dnl @error{}m4:stdin:1: Warning: too few arguments to builtin `patsubst' +dnl @result{}abc diff -ruNp m4-1.4.9/checks/138.format m4-1.4.10/checks/138.format --- m4-1.4.9/checks/138.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/138.format 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:4894: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `The brown fox jumped over the lazy dog') +dnl @result{} +format(`The string "%s" uses %d characters', foo, len(foo)) +dnl @result{}The string "The brown fox jumped over the lazy dog" uses 38 characters +format(`%*.*d', `-1', `-1', `1') +dnl @result{}1 +format(`%.0f', `56789.9876') +dnl @result{}56790 +len(format(`%-*X', `5000', `1')) +dnl @result{}5000 +ifelse(format(`%010F', `infinity'), ` INF', `success', + format(`%010F', `infinity'), ` INFINITY', `success', + format(`%010F', `infinity')) +dnl @result{}success +ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', + format(`%.1A', `1.999'), `0X2.0P+0', `success', + format(`%.1A', `1.999')) +dnl @result{}success diff -ruNp m4-1.4.9/checks/138.platform_m m4-1.4.10/checks/138.platform_m --- m4-1.4.9/checks/138.platform_m 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/138.platform_m 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:5112: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -__gnu__ -dnl @result{} -ifdef(`__gnu__', `Extensions are active') -dnl @result{}Extensions are active diff -ruNp m4-1.4.9/checks/139.format m4-1.4.10/checks/139.format --- m4-1.4.9/checks/139.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/139.format 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,23 @@ +dnl @ ../doc/m4.texinfo:4918: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`forloop.m4') +dnl @result{} +forloop(`i', `1', `10', `format(`%6d squared is %10d +', i, eval(i**2))') +dnl @result{} 1 squared is 1 +dnl @result{} 2 squared is 4 +dnl @result{} 3 squared is 9 +dnl @result{} 4 squared is 16 +dnl @result{} 5 squared is 25 +dnl @result{} 6 squared is 36 +dnl @result{} 7 squared is 49 +dnl @result{} 8 squared is 64 +dnl @result{} 9 squared is 81 +dnl @result{} 10 squared is 100 +dnl @result{} diff -ruNp m4-1.4.9/checks/139.platform_m m4-1.4.10/checks/139.platform_m --- m4-1.4.9/checks/139.platform_m 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/139.platform_m 1969-12-31 17:00:00.000000000 -0700 @@ -1,17 +0,0 @@ -dnl @ ../doc/m4.texinfo:5132: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`provided', `0') -dnl @result{} -ifdef(`__unix__', `define(`provided', incr(provided))') -dnl @result{} -ifdef(`__windows__', `define(`provided', incr(provided))') -dnl @result{} -ifdef(`__os2__', `define(`provided', incr(provided))') -dnl @result{} -provided -dnl @result{}1 diff -ruNp m4-1.4.9/checks/140.format m4-1.4.10/checks/140.format --- m4-1.4.9/checks/140.format 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/140.format 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,11 @@ +dnl @ ../doc/m4.texinfo:4959: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +format(`%p', `0') +dnl @error{}m4:stdin:1: Warning: unrecognized specifier in `%p' +dnl @result{} diff -ruNp m4-1.4.9/checks/140.syscmd m4-1.4.10/checks/140.syscmd --- m4-1.4.9/checks/140.syscmd 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/140.syscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:5165: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -syscmd(`echo foo') -dnl @result{}foo -dnl @result{} diff -ruNp m4-1.4.9/checks/141.incr m4-1.4.10/checks/141.incr --- m4-1.4.9/checks/141.incr 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/141.incr 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:4997: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +incr(`4') +dnl @result{}5 +decr(`7') +dnl @result{}6 +incr() +dnl @error{}m4:stdin:3: empty string treated as 0 in builtin `incr' +dnl @result{}1 +decr() +dnl @error{}m4:stdin:4: empty string treated as 0 in builtin `decr' +dnl @result{}-1 diff -ruNp m4-1.4.9/checks/141.syscmd m4-1.4.10/checks/141.syscmd --- m4-1.4.9/checks/141.syscmd 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/141.syscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,9 +0,0 @@ -dnl @ ../doc/m4.texinfo:5200: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`syscmd(`cat')') -dnl @result{} diff -ruNp m4-1.4.9/checks/142.esyscmd m4-1.4.10/checks/142.esyscmd --- m4-1.4.9/checks/142.esyscmd 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/142.esyscmd 1969-12-31 17:00:00.000000000 -0700 @@ -1,12 +0,0 @@ -dnl @ ../doc/m4.texinfo:5227: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', `FOO') -dnl @result{} -esyscmd(`echo foo') -dnl @result{}FOO -dnl @result{} diff -ruNp m4-1.4.9/checks/142.eval m4-1.4.10/checks/142.eval --- m4-1.4.9/checks/142.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/142.eval 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:5074: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`2 = 2') +dnl @error{}m4:stdin:1: Warning: recommend ==, not =, for equality operator +dnl @result{}1 +eval(`++0') +dnl @error{}m4:stdin:2: invalid operator in eval: ++0 +dnl @result{} +eval(`0 |= 1') +dnl @error{}m4:stdin:3: invalid operator in eval: 0 |= 1 +dnl @result{} diff -ruNp m4-1.4.9/checks/143.eval m4-1.4.10/checks/143.eval --- m4-1.4.9/checks/143.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/143.eval 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:5107: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`1 == 2 > 0') +dnl @result{}1 +eval(`(1 == 2) > 0') +dnl @result{}0 +eval(`! 0 * 2') +dnl @result{}2 +eval(`! (0 * 2)') +dnl @result{}1 +eval(`1 | 1 ^ 1') +dnl @result{}1 +eval(`(1 | 1) ^ 1') +dnl @result{}0 +eval(`+ + - ~ ! ~ 0') +dnl @result{}1 +eval(`2 || 1 / 0') +dnl @result{}1 +eval(`0 || 1 / 0') +dnl @error{}m4:stdin:9: divide by zero in eval: 0 || 1 / 0 +dnl @result{} +eval(`0 && 1 % 0') +dnl @result{}0 +eval(`2 && 1 % 0') +dnl @error{}m4:stdin:11: modulo by zero in eval: 2 && 1 % 0 +dnl @result{} diff -ruNp m4-1.4.9/checks/143.sysval m4-1.4.10/checks/143.sysval --- m4-1.4.9/checks/143.sysval 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/143.sysval 1969-12-31 17:00:00.000000000 -0700 @@ -1,33 +0,0 @@ -dnl @ ../doc/m4.texinfo:5257: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -sysval -dnl @result{}0 -syscmd(`false') -dnl @result{} -ifelse(sysval, `0', `zero', `non-zero') -dnl @result{}non-zero -syscmd(`exit 2') -dnl @result{} -sysval -dnl @result{}2 -syscmd(`true') -dnl @result{} -sysval -dnl @result{}0 -esyscmd(`false') -dnl @result{} -ifelse(sysval, `0', `zero', `non-zero') -dnl @result{}non-zero -esyscmd(`exit 2') -dnl @result{} -sysval -dnl @result{}2 -esyscmd(`true') -dnl @result{} -sysval -dnl @result{}0 diff -ruNp m4-1.4.9/checks/144.eval m4-1.4.10/checks/144.eval --- m4-1.4.9/checks/144.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/144.eval 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,22 @@ +dnl @ ../doc/m4.texinfo:5140: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`2 ** 3 ** 2') +dnl @result{}512 +eval(`(2 ** 3) ** 2') +dnl @result{}64 +eval(`0 ** 1') +dnl @result{}0 +eval(`2 ** 0') +dnl @result{}1 +eval(`0 ** 0') +dnl @result{} +dnl @error{}m4:stdin:5: divide by zero in eval: 0 ** 0 +eval(`4 ** -2') +dnl @error{}m4:stdin:6: negative exponent in eval: 4 ** -2 +dnl @result{} diff -ruNp m4-1.4.9/checks/144.sysval m4-1.4.10/checks/144.sysval --- m4-1.4.9/checks/144.sysval 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/144.sysval 1969-12-31 17:00:00.000000000 -0700 @@ -1,24 +0,0 @@ -dnl @ ../doc/m4.texinfo:5307: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -dnl This test assumes kill is a shell builtin, and that signals are -dnl recognizable. -ifdef(`__unix__', , - `errprint(` skipping: syscmd does not have unix semantics -')m4exit(`77')')dnl -syscmd(`kill -9 $$') -dnl @result{} -sysval -dnl @result{}2304 -syscmd() -dnl @result{} -sysval -dnl @result{}0 -esyscmd(`kill -9 $$') -dnl @result{} -sysval -dnl @result{}2304 diff -ruNp m4-1.4.9/checks/145.eval m4-1.4.10/checks/145.eval --- m4-1.4.9/checks/145.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/145.eval 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:5176: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`-3 * 5') +dnl @result{}-15 +eval(`-99 / 10') +dnl @result{}-9 +eval(`-99 % 10') +dnl @result{}-9 +eval(`99 % -10') +dnl @result{}9 +eval(index(`Hello world', `llo') >= 0) +dnl @result{}1 +eval(`0r1:0111 + 0b100 + 0r3:12') +dnl @result{}12 +define(`square', `eval(`($1) ** 2')') +dnl @result{} +square(`9') +dnl @result{}81 +square(square(`5')` + 1') +dnl @result{}676 +define(`foo', `666') +dnl @result{} +eval(`foo / 6') +dnl @error{}m4:stdin:11: bad expression in eval: foo / 6 +dnl @result{} +eval(foo / 6) +dnl @result{}111 diff -ruNp m4-1.4.9/checks/145.mkstemp m4-1.4.10/checks/145.mkstemp --- m4-1.4.9/checks/145.mkstemp 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/145.mkstemp 1969-12-31 17:00:00.000000000 -0700 @@ -1,26 +0,0 @@ -dnl @ ../doc/m4.texinfo:5392: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -syscmd(`echo foo??????')dnl -dnl @result{}foo?????? -define(`file1', maketemp(`fooXXXXXX'))dnl -ifelse(esyscmd(`echo foo??????'), `foo??????', `no file', `created') -dnl @result{}created -define(`file2', maketemp(`fooXX'))dnl -define(`file3', mkstemp(`fooXXXXXX'))dnl -ifelse(len(file1), len(file2), `same length', `different') -dnl @result{}same length -ifelse(file1, file2, `same', `different file') -dnl @result{}different file -ifelse(file2, file3, `same', `different file') -dnl @result{}different file -ifelse(file1, file3, `same', `different file') -dnl @result{}different file -syscmd(`rm 'file1 file2 file3) -dnl @result{} -sysval -dnl @result{}0 diff -ruNp m4-1.4.9/checks/146.errprint m4-1.4.10/checks/146.errprint --- m4-1.4.9/checks/146.errprint 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/146.errprint 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -dnl @ ../doc/m4.texinfo:5444: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -errprint(`Invalid arguments to forloop -') -dnl @error{}Invalid arguments to forloop -dnl @result{} -errprint(`1')errprint(`2',`3 -') -dnl @error{}12 3 -dnl @result{} diff -ruNp m4-1.4.9/checks/146.eval m4-1.4.10/checks/146.eval --- m4-1.4.9/checks/146.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/146.eval 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,26 @@ +dnl @ ../doc/m4.texinfo:5215: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`max_int', eval(`0x7fffffff')) +dnl @result{} +define(`min_int', incr(max_int)) +dnl @result{} +eval(min_int` < 0') +dnl @result{}1 +eval(max_int` > 0') +dnl @result{}1 +ifelse(eval(min_int` / -1'), min_int, `overflow occurred') +dnl @result{}overflow occurred +min_int +dnl @result{}-2147483648 +eval(`0x80000000 % -1') +dnl @result{}0 +eval(`-4 >> 1') +dnl @result{}-2 +eval(`-4 >> 33') +dnl @result{}-2 diff -ruNp m4-1.4.9/checks/147.eval m4-1.4.10/checks/147.eval --- m4-1.4.9/checks/147.eval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/147.eval 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,33 @@ +dnl @ ../doc/m4.texinfo:5248: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +eval(`666', `10') +dnl @result{}666 +eval(`666', `11') +dnl @result{}556 +eval(`666', `6') +dnl @result{}3030 +eval(`666', `6', `10') +dnl @result{}0000003030 +eval(`-666', `6', `10') +dnl @result{}-0000003030 +eval(`10', `', `0') +dnl @result{}10 +`0r1:'eval(`10', `1', `11') +dnl @result{}0r1:01111111111 +eval(`10', `16') +dnl @result{}a +eval(`1', `37') +dnl @error{}m4:stdin:9: radix 37 in builtin `eval' out of range +dnl @result{} +eval(`1', , `-1') +dnl @error{}m4:stdin:10: negative width to builtin `eval' +dnl @result{} +eval() +dnl @error{}m4:stdin:11: empty string treated as 0 in builtin `eval' +dnl @result{}0 diff -ruNp m4-1.4.9/checks/147.location m4-1.4.10/checks/147.location --- m4-1.4.9/checks/147.location 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/147.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:5480: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -errprint(__program__:__file__:__line__: `input error -') -dnl @error{}m4:stdin:1: input error -dnl @result{} diff -ruNp m4-1.4.9/checks/148.location m4-1.4.10/checks/148.location --- m4-1.4.9/checks/148.location 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/148.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,16 +0,0 @@ -dnl @ ../doc/m4.texinfo:5499: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`foo', ``$0' called at __file__:__line__') -dnl @result{} -foo -dnl @result{}foo called at stdin:2 -include(`incl.m4') -dnl @result{}Include file start -dnl @result{}foo called at ../examples/incl.m4:2 -dnl @result{}Include file end -dnl @result{} diff -ruNp m4-1.4.9/checks/148.platform_m m4-1.4.10/checks/148.platform_m --- m4-1.4.9/checks/148.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/148.platform_m 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5328: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +__gnu__ +dnl @result{} +ifdef(`__gnu__', `Extensions are active') +dnl @result{}Extensions are active diff -ruNp m4-1.4.9/checks/149.location m4-1.4.10/checks/149.location --- m4-1.4.9/checks/149.location 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/149.location 1969-12-31 17:00:00.000000000 -0700 @@ -1,30 +0,0 @@ -dnl @ ../doc/m4.texinfo:5519: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`echo', `$@') -dnl @result{} -define(`foo', `echo(__line__ -__line__)') -dnl @result{} -echo(__line__ -__line__) -dnl @result{}4 -dnl @result{}5 -m4wrap(`foo -') -dnl @result{} -foo(errprint(__line__ -__line__ -)) -dnl @error{}8 -dnl @error{}9 -dnl @result{}8 -dnl @result{}8 -__line__ -dnl @result{}11 -dnl @result{}6 -dnl @result{}6 diff -ruNp m4-1.4.9/checks/149.platform_m m4-1.4.10/checks/149.platform_m --- m4-1.4.9/checks/149.platform_m 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/149.platform_m 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,18 @@ +dnl @ ../doc/m4.texinfo:5348: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`provided', `0') +dnl @result{} +ifdef(`__unix__', `define(`provided', incr(provided))') +dnl @result{} +ifdef(`__windows__', `define(`provided', incr(provided))') +dnl @result{} +ifdef(`__os2__', `define(`provided', incr(provided))') +dnl @result{} +provided +dnl @result{}1 diff -ruNp m4-1.4.9/checks/150.m4exit m4-1.4.10/checks/150.m4exit --- m4-1.4.9/checks/150.m4exit 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/150.m4exit 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:5572: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -m4wrap(`This text is lost due to `m4exit'.') -dnl @result{} -divert(`1') So is this. -divert -dnl @result{} -m4exit And this is never read. diff -ruNp m4-1.4.9/checks/150.syscmd m4-1.4.10/checks/150.syscmd --- m4-1.4.9/checks/150.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/150.syscmd 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:5381: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +syscmd(`echo foo') +dnl @result{}foo +dnl @result{} diff -ruNp m4-1.4.9/checks/151.m4exit m4-1.4.10/checks/151.m4exit --- m4-1.4.9/checks/151.m4exit 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/151.m4exit 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:5590: Origin of test -dnl @ expected status: 1 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`fatal_error', - `errprint(__program__:__file__:__line__`: fatal error: $* -')m4exit(`1')') -dnl @result{} -fatal_error(`this is a BAD one, buster') -dnl @error{}m4:stdin:4: fatal error: this is a BAD one, buster diff -ruNp m4-1.4.9/checks/151.syscmd m4-1.4.10/checks/151.syscmd --- m4-1.4.9/checks/151.syscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/151.syscmd 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,10 @@ +dnl @ ../doc/m4.texinfo:5410: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`syscmd(`cat')') +dnl @result{} diff -ruNp m4-1.4.9/checks/152.esyscmd m4-1.4.10/checks/152.esyscmd --- m4-1.4.9/checks/152.esyscmd 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/152.esyscmd 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,13 @@ +dnl @ ../doc/m4.texinfo:5449: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', `FOO') +dnl @result{} +esyscmd(`echo foo') +dnl @result{}FOO +dnl @result{} diff -ruNp m4-1.4.9/checks/152.extensions m4-1.4.10/checks/152.extensions --- m4-1.4.9/checks/152.extensions 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/152.extensions 1969-12-31 17:00:00.000000000 -0700 @@ -1,24 +0,0 @@ -dnl @ ../doc/m4.texinfo:5843: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`a1', `A1') -dnl @result{} -dnl First argument, concatenated with 1 -define(`_1', `$1')define(`first1', `_1($@)1') -dnl @result{} -dnl Eleventh argument, portable -define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') -dnl @result{} -dnl Eleventh argument, GNU style -define(`Eleventh', `$11') -dnl @result{} -first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}A1 -eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}k -Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') -dnl @result{}k diff -ruNp m4-1.4.9/checks/153.incompatib m4-1.4.10/checks/153.incompatib --- m4-1.4.9/checks/153.incompatib 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/153.incompatib 1969-12-31 17:00:00.000000000 -0700 @@ -1,24 +0,0 @@ -dnl @ ../doc/m4.texinfo:5971: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`wrapfifo.m4')dnl -dnl @result{}dnl Redefine m4wrap to have FIFO semantics. -dnl @result{}define(`_m4wrap_level', `0')dnl -dnl @result{}define(`m4wrap', -dnl @result{}`ifdef(`m4wrap'_m4wrap_level, -dnl @result{} `define(`m4wrap'_m4wrap_level, -dnl @result{} defn(`m4wrap'_m4wrap_level)`$1')', -dnl @result{} `builtin(`m4wrap', `define(`_m4wrap_level', -dnl @result{} incr(_m4wrap_level))dnl -dnl @result{}m4wrap'_m4wrap_level)dnl -dnl @result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl -include(`wrapfifo.m4') -dnl @result{} -m4wrap(`a`'m4wrap(`c -', `d')')m4wrap(`b') -dnl @result{} -dnl @result{}abc diff -ruNp m4-1.4.9/checks/153.sysval m4-1.4.10/checks/153.sysval --- m4-1.4.9/checks/153.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/153.sysval 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,34 @@ +dnl @ ../doc/m4.texinfo:5479: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +sysval +dnl @result{}0 +syscmd(`false') +dnl @result{} +ifelse(sysval, `0', `zero', `non-zero') +dnl @result{}non-zero +syscmd(`exit 2') +dnl @result{} +sysval +dnl @result{}2 +syscmd(`true') +dnl @result{} +sysval +dnl @result{}0 +esyscmd(`false') +dnl @result{} +ifelse(sysval, `0', `zero', `non-zero') +dnl @result{}non-zero +esyscmd(`exit 2') +dnl @result{} +sysval +dnl @result{}2 +esyscmd(`true') +dnl @result{} +sysval +dnl @result{}0 diff -ruNp m4-1.4.9/checks/154.other_inco m4-1.4.10/checks/154.other_inco --- m4-1.4.9/checks/154.other_inco 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/154.other_inco 1969-12-31 17:00:00.000000000 -0700 @@ -1,11 +0,0 @@ -dnl @ ../doc/m4.texinfo:6136: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`x', `x') -dnl @result{} -define(`x', `x ') -dnl @result{} diff -ruNp m4-1.4.9/checks/154.sysval m4-1.4.10/checks/154.sysval --- m4-1.4.9/checks/154.sysval 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/154.sysval 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:5529: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +dnl This test assumes kill is a shell builtin, and that signals are +dnl recognizable. +ifdef(`__unix__', , + `errprint(` skipping: syscmd does not have unix semantics +')m4exit(`77')')dnl +syscmd(`kill -9 $$') +dnl @result{} +sysval +dnl @result{}2304 +syscmd() +dnl @result{} +sysval +dnl @result{}0 +esyscmd(`kill -9 $$') +dnl @result{} +sysval +dnl @result{}2304 diff -ruNp m4-1.4.9/checks/155.improved_e m4-1.4.10/checks/155.improved_e --- m4-1.4.9/checks/155.improved_e 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/155.improved_e 1969-12-31 17:00:00.000000000 -0700 @@ -1,13 +0,0 @@ -dnl @ ../doc/m4.texinfo:6187: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`exch', ``$2', `$1'') -dnl @result{} -define(exch(`expansion text', `macro')) -dnl @result{} -macro -dnl @result{}expansion text diff -ruNp m4-1.4.9/checks/155.mkstemp m4-1.4.10/checks/155.mkstemp --- m4-1.4.9/checks/155.mkstemp 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/155.mkstemp 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,27 @@ +dnl @ ../doc/m4.texinfo:5615: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +syscmd(`echo foo??????')dnl +dnl @result{}foo?????? +define(`file1', maketemp(`fooXXXXXX'))dnl +ifelse(esyscmd(`echo foo??????'), `foo??????', `no file', `created') +dnl @result{}created +define(`file2', maketemp(`fooXX'))dnl +define(`file3', mkstemp(`fooXXXXXX'))dnl +ifelse(len(file1), len(file2), `same length', `different') +dnl @result{}same length +ifelse(file1, file2, `same', `different file') +dnl @result{}different file +ifelse(file2, file3, `same', `different file') +dnl @result{}different file +ifelse(file1, file3, `same', `different file') +dnl @result{}different file +syscmd(`rm 'file1 file2 file3) +dnl @result{} +sysval +dnl @result{}0 diff -ruNp m4-1.4.9/checks/156.errprint m4-1.4.10/checks/156.errprint --- m4-1.4.9/checks/156.errprint 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/156.errprint 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,16 @@ +dnl @ ../doc/m4.texinfo:5668: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +errprint(`Invalid arguments to forloop +') +dnl @error{}Invalid arguments to forloop +dnl @result{} +errprint(`1')errprint(`2',`3 +') +dnl @error{}12 3 +dnl @result{} diff -ruNp m4-1.4.9/checks/156.improved_f m4-1.4.10/checks/156.improved_f --- m4-1.4.9/checks/156.improved_f 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/156.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -dnl @ ../doc/m4.texinfo:6207: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -undivert(`forloop2.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# forloop(var, from, to, stmt) - improved version: -dnl @result{}# works even if VAR is not a strict macro name -dnl @result{}# performs sanity check that FROM is larger than TO -dnl @result{}# allows complex numerical expressions in TO and FROM -dnl @result{}define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', -dnl @result{} `pushdef(`$1', eval(`$2'))_forloop(`$1', -dnl @result{} eval(`$3'), `$4')popdef(`$1')')') -dnl @result{}define(`_forloop', -dnl @result{} `$3`'ifelse(indir(`$1'), `$2', `', -dnl @result{} `define(`$1', incr(indir(`$1')))$0($@)')') -dnl @result{}divert`'dnl -include(`forloop2.m4') -dnl @result{} -forloop(`i', `2', `1', `no iteration occurs') -dnl @result{} -forloop(`', `1', `2', ` odd iterator name') -dnl @result{} odd iterator name odd iterator name -forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') -dnl @result{} 0xa 0xb 0xc -forloop(`i', `a', `b', `non-numeric bounds') -dnl @error{}m4:stdin:6: bad expression in eval (bad input): (b) >= (a) -dnl @result{} diff -ruNp m4-1.4.9/checks/157.improved_f m4-1.4.10/checks/157.improved_f --- m4-1.4.9/checks/157.improved_f 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/157.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,33 +0,0 @@ -dnl @ ../doc/m4.texinfo:6246: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreachq.m4') -dnl @result{} -traceon(`shift')debugmode(`aq') -dnl @result{} -foreachq(`x', ``1', `2', `3', `4'', `x -')dnl -dnl @result{}1 -dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -2- shift(`1', `2', `3', `4') -dnl @result{}2 -dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -3- shift(`2', `3', `4') -dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -2- shift(`2', `3', `4') -dnl @result{}3 -dnl @error{}m4trace: -5- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -4- shift(`2', `3', `4') -dnl @error{}m4trace: -3- shift(`3', `4') -dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -3- shift(`2', `3', `4') -dnl @error{}m4trace: -2- shift(`3', `4') -dnl @result{}4 -dnl @error{}m4trace: -6- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -5- shift(`2', `3', `4') -dnl @error{}m4trace: -4- shift(`3', `4') -dnl @error{}m4trace: -3- shift(`4') diff -ruNp m4-1.4.9/checks/157.location m4-1.4.10/checks/157.location --- m4-1.4.9/checks/157.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/157.location 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:5704: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +errprint(__program__:__file__:__line__: `input error +') +dnl @error{}m4:stdin:1: input error +dnl @result{} diff -ruNp m4-1.4.9/checks/158.improved_f m4-1.4.10/checks/158.improved_f --- m4-1.4.9/checks/158.improved_f 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/158.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -dnl @ ../doc/m4.texinfo:6286: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreachq2.m4') -dnl @result{} -undivert(`foreachq2.m4')dnl -dnl @result{}include(`quote.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) -dnl @result{}# quoted list, improved version -dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') -dnl @result{}define(`_arg1q', ``$1'') -dnl @result{}define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') -dnl @result{}define(`_foreachq', `ifelse(`$2', `', `', -dnl @result{} `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') -dnl @result{}divert`'dnl -traceon(`shift')debugmode(`aq') -dnl @result{} -foreachq(`x', ``1', `2', `3', `4'', `x -')dnl -dnl @result{}1 -dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') -dnl @result{}2 -dnl @error{}m4trace: -3- shift(`2', `3', `4') -dnl @result{}3 -dnl @error{}m4trace: -3- shift(`3', `4') -dnl @result{}4 diff -ruNp m4-1.4.9/checks/158.location m4-1.4.10/checks/158.location --- m4-1.4.9/checks/158.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/158.location 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:5723: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`foo', ``$0' called at __file__:__line__') +dnl @result{} +foo +dnl @result{}foo called at stdin:2 +include(`incl.m4') +dnl @result{}Include file start +dnl @result{}foo called at ../examples/incl.m4:2 +dnl @result{}Include file end +dnl @result{} diff -ruNp m4-1.4.9/checks/159.improved_f m4-1.4.10/checks/159.improved_f --- m4-1.4.9/checks/159.improved_f 2007-03-23 07:36:11.000000000 -0600 +++ m4-1.4.10/checks/159.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,35 +0,0 @@ -dnl @ ../doc/m4.texinfo:6327: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreach2.m4') -dnl @result{} -undivert(`foreach2.m4')dnl -dnl @result{}include(`quote.m4')dnl -dnl @result{}divert(`-1') -dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) -dnl @result{}# parenthesized list, improved version -dnl @result{}define(`foreach', `pushdef(`$1')_foreach(`$1', -dnl @result{} (dquote(dquote_elt$2)), `$3')popdef(`$1')') -dnl @result{}define(`_arg1', `$1') -dnl @result{}define(`_foreach', `ifelse(`$2', `(`')', `', -dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') -dnl @result{}divert`'dnl -traceon(`shift')debugmode(`aq') -dnl @result{} -foreach(`x', `(`1', `2', `3', `4')', `x -')dnl -dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') -dnl @error{}m4trace: -4- shift(`2', `3', `4') -dnl @error{}m4trace: -4- shift(`3', `4') -dnl @result{}1 -dnl @error{}m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') -dnl @result{}2 -dnl @error{}m4trace: -3- shift(``2'', ``3'', ``4'') -dnl @result{}3 -dnl @error{}m4trace: -3- shift(``3'', ``4'') -dnl @result{}4 -dnl @error{}m4trace: -3- shift(``4'') diff -ruNp m4-1.4.9/checks/159.location m4-1.4.10/checks/159.location --- m4-1.4.9/checks/159.location 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/159.location 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,31 @@ +dnl @ ../doc/m4.texinfo:5744: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`echo', `$@') +dnl @result{} +define(`foo', `echo(__line__ +__line__)') +dnl @result{} +echo(__line__ +__line__) +dnl @result{}4 +dnl @result{}5 +m4wrap(`foo +') +dnl @result{} +foo(errprint(__line__ +__line__ +)) +dnl @error{}8 +dnl @error{}9 +dnl @result{}8 +dnl @result{}8 +__line__ +dnl @result{}11 +dnl @result{}6 +dnl @result{}6 diff -ruNp m4-1.4.9/checks/160.improved_f m4-1.4.10/checks/160.improved_f --- m4-1.4.9/checks/160.improved_f 2007-03-23 07:36:12.000000000 -0600 +++ m4-1.4.10/checks/160.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,71 +0,0 @@ -dnl @ ../doc/m4.texinfo:6371: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -include(`foreach2.m4') -dnl @result{} -include(`foreachq2.m4') -dnl @result{} -dnl 0-element list: -foreach(`x', `', `') / foreachq(`x', `', `') -dnl @result{} / -dnl 1-element list of empty element -foreach(`x', `()', `') / foreachq(`x', ``'', `') -dnl @result{}<> / <> -dnl 2-element list of empty elements -foreach(`x', `(`',`')', `') / foreachq(`x', ``',`'', `') -dnl @result{}<><> / <><> -dnl 1-element list of a comma -foreach(`x', `(`,')', `') / foreachq(`x', ``,'', `') -dnl @result{}<,> / <,> -dnl 2-element list of unbalanced parentheses -foreach(`x', `(`(', `)')', `') / foreachq(`x', ``(', `)'', `') -dnl @result{}<(><)> / <(><)> -define(`active', `ACT, IVE') -dnl @result{} -traceon(`active') -dnl @result{} -dnl list of unquoted macros; expansion occurs before recursion -foreach(`x', `(active, active)', ` -')dnl -dnl @error{}m4trace: -4- active -> `ACT, IVE' -dnl @error{}m4trace: -4- active -> `ACT, IVE' -dnl @result{} -dnl @result{} -dnl @result{} -dnl @result{} -foreachq(`x', `active, active', ` -')dnl -dnl @error{}m4trace: -3- active -> `ACT, IVE' -dnl @error{}m4trace: -3- active -> `ACT, IVE' -dnl @result{} -dnl @error{}m4trace: -3- active -> `ACT, IVE' -dnl @error{}m4trace: -3- active -> `ACT, IVE' -dnl @result{} -dnl @result{} -dnl @result{} -dnl list of quoted macros; expansion occurs during recursion -foreach(`x', `(`active', `active')', ` -')dnl -dnl @error{}m4trace: -1- active -> `ACT, IVE' -dnl @result{} -dnl @error{}m4trace: -1- active -> `ACT, IVE' -dnl @result{} -foreachq(`x', ``active', `active'', ` -')dnl -dnl @error{}m4trace: -1- active -> `ACT, IVE' -dnl @result{} -dnl @error{}m4trace: -1- active -> `ACT, IVE' -dnl @result{} -dnl list of double-quoted macro names; no expansion -foreach(`x', `(``active'', ``active'')', ` -')dnl -dnl @result{} -dnl @result{} -foreachq(`x', ```active'', ``active''', ` -')dnl -dnl @result{} -dnl @result{} diff -ruNp m4-1.4.9/checks/160.m4exit m4-1.4.10/checks/160.m4exit --- m4-1.4.9/checks/160.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/160.m4exit 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:5797: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +m4wrap(`This text is lost due to `m4exit'.') +dnl @result{} +divert(`1') So is this. +divert +dnl @result{} +m4exit And this is never read. diff -ruNp m4-1.4.9/checks/161.improved_c m4-1.4.10/checks/161.improved_c --- m4-1.4.9/checks/161.improved_c 2007-03-23 07:36:12.000000000 -0600 +++ m4-1.4.10/checks/161.improved_c 1969-12-31 17:00:00.000000000 -0700 @@ -1,29 +0,0 @@ -dnl @ ../doc/m4.texinfo:6447: Origin of test -dnl @ expected status: 0 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`cleardivert', - `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') -dnl @result{} -divert(`1')one -divert -dnl @result{} -cleardivert -dnl @result{} -undivert -dnl @result{}one -dnl @result{} -define(`cleardivert', - `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', - `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') -dnl @result{} -divert(`2')two -divert -dnl @result{} -cleardivert -dnl @result{} -undivert -dnl @result{} diff -ruNp m4-1.4.9/checks/161.m4exit m4-1.4.10/checks/161.m4exit --- m4-1.4.9/checks/161.m4exit 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/161.m4exit 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:5815: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`fatal_error', + `errprint(__program__:__file__:__line__`: fatal error: $* +')m4exit(`1')') +dnl @result{} +fatal_error(`this is a BAD one, buster') +dnl @error{}m4:stdin:4: fatal error: this is a BAD one, buster diff -ruNp m4-1.4.9/checks/162.extensions m4-1.4.10/checks/162.extensions --- m4-1.4.9/checks/162.extensions 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/162.extensions 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:6068: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`a1', `A1') +dnl @result{} +dnl First argument, concatenated with 1 +define(`_1', `$1')define(`first1', `_1($@)1') +dnl @result{} +dnl Eleventh argument, portable +define(`_9', `$9')define(`eleventh', `_9(shift(shift($@)))') +dnl @result{} +dnl Eleventh argument, GNU style +define(`Eleventh', `$11') +dnl @result{} +first1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}A1 +eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}k +Eleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k') +dnl @result{}k diff -ruNp m4-1.4.9/checks/162.improved_f m4-1.4.10/checks/162.improved_f --- m4-1.4.9/checks/162.improved_f 2007-03-23 07:36:12.000000000 -0600 +++ m4-1.4.10/checks/162.improved_f 1969-12-31 17:00:00.000000000 -0700 @@ -1,19 +0,0 @@ -dnl @ ../doc/m4.texinfo:6485: Origin of test -dnl @ expected status: 1 -dnl @ Copyright (C) 2006, 2007 Free Software Foundation -dnl @ This file is free software; the Free Software Foundation -dnl @ gives unlimited permission to copy and/or distribute it -dnl @ with or without modifications, as long as this notice -dnl @ is preserved. -define(`fatal_error', - `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl -`:ifelse(__line__, `0', `', - `__file__:__line__:')` fatal error: $* -')m4exit(`1')') -dnl @result{} -m4wrap(`divnum(`demo of internal message') -fatal_error(`inside wrapped text')') -dnl @result{} -dnl @error{}m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored -dnl @result{}0 -dnl @error{}m4:stdin:6: fatal error: inside wrapped text diff -ruNp m4-1.4.9/checks/163.incompatib m4-1.4.10/checks/163.incompatib --- m4-1.4.9/checks/163.incompatib 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/163.incompatib 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,25 @@ +dnl @ ../doc/m4.texinfo:6196: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`wrapfifo.m4')dnl +dnl @result{}dnl Redefine m4wrap to have FIFO semantics. +dnl @result{}define(`_m4wrap_level', `0')dnl +dnl @result{}define(`m4wrap', +dnl @result{}`ifdef(`m4wrap'_m4wrap_level, +dnl @result{} `define(`m4wrap'_m4wrap_level, +dnl @result{} defn(`m4wrap'_m4wrap_level)`$1')', +dnl @result{} `builtin(`m4wrap', `define(`_m4wrap_level', +dnl @result{} incr(_m4wrap_level))dnl +dnl @result{}m4wrap'_m4wrap_level)dnl +dnl @result{}define(`m4wrap'_m4wrap_level, `$1')')')dnl +include(`wrapfifo.m4') +dnl @result{} +m4wrap(`a`'m4wrap(`c +', `d')')m4wrap(`b') +dnl @result{} +dnl @result{}abc diff -ruNp m4-1.4.9/checks/164.other_inco m4-1.4.10/checks/164.other_inco --- m4-1.4.9/checks/164.other_inco 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/164.other_inco 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,17 @@ +dnl @ ../doc/m4.texinfo:6358: Origin of test +dnl @ expected status: 0 +dnl @ extra options: -s +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +divert(2)2 +divert(1)1 +divert`'0 +dnl @result{}#line 3 "stdin" +dnl @result{}0 +dnl @result{}#line 2 "stdin" +dnl @result{}1 +dnl @result{}#line 1 "stdin" +dnl @result{}2 diff -ruNp m4-1.4.9/checks/165.other_inco m4-1.4.10/checks/165.other_inco --- m4-1.4.9/checks/165.other_inco 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/165.other_inco 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,12 @@ +dnl @ ../doc/m4.texinfo:6383: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`x', `x') +dnl @result{} +define(`x', `x ') +dnl @result{} diff -ruNp m4-1.4.9/checks/166.improved_e m4-1.4.10/checks/166.improved_e --- m4-1.4.9/checks/166.improved_e 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/166.improved_e 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,14 @@ +dnl @ ../doc/m4.texinfo:6434: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`exch', ``$2', `$1'') +dnl @result{} +define(exch(`expansion text', `macro')) +dnl @result{} +macro +dnl @result{}expansion text diff -ruNp m4-1.4.9/checks/167.improved_f m4-1.4.10/checks/167.improved_f --- m4-1.4.9/checks/167.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/167.improved_f 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:6454: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +undivert(`forloop2.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# forloop(var, from, to, stmt) - improved version: +dnl @result{}# works even if VAR is not a strict macro name +dnl @result{}# performs sanity check that FROM is larger than TO +dnl @result{}# allows complex numerical expressions in TO and FROM +dnl @result{}define(`forloop', `ifelse(eval(`($3) >= ($2)'), `1', +dnl @result{} `pushdef(`$1', eval(`$2'))_forloop(`$1', +dnl @result{} eval(`$3'), `$4')popdef(`$1')')') +dnl @result{}define(`_forloop', +dnl @result{} `$3`'ifelse(indir(`$1'), `$2', `', +dnl @result{} `define(`$1', incr(indir(`$1')))$0($@)')') +dnl @result{}divert`'dnl +include(`forloop2.m4') +dnl @result{} +forloop(`i', `2', `1', `no iteration occurs') +dnl @result{} +forloop(`', `1', `2', ` odd iterator name') +dnl @result{} odd iterator name odd iterator name +forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')') +dnl @result{} 0xa 0xb 0xc +forloop(`i', `a', `b', `non-numeric bounds') +dnl @error{}m4:stdin:6: bad expression in eval (bad input): (b) >= (a) +dnl @result{} diff -ruNp m4-1.4.9/checks/168.improved_f m4-1.4.10/checks/168.improved_f --- m4-1.4.9/checks/168.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/168.improved_f 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,34 @@ +dnl @ ../doc/m4.texinfo:6494: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreachq.m4') +dnl @result{} +traceon(`shift')debugmode(`aq') +dnl @result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +dnl @result{}1 +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -2- shift(`1', `2', `3', `4') +dnl @result{}2 +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -2- shift(`2', `3', `4') +dnl @result{}3 +dnl @error{}m4trace: -5- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -4- shift(`2', `3', `4') +dnl @error{}m4trace: -3- shift(`3', `4') +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @error{}m4trace: -2- shift(`3', `4') +dnl @result{}4 +dnl @error{}m4trace: -6- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -5- shift(`2', `3', `4') +dnl @error{}m4trace: -4- shift(`3', `4') +dnl @error{}m4trace: -3- shift(`4') diff -ruNp m4-1.4.9/checks/169.improved_f m4-1.4.10/checks/169.improved_f --- m4-1.4.9/checks/169.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/169.improved_f 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,32 @@ +dnl @ ../doc/m4.texinfo:6535: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreachq2.m4') +dnl @result{} +undivert(`foreachq2.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreachq(x, `item_1, item_2, ..., item_n', stmt) +dnl @result{}# quoted list, improved version +dnl @result{}define(`foreachq', `pushdef(`$1')_foreachq($@)popdef(`$1')') +dnl @result{}define(`_arg1q', ``$1'') +dnl @result{}define(`_rest', `ifelse(`$#', `1', `', `dquote(shift($@))')') +dnl @result{}define(`_foreachq', `ifelse(`$2', `', `', +dnl @result{} `define(`$1', _arg1q($2))$3`'$0(`$1', _rest($2), `$3')')') +dnl @result{}divert`'dnl +traceon(`shift')debugmode(`aq') +dnl @result{} +foreachq(`x', ``1', `2', `3', `4'', `x +')dnl +dnl @result{}1 +dnl @error{}m4trace: -3- shift(`1', `2', `3', `4') +dnl @result{}2 +dnl @error{}m4trace: -3- shift(`2', `3', `4') +dnl @result{}3 +dnl @error{}m4trace: -3- shift(`3', `4') +dnl @result{}4 diff -ruNp m4-1.4.9/checks/170.improved_f m4-1.4.10/checks/170.improved_f --- m4-1.4.9/checks/170.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/170.improved_f 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,36 @@ +dnl @ ../doc/m4.texinfo:6577: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach2.m4') +dnl @result{} +undivert(`foreach2.m4')dnl +dnl @result{}include(`quote.m4')dnl +dnl @result{}divert(`-1') +dnl @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) +dnl @result{}# parenthesized list, improved version +dnl @result{}define(`foreach', `pushdef(`$1')_foreach(`$1', +dnl @result{} (dquote(dquote_elt$2)), `$3')popdef(`$1')') +dnl @result{}define(`_arg1', `$1') +dnl @result{}define(`_foreach', `ifelse(`$2', `(`')', `', +dnl @result{} `define(`$1', _arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')') +dnl @result{}divert`'dnl +traceon(`shift')debugmode(`aq') +dnl @result{} +foreach(`x', `(`1', `2', `3', `4')', `x +')dnl +dnl @error{}m4trace: -4- shift(`1', `2', `3', `4') +dnl @error{}m4trace: -4- shift(`2', `3', `4') +dnl @error{}m4trace: -4- shift(`3', `4') +dnl @result{}1 +dnl @error{}m4trace: -3- shift(``1'', ``2'', ``3'', ``4'') +dnl @result{}2 +dnl @error{}m4trace: -3- shift(``2'', ``3'', ``4'') +dnl @result{}3 +dnl @error{}m4trace: -3- shift(``3'', ``4'') +dnl @result{}4 +dnl @error{}m4trace: -3- shift(``4'') diff -ruNp m4-1.4.9/checks/171.improved_f m4-1.4.10/checks/171.improved_f --- m4-1.4.9/checks/171.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/171.improved_f 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,72 @@ +dnl @ ../doc/m4.texinfo:6622: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +include(`foreach2.m4') +dnl @result{} +include(`foreachq2.m4') +dnl @result{} +dnl 0-element list: +foreach(`x', `', `') / foreachq(`x', `', `') +dnl @result{} / +dnl 1-element list of empty element +foreach(`x', `()', `') / foreachq(`x', ``'', `') +dnl @result{}<> / <> +dnl 2-element list of empty elements +foreach(`x', `(`',`')', `') / foreachq(`x', ``',`'', `') +dnl @result{}<><> / <><> +dnl 1-element list of a comma +foreach(`x', `(`,')', `') / foreachq(`x', ``,'', `') +dnl @result{}<,> / <,> +dnl 2-element list of unbalanced parentheses +foreach(`x', `(`(', `)')', `') / foreachq(`x', ``(', `)'', `') +dnl @result{}<(><)> / <(><)> +define(`active', `ACT, IVE') +dnl @result{} +traceon(`active') +dnl @result{} +dnl list of unquoted macros; expansion occurs before recursion +foreach(`x', `(active, active)', ` +')dnl +dnl @error{}m4trace: -4- active -> `ACT, IVE' +dnl @error{}m4trace: -4- active -> `ACT, IVE' +dnl @result{} +dnl @result{} +dnl @result{} +dnl @result{} +foreachq(`x', `active, active', ` +')dnl +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @result{} +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @error{}m4trace: -3- active -> `ACT, IVE' +dnl @result{} +dnl @result{} +dnl @result{} +dnl list of quoted macros; expansion occurs during recursion +foreach(`x', `(`active', `active')', ` +')dnl +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{} +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{} +foreachq(`x', ``active', `active'', ` +')dnl +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{} +dnl @error{}m4trace: -1- active -> `ACT, IVE' +dnl @result{} +dnl list of double-quoted macro names; no expansion +foreach(`x', `(``active'', ``active'')', ` +')dnl +dnl @result{} +dnl @result{} +foreachq(`x', ```active'', ``active''', ` +')dnl +dnl @result{} +dnl @result{} diff -ruNp m4-1.4.9/checks/172.improved_c m4-1.4.10/checks/172.improved_c --- m4-1.4.9/checks/172.improved_c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/172.improved_c 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,30 @@ +dnl @ ../doc/m4.texinfo:6699: Origin of test +dnl @ expected status: 0 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`cleardivert', + `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')') +dnl @result{} +divert(`1')one +divert +dnl @result{} +cleardivert +dnl @result{} +undivert +dnl @result{}one +dnl @result{} +define(`cleardivert', + `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', + `undivert`'', `undivert($@)')divert(_num)popdef(`_num')') +dnl @result{} +divert(`2')two +divert +dnl @result{} +cleardivert +dnl @result{} +undivert +dnl @result{} diff -ruNp m4-1.4.9/checks/173.improved_f m4-1.4.10/checks/173.improved_f --- m4-1.4.9/checks/173.improved_f 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/checks/173.improved_f 2007-07-05 08:26:40.000000000 -0600 @@ -0,0 +1,20 @@ +dnl @ ../doc/m4.texinfo:6737: Origin of test +dnl @ expected status: 1 +dnl @ extra options: +dnl @ Copyright (C) 2006, 2007 Free Software Foundation +dnl @ This file is free software; the Free Software Foundation +dnl @ gives unlimited permission to copy and/or distribute it +dnl @ with or without modifications, as long as this notice +dnl @ is preserved. +define(`fatal_error', + `errprint(ifdef(`__program__', `__program__', ``m4'')'dnl +`:ifelse(__line__, `0', `', + `__file__:__line__:')` fatal error: $* +')m4exit(`1')') +dnl @result{} +m4wrap(`divnum(`demo of internal message') +fatal_error(`inside wrapped text')') +dnl @result{} +dnl @error{}m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored +dnl @result{}0 +dnl @error{}m4:stdin:6: fatal error: inside wrapped text diff -ruNp m4-1.4.9/checks/Makefile.in m4-1.4.10/checks/Makefile.in --- m4-1.4.9/checks/Makefile.in 2006-07-14 09:15:58.000000000 -0600 +++ m4-1.4.10/checks/Makefile.in 2007-07-04 21:56:03.000000000 -0600 @@ -1,9 +1,9 @@ ## -## Copyright (C) 1992, 1993, 1994, 2006 Free Software Foundation, Inc. +## Copyright (C) 1992, 1993, 1994, 2006, 2007 Free Software Foundation, Inc. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or +## 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, diff -ruNp m4-1.4.9/checks/check-them m4-1.4.10/checks/check-them --- m4-1.4.9/checks/check-them 2007-01-06 12:56:11.000000000 -0700 +++ m4-1.4.10/checks/check-them 2007-05-25 06:58:49.000000000 -0600 @@ -57,8 +57,9 @@ do continue } echo "Checking $file" + options=`sed -ne '3s/^dnl @ extra options: //p;3q' "$file"` sed -e '/^dnl @/d' -e '/^\^D$/q' "$file" \ - | LC_MESSAGES=C m4 -d -I "$examples" - >$out 2>$err + | LC_MESSAGES=C m4 -d -I "$examples" $options - >$out 2>$err stat=$? xstat=`sed -ne '2s/^dnl @ expected status: //p;2q' "$file"` diff -ruNp m4-1.4.9/checks/get-them m4-1.4.10/checks/get-them --- m4-1.4.9/checks/get-them 2007-01-27 18:54:41.000000000 -0700 +++ m4-1.4.10/checks/get-them 2007-05-25 14:29:17.000000000 -0600 @@ -15,6 +15,7 @@ BEGIN { count = 0; file = "NONE"; status = 0; + options = ""; } /^@node / { @@ -37,6 +38,7 @@ BEGIN { /^@comment ignore$/ { getline; status = 0; + options = ""; next; } @@ -44,6 +46,11 @@ BEGIN { status = $3; } +/^@comment options: / { + options = $0; + gsub ("@comment options:", "", options); +} + /^@example$/, /^@end example$/ { if (seq < 0) next; @@ -55,12 +62,14 @@ BEGIN { file = sprintf("%03d.%s", count, node); printf("dnl @ %s:%d: Origin of test\n"\ "dnl @ expected status: %d\n"\ + "dnl @ extra options: %s\n"\ "dnl @ Copyright (C) 2006, 2007 Free Software Foundation\n"\ "dnl @ This file is free software; the Free Software Foundation\n"\ "dnl @ gives unlimited permission to copy and/or distribute it\n"\ "dnl @ with or without modifications, as long as this notice\n"\ - "dnl @ is preserved.\n", FILENAME, NR, status) > file; + "dnl @ is preserved.\n", FILENAME, NR, status, options) > file; status = 0; + options = ""; next; } if ($0 ~ /^@end example$/) { @@ -68,6 +77,8 @@ BEGIN { } if ($0 ~ /^\^D$/) next; + if ($0 ~ /^\$ @kbd/) + next; if ($0 ~ /^@result\{\}/ || $0 ~ /^@error\{\}/) prefix = "dnl "; else diff -ruNp m4-1.4.9/config.guess m4-1.4.10/config.guess --- m4-1.4.9/config.guess 2007-03-23 06:54:13.000000000 -0600 +++ m4-1.4.10/config.guess 2007-07-09 21:15:35.000000000 -0600 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2007-03-06' +timestamp='2007-05-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -330,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:*) + i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) diff -ruNp m4-1.4.9/config.sub m4-1.4.10/config.sub --- m4-1.4.9/config.sub 2007-03-23 06:54:13.000000000 -0600 +++ m4-1.4.10/config.sub 2007-07-09 21:15:35.000000000 -0600 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2007-01-18' +timestamp='2007-06-28' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -475,8 +475,8 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16c) - basic_machine=cr16c-unknown + cr16) + basic_machine=cr16-unknown os=-elf ;; crds | unos) @@ -683,6 +683,10 @@ case $basic_machine in basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; diff -ruNp m4-1.4.9/configure m4-1.4.10/configure --- m4-1.4.9/configure 2007-03-23 07:32:41.000000000 -0600 +++ m4-1.4.10/configure 2007-07-09 21:15:12.000000000 -0600 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for GNU M4 1.4.9. +# Generated by GNU Autoconf 2.61 for GNU M4 1.4.10. # # Report bugs to . # @@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='GNU M4' PACKAGE_TARNAME='m4' -PACKAGE_VERSION='1.4.9' -PACKAGE_STRING='GNU M4 1.4.9' +PACKAGE_VERSION='1.4.10' +PACKAGE_STRING='GNU M4 1.4.10' PACKAGE_BUGREPORT='bug-m4@gnu.org' ac_unique_file="src/m4.h" @@ -708,26 +708,111 @@ GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE ALLOCA ALLOCA_H +GNULIB_FPRINTF_POSIX +GNULIB_PRINTF_POSIX +GNULIB_SNPRINTF +GNULIB_SPRINTF_POSIX +GNULIB_VFPRINTF_POSIX +GNULIB_VPRINTF_POSIX +GNULIB_VSNPRINTF +GNULIB_VSPRINTF_POSIX +GNULIB_VASPRINTF +GNULIB_FSEEK +GNULIB_FSEEKO +GNULIB_FTELL +GNULIB_FTELLO +GNULIB_FFLUSH +REPLACE_FPRINTF +REPLACE_VFPRINTF +REPLACE_PRINTF +REPLACE_VPRINTF +REPLACE_SNPRINTF +HAVE_DECL_SNPRINTF +REPLACE_VSNPRINTF +HAVE_DECL_VSNPRINTF +REPLACE_SPRINTF +REPLACE_VSPRINTF +HAVE_VASPRINTF +REPLACE_VASPRINTF +HAVE_FSEEKO +REPLACE_FSEEKO +REPLACE_FSEEK +HAVE_FTELLO +REPLACE_FTELLO +REPLACE_FTELL +REPLACE_FFLUSH +INCLUDE_NEXT +NEXT_FLOAT_H +FLOAT_H +GNULIB_FREXP +GNULIB_FREXPL +GNULIB_LDEXPL +GNULIB_MATHL +GNULIB_SIGNBIT +HAVE_DECL_ACOSL +HAVE_DECL_ASINL +HAVE_DECL_ATANL +HAVE_DECL_CEILL +HAVE_DECL_COSL +HAVE_DECL_EXPL +HAVE_DECL_FLOORL +HAVE_DECL_FREXPL +HAVE_DECL_LDEXPL +HAVE_DECL_LOGL +HAVE_DECL_SINL +HAVE_DECL_SQRTL +HAVE_DECL_TANL +REPLACE_FREXP +REPLACE_FREXPL +REPLACE_LDEXPL +REPLACE_SIGNBIT GETOPT_H -ABSOLUTE_SYS_TIME_H +LIBINTL +LTLIBINTL +NEXT_SYS_TIME_H HAVE_SYS_TIME_H HAVE_STRUCT_TIMEVAL REPLACE_GETTIMEOFDAY SYS_TIME_H GLIBC21 +GNULIB_CHOWN +GNULIB_DUP2 +GNULIB_FCHDIR +GNULIB_FTRUNCATE +GNULIB_GETCWD +GNULIB_GETLOGIN_R +GNULIB_LCHOWN +GNULIB_LSEEK +GNULIB_READLINK +GNULIB_SLEEP +HAVE_DUP2 +HAVE_FTRUNCATE +HAVE_READLINK +HAVE_SLEEP +HAVE_DECL_GETLOGIN_R +REPLACE_CHOWN +REPLACE_FCHDIR +REPLACE_GETCWD +REPLACE_LCHOWN +REPLACE_LSEEK +NEXT_MATH_H GNULIB_GETSUBOPT GNULIB_MKDTEMP GNULIB_MKSTEMP HAVE_GETSUBOPT HAVE_MKDTEMP REPLACE_MKSTEMP +GNULIB_SIGPROCMASK +HAVE_POSIX_SIGNALBLOCKING +HAVE_SIGSET_T +NEXT_SIGNAL_H STDBOOL_H HAVE__BOOL HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H -ABSOLUTE_STDINT_H +NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H @@ -745,30 +830,25 @@ SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H -ABSOLUTE_STDLIB_H -ABSOLUTE_SYS_STAT_H +NEXT_STDIO_H +NEXT_STDLIB_H +HAVE_LSTAT +HAVE_DECL_MKDIR +HAVE_IO_H +NEXT_SYS_STAT_H SYS_STAT_H -GNULIB_CHOWN -GNULIB_DUP2 -GNULIB_FCHDIR -GNULIB_FTRUNCATE -GNULIB_GETCWD -GNULIB_GETLOGIN_R -GNULIB_READLINK -HAVE_DUP2 -HAVE_FTRUNCATE -HAVE_READLINK -HAVE_DECL_GETLOGIN_R -REPLACE_CHOWN -REPLACE_FCHDIR -REPLACE_GETCWD +NEXT_UNISTD_H HAVE_UNISTD_H -ABSOLUTE_UNISTD_H EOVERFLOW -ABSOLUTE_WCHAR_H +GNULIB_WCWIDTH +HAVE_DECL_WCWIDTH +REPLACE_WCWIDTH WCHAR_H +HAVE_WCHAR_H +NEXT_WCHAR_H +HAVE_ISWCNTRL HAVE_WINT_T -ABSOLUTE_WCTYPE_H +NEXT_WCTYPE_H HAVE_WCTYPE_H WCTYPE_H LIBM4_LIBDEPS @@ -1291,7 +1371,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 GNU M4 1.4.9 to adapt to many kinds of systems. +\`configure' configures GNU M4 1.4.10 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1361,7 +1441,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU M4 1.4.9:";; + short | recursive ) echo "Configuration of GNU M4 1.4.10:";; esac cat <<\_ACEOF @@ -1371,6 +1451,7 @@ Optional Features: --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-largefile omit support for large files + --disable-assert turn off assertions --enable-changeword enable -W and changeword() builtin Optional Packages: @@ -1460,7 +1541,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNU M4 configure 1.4.9 +GNU M4 configure 1.4.10 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1474,7 +1555,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 GNU M4 $as_me 1.4.9, which was +It was created by GNU M4 $as_me 1.4.10, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1757,23 +1838,32 @@ ac_func_list="$ac_func_list sigvec" ac_func_list="$ac_func_list strerror" ac_header_list="$ac_header_list unistd.h" ac_func_list="$ac_func_list raise" +ac_header_list="$ac_header_list float.h" ac_header_list="$ac_header_list stdio_ext.h" +ac_func_list="$ac_func_list fpurge" +ac_func_list="$ac_func_list __fpurge" +ac_func_list="$ac_func_list __freading" ac_header_list="$ac_header_list sys/time.h" ac_func_list="$ac_func_list gettimeofday" +ac_header_list="$ac_header_list math.h" ac_header_list="$ac_header_list sys/param.h" +gl_printf_safe=yes ac_func_list="$ac_func_list mbsinit" ac_header_list="$ac_header_list locale.h" +ac_func_list="$ac_func_list isblank" ac_func_list="$ac_func_list iswctype" ac_func_list="$ac_func_list mbrtowc" ac_func_list="$ac_func_list wcrtomb" ac_func_list="$ac_func_list wcscoll" +ac_header_list="$ac_header_list signal.h" ac_header_list="$ac_header_list stdint.h" +ac_header_list="$ac_header_list wchar.h" +ac_header_list="$ac_header_list stdio.h" ac_header_list="$ac_header_list stdlib.h" ac_func_list="$ac_func_list lstat" ac_header_list="$ac_header_list sys/stat.h" ac_func_list="$ac_func_list pipe" ac_func_list="$ac_func_list vasnprintf" -ac_header_list="$ac_header_list wchar.h" ac_func_list="$ac_func_list iswcntrl" ac_header_list="$ac_header_list wctype.h" # Check that the precious variables saved in the cache have kept the same @@ -2193,7 +2283,7 @@ fi # Define the identity of the package. PACKAGE='m4' - VERSION='1.4.9' + VERSION='1.4.10' cat >>confdefs.h <<_ACEOF @@ -4519,6 +4609,153 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6; } +if test "${ac_cv_sys_largefile_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_sys_largefile_source=no; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#define _LARGEFILE_SOURCE 1 +#include +int +main () +{ +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_sys_largefile_source=1; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + ac_cv_sys_largefile_source=unknown + break +done +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6; } +case $ac_cv_sys_largefile_source in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source +_ACEOF +;; +esac +rm -f conftest* + +# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug +# in glibc 2.1.3, but that breaks too many other things. +# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. +if test $ac_cv_sys_largefile_source != unknown; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FSEEKO 1 +_ACEOF + +fi + + + + + # IEEE behaviour is the default on all CPUs except Alpha and SH + # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4 + # and the GCC 4.1.2 manual). + case "$host_cpu" in + alpha*) + # On Alpha systems, a compiler option provides the behaviour. + # See the ieee(3) manual page, also available at + # + if test -n "$GCC"; then + # GCC has the option -mieee. + CPPFLAGS="$CPPFLAGS -mieee" + else + # Compaq (ex-DEC) C has the option -ieee. + CPPFLAGS="$CPPFLAGS -ieee" + fi + ;; + sh*) + if test -n "$GCC"; then + # GCC has the option -mieee. + CPPFLAGS="$CPPFLAGS -mieee" + fi + ;; + esac + case $ac_cv_prog_cc_stdc in no) ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; *) { echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 @@ -4869,6 +5106,10 @@ esac + + + + # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then enableval=$enable_largefile; @@ -6481,32 +6722,28 @@ _ACEOF fi - - -for ac_header in stdlib.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then +{ echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 +echo $ECHO_N "checking whether strerror_r is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_strerror_r+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include <$ac_header> +int +main () +{ +#ifndef strerror_r + (void) strerror_r; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -6525,115 +6762,191 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + ac_cv_have_decl_strerror_r=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + ac_cv_have_decl_strerror_r=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strerror_r" >&6; } +if test $ac_cv_have_decl_strerror_r = yes; then -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 0 +_ACEOF + + +fi + + + +for ac_func in strerror_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func - ac_header_preproc=no -fi +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } +#ifdef __STDC__ +# include +#else +# include +#endif -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else - eval "$as_ac_Header=\$ac_header_preproc" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi - done -{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 -echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; } -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then +{ echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5 +echo $ECHO_N "checking whether strerror_r returns char *... $ECHO_C" >&6; } +if test "${ac_cv_func_strerror_r_char_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - ac_cv_func_malloc_0_nonnull=no + + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_func_strerror_r_char_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + # strerror_r is not declared. Choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + if test "$cross_compiling" = yes; then + : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6641,16 +6954,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - +$ac_includes_default + extern char *strerror_r (); int main () { -return ! malloc (0); +char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + return ! isalpha (x); ; return 0; } @@ -6675,60 +6986,52 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_malloc_0_nonnull=yes + ac_cv_func_strerror_r_char_p=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then - gl_cv_func_malloc_0_nonnull=1 -else - gl_cv_func_malloc_0_nonnull=0 -fi - + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5 +echo "${ECHO_T}$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then -cat >>confdefs.h <<_ACEOF -#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull +cat >>confdefs.h <<\_ACEOF +#define STRERROR_R_CHAR_P 1 _ACEOF +fi - { echo "$as_me:$LINENO: checking for long double" >&5 -echo $ECHO_N "checking for long double... $ECHO_C" >&6; } -if test "${gt_cv_c_long_double+set}" = set; then + { echo "$as_me:$LINENO: checking for sig_atomic_t" >&5 +echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6; } +if test "${ac_cv_type_sig_atomic_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$GCC" = yes; then - gt_cv_c_long_double=yes - else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include - /* The Stardent Vistra knows sizeof(long double), but does not support it. */ - long double foo = 0.0; - /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ - int array [2*(sizeof(long double) >= sizeof(double)) - 1]; - +typedef sig_atomic_t ac__type_new_; int main () { - +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -6750,58 +7053,257 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - gt_cv_c_long_double=yes + ac_cv_type_sig_atomic_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gt_cv_c_long_double=no + ac_cv_type_sig_atomic_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi fi -{ echo "$as_me:$LINENO: result: $gt_cv_c_long_double" >&5 -echo "${ECHO_T}$gt_cv_c_long_double" >&6; } - if test $gt_cv_c_long_double = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_sig_atomic_t" >&5 +echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6; } +if test $ac_cv_type_sig_atomic_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIG_ATOMIC_T 1 +_ACEOF + + +else cat >>confdefs.h <<\_ACEOF -#define HAVE_LONG_DOUBLE 1 +#define sig_atomic_t int _ACEOF - fi +fi -{ echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 -echo $ECHO_N "checking whether strerror_r is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_strerror_r+set}" = set; then + + + + + + + GNULIB_FPRINTF_POSIX=0; + GNULIB_PRINTF_POSIX=0; + GNULIB_SNPRINTF=0; + GNULIB_SPRINTF_POSIX=0; + GNULIB_VFPRINTF_POSIX=0; + GNULIB_VPRINTF_POSIX=0; + GNULIB_VSNPRINTF=0; + GNULIB_VSPRINTF_POSIX=0; + GNULIB_VASPRINTF=0; + GNULIB_FSEEK=0; + GNULIB_FSEEKO=0; + GNULIB_FTELL=0; + GNULIB_FTELLO=0; + GNULIB_FFLUSH=0; + REPLACE_FPRINTF=0; + REPLACE_VFPRINTF=0; + REPLACE_PRINTF=0; + REPLACE_VPRINTF=0; + REPLACE_SNPRINTF=0; + HAVE_DECL_SNPRINTF=1; + REPLACE_VSNPRINTF=0; + HAVE_DECL_VSNPRINTF=1; + REPLACE_SPRINTF=0; + REPLACE_VSPRINTF=0; + HAVE_VASPRINTF=1; + REPLACE_VASPRINTF=0; + HAVE_FSEEKO=1; + REPLACE_FSEEKO=0; + REPLACE_FSEEK=0; + HAVE_FTELLO=1; + REPLACE_FTELLO=0; + REPLACE_FTELL=0; + REPLACE_FFLUSH=0; + + + + { echo "$as_me:$LINENO: checking whether the preprocessor supports include_next" >&5 +echo $ECHO_N "checking whether the preprocessor supports include_next... $ECHO_C" >&6; } +if test "${gl_cv_have_include_next+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef strerror_r - (void) strerror_r; -#endif - - ; - return 0; -} +#include_next _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + gl_cv_have_include_next=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_have_include_next=no +fi + +rm -f conftest.err conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gl_cv_have_include_next" >&5 +echo "${ECHO_T}$gl_cv_have_include_next" >&6; } + if test $gl_cv_have_include_next = yes; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INCLUDE_NEXT 1 +_ACEOF + + + INCLUDE_NEXT=include_next + else + INCLUDE_NEXT=include + fi + + + + + + + + + + + + + + GNULIB_FREXP=0; + GNULIB_FREXPL=0; + GNULIB_LDEXPL=0; + GNULIB_MATHL=0; + GNULIB_SIGNBIT=0; + HAVE_DECL_ACOSL=1; + HAVE_DECL_ASINL=1; + HAVE_DECL_ATANL=1; + HAVE_DECL_CEILL=1; + HAVE_DECL_COSL=1; + HAVE_DECL_EXPL=1; + HAVE_DECL_FLOORL=1; + HAVE_DECL_FREXPL=1; + HAVE_DECL_LDEXPL=1; + HAVE_DECL_LOGL=1; + HAVE_DECL_SINL=1; + HAVE_DECL_SQRTL=1; + HAVE_DECL_TANL=1; + REPLACE_FREXP=0; + REPLACE_FREXPL=0; + REPLACE_LDEXPL=0; + REPLACE_SIGNBIT=0; + + + { echo "$as_me:$LINENO: checking whether stdin defaults to large file offsets" >&5 +echo $ECHO_N "checking whether stdin defaults to large file offsets... $ECHO_C" >&6; } +if test "${gl_cv_var_stdin_large_offset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +#if defined __SL64 && defined __SCLE /* cygwin */ + /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making + fseeko/ftello needlessly fail. This bug was fixed at the same time + that cygwin started exporting asnprintf (cygwin 1.7.0), so we use + that as a link-time test for cross-compiles rather than building + a runtime test. */ + size_t s; + if (asnprintf (NULL, &s, "")) + return 0; +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_var_stdin_large_offset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_var_stdin_large_offset=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gl_cv_var_stdin_large_offset" >&5 +echo "${ECHO_T}$gl_cv_var_stdin_large_offset" >&6; } + + + if test -z "$GETOPT_H"; then + +for ac_header in getopt.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -6811,36 +7313,115 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_have_decl_strerror_r=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_strerror_r=no + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 -echo "${ECHO_T}$ac_cv_have_decl_strerror_r" >&6; } -if test $ac_cv_have_decl_strerror_r = yes; then +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRERROR_R 1 +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> _ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRERROR_R 0 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - +else + GETOPT_H=getopt.h fi +done + fi -for ac_func in strerror_r + if test -z "$GETOPT_H"; then + +for ac_func in getopt_long_only do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -6930,32 +7511,33 @@ if test `eval echo '${'$as_ac_var'}'` = #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF +else + GETOPT_H=getopt.h fi done -{ echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5 -echo $ECHO_N "checking whether strerror_r returns char *... $ECHO_C" >&6; } -if test "${ac_cv_func_strerror_r_char_p+set}" = set; then + fi + + if test -z "$GETOPT_H"; then + { echo "$as_me:$LINENO: checking whether optreset is declared" >&5 +echo $ECHO_N "checking whether optreset is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_optreset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - ac_cv_func_strerror_r_char_p=no - if test $ac_cv_have_decl_strerror_r = yes; then - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default +#include + int main () { - - char buf[100]; - char x = *strerror_r (0, buf, sizeof buf); - char *p = strerror_r (0, buf, sizeof buf); - return !p || x; +#ifndef optreset + (void) optreset; +#endif ; return 0; @@ -6978,24 +7560,35 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_func_strerror_r_char_p=yes + ac_cv_have_decl_optreset=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_have_decl_optreset=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else - # strerror_r is not declared. Choose between - # systems that have relatively inaccessible declarations for the - # function. BeOS and DEC UNIX 4.0 fall in this category, but the - # former has a strerror_r that returns char*, while the latter - # has a strerror_r that returns `int'. - # This test should segfault on the DEC system. - if test "$cross_compiling" = yes; then - : +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_optreset" >&5 +echo "${ECHO_T}$ac_cv_have_decl_optreset" >&6; } +if test $ac_cv_have_decl_optreset = yes; then + GETOPT_H=getopt.h +fi + + fi + + if test -z "$GETOPT_H"; then + { echo "$as_me:$LINENO: checking for working GNU getopt function" >&5 +echo $ECHO_N "checking for working GNU getopt function... $ECHO_C" >&6; } +if test "${gl_cv_func_gnu_getopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: checking whether getopt_clip is declared" >&5 +echo $ECHO_N "checking whether getopt_clip is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_getopt_clip+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7003,14 +7596,72 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default - extern char *strerror_r (); +#include + int main () { -char buf[100]; - char x = *strerror_r (0, buf, sizeof buf); - return ! isalpha (x); +#ifndef getopt_clip + (void) getopt_clip; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_getopt_clip=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_getopt_clip=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getopt_clip" >&6; } +if test $ac_cv_have_decl_getopt_clip = yes; then + gl_cv_func_gnu_getopt=no +else + gl_cv_func_gnu_getopt=yes +fi + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + + char *myargv[3]; + myargv[0] = "conftest"; + myargv[1] = "-+"; + myargv[2] = 0; + return getopt (2, myargv, "+a") != '?'; + ; return 0; } @@ -7035,34 +7686,30 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_strerror_r_char_p=yes + gl_cv_func_gnu_getopt=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +gl_cv_func_gnu_getopt=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5 -echo "${ECHO_T}$ac_cv_func_strerror_r_char_p" >&6; } -if test $ac_cv_func_strerror_r_char_p = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STRERROR_R_CHAR_P 1 -_ACEOF - fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_gnu_getopt" >&5 +echo "${ECHO_T}$gl_cv_func_gnu_getopt" >&6; } + if test "$gl_cv_func_gnu_getopt" = "no"; then + GETOPT_H=getopt.h + fi + fi - - { echo "$as_me:$LINENO: checking for sig_atomic_t" >&5 -echo $ECHO_N "checking for sig_atomic_t... $ECHO_C" >&6; } -if test "${ac_cv_type_sig_atomic_t+set}" = set; then +{ echo "$as_me:$LINENO: checking whether getenv is declared" >&5 +echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_getenv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -7071,16 +7718,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - -typedef sig_atomic_t ac__type_new_; +$ac_includes_default int main () { -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; +#ifndef getenv + (void) getenv; +#endif + ; return 0; } @@ -7102,67 +7747,63 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_type_sig_atomic_t=yes + ac_cv_have_decl_getenv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_sig_atomic_t=no + ac_cv_have_decl_getenv=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_sig_atomic_t" >&5 -echo "${ECHO_T}$ac_cv_type_sig_atomic_t" >&6; } -if test $ac_cv_type_sig_atomic_t = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getenv" >&6; } +if test $ac_cv_have_decl_getenv = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_SIG_ATOMIC_T 1 +#define HAVE_DECL_GETENV 1 _ACEOF else - -cat >>confdefs.h <<\_ACEOF -#define sig_atomic_t int + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 0 _ACEOF -fi - - - - - - - +fi - if test -z "$GETOPT_H"; then -for ac_header in getopt.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then +{ echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5 +echo $ECHO_N "checking for C/C++ restrict keyword... $ECHO_C" >&6; } +if test "${ac_cv_c_restrict+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + ac_cv_c_restrict=no + # Try the official restrict keyword, then gcc's __restrict, and + # the less common variants. + for ac_kw in restrict __restrict __restrict__ _Restrict; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + } +int +main () +{ +int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t) + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -7181,120 +7822,97 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + ac_cv_c_restrict=$ac_kw else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } + test "$ac_cv_c_restrict" != no && break + done -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5 +echo "${ECHO_T}$ac_cv_c_restrict" >&6; } + case $ac_cv_c_restrict in + restrict) ;; + no) +cat >>confdefs.h <<\_ACEOF +#define restrict +_ACEOF + ;; + *) cat >>confdefs.h <<_ACEOF +#define restrict $ac_cv_c_restrict +_ACEOF + ;; + esac + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_time_h='<'sys/time.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_sys_time_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_sys_time_h = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> +#include + _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } + gl_cv_next_sys_time_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/sys/time.h#{ + s#.*"\(.*/sys/time.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_sys_time_h='<'sys/time.h'>' + fi -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_next_sys_time_h" >&5 +echo "${ECHO_T}$gl_cv_next_sys_time_h" >&6; } + fi + NEXT_SYS_TIME_H=$gl_cv_next_sys_time_h -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF -else - GETOPT_H=getopt.h -fi -done + if test $ac_cv_header_sys_time_h = yes; then + HAVE_SYS_TIME_H=1 + else + HAVE_SYS_TIME_H=0 fi - if test -z "$GETOPT_H"; then -for ac_func in getopt_long_only -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for struct timeval" >&5 +echo $ECHO_N "checking for struct timeval... $ECHO_C" >&6; } +if test "${gl_cv_sys_struct_timeval+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -7303,53 +7921,27 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif +#if HAVE_SYS_TIME_H + #include + #endif + #include int main () { -return $ac_func (); +static struct timeval x; x.tv_sec = x.tv_usec; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -7358,58 +7950,59 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + } && test -s conftest.$ac_objext; then + gl_cv_sys_struct_timeval=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + gl_cv_sys_struct_timeval=no fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +{ echo "$as_me:$LINENO: result: $gl_cv_sys_struct_timeval" >&5 +echo "${ECHO_T}$gl_cv_sys_struct_timeval" >&6; } + if test $gl_cv_sys_struct_timeval = yes; then + HAVE_STRUCT_TIMEVAL=1 + else + HAVE_STRUCT_TIMEVAL=0 + fi -else - GETOPT_H=getopt.h -fi -done + REPLACE_GETTIMEOFDAY=0 + + if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then + SYS_TIME_H=sys/time.h + else + SYS_TIME_H= fi - if test -z "$GETOPT_H"; then - { echo "$as_me:$LINENO: checking whether optreset is declared" >&5 -echo $ECHO_N "checking whether optreset is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_optreset+set}" = set; then + + + + + + +{ echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6; } +if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - -int -main () -{ -#ifndef optreset - (void) optreset; +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } #endif - ; - return 0; -} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -7428,34 +8021,42 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_have_decl_optreset=yes + ac_cv_c_inline=$ac_kw else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_optreset=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_optreset" >&5 -echo "${ECHO_T}$ac_cv_have_decl_optreset" >&6; } -if test $ac_cv_have_decl_optreset = yes; then - GETOPT_H=getopt.h -fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6; } - fi - if test -z "$GETOPT_H"; then - { echo "$as_me:$LINENO: checking for working GNU getopt function" >&5 -echo $ECHO_N "checking for working GNU getopt function... $ECHO_C" >&6; } -if test "${gl_cv_func_gnu_getopt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - { echo "$as_me:$LINENO: checking whether getopt_clip is declared" >&5 -echo $ECHO_N "checking whether getopt_clip is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_getopt_clip+set}" = set; then +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + + { echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 +echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6; } +if test "${am_cv_langinfo_codeset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -7464,27 +8065,23 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - +#include int main () { -#ifndef getopt_clip - (void) getopt_clip; -#endif - +char* cs = nl_langinfo(CODESET); return !cs; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -7493,91 +8090,33 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_getopt_clip=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + am_cv_langinfo_codeset=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_getopt_clip=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5 -echo "${ECHO_T}$ac_cv_have_decl_getopt_clip" >&6; } -if test $ac_cv_have_decl_getopt_clip = yes; then - gl_cv_func_gnu_getopt=no -else - gl_cv_func_gnu_getopt=yes + am_cv_langinfo_codeset=no fi -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ - - char *myargv[3]; - myargv[0] = "conftest"; - myargv[1] = "-+"; - myargv[2] = 0; - return getopt (2, myargv, "+a") != '?'; - - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gl_cv_func_gnu_getopt=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext -( exit $ac_status ) -gl_cv_func_gnu_getopt=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi +{ echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 +echo "${ECHO_T}$am_cv_langinfo_codeset" >&6; } + if test $am_cv_langinfo_codeset = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_LANGINFO_CODESET 1 +_ACEOF -fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_gnu_getopt" >&5 -echo "${ECHO_T}$gl_cv_func_gnu_getopt" >&6; } - if test "$gl_cv_func_gnu_getopt" = "no"; then - GETOPT_H=getopt.h - fi fi -{ echo "$as_me:$LINENO: checking whether getenv is declared" >&5 -echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_getenv+set}" = set; then +{ echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 +echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -7590,8 +8129,8 @@ $ac_includes_default int main () { -#ifndef getenv - (void) getenv; +#ifndef getc_unlocked + (void) getc_unlocked; #endif ; @@ -7615,63 +8154,120 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_have_decl_getenv=yes + ac_cv_have_decl_getc_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_getenv=no + ac_cv_have_decl_getc_unlocked=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 -echo "${ECHO_T}$ac_cv_have_decl_getenv" >&6; } -if test $ac_cv_have_decl_getenv = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getc_unlocked" >&6; } +if test $ac_cv_have_decl_getc_unlocked = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETENV 1 +#define HAVE_DECL_GETC_UNLOCKED 1 _ACEOF else cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETENV 0 +#define HAVE_DECL_GETC_UNLOCKED 0 _ACEOF fi -{ echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5 -echo $ECHO_N "checking for C/C++ restrict keyword... $ECHO_C" >&6; } -if test "${ac_cv_c_restrict+set}" = set; then + + { echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 +echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6; } +if test "${ac_cv_gnu_library_2_1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_c_restrict=no - # Try the official restrict keyword, then gcc's __restrict, and - # the less common variants. - for ac_kw in restrict __restrict __restrict__ _Restrict; do - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - } -int -main () -{ -int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t) - ; - return 0; -} + +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky GNU user" >/dev/null 2>&1; then + ac_cv_gnu_library_2_1=yes +else + ac_cv_gnu_library_2_1=no +fi +rm -f conftest* + + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 +echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6; } + + GLIBC21="$ac_cv_gnu_library_2_1" + + + + GNULIB_CHOWN=0; + GNULIB_DUP2=0; + GNULIB_FCHDIR=0; + GNULIB_FTRUNCATE=0; + GNULIB_GETCWD=0; + GNULIB_GETLOGIN_R=0; + GNULIB_LCHOWN=0; + GNULIB_LSEEK=0; + GNULIB_READLINK=0; + GNULIB_SLEEP=0; + HAVE_DUP2=1; + HAVE_FTRUNCATE=1; + HAVE_READLINK=1; + HAVE_SLEEP=1; + HAVE_DECL_GETLOGIN_R=1; + REPLACE_CHOWN=0; + REPLACE_FCHDIR=0; + REPLACE_GETCWD=0; + REPLACE_LCHOWN=0; + REPLACE_LSEEK=0; + + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -7690,395 +8286,186 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_c_restrict=$ac_kw + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_restrict" != no && break - done - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5 -echo "${ECHO_T}$ac_cv_c_restrict" >&6; } - case $ac_cv_c_restrict in - restrict) ;; - no) -cat >>confdefs.h <<\_ACEOF -#define restrict -_ACEOF - ;; - *) cat >>confdefs.h <<_ACEOF -#define restrict $ac_cv_c_restrict -_ACEOF - ;; - esac - - - - - - - - - - - - - if test $ac_cv_header_sys_time_h = yes; then - { echo "$as_me:$LINENO: checking absolute name of " >&5 -echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } -if test "${gl_cv_absolute_sys_time_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - - +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } - if test $ac_cv_header_sys_time_h = yes; then - cat >conftest.$ac_ext <<_ACEOF +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -_ACEOF - gl_cv_absolute_sys_time_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | -sed -n '\#/sys/time.h#{s#.*"\(.*/sys/time.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` - fi - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_absolute_sys_time_h" >&5 -echo "${ECHO_T}$gl_cv_absolute_sys_time_h" >&6; } -cat >>confdefs.h <<_ACEOF -#define ABSOLUTE_SYS_TIME_H "$gl_cv_absolute_sys_time_h" +#include <$ac_header> _ACEOF - - - ABSOLUTE_SYS_TIME_H=\"$gl_cv_absolute_sys_time_h\" - HAVE_SYS_TIME_H=1 - else - ABSOLUTE_SYS_TIME_H=\"no/such/file/sys/time.h\" - HAVE_SYS_TIME_H=0 - fi - - - - { echo "$as_me:$LINENO: checking for struct timeval" >&5 -echo $ECHO_N "checking for struct timeval... $ECHO_C" >&6; } -if test "${gl_cv_sys_struct_timeval+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if HAVE_SYS_TIME_H - #include - #endif - #include - -int -main () -{ -static struct timeval x; x.tv_sec = x.tv_usec; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_sys_struct_timeval=yes + }; then + ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_sys_struct_timeval=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_header_preproc=no fi -{ echo "$as_me:$LINENO: result: $gl_cv_sys_struct_timeval" >&5 -echo "${ECHO_T}$gl_cv_sys_struct_timeval" >&6; } - if test $gl_cv_sys_struct_timeval = yes; then - HAVE_STRUCT_TIMEVAL=1 - else - HAVE_STRUCT_TIMEVAL=0 - fi - - - REPLACE_GETTIMEOFDAY=0 - - if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then - SYS_TIME_H=sys/time.h - else - SYS_TIME_H= - fi - - - - - +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } -{ echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6; } -if test "${ac_cv_c_inline+set}" = set; then +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_inline=$ac_kw -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break done -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6; } - - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - - - { echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 -echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6; } -if test "${am_cv_langinfo_codeset+set}" = set; then +{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 +echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; } +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_0_nonnull=no +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + int main () { -char* cs = nl_langinfo(CODESET); return !cs; +return ! malloc (0); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - am_cv_langinfo_codeset=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_malloc_0_nonnull=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - am_cv_langinfo_codeset=no +( exit $ac_status ) +ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 -echo "${ECHO_T}$am_cv_langinfo_codeset" >&6; } - if test $am_cv_langinfo_codeset = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then + gl_cv_func_malloc_0_nonnull=1 +else + gl_cv_func_malloc_0_nonnull=0 +fi -cat >>confdefs.h <<\_ACEOF -#define HAVE_LANGINFO_CODESET 1 -_ACEOF - fi -{ echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 -echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat >>confdefs.h <<_ACEOF +#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -#ifndef getc_unlocked - (void) getc_unlocked; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_getc_unlocked=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_have_decl_getc_unlocked=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 -echo "${ECHO_T}$ac_cv_have_decl_getc_unlocked" >&6; } -if test $ac_cv_have_decl_getc_unlocked = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETC_UNLOCKED 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETC_UNLOCKED 0 -_ACEOF - - -fi - - - - { echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 -echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6; } -if test "${ac_cv_gnu_library_2_1+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Lucky GNU user" >/dev/null 2>&1; then - ac_cv_gnu_library_2_1=yes -else - ac_cv_gnu_library_2_1=no -fi -rm -f conftest* -fi -{ echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 -echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6; } - - GLIBC21="$ac_cv_gnu_library_2_1" - GNULIB_GETSUBOPT=0; @@ -8102,6 +8489,15 @@ echo "${ECHO_T}$ac_cv_gnu_library_2_1" > + + + + GNULIB_SIGPROCMASK=0; + HAVE_POSIX_SIGNALBLOCKING=1; + HAVE_SIGSET_T=1; + + + { echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; } if test "${ac_cv_header_stdbool_h+set}" = set; then @@ -8293,6 +8689,10 @@ _ACEOF + + + + { echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } if test "${ac_cv_header_stat_broken+set}" = set; then @@ -8364,22 +8764,6 @@ fi - GNULIB_CHOWN=0; - GNULIB_DUP2=0; - GNULIB_FCHDIR=0; - GNULIB_FTRUNCATE=0; - GNULIB_GETCWD=0; - GNULIB_GETLOGIN_R=0; - GNULIB_READLINK=0; - HAVE_DUP2=1; - HAVE_FTRUNCATE=1; - HAVE_READLINK=1; - HAVE_DECL_GETLOGIN_R=1; - REPLACE_CHOWN=0; - REPLACE_FCHDIR=0; - REPLACE_GETCWD=0; - - { echo "$as_me:$LINENO: checking whether clearerr_unlocked is declared" >&5 echo $ECHO_N "checking whether clearerr_unlocked is declared... $ECHO_C" >&6; } @@ -9612,132 +9996,6 @@ _ACEOF - { echo "$as_me:$LINENO: checking for wchar_t" >&5 -echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } -if test "${gt_cv_c_wchar_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - wchar_t foo = (wchar_t)'\0'; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gt_cv_c_wchar_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gt_cv_c_wchar_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 -echo "${ECHO_T}$gt_cv_c_wchar_t" >&6; } - if test $gt_cv_c_wchar_t = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WCHAR_T 1 -_ACEOF - - fi - - - { echo "$as_me:$LINENO: checking for wint_t" >&5 -echo $ECHO_N "checking for wint_t... $ECHO_C" >&6; } -if test "${gt_cv_c_wint_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be included - before . */ -#include -#include -#include -#include - wint_t foo = (wchar_t)'\0'; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gt_cv_c_wint_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gt_cv_c_wint_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 -echo "${ECHO_T}$gt_cv_c_wint_t" >&6; } - if test $gt_cv_c_wint_t = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WINT_T 1 -_ACEOF - - fi - - { echo "$as_me:$LINENO: checking for inttypes.h" >&5 echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } if test "${gl_cv_header_inttypes_h+set}" = set; then @@ -9949,122 +10207,232 @@ _ACEOF + { echo "$as_me:$LINENO: checking whether printf supports size specifiers as in C99" >&5 +echo $ECHO_N "checking whether printf supports size specifiers as in C99... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_sizes_c99+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; + darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_printf_sizes_c99="guessing no";; + openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; + solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_sizes_c99="guessing no";; + netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_sizes_c99="guessing no";; + esac - - - - if false; then - GL_COND_LIBTOOL_TRUE= - GL_COND_LIBTOOL_FALSE='#' else - GL_COND_LIBTOOL_TRUE='#' - GL_COND_LIBTOOL_FALSE= -fi - - gl_cond_libtool=false - gl_libdeps= - gl_ltlibdeps= - gl_source_base='lib' - - - - - - if test $ac_cv_func_alloca_works = no; then - : - fi - - # Define an additional variable used in the Makefile substitution. - if test $ac_cv_working_alloca_h = yes; then - { echo "$as_me:$LINENO: checking for alloca as a compiler built-in" >&5 -echo $ECHO_N "checking for alloca as a compiler built-in... $ECHO_C" >&6; } -if test "${gl_cv_rpl_alloca+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if defined __GNUC__ || defined _AIX || defined _MSC_VER - Need own alloca +#include +#include +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +# include #endif - +#if HAVE_INTTYPES_H_WITH_UINTMAX +# include +#endif +static char buf[100]; +int main () +{ +#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX + buf[0] = '\0'; + if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + return 1; +#endif + buf[0] = '\0'; + if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 + || strcmp (buf, "12345672 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 + || strcmp (buf, "12345673 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 + || strcmp (buf, "1.5 33") != 0) + return 1; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Need own alloca" >/dev/null 2>&1; then - gl_cv_rpl_alloca=yes +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_sizes_c99=yes else - gl_cv_rpl_alloca=no -fi -rm -f conftest* - + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +gl_cv_func_printf_sizes_c99=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_rpl_alloca" >&5 -echo "${ECHO_T}$gl_cv_rpl_alloca" >&6; } - if test $gl_cv_rpl_alloca = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA 1 -_ACEOF - - ALLOCA_H=alloca.h - else - ALLOCA_H= - fi - else - ALLOCA_H=alloca.h - fi - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ALLOCA_H 1 -_ACEOF +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_sizes_c99" >&5 +echo "${ECHO_T}$gl_cv_func_printf_sizes_c99" >&6; } + { echo "$as_me:$LINENO: checking whether printf supports 'long double' arguments" >&5 +echo $ECHO_N "checking whether printf supports 'long double' arguments... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + case "$host_os" in + beos*) gl_cv_func_printf_long_double="guessing no";; + mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; + *) gl_cv_func_printf_long_double="guessing yes";; + esac -cat >>confdefs.h <<\_ACEOF -#define SIGNAL_SAFE_LIST 1 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +static char buf[100]; +int main () +{ + buf[0] = '\0'; + if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000e+00 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.75 33") != 0) + return 1; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_long_double=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - M4_LIBOBJS="$M4_LIBOBJS cloexec.$ac_objext" - - - M4_LIBOBJS="$M4_LIBOBJS close-stream.$ac_objext" - - : - +( exit $ac_status ) +gl_cv_func_printf_long_double=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi -cat >>confdefs.h <<\_ACEOF -#define GNULIB_CLOSE_STREAM 1 -_ACEOF +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_long_double" >&5 +echo "${ECHO_T}$gl_cv_func_printf_long_double" >&6; } - M4_LIBOBJS="$M4_LIBOBJS closeout.$ac_objext" - : + { echo "$as_me:$LINENO: checking whether printf supports infinite 'double' arguments" >&5 +echo $ECHO_N "checking whether printf supports infinite 'double' arguments... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_infinite+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; + darwin*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; + hpux*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite="guessing no";; + netbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_infinite="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_infinite="guessing no";; + esac - { echo "$as_me:$LINENO: checking for error_at_line" >&5 -echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6; } -if test "${ac_cv_lib_error_at_line+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10072,82 +10440,146 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () + +#include +#include +static int +strisnan (const char *string, size_t start_index, size_t end_index) { -error_at_line (0, 0, "", 0, "an error occurred"); - ; + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static char buf[100]; +static double zero = 0.0; +int main () +{ + if (sprintf (buf, "%f", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%f", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%f", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%e", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%e", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%e", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%g", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%g", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%g", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_error_at_line=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_infinite=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_error_at_line=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +( exit $ac_status ) +gl_cv_func_printf_infinite=no fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 -echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6; } -if test $ac_cv_lib_error_at_line = no; then - M4_LIBOBJS="$M4_LIBOBJS error.$ac_objext" +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - : - - - - M4_LIBOBJS="$M4_LIBOBJS exitfail.$ac_objext" - - : - - - - - - - +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_infinite" >&5 +echo "${ECHO_T}$gl_cv_func_printf_infinite" >&6; } + if test -n "$gl_printf_safe"; then +cat >>confdefs.h <<\_ACEOF +#define CHECK_PRINTF_SAFE 1 +_ACEOF + fi + case "$gl_cv_func_printf_long_double" in + *yes) + { echo "$as_me:$LINENO: checking whether printf supports infinite 'long double' arguments" >&5 +echo $ECHO_N "checking whether printf supports infinite 'long double' arguments... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_infinite_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + + case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; + *) + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; + darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; + hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite_long_double="guessing no";; + netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_infinite_long_double="guessing no";; + esac + ;; + esac -for ac_func in sigaction -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10155,111 +10587,252 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () +#include +#include +#include +static int +strisnan (const char *string, size_t start_index, size_t end_index) { -return $ac_func (); - ; + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static char buf[100]; +static long double zeroL = 0.0L; +int main () +{ + if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Le", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } +#endif return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_infinite_long_double=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +( exit $ac_status ) +gl_cv_func_printf_infinite_long_double=no fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -done - - - - M4_LIBOBJS="$M4_LIBOBJS fopen-safer.$ac_objext" -cat >>confdefs.h <<\_ACEOF -#define GNULIB_FOPEN_SAFER 1 -_ACEOF - +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_infinite_long_double" >&5 +echo "${ECHO_T}$gl_cv_func_printf_infinite_long_double" >&6; } + ;; + *) + gl_cv_func_printf_infinite_long_double="irrelevant" + ;; + esac + { echo "$as_me:$LINENO: checking whether printf supports the 'a' and 'A' directives" >&5 +echo $ECHO_N "checking whether printf supports the 'a' and 'A' directives... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_directive_a+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + case "$host_os" in + # Guess yes on glibc >= 2.5 systems. + *-gnu*) + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + #include + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) + BZ2908 + #endif + #endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "BZ2908" >/dev/null 2>&1; then + gl_cv_func_printf_directive_a="guessing yes" +else + gl_cv_func_printf_directive_a="guessing no" +fi +rm -f conftest* + ;; + # If we don't know, assume the worst. + *) gl_cv_func_printf_directive_a="guessing no";; + esac -for ac_func in __fpending -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10267,361 +10840,424 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () +#include +#include +static char buf[100]; +int main () { -return $ac_func (); - ; + if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.922p+1 33") != 0 + && strcmp (buf, "0x3.244p+0 33") != 0 + && strcmp (buf, "0x6.488p-1 33") != 0 + && strcmp (buf, "0xc.91p-2 33") != 0)) + return 1; + if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "-0X1.922P+1 33") != 0 + && strcmp (buf, "-0X3.244P+0 33") != 0 + && strcmp (buf, "-0X6.488P-1 33") != 0 + && strcmp (buf, "-0XC.91P-2 33") != 0)) + return 1; + /* This catches a FreeBSD 6.1 bug: it doesn't round. */ + if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.83p+0 33") != 0 + && strcmp (buf, "0x3.05p-1 33") != 0 + && strcmp (buf, "0x6.0ap-2 33") != 0 + && strcmp (buf, "0xc.14p-3 33") != 0)) + return 1; + /* This catches a FreeBSD 6.1 bug. See + */ + if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 + || buf[0] == '0') + return 1; + /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ + if (sprintf (buf, "%.1a", 1.999) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) + return 1; + /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a + glibc 2.4 bug . */ + if (sprintf (buf, "%.1La", 1.999L) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) + return 1; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_directive_a=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" +( exit $ac_status ) +gl_cv_func_printf_directive_a=no fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -else - M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" + + fi -done +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_a" >&5 +echo "${ECHO_T}$gl_cv_func_printf_directive_a" >&6; } - fp_headers=' -# include -# if HAVE_STDIO_EXT_H -# include -# endif -' - { echo "$as_me:$LINENO: checking whether __fpending is declared" >&5 -echo $ECHO_N "checking whether __fpending is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl___fpending+set}" = set; then + + + { echo "$as_me:$LINENO: checking whether printf supports the 'F' directive" >&5 +echo $ECHO_N "checking whether printf supports the 'F' directive... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_directive_f+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + + if test "$cross_compiling" = yes; then + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; + darwin*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; + solaris*) gl_cv_func_printf_directive_f="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_directive_f="guessing no";; + esac + +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$fp_headers -int -main () +#include +#include +static char buf[100]; +int main () { -#ifndef __fpending - (void) __fpending; -#endif - - ; + if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 + || strcmp (buf, "1234567.000000 33") != 0) + return 1; + if (sprintf (buf, "%F", 1.0 / 0.0) < 0 + || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) + return 1; + /* This catches a Cygwin 2007 bug. */ + if (sprintf (buf, "%.F", 1234.0) < 0 + || strcmp (buf, "1234") != 0) + return 1; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl___fpending=yes -else - echo "$as_me: failed program was:" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_directive_f=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl___fpending=no +( exit $ac_status ) +gl_cv_func_printf_directive_f=no fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl___fpending" >&5 -echo "${ECHO_T}$ac_cv_have_decl___fpending" >&6; } -if test $ac_cv_have_decl___fpending = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___FPENDING 1 -_ACEOF -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___FPENDING 0 -_ACEOF - fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_f" >&5 +echo "${ECHO_T}$gl_cv_func_printf_directive_f" >&6; } - if test $ac_cv_func___fpending = no; then - { echo "$as_me:$LINENO: checking how to determine the number of pending output bytes on a stream" >&5 -echo $ECHO_N "checking how to determine the number of pending output bytes on a stream... $ECHO_C" >&6; } -if test "${ac_cv_sys_pending_output_n_bytes+set}" = set; then + + { echo "$as_me:$LINENO: checking whether printf supports the 'n' directive" >&5 +echo $ECHO_N "checking whether printf supports the 'n' directive... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_directive_n+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - for ac_expr in \ - \ - '# glibc2' \ - 'fp->_IO_write_ptr - fp->_IO_write_base' \ - \ - '# traditional Unix' \ - 'fp->_ptr - fp->_base' \ - \ - '# BSD' \ - 'fp->_p - fp->_bf._base' \ - \ - '# SCO, Unixware' \ - '(fp->__ptr ? fp->__ptr - fp->__base : 0)' \ - \ - '# old glibc?' \ - 'fp->__bufp - fp->__buffer' \ - \ - '# old glibc iostream?' \ - 'fp->_pptr - fp->_pbase' \ - \ - '# VMS' \ - '(*fp)->_ptr - (*fp)->_base' \ - \ - '# e.g., DGUX R4.11; the info is not available' \ - 1 \ - ; do + if test "$cross_compiling" = yes; then - # Skip each embedded comment. - case "$ac_expr" in '#'*) continue;; esac + case "$host_os" in + *) gl_cv_func_printf_directive_n="guessing yes";; + esac - cat >conftest.$ac_ext <<_ACEOF +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () +#include +#include +static char buf[100]; +int main () { -FILE *fp = stdin; (void) ($ac_expr); - ; + int count = -1; + if (sprintf (buf, "%d %n", 123, &count, 33, 44, 55) < 0 + || strcmp (buf, "123 ") != 0 + || count != 4) + return 1; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - fp_done=yes - + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_directive_n=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - +( exit $ac_status ) +gl_cv_func_printf_directive_n=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$fp_done" = yes && break - done - - ac_cv_sys_pending_output_n_bytes=$ac_expr fi -{ echo "$as_me:$LINENO: result: $ac_cv_sys_pending_output_n_bytes" >&5 -echo "${ECHO_T}$ac_cv_sys_pending_output_n_bytes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define PENDING_OUTPUT_N_BYTES $ac_cv_sys_pending_output_n_bytes -_ACEOF +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_directive_n" >&5 +echo "${ECHO_T}$gl_cv_func_printf_directive_n" >&6; } - fi - { echo "$as_me:$LINENO: checking whether free (NULL) is known to work" >&5 -echo $ECHO_N "checking whether free (NULL) is known to work... $ECHO_C" >&6; } -if test "${gl_cv_func_free+set}" = set; then + { echo "$as_me:$LINENO: checking whether printf supports POSIX/XSI format strings with positions" >&5 +echo $ECHO_N "checking whether printf supports POSIX/XSI format strings with positions... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_positions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + + if test "$cross_compiling" = yes; then + + case "$host_os" in + netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) + gl_cv_func_printf_positions="guessing no";; + beos*) gl_cv_func_printf_positions="guessing no";; + mingw* | pw*) gl_cv_func_printf_positions="guessing no";; + *) gl_cv_func_printf_positions="guessing yes";; + esac + +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () + +#include +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () { -#if _POSIX_VERSION < 199009L && \ - (defined unix || defined _unix || defined _unix_ \ - || defined __unix || defined __unix__) - #error "'free (NULL)' is not known to work" - #endif - ; - return 0; + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_func_free=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_positions=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_free=no +( exit $ac_status ) +gl_cv_func_printf_positions=no fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_free" >&5 -echo "${ECHO_T}$gl_cv_func_free" >&6; } - if test $gl_cv_func_free = no; then - M4_LIBOBJS="$M4_LIBOBJS free.$ac_objext" -cat >>confdefs.h <<\_ACEOF -#define free rpl_free -_ACEOF - fi +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_positions" >&5 +echo "${ECHO_T}$gl_cv_func_printf_positions" >&6; } - if test -n "$GETOPT_H"; then + { echo "$as_me:$LINENO: checking whether printf supports the grouping flag" >&5 +echo $ECHO_N "checking whether printf supports the grouping flag... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_flag_grouping+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else - M4_LIBOBJS="$M4_LIBOBJS getopt.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS getopt1.$ac_objext" + if test "$cross_compiling" = yes; then - GETOPT_H=getopt.h + case "$host_os" in + cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; + netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; + mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; + *) gl_cv_func_printf_flag_grouping="guessing yes";; + esac -cat >>confdefs.h <<\_ACEOF -#define __GETOPT_PREFIX rpl_ +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +static char buf[100]; +int main () +{ + if (sprintf (buf, "%'d %d", 1234567, 99) < 0 + || buf[strlen (buf) - 1] != '9') + return 1; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_printf_flag_grouping=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - - - - - - - - +( exit $ac_status ) +gl_cv_func_printf_flag_grouping=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_flag_grouping" >&5 +echo "${ECHO_T}$gl_cv_func_printf_flag_grouping" >&6; } + { echo "$as_me:$LINENO: checking whether printf supports the zero flag correctly" >&5 +echo $ECHO_N "checking whether printf supports the zero flag correctly... $ECHO_C" >&6; } +if test "${gl_cv_func_printf_flag_zero+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_flag_zero="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_flag_zero="guessing no";; + esac - - - - { echo "$as_me:$LINENO: checking for gettimeofday with POSIX signature" >&5 -echo $ECHO_N "checking for gettimeofday with POSIX signature... $ECHO_C" >&6; } -if test "${gl_cv_func_gettimeofday_posix_signature+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10629,87 +11265,16 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - struct timeval c; -int -main () -{ - - int (*f) (struct timeval *restrict, void *restrict) = gettimeofday; - int x = f (&c, 0); - return !(x | c.tv_sec | c.tv_usec); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_func_gettimeofday_posix_signature=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - gl_cv_func_gettimeofday_posix_signature=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_posix_signature" >&5 -echo "${ECHO_T}$gl_cv_func_gettimeofday_posix_signature" >&6; } - - - - - { echo "$as_me:$LINENO: checking whether gettimeofday clobbers localtime buffer" >&5 -echo $ECHO_N "checking whether gettimeofday clobbers localtime buffer... $ECHO_C" >&6; } -if test "${gl_cv_func_gettimeofday_clobber+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - gl_cv_func_gettimeofday_clobber=yes -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include #include - #include - #include - #include - -int -main () +static char buf[100]; +int main () { - - time_t t = 0; - struct tm *lt; - struct tm saved_lt; - struct timeval tv; - lt = localtime (&t); - saved_lt = *lt; - gettimeofday (&tv, NULL); - return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0; - - ; + if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 + || (strcmp (buf, " inf") != 0 + && strcmp (buf, " infinity") != 0)) + return 1; return 0; } _ACEOF @@ -10733,63 +11298,192 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_gettimeofday_clobber=no + gl_cv_func_printf_flag_zero=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_gettimeofday_clobber=yes +gl_cv_func_printf_flag_zero=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_clobber" >&5 -echo "${ECHO_T}$gl_cv_func_gettimeofday_clobber" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_func_printf_flag_zero" >&5 +echo "${ECHO_T}$gl_cv_func_printf_flag_zero" >&6; } - if test $gl_cv_func_gettimeofday_clobber = yes; then - REPLACE_GETTIMEOFDAY=1 - SYS_TIME_H=sys/time.h - M4_LIBOBJS="$M4_LIBOBJS gettimeofday.$ac_objext" + GNULIB_WCWIDTH=0; + HAVE_DECL_WCWIDTH=1; + REPLACE_WCWIDTH=0; + WCHAR_H= -for ac_header in sys/timeb.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + + + + + + + + + if false; then + GL_COND_LIBTOOL_TRUE= + GL_COND_LIBTOOL_FALSE='#' +else + GL_COND_LIBTOOL_TRUE='#' + GL_COND_LIBTOOL_FALSE= +fi + + gl_cond_libtool=false + gl_libdeps= + gl_ltlibdeps= + gl_source_base='lib' + + + + + + if test $ac_cv_func_alloca_works = no; then + : + fi + + # Define an additional variable used in the Makefile substitution. + if test $ac_cv_working_alloca_h = yes; then + { echo "$as_me:$LINENO: checking for alloca as a compiler built-in" >&5 +echo $ECHO_N "checking for alloca as a compiler built-in... $ECHO_C" >&6; } +if test "${gl_cv_rpl_alloca+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if defined __GNUC__ || defined _AIX || defined _MSC_VER + Need own alloca +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Need own alloca" >/dev/null 2>&1; then + gl_cv_rpl_alloca=yes +else + gl_cv_rpl_alloca=no fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +rm -f conftest* + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_rpl_alloca" >&5 +echo "${ECHO_T}$gl_cv_rpl_alloca" >&6; } + if test $gl_cv_rpl_alloca = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA 1 +_ACEOF + + ALLOCA_H=alloca.h + else + ALLOCA_H= + fi + else + ALLOCA_H=alloca.h + fi + + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA_H 1 +_ACEOF + + + + { echo "$as_me:$LINENO: checking whether to enable assertions" >&5 +echo $ECHO_N "checking whether to enable assertions... $ECHO_C" >&6; } + # Check whether --enable-assert was given. +if test "${enable_assert+set}" = set; then + enableval=$enable_assert; { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define NDEBUG 1 +_ACEOF + else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +fi + + + +cat >>confdefs.h <<\_ACEOF +#define SIGNAL_SAFE_LIST 1 +_ACEOF + + + M4_LIBOBJS="$M4_LIBOBJS cloexec.$ac_objext" + + + M4_LIBOBJS="$M4_LIBOBJS close-stream.$ac_objext" + + : + + + +cat >>confdefs.h <<\_ACEOF +#define GNULIB_CLOSE_STREAM 1 +_ACEOF + + + + M4_LIBOBJS="$M4_LIBOBJS closein.$ac_objext" + + : + + + M4_LIBOBJS="$M4_LIBOBJS closeout.$ac_objext" + + : + + + + { echo "$as_me:$LINENO: checking for error_at_line" >&5 +echo $ECHO_N "checking for error_at_line... $ECHO_C" >&6; } +if test "${ac_cv_lib_error_at_line+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include +int +main () +{ +error_at_line (0, 0, "", 0, "an error occurred"); + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -10798,111 +11492,51 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_error_at_line=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + ac_cv_lib_error_at_line=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5 +echo "${ECHO_T}$ac_cv_lib_error_at_line" >&6; } +if test $ac_cv_lib_error_at_line = no; then + M4_LIBOBJS="$M4_LIBOBJS error.$ac_objext" fi -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + : -fi -done + + M4_LIBOBJS="$M4_LIBOBJS exitfail.$ac_objext" + + : -for ac_func in _ftime + + + + + + + + + + + + + + +for ac_func in sigaction do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -10997,177 +11631,175 @@ done -cat >>confdefs.h <<\_ACEOF -#define gmtime rpl_gmtime -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define localtime rpl_localtime -_ACEOF - - - -cat >>confdefs.h <<\_ACEOF -#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1 -_ACEOF - - fi - - - if test $gl_cv_func_gettimeofday_posix_signature != yes; then - REPLACE_GETTIMEOFDAY=1 - SYS_TIME_H=sys/time.h - if test $gl_cv_func_gettimeofday_clobber != yes; then - M4_LIBOBJS="$M4_LIBOBJS gettimeofday.$ac_objext" - - -for ac_header in sys/timeb.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking whether fflush works on input streams" >&5 +echo $ECHO_N "checking whether fflush works on input streams... $ECHO_C" >&6; } +if test "${gl_cv_func_fflush_stdin+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + echo hello world > conftest.txt + if test "$cross_compiling" = yes; then + gl_cv_func_fflush_stdin=no +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> + +#include +#include + +int +main () +{ +FILE *f = fopen ("conftest.txt", "r"); + char buffer[10]; + int fd = fileno (f); + if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5) + return 2; + /* For deterministic results, ensure f read a bigger buffer. */ + if (lseek (fd, 0, SEEK_CUR) == 5) + return 3; + /* POSIX requires fflush-fseek to set file offset of fd. */ + if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0) + return 4; + return !(lseek (fd, 0, SEEK_CUR) == 5); + + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_fflush_stdin=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no +( exit $ac_status ) +gl_cv_func_fflush_stdin=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + rm conftest.txt + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_fflush_stdin" >&5 +echo "${ECHO_T}$gl_cv_func_fflush_stdin" >&6; } + if test $gl_cv_func_fflush_stdin = no; then + + M4_LIBOBJS="$M4_LIBOBJS fflush.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" + + REPLACE_FFLUSH=1 + REPLACE_FSEEKO=1 + + fi + + + + GNULIB_FFLUSH=1 + + + + + FLOAT_H= + case "$host_os" in + beos*) + FLOAT_H=float.h + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_float_h='<'float.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_float_h = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> +#include + _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + gl_cv_next_float_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/float.h#{ + s#.*"\(.*/float.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_float_h='<'float.h'>' + fi - ac_header_preproc=no fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_float_h" >&5 +echo "${ECHO_T}$gl_cv_next_float_h" >&6; } + fi + NEXT_FLOAT_H=$gl_cv_next_float_h -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 + ;; + esac + + + + M4_LIBOBJS="$M4_LIBOBJS fopen-safer.$ac_objext" + + + +cat >>confdefs.h <<\_ACEOF +#define GNULIB_FOPEN_SAFER 1 _ACEOF -fi -done -for ac_func in _ftime + + + + + + +for ac_func in __fpending do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -11257,36 +11889,37 @@ if test `eval echo '${'$as_ac_var'}'` = #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF +else + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi done - - fi - fi - - - - { echo "$as_me:$LINENO: checking whether the compiler generally respects inline" >&5 -echo $ECHO_N "checking whether the compiler generally respects inline... $ECHO_C" >&6; } -if test "${gl_cv_c_inline_effective+set}" = set; then + fp_headers=' +# include +# if HAVE_STDIO_EXT_H +# include +# endif +' + { echo "$as_me:$LINENO: checking whether __fpending is declared" >&5 +echo $ECHO_N "checking whether __fpending is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl___fpending+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test $ac_cv_c_inline = no; then - gl_cv_c_inline_effective=no - else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +$fp_headers int main () { -#ifdef __NO_INLINE__ - #error "inline is not effective" - #endif +#ifndef __fpending + (void) __fpending; +#endif + ; return 0; } @@ -11308,66 +11941,86 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - gl_cv_c_inline_effective=yes + ac_cv_have_decl___fpending=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_c_inline_effective=no + ac_cv_have_decl___fpending=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - fi -{ echo "$as_me:$LINENO: result: $gl_cv_c_inline_effective" >&5 -echo "${ECHO_T}$gl_cv_c_inline_effective" >&6; } - if test $gl_cv_c_inline_effective = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl___fpending" >&5 +echo "${ECHO_T}$ac_cv_have_decl___fpending" >&6; } +if test $ac_cv_have_decl___fpending = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_INLINE 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___FPENDING 1 _ACEOF - fi - - - - - - - +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___FPENDING 0 +_ACEOF +fi + if test $ac_cv_func___fpending = no; then + { echo "$as_me:$LINENO: checking how to determine the number of pending output bytes on a stream" >&5 +echo $ECHO_N "checking how to determine the number of pending output bytes on a stream... $ECHO_C" >&6; } +if test "${ac_cv_sys_pending_output_n_bytes+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + for ac_expr in \ + \ + '# glibc2' \ + 'fp->_IO_write_ptr - fp->_IO_write_base' \ + \ + '# traditional Unix' \ + 'fp->_ptr - fp->_base' \ + \ + '# BSD' \ + 'fp->_p - fp->_bf._base' \ + \ + '# SCO, Unixware' \ + '(fp->__ptr ? fp->__ptr - fp->__base : 0)' \ + \ + '# old glibc?' \ + 'fp->__bufp - fp->__buffer' \ + \ + '# old glibc iostream?' \ + 'fp->_pptr - fp->_pbase' \ + \ + '# VMS' \ + '(*fp)->_ptr - (*fp)->_base' \ + \ + '# e.g., DGUX R4.11; the info is not available' \ + 1 \ + ; do + # Skip each embedded comment. + case "$ac_expr" in '#'*) continue;; esac -for ac_header in stdlib.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include + +int +main () +{ +FILE *fp = stdin; (void) ($ac_expr); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -11386,245 +12039,207 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + fp_done=yes + else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } + test "$fp_done" = yes && break + done -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + ac_cv_sys_pending_output_n_bytes=$ac_expr + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_pending_output_n_bytes" >&5 +echo "${ECHO_T}$ac_cv_sys_pending_output_n_bytes" >&6; } + +cat >>confdefs.h <<_ACEOF +#define PENDING_OUTPUT_N_BYTES $ac_cv_sys_pending_output_n_bytes +_ACEOF + + fi + + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking whether fpurge is declared" >&5 +echo $ECHO_N "checking whether fpurge is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_fpurge+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> +#include + +int +main () +{ +#ifndef fpurge + (void) fpurge; +#endif + + ; + return 0; +} _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_fpurge=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no + ac_cv_have_decl_fpurge=no fi -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fpurge" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fpurge" >&6; } +if test $ac_cv_have_decl_fpurge = yes; then -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPURGE 1 +_ACEOF + + +else cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_DECL_FPURGE 0 _ACEOF + fi -done -{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 -echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; } -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then + + + + + + + + + + + { echo "$as_me:$LINENO: checking whether free (NULL) is known to work" >&5 +echo $ECHO_N "checking whether free (NULL) is known to work... $ECHO_C" >&6; } +if test "${gl_cv_func_free+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - ac_cv_func_malloc_0_nonnull=no -else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - +#include int main () { -return ! malloc (0); +#if _POSIX_VERSION < 199009L && \ + (defined unix || defined _unix || defined _unix_ \ + || defined __unix || defined __unix__) + #error "'free (NULL)' is not known to work" + #endif ; return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_malloc_0_nonnull=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_func_free=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + gl_cv_func_free=no fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 1 -_ACEOF - -else - cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 0 -_ACEOF +{ echo "$as_me:$LINENO: result: $gl_cv_func_free" >&5 +echo "${ECHO_T}$gl_cv_func_free" >&6; } - M4_LIBOBJS="$M4_LIBOBJS malloc.$ac_objext" + if test $gl_cv_func_free = no; then + M4_LIBOBJS="$M4_LIBOBJS free.$ac_objext" cat >>confdefs.h <<\_ACEOF -#define malloc rpl_malloc +#define free rpl_free _ACEOF -fi - - - + fi -for ac_func in mkdtemp -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking whether frexpl() can be used without linking with libm" >&5 +echo $ECHO_N "checking whether frexpl() can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_frexpl_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - +#include + long double x; int main () { -return $ac_func (); +int e; return frexpl (x, &e) > 0; ; return 0; } @@ -11647,53 +12262,36 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + gl_cv_func_frexpl_no_libm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + gl_cv_func_frexpl_no_libm=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -else - M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" fi -done - - if test $ac_cv_func_mkdtemp = no; then - HAVE_MKDTEMP=0 - : - - fi - - - - GNULIB_MKDTEMP=1 +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_frexpl_no_libm" >&6; } + if test $gl_cv_func_frexpl_no_libm = yes; then - - - - { echo "$as_me:$LINENO: checking for working mkstemp" >&5 -echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6; } -if test "${gl_cv_func_working_mkstemp+set}" = set; then + { echo "$as_me:$LINENO: checking whether frexpl works" >&5 +echo $ECHO_N "checking whether frexpl works... $ECHO_C" >&6; } +if test "${gl_cv_func_frexpl_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - mkdir conftest.mkstemp if test "$cross_compiling" = yes; then - gl_cv_func_working_mkstemp=no + case "$host_os" in + aix* | beos* | darwin* | irix* | mingw* | pw*) + gl_cv_func_frexpl_works="guessing no";; + *) gl_cv_func_frexpl_works="guessing yes";; + esac + else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11701,25 +12299,54 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -int i; - off_t large = (off_t) 4294967295u; - if (large < 0) - large = 2147483647; - for (i = 0; i < 70; i++) - { - char templ[] = "conftest.mkstemp/coXXXXXX"; - int (*mkstemp_function) (char *) = mkstemp; - int fd = mkstemp_function (templ); - if (fd < 0 || lseek (fd, large, SEEK_SET) != large) - return 1; - close (fd); - } - return 0; - ; + +#include +extern long double frexpl (long double, int *); +int main() +{ + volatile long double x; + /* Test on finite numbers that fails on AIX 5.1. */ + x = 16.0L; + { + int exp = -9999; + frexpl (x, &exp); + if (exp != 5) + return 1; + } + /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl + function returns an invalid (incorrectly normalized) value: it returns + y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } + but the correct result is + 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ + x = 1.01L; + { + int exp = -9999; + long double y = frexpl (x, &exp); + if (!(exp == 1 && y == 0.505L)) + return 1; + } + /* Test on large finite numbers. This fails on BeOS at i = 16322, while + LDBL_MAX_EXP = 16384. + In the loop end test, we test x against Infinity, rather than comparing + i with LDBL_MAX_EXP, because BeOS has a wrong LDBL_MAX_EXP. */ + { + int i; + for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) + { + int exp = -9999; + frexpl (x, &exp); + if (exp != i) + return 1; + } + } + /* Test on infinite numbers. */ + x = 1.0L / 0.0L; + { + int exp; + long double y = frexpl (x, &exp); + if (y != x) + return 1; + } return 0; } _ACEOF @@ -11743,39 +12370,41 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_working_mkstemp=yes + gl_cv_func_frexpl_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_working_mkstemp=no +gl_cv_func_frexpl_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - rm -rf conftest.mkstemp fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_working_mkstemp" >&5 -echo "${ECHO_T}$gl_cv_func_working_mkstemp" >&6; } - - if test $gl_cv_func_working_mkstemp != yes; then - REPLACE_MKSTEMP=1 - M4_LIBOBJS="$M4_LIBOBJS mkstemp.$ac_objext" - +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_works" >&5 +echo "${ECHO_T}$gl_cv_func_frexpl_works" >&6; } + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + REPLACE_FREXPL=1 fi + if test $gl_func_frexpl_no_libm = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_FREXPL_IN_LIBC 1 +_ACEOF - - GNULIB_MKSTEMP=1 - - { echo "$as_me:$LINENO: checking for obstacks" >&5 -echo $ECHO_N "checking for obstacks... $ECHO_C" >&6; } -if test "${ac_cv_func_obstack+set}" = set; then + { echo "$as_me:$LINENO: checking whether frexpl is declared" >&5 +echo $ECHO_N "checking whether frexpl is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_frexpl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -11784,28 +12413,27 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default - #include "obstack.h" +#include + int main () { -struct obstack mem; - #define obstack_chunk_alloc malloc - #define obstack_chunk_free free - obstack_init (&mem); - obstack_free (&mem, 0); +#ifndef frexpl + (void) frexpl; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -11814,80 +12442,67 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_func_obstack=yes + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_frexpl=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_func_obstack=no + ac_cv_have_decl_frexpl=no fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_obstack" >&5 -echo "${ECHO_T}$ac_cv_func_obstack" >&6; } -if test $ac_cv_func_obstack = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_OBSTACK 1 -_ACEOF - +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_frexpl" >&5 +echo "${ECHO_T}$ac_cv_have_decl_frexpl" >&6; } +if test $ac_cv_have_decl_frexpl = yes; then + : else - M4_LIBOBJS="$M4_LIBOBJS obstack.$ac_objext" + HAVE_DECL_FREXPL=0 fi + else + HAVE_DECL_FREXPL=0 + M4_LIBOBJS="$M4_LIBOBJS frexpl.$ac_objext" + fi + GNULIB_FREXPL=1 - - - - - M4_LIBOBJS="$M4_LIBOBJS quotearg.$ac_objext" - - - - - - - - { echo "$as_me:$LINENO: checking for mbstate_t" >&5 -echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6; } -if test "${ac_cv_type_mbstate_t+set}" = set; then + { echo "$as_me:$LINENO: checking for fseeko" >&5 +echo $ECHO_N "checking for fseeko... $ECHO_C" >&6; } +if test "${gl_cv_func_fseeko+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -# include +#include int main () { -mbstate_t x; return sizeof x; +fseeko (stdin, 0, 0); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -11896,53 +12511,62 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_mbstate_t=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_fseeko=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_mbstate_t=no + gl_cv_func_fseeko=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5 -echo "${ECHO_T}$ac_cv_type_mbstate_t" >&6; } - if test $ac_cv_type_mbstate_t = yes; then +{ echo "$as_me:$LINENO: result: $gl_cv_func_fseeko" >&5 +echo "${ECHO_T}$gl_cv_func_fseeko" >&6; } + if test $gl_cv_func_fseeko = no; then + HAVE_FSEEKO=0 -cat >>confdefs.h <<\_ACEOF -#define HAVE_MBSTATE_T 1 -_ACEOF + M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" - else + REPLACE_FSEEKO=1 -cat >>confdefs.h <<\_ACEOF -#define mbstate_t int -_ACEOF + elif test $gl_cv_var_stdin_large_offset = no; then - fi + M4_LIBOBJS="$M4_LIBOBJS fseeko.$ac_objext" - { echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 -echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6; } -if test "${gl_cv_func_mbrtowc+set}" = set; then + REPLACE_FSEEKO=1 + + fi + + + + GNULIB_FSEEKO=1 + + + + + + { echo "$as_me:$LINENO: checking for ftello" >&5 +echo $ECHO_N "checking for ftello... $ECHO_C" >&6; } +if test "${gl_cv_func_ftello+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include int main () { -wchar_t wc; - char const s[] = ""; - size_t n = 1; - mbstate_t state; - return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); +ftello (stdin); ; return 0; } @@ -11965,26 +12589,52 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - gl_cv_func_mbrtowc=yes + gl_cv_func_ftello=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_mbrtowc=no + gl_cv_func_ftello=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext + fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_mbrtowc" >&5 -echo "${ECHO_T}$gl_cv_func_mbrtowc" >&6; } - if test $gl_cv_func_mbrtowc = yes; then +{ echo "$as_me:$LINENO: result: $gl_cv_func_ftello" >&5 +echo "${ECHO_T}$gl_cv_func_ftello" >&6; } + if test $gl_cv_func_ftello = no; then + HAVE_FTELLO=0 + + M4_LIBOBJS="$M4_LIBOBJS ftello.$ac_objext" + + REPLACE_FTELLO=1 + + elif test $gl_cv_var_stdin_large_offset = no; then + + M4_LIBOBJS="$M4_LIBOBJS ftello.$ac_objext" + + REPLACE_FTELLO=1 + + fi + + + + GNULIB_FTELLO=1 + + + + if test -n "$GETOPT_H"; then + + M4_LIBOBJS="$M4_LIBOBJS getopt.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS getopt1.$ac_objext" + + GETOPT_H=getopt.h cat >>confdefs.h <<\_ACEOF -#define HAVE_MBRTOWC 1 +#define __GETOPT_PREFIX rpl_ _ACEOF - fi @@ -11994,29 +12644,87 @@ _ACEOF +fi -# Check whether --with-included-regex was given. -if test "${with_included_regex+set}" = set; then - withval=$with_included_regex; + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking for gettimeofday with POSIX signature" >&5 +echo $ECHO_N "checking for gettimeofday with POSIX signature... $ECHO_C" >&6; } +if test "${gl_cv_func_gettimeofday_posix_signature+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + struct timeval c; + +int +main () +{ + + int (*f) (struct timeval *restrict, void *restrict) = gettimeofday; + int x = f (&c, 0); + return !(x | c.tv_sec | c.tv_usec); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_func_gettimeofday_posix_signature=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_gettimeofday_posix_signature=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_posix_signature" >&5 +echo "${ECHO_T}$gl_cv_func_gettimeofday_posix_signature" >&6; } - case $with_included_regex in #( - yes|no) ac_use_included_regex=$with_included_regex - ;; - '') - # If the system regex support is good enough that it passes the - # following run test, then default to *not* using the included regex.c. - # If cross compiling, assume the test would fail and use the included - # regex.c. - { echo "$as_me:$LINENO: checking for working re_compile_pattern" >&5 -echo $ECHO_N "checking for working re_compile_pattern... $ECHO_C" >&6; } -if test "${gl_cv_func_re_compile_pattern_working+set}" = set; then + + + + { echo "$as_me:$LINENO: checking whether gettimeofday clobbers localtime buffer" >&5 +echo $ECHO_N "checking whether gettimeofday clobbers localtime buffer... $ECHO_C" >&6; } +if test "${gl_cv_func_gettimeofday_clobber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - gl_cv_func_re_compile_pattern_working=no + gl_cv_func_gettimeofday_clobber=yes else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12024,122 +12732,24 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default - #if HAVE_LOCALE_H - #include - #endif - #include - #include +#include + #include + #include + #include int main () { -static struct re_pattern_buffer regex; - unsigned char folded_chars[UCHAR_MAX + 1]; - int i; - const char *s; - struct re_registers regs; - #if HAVE_LOCALE_H - /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html - This test needs valgrind to catch the bug on Debian - GNU/Linux 3.1 x86, but it might catch the bug better - on other platforms and it shouldn't hurt to try the - test here. */ - if (setlocale (LC_ALL, "en_US.UTF-8")) - { - static char const pat[] = "insert into"; - static char const data[] = - "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; - re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE - | RE_ICASE); - memset (®ex, 0, sizeof regex); - s = re_compile_pattern (pat, sizeof pat - 1, ®ex); - if (s) - return 1; - if (re_search (®ex, data, sizeof data - 1, - 0, sizeof data - 1, ®s) - != -1) - return 1; - if (! setlocale (LC_ALL, "C")) - return 1; - } - #endif - - /* This test is from glibc bug 3957, reported by Andrew Mackey. */ - re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("a[^x]b", 6, ®ex); - if (s) - return 1; - - /* This should fail, but succeeds for glibc-2.5. */ - if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) - return 1; - - /* This regular expression is from Spencer ere test number 75 - in grep-2.3. */ - re_set_syntax (RE_SYNTAX_POSIX_EGREP); - memset (®ex, 0, sizeof regex); - for (i = 0; i <= UCHAR_MAX; i++) - folded_chars[i] = i; - regex.translate = folded_chars; - s = re_compile_pattern ("a[[:]:]]b\n", 11, ®ex); - /* This should fail with _Invalid character class name_ error. */ - if (!s) - return 1; - - /* This should succeed, but does not for glibc-2.1.3. */ - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("{1", 2, ®ex); - - if (s) - return 1; - - /* The following example is derived from a problem report - against gawk from Jorge Stolfi . */ - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("[an\371]*n", 7, ®ex); - if (s) - return 1; - - /* This should match, but does not for glibc-2.2.1. */ - if (re_match (®ex, "an", 2, 0, ®s) != 2) - return 1; - - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("x", 1, ®ex); - if (s) - return 1; - - /* glibc-2.2.93 does not work with a negative RANGE argument. */ - if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) - return 1; - - /* The version of regex.c in older versions of gnulib - ignored RE_ICASE. Detect that problem too. */ - re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); - memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("x", 1, ®ex); - if (s) - return 1; - - if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) - return 1; - - /* REG_STARTEND was added to glibc on 2004-01-15. - Reject older versions. */ - if (! REG_STARTEND) - return 1; - - /* Reject hosts whose regoff_t values are too narrow. - These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t - and 32-bit int. */ - if (sizeof (regoff_t) < sizeof (ptrdiff_t) - || sizeof (regoff_t) < sizeof (ssize_t)) - return 1; + time_t t = 0; + struct tm *lt; + struct tm saved_lt; + struct timeval tv; + lt = localtime (&t); + saved_lt = *lt; + gettimeofday (&tv, NULL); + return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0; - return 0; ; return 0; } @@ -12164,153 +12774,54 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gl_cv_func_re_compile_pattern_working=yes + gl_cv_func_gettimeofday_clobber=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -gl_cv_func_re_compile_pattern_working=no +gl_cv_func_gettimeofday_clobber=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_func_re_compile_pattern_working" >&5 -echo "${ECHO_T}$gl_cv_func_re_compile_pattern_working" >&6; } - case $gl_cv_func_re_compile_pattern_working in #( - yes) ac_use_included_regex=no;; #( - no) ac_use_included_regex=yes;; - esac - ;; - *) { { echo "$as_me:$LINENO: error: Invalid value for --with-included-regex: $with_included_regex" >&5 -echo "$as_me: error: Invalid value for --with-included-regex: $with_included_regex" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if test $ac_use_included_regex = yes; then - -cat >>confdefs.h <<\_ACEOF -#define _REGEX_LARGE_OFFSETS 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_syntax_options rpl_re_syntax_options -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_set_syntax rpl_re_set_syntax -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_compile_pattern rpl_re_compile_pattern -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_compile_fastmap rpl_re_compile_fastmap -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_search rpl_re_search -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_search_2 rpl_re_search_2 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_match rpl_re_match -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_match_2 rpl_re_match_2 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_set_registers rpl_re_set_registers -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_comp rpl_re_comp -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define re_exec rpl_re_exec -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define regcomp rpl_regcomp -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define regexec rpl_regexec -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define regerror rpl_regerror -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define regfree rpl_regfree -_ACEOF - - M4_LIBOBJS="$M4_LIBOBJS regex.$ac_objext" - - - - - - - - - - - +{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_clobber" >&5 +echo "${ECHO_T}$gl_cv_func_gettimeofday_clobber" >&6; } + if test $gl_cv_func_gettimeofday_clobber = yes; then + REPLACE_GETTIMEOFDAY=1 + SYS_TIME_H=sys/time.h + M4_LIBOBJS="$M4_LIBOBJS gettimeofday.$ac_objext" - { echo "$as_me:$LINENO: checking whether isblank is declared" >&5 -echo $ECHO_N "checking whether isblank is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_isblank+set}" = set; then +for ac_header in sys/timeb.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - -int -main () -{ -#ifndef isblank - (void) isblank; -#endif - - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -12329,60 +12840,115 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_cv_have_decl_isblank=yes + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_isblank=no + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isblank" >&5 -echo "${ECHO_T}$ac_cv_have_decl_isblank" >&6; } -if test $ac_cv_have_decl_isblank = yes; then +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ISBLANK 1 +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ISBLANK 0 +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> _ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } - fi - - - signals_not_posix= - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sigset_t" >/dev/null 2>&1; then - : -else - signals_not_posix=1 fi -rm -f conftest* - if test -z "$signals_not_posix"; then - { echo "$as_me:$LINENO: checking for sigprocmask" >&5 -echo $ECHO_N "checking for sigprocmask... $ECHO_C" >&6; } -if test "${ac_cv_func_sigprocmask+set}" = set; then +done + + +for ac_func in _ftime +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -12391,12 +12957,12 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define sigprocmask to an innocuous variant, in case declares sigprocmask. +/* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ -#define sigprocmask innocuous_sigprocmask +#define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char sigprocmask (); below. + which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ @@ -12406,7 +12972,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include #endif -#undef sigprocmask +#undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC @@ -12414,18 +12980,18 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char sigprocmask (); +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined __stub_sigprocmask || defined __stub___sigprocmask +#if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { -return sigprocmask (); +return $ac_func (); ; return 0; } @@ -12448,119 +13014,56 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_func_sigprocmask=yes + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_func_sigprocmask=no + eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_func_sigprocmask" >&5 -echo "${ECHO_T}$ac_cv_func_sigprocmask" >&6; } -if test $ac_cv_func_sigprocmask = yes; then - gl_cv_func_sigprocmask=1 -fi - - fi - if test -n "$gl_cv_func_sigprocmask"; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_POSIX_SIGNALBLOCKING 1 -_ACEOF - - else - M4_LIBOBJS="$M4_LIBOBJS sigprocmask.$ac_objext" - - { echo "$as_me:$LINENO: checking for sigset_t" >&5 -echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6; } -if test "${ac_cv_type_sigset_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -/* Mingw defines sigset_t not in , but in . */ -#include - -typedef sigset_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_sigset_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_sigset_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_sigset_t" >&5 -echo "${ECHO_T}$ac_cv_type_sigset_t" >&6; } -if test $ac_cv_type_sigset_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_SIGSET_T 1 -_ACEOF +done -gl_cv_type_sigset_t=yes -else - gl_cv_type_sigset_t=no -fi - if test $gl_cv_type_sigset_t = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_SIGSET_T 1 +#define gmtime rpl_gmtime _ACEOF - fi - +cat >>confdefs.h <<\_ACEOF +#define localtime rpl_localtime +_ACEOF +cat >>confdefs.h <<\_ACEOF +#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1 +_ACEOF + fi - fi + if test $gl_cv_func_gettimeofday_posix_signature != yes; then + REPLACE_GETTIMEOFDAY=1 + SYS_TIME_H=sys/time.h + if test $gl_cv_func_gettimeofday_clobber != yes; then + M4_LIBOBJS="$M4_LIBOBJS gettimeofday.$ac_objext" -for ac_header in stdint.h +for ac_header in sys/timeb.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -12704,52 +13207,127 @@ fi done - { echo "$as_me:$LINENO: checking for SIZE_MAX" >&5 -echo $ECHO_N "checking for SIZE_MAX... $ECHO_C" >&6; } - if test "${gl_cv_size_max+set}" = set; then + +for ac_func in _ftime +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - gl_cv_size_max= - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#if HAVE_STDINT_H -#include +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include #endif -#ifdef SIZE_MAX -Found it + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me #endif +int +main () +{ +return $ac_func (); + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Found it" >/dev/null 2>&1; then - gl_cv_size_max=yes +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" fi -rm -f conftest* - if test -z "$gl_cv_size_max"; then - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + fi + fi + + + + { echo "$as_me:$LINENO: checking whether the compiler generally respects inline" >&5 +echo $ECHO_N "checking whether the compiler generally respects inline... $ECHO_C" >&6; } +if test "${gl_cv_c_inline_effective+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test $ac_cv_c_inline = no; then + gl_cv_c_inline_effective=no + else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include + int main () { -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= 0)]; -test_array [0] = 0 - +#ifdef __NO_INLINE__ + #error "inline is not effective" + #endif ; return 0; } @@ -12771,34 +13349,59 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF + gl_cv_c_inline_effective=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_c_inline_effective=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_c_inline_effective" >&5 +echo "${ECHO_T}$gl_cv_c_inline_effective" >&6; } + if test $gl_cv_c_inline_effective = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INLINE 1 +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking whether isnan(double) can be used without linking with libm" >&5 +echo $ECHO_N "checking whether isnan(double) can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_isnan_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +#include + double x; int main () { -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $ac_mid)]; -test_array [0] = 0 - +return isnan (x); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -12807,39 +13410,77 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_isnan_no_libm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` + gl_cv_func_isnan_no_libm=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnan_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_isnan_no_libm" >&6; } + if test $gl_cv_func_isnan_no_libm = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ISNAN_IN_LIBC 1 +_ACEOF + + else + M4_LIBOBJS="$M4_LIBOBJS isnan.$ac_objext" + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'double'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_double_expbit0+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include + +#if defined arm || defined __arm || defined __arm__ + mixed_endianness +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "mixed_endianness" >/dev/null 2>&1; then + gl_cv_cc_double_expbit0="unknown" +else + + : +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + int main () { -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) < 0)]; -test_array [0] = 0 +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif ; return 0; @@ -12862,21 +13503,22 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +#include +#include + int main () { -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= $ac_mid)]; -test_array [0] = 0 +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif ; return 0; @@ -12899,49 +13541,39 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break + ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo= ac_hi= -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { -static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $ac_mid)]; -test_array [0] = 0 - + _ascii (); _ebcdic (); ; return 0; } @@ -12963,20 +13595,25 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr '(' $ac_mid ')' + 1` + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) size_t_bits_minus_1=$ac_lo;; -'') size_t_bits_minus_1= ;; -esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12984,34 +13621,19 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include -static long int longval () { return sizeof (size_t) * CHAR_BIT - 1; } -static unsigned long int ulongval () { return sizeof (size_t) * CHAR_BIT - 1; } -#include -#include +$ac_includes_default int main () { - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if ((sizeof (size_t) * CHAR_BIT - 1) < 0) - { - long int i = longval (); - if (i != (sizeof (size_t) * CHAR_BIT - 1)) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != (sizeof (size_t) * CHAR_BIT - 1)) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; ; return 0; @@ -13037,121 +13659,214 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - size_t_bits_minus_1=`cat conftest.val` + ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -size_t_bits_minus_1= +ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.val - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +: +case $ac_cv_c_bigendian in + yes) + gl_cv_cc_double_expbit0="word 0 bit 20" ;; + no) + gl_cv_cc_double_expbit0="word 1 bit 20" ;; + *) + gl_cv_cc_double_expbit0="unknown" ;; +esac + + +fi +rm -f conftest* + + +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + +#include #include -int -main () +#include +#include +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (double x) +{ + memory_double m; + size_t i; + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= 0)]; -test_array [0] = 0 - - ; - return 0; + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); } + _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_try") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break + (exit $ac_status); }; }; then + gl_cv_cc_double_expbit0=`cat conftest.out` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` +( exit $ac_status ) +gl_cv_cc_double_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done + + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_double_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_double_expbit0" >&6; } + case "$gl_cv_cc_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define DBL_EXPBIT0_WORD $word +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define DBL_EXPBIT0_BIT $bit +_ACEOF + + ;; + esac + + fi + + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'double'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_double_expbit0+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + +#if defined arm || defined __arm || defined __arm__ + mixed_endianness +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "mixed_endianness" >/dev/null 2>&1; then + gl_cv_cc_double_expbit0="unknown" +else + + : +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) < 0)]; -test_array [0] = 0 +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif ; return 0; @@ -13174,20 +13889,22 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include +#include + int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= $ac_mid)]; -test_array [0] = 0 +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif ; return 0; @@ -13210,48 +13927,39 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break + ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo= ac_hi= -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { -static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; -test_array [0] = 0 - + _ascii (); _ebcdic (); ; return 0; } @@ -13273,20 +13981,25 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr '(' $ac_mid ')' + 1` + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) fits_in_uint=$ac_lo;; -'') fits_in_uint= ;; -esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -13294,33 +14007,19 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -static long int longval () { return sizeof (size_t) <= sizeof (unsigned int); } -static unsigned long int ulongval () { return sizeof (size_t) <= sizeof (unsigned int); } -#include -#include +$ac_includes_default int main () { - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if ((sizeof (size_t) <= sizeof (unsigned int)) < 0) - { - long int i = longval (); - if (i != (sizeof (size_t) <= sizeof (unsigned int))) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != (sizeof (size_t) <= sizeof (unsigned int))) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; ; return 0; @@ -13346,117 +14045,201 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - fits_in_uint=`cat conftest.val` + ac_cv_c_bigendian=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -fits_in_uint= +ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.val - if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then - if test $fits_in_uint = 1; then - cat >conftest.$ac_ext <<_ACEOF + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +: +case $ac_cv_c_bigendian in + yes) + gl_cv_cc_double_expbit0="word 0 bit 20" ;; + no) + gl_cv_cc_double_expbit0="word 1 bit 20" ;; + *) + gl_cv_cc_double_expbit0="unknown" ;; +esac + + +fi +rm -f conftest* + + +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - extern size_t foo; - extern unsigned long foo; -int -main () +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (double x) +{ + memory_double m; + size_t i; + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () { - - ; - return 0; + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); } + _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - fits_in_uint=0 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_double_expbit0=`cat conftest.out` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - +( exit $ac_status ) +gl_cv_cc_double_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $fits_in_uint = 1; then - gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" - else - gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" - fi - else - gl_cv_size_max='((size_t)~(size_t)0)' - fi - fi + + rm -f conftest.out fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_double_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_double_expbit0" >&6; } + case "$gl_cv_cc_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define DBL_EXPBIT0_WORD $word +_ACEOF - { echo "$as_me:$LINENO: result: $gl_cv_size_max" >&5 -echo "${ECHO_T}$gl_cv_size_max" >&6; } - if test "$gl_cv_size_max" != yes; then cat >>confdefs.h <<_ACEOF -#define SIZE_MAX $gl_cv_size_max +#define DBL_EXPBIT0_BIT $bit _ACEOF - fi + ;; + esac - { echo "$as_me:$LINENO: checking for ssize_t" >&5 -echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; } -if test "${gt_cv_ssize_t+set}" = set; then + + { echo "$as_me:$LINENO: checking whether isnan(float) can be used without linking with libm" >&5 +echo $ECHO_N "checking whether isnan(float) can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_isnanf_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include + #ifdef isnan + # undef isnanf + # define isnanf(x) isnan ((float)(x)) + #endif + float x; int main () { -int x = sizeof (ssize_t *) + sizeof (ssize_t); - return !x; +return isnanf (x); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -13465,389 +14248,435 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gt_cv_ssize_t=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_isnanf_no_libm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gt_cv_ssize_t=no + gl_cv_func_isnanf_no_libm=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $gt_cv_ssize_t" >&5 -echo "${ECHO_T}$gt_cv_ssize_t" >&6; } - if test $gt_cv_ssize_t = no; then +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext -cat >>confdefs.h <<\_ACEOF -#define ssize_t int -_ACEOF +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanf_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_isnanf_no_libm" >&6; } - fi + if test $gl_cv_func_isnanf_no_libm = yes; then - { echo "$as_me:$LINENO: checking for va_copy" >&5 -echo $ECHO_N "checking for va_copy... $ECHO_C" >&6; } - if test "${gl_cv_func_va_copy+set}" = set; then + { echo "$as_me:$LINENO: checking whether isnan(float) works" >&5 +echo $ECHO_N "checking whether isnan(float) works... $ECHO_C" >&6; } +if test "${gl_cv_func_isnanf_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + case "$host_os" in + irix* | solaris*) gl_cv_func_isnanf_works="guessing no";; + *) gl_cv_func_isnanf_works="guessing yes";; + esac + +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () -{ -#ifndef va_copy -void (*func) (va_list, va_list) = va_copy; +#include +#ifdef isnan +# undef isnanf +# define isnanf(x) isnan ((float)(x)) +#endif +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static float +NaN () +{ + static float zero = 0.0f; + return zero / zero; +} +#else +# define NaN() (0.0f / 0.0f) #endif - - ; +int main() +{ + if (!isnanf (NaN ())) + return 1; + if (isnanf (1.0f / 0.0f)) + return 1; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_func_va_copy=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_isnanf_works=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func_va_copy=no +( exit $ac_status ) +gl_cv_func_isnanf_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanf_works" >&5 +echo "${ECHO_T}$gl_cv_func_isnanf_works" >&6; } - { echo "$as_me:$LINENO: result: $gl_cv_func_va_copy" >&5 -echo "${ECHO_T}$gl_cv_func_va_copy" >&6; } - if test $gl_cv_func_va_copy = no; then - # Provide a substitute, either __va_copy or as a simple assignment. - if test "${gl_cv_func___va_copy+set}" = set; then + fi + if test $gl_cv_func_isnanf_no_libm = yes \ + && { case "$gl_cv_func_isnanf_works" in + *yes) true;; + *) false;; + esac + }; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ISNANF_IN_LIBC 1 +_ACEOF + + else + M4_LIBOBJS="$M4_LIBOBJS isnanf.$ac_objext" + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'float'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'float'... $ECHO_C" >&6; } +if test "${gl_cv_cc_float_expbit0+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + gl_cv_cc_float_expbit0="word 0 bit 23" +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () -{ - -#ifndef __va_copy -error, bail out -#endif - ; - return 0; +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } memory_float; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (float x) +{ + memory_float m; + size_t i; + /* Clear it first, in case + sizeof (float) < sizeof (memory_float). */ + memset (&m, 0, sizeof (memory_float)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25f); + add_to_ored_words (0.5f); + add_to_ored_words (1.0f); + add_to_ored_words (2.0f); + add_to_ored_words (4.0f); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); } + _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_func___va_copy=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_float_expbit0=`cat conftest.out` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - gl_cv_func___va_copy=no +( exit $ac_status ) +gl_cv_cc_float_expbit0="unknown" fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - if test $gl_cv_func___va_copy = yes; then - -cat >>confdefs.h <<\_ACEOF -#define va_copy __va_copy -_ACEOF - - else + rm -f conftest.out +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_float_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_float_expbit0" >&6; } + case "$gl_cv_cc_float_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` -cat >>confdefs.h <<\_ACEOF -#define va_copy gl_va_copy +cat >>confdefs.h <<_ACEOF +#define FLT_EXPBIT0_WORD $word _ACEOF - fi - fi - - +cat >>confdefs.h <<_ACEOF +#define FLT_EXPBIT0_BIT $bit +_ACEOF - # Define two additional variables used in the Makefile substitution. + ;; + esac - if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' - else - STDBOOL_H='stdbool.h' fi - if test "$ac_cv_type__Bool" = yes; then - HAVE__BOOL=1 - else - HAVE__BOOL=0 - fi - - - - - - if test $ac_cv_type_long_long_int = yes; then - HAVE_LONG_LONG_INT=1 - else - HAVE_LONG_LONG_INT=0 - fi - - - if test $ac_cv_type_unsigned_long_long_int = yes; then - HAVE_UNSIGNED_LONG_LONG_INT=1 - else - HAVE_UNSIGNED_LONG_LONG_INT=0 - fi - - - if test $ac_cv_header_inttypes_h = yes; then - HAVE_INTTYPES_H=1 - else - HAVE_INTTYPES_H=0 - fi - - - if test $ac_cv_header_sys_types_h = yes; then - HAVE_SYS_TYPES_H=1 - else - HAVE_SYS_TYPES_H=0 - fi - - - if test $ac_cv_header_stdint_h = yes; then - { echo "$as_me:$LINENO: checking absolute name of " >&5 -echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } -if test "${gl_cv_absolute_stdint_h+set}" = set; then + { echo "$as_me:$LINENO: checking where to find the exponent in a 'float'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'float'... $ECHO_C" >&6; } +if test "${gl_cv_cc_float_expbit0+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - - - - if test $ac_cv_header_stdint_h = yes; then - cat >conftest.$ac_ext <<_ACEOF + if test "$cross_compiling" = yes; then + gl_cv_cc_float_expbit0="word 0 bit 23" +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include + +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } memory_float; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (float x) +{ + memory_float m; + size_t i; + /* Clear it first, in case + sizeof (float) < sizeof (memory_float). */ + memset (&m, 0, sizeof (memory_float)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25f); + add_to_ored_words (0.5f); + add_to_ored_words (1.0f); + add_to_ored_words (2.0f); + add_to_ored_words (4.0f); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + _ACEOF - gl_cv_absolute_stdint_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | -sed -n '\#/stdint.h#{s#.*"\(.*/stdint.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` - fi +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_float_expbit0=`cat conftest.out` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_cc_float_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f conftest.out fi -{ echo "$as_me:$LINENO: result: $gl_cv_absolute_stdint_h" >&5 -echo "${ECHO_T}$gl_cv_absolute_stdint_h" >&6; } +{ echo "$as_me:$LINENO: result: $gl_cv_cc_float_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_float_expbit0" >&6; } + case "$gl_cv_cc_float_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` + cat >>confdefs.h <<_ACEOF -#define ABSOLUTE_STDINT_H "$gl_cv_absolute_stdint_h" +#define FLT_EXPBIT0_WORD $word _ACEOF - ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\" - HAVE_STDINT_H=1 - else - ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\" - HAVE_STDINT_H=0 - fi +cat >>confdefs.h <<_ACEOF +#define FLT_EXPBIT0_BIT $bit +_ACEOF + + ;; + esac - if test $ac_cv_header_stdint_h = yes; then - { echo "$as_me:$LINENO: checking whether stdint.h conforms to C99" >&5 -echo $ECHO_N "checking whether stdint.h conforms to C99... $ECHO_C" >&6; } -if test "${gl_cv_header_working_stdint_h+set}" = set; then + { echo "$as_me:$LINENO: checking whether isnan(long double) can be used without linking with libm" >&5 +echo $ECHO_N "checking whether isnan(long double) can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_isnanl_no_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - gl_cv_header_working_stdint_h=no - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#include ABSOLUTE_STDINT_H -#ifdef INT8_MAX -int8_t a1 = INT8_MAX; -int8_t a1min = INT8_MIN; -#endif -#ifdef INT16_MAX -int16_t a2 = INT16_MAX; -int16_t a2min = INT16_MIN; -#endif -#ifdef INT32_MAX -int32_t a3 = INT32_MAX; -int32_t a3min = INT32_MIN; -#endif -#ifdef INT64_MAX -int64_t a4 = INT64_MAX; -int64_t a4min = INT64_MIN; -#endif -#ifdef UINT8_MAX -uint8_t b1 = UINT8_MAX; -#else -typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; -#endif -#ifdef UINT16_MAX -uint16_t b2 = UINT16_MAX; -#endif -#ifdef UINT32_MAX -uint32_t b3 = UINT32_MAX; -#endif -#ifdef UINT64_MAX -uint64_t b4 = UINT64_MAX; -#endif -int_least8_t c1 = INT8_C (0x7f); -int_least8_t c1max = INT_LEAST8_MAX; -int_least8_t c1min = INT_LEAST8_MIN; -int_least16_t c2 = INT16_C (0x7fff); -int_least16_t c2max = INT_LEAST16_MAX; -int_least16_t c2min = INT_LEAST16_MIN; -int_least32_t c3 = INT32_C (0x7fffffff); -int_least32_t c3max = INT_LEAST32_MAX; -int_least32_t c3min = INT_LEAST32_MIN; -int_least64_t c4 = INT64_C (0x7fffffffffffffff); -int_least64_t c4max = INT_LEAST64_MAX; -int_least64_t c4min = INT_LEAST64_MIN; -uint_least8_t d1 = UINT8_C (0xff); -uint_least8_t d1max = UINT_LEAST8_MAX; -uint_least16_t d2 = UINT16_C (0xffff); -uint_least16_t d2max = UINT_LEAST16_MAX; -uint_least32_t d3 = UINT32_C (0xffffffff); -uint_least32_t d3max = UINT_LEAST32_MAX; -uint_least64_t d4 = UINT64_C (0xffffffffffffffff); -uint_least64_t d4max = UINT_LEAST64_MAX; -int_fast8_t e1 = INT_FAST8_MAX; -int_fast8_t e1min = INT_FAST8_MIN; -int_fast16_t e2 = INT_FAST16_MAX; -int_fast16_t e2min = INT_FAST16_MIN; -int_fast32_t e3 = INT_FAST32_MAX; -int_fast32_t e3min = INT_FAST32_MIN; -int_fast64_t e4 = INT_FAST64_MAX; -int_fast64_t e4min = INT_FAST64_MIN; -uint_fast8_t f1 = UINT_FAST8_MAX; -uint_fast16_t f2 = UINT_FAST16_MAX; -uint_fast32_t f3 = UINT_FAST32_MAX; -uint_fast64_t f4 = UINT_FAST64_MAX; -#ifdef INTPTR_MAX -intptr_t g = INTPTR_MAX; -intptr_t gmin = INTPTR_MIN; -#endif -#ifdef UINTPTR_MAX -uintptr_t h = UINTPTR_MAX; -#endif -intmax_t i = INTMAX_MAX; -uintmax_t j = UINTMAX_MAX; -struct s { - int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1; - int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1; - int check_SIZE: 0 < SIZE_MAX ? 1 : -1; - int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1; - int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1; - - /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ - int check_UINT8_C: - (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; - int check_UINT16_C: - (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; - - /* Detect bugs in OpenBSD 3.9 stdint.h. */ -#ifdef UINT8_MAX - int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; -#endif -#ifdef UINT16_MAX - int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; -#endif -#ifdef UINT32_MAX - int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; -#endif -#ifdef UINT64_MAX - int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; -#endif - int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; - int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; - int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; - int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; - int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; - int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; - int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; - int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; - int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; - int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; - int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; -}; - +#include + #ifdef isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x; int main () { - +return isnanl (x); ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -13856,339 +14685,525 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - gl_cv_header_working_stdint_h=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_isnanl_no_libm=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + gl_cv_func_isnanl_no_libm=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + fi -{ echo "$as_me:$LINENO: result: $gl_cv_header_working_stdint_h" >&5 -echo "${ECHO_T}$gl_cv_header_working_stdint_h" >&6; } - fi - if test "$gl_cv_header_working_stdint_h" = yes; then - STDINT_H= - else +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanl_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_isnanl_no_libm" >&6; } + gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm + if test $gl_func_isnanl_no_libm = yes; then -for ac_header in sys/inttypes.h sys/bitypes.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + + + { echo "$as_me:$LINENO: checking whether isnanl works" >&5 +echo $ECHO_N "checking whether isnanl works... $ECHO_C" >&6; } +if test "${gl_cv_func_isnanl_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + + if test "$cross_compiling" = yes; then + case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_isnanl_works="guessing no";; + *) + case "$host_os" in + netbsd*) gl_cv_func_isnanl_works="guessing no";; + *) gl_cv_func_isnanl_works="guessing yes";; + esac + ;; + esac + +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> + +#include +#include +#include +#ifdef isnan +# undef isnanl +# define isnanl(x) isnan ((long double)(x)) +#endif +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { unsigned int word[NWORDS]; long double value; } + memory_long_double; +int main () +{ + memory_long_double m; + unsigned int i; + + /* The isnanl function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit (since the exponent never extends to + bit 31). */ + m.value = 0.0L / 0.0L; + m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); + for (i = 0; i < NWORDS; i++) + m.word[i] |= 1; + if (!isnanl (m.value)) + return 1; + +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { + /* Signalling NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in + Intel IA-64 Architecture Software Developer's Manual, Volume 1: + Application Architecture. + Table 5-2 "Floating-Point Register Encodings" + Figure 5-6 "Memory to Floating-Point Register Data Translation" + */ + { /* Pseudo-NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Infinity. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Zero. */ + static memory_long_double x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Unnormalized number. */ + static memory_long_double x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Denormal. */ + static memory_long_double x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } +#endif + + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_isnanl_works=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no +( exit $ac_status ) +gl_cv_func_isnanl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_isnanl_works" >&5 +echo "${ECHO_T}$gl_cv_func_isnanl_works" >&6; } + + case "$gl_cv_func_isnanl_works" in + *yes) ;; + *) gl_func_isnanl_no_libm=no ;; + esac + fi + if test $gl_func_isnanl_no_libm = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ISNANL_IN_LIBC 1 +_ACEOF + + else + M4_LIBOBJS="$M4_LIBOBJS isnanl.$ac_objext" + + + { echo "$as_me:$LINENO: checking where to find the exponent in a 'long double'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'long double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_long_double_expbit0+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + gl_cv_cc_long_double_expbit0="unknown" + +else + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <$ac_header> + +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_long_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (long double x) +{ + memory_long_double m; + size_t i; + /* Clear it first, in case + sizeof (long double) < sizeof (memory_long_double). */ + memset (&m, 0, sizeof (memory_long_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25L); + add_to_ored_words (0.5L); + add_to_ored_words (1.0L); + add_to_ored_words (2.0L); + add_to_ored_words (4.0L); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_long_double_expbit0=`cat conftest.out` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" +( exit $ac_status ) +gl_cv_cc_long_double_expbit0="unknown" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF -fi -done + rm -f conftest.out - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 - else - HAVE_SYS_INTTYPES_H=0 - fi +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_long_double_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_long_double_expbit0" >&6; } + case "$gl_cv_cc_long_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 - else - HAVE_SYS_BITYPES_H=0 - fi +cat >>confdefs.h <<_ACEOF +#define LDBL_EXPBIT0_WORD $word +_ACEOF +cat >>confdefs.h <<_ACEOF +#define LDBL_EXPBIT0_BIT $bit +_ACEOF + ;; + esac + fi + { echo "$as_me:$LINENO: checking where to find the exponent in a 'long double'" >&5 +echo $ECHO_N "checking where to find the exponent in a 'long double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_long_double_expbit0+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + gl_cv_cc_long_double_expbit0="unknown" - for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do - { echo "$as_me:$LINENO: checking for bit size of $gltype" >&5 -echo $ECHO_N "checking for bit size of $gltype... $ECHO_C" >&6; } -if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #include - #include - #include - -#include -int -main () +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_long_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (long double x) +{ + memory_long_double m; + size_t i; + /* Clear it first, in case + sizeof (long double) < sizeof (memory_long_double). */ + memset (&m, 0, sizeof (memory_long_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () { -static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= 0)]; -test_array [0] = 0 - - ; - return 0; + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25L); + add_to_ored_words (0.5L); + add_to_ored_words (1.0L); + add_to_ored_words (2.0L); + add_to_ored_words (4.0L); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); } + _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_lo=0 ac_mid=0 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #include - #include - #include - -#include -int -main () -{ -static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_try") 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid; break + (exit $ac_status); }; }; then + gl_cv_cc_long_double_expbit0=`cat conftest.out` else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr $ac_mid + 1` - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid + 1` +( exit $ac_status ) +gl_cv_cc_long_double_expbit0="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_long_double_expbit0" >&5 +echo "${ECHO_T}$gl_cv_cc_long_double_expbit0" >&6; } + case "$gl_cv_cc_long_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define LDBL_EXPBIT0_WORD $word _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #include - #include - #include -#include -int -main () -{ -static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) < 0)]; -test_array [0] = 0 +cat >>confdefs.h <<_ACEOF +#define LDBL_EXPBIT0_BIT $bit +_ACEOF - ; - return 0; + ;; + esac + + + + + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking whether lseek detects pipes" >&5 +echo $ECHO_N "checking whether lseek detects pipes... $ECHO_C" >&6; } +if test "${gl_cv_func_lseek_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test $cross_compiling = no; then + cat >conftest.$ac_ext <<_ACEOF + +#include /* for off_t */ +#include /* for SEEK_CUR */ +#include +int main () +{ + /* Exit with success only if stdin is seekable. */ + return lseek (0, (off_t)0, SEEK_CUR) < 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -14197,34 +15212,31 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_hi=-1 ac_mid=-1 - while :; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + if test -s conftest$ac_exeext \ + && ./conftest$ac_exeext < conftest.$ac_ext \ + && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then + gl_cv_func_lseek_pipe=yes + else + gl_cv_func_lseek_pipe=no + fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #include - #include - #include + gl_cv_func_lseek_pipe=no +fi -#include -int -main () -{ -static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= $ac_mid)]; -test_array [0] = 0 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + else + cat >conftest.$ac_ext <<_ACEOF - ; - return 0; -} +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* mingw mistakenly returns 0 when trying to seek on pipes. */ + Choke me. +#endif _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -14243,60 +15255,61 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_lo=$ac_mid; break + gl_cv_func_lseek_pipe=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_hi=`expr '(' $ac_mid ')' - 1` - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - ac_mid=`expr 2 '*' $ac_mid` + gl_cv_func_lseek_pipe=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_lo= ac_hi= + fi fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_lseek_pipe" >&5 +echo "${ECHO_T}$gl_cv_func_lseek_pipe" >&6; } + if test $gl_cv_func_lseek_pipe = no; then -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi + M4_LIBOBJS="$M4_LIBOBJS lseek.$ac_objext" -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` - cat >conftest.$ac_ext <<_ACEOF + REPLACE_LSEEK=1 + +cat >>confdefs.h <<\_ACEOF +#define LSEEK_PIPE_BROKEN 1 +_ACEOF + + + fi + + + + GNULIB_LSEEK=1 + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #include - #include - #include - -#include -int -main () -{ -static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -14315,64 +15328,132 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_hi=$ac_mid + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_lo=`expr '(' $ac_mid ')' + 1` + ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in -?*) result=$ac_lo;; -'') result=unknown ;; -esac -else - cat >conftest.$ac_ext <<_ACEOF +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #include - #include - #include + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 +echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; } +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_0_nonnull=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif -#include -static long int longval () { return sizeof ($gltype) * CHAR_BIT; } -static unsigned long int ulongval () { return sizeof ($gltype) * CHAR_BIT; } -#include -#include int main () { - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if ((sizeof ($gltype) * CHAR_BIT) < 0) - { - long int i = longval (); - if (i != (sizeof ($gltype) * CHAR_BIT)) - return 1; - fprintf (f, "%ld\n", i); - } - else - { - unsigned long int i = ulongval (); - if (i != (sizeof ($gltype) * CHAR_BIT)) - return 1; - fprintf (f, "%lu\n", i); - } - return ferror (f) || fclose (f) != 0; - +return ! malloc (0); ; return 0; } @@ -14397,35 +15478,5734 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - result=`cat conftest.val` + ac_cv_func_malloc_0_nonnull=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -result=unknown +ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.val - eval gl_cv_bitsizeof_${gltype}=\$result + fi -ac_res=`eval echo '${'gl_cv_bitsizeof_${gltype}'}'` +{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 0 +_ACEOF + + M4_LIBOBJS="$M4_LIBOBJS malloc.$ac_objext" + +cat >>confdefs.h <<\_ACEOF +#define malloc rpl_malloc +_ACEOF + +fi + + + + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_math_h='<'math.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_math_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_math_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + gl_cv_next_math_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/math.h#{ + s#.*"\(.*/math.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_math_h='<'math.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_math_h" >&5 +echo "${ECHO_T}$gl_cv_next_math_h" >&6; } + fi + NEXT_MATH_H=$gl_cv_next_math_h + + + + + + + +for ac_func in mkdtemp +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } - eval result=\$gl_cv_bitsizeof_${gltype} - if test $result = unknown; then - result=0 - fi - GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - cat >>confdefs.h <<_ACEOF -#define BITSIZEOF_${GLTYPE} $result +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" +fi +done + + if test $ac_cv_func_mkdtemp = no; then + HAVE_MKDTEMP=0 + : + + fi + + + + GNULIB_MKDTEMP=1 + + + + + + { echo "$as_me:$LINENO: checking for working mkstemp" >&5 +echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6; } +if test "${gl_cv_func_working_mkstemp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + mkdir conftest.mkstemp + if test "$cross_compiling" = yes; then + gl_cv_func_working_mkstemp=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +int i; + off_t large = (off_t) 4294967295u; + if (large < 0) + large = 2147483647; + for (i = 0; i < 70; i++) + { + char templ[] = "conftest.mkstemp/coXXXXXX"; + int (*mkstemp_function) (char *) = mkstemp; + int fd = mkstemp_function (templ); + if (fd < 0 || lseek (fd, large, SEEK_SET) != large) + return 1; + close (fd); + } + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_working_mkstemp=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_working_mkstemp=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -rf conftest.mkstemp + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_working_mkstemp" >&5 +echo "${ECHO_T}$gl_cv_func_working_mkstemp" >&6; } + + if test $gl_cv_func_working_mkstemp != yes; then + REPLACE_MKSTEMP=1 + M4_LIBOBJS="$M4_LIBOBJS mkstemp.$ac_objext" + + + fi + + + + GNULIB_MKSTEMP=1 + + { echo "$as_me:$LINENO: checking for obstacks" >&5 +echo $ECHO_N "checking for obstacks... $ECHO_C" >&6; } +if test "${ac_cv_func_obstack+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + #include "obstack.h" +int +main () +{ +struct obstack mem; + #define obstack_chunk_alloc malloc + #define obstack_chunk_free free + obstack_init (&mem); + obstack_free (&mem, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_obstack=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_obstack=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_obstack" >&5 +echo "${ECHO_T}$ac_cv_func_obstack" >&6; } +if test $ac_cv_func_obstack = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_OBSTACK 1 +_ACEOF + +else + M4_LIBOBJS="$M4_LIBOBJS obstack.$ac_objext" +fi + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking whether frexp can be used without linking with libm" >&5 +echo $ECHO_N "checking whether frexp can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_frexp_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + double x; + int y; +int +main () +{ +return frexp (x, &y) < 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_frexp_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_frexp_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexp_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_frexp_no_libm" >&6; } + if test $gl_cv_func_frexp_no_libm = yes; then + + + { echo "$as_me:$LINENO: checking whether frexp works" >&5 +echo $ECHO_N "checking whether frexp works... $ECHO_C" >&6; } +if test "${gl_cv_func_frexp_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + case "$host_os" in + netbsd* | irix*) gl_cv_func_frexp_works="guessing no";; + *) gl_cv_func_frexp_works="guessing yes";; + esac + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +int main() +{ + int i; + volatile double x; + /* Test on denormalized numbers. */ + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + ; + if (x > 0.0) + { + int exp; + double y = frexp (x, &exp); + /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. + On NetBSD: y = 0.75. Correct: y = 0.5. */ + if (y != 0.5) + return 1; + } + /* Test on infinite numbers. */ + x = 1.0 / 0.0; + { + int exp; + double y = frexp (x, &exp); + if (y != x) + return 1; + } + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_frexp_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_frexp_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexp_works" >&5 +echo "${ECHO_T}$gl_cv_func_frexp_works" >&6; } + + case "$gl_cv_func_frexp_works" in + *yes) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FREXP_IN_LIBC 1 +_ACEOF + + ;; + esac + fi + + { echo "$as_me:$LINENO: checking whether ldexp can be used without linking with libm" >&5 +echo $ECHO_N "checking whether ldexp can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_ldexp_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + double x; + int y; +int +main () +{ +return ldexp (x, y) < 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_ldexp_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_ldexp_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_ldexp_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_ldexp_no_libm" >&6; } + if test $gl_cv_func_ldexp_no_libm = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LDEXP_IN_LIBC 1 +_ACEOF + + fi + + + + { echo "$as_me:$LINENO: checking whether frexpl can be used without linking with libm" >&5 +echo $ECHO_N "checking whether frexpl can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_frexpl_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + long double x; + int y; +int +main () +{ +return frexpl (x, &y) < 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_frexpl_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_frexpl_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_frexpl_no_libm" >&6; } + if test $gl_cv_func_frexpl_no_libm = yes; then + + + { echo "$as_me:$LINENO: checking whether frexpl works" >&5 +echo $ECHO_N "checking whether frexpl works... $ECHO_C" >&6; } +if test "${gl_cv_func_frexpl_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + case "$host_os" in + aix* | beos* | darwin* | irix* | mingw* | pw*) + gl_cv_func_frexpl_works="guessing no";; + *) gl_cv_func_frexpl_works="guessing yes";; + esac + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +extern long double frexpl (long double, int *); +int main() +{ + volatile long double x; + /* Test on finite numbers that fails on AIX 5.1. */ + x = 16.0L; + { + int exp = -9999; + frexpl (x, &exp); + if (exp != 5) + return 1; + } + /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl + function returns an invalid (incorrectly normalized) value: it returns + y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } + but the correct result is + 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ + x = 1.01L; + { + int exp = -9999; + long double y = frexpl (x, &exp); + if (!(exp == 1 && y == 0.505L)) + return 1; + } + /* Test on large finite numbers. This fails on BeOS at i = 16322, while + LDBL_MAX_EXP = 16384. + In the loop end test, we test x against Infinity, rather than comparing + i with LDBL_MAX_EXP, because BeOS has a wrong LDBL_MAX_EXP. */ + { + int i; + for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) + { + int exp = -9999; + frexpl (x, &exp); + if (exp != i) + return 1; + } + } + /* Test on infinite numbers. */ + x = 1.0L / 0.0L; + { + int exp; + long double y = frexpl (x, &exp); + if (y != x) + return 1; + } + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_frexpl_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_frexpl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_frexpl_works" >&5 +echo "${ECHO_T}$gl_cv_func_frexpl_works" >&6; } + + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FREXPL_IN_LIBC 1 +_ACEOF + + { echo "$as_me:$LINENO: checking whether frexpl is declared" >&5 +echo $ECHO_N "checking whether frexpl is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_frexpl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef frexpl + (void) frexpl; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_frexpl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_frexpl=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_frexpl" >&5 +echo "${ECHO_T}$ac_cv_have_decl_frexpl" >&6; } +if test $ac_cv_have_decl_frexpl = yes; then + : +else + HAVE_DECL_FREXPL=0 +fi + + fi + + { echo "$as_me:$LINENO: checking whether ldexpl can be used without linking with libm" >&5 +echo $ECHO_N "checking whether ldexpl can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_ldexpl_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + long double x; + int y; +int +main () +{ +return ldexpl (x, y) < 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_ldexpl_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_ldexpl_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_ldexpl_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_ldexpl_no_libm" >&6; } + if test $gl_cv_func_ldexpl_no_libm = yes; then + + + { echo "$as_me:$LINENO: checking whether ldexpl works" >&5 +echo $ECHO_N "checking whether ldexpl works... $ECHO_C" >&6; } +if test "${gl_cv_func_ldexpl_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + case "$host_os" in + aix*) gl_cv_func_ldexpl_works="guessing no";; + *) gl_cv_func_ldexpl_works="guessing yes";; + esac + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +extern long double ldexpl (long double, int); +int main() +{ + volatile long double x = 1.0; + volatile long double y = ldexpl (x, -1); + return (y != 0.5L); +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_ldexpl_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_ldexpl_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_ldexpl_works" >&5 +echo "${ECHO_T}$gl_cv_func_ldexpl_works" >&6; } + + case "$gl_cv_func_ldexpl_works" in + *yes) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LDEXPL_IN_LIBC 1 +_ACEOF + + { echo "$as_me:$LINENO: checking whether ldexpl is declared" >&5 +echo $ECHO_N "checking whether ldexpl is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_ldexpl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef ldexpl + (void) ldexpl; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_ldexpl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_ldexpl=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_ldexpl" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ldexpl" >&6; } +if test $ac_cv_have_decl_ldexpl = yes; then + : +else + HAVE_DECL_LDEXPL=0 +fi + + ;; + esac + fi + + + + M4_LIBOBJS="$M4_LIBOBJS quotearg.$ac_objext" + + + + + + + + { echo "$as_me:$LINENO: checking for mbstate_t" >&5 +echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6; } +if test "${ac_cv_type_mbstate_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +# include +int +main () +{ +mbstate_t x; return sizeof x; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_mbstate_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_mbstate_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5 +echo "${ECHO_T}$ac_cv_type_mbstate_t" >&6; } + if test $ac_cv_type_mbstate_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBSTATE_T 1 +_ACEOF + + else + +cat >>confdefs.h <<\_ACEOF +#define mbstate_t int +_ACEOF + + fi + + { echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 +echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6; } +if test "${gl_cv_func_mbrtowc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_mbrtowc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_mbrtowc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_mbrtowc" >&5 +echo "${ECHO_T}$gl_cv_func_mbrtowc" >&6; } + if test $gl_cv_func_mbrtowc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBRTOWC 1 +_ACEOF + + fi + + + + + + + + + + + +# Check whether --with-included-regex was given. +if test "${with_included_regex+set}" = set; then + withval=$with_included_regex; +fi + + + case $with_included_regex in #( + yes|no) ac_use_included_regex=$with_included_regex + ;; + '') + # If the system regex support is good enough that it passes the + # following run test, then default to *not* using the included regex.c. + # If cross compiling, assume the test would fail and use the included + # regex.c. + { echo "$as_me:$LINENO: checking for working re_compile_pattern" >&5 +echo $ECHO_N "checking for working re_compile_pattern... $ECHO_C" >&6; } +if test "${gl_cv_func_re_compile_pattern_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + gl_cv_func_re_compile_pattern_working=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + #if HAVE_LOCALE_H + #include + #endif + #include + #include + +int +main () +{ +static struct re_pattern_buffer regex; + unsigned char folded_chars[UCHAR_MAX + 1]; + int i; + const char *s; + struct re_registers regs; + + #if HAVE_LOCALE_H + /* http://sourceware.org/ml/libc-hacker/2006-09/msg00008.html + This test needs valgrind to catch the bug on Debian + GNU/Linux 3.1 x86, but it might catch the bug better + on other platforms and it shouldn't hurt to try the + test here. */ + if (setlocale (LC_ALL, "en_US.UTF-8")) + { + static char const pat[] = "insert into"; + static char const data[] = + "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK"; + re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE + | RE_ICASE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern (pat, sizeof pat - 1, ®ex); + if (s) + return 1; + if (re_search (®ex, data, sizeof data - 1, + 0, sizeof data - 1, ®s) + != -1) + return 1; + if (! setlocale (LC_ALL, "C")) + return 1; + } + #endif + + /* This test is from glibc bug 3957, reported by Andrew Mackey. */ + re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("a[^x]b", 6, ®ex); + if (s) + return 1; + + /* This should fail, but succeeds for glibc-2.5. */ + if (re_search (®ex, "a\nb", 3, 0, 3, ®s) != -1) + return 1; + + /* This regular expression is from Spencer ere test number 75 + in grep-2.3. */ + re_set_syntax (RE_SYNTAX_POSIX_EGREP); + memset (®ex, 0, sizeof regex); + for (i = 0; i <= UCHAR_MAX; i++) + folded_chars[i] = i; + regex.translate = folded_chars; + s = re_compile_pattern ("a[[:]:]]b\n", 11, ®ex); + /* This should fail with _Invalid character class name_ error. */ + if (!s) + return 1; + + /* This should succeed, but does not for glibc-2.1.3. */ + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("{1", 2, ®ex); + + if (s) + return 1; + + /* The following example is derived from a problem report + against gawk from Jorge Stolfi . */ + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("[an\371]*n", 7, ®ex); + if (s) + return 1; + + /* This should match, but does not for glibc-2.2.1. */ + if (re_match (®ex, "an", 2, 0, ®s) != 2) + return 1; + + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("x", 1, ®ex); + if (s) + return 1; + + /* glibc-2.2.93 does not work with a negative RANGE argument. */ + if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) + return 1; + + /* The version of regex.c in older versions of gnulib + ignored RE_ICASE. Detect that problem too. */ + re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("x", 1, ®ex); + if (s) + return 1; + + if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) + return 1; + + /* Catch a bug reported by Vin Shelton in + http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html + */ + re_set_syntax (RE_SYNTAX_POSIX_BASIC + & ~RE_CONTEXT_INVALID_DUP + & ~RE_NO_EMPTY_RANGES); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); + if (s) + return 1; + + /* REG_STARTEND was added to glibc on 2004-01-15. + Reject older versions. */ + if (! REG_STARTEND) + return 1; + + /* Reject hosts whose regoff_t values are too narrow. + These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t + and 32-bit int. */ + if (sizeof (regoff_t) < sizeof (ptrdiff_t) + || sizeof (regoff_t) < sizeof (ssize_t)) + return 1; + + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_re_compile_pattern_working=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_re_compile_pattern_working=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_re_compile_pattern_working" >&5 +echo "${ECHO_T}$gl_cv_func_re_compile_pattern_working" >&6; } + case $gl_cv_func_re_compile_pattern_working in #( + yes) ac_use_included_regex=no;; #( + no) ac_use_included_regex=yes;; + esac + ;; + *) { { echo "$as_me:$LINENO: error: Invalid value for --with-included-regex: $with_included_regex" >&5 +echo "$as_me: error: Invalid value for --with-included-regex: $with_included_regex" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if test $ac_use_included_regex = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _REGEX_LARGE_OFFSETS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_syntax_options rpl_re_syntax_options +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_set_syntax rpl_re_set_syntax +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_compile_pattern rpl_re_compile_pattern +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_compile_fastmap rpl_re_compile_fastmap +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_search rpl_re_search +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_search_2 rpl_re_search_2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_match rpl_re_match +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_match_2 rpl_re_match_2 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_set_registers rpl_re_set_registers +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_comp rpl_re_comp +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define re_exec rpl_re_exec +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define regcomp rpl_regcomp +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define regexec rpl_regexec +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define regerror rpl_regerror +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define regfree rpl_regfree +_ACEOF + + M4_LIBOBJS="$M4_LIBOBJS regex.$ac_objext" + + + + + + + + + + + + + + + + + + { echo "$as_me:$LINENO: checking whether isblank is declared" >&5 +echo $ECHO_N "checking whether isblank is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_isblank+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef isblank + (void) isblank; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_isblank=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_isblank=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isblank" >&5 +echo "${ECHO_T}$ac_cv_have_decl_isblank" >&6; } +if test $ac_cv_have_decl_isblank = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ISBLANK 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ISBLANK 0 +_ACEOF + + +fi + + + + fi + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_signal_h='<'signal.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_signal_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_signal_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + gl_cv_next_signal_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/signal.h#{ + s#.*"\(.*/signal.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_signal_h='<'signal.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_signal_h" >&5 +echo "${ECHO_T}$gl_cv_next_signal_h" >&6; } + fi + NEXT_SIGNAL_H=$gl_cv_next_signal_h + + + + + + + { echo "$as_me:$LINENO: checking for signbit macro" >&5 +echo $ECHO_N "checking for signbit macro... $ECHO_C" >&6; } +if test "${gl_cv_func_signbit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + gl_cv_func_signbit="guessing no" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +float p0f = 0.0f; +float m0f = -0.0f; +double p0d = 0.0; +double m0d = -0.0; +long double p0l = 0.0L; +long double m0l = -0.0L; +int main () +{ + { + float plus_inf = 1.0f / p0f; + float minus_inf = -1.0f / p0f; + if (!(!signbit (255.0f) + && signbit (-255.0f) + && !signbit (p0f) + && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + { + double plus_inf = 1.0 / p0d; + double minus_inf = -1.0 / p0d; + if (!(!signbit (255.0) + && signbit (-255.0) + && !signbit (p0d) + && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + { + long double plus_inf = 1.0L / p0l; + long double minus_inf = -1.0L / p0l; + if (!(!signbit (255.0L) + && signbit (-255.0L) + && !signbit (p0l) + && (memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_func_signbit=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_func_signbit=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_signbit" >&5 +echo "${ECHO_T}$gl_cv_func_signbit" >&6; } + if test "$gl_cv_func_signbit" != yes; then + REPLACE_SIGNBIT=1 + M4_LIBOBJS="$M4_LIBOBJS signbitf.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS signbitd.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS signbitl.$ac_objext" + + + { echo "$as_me:$LINENO: checking where to find the sign bit in a 'float'" >&5 +echo $ECHO_N "checking where to find the sign bit in a 'float'... $ECHO_C" >&6; } +if test "${gl_cv_cc_float_signbit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + gl_cv_cc_float_signbit="unknown" + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } + memory_float; +static memory_float plus = { 1.0f }; +static memory_float minus = { -1.0f }; +int main () +{ + size_t j, k, i; + unsigned int m; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + /* Find the different bit. */ + k = 0; m = 0; + for (j = 0; j < NWORDS; j++) + { + unsigned int x = plus.word[j] ^ minus.word[j]; + if ((x & (x - 1)) || (x && m)) + { + /* More than one bit difference. */ + fprintf (fp, "unknown"); + return 1; + } + if (x) + { + k = j; + m = x; + } + } + if (m == 0) + { + /* No difference. */ + fprintf (fp, "unknown"); + return 1; + } + /* Now m = plus.word[k] ^ ~minus.word[k]. */ + if (plus.word[k] & ~minus.word[k]) + { + /* Oh? The sign bit is set in the positive and cleared in the negative + numbers? */ + fprintf (fp, "unknown"); + return 1; + } + for (i = 0; ; i++) + if ((m >> i) & 1) + break; + fprintf (fp, "word %d bit %d", (int) k, (int) i); + return (fclose (fp) != 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_float_signbit=`cat conftest.out` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_cc_float_signbit="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_float_signbit" >&5 +echo "${ECHO_T}$gl_cv_cc_float_signbit" >&6; } + case "$gl_cv_cc_float_signbit" in + word*bit*) + word=`echo "$gl_cv_cc_float_signbit" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_signbit" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define FLT_SIGNBIT_WORD $word +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define FLT_SIGNBIT_BIT $bit +_ACEOF + + ;; + esac + + + + + { echo "$as_me:$LINENO: checking where to find the sign bit in a 'double'" >&5 +echo $ECHO_N "checking where to find the sign bit in a 'double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_double_signbit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + gl_cv_cc_double_signbit="unknown" + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } + memory_float; +static memory_float plus = { 1.0 }; +static memory_float minus = { -1.0 }; +int main () +{ + size_t j, k, i; + unsigned int m; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + /* Find the different bit. */ + k = 0; m = 0; + for (j = 0; j < NWORDS; j++) + { + unsigned int x = plus.word[j] ^ minus.word[j]; + if ((x & (x - 1)) || (x && m)) + { + /* More than one bit difference. */ + fprintf (fp, "unknown"); + return 1; + } + if (x) + { + k = j; + m = x; + } + } + if (m == 0) + { + /* No difference. */ + fprintf (fp, "unknown"); + return 1; + } + /* Now m = plus.word[k] ^ ~minus.word[k]. */ + if (plus.word[k] & ~minus.word[k]) + { + /* Oh? The sign bit is set in the positive and cleared in the negative + numbers? */ + fprintf (fp, "unknown"); + return 1; + } + for (i = 0; ; i++) + if ((m >> i) & 1) + break; + fprintf (fp, "word %d bit %d", (int) k, (int) i); + return (fclose (fp) != 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_double_signbit=`cat conftest.out` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_cc_double_signbit="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_double_signbit" >&5 +echo "${ECHO_T}$gl_cv_cc_double_signbit" >&6; } + case "$gl_cv_cc_double_signbit" in + word*bit*) + word=`echo "$gl_cv_cc_double_signbit" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_signbit" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define DBL_SIGNBIT_WORD $word +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define DBL_SIGNBIT_BIT $bit +_ACEOF + + ;; + esac + + + + + { echo "$as_me:$LINENO: checking where to find the sign bit in a 'long double'" >&5 +echo $ECHO_N "checking where to find the sign bit in a 'long double'... $ECHO_C" >&6; } +if test "${gl_cv_cc_long_double_signbit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + gl_cv_cc_long_double_signbit="unknown" + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_float; +static memory_float plus = { 1.0L }; +static memory_float minus = { -1.0L }; +int main () +{ + size_t j, k, i; + unsigned int m; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + /* Find the different bit. */ + k = 0; m = 0; + for (j = 0; j < NWORDS; j++) + { + unsigned int x = plus.word[j] ^ minus.word[j]; + if ((x & (x - 1)) || (x && m)) + { + /* More than one bit difference. */ + fprintf (fp, "unknown"); + return 1; + } + if (x) + { + k = j; + m = x; + } + } + if (m == 0) + { + /* No difference. */ + fprintf (fp, "unknown"); + return 1; + } + /* Now m = plus.word[k] ^ ~minus.word[k]. */ + if (plus.word[k] & ~minus.word[k]) + { + /* Oh? The sign bit is set in the positive and cleared in the negative + numbers? */ + fprintf (fp, "unknown"); + return 1; + } + for (i = 0; ; i++) + if ((m >> i) & 1) + break; + fprintf (fp, "word %d bit %d", (int) k, (int) i); + return (fclose (fp) != 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gl_cv_cc_long_double_signbit=`cat conftest.out` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gl_cv_cc_long_double_signbit="unknown" +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + rm -f conftest.out + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_cc_long_double_signbit" >&5 +echo "${ECHO_T}$gl_cv_cc_long_double_signbit" >&6; } + case "$gl_cv_cc_long_double_signbit" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_signbit" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_signbit" | sed -e 's/word.*bit //'` + +cat >>confdefs.h <<_ACEOF +#define LDBL_SIGNBIT_WORD $word +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define LDBL_SIGNBIT_BIT $bit +_ACEOF + + ;; + esac + + + if test "$gl_cv_cc_float_signbit" = unknown; then + { echo "$as_me:$LINENO: checking whether copysignf is declared" >&5 +echo $ECHO_N "checking whether copysignf is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_copysignf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef copysignf + (void) copysignf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_copysignf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_copysignf=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_copysignf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_copysignf" >&6; } +if test $ac_cv_have_decl_copysignf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_COPYSIGNF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_COPYSIGNF 0 +_ACEOF + + +fi + + + if test "$ac_cv_have_decl_copysignf" = yes; then + { echo "$as_me:$LINENO: checking whether copysignf can be used without linking with libm" >&5 +echo $ECHO_N "checking whether copysignf can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_copysignf_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + float x, y; +int +main () +{ +return copysignf (x, y) < 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_copysignf_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_copysignf_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_copysignf_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_copysignf_no_libm" >&6; } + if test $gl_cv_func_copysignf_no_libm = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_COPYSIGNF_IN_LIBC 1 +_ACEOF + + fi + fi + fi + if test "$gl_cv_cc_double_signbit" = unknown; then + { echo "$as_me:$LINENO: checking whether copysign is declared" >&5 +echo $ECHO_N "checking whether copysign is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_copysign+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef copysign + (void) copysign; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_copysign=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_copysign=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_copysign" >&5 +echo "${ECHO_T}$ac_cv_have_decl_copysign" >&6; } +if test $ac_cv_have_decl_copysign = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_COPYSIGN 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_COPYSIGN 0 +_ACEOF + + +fi + + + if test "$ac_cv_have_decl_copysign" = yes; then + { echo "$as_me:$LINENO: checking whether copysign can be used without linking with libm" >&5 +echo $ECHO_N "checking whether copysign can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_copysign_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + double x, y; +int +main () +{ +return copysign (x, y) < 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_copysign_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_copysign_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_copysign_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_copysign_no_libm" >&6; } + if test $gl_cv_func_copysign_no_libm = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_COPYSIGN_IN_LIBC 1 +_ACEOF + + fi + fi + fi + if test "$gl_cv_cc_long_double_signbit" = unknown; then + { echo "$as_me:$LINENO: checking whether copysignl is declared" >&5 +echo $ECHO_N "checking whether copysignl is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_copysignl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef copysignl + (void) copysignl; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_copysignl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_copysignl=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_copysignl" >&5 +echo "${ECHO_T}$ac_cv_have_decl_copysignl" >&6; } +if test $ac_cv_have_decl_copysignl = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_COPYSIGNL 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_COPYSIGNL 0 +_ACEOF + + +fi + + + if test "$ac_cv_have_decl_copysignl" = yes; then + { echo "$as_me:$LINENO: checking whether copysignl can be used without linking with libm" >&5 +echo $ECHO_N "checking whether copysignl can be used without linking with libm... $ECHO_C" >&6; } +if test "${gl_cv_func_copysignl_no_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + long double x, y; +int +main () +{ +return copysignl (x, y) < 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + gl_cv_func_copysignl_no_libm=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_copysignl_no_libm=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_func_copysignl_no_libm" >&5 +echo "${ECHO_T}$gl_cv_func_copysignl_no_libm" >&6; } + if test $gl_cv_func_copysignl_no_libm = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_COPYSIGNL_IN_LIBC 1 +_ACEOF + + fi + fi + fi + fi + + + + GNULIB_SIGNBIT=1 + + + + + + + signals_not_posix= + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sigset_t" >/dev/null 2>&1; then + : +else + signals_not_posix=1 +fi +rm -f conftest* + + if test -z "$signals_not_posix"; then + { echo "$as_me:$LINENO: checking for sigprocmask" >&5 +echo $ECHO_N "checking for sigprocmask... $ECHO_C" >&6; } +if test "${ac_cv_func_sigprocmask+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define sigprocmask to an innocuous variant, in case declares sigprocmask. + For example, HP-UX 11i declares gettimeofday. */ +#define sigprocmask innocuous_sigprocmask + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sigprocmask (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef sigprocmask + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sigprocmask (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_sigprocmask || defined __stub___sigprocmask +choke me +#endif + +int +main () +{ +return sigprocmask (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_sigprocmask=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_sigprocmask=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_sigprocmask" >&5 +echo "${ECHO_T}$ac_cv_func_sigprocmask" >&6; } +if test $ac_cv_func_sigprocmask = yes; then + gl_cv_func_sigprocmask=1 +fi + + fi + if test -z "$gl_cv_func_sigprocmask"; then + HAVE_POSIX_SIGNALBLOCKING=0 + M4_LIBOBJS="$M4_LIBOBJS sigprocmask.$ac_objext" + + + { echo "$as_me:$LINENO: checking for sigset_t" >&5 +echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6; } +if test "${ac_cv_type_sigset_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +/* Mingw defines sigset_t not in , but in . */ +#include + +typedef sigset_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_sigset_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_sigset_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_sigset_t" >&5 +echo "${ECHO_T}$ac_cv_type_sigset_t" >&6; } +if test $ac_cv_type_sigset_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGSET_T 1 +_ACEOF + +gl_cv_type_sigset_t=yes +else + gl_cv_type_sigset_t=no +fi + + if test $gl_cv_type_sigset_t != yes; then + HAVE_SIGSET_T=0 + fi + + + + + + + + + fi + + + + GNULIB_SIGPROCMASK=1 + + + +for ac_header in stdint.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + { echo "$as_me:$LINENO: checking for SIZE_MAX" >&5 +echo $ECHO_N "checking for SIZE_MAX... $ECHO_C" >&6; } + if test "${gl_cv_size_max+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + gl_cv_size_max= + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#if HAVE_STDINT_H +#include +#endif +#ifdef SIZE_MAX +Found it +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Found it" >/dev/null 2>&1; then + gl_cv_size_max=yes +fi +rm -f conftest* + + if test -z "$gl_cv_size_max"; then + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) * CHAR_BIT - 1) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) size_t_bits_minus_1=$ac_lo;; +'') size_t_bits_minus_1= ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +static long int longval () { return sizeof (size_t) * CHAR_BIT - 1; } +static unsigned long int ulongval () { return sizeof (size_t) * CHAR_BIT - 1; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((sizeof (size_t) * CHAR_BIT - 1) < 0) + { + long int i = longval (); + if (i != (sizeof (size_t) * CHAR_BIT - 1)) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (sizeof (size_t) * CHAR_BIT - 1)) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + size_t_bits_minus_1=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +size_t_bits_minus_1= +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) fits_in_uint=$ac_lo;; +'') fits_in_uint= ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +static long int longval () { return sizeof (size_t) <= sizeof (unsigned int); } +static unsigned long int ulongval () { return sizeof (size_t) <= sizeof (unsigned int); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((sizeof (size_t) <= sizeof (unsigned int)) < 0) + { + long int i = longval (); + if (i != (sizeof (size_t) <= sizeof (unsigned int))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (sizeof (size_t) <= sizeof (unsigned int))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + fits_in_uint=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +fits_in_uint= +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then + if test $fits_in_uint = 1; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + extern size_t foo; + extern unsigned long foo; + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + fits_in_uint=0 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $fits_in_uint = 1; then + gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" + else + gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + fi + else + gl_cv_size_max='((size_t)~(size_t)0)' + fi + fi + +fi + + { echo "$as_me:$LINENO: result: $gl_cv_size_max" >&5 +echo "${ECHO_T}$gl_cv_size_max" >&6; } + if test "$gl_cv_size_max" != yes; then + +cat >>confdefs.h <<_ACEOF +#define SIZE_MAX $gl_cv_size_max +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for ssize_t" >&5 +echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; } +if test "${gt_cv_ssize_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +int x = sizeof (ssize_t *) + sizeof (ssize_t); + return !x; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_ssize_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_ssize_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gt_cv_ssize_t" >&5 +echo "${ECHO_T}$gt_cv_ssize_t" >&6; } + if test $gt_cv_ssize_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define ssize_t int +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for va_copy" >&5 +echo $ECHO_N "checking for va_copy... $ECHO_C" >&6; } + if test "${gl_cv_func_va_copy+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + +#ifndef va_copy +void (*func) (va_list, va_list) = va_copy; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_func_va_copy=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func_va_copy=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + { echo "$as_me:$LINENO: result: $gl_cv_func_va_copy" >&5 +echo "${ECHO_T}$gl_cv_func_va_copy" >&6; } + if test $gl_cv_func_va_copy = no; then + # Provide a substitute, either __va_copy or as a simple assignment. + if test "${gl_cv_func___va_copy+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + +#ifndef __va_copy +error, bail out +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_func___va_copy=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gl_cv_func___va_copy=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test $gl_cv_func___va_copy = yes; then + +cat >>confdefs.h <<\_ACEOF +#define va_copy __va_copy +_ACEOF + + else + + + +cat >>confdefs.h <<\_ACEOF +#define va_copy gl_va_copy +_ACEOF + + fi + fi + + + + + # Define two additional variables used in the Makefile substitution. + + if test "$ac_cv_header_stdbool_h" = yes; then + STDBOOL_H='' + else + STDBOOL_H='stdbool.h' + fi + + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi + + + + + + if test $ac_cv_type_long_long_int = yes; then + HAVE_LONG_LONG_INT=1 + else + HAVE_LONG_LONG_INT=0 + fi + + + if test $ac_cv_type_unsigned_long_long_int = yes; then + HAVE_UNSIGNED_LONG_LONG_INT=1 + else + HAVE_UNSIGNED_LONG_LONG_INT=0 + fi + + + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + + + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdint_h='<'stdint.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_stdint_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + gl_cv_next_stdint_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdint.h#{ + s#.*"\(.*/stdint.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdint_h='<'stdint.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_stdint_h" >&5 +echo "${ECHO_T}$gl_cv_next_stdint_h" >&6; } + fi + NEXT_STDINT_H=$gl_cv_next_stdint_h + + + + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + + + if test $ac_cv_header_stdint_h = yes; then + { echo "$as_me:$LINENO: checking whether stdint.h conforms to C99" >&5 +echo $ECHO_N "checking whether stdint.h conforms to C99... $ECHO_C" >&6; } +if test "${gl_cv_header_working_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gl_cv_header_working_stdint_h=no + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gl_cv_header_working_stdint_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gl_cv_header_working_stdint_h" >&5 +echo "${ECHO_T}$gl_cv_header_working_stdint_h" >&6; } + fi + if test "$gl_cv_header_working_stdint_h" = yes; then + STDINT_H= + else + + +for ac_header in sys/inttypes.h sys/bitypes.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + else + HAVE_SYS_INTTYPES_H=0 + fi + + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + else + HAVE_SYS_BITYPES_H=0 + fi + + + + + + + + + + + + + + + + + + for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do + { echo "$as_me:$LINENO: checking for bit size of $gltype" >&5 +echo $ECHO_N "checking for bit size of $gltype... $ECHO_C" >&6; } +if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +int +main () +{ +static int test_array [1 - 2 * !((sizeof ($gltype) * CHAR_BIT) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) result=$ac_lo;; +'') result=unknown ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include +static long int longval () { return sizeof ($gltype) * CHAR_BIT; } +static unsigned long int ulongval () { return sizeof ($gltype) * CHAR_BIT; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if ((sizeof ($gltype) * CHAR_BIT) < 0) + { + long int i = longval (); + if (i != (sizeof ($gltype) * CHAR_BIT)) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != (sizeof ($gltype) * CHAR_BIT)) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + result=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +result=unknown +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +ac_res=`eval echo '${'gl_cv_bitsizeof_${gltype}'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + cat >>confdefs.h <<_ACEOF +#define BITSIZEOF_${GLTYPE} $result +_ACEOF + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + + + + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { echo "$as_me:$LINENO: checking whether $gltype is signed" >&5 +echo $ECHO_N "checking whether $gltype is signed... $ECHO_C" >&6; } +if { as_var=gl_cv_type_${gltype}_signed; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + result=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + result=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval gl_cv_type_${gltype}_signed=\$result + +fi +ac_res=`eval echo '${'gl_cv_type_${gltype}_signed'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNED_${GLTYPE} 1 +_ACEOF + + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + + + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + + + + + + + + for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do + { echo "$as_me:$LINENO: checking for $gltype integer literal suffix" >&5 +echo $ECHO_N "checking for $gltype integer literal suffix... $ECHO_C" >&6; } +if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval gl_cv_type_${gltype}_suffix=\$glsuf +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +ac_res=`eval echo '${'gl_cv_type_${gltype}_suffix'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + cat >>confdefs.h <<_ACEOF +#define ${GLTYPE}_SUFFIX $result +_ACEOF + + done + + + + STDINT_H=stdint.h + fi + + + + { echo "$as_me:$LINENO: checking for wchar_t" >&5 +echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } +if test "${gt_cv_c_wchar_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + wchar_t foo = (wchar_t)'\0'; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_c_wchar_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_c_wchar_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 +echo "${ECHO_T}$gt_cv_c_wchar_t" >&6; } + if test $gt_cv_c_wchar_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WCHAR_T 1 +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for wint_t" >&5 +echo $ECHO_N "checking for wint_t... $ECHO_C" >&6; } +if test "${gt_cv_c_wint_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include + wint_t foo = (wchar_t)'\0'; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + gt_cv_c_wint_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_c_wint_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 +echo "${ECHO_T}$gt_cv_c_wint_t" >&6; } + if test $gt_cv_c_wint_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WINT_T 1 +_ACEOF + + fi + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdio_h='<'stdio.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_stdio_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_stdio_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + gl_cv_next_stdio_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdio.h#{ + s#.*"\(.*/stdio.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdio_h='<'stdio.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_stdio_h" >&5 +echo "${ECHO_T}$gl_cv_next_stdio_h" >&6; } + fi + NEXT_STDIO_H=$gl_cv_next_stdio_h + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdlib_h='<'stdlib.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_stdlib_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + gl_cv_next_stdlib_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdlib.h#{ + s#.*"\(.*/stdlib.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdlib_h='<'stdlib.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_stdlib_h" >&5 +echo "${ECHO_T}$gl_cv_next_stdlib_h" >&6; } + fi + NEXT_STDLIB_H=$gl_cv_next_stdlib_h + + + + + + M4_LIBOBJS="$M4_LIBOBJS mkstemp-safer.$ac_objext" + + + +for ac_func in strtol +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" +fi +done + + + + + + + + + + if test $ac_cv_func_lstat = yes; then + HAVE_LSTAT=1 + else + HAVE_LSTAT=0 + fi + + + { echo "$as_me:$LINENO: checking whether mkdir is declared" >&5 +echo $ECHO_N "checking whether mkdir is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef mkdir + (void) mkdir; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_have_decl_mkdir=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_mkdir=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_mkdir" >&5 +echo "${ECHO_T}$ac_cv_have_decl_mkdir" >&6; } +if test $ac_cv_have_decl_mkdir = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MKDIR 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MKDIR 0 +_ACEOF + + +for ac_header in io.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------- ## +## Report this to bug-m4@gnu.org ## +## ----------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +fi + + + if test $ac_cv_have_decl_mkdir = yes; then + HAVE_DECL_MKDIR=1 + else + HAVE_DECL_MKDIR=0 + fi + + if test "$ac_cv_header_io_h" = yes; then + HAVE_IO_H=1 + else + HAVE_IO_H=0 + fi + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_sys_stat_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_sys_stat_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + gl_cv_next_sys_stat_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/sys/stat.h#{ + s#.*"\(.*/sys/stat.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_sys_stat_h" >&5 +echo "${ECHO_T}$gl_cv_next_sys_stat_h" >&6; } + fi + NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h + + + + SYS_STAT_H='sys/stat.h' + + + { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + + + + + { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + + + + + M4_LIBOBJS="$M4_LIBOBJS tempname.$ac_objext" + + : + + + + +for ac_func in __secure_getenv +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_unistd_h='<'unistd.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_unistd_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_unistd_h = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF + gl_cv_next_unistd_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/unistd.h#{ + s#.*"\(.*/unistd.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_unistd_h='<'unistd.h'>' + fi + +fi +{ echo "$as_me:$LINENO: result: $gl_cv_next_unistd_h" >&5 +echo "${ECHO_T}$gl_cv_next_unistd_h" >&6; } + fi + NEXT_UNISTD_H=$gl_cv_next_unistd_h + + + + + + + + + + + if test $ac_cv_header_unistd_h = yes; then + HAVE_UNISTD_H=1 + else + HAVE_UNISTD_H=0 + fi + + + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS dup-safer.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS fd-safer.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS pipe-safer.$ac_objext" + + + +cat >>confdefs.h <<\_ACEOF +#define USE_UNLOCKED_IO 1 _ACEOF - eval BITSIZEOF_${GLTYPE}=\$result - done @@ -14433,84 +21213,84 @@ _ACEOF - for gltype in sig_atomic_t wchar_t wint_t ; do - { echo "$as_me:$LINENO: checking whether $gltype is signed" >&5 -echo $ECHO_N "checking whether $gltype is signed... $ECHO_C" >&6; } -if { as_var=gl_cv_type_${gltype}_signed; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #include - #include - #include - int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; -int -main () -{ - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - result=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - result=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval gl_cv_type_${gltype}_signed=\$result -fi -ac_res=`eval echo '${'gl_cv_type_${gltype}_signed'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - eval result=\$gl_cv_type_${gltype}_signed - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - if test "$result" = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_SIGNED_${GLTYPE} 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if test $ac_cv_func_vasnprintf = no; then + + + + + + + + M4_LIBOBJS="$M4_LIBOBJS vasnprintf.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS printf-args.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS printf-parse.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS asnprintf.$ac_objext" + if test $ac_cv_func_vasnprintf = yes; then + +cat >>confdefs.h <<\_ACEOF +#define REPLACE_VASNPRINTF 1 _ACEOF - eval HAVE_SIGNED_${GLTYPE}=1 - else - eval HAVE_SIGNED_${GLTYPE}=0 - fi - done + fi - gl_cv_type_ptrdiff_t_signed=yes - gl_cv_type_size_t_signed=no @@ -14518,51 +21298,27 @@ _ACEOF - for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do - { echo "$as_me:$LINENO: checking for $gltype integer literal suffix" >&5 -echo $ECHO_N "checking for $gltype integer literal suffix... $ECHO_C" >&6; } -if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then + + { echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 +echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6; } +if test "${ac_cv_type_ptrdiff_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval gl_cv_type_${gltype}_suffix=no - eval result=\$gl_cv_type_${gltype}_signed - if test "$result" = yes; then - glsufu= - else - glsufu=u - fi - for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do - case $glsuf in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; - ui64)gltype1='unsigned __int64';; - esac - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #include - #include - #include - - extern $gltype foo; - extern $gltype1 foo; +$ac_includes_default +typedef ptrdiff_t ac__type_new_; int main () { - +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -14584,80 +21340,37 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - eval gl_cv_type_${gltype}_suffix=\$glsuf + ac_cv_type_ptrdiff_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_ptrdiff_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" != no && break - done fi -ac_res=`eval echo '${'gl_cv_type_${gltype}_suffix'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" = no && result= - eval ${GLTYPE}_SUFFIX=\$result - cat >>confdefs.h <<_ACEOF -#define ${GLTYPE}_SUFFIX $result -_ACEOF - - done - - - - STDINT_H=stdint.h - fi - - - - - { echo "$as_me:$LINENO: checking absolute name of " >&5 -echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } -if test "${gl_cv_absolute_stdlib_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - +{ echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 +echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6; } +if test $ac_cv_type_ptrdiff_t = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_PTRDIFF_T 1 +_ACEOF +fi - if test $ac_cv_header_stdlib_h = yes; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF - gl_cv_absolute_stdlib_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | -sed -n '\#/stdlib.h#{s#.*"\(.*/stdlib.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` - fi -fi -{ echo "$as_me:$LINENO: result: $gl_cv_absolute_stdlib_h" >&5 -echo "${ECHO_T}$gl_cv_absolute_stdlib_h" >&6; } -cat >>confdefs.h <<_ACEOF -#define ABSOLUTE_STDLIB_H "$gl_cv_absolute_stdlib_h" -_ACEOF - ABSOLUTE_STDLIB_H=\"$gl_cv_absolute_stdlib_h\" - M4_LIBOBJS="$M4_LIBOBJS mkstemp-safer.$ac_objext" -for ac_func in strtol +for ac_func in snprintf wcslen do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -14711,88 +21424,13 @@ return $ac_func (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - M4_LIBOBJS="$M4_LIBOBJS $ac_func.$ac_objext" -fi -done - - - - - - - - - - - { echo "$as_me:$LINENO: checking whether mkdir is declared" >&5 -echo $ECHO_N "checking whether mkdir is declared... $ECHO_C" >&6; } -if test "${ac_cv_have_decl_mkdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -int -main () -{ -#ifndef mkdir - (void) mkdir; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -14801,56 +21439,53 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_have_decl_mkdir=yes + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_have_decl_mkdir=no + eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_mkdir" >&5 -echo "${ECHO_T}$ac_cv_have_decl_mkdir" >&6; } -if test $ac_cv_have_decl_mkdir = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_MKDIR 1 -_ACEOF - - -else +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_MKDIR 0 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF +fi +done -for ac_header in io.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5 +echo $ECHO_N "checking whether _snprintf is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl__snprintf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include + +int +main () +{ +#ifndef _snprintf + (void) _snprintf; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" @@ -14869,249 +21504,43 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + ac_cv_have_decl__snprintf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no + ac_cv_have_decl__snprintf=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------- ## -## Report this to bug-m4@gnu.org ## -## ----------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -fi - - - - - - - { echo "$as_me:$LINENO: checking absolute name of " >&5 -echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } -if test "${gl_cv_absolute_sys_stat_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - - - - if test $ac_cv_header_sys_stat_h = yes; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF - gl_cv_absolute_sys_stat_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | -sed -n '\#/sys/stat.h#{s#.*"\(.*/sys/stat.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` - fi - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_absolute_sys_stat_h" >&5 -echo "${ECHO_T}$gl_cv_absolute_sys_stat_h" >&6; } -cat >>confdefs.h <<_ACEOF -#define ABSOLUTE_SYS_STAT_H "$gl_cv_absolute_sys_stat_h" -_ACEOF - - - ABSOLUTE_SYS_STAT_H=\"$gl_cv_absolute_sys_stat_h\" - - SYS_STAT_H='sys/stat.h' - - - { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 -echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } -if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done -done -IFS=$as_save_IFS - -fi - - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version - MKDIR_P="$ac_install_sh -d" - fi fi -{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 -echo "${ECHO_T}$MKDIR_P" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl__snprintf" >&6; } +if test $ac_cv_have_decl__snprintf = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SNPRINTF 0 +_ACEOF - - { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 -echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } -if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done -done -IFS=$as_save_IFS - -fi - - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version - MKDIR_P="$ac_install_sh -d" - fi fi -{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 -echo "${ECHO_T}$MKDIR_P" >&6; } - M4_LIBOBJS="$M4_LIBOBJS tempname.$ac_objext" - : + fi -for ac_func in __secure_getenv +for ac_func in vasprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -15204,8 +21633,16 @@ _ACEOF fi done + if test $ac_cv_func_vasprintf = no; then + M4_LIBOBJS="$M4_LIBOBJS vasprintf.$ac_objext" + M4_LIBOBJS="$M4_LIBOBJS asprintf.$ac_objext" + if test $ac_cv_func_vasprintf = yes; then + REPLACE_VASPRINTF=1 + else + HAVE_VASPRINTF=0 + fi @@ -15214,46 +21651,11 @@ done - if test $ac_cv_header_unistd_h = yes; then - HAVE_UNISTD_H=1 - { echo "$as_me:$LINENO: checking absolute name of " >&5 -echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } -if test "${gl_cv_absolute_unistd_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - - - - if test $ac_cv_header_unistd_h = yes; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF - gl_cv_absolute_unistd_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | -sed -n '\#/unistd.h#{s#.*"\(.*/unistd.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` - fi - -fi -{ echo "$as_me:$LINENO: result: $gl_cv_absolute_unistd_h" >&5 -echo "${ECHO_T}$gl_cv_absolute_unistd_h" >&6; } -cat >>confdefs.h <<_ACEOF -#define ABSOLUTE_UNISTD_H "$gl_cv_absolute_unistd_h" -_ACEOF - - - ABSOLUTE_UNISTD_H=\"$gl_cv_absolute_unistd_h\" - else - HAVE_UNISTD_H=0 fi + GNULIB_VASPRINTF=1 @@ -15261,81 +21663,350 @@ _ACEOF - M4_LIBOBJS="$M4_LIBOBJS dup-safer.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS fd-safer.$ac_objext" - M4_LIBOBJS="$M4_LIBOBJS pipe-safer.$ac_objext" - - - -cat >>confdefs.h <<\_ACEOF -#define USE_UNLOCKED_IO 1 -_ACEOF - - - + gl_cv_func_vasprintf_posix=no +for ac_func in vasprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $ac_func +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_var=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done + case "$gl_cv_func_printf_sizes_c99" in + *yes) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + case "$gl_cv_func_printf_directive_a" in + *yes) + case "$gl_cv_func_printf_directive_f" in + *yes) + case "$gl_cv_func_printf_directive_n" in + *yes) + case "$gl_cv_func_printf_positions" in + *yes) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + case "$gl_cv_func_printf_flag_zero" in + *yes) + if test $ac_cv_func_vasprintf = yes; then + # vasprintf exists and is already + # POSIX compliant. + gl_cv_func_vasprintf_posix=yes + fi + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + if test $gl_cv_func_vasprintf_posix = no; then + case "$gl_cv_func_printf_long_double" in + *yes) + ;; + *) +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_LONG_DOUBLE 1 +_ACEOF + ;; + esac + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_INFINITE_DOUBLE 1 +_ACEOF + ;; + esac + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_INFINITE_LONG_DOUBLE 1 +_ACEOF + ;; + esac + ;; + esac + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_DIRECTIVE_A 1 +_ACEOF +for ac_func in nl_langinfo +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $ac_func +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_var=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done + ;; + esac + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_DIRECTIVE_F 1 +_ACEOF + ;; + esac + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_FLAG_GROUPING 1 +_ACEOF + ;; + esac + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) +cat >>confdefs.h <<\_ACEOF +#define NEED_PRINTF_FLAG_ZERO 1 +_ACEOF + ;; + esac - if test $ac_cv_func_vasnprintf = no; then @@ -15364,8 +22035,6 @@ _ACEOF - - { echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6; } if test "${ac_cv_type_ptrdiff_t+set}" = set; then @@ -15437,7 +22106,6 @@ fi - for ac_func in snprintf wcslen do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -15531,20 +22199,9 @@ _ACEOF fi done - - - - - fi - - - -for ac_func in vasprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5 +echo $ECHO_N "checking whether _snprintf is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl__snprintf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -15553,53 +22210,27 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif +#include int main () { -return $ac_func (); +#ifndef _snprintf + (void) _snprintf; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -15608,40 +22239,47 @@ eval "echo \"\$as_me:$LINENO: $ac_try_ec (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" + } && test -s conftest.$ac_objext; then + ac_cv_have_decl__snprintf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + ac_cv_have_decl__snprintf=no fi -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl__snprintf" >&6; } +if test $ac_cv_have_decl__snprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SNPRINTF 1 +_ACEOF + + +else cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_DECL__SNPRINTF 0 _ACEOF + fi -done - if test $ac_cv_func_vasprintf = no; then + + + + + M4_LIBOBJS="$M4_LIBOBJS vasprintf.$ac_objext" M4_LIBOBJS="$M4_LIBOBJS asprintf.$ac_objext" - if test $ac_cv_func_vasprintf = yes; then - -cat >>confdefs.h <<\_ACEOF -#define REPLACE_VASPRINTF 1 -_ACEOF + if test $ac_cv_func_vasprintf = yes; then + REPLACE_VASPRINTF=1 + else + HAVE_VASPRINTF=0 fi @@ -15654,6 +22292,7 @@ _ACEOF fi + { echo "$as_me:$LINENO: checking whether is standalone" >&5 echo $ECHO_N "checking whether is standalone... $ECHO_C" >&6; } if test "${gl_cv_header_wchar_h_standalone+set}" = set; then @@ -15692,43 +22331,69 @@ rm -f core conftest.err conftest.$ac_obj fi { echo "$as_me:$LINENO: result: $gl_cv_header_wchar_h_standalone" >&5 echo "${ECHO_T}$gl_cv_header_wchar_h_standalone" >&6; } - if test $gl_cv_header_wchar_h_standalone = yes; then - WCHAR_H= + if test $gl_cv_header_wchar_h_standalone != yes; then + WCHAR_H=wchar.h + fi + + + + + + + + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 else - { echo "$as_me:$LINENO: checking absolute name of " >&5 -echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } -if test "${gl_cv_absolute_wchar_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + HAVE_WCHAR_H=0 + fi - if test $ac_cv_header_wchar_h = yes; then - cat >conftest.$ac_ext <<_ACEOF + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wchar_h='<'wchar.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_wchar_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_wchar_h = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include + _ACEOF - gl_cv_absolute_wchar_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | -sed -n '\#/wchar.h#{s#.*"\(.*/wchar.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` - fi + gl_cv_next_wchar_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/wchar.h#{ + s#.*"\(.*/wchar.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_wchar_h='<'wchar.h'>' + fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_absolute_wchar_h" >&5 -echo "${ECHO_T}$gl_cv_absolute_wchar_h" >&6; } -cat >>confdefs.h <<_ACEOF -#define ABSOLUTE_WCHAR_H "$gl_cv_absolute_wchar_h" -_ACEOF +{ echo "$as_me:$LINENO: result: $gl_cv_next_wchar_h" >&5 +echo "${ECHO_T}$gl_cv_next_wchar_h" >&6; } + fi + NEXT_WCHAR_H=$gl_cv_next_wchar_h - ABSOLUTE_WCHAR_H=\"$gl_cv_absolute_wchar_h\" - WCHAR_H=wchar.h - fi @@ -15738,6 +22403,11 @@ _ACEOF + if test $ac_cv_func_iswcntrl = yes; then + HAVE_ISWCNTRL=1 + else + HAVE_ISWCNTRL=0 + fi @@ -15757,51 +22427,65 @@ _ACEOF WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then - if test "$ac_cv_func_iswcntrl" = yes; then + if test $ac_cv_func_iswcntrl = yes; then WCTYPE_H= fi - { echo "$as_me:$LINENO: checking absolute name of " >&5 -echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } -if test "${gl_cv_absolute_wctype_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test $ac_cv_header_wctype_h = yes; then - cat >conftest.$ac_ext <<_ACEOF + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wctype_h='<'wctype.h'>' + else + { echo "$as_me:$LINENO: checking absolute name of " >&5 +echo $ECHO_N "checking absolute name of ... $ECHO_C" >&6; } +if test "${gl_cv_next_wctype_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test $ac_cv_header_wctype_h = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include + _ACEOF - gl_cv_absolute_wctype_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | -sed -n '\#/wctype.h#{s#.*"\(.*/wctype.h\)".*#\1#;s#^/[^/]#//&#;p;q;}'` - fi + gl_cv_next_wctype_h='"'`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/wctype.h#{ + s#.*"\(.*/wctype.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_wctype_h='<'wctype.h'>' + fi fi -{ echo "$as_me:$LINENO: result: $gl_cv_absolute_wctype_h" >&5 -echo "${ECHO_T}$gl_cv_absolute_wctype_h" >&6; } -cat >>confdefs.h <<_ACEOF -#define ABSOLUTE_WCTYPE_H "$gl_cv_absolute_wctype_h" -_ACEOF +{ echo "$as_me:$LINENO: result: $gl_cv_next_wctype_h" >&5 +echo "${ECHO_T}$gl_cv_next_wctype_h" >&6; } + fi + NEXT_WCTYPE_H=$gl_cv_next_wctype_h + - ABSOLUTE_WCTYPE_H=\"$gl_cv_absolute_wctype_h\" HAVE_WCTYPE_H=1 else - ABSOLUTE_WCTYPE_H=\"no/such/file/wctype.h\" HAVE_WCTYPE_H=0 fi - M4_LIBOBJS="$M4_LIBOBJS xmalloc.$ac_objext" @@ -16432,7 +23116,7 @@ fi ac_config_commands="$ac_config_commands stamp-h" -ac_config_files="$ac_config_files Makefile doc/Makefile lib/Makefile src/Makefile checks/Makefile examples/Makefile" +ac_config_files="$ac_config_files Makefile doc/Makefile lib/Makefile src/Makefile tests/Makefile checks/Makefile examples/Makefile" cat >confcache <<\_ACEOF @@ -16876,7 +23560,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GNU M4 $as_me 1.4.9, which was +This file was extended by GNU M4 $as_me 1.4.10, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16929,7 +23613,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -GNU M4 config.status 1.4.9 +GNU M4 config.status 1.4.10 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -17050,6 +23734,7 @@ do "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "checks/Makefile") CONFIG_FILES="$CONFIG_FILES checks/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; @@ -17205,12 +23890,12 @@ GL_COND_LIBTOOL_TRUE!$GL_COND_LIBTOOL_TR GL_COND_LIBTOOL_FALSE!$GL_COND_LIBTOOL_FALSE$ac_delim ALLOCA!$ALLOCA$ac_delim ALLOCA_H!$ALLOCA_H$ac_delim -GETOPT_H!$GETOPT_H$ac_delim -ABSOLUTE_SYS_TIME_H!$ABSOLUTE_SYS_TIME_H$ac_delim -HAVE_SYS_TIME_H!$HAVE_SYS_TIME_H$ac_delim -HAVE_STRUCT_TIMEVAL!$HAVE_STRUCT_TIMEVAL$ac_delim -REPLACE_GETTIMEOFDAY!$REPLACE_GETTIMEOFDAY$ac_delim -SYS_TIME_H!$SYS_TIME_H$ac_delim +GNULIB_FPRINTF_POSIX!$GNULIB_FPRINTF_POSIX$ac_delim +GNULIB_PRINTF_POSIX!$GNULIB_PRINTF_POSIX$ac_delim +GNULIB_SNPRINTF!$GNULIB_SNPRINTF$ac_delim +GNULIB_SPRINTF_POSIX!$GNULIB_SPRINTF_POSIX$ac_delim +GNULIB_VFPRINTF_POSIX!$GNULIB_VFPRINTF_POSIX$ac_delim +GNULIB_VPRINTF_POSIX!$GNULIB_VPRINTF_POSIX$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -17252,20 +23937,146 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +GNULIB_VSNPRINTF!$GNULIB_VSNPRINTF$ac_delim +GNULIB_VSPRINTF_POSIX!$GNULIB_VSPRINTF_POSIX$ac_delim +GNULIB_VASPRINTF!$GNULIB_VASPRINTF$ac_delim +GNULIB_FSEEK!$GNULIB_FSEEK$ac_delim +GNULIB_FSEEKO!$GNULIB_FSEEKO$ac_delim +GNULIB_FTELL!$GNULIB_FTELL$ac_delim +GNULIB_FTELLO!$GNULIB_FTELLO$ac_delim +GNULIB_FFLUSH!$GNULIB_FFLUSH$ac_delim +REPLACE_FPRINTF!$REPLACE_FPRINTF$ac_delim +REPLACE_VFPRINTF!$REPLACE_VFPRINTF$ac_delim +REPLACE_PRINTF!$REPLACE_PRINTF$ac_delim +REPLACE_VPRINTF!$REPLACE_VPRINTF$ac_delim +REPLACE_SNPRINTF!$REPLACE_SNPRINTF$ac_delim +HAVE_DECL_SNPRINTF!$HAVE_DECL_SNPRINTF$ac_delim +REPLACE_VSNPRINTF!$REPLACE_VSNPRINTF$ac_delim +HAVE_DECL_VSNPRINTF!$HAVE_DECL_VSNPRINTF$ac_delim +REPLACE_SPRINTF!$REPLACE_SPRINTF$ac_delim +REPLACE_VSPRINTF!$REPLACE_VSPRINTF$ac_delim +HAVE_VASPRINTF!$HAVE_VASPRINTF$ac_delim +REPLACE_VASPRINTF!$REPLACE_VASPRINTF$ac_delim +HAVE_FSEEKO!$HAVE_FSEEKO$ac_delim +REPLACE_FSEEKO!$REPLACE_FSEEKO$ac_delim +REPLACE_FSEEK!$REPLACE_FSEEK$ac_delim +HAVE_FTELLO!$HAVE_FTELLO$ac_delim +REPLACE_FTELLO!$REPLACE_FTELLO$ac_delim +REPLACE_FTELL!$REPLACE_FTELL$ac_delim +REPLACE_FFLUSH!$REPLACE_FFLUSH$ac_delim +INCLUDE_NEXT!$INCLUDE_NEXT$ac_delim +NEXT_FLOAT_H!$NEXT_FLOAT_H$ac_delim +FLOAT_H!$FLOAT_H$ac_delim +GNULIB_FREXP!$GNULIB_FREXP$ac_delim +GNULIB_FREXPL!$GNULIB_FREXPL$ac_delim +GNULIB_LDEXPL!$GNULIB_LDEXPL$ac_delim +GNULIB_MATHL!$GNULIB_MATHL$ac_delim +GNULIB_SIGNBIT!$GNULIB_SIGNBIT$ac_delim +HAVE_DECL_ACOSL!$HAVE_DECL_ACOSL$ac_delim +HAVE_DECL_ASINL!$HAVE_DECL_ASINL$ac_delim +HAVE_DECL_ATANL!$HAVE_DECL_ATANL$ac_delim +HAVE_DECL_CEILL!$HAVE_DECL_CEILL$ac_delim +HAVE_DECL_COSL!$HAVE_DECL_COSL$ac_delim +HAVE_DECL_EXPL!$HAVE_DECL_EXPL$ac_delim +HAVE_DECL_FLOORL!$HAVE_DECL_FLOORL$ac_delim +HAVE_DECL_FREXPL!$HAVE_DECL_FREXPL$ac_delim +HAVE_DECL_LDEXPL!$HAVE_DECL_LDEXPL$ac_delim +HAVE_DECL_LOGL!$HAVE_DECL_LOGL$ac_delim +HAVE_DECL_SINL!$HAVE_DECL_SINL$ac_delim +HAVE_DECL_SQRTL!$HAVE_DECL_SQRTL$ac_delim +HAVE_DECL_TANL!$HAVE_DECL_TANL$ac_delim +REPLACE_FREXP!$REPLACE_FREXP$ac_delim +REPLACE_FREXPL!$REPLACE_FREXPL$ac_delim +REPLACE_LDEXPL!$REPLACE_LDEXPL$ac_delim +REPLACE_SIGNBIT!$REPLACE_SIGNBIT$ac_delim +GETOPT_H!$GETOPT_H$ac_delim +LIBINTL!$LIBINTL$ac_delim +LTLIBINTL!$LTLIBINTL$ac_delim +NEXT_SYS_TIME_H!$NEXT_SYS_TIME_H$ac_delim +HAVE_SYS_TIME_H!$HAVE_SYS_TIME_H$ac_delim +HAVE_STRUCT_TIMEVAL!$HAVE_STRUCT_TIMEVAL$ac_delim +REPLACE_GETTIMEOFDAY!$REPLACE_GETTIMEOFDAY$ac_delim +SYS_TIME_H!$SYS_TIME_H$ac_delim GLIBC21!$GLIBC21$ac_delim +GNULIB_CHOWN!$GNULIB_CHOWN$ac_delim +GNULIB_DUP2!$GNULIB_DUP2$ac_delim +GNULIB_FCHDIR!$GNULIB_FCHDIR$ac_delim +GNULIB_FTRUNCATE!$GNULIB_FTRUNCATE$ac_delim +GNULIB_GETCWD!$GNULIB_GETCWD$ac_delim +GNULIB_GETLOGIN_R!$GNULIB_GETLOGIN_R$ac_delim +GNULIB_LCHOWN!$GNULIB_LCHOWN$ac_delim +GNULIB_LSEEK!$GNULIB_LSEEK$ac_delim +GNULIB_READLINK!$GNULIB_READLINK$ac_delim +GNULIB_SLEEP!$GNULIB_SLEEP$ac_delim +HAVE_DUP2!$HAVE_DUP2$ac_delim +HAVE_FTRUNCATE!$HAVE_FTRUNCATE$ac_delim +HAVE_READLINK!$HAVE_READLINK$ac_delim +HAVE_SLEEP!$HAVE_SLEEP$ac_delim +HAVE_DECL_GETLOGIN_R!$HAVE_DECL_GETLOGIN_R$ac_delim +REPLACE_CHOWN!$REPLACE_CHOWN$ac_delim +REPLACE_FCHDIR!$REPLACE_FCHDIR$ac_delim +REPLACE_GETCWD!$REPLACE_GETCWD$ac_delim +REPLACE_LCHOWN!$REPLACE_LCHOWN$ac_delim +REPLACE_LSEEK!$REPLACE_LSEEK$ac_delim +NEXT_MATH_H!$NEXT_MATH_H$ac_delim GNULIB_GETSUBOPT!$GNULIB_GETSUBOPT$ac_delim GNULIB_MKDTEMP!$GNULIB_MKDTEMP$ac_delim GNULIB_MKSTEMP!$GNULIB_MKSTEMP$ac_delim HAVE_GETSUBOPT!$HAVE_GETSUBOPT$ac_delim HAVE_MKDTEMP!$HAVE_MKDTEMP$ac_delim REPLACE_MKSTEMP!$REPLACE_MKSTEMP$ac_delim +GNULIB_SIGPROCMASK!$GNULIB_SIGPROCMASK$ac_delim +HAVE_POSIX_SIGNALBLOCKING!$HAVE_POSIX_SIGNALBLOCKING$ac_delim +HAVE_SIGSET_T!$HAVE_SIGSET_T$ac_delim +NEXT_SIGNAL_H!$NEXT_SIGNAL_H$ac_delim STDBOOL_H!$STDBOOL_H$ac_delim HAVE__BOOL!$HAVE__BOOL$ac_delim HAVE_LONG_LONG_INT!$HAVE_LONG_LONG_INT$ac_delim HAVE_UNSIGNED_LONG_LONG_INT!$HAVE_UNSIGNED_LONG_LONG_INT$ac_delim HAVE_INTTYPES_H!$HAVE_INTTYPES_H$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF HAVE_SYS_TYPES_H!$HAVE_SYS_TYPES_H$ac_delim -ABSOLUTE_STDINT_H!$ABSOLUTE_STDINT_H$ac_delim +NEXT_STDINT_H!$NEXT_STDINT_H$ac_delim HAVE_STDINT_H!$HAVE_STDINT_H$ac_delim HAVE_SYS_INTTYPES_H!$HAVE_SYS_INTTYPES_H$ac_delim HAVE_SYS_BITYPES_H!$HAVE_SYS_BITYPES_H$ac_delim @@ -17283,30 +24094,25 @@ SIZE_T_SUFFIX!$SIZE_T_SUFFIX$ac_delim WCHAR_T_SUFFIX!$WCHAR_T_SUFFIX$ac_delim WINT_T_SUFFIX!$WINT_T_SUFFIX$ac_delim STDINT_H!$STDINT_H$ac_delim -ABSOLUTE_STDLIB_H!$ABSOLUTE_STDLIB_H$ac_delim -ABSOLUTE_SYS_STAT_H!$ABSOLUTE_SYS_STAT_H$ac_delim +NEXT_STDIO_H!$NEXT_STDIO_H$ac_delim +NEXT_STDLIB_H!$NEXT_STDLIB_H$ac_delim +HAVE_LSTAT!$HAVE_LSTAT$ac_delim +HAVE_DECL_MKDIR!$HAVE_DECL_MKDIR$ac_delim +HAVE_IO_H!$HAVE_IO_H$ac_delim +NEXT_SYS_STAT_H!$NEXT_SYS_STAT_H$ac_delim SYS_STAT_H!$SYS_STAT_H$ac_delim -GNULIB_CHOWN!$GNULIB_CHOWN$ac_delim -GNULIB_DUP2!$GNULIB_DUP2$ac_delim -GNULIB_FCHDIR!$GNULIB_FCHDIR$ac_delim -GNULIB_FTRUNCATE!$GNULIB_FTRUNCATE$ac_delim -GNULIB_GETCWD!$GNULIB_GETCWD$ac_delim -GNULIB_GETLOGIN_R!$GNULIB_GETLOGIN_R$ac_delim -GNULIB_READLINK!$GNULIB_READLINK$ac_delim -HAVE_DUP2!$HAVE_DUP2$ac_delim -HAVE_FTRUNCATE!$HAVE_FTRUNCATE$ac_delim -HAVE_READLINK!$HAVE_READLINK$ac_delim -HAVE_DECL_GETLOGIN_R!$HAVE_DECL_GETLOGIN_R$ac_delim -REPLACE_CHOWN!$REPLACE_CHOWN$ac_delim -REPLACE_FCHDIR!$REPLACE_FCHDIR$ac_delim -REPLACE_GETCWD!$REPLACE_GETCWD$ac_delim +NEXT_UNISTD_H!$NEXT_UNISTD_H$ac_delim HAVE_UNISTD_H!$HAVE_UNISTD_H$ac_delim -ABSOLUTE_UNISTD_H!$ABSOLUTE_UNISTD_H$ac_delim EOVERFLOW!$EOVERFLOW$ac_delim -ABSOLUTE_WCHAR_H!$ABSOLUTE_WCHAR_H$ac_delim +GNULIB_WCWIDTH!$GNULIB_WCWIDTH$ac_delim +HAVE_DECL_WCWIDTH!$HAVE_DECL_WCWIDTH$ac_delim +REPLACE_WCWIDTH!$REPLACE_WCWIDTH$ac_delim WCHAR_H!$WCHAR_H$ac_delim +HAVE_WCHAR_H!$HAVE_WCHAR_H$ac_delim +NEXT_WCHAR_H!$NEXT_WCHAR_H$ac_delim +HAVE_ISWCNTRL!$HAVE_ISWCNTRL$ac_delim HAVE_WINT_T!$HAVE_WINT_T$ac_delim -ABSOLUTE_WCTYPE_H!$ABSOLUTE_WCTYPE_H$ac_delim +NEXT_WCTYPE_H!$NEXT_WCTYPE_H$ac_delim HAVE_WCTYPE_H!$HAVE_WCTYPE_H$ac_delim WCTYPE_H!$WCTYPE_H$ac_delim LIBM4_LIBDEPS!$LIBM4_LIBDEPS$ac_delim @@ -17319,7 +24125,7 @@ M4_LIBOBJS!$M4_LIBOBJS$ac_delim M4_LTLIBOBJS!$M4_LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 65; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 48; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -17337,7 +24143,7 @@ if test -n "$ac_eof"; then fi cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +cat >"\$tmp/subs-3.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' @@ -17606,7 +24412,7 @@ s&@abs_top_builddir@&$ac_abs_top_builddi s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed -f "$tmp/subs-3.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && diff -ruNp m4-1.4.9/configure.ac m4-1.4.10/configure.ac --- m4-1.4.9/configure.ac 2007-03-23 06:40:49.000000000 -0600 +++ m4-1.4.10/configure.ac 2007-07-09 21:09:35.000000000 -0600 @@ -4,7 +4,7 @@ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# 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, @@ -18,7 +18,7 @@ # 02110-1301 USA AC_PREREQ([2.60]) -AC_INIT([GNU M4], [1.4.9], [bug-m4@gnu.org]) +AC_INIT([GNU M4], [1.4.10], [bug-m4@gnu.org]) AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 gnu]) PACKAGE=$PACKAGE_TARNAME; AC_SUBST([PACKAGE]) VERSION=$PACKAGE_VERSION; AC_SUBST([VERSION]) @@ -165,6 +165,7 @@ AC_CONFIG_FILES([Makefile doc/Makefile lib/Makefile src/Makefile + tests/Makefile checks/Makefile examples/Makefile ]) diff -ruNp m4-1.4.9/depcomp m4-1.4.10/depcomp --- m4-1.4.9/depcomp 2007-03-23 06:54:11.000000000 -0600 +++ m4-1.4.10/depcomp 2007-07-09 21:15:35.000000000 -0600 @@ -1,14 +1,14 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2006-10-15.18 +scriptversion=2007-03-29.01 -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, @@ -215,34 +215,39 @@ aix) # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u "$@" -M fi stat=$? - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - if test $stat -eq 0; then : else - rm -f "$tmpdepfile" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done if test -f "$tmpdepfile"; then - outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile diff -ruNp m4-1.4.9/doc/Makefile.am m4-1.4.10/doc/Makefile.am --- m4-1.4.9/doc/Makefile.am 2006-07-27 12:12:08.000000000 -0600 +++ m4-1.4.10/doc/Makefile.am 2007-07-09 21:27:07.000000000 -0600 @@ -1,10 +1,10 @@ ## This file is part of GNU M4. ## -## Copyright (C) 2006 Free Software Foundation, Inc. +## Copyright (C) 2006, 2007 Free Software Foundation, Inc. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or +## 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, @@ -20,7 +20,7 @@ ## This file written by Eric Blake info_TEXINFOS = m4.texinfo -m4_TEXINFOS = fdl.texi +m4_TEXINFOS = fdl.texi gpl-3.0.texi man_MANS = m4.1 EXTRA_DIST = $(man_MANS) gendocs_template MAINTAINERCLEANFILES = $(man_MANS) gendocs_template diff -ruNp m4-1.4.9/doc/Makefile.in m4-1.4.10/doc/Makefile.in --- m4-1.4.9/doc/Makefile.in 2007-03-23 07:32:33.000000000 -0600 +++ m4-1.4.10/doc/Makefile.in 2007-07-09 21:30:30.000000000 -0600 @@ -36,36 +36,48 @@ DIST_COMMON = $(m4_TEXINFOS) $(srcdir)/M $(srcdir)/Makefile.in $(srcdir)/stamp-vti \ $(srcdir)/version.texi mdate-sh texinfo.tex ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ - $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/closein.m4 \ $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ - $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ - $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ - $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/inline.m4 \ + $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ + $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ + $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ + $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/localcharset.m4 \ - $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ - $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ - $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ - $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ + $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/printf-frexp.m4 \ + $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ + $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ + $(top_srcdir)/m4/sig_atomic_t.m4 $(top_srcdir)/m4/signal_h.m4 \ + $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/signbit.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ @@ -101,13 +113,6 @@ man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ -ABSOLUTE_STDLIB_H = @ABSOLUTE_STDLIB_H@ -ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ -ABSOLUTE_SYS_TIME_H = @ABSOLUTE_SYS_TIME_H@ -ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@ -ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@ -ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ @@ -135,30 +140,80 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ +FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREXP = @GNULIB_FREXP@ +GNULIB_FREXPL = @GNULIB_FREXPL@ +GNULIB_FSEEK = @GNULIB_FSEEK@ +GNULIB_FSEEKO = @GNULIB_FSEEKO@ +GNULIB_FTELL = @GNULIB_FTELL@ +GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LDEXPL = @GNULIB_LDEXPL@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ +GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ +GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ +GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ +GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ +GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ +HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ +HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ +HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ +HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ +HAVE_DECL_SINL = @HAVE_DECL_SINL@ +HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ +HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_FSEEKO = @HAVE_FSEEKO@ +HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_IO_H = @HAVE_IO_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SIGSET_T = @HAVE_SIGSET_T@ +HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ @@ -167,24 +222,40 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_VASPRINTF = @HAVE_VASPRINTF@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE__BOOL = @HAVE__BOOL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ +NEXT_FLOAT_H = @NEXT_FLOAT_H@ +NEXT_MATH_H = @NEXT_MATH_H@ +NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDIO_H = @NEXT_STDIO_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -197,9 +268,30 @@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREXP = @REPLACE_FREXP@ +REPLACE_FREXPL = @REPLACE_FREXPL@ +REPLACE_FSEEK = @REPLACE_FSEEK@ +REPLACE_FSEEKO = @REPLACE_FSEEKO@ +REPLACE_FTELL = @REPLACE_FTELL@ +REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ +REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ +REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ +REPLACE_VPRINTF = @REPLACE_VPRINTF@ +REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ +REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ @@ -264,7 +356,7 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ info_TEXINFOS = m4.texinfo -m4_TEXINFOS = fdl.texi +m4_TEXINFOS = fdl.texi gpl-3.0.texi man_MANS = m4.1 EXTRA_DIST = $(man_MANS) gendocs_template MAINTAINERCLEANFILES = $(man_MANS) gendocs_template diff -ruNp m4-1.4.9/doc/gendocs_template m4-1.4.10/doc/gendocs_template --- m4-1.4.9/doc/gendocs_template 2007-03-23 06:50:37.000000000 -0600 +++ m4-1.4.10/doc/gendocs_template 2007-07-05 05:47:49.000000000 -0600 @@ -1,14 +1,7 @@ - - - - - + %%TITLE%% - GNU Project - Free Software Foundation (FSF) - - - - + +

%%TITLE%%

@@ -16,76 +9,74 @@ - - -

%%TITLE%%

-
Free Software Foundation
last updated %%DATE%%
-

- -  [image of the head of a GNU] - -

-

This manual (%%PACKAGE%%) is available in the following formats:

+

You can buy printed copies of +some manuals (among other items) from the Free Software Foundation; +this helps support FSF activities.

+

(This page generated by the %%SCRIPTNAME%% script.)

- + + - + diff -ruNp m4-1.4.9/doc/gpl-3.0.texi m4-1.4.10/doc/gpl-3.0.texi --- m4-1.4.9/doc/gpl-3.0.texi 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/doc/gpl-3.0.texi 2007-07-05 05:47:50.000000000 -0600 @@ -0,0 +1,717 @@ +@node Copying +@appendixsec GNU General Public License +@center Version 3, 29 June 2007 + +@c This file is intended to be included in another file. + +@display +Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/} + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. +@end display + +@heading 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. + +@heading TERMS AND CONDITIONS + +@enumerate 0 +@item 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. + +@item 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. + +@item 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. + +@item 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. + +@item 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. + +@item 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: + +@enumerate a +@item +The work must carry prominent notices stating that you modified it, +and giving a relevant date. + +@item +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''. + +@item +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. + +@item +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. +@end enumerate + +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. + +@item 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: + +@enumerate a +@item +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. + +@item +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. + +@item +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. + +@item +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. + +@item +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. + +@end enumerate + +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. + +@item 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: + +@enumerate a +@item +Disclaiming warranty or limiting liability differently from the terms +of sections 15 and 16 of this License; or + +@item +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 + +@item +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 + +@item +Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +@item +Declining to grant rights under trademark law for use of some trade +names, trademarks, or service marks; or + +@item +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. +@end enumerate + +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. + +@item 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. + +@item 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. + +@item 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. + +@item 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. + +@item 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. + +@item 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. + +@item 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. + +@item 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. + +@item 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. + +@item 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 enumerate + +@heading END OF TERMS AND CONDITIONS + +@heading 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. + +@smallexample +@var{one line to give the program's name and a brief idea of what it does.} +Copyright (C) @var{year} @var{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 @url{http://www.gnu.org/licenses/}. +@end smallexample + +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: + +@smallexample +@var{program} Copyright (C) @var{year} @var{name of author} +This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}. +This is free software, and you are welcome to redistribute it +under certain conditions; type @samp{show c} for details. +@end smallexample + +The hypothetical commands @samp{show w} and @samp{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 +@url{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 @url{http://www.gnu.org/philosophy/why-not-lgpl.html}. diff -ruNp m4-1.4.9/doc/m4.1 m4-1.4.10/doc/m4.1 --- m4-1.4.9/doc/m4.1 2007-03-23 07:36:08.000000000 -0600 +++ m4-1.4.10/doc/m4.1 2007-07-09 21:20:51.000000000 -0600 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. -.TH M4 "1" "March 2007" "FSF" "User Commands" +.TH M4 "1" "July 2007" "FSF" "User Commands" .SH NAME m4 \- macro processor .SH SYNOPSIS @@ -124,7 +124,7 @@ Written by Rene' Seindal. Report bugs to . .SH COPYRIGHT Copyright \(co 2007 Free Software Foundation, Inc. -License GPLv2+: GNU GPL version 2 or later +License GPLv3+: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. diff -ruNp m4-1.4.9/doc/m4.info m4-1.4.10/doc/m4.info --- m4-1.4.9/doc/m4.info 2007-03-23 07:36:05.000000000 -0600 +++ m4-1.4.10/doc/m4.info 2007-07-09 21:20:52.000000000 -0600 @@ -1,6 +1,6 @@ This is m4.info, produced by makeinfo version 4.8 from m4.texinfo. - This manual is for GNU M4 (version 1.4.9, 23 March 2007), a package + This manual is for GNU M4 (version 1.4.10, 4 July 2007), a package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, @@ -13,7 +13,7 @@ containing an implementation of the m4 m no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License." -INFO-DIR-SECTION GNU programming tools +INFO-DIR-SECTION Text creation and manipulation START-INFO-DIR-ENTRY * M4: (m4). A powerful macro processor. END-INFO-DIR-ENTRY @@ -24,7 +24,7 @@ File: m4.info, Node: Top, Next: Prelim GNU M4 ****** -This manual is for GNU M4 (version 1.4.9, 23 March 2007), a package +This manual is for GNU M4 (version 1.4.10, 4 July 2007), a package containing an implementation of the m4 macro language. Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006, @@ -46,10 +46,10 @@ generating `configure' scripts, but not GNU `m4' was originally written by Rene' Seindal, with subsequent changes by Franc,ois Pinard and other volunteers on the Internet. All -names and email addresses can be found in the files `m4-1.4.9/AUTHORS' -and `m4-1.4.9/THANKS' from the GNU M4 distribution. +names and email addresses can be found in the files `m4-1.4.10/AUTHORS' +and `m4-1.4.10/THANKS' from the GNU M4 distribution. - This is release 1.4.9. It is now considered stable: future + This is release 1.4.10. It is now considered stable: future releases in the 1.4.x series are only meant to fix bugs, increase speed, or improve documentation. However... @@ -86,6 +86,7 @@ will go away and _you should not count o * Compatibility:: Compatibility with other versions of `m4' * Answers:: Correct version of some examples +* Copying This Package:: How to make copies of the overall M4 package * Copying This Manual:: How to make copies of this manual * Indices:: Indices of concepts and macros @@ -218,8 +219,9 @@ Correct version of some examples * Improved cleardivert:: Solution for `cleardivert' * Improved fatal_error:: Solution for `fatal_error' -How to make copies of this manual +How to make copies of this package or manual +* Copying:: GNU General Public License * GNU Free Documentation License:: License for copying this manual Indices of concepts and macros @@ -332,7 +334,7 @@ addressed some long standing bugs in the 1.4 that were floating around the net and released 1.4.3 and 1.4.4. And in 2006, Eric Blake joined the team and prepared patches for the release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8. The 1.4.x series remains -open for bug fixes, including release 1.4.9 in 2007. +open for bug fixes, including release 1.4.9 and 1.4.10 in 2007. Meanwhile, development has continued on new features for `m4', such as dynamic module loading and additional builtins. When complete, GNU @@ -381,8 +383,11 @@ shown in a fixed width font, like this To distinguish input from output, all output from `m4' is prefixed by the string `=>', and all error messages by the string `error-->'. -Thus +When showing how command line options affect matters, the command line +is shown with a prompt `$ like this', otherwise, you can assume that a +simple `m4' invocation will work. Thus: + $ command line to invoke m4 Example of input line =>Output line from m4 error-->and an error message @@ -391,7 +396,12 @@ Thus The sequence `' refers to the newline character. The majority of these examples are self-contained, and you can run them with similar results by invoking `m4 -d'. In fact, the testsuite that is bundled in -the GNU M4 package consists of the examples in this document! +the GNU M4 package consists of the examples in this document! Some of +the examples assume that your current directory is located where you +unpacked the installation, so if you plan on following along, you may +find it helpful to do this now: + + $ cd m4-1.4.10 As each of the predefined macros in `m4' is described, a prototype call of the macro will be shown, giving descriptive names to the @@ -587,7 +597,39 @@ from. These features occur with the fol Synchronization directives are always given on complete lines by themselves. When a synchronization discrepancy occurs in the middle of an output line, the associated synchronization directive - is delayed until the beginning of the next generated line. + is delayed until the next newline that does not occur in the + middle of a quoted string or comment. + + define(`twoline', `1 + 2') + =>#line 2 "stdin" + => + changecom(`/*', `*/') + => + define(`comment', `/*1 + 2*/') + =>#line 5 + => + dnl no line + hello + =>#line 7 + =>hello + twoline + =>1 + =>#line 8 + =>2 + comment + =>/*1 + =>2*/ + one comment `two + three' + =>#line 10 + =>one /*1 + =>2*/ two + =>three + goodbye + =>#line 12 + =>goodbye `-U NAME' `--undefine=NAME' @@ -749,7 +791,17 @@ string. The options `--define' (`-D'), `--undefine' (`-U'), `--synclines' (`-s'), and `--trace' (`-t') only take effect after processing input -from any file names that occur earlier on the command line. +from any file names that occur earlier on the command line. For +example, assume the file `foo' contains: + + $ cat foo + bar + + The text `bar' can then be redefined over multiple uses of `foo': + + $ m4 -Dbar=hello foo -Dbar=world foo + =>hello + =>world If none of the input files invoked `m4exit' (*note M4exit::), the exit status of `m4' will be 0 for success, 1 for general failure (such @@ -768,13 +820,14 @@ File: m4.info, Node: Syntax, Next: Mac As `m4' reads its input, it separates it into "tokens". A token is either a name, a quoted string, or any single character, that is not a part of either a name or a string. Input to `m4' can also contain -comments. GNU `m4' does not yet understand locales; all operations are -byte-oriented rather than character-oriented (although if your locale -uses a single byte encoding, such as ISO-8859-1, you will not notice a -difference). However, `m4' is eight-bit clean, so you can use -non-ASCII characters in quoted strings (*note Changequote::), comments -(*note Changecom::), and macro names (*note Indir::), with the -exception of the NUL character (the zero byte `'\0''). +comments. GNU `m4' does not yet understand multibyte locales; all +operations are byte-oriented rather than character-oriented (although +if your locale uses a single byte encoding, such as ISO-8859-1, you +will not notice a difference). However, `m4' is eight-bit clean, so +you can use non-ASCII characters in quoted strings (*note +Changequote::), comments (*note Changecom::), and macro names (*note +Indir::), with the exception of the NUL character (the zero byte +`'\0''). * Menu: @@ -835,6 +888,7 @@ the output--comments are _not_ discarded comment. The commenting effect of the begin-comment string can be inhibited by quoting it. + $ m4 `quoted text' # `commented text' =>quoted text # `commented text' `quoting inhibits' `#' `comments' @@ -1090,6 +1144,7 @@ specifically states that invoking those unspecified, because many other implementations simply invoke the builtin as though it were given one empty argument instead. + $ m4 eval =>eval eval(`1') @@ -1102,6 +1157,16 @@ on user defined macros. For example, wi write `m4_dnl' and even `m4_m4exit'. It also has no effect on whether a macro requires parameters. + $ m4 -P + eval + =>eval + eval(`1') + =>eval(1) + m4_eval + =>m4_eval + m4_eval(`1') + =>1 + Another alternative is to redefine problematic macros to a name less likely to cause conflicts, *Note Definitions::. @@ -1219,6 +1284,24 @@ an inappropriate number of arguments, bu m4: Operation modes.). For user defined macros, there is no check of the number of arguments given. + $ m4 + index(`abc') + error-->m4:stdin:1: Warning: too few arguments to builtin `index' + =>0 + index(`abc',) + =>0 + index(`abc', `b', `ignored') + error-->m4:stdin:3: Warning: excess arguments to builtin `index' ignored + =>1 + + $ m4 -Q + index(`abc') + =>0 + index(`abc',) + =>0 + index(`abc', `b', `ignored') + =>1 + Macros are expanded normally during argument collection, and whatever commas, quotes and parentheses that might show up in the resulting expanded text will serve to define the arguments as well. Thus, if FOO @@ -1315,12 +1398,14 @@ therefore result in more macros being ca completely or partially, in the first macro calls' expansion. Taking a very simple example, if FOO expands to `bar', and BAR -expands to `Hello world', the input +expands to `Hello', the input + $ m4 -Dbar=Hello -Dfoo=bar foo + =>Hello will expand first to `bar', and when this is reread and expanded, into -`Hello world'. +`Hello'.  File: m4.info, Node: Definitions, Next: Conditionals, Prev: Macros, Up: Top @@ -1906,6 +1991,7 @@ NAME, that will be reflected in the fina than the behavior when invoking macros directly, where the definition that was in effect before argument collection is used. + $ m4 -d define(`f', `1') => f(define(`f', `2')) @@ -1920,6 +2006,7 @@ that was in effect before argument colle arguments, `indir' defers to the invoked NAME for whether a token representing a builtin is recognized or flattened to the empty string. + $ m4 -d indir(defn(`defn'), `divnum') error-->m4:stdin:1: Warning: indir: invalid macro name ignored => @@ -1983,6 +2070,18 @@ even when the `--prefix-builtins' option Operation modes.) is in effect. This is different from `indir', which only tracks current macro names. + $ m4 -P + m4_builtin(`divnum') + =>0 + m4_builtin(`m4_divnum') + error-->m4:stdin:2: undefined builtin `m4_divnum' + => + m4_indir(`divnum') + error-->m4:stdin:3: undefined macro `divnum' + => + m4_indir(`m4_divnum') + =>0 + Note that `indir' and `builtin' can be used to invoke builtins without arguments, even when they normally require parameters to be recognized; but it will provoke a warning, and result in a void @@ -2197,9 +2296,10 @@ requires adding quotes to each element: levels of quoting are added around each element. An actual implementation of these three macros is distributed as -`m4-1.4.9/examples/quote.m4' in this package. First, let's examine +`m4-1.4.10/examples/quote.m4' in this package. First, let's examine their usage: + $ m4 -I examples include(`quote.m4') => -quote-dquote-dquote_elt- @@ -2228,6 +2328,7 @@ an empty first argument. `dquote', on t string no matter what, since it is still possible to tell whether it was invoked without arguments based on the resulting string. + $ m4 -I examples undivert(`quote.m4')dnl =>divert(`-1') =># quote(args) - convert args to single-quoted string @@ -2277,6 +2378,7 @@ Here is an example of a loop macro that It can, for example, be used for simple counting: + $ m4 -I examples include(`forloop.m4') => forloop(`i', `1', `8', `i ') @@ -2284,6 +2386,7 @@ Here is an example of a loop macro that For-loops can be nested, like: + $ m4 -I examples include(`forloop.m4') => forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') @@ -2306,8 +2409,9 @@ finished, it increments the iterator (us `incr', *note Incr::), and recurses. Here is an actual implementation of `forloop', distributed as -`m4-1.4.9/examples/forloop.m4' in this package: +`m4-1.4.10/examples/forloop.m4' in this package: + $ m4 -I examples undivert(`forloop.m4')dnl =>divert(`-1') =># forloop(var, from, to, stmt) - simple version @@ -2346,9 +2450,10 @@ Here is an example of a loop macro that As an example, this displays each word in a list inside of a sentence, using an implementation of `foreach' distributed as -`m4-1.4.9/examples/foreach.m4', and `foreachq' in -`m4-1.4.9/examples/foreachq.m4'. +`m4-1.4.10/examples/foreach.m4', and `foreachq' in +`m4-1.4.10/examples/foreachq.m4'. + $ m4 -I examples include(`foreach.m4') => foreach(`x', (foo, bar, foobar), `Word was: x @@ -2368,6 +2473,7 @@ sentence, using an implementation of `fo QUOTE-LIST can itself be a list, to pass as further arguments to a helper macro. This example generates a shell case statement: + $ m4 -I examples include(`foreach.m4') => define(`_case', ` $1) @@ -2393,6 +2499,7 @@ grab the first element of a list. Secon recursion, successively walking through the original list. Here is a simple implementation of `foreach': + $ m4 -I examples undivert(`foreach.m4')dnl =>divert(`-1') =># foreach(x, (item_1, item_2, ..., item_n), stmt) @@ -2415,6 +2522,7 @@ pass double-quoted macro names in a list output after one layer of quotes is removed during list iteration and the final layer removed during the final rescan: + $ m4 -I examples define(`a', `1')define(`b', `2')define(`c', `3') => include(`foreach.m4') @@ -2436,6 +2544,7 @@ the final layer removed during the final Obviously, `foreachq' did a better job; here is its implementation: + $ m4 -I examples undivert(`foreachq.m4')dnl =>include(`quote.m4')dnl =>divert(`-1') @@ -2495,6 +2604,7 @@ If you want to see what a name expands i The expansion of `dumpdef' is void. + $ m4 -d define(`foo', `Hello world.') => dumpdef(`foo') @@ -2509,6 +2619,7 @@ The definition that is dumped correspond macro were to be called at that point, even if other definitions are still live due to redefining a macro during argument collection. + $ m4 -d pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') => f(popdef(`f')dumpdef(`f')) @@ -2547,6 +2658,7 @@ is not void, the expansion can be displa is printed to the current debug file (defaulting to standard error, *note Debug Output::). + $ m4 -d define(`foo', `Hello World.') => define(`echo', `$@') @@ -2564,12 +2676,27 @@ is printed to the current debug file (de most of the time, signifying an expansion at the outermost level, but it increases when macro arguments contain unquoted macro calls. The maximum number that will appear between dashes is controlled by the -option `--nesting-limit' (*note Invoking m4: Limits control.). +option `--nesting-limit' (or `-L', *note Invoking m4: Limits control.). +Additionally, the option `--trace' (or `-t') can be used to invoke +`traceon(NAME)' before parsing input. + + $ m4 -L 3 -t ifelse + ifelse(`one level') + error-->m4trace: -1- ifelse + => + ifelse(ifelse(ifelse(`three levels'))) + error-->m4trace: -3- ifelse + error-->m4trace: -2- ifelse + error-->m4trace: -1- ifelse + => + ifelse(ifelse(ifelse(ifelse(`four levels')))) + error-->m4:stdin:3: recursion limit of 3 exceeded, use -L to change it Tracing by name is an attribute that is preserved whether the macro -is defined or not. This allows the `-t' option to select macros to -trace before those macros are defined. +is defined or not. This allows the selection of macros to trace before +those macros are defined. + $ m4 -d traceoff(`foo') => traceon(`foo') @@ -2601,6 +2728,7 @@ trace before those macros are defined. Tracing even works on builtins. However, `defn' (*note Defn::) does not transfer tracing status. + $ m4 -d traceon(`eval', `m4_divnum') => define(`m4_eval', defn(`eval')) @@ -2701,6 +2829,7 @@ control of the debugging output format: The expansion of `debugmode' is void. + $ m4 define(`foo', `FOO') => traceon(`foo') @@ -2742,6 +2871,7 @@ or with the builtin macro `debugfile': The expansion of `debugfile' is void. + $ m4 traceon(`divnum') => divnum(`extra') @@ -3391,18 +3521,20 @@ There are two builtin macros in `m4' for The rest of this section assumes that `m4' is invoked with the `-I' option (*note Invoking m4: Preprocessor features.) pointing to the -`m4-1.4.9/examples' directory shipped as part of the GNU `m4' package. -The file `m4-1.4.9/examples/incl.m4' in the distribution contains the +`m4-1.4.10/examples' directory shipped as part of the GNU `m4' package. +The file `m4-1.4.10/examples/incl.m4' in the distribution contains the lines: - Include file start - foo - Include file end + $ cat examples/incl.m4 + =>Include file start + =>foo + =>Include file end Normally file inclusion is used to insert the contents of a file into the input stream. The contents of the file will be read by `m4' and macro calls in the file will be expanded: + $ m4 -I examples define(`foo', `FOO') => include(`incl.m4') @@ -3416,6 +3548,7 @@ file can be used to define macros that o is an example, which defines `bar' to expand to the contents of `incl.m4': + $ m4 -I examples define(`bar', include(`incl.m4')) => This is `bar': >>bar<< @@ -3660,8 +3793,13 @@ not get rearranged among the other diver GNU `m4' allows named files to be undiverted. Given a non-numeric argument, the contents of the file named will be copied, uninterpreted, to the current output. This complements the builtin `include' (*note -Include::). To illustrate the difference, the file -`m4-1.4.9/examples/foo' contains the word `bar': +Include::). To illustrate the difference, assume the file `foo' +contains: + + $ cat foo + bar + +then define(`bar', `BAR') => @@ -3673,7 +3811,18 @@ Include::). To illustrate the differenc => If the file is not found (or cannot be read), an error message is -issued, and the expansion is void. +issued, and the expansion is void. It is possible to intermix files +and diversion numbers. + + divert(`1')diversion one + divert(`2')undivert(`foo')dnl + divert(`3')diversion three + divert`'dnl + undivert(`1', `2', `foo', `3')dnl + =>diversion one + =>bar + =>bar + =>diversion three  File: m4.info, Node: Divnum, Next: Cleardivert, Prev: Undivert, Up: Diversions @@ -4064,14 +4213,25 @@ Formatted output can be made with `forma => format(`The string "%s" uses %d characters', foo, len(foo)) =>The string "The brown fox jumped over the lazy dog" uses 38 characters + format(`%*.*d', `-1', `-1', `1') + =>1 format(`%.0f', `56789.9876') =>56790 - len(format(`%-*X', `300', `1')) - =>300 + len(format(`%-*X', `5000', `1')) + =>5000 + ifelse(format(`%010F', `infinity'), ` INF', `success', + format(`%010F', `infinity'), ` INFINITY', `success', + format(`%010F', `infinity')) + =>success + ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', + format(`%.1A', `1.999'), `0X2.0P+0', `success', + format(`%.1A', `1.999')) + =>success Using the `forloop' macro defined earlier (*note Forloop::), this example shows how `format' can be used to produce tabular output. + $ m4 -I examples include(`forloop.m4') => forloop(`i', `1', `10', `format(`%6d squared is %10d @@ -4090,15 +4250,26 @@ example shows how `format' can be used t The builtin `format' is modeled after the ANSI C `printf' function, and supports these `%' specifiers: `c', `s', `d', `o', `x', `X', `u', -`e', `E', `f', `F', `g', `G', and `%'; it supports field widths and -precisions, and the modifiers `+', `-', ` ', `0', `#', `h' and `l'. -For more details on the functioning of `printf', see the C Library -Manual. - - For now, unrecognized specifiers are silently ignored, but it is -anticipated that a future release of GNU `m4' will support more -specifiers, and give warnings when problems are encountered. Likewise, -escape sequences are not yet recognized. +`a', `A', `e', `E', `f', `F', `g', `G', and `%'; it supports field +widths and precisions, and the flags `+', `-', ` ', `0', `#', and `''. +For integer specifiers, the width modifiers `hh', `h', and `l' are +recognized, and for floating point specifiers, the width modifier `l' +is recognized. Items not yet supported include positional arguments, +the `n', `p', `S', and `C' specifiers, the `z', `t', `j', `L' and `ll' +modifiers, and any platform extensions available in the native +`printf'. For more details on the functioning of `printf', see the C +Library Manual, or the POSIX specification (for example, `%a' is +supported even on platforms that haven't yet implemented C99 +hexadecimal floating point output natively). + + Unrecognized specifiers result in a warning. It is anticipated that +a future release of GNU `m4' will support more specifiers, and give +better warnings when various problems such as overflow are encountered. +Likewise, escape sequences are not yet recognized. + + format(`%p', `0') + error-->m4:stdin:1: Warning: unrecognized specifier in `%p' + =>  File: m4.info, Node: Arithmetic, Next: Shell commands, Prev: Text handling, Up: Top @@ -4308,6 +4479,12 @@ relation return `0'. eval(`-3 * 5') =>-15 + eval(`-99 / 10') + =>-9 + eval(`-99 % 10') + =>-9 + eval(`99 % -10') + =>9 eval(index(`Hello world', `llo') >= 0) =>1 eval(`0r1:0111 + 0b100 + 0r3:12') @@ -4321,7 +4498,7 @@ relation return `0'. define(`foo', `666') => eval(`foo / 6') - error-->m4:stdin:8: bad expression in eval: foo / 6 + error-->m4:stdin:11: bad expression in eval: foo / 6 => eval(foo / 6) =>111 @@ -4501,13 +4678,17 @@ Any shell command can be executed, using Note how the expansion of `syscmd' keeps the trailing newline of the command, as well as using the newline that appeared after the macro. - As an example of SHELL-COMMAND using the same standard input as -`m4', the command line `echo "m4wrap(\`syscmd(\`cat')')" | m4' will -tell `m4' to read all of its input before executing the wrapped text, -then hand a valid (albeit emptied) pipe as standard input for the `cat' -subcommand. Therefore, you should be careful when using standard input -(either by specifying no files, or by passing `-' as a file name on the -command line, *note Invoking m4: Command line files.), and also + The following is an example of SHELL-COMMAND using the same standard +input as `m4': + + $ echo "m4wrap(\`syscmd(\`cat')')" | m4 + => + + It tells `m4' to read all of its input before executing the wrapped +text, then hand a valid (albeit emptied) pipe as standard input for the +`cat' subcommand. Therefore, you should be careful when using standard +input (either by specifying no files, or by passing `-' as a file name +on the command line, *note Invoking m4: Command line files.), and also invoking subcommands via `syscmd' or `esyscmd' that consume data from standard input. When standard input is a seekable file, the subprocess will pick up with the next character not yet processed by `m4'; when it @@ -4658,6 +4839,7 @@ file, for output or for some other purpo output for the two file names, since the replacement characters are randomly chosen: + $ m4 maketemp(`/tmp/fooXXXXXX') =>/tmp/fooa07346 ifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))', @@ -4675,6 +4857,7 @@ generate multiple files. However, we re `mkstemp' macro, introduced in GNU M4 1.4.8, which is secure even in traditional mode. + $ m4 syscmd(`echo foo??????')dnl =>foo?????? define(`file1', maketemp(`fooXXXXXX'))dnl @@ -4771,11 +4954,12 @@ the file name. The syncline option (`-s Preprocessor features.), and the `f' and `l' flags of `debugmode' (*note Debug Levels::), also use this notion of current file and line. Redefining the three location macros has no effect on syncline, debug, -or warning message output. Assume this example is run in the -`m4-1.4.9/checks' directory of the GNU M4 package, using -`--include=../examples' in the command line to find the file `incl.m4' -mentioned earlier: +warning, or error message output. + + This example reuses the file `incl.m4' mentioned earlier (*note +Include::): + $ m4 -I examples define(`foo', ``$0' called at __file__:__line__') => foo @@ -4912,20 +5096,20 @@ File: m4.info, Node: Using frozen files Suppose a user has a library of `m4' initializations in `base.m4', which is then used with multiple input files: - m4 base.m4 input1.m4 - m4 base.m4 input2.m4 - m4 base.m4 input3.m4 + $ m4 base.m4 input1.m4 + $ m4 base.m4 input2.m4 + $ m4 base.m4 input3.m4 Rather than spending time parsing the fixed contents of `base.m4' every time, the user might rather execute: - m4 -F base.m4f base.m4 + $ m4 -F base.m4f base.m4 once, and further execute, as often as needed: - m4 -R base.m4f input1.m4 - m4 -R base.m4f input2.m4 - m4 -R base.m4f input3.m4 + $ m4 -R base.m4f input1.m4 + $ m4 -R base.m4f input2.m4 + $ m4 -R base.m4f input3.m4 with the varying input. The first call, containing the `-F' option, only reads and executes file `base.m4', defining various application @@ -4948,15 +5132,15 @@ However, frozen files may be updated inc and `-F' options simultaneously. For example, if some care is taken, the command: - m4 file1.m4 file2.m4 file3.m4 file4.m4 + $ m4 file1.m4 file2.m4 file3.m4 file4.m4 could be broken down in the following sequence, accumulating the same output: - m4 -F file1.m4f file1.m4 - m4 -R file1.m4f -F file2.m4f file2.m4 - m4 -R file2.m4f -F file3.m4f file3.m4 - m4 -R file3.m4f file4.m4 + $ m4 -F file1.m4f file1.m4 + $ m4 -R file1.m4f -F file2.m4f file2.m4 + $ m4 -R file2.m4f -F file3.m4f file3.m4 + $ m4 -R file3.m4f file4.m4 Some care is necessary because not every effort has been made for this to work in all cases. In particular, the trace attribute of @@ -5041,7 +5225,7 @@ characters. The directives are: the same name, and its order, along with `F', is important. `V NUMBER ' - Confirms the format of the file. `m4' 1.4.9 only creates and + Confirms the format of the file. `m4' 1.4.10 only creates and understands frozen files where NUMBER is 1. This directive must be the first non-comment in the file, and may not appear more than once. @@ -5192,7 +5376,7 @@ behaviors is non-portable, as a future r all arguments, with output separated by spaces. However, it is possible to emulate POSIX behavior by including the - file `m4-1.4.9/examples/wrapfifo.m4' from the distribution: + file `m4-1.4.10/examples/wrapfifo.m4' from the distribution: undivert(`wrapfifo.m4')dnl =>dnl Redefine m4wrap to have FIFO semantics. @@ -5336,7 +5520,26 @@ There are a few other incompatibilities The sync line option is used mostly when using `m4' as a front end to a compiler. If a diverted line causes a compiler error, the error messages should most probably refer to the place where the - diversion were made, and not where it was inserted again. + diversion was made, and not where it was inserted again. + + divert(2)2 + divert(1)1 + divert`'0 + =>#line 3 "stdin" + =>0 + ^D + =>#line 2 "stdin" + =>1 + =>#line 1 "stdin" + =>2 + + The current `m4' implementation has a limitation that the syncline + output at the start of each diversion occurs no matter what, even + if the previous diversion did not end with a newline. This goes + contrary to the claim that synclines appear on a line by + themselves, so this limitation may be corrected in a future + version of `m4'. In the meantime, when using `-s', it is wisest + to make sure all diversions end with newline. * GNU `m4' makes no attempt at prohibiting self-referential definitions like: @@ -5361,7 +5564,7 @@ There are a few other incompatibilities endless loops in traditional programming languages.  -File: m4.info, Node: Answers, Next: Copying This Manual, Prev: Compatibility, Up: Top +File: m4.info, Node: Answers, Next: Copying This Package, Prev: Compatibility, Up: Top 17 Correct version of some examples *********************************** @@ -5407,10 +5610,11 @@ The `forloop' macro (*note Forloop::) as an infinite loop if given an iterator that is not parsed as a macro name. It does not do any sanity checking on its numeric bounds, and only permits decimal numbers for bounds. Here is an improved version, -shipped as `m4-1.4.9/examples/forloop2.m4'; this version also optimizes -based on the fact that the starting bound does not need to be passed to -the helper `_forloop'. +shipped as `m4-1.4.10/examples/forloop2.m4'; this version also +optimizes based on the fact that the starting bound does not need to be +passed to the helper `_forloop'. + $ m4 -I examples undivert(`forloop2.m4')dnl =>divert(`-1') =># forloop(var, from, to, stmt) - improved version: @@ -5451,6 +5655,7 @@ The `foreach' and `foreachq' macros (*no earlier each have flaws. First, we will examine and fix the quadratic behavior of `foreachq': + $ m4 -I examples include(`foreachq.m4') => traceon(`shift')debugmode(`aq') @@ -5485,8 +5690,9 @@ recursion use fewer arguments, rather th uses of `shift'. By doing so, `m4' uses less memory, invokes fewer macros, is less likely to run into machine limits, and most importantly, performs faster. The fixed version of `foreachq' can be -found in `m4-1.4.9/examples/foreachq2.m4': +found in `m4-1.4.10/examples/foreachq2.m4': + $ m4 -I examples include(`foreachq2.m4') => undivert(`foreachq2.m4')dnl @@ -5520,11 +5726,12 @@ Contrast the use of `_arg1q', which quot element directly. For a different approach, the improved version of `foreach', -available in `m4-1.4.9/examples/foreach2.m4', simply overquotes the +available in `m4-1.4.10/examples/foreach2.m4', simply overquotes the arguments to `_foreach' to begin with, using `dquote_elt'. Then `_foreach' can just use `_arg1' to remove the extra layer of quoting that was added up front: + $ m4 -I examples include(`foreach2.m4') => undivert(`foreach2.m4')dnl @@ -5566,6 +5773,7 @@ list elements twice while visiting the f one must take into account whether repeating the side effects of unquoted list elements will have any detrimental effects. + $ m4 -I examples include(`foreach2.m4') => include(`foreachq2.m4') @@ -5695,11 +5903,753 @@ series, a better implementation would be error-->m4:stdin:6: fatal error: inside wrapped text  -File: m4.info, Node: Copying This Manual, Next: Indices, Prev: Answers, Up: Top +File: m4.info, Node: Copying This Package, Next: Copying This Manual, Prev: Answers, Up: Top + +Appendix A How to make copies of the overall M4 package +******************************************************* + +This appendix covers the license for copying the source code of the +overall M4 package. This manual is under a different set of +restrictions, covered later (*note Copying This Manual::). + +* Menu: + +* Copying:: GNU General Public License + + +File: m4.info, Node: Copying, Up: Copying This Package + +A.1 GNU General Public License +============================== + + Version 3, 29 June 2007 -Appendix A How to make copies of this manual + 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'. + + +File: m4.info, Node: Copying This Manual, Next: Indices, Prev: Copying This Package, Up: Top + +Appendix B How to make copies of this manual ******************************************** +This appendix covers the license for copying this manual. Note that +some of the longer examples in this manual are also distributed in the +directory `m4-1.4.10/examples/', where a more permissive license is in +effect when copying just the examples. + * Menu: * GNU Free Documentation License:: License for copying this manual @@ -5707,7 +6657,7 @@ Appendix A How to make copies of this ma  File: m4.info, Node: GNU Free Documentation License, Up: Copying This Manual -A.1 GNU Free Documentation License +B.1 GNU Free Documentation License ================================== Version 1.2, November 2002 @@ -6139,7 +7089,7 @@ permit their use in free software.  File: m4.info, Node: Indices, Prev: Copying This Manual, Up: Top -Appendix B Indices of concepts and macros +Appendix C Indices of concepts and macros ***************************************** * Menu: @@ -6150,7 +7100,7 @@ Appendix B Indices of concepts and macro  File: m4.info, Node: Macro index, Next: Concept index, Up: Indices -B.1 Index for all `m4' macros +C.1 Index for all `m4' macros ============================= This index covers all `m4' builtins, as well as several useful @@ -6167,7 +7117,7 @@ macro is introduced the first time. * __program__: Location. (line 12) * __unix__: Platform macros. (line 15) * __windows__: Platform macros. (line 17) -* argn: Shift. (line 110) +* argn: Shift. (line 112) * array: Define. (line 56) * array_set: Define. (line 57) * builtin: Builtin. (line 9) @@ -6191,7 +7141,7 @@ macro is introduced the first time. * errprint: Errprint. (line 9) * esyscmd: Esyscmd. (line 9) * eval: Eval. (line 9) -* example: Manual. (line 32) +* example: Manual. (line 40) * exch: Arguments. (line 13) * fatal_error: M4exit. (line 25) * foreach: Foreach. (line 9) @@ -6234,7 +7184,7 @@ macro is introduced the first time.  File: m4.info, Node: Concept index, Prev: Macro index, Up: Indices -B.2 Index for many concepts +C.2 Index for many concepts =========================== [index] @@ -6244,16 +7194,16 @@ B.2 Index for many concepts * arguments to macros: Arguments. (line 6) * arguments to macros, special: Pseudo Arguments. (line 6) * arguments, more than nine <1>: Arguments. (line 54) -* arguments, more than nine: Shift. (line 104) +* arguments, more than nine: Shift. (line 106) * arguments, quoted macro: Quoting Arguments. (line 6) * arithmetic: Arithmetic. (line 6) * arrays: Define. (line 52) -* avoiding quadratic behavior: Improved foreach. (line 37) -* basic regular expressions <1>: Regexp. (line 6) -* basic regular expressions: Patsubst. (line 6) -* blind macro <1>: Ifelse. (line 52) -* blind macro: Inhibiting Invocation. +* avoiding quadratic behavior: Improved foreach. (line 38) +* basic regular expressions <1>: Patsubst. (line 6) +* basic regular expressions: Regexp. (line 6) +* blind macro <1>: Inhibiting Invocation. (line 14) +* blind macro: Ifelse. (line 52) * bug reports: Bugs. (line 6) * builtins, indirect call of: Builtin. (line 6) * builtins, special tokens: Defn. (line 79) @@ -6291,12 +7241,12 @@ B.2 Index for many concepts * definitions, displaying macro: Defn. (line 6) * deleting macros: Undefine. (line 6) * deleting whitespace in input: Dnl. (line 6) -* delimiters, changing <1>: Changecom. (line 6) -* delimiters, changing: Changequote. (line 6) +* delimiters, changing <1>: Changequote. (line 6) +* delimiters, changing: Changecom. (line 6) * discarding diverted text: Cleardivert. (line 6) -* discarding input <1>: Ifelse. (line 6) -* discarding input <2>: Divert. (line 42) -* discarding input: Dnl. (line 6) +* discarding input <1>: Dnl. (line 6) +* discarding input <2>: Ifelse. (line 6) +* discarding input: Divert. (line 42) * displaying macro definitions: Dumpdef. (line 6) * diversion numbers: Divnum. (line 6) * diverted text, discarding: Cleardivert. (line 6) @@ -6321,8 +7271,8 @@ B.2 Index for many concepts * FDL, GNU Free Documentation License: GNU Free Documentation License. (line 6) * file format, frozen file: Frozen file format. (line 6) -* file inclusion <1>: Undivert. (line 13) -* file inclusion: File Inclusion. (line 6) +* file inclusion <1>: File Inclusion. (line 6) +* file inclusion: Undivert. (line 13) * file names, on the command line: Command line files. (line 6) * files, diverting output to: Divert. (line 6) * files, names of temporary: Mkstemp. (line 6) @@ -6331,25 +7281,26 @@ B.2 Index for many concepts * formatted output: Format. (line 6) * frozen file format: Frozen file format. (line 6) * frozen files for fast loading: Using frozen files. (line 6) -* GNU extensions <1>: Mkstemp. (line 55) -* GNU extensions <2>: Divert. (line 54) -* GNU extensions <3>: Undivert. (line 81) -* GNU extensions <4>: Patsubst. (line 6) -* GNU extensions <5>: Inhibiting Invocation. +* GNU extensions <1>: Inhibiting Invocation. (line 14) -* GNU extensions <6>: Builtin. (line 6) -* GNU extensions <7>: Esyscmd. (line 6) -* GNU extensions <8>: Eval. (line 125) -* GNU extensions <9>: Extensions. (line 6) -* GNU extensions <10>: Debug Output. (line 6) -* GNU extensions <11>: Arguments. (line 54) -* GNU extensions <12>: Format. (line 6) -* GNU extensions <13>: Debug Levels. (line 71) -* GNU extensions <14>: Search Path. (line 6) -* GNU extensions <15>: Indir. (line 6) -* GNU extensions <16>: Define. (line 41) -* GNU extensions <17>: Using frozen files. (line 6) -* GNU extensions: Regexp. (line 6) +* GNU extensions <2>: Search Path. (line 6) +* GNU extensions <3>: Divert. (line 54) +* GNU extensions <4>: Undivert. (line 13) +* GNU extensions <5>: Esyscmd. (line 6) +* GNU extensions <6>: Regexp. (line 6) +* GNU extensions <7>: Builtin. (line 6) +* GNU extensions <8>: Using frozen files. (line 6) +* GNU extensions <9>: Debug Output. (line 6) +* GNU extensions <10>: Define. (line 41) +* GNU extensions <11>: Debug Levels. (line 71) +* GNU extensions <12>: Eval. (line 125) +* GNU extensions <13>: Patsubst. (line 6) +* GNU extensions <14>: Mkstemp. (line 56) +* GNU extensions <15>: Undivert. (line 81) +* GNU extensions <16>: Format. (line 6) +* GNU extensions <17>: Extensions. (line 6) +* GNU extensions <18>: Arguments. (line 54) +* GNU extensions: Indir. (line 6) * GNU M4, history of: History. (line 6) * history of m4: History. (line 6) * included files, search path for: Search Path. (line 6) @@ -6359,9 +7310,9 @@ B.2 Index for many concepts * indirect call of builtins: Builtin. (line 6) * indirect call of macros: Indir. (line 6) * initialization, frozen state: Using frozen files. (line 6) -* input location <1>: Preprocessor features. +* input location <1>: Location. (line 6) +* input location: Preprocessor features. (line 28) -* input location: Location. (line 6) * input tokens: Syntax. (line 6) * input, discarding <1>: Divert. (line 42) * input, discarding <2>: Ifelse. (line 6) @@ -6374,13 +7325,15 @@ B.2 Index for many concepts * iterating over lists: Foreach. (line 6) * length of strings: Len. (line 6) * lexical structure of words: Changeword. (line 6) -* License: Copying This Manual. (line 6) +* License, code: Copying This Package. + (line 6) +* License, manual: Copying This Manual. (line 6) * limit, nesting: Limits control. (line 27) * literal output: Pseudo Arguments. (line 106) * local variables: Pushdef. (line 79) -* location, input <1>: Location. (line 6) -* location, input: Preprocessor features. +* location, input <1>: Preprocessor features. (line 28) +* location, input: Location. (line 6) * loops: Shift. (line 10) * loops, counting: Forloop. (line 6) * loops, list iteration: Foreach. (line 6) @@ -6395,8 +7348,8 @@ B.2 Index for many concepts * macros, arguments to <1>: Macro Arguments. (line 6) * macros, arguments to: Arguments. (line 6) * macros, debugging: Debugging. (line 6) -* macros, displaying definitions <1>: Dumpdef. (line 6) -* macros, displaying definitions: Defn. (line 6) +* macros, displaying definitions <1>: Defn. (line 6) +* macros, displaying definitions: Dumpdef. (line 6) * macros, expansion of: Macro expansion. (line 6) * macros, how to define new: Definitions. (line 6) * macros, how to delete: Undefine. (line 6) @@ -6408,13 +7361,13 @@ B.2 Index for many concepts * macros, temporary redefinition of: Pushdef. (line 6) * messages, printing error: Errprint. (line 6) * more than nine arguments <1>: Arguments. (line 54) -* more than nine arguments: Shift. (line 104) +* more than nine arguments: Shift. (line 106) * multibranches: Ifelse. (line 66) * names: Names. (line 6) * nesting limit: Limits control. (line 27) -* nine arguments, more than <1>: Shift. (line 104) +* nine arguments, more than <1>: Shift. (line 106) * nine arguments, more than: Arguments. (line 54) -* numbers: Manual. (line 49) +* numbers: Manual. (line 57) * options, command line: Invoking m4. (line 10) * output, diverting to files: Divert. (line 6) * output, formatted: Format. (line 6) @@ -6429,7 +7382,7 @@ B.2 Index for many concepts * preprocessor features: Preprocessor features. (line 6) * printing error messages: Errprint. (line 6) -* quadratic behavior, avoiding: Improved foreach. (line 37) +* quadratic behavior, avoiding: Improved foreach. (line 38) * quote delimiters, changing: Changequote. (line 6) * quoted macro arguments: Quoting Arguments. (line 6) * quoted string: Quoted strings. (line 6) @@ -6442,13 +7395,13 @@ B.2 Index for many concepts * reloading a frozen file: Using frozen files. (line 6) * renaming macros: Defn. (line 6) * reporting bugs: Bugs. (line 6) -* rescanning <1>: Other Incompatibilities. - (line 33) -* rescanning <2>: Pseudo Arguments. (line 106) -* rescanning <3>: Inhibiting Invocation. - (line 76) -* rescanning <4>: Limits control. (line 40) -* rescanning: Defn. (line 59) +* rescanning <1>: Pseudo Arguments. (line 106) +* rescanning <2>: Defn. (line 59) +* rescanning <3>: Other Incompatibilities. + (line 52) +* rescanning <4>: Inhibiting Invocation. + (line 87) +* rescanning: Limits control. (line 40) * rule of thumb, quoting: Quoting Arguments. (line 22) * running shell commands: Shell commands. (line 6) * saving debugging output: Debug Output. (line 6) @@ -6458,9 +7411,9 @@ B.2 Index for many concepts * shell commands, running: Shell commands. (line 6) * special arguments to macros: Pseudo Arguments. (line 6) * stack, macro definition: Pushdef. (line 6) -* standard error, output to <1>: Dumpdef. (line 6) +* standard error, output to <1>: Trace. (line 6) * standard error, output to <2>: Errprint. (line 6) -* standard error, output to: Trace. (line 6) +* standard error, output to: Dumpdef. (line 6) * status of shell commands: Sysval. (line 6) * status, setting m4 exit: M4exit. (line 6) * string, quoted: Quoted strings. (line 6) @@ -6493,104 +7446,106 @@ B.2 Index for many concepts  Tag Table: -Node: Top843 -Node: Preliminaries9202 -Node: Intro9888 -Node: History11520 -Node: Bugs14233 -Node: Manual15484 -Node: Invoking m418470 -Node: Operation modes20618 -Node: Preprocessor features23590 -Node: Limits control26054 -Node: Frozen state28990 -Node: Debugging options29789 -Node: Command line files31528 -Node: Syntax32891 -Node: Names34000 -Node: Quoted strings34462 -Node: Comments35111 -Node: Other tokens35978 -Node: Input processing36556 -Ref: Input processing-Footnote-144229 -Node: Macros44424 -Node: Invocation44918 -Node: Inhibiting Invocation45719 -Node: Macro Arguments49668 -Node: Quoting Arguments52360 -Node: Macro expansion54483 -Node: Definitions55151 -Node: Define55936 -Node: Arguments58374 -Node: Pseudo Arguments62046 -Node: Undefine65588 -Node: Defn66718 -Node: Pushdef69451 -Node: Indir72077 -Node: Builtin74179 -Node: Conditionals75941 -Node: Ifdef76760 -Node: Ifelse77623 -Node: Shift80836 -Node: Forloop85291 -Node: Foreach87860 -Node: Debugging92839 -Node: Dumpdef93424 -Node: Trace94808 -Node: Debug Levels97511 -Node: Debug Output100971 -Node: Input Control102242 -Node: Dnl102779 -Node: Changequote104680 -Node: Changecom109476 -Node: Changeword112992 -Node: M4wrap118433 -Node: File Inclusion120694 -Node: Include121011 -Node: Search Path123611 -Node: Diversions124528 -Node: Divert126319 -Node: Undivert128845 -Node: Divnum131727 -Node: Cleardivert132191 -Node: Text handling133396 -Node: Len134119 -Node: Index macro134504 -Node: Regexp135275 -Node: Substr137695 -Node: Translit138746 -Node: Patsubst141468 -Node: Format145009 -Node: Arithmetic147108 -Node: Incr147557 -Node: Eval148332 -Node: Shell commands156199 -Node: Platform macros157121 -Node: Syscmd158865 -Node: Esyscmd160670 -Node: Sysval161718 -Node: Mkstemp163336 -Node: Miscellaneous166733 -Node: Errprint167166 -Node: Location168385 -Node: M4exit171187 -Node: Frozen files173274 -Node: Using frozen files174055 -Node: Frozen file format177295 -Node: Compatibility180358 -Node: Extensions180973 -Node: Incompatibilities184795 -Node: Other Incompatibilities193002 -Node: Answers194985 -Node: Improved exch195602 -Node: Improved forloop196140 -Node: Improved foreach197976 -Node: Improved cleardivert204915 -Node: Improved fatal_error205898 -Node: Copying This Manual206960 -Node: GNU Free Documentation License207216 -Node: Indices229610 -Node: Macro index229890 -Node: Concept index235324 +Node: Top851 +Node: Preliminaries9359 +Node: Intro10045 +Node: History11677 +Node: Bugs14401 +Node: Manual15652 +Node: Invoking m419050 +Node: Operation modes21198 +Node: Preprocessor features24170 +Node: Limits control27267 +Node: Frozen state30203 +Node: Debugging options31002 +Node: Command line files32741 +Node: Syntax34314 +Node: Names35433 +Node: Quoted strings35895 +Node: Comments36544 +Node: Other tokens37421 +Node: Input processing37999 +Ref: Input processing-Footnote-145672 +Node: Macros45867 +Node: Invocation46361 +Node: Inhibiting Invocation47162 +Node: Macro Arguments51242 +Node: Quoting Arguments54304 +Node: Macro expansion56427 +Node: Definitions57128 +Node: Define57913 +Node: Arguments60351 +Node: Pseudo Arguments64023 +Node: Undefine67565 +Node: Defn68695 +Node: Pushdef71428 +Node: Indir74054 +Node: Builtin76182 +Node: Conditionals78203 +Node: Ifdef79022 +Node: Ifelse79885 +Node: Shift83098 +Node: Forloop87598 +Node: Foreach90234 +Node: Debugging95325 +Node: Dumpdef95910 +Node: Trace97320 +Node: Debug Levels100540 +Node: Debug Output104010 +Node: Input Control105291 +Node: Dnl105828 +Node: Changequote107729 +Node: Changecom112525 +Node: Changeword116041 +Node: M4wrap121482 +Node: File Inclusion123743 +Node: Include124060 +Node: Search Path126740 +Node: Diversions127657 +Node: Divert129448 +Node: Undivert131974 +Node: Divnum135138 +Node: Cleardivert135602 +Node: Text handling136807 +Node: Len137530 +Node: Index macro137915 +Node: Regexp138686 +Node: Substr141106 +Node: Translit142157 +Node: Patsubst144879 +Node: Format148420 +Node: Arithmetic151574 +Node: Incr152023 +Node: Eval152798 +Node: Shell commands160761 +Node: Platform macros161683 +Node: Syscmd163427 +Node: Esyscmd165246 +Node: Sysval166294 +Node: Mkstemp167912 +Node: Miscellaneous171329 +Node: Errprint171762 +Node: Location172981 +Node: M4exit175710 +Node: Frozen files177797 +Node: Using frozen files178578 +Node: Frozen file format181842 +Node: Compatibility184906 +Node: Extensions185521 +Node: Incompatibilities189343 +Node: Other Incompatibilities197551 +Node: Answers200197 +Node: Improved exch200815 +Node: Improved forloop201353 +Node: Improved foreach203212 +Node: Improved cleardivert210241 +Node: Improved fatal_error211224 +Node: Copying This Package212286 +Node: Copying212757 +Node: Copying This Manual250280 +Node: GNU Free Documentation License250800 +Node: Indices273194 +Node: Macro index273474 +Node: Concept index278908  End Tag Table diff -ruNp m4-1.4.9/doc/m4.texinfo m4-1.4.10/doc/m4.texinfo --- m4-1.4.9/doc/m4.texinfo 2007-03-23 06:40:02.000000000 -0600 +++ m4-1.4.10/doc/m4.texinfo 2007-07-04 21:56:03.000000000 -0600 @@ -55,7 +55,7 @@ entitled ``@acronym{GNU} Free Documentat @end quotation @end copying -@dircategory GNU programming tools +@dircategory Text creation and manipulation @direntry * M4: (m4). A powerful macro processor. @end direntry @@ -137,6 +137,7 @@ changeword will go away and @emph{you sh * Compatibility:: Compatibility with other versions of @code{m4} * Answers:: Correct version of some examples +* Copying This Package:: How to make copies of the overall M4 package * Copying This Manual:: How to make copies of this manual * Indices:: Indices of concepts and macros @@ -270,8 +271,9 @@ Correct version of some examples * Improved cleardivert:: Solution for @code{cleardivert} * Improved fatal_error:: Solution for @code{fatal_error} -How to make copies of this manual +How to make copies of this package or manual +* Copying:: GNU General Public License * GNU Free Documentation License:: License for copying this manual Indices of concepts and macros @@ -385,8 +387,8 @@ addressed some long standing bugs in the @acronym{GNU} @code{m4} 1.4 that were floating around the net and released 1.4.3 and 1.4.4. And in 2006, Eric Blake joined the team and prepared patches for the release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8. The -1.4.x series remains open for bug fixes, including release 1.4.9 in -2007. +1.4.x series remains open for bug fixes, including release 1.4.9 and +1.4.10 in 2007. Meanwhile, development has continued on new features for @code{m4}, such as dynamic module loading and additional builtins. When complete, @@ -437,10 +439,14 @@ This is an example of an example! To distinguish input from output, all output from @code{m4} is prefixed by the string @samp{@result{}}, and all error messages by the string -@samp{@error{}}. Thus +@samp{@error{}}. When showing how command line options affect matters, +the command line is shown with a prompt @samp{$ @kbd{like this}}, +otherwise, you can assume that a simple @kbd{m4} invocation will work. +Thus: @comment ignore @example +$ @kbd{command line to invoke m4} Example of input line @result{}Output line from m4 @error{}and an error message @@ -451,7 +457,14 @@ file. The sequence @samp{@key{NL}} refe The majority of these examples are self-contained, and you can run them with similar results by invoking @kbd{m4 -d}. In fact, the testsuite that is bundled in the @acronym{GNU} M4 package consists of the examples -in this document! +in this document! Some of the examples assume that your current +directory is located where you unpacked the installation, so if you plan +on following along, you may find it helpful to do this now: + +@comment ignore +@example +$ @kbd{cd m4-@value{VERSION}} +@end example As each of the predefined macros in @code{m4} is described, a prototype call of the macro will be shown, giving descriptive names to the @@ -664,7 +677,42 @@ the file name did not change from the pr Synchronization directives are always given on complete lines by themselves. When a synchronization discrepancy occurs in the middle of an output line, the associated synchronization directive is delayed -until the beginning of the next generated line. +until the next newline that does not occur in the middle of a quoted +string or comment. + +@comment options: -s +@example +define(`twoline', `1 +2') +@result{}#line 2 "stdin" +@result{} +changecom(`/*', `*/') +@result{} +define(`comment', `/*1 +2*/') +@result{}#line 5 +@result{} +dnl no line +hello +@result{}#line 7 +@result{}hello +twoline +@result{}1 +@result{}#line 8 +@result{}2 +comment +@result{}/*1 +@result{}2*/ +one comment `two +three' +@result{}#line 10 +@result{}one /*1 +@result{}2*/ two +@result{}three +goodbye +@result{}#line 12 +@result{}goodbye +@end example @item -U @var{NAME} @itemx --undefine=@var{NAME} @@ -824,7 +872,24 @@ string. The options @option{--define} (@option{-D}), @option{--undefine} (@option{-U}), @option{--synclines} (@option{-s}), and @option{--trace} (@option{-t}) only take effect after processing input from any file -names that occur earlier on the command line. +names that occur earlier on the command line. For example, assume the +file @file{foo} contains: + +@comment ignore +@example +$ @kbd{cat foo} +bar +@end example + +The text @samp{bar} can then be redefined over multiple uses of +@file{foo}: + +@comment options: -Dbar=hello foo -Dbar=world foo +@example +$ @kbd{m4 -Dbar=hello foo -Dbar=world foo} +@result{}hello +@result{}world +@end example If none of the input files invoked @code{m4exit} (@pxref{M4exit}), the exit status of @code{m4} will be 0 for success, 1 for general failure @@ -844,7 +909,7 @@ As @code{m4} reads its input, it separat token is either a name, a quoted string, or any single character, that is not a part of either a name or a string. Input to @code{m4} can also contain comments. @acronym{GNU} @code{m4} does not yet understand -locales; all operations are byte-oriented rather than +multibyte locales; all operations are byte-oriented rather than character-oriented (although if your locale uses a single byte encoding, such as @sc{ISO-8859-1}, you will not notice a difference). However, @code{m4} is eight-bit clean, so you can @@ -916,6 +981,7 @@ the comment. The commenting effect of t can be inhibited by quoting it. @example +$ @kbd{m4} `quoted text' # `commented text' @result{}quoted text # `commented text' `quoting inhibits' `#' `comments' @@ -1202,6 +1268,7 @@ implementations simply invoke the builti empty argument instead. @example +$ @kbd{m4} eval @result{}eval eval(`1') @@ -1215,6 +1282,19 @@ no effect whatsoever on user defined mac one has to write @code{m4_dnl} and even @code{m4_m4exit}. It also has no effect on whether a macro requires parameters. +@comment options: -P +@example +$ @kbd{m4 -P} +eval +@result{}eval +eval(`1') +@result{}eval(1) +m4_eval +@result{}m4_eval +m4_eval(`1') +@result{}1 +@end example + Another alternative is to redefine problematic macros to a name less likely to cause conflicts, @xref{Definitions}. @@ -1349,6 +1429,29 @@ the @option{--quiet} command line option @option{-Q}, @pxref{Operation modes, , Invoking m4}). For user defined macros, there is no check of the number of arguments given. +@example +$ @kbd{m4} +index(`abc') +@error{}m4:stdin:1: Warning: too few arguments to builtin `index' +@result{}0 +index(`abc',) +@result{}0 +index(`abc', `b', `ignored') +@error{}m4:stdin:3: Warning: excess arguments to builtin `index' ignored +@result{}1 +@end example + +@comment options: -Q +@example +$ @kbd{m4 -Q} +index(`abc') +@result{}0 +index(`abc',) +@result{}0 +index(`abc', `b', `ignored') +@result{}1 +@end example + Macros are expanded normally during argument collection, and whatever commas, quotes and parentheses that might show up in the resulting expanded text will serve to define the arguments as well. Thus, if @@ -1465,16 +1568,18 @@ therefore result in more macros being ca completely or partially, in the first macro calls' expansion. Taking a very simple example, if @var{foo} expands to @samp{bar}, and -@var{bar} expands to @samp{Hello world}, the input +@var{bar} expands to @samp{Hello}, the input -@comment ignore +@comment options: -Dbar=Hello -Dfoo=bar @example +$ @kbd{m4 -Dbar=Hello -Dfoo=bar} foo +@result{}Hello @end example @noindent will expand first to @samp{bar}, and when this is reread and -expanded, into @samp{Hello world}. +expanded, into @samp{Hello}. @node Definitions @chapter How to define new macros @@ -2148,6 +2253,7 @@ where the definition that was in effect used. @example +$ @kbd{m4 -d} define(`f', `1') @result{} f(define(`f', `2')) @@ -2165,6 +2271,7 @@ token representing a builtin is recogniz string. @example +$ @kbd{m4 -d} indir(defn(`defn'), `divnum') @error{}m4:stdin:1: Warning: indir: invalid macro name ignored @result{} @@ -2233,6 +2340,21 @@ even when the @option{--prefix-builtins} @pxref{Operation modes, , Invoking m4}) is in effect. This is different from @code{indir}, which only tracks current macro names. +@comment options: -P +@example +$ @kbd{m4 -P} +m4_builtin(`divnum') +@result{}0 +m4_builtin(`m4_divnum') +@error{}m4:stdin:2: undefined builtin `m4_divnum' +@result{} +m4_indir(`divnum') +@error{}m4:stdin:3: undefined macro `divnum' +@result{} +m4_indir(`m4_divnum') +@result{}0 +@end example + Note that @code{indir} and @code{builtin} can be used to invoke builtins without arguments, even when they normally require parameters to be recognized; but it will provoke a warning, and result in a void expansion. @@ -2473,6 +2595,7 @@ An actual implementation of these three let's examine their usage: @example +$ @kbd{m4 -I examples} include(`quote.m4') @result{} -quote-dquote-dquote_elt- @@ -2504,6 +2627,7 @@ possible to tell whether it was invoked resulting string. @example +$ @kbd{m4 -I examples} undivert(`quote.m4')dnl @result{}divert(`-1') @result{}# quote(args) - convert args to single-quoted string @@ -2564,6 +2688,7 @@ invocation is restored. It can, for example, be used for simple counting: @example +$ @kbd{m4 -I examples} include(`forloop.m4') @result{} forloop(`i', `1', `8', `i ') @@ -2573,6 +2698,7 @@ forloop(`i', `1', `8', `i ') For-loops can be nested, like: @example +$ @kbd{m4 -I examples} include(`forloop.m4') @result{} forloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)') @@ -2599,6 +2725,7 @@ Here is an actual implementation of @cod @file{m4-@value{VERSION}/@/examples/@/forloop.m4} in this package: @example +$ @kbd{m4 -I examples} undivert(`forloop.m4')dnl @result{}divert(`-1') @result{}# forloop(var, from, to, stmt) - simple version @@ -2644,6 +2771,7 @@ using an implementation of @code{foreach in @file{m4-@value{VERSION}/@/examples/@/foreachq.m4}. @example +$ @kbd{m4 -I examples} include(`foreach.m4') @result{} foreach(`x', (foo, bar, foobar), `Word was: x @@ -2665,6 +2793,7 @@ or @var{quote-list} can itself be a list to a helper macro. This example generates a shell case statement: @example +$ @kbd{m4 -I examples} include(`foreach.m4') @result{} define(`_case', ` $1) @@ -2693,6 +2822,7 @@ through the original list. Here is a si @code{foreach}: @example +$ @kbd{m4 -I examples} undivert(`foreach.m4')dnl @result{}divert(`-1') @result{}# foreach(x, (item_1, item_2, ..., item_n), stmt) @@ -2718,6 +2848,7 @@ during list iteration and the final laye rescan: @example +$ @kbd{m4 -I examples} define(`a', `1')define(`b', `2')define(`c', `3') @result{} include(`foreach.m4') @@ -2741,6 +2872,7 @@ foreachq(`x', ```a'', ``(b'', ``c)''', ` Obviously, @code{foreachq} did a better job; here is its implementation: @example +$ @kbd{m4 -I examples} undivert(`foreachq.m4')dnl @result{}include(`quote.m4')dnl @result{}divert(`-1') @@ -2803,6 +2935,7 @@ The expansion of @code{dumpdef} is void. @end deffn @example +$ @kbd{m4 -d} define(`foo', `Hello world.') @result{} dumpdef(`foo') @@ -2819,6 +2952,7 @@ macro were to be called at that point, e still live due to redefining a macro during argument collection. @example +$ @kbd{m4 -d} pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') @result{} f(popdef(`f')dumpdef(`f')) @@ -2861,6 +2995,7 @@ to the current debug file (defaulting to Output}). @example +$ @kbd{m4 -d} define(`foo', `Hello World.') @result{} define(`echo', `$@@') @@ -2879,13 +3014,33 @@ The number between dashes is the depth o of the time, signifying an expansion at the outermost level, but it increases when macro arguments contain unquoted macro calls. The maximum number that will appear between dashes is controlled by the -option @option{--nesting-limit} (@pxref{Limits control, , Invoking m4}). +option @option{--nesting-limit} (or @option{-L}, @pxref{Limits control, +, Invoking m4}). Additionally, the option @option{--trace} (or +@option{-t}) can be used to invoke @code{traceon(@var{name})} before +parsing input. + +@comment options: -dp -L3 -tifelse +@comment status: 1 +@example +$ @kbd{m4 -L 3 -t ifelse} +ifelse(`one level') +@error{}m4trace: -1- ifelse +@result{} +ifelse(ifelse(ifelse(`three levels'))) +@error{}m4trace: -3- ifelse +@error{}m4trace: -2- ifelse +@error{}m4trace: -1- ifelse +@result{} +ifelse(ifelse(ifelse(ifelse(`four levels')))) +@error{}m4:stdin:3: recursion limit of 3 exceeded, use -L to change it +@end example Tracing by name is an attribute that is preserved whether the macro is -defined or not. This allows the @option{-t} option to select macros to -trace before those macros are defined. +defined or not. This allows the selection of macros to trace before +those macros are defined. @example +$ @kbd{m4 -d} traceoff(`foo') @result{} traceon(`foo') @@ -2919,6 +3074,7 @@ Tracing even works on builtins. However does not transfer tracing status. @example +$ @kbd{m4 -d} traceon(`eval', `m4_divnum') @result{} define(`m4_eval', defn(`eval')) @@ -3025,7 +3181,9 @@ are reset to the default of @samp{aeq}. The expansion of @code{debugmode} is void. @end deffn +@comment options: -dp @example +$ @kbd{m4} define(`foo', `FOO') @result{} traceon(`foo') @@ -3071,6 +3229,7 @@ The expansion of @code{debugfile} is voi @end deffn @example +$ @kbd{m4} traceon(`divnum') @result{} divnum(`extra') @@ -3878,9 +4037,10 @@ contains the lines: @comment ignore @example -Include file start -foo -Include file end +$ @kbd{cat examples/incl.m4} +@result{}Include file start +@result{}foo +@result{}Include file end @end example Normally file inclusion is used to insert the contents of a file @@ -3888,6 +4048,7 @@ into the input stream. The contents of @code{m4} and macro calls in the file will be expanded: @example +$ @kbd{m4 -I examples} define(`foo', `FOO') @result{} include(`incl.m4') @@ -3903,6 +4064,7 @@ Here is an example, which defines @samp{ of @file{incl.m4}: @example +$ @kbd{m4 -I examples} define(`bar', include(`incl.m4')) @result{} This is `bar': >>bar<< @@ -4241,11 +4403,19 @@ divert`'undivert`'dnl @cindex file inclusion @cindex inclusion, of files @acronym{GNU} @code{m4} allows named files to be undiverted. Given a -non-numeric -argument, the contents of the file named will be copied, uninterpreted, to -the current output. This complements the builtin @code{include} -(@pxref{Include}). To illustrate the difference, the file -@file{m4-@value{VERSION}/@/examples/@/foo} contains the word @samp{bar}: +non-numeric argument, the contents of the file named will be copied, +uninterpreted, to the current output. This complements the builtin +@code{include} (@pxref{Include}). To illustrate the difference, assume +the file @file{foo} contains: + +@comment ignore +@example +$ @kbd{cat foo} +bar +@end example + +@noindent +then @example define(`bar', `BAR') @@ -4259,7 +4429,20 @@ include(`foo') @end example If the file is not found (or cannot be read), an error message is -issued, and the expansion is void. +issued, and the expansion is void. It is possible to intermix files +and diversion numbers. + +@example +divert(`1')diversion one +divert(`2')undivert(`foo')dnl +divert(`3')diversion three +divert`'dnl +undivert(`1', `2', `foo', `3')dnl +@result{}diversion one +@result{}bar +@result{}bar +@result{}diversion three +@end example @node Divnum @section Diversion numbers @@ -4706,21 +4889,34 @@ The macro @code{format} is recognized on Its use is best described by a few examples: +@comment This test is a bit fragile, if someone tries to port to a +@comment platform without infinity. @example define(`foo', `The brown fox jumped over the lazy dog') @result{} format(`The string "%s" uses %d characters', foo, len(foo)) @result{}The string "The brown fox jumped over the lazy dog" uses 38 characters +format(`%*.*d', `-1', `-1', `1') +@result{}1 format(`%.0f', `56789.9876') @result{}56790 -len(format(`%-*X', `300', `1')) -@result{}300 +len(format(`%-*X', `5000', `1')) +@result{}5000 +ifelse(format(`%010F', `infinity'), ` INF', `success', + format(`%010F', `infinity'), ` INFINITY', `success', + format(`%010F', `infinity')) +@result{}success +ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success', + format(`%.1A', `1.999'), `0X2.0P+0', `success', + format(`%.1A', `1.999')) +@result{}success @end example Using the @code{forloop} macro defined earlier (@pxref{Forloop}), this example shows how @code{format} can be used to produce tabular output. @example +$ @kbd{m4 -I examples} include(`forloop.m4') @result{} forloop(`i', `1', `10', `format(`%6d squared is %10d @@ -4739,18 +4935,32 @@ forloop(`i', `1', `10', `format(`%6d squ @end example The builtin @code{format} is modeled after the ANSI C @samp{printf} -function, and supports these @samp{%} specifiers: @samp{c}, -@samp{s}, @samp{d}, @samp{o}, @samp{x}, @samp{X}, @samp{u}, @samp{e}, -@samp{E}, @samp{f}, @samp{F}, @samp{g}, @samp{G}, and @samp{%}; it -supports field widths and precisions, and the -modifiers @samp{+}, @samp{-}, @samp{@w{ }}, @samp{0}, @samp{#}, @samp{h} and -@samp{l}. For more details on the functioning of @code{printf}, see the -C Library Manual. - -For now, unrecognized specifiers are silently ignored, but it is -anticipated that a future release of @acronym{GNU} @code{m4} will support more -specifiers, and give warnings when problems are encountered. Likewise, -escape sequences are not yet recognized. +function, and supports these @samp{%} specifiers: @samp{c}, @samp{s}, +@samp{d}, @samp{o}, @samp{x}, @samp{X}, @samp{u}, @samp{a}, @samp{A}, +@samp{e}, @samp{E}, @samp{f}, @samp{F}, @samp{g}, @samp{G}, and +@samp{%}; it supports field widths and precisions, and the flags +@samp{+}, @samp{-}, @samp{ }, @samp{0}, @samp{#}, and @samp{'}. For +integer specifiers, the width modifiers @samp{hh}, @samp{h}, and +@samp{l} are recognized, and for floating point specifiers, the width +modifier @samp{l} is recognized. Items not yet supported include +positional arguments, the @samp{n}, @samp{p}, @samp{S}, and @samp{C} +specifiers, the @samp{z}, @samp{t}, @samp{j}, @samp{L} and @samp{ll} +modifiers, and any platform extensions available in the native +@code{printf}. For more details on the functioning of @code{printf}, +see the C Library Manual, or the @acronym{POSIX} specification (for +example, @samp{%a} is supported even on platforms that haven't yet +implemented C99 hexadecimal floating point output natively). + +Unrecognized specifiers result in a warning. It is anticipated that a +future release of @acronym{GNU} @code{m4} will support more specifiers, +and give better warnings when various problems such as overflow are +encountered. Likewise, escape sequences are not yet recognized. + +@example +format(`%p', `0') +@error{}m4:stdin:1: Warning: unrecognized specifier in `%p' +@result{} +@end example @node Arithmetic @chapter Macros for doing arithmetic @@ -4966,6 +5176,12 @@ Here are a few examples of use of @code{ @example eval(`-3 * 5') @result{}-15 +eval(`-99 / 10') +@result{}-9 +eval(`-99 % 10') +@result{}-9 +eval(`99 % -10') +@result{}9 eval(index(`Hello world', `llo') >= 0) @result{}1 eval(`0r1:0111 + 0b100 + 0r3:12') @@ -4979,7 +5195,7 @@ square(square(`5')` + 1') define(`foo', `666') @result{} eval(`foo / 6') -@error{}m4:stdin:8: bad expression in eval: foo / 6 +@error{}m4:stdin:11: bad expression in eval: foo / 6 @result{} eval(foo / 6) @result{}111 @@ -5173,20 +5389,14 @@ syscmd(`echo foo') Note how the expansion of @code{syscmd} keeps the trailing newline of the command, as well as using the newline that appeared after the macro. -As an example of @var{shell-command} using the same standard input as -@code{m4}, the command line @kbd{echo "m4wrap(\`syscmd(\`cat')')" | m4} -will tell @code{m4} to read all of its input before executing the -wrapped text, then hand a valid (albeit emptied) pipe as standard input -for the @code{cat} subcommand. Therefore, you should be careful when -using standard input (either by specifying no files, or by passing -@samp{-} as a file name on the command line, @pxref{Command line files, -, Invoking m4}), and -also invoking subcommands via @code{syscmd} or @code{esyscmd} that -consume data from standard input. When standard input is a seekable -file, the subprocess will pick up with the next character not yet -processed by @code{m4}; when it is a pipe or other non-seekable file, -there is no guarantee how much data will already be buffered by -@code{m4} and thus unavailable to the child. +The following is an example of @var{shell-command} using the same +standard input as @code{m4}: + +@comment ignore +@example +$ @kbd{echo "m4wrap(\`syscmd(\`cat')')" | m4} +@result{} +@end example @ignore @comment If the user types the example below with stdin being an @@ -5204,6 +5414,18 @@ m4wrap(`syscmd(`cat')') @end example @end ignore +It tells @code{m4} to read all of its input before executing the wrapped +text, then hand a valid (albeit emptied) pipe as standard input for the +@code{cat} subcommand. Therefore, you should be careful when using +standard input (either by specifying no files, or by passing @samp{-} as +a file name on the command line, @pxref{Command line files, , Invoking +m4}), and also invoking subcommands via @code{syscmd} or @code{esyscmd} +that consume data from standard input. When standard input is a +seekable file, the subprocess will pick up with the next character not +yet processed by @code{m4}; when it is a pipe or other non-seekable +file, there is no guarantee how much data will already be buffered by +@code{m4} and thus unavailable to the child. + @node Esyscmd @section Reading the output of commands @@ -5370,6 +5592,7 @@ chosen: @comment ignore @example +$ @kbd{m4} maketemp(`/tmp/fooXXXXXX') @result{}/tmp/fooa07346 ifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))', @@ -5390,6 +5613,7 @@ recommend that you use the new @code{mks @acronym{GNU} M4 1.4.8, which is secure even in traditional mode. @example +$ @kbd{m4} syscmd(`echo foo??????')dnl @result{}foo?????? define(`file1', maketemp(`fooXXXXXX'))dnl @@ -5490,13 +5714,14 @@ reflected in the file name. The synclin @pxref{Preprocessor features, , Invoking m4}), and the @samp{f} and @samp{l} flags of @code{debugmode} (@pxref{Debug Levels}), also use this notion of current file and line. Redefining the three -location macros has no effect on syncline, debug, or warning message -output. Assume this example is run in the -@file{m4-@value{VERSION}/@/checks} directory of the @acronym{GNU} M4 -package, using @samp{--include=../examples} in the command line to find -the file @file{incl.m4} mentioned earlier: +location macros has no effect on syncline, debug, warning, or error +message output. + +This example reuses the file @file{incl.m4} mentioned earlier +(@pxref{Include}): @example +$ @kbd{m4 -I examples} define(`foo', ``$0' called at __file__:__line__') @result{} foo @@ -5645,9 +5870,9 @@ Suppose a user has a library of @code{m4 @comment ignore @example -m4 base.m4 input1.m4 -m4 base.m4 input2.m4 -m4 base.m4 input3.m4 +$ @kbd{m4 base.m4 input1.m4} +$ @kbd{m4 base.m4 input2.m4} +$ @kbd{m4 base.m4 input3.m4} @end example Rather than spending time parsing the fixed contents of @file{base.m4} @@ -5655,7 +5880,7 @@ every time, the user might rather execut @comment ignore @example -m4 -F base.m4f base.m4 +$ @kbd{m4 -F base.m4f base.m4} @end example @noindent @@ -5663,9 +5888,9 @@ once, and further execute, as often as n @comment ignore @example -m4 -R base.m4f input1.m4 -m4 -R base.m4f input2.m4 -m4 -R base.m4f input3.m4 +$ @kbd{m4 -R base.m4f input1.m4} +$ @kbd{m4 -R base.m4f input2.m4} +$ @kbd{m4 -R base.m4f input3.m4} @end example @noindent @@ -5692,7 +5917,7 @@ some care is taken, the command: @comment ignore @example -m4 file1.m4 file2.m4 file3.m4 file4.m4 +$ @kbd{m4 file1.m4 file2.m4 file3.m4 file4.m4} @end example @noindent @@ -5701,10 +5926,10 @@ output: @comment ignore @example -m4 -F file1.m4f file1.m4 -m4 -R file1.m4f -F file2.m4f file2.m4 -m4 -R file2.m4f -F file3.m4f file3.m4 -m4 -R file3.m4f file4.m4 +$ @kbd{m4 -F file1.m4f file1.m4} +$ @kbd{m4 -R file1.m4f -F file2.m4f file2.m4} +$ @kbd{m4 -R file2.m4f -F file3.m4f file3.m4} +$ @kbd{m4 -R file3.m4f file4.m4} @end example Some care is necessary because not every effort has been made for @@ -6127,7 +6352,29 @@ diverted text as being generated at the The sync line option is used mostly when using @code{m4} as a front end to a compiler. If a diverted line causes a compiler error, the error messages should most probably refer to the place where the -diversion were made, and not where it was inserted again. +diversion was made, and not where it was inserted again. + +@comment options: -s +@example +divert(2)2 +divert(1)1 +divert`'0 +@result{}#line 3 "stdin" +@result{}0 +^D +@result{}#line 2 "stdin" +@result{}1 +@result{}#line 1 "stdin" +@result{}2 +@end example + +The current @code{m4} implementation has a limitation that the syncline +output at the start of each diversion occurs no matter what, even if the +previous diversion did not end with a newline. This goes contrary to +the claim that synclines appear on a line by themselves, so this +limitation may be corrected in a future version of @code{m4}. In the +meantime, when using @option{-s}, it is wisest to make sure all +diversions end with newline. @item @acronym{GNU} @code{m4} makes no attempt at prohibiting self-referential @@ -6205,6 +6452,7 @@ version also optimizes based on the fact not need to be passed to the helper @code{@w{_forloop}}. @example +$ @kbd{m4 -I examples} undivert(`forloop2.m4')dnl @result{}divert(`-1') @result{}# forloop(var, from, to, stmt) - improved version: @@ -6244,6 +6492,7 @@ presented earlier each have flaws. Firs quadratic behavior of @code{foreachq}: @example +$ @kbd{m4 -I examples} include(`foreachq.m4') @result{} traceon(`shift')debugmode(`aq') @@ -6284,6 +6533,7 @@ importantly, performs faster. The fixed be found in @file{m4-@value{VERSION}/@/examples/@/foreachq2.m4}: @example +$ @kbd{m4 -I examples} include(`foreachq2.m4') @result{} undivert(`foreachq2.m4')dnl @@ -6325,6 +6575,7 @@ overquotes the arguments to @code{@w{_fo front: @example +$ @kbd{m4 -I examples} include(`foreach2.m4') @result{} undivert(`foreach2.m4')dnl @@ -6369,6 +6620,7 @@ repeating the side effects of unquoted l detrimental effects. @example +$ @kbd{m4 -I examples} include(`foreach2.m4') @result{} include(`foreachq2.m4') @@ -6500,9 +6752,28 @@ fatal_error(`inside wrapped text')') @c ========================================================== Appendices +@node Copying This Package +@appendix How to make copies of the overall M4 package +@cindex License, code + +This appendix covers the license for copying the source code of the +overall M4 package. This manual is under a different set of +restrictions, covered later (@pxref{Copying This Manual}). + +@menu +* Copying:: GNU General Public License +@end menu + +@include gpl-3.0.texi + @node Copying This Manual @appendix How to make copies of this manual -@cindex License +@cindex License, manual + +This appendix covers the license for copying this manual. Note that +some of the longer examples in this manual are also distributed in the +directory @file{m4-@value{VERSION}/@/examples/}, where a more +permissive license is in effect when copying just the examples. @menu * GNU Free Documentation License:: License for copying this manual diff -ruNp m4-1.4.9/doc/mdate-sh m4-1.4.10/doc/mdate-sh --- m4-1.4.9/doc/mdate-sh 2007-03-23 06:54:09.000000000 -0600 +++ m4-1.4.10/doc/mdate-sh 2007-07-09 21:15:35.000000000 -0600 @@ -1,15 +1,15 @@ #!/bin/sh # Get modification time of a file or directory and pretty-print it. -scriptversion=2005-06-29.22 +scriptversion=2007-03-30.02 -# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007 Free Software # Foundation, Inc. # written by Ulrich Drepper , June 1995 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, @@ -75,6 +75,10 @@ if ls -L /dev/null 1>/dev/null 2>&1; the else ls_command='ls -l -d' fi +# Avoid user/group names that might have spaces, when possible. +if ls -n /dev/null 1>/dev/null 2>&1; then + ls_command="$ls_command -n" +fi # A `ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo @@ -89,7 +93,7 @@ fi # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. -set x`ls -l -d /` +set x`$ls_command /` # Find which argument is the month. month= diff -ruNp m4-1.4.9/doc/stamp-vti m4-1.4.10/doc/stamp-vti --- m4-1.4.9/doc/stamp-vti 2007-03-23 07:36:04.000000000 -0600 +++ m4-1.4.10/doc/stamp-vti 2007-07-09 21:20:49.000000000 -0600 @@ -1,4 +1,4 @@ -@set UPDATED 23 March 2007 -@set UPDATED-MONTH March 2007 -@set EDITION 1.4.9 -@set VERSION 1.4.9 +@set UPDATED 4 July 2007 +@set UPDATED-MONTH July 2007 +@set EDITION 1.4.10 +@set VERSION 1.4.10 diff -ruNp m4-1.4.9/doc/texinfo.tex m4-1.4.10/doc/texinfo.tex --- m4-1.4.9/doc/texinfo.tex 2007-03-23 06:54:13.000000000 -0600 +++ m4-1.4.10/doc/texinfo.tex 2007-07-09 21:15:36.000000000 -0600 @@ -3,16 +3,16 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2007-03-14.11} +\def\texinfoversion{2007-07-05.10} % -% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 2007, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, % 2007 Free Software Foundation, Inc. % % This texinfo.tex file is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License as -% published by the Free Software Foundation; either version 2, or (at -% your option) any later version. +% published by the Free Software Foundation; either version 3 of the +% License, or (at your option) any later version. % % This texinfo.tex file is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied warranty @@ -20,9 +20,7 @@ % General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -% Boston, MA 02110-1301, USA. +% along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -375,7 +373,7 @@ % marginal hacks, juha@viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 +\dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } @@ -1262,7 +1260,30 @@ be supported due to the design of the PD output) for that.)} \ifpdf - \input pdfcolor + % + % Color manipulation macros from pdfcolor.tex. + \def\cmykDarkRed{0.28 1 1 0.35} + \def\cmykBlack{0 0 0 1} + % + \def\pdfsetcolor#1{\pdfliteral{#1 k}} + \def\setcolor#1{\mark{#1}\pdfsetcolor{#1}} + % + \def\maincolor{\cmykBlack} + \pdfsetcolor{\maincolor} + % + \def\makefootline{ + \baselineskip24pt + \line{\pdfsetcolor{\maincolor}\the\footline}} + % + \def\makeheadline{% + \edef\M{\topmark} + \ifx\M\empty\let\M=\maincolor\fi + \vbox to 0pt{\vskip-22.5pt + \line{\vbox to8.5pt{}% + \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\M}}\vss}% + \nointerlineskip} + % + % \pdfcatalog{/PageMode /UseOutlines} % % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). @@ -1321,14 +1342,17 @@ output) for that.)} \makevalueexpandable \def\pdfdestname{#1}% \backslashparens\pdfdestname - \pdfdest name{\pdfdestname} xyz% + \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % - \let\linkcolor = \Blue % was Cyan, but that seems light? - \def\endlink{\Black\pdfendlink} + % by default, use a color that is dark enough to print on paper as + % nearly black, but still distinguishable for online viewing. + \def\urlcolor{\cmykDarkRed} + \def\linkcolor{\cmykDarkRed} + \def\endlink{\setcolor{\maincolor}\pdfendlink} % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak @@ -1431,7 +1455,7 @@ output) for that.)} \indexnofonts \setupdatafile \catcode`\\=\active \otherbackslash - \input \jobname.toc + \input \tocreadfilename \endgroup } % @@ -1461,7 +1485,7 @@ output) for that.)} \def\@{@}% \let\/=\empty \makevalueexpandable - \leavevmode\Red + \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} @@ -1488,13 +1512,14 @@ output) for that.)} {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} - \linkcolor #1\endlink} + \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax - \let\linkcolor = \relax + \let\setcolor = \gobble + \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput @@ -1551,11 +1576,276 @@ output) for that.)} }% } +% +% PDF CMaps. See also LaTeX's t1.cmap. +% +% \cmapOT1 +\ifpdf + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1-0) +%%Title: (TeX-OT1-0 TeX OT1 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1) +/Supplement 0 +>> def +/CMapName /TeX-OT1-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<23> <26> <0023> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +40 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1IT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1IT-0) +%%Title: (TeX-OT1IT-0 TeX OT1IT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1IT) +/Supplement 0 +>> def +/CMapName /TeX-OT1IT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +8 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<25> <26> <0025> +<28> <3B> <0028> +<3F> <5B> <003F> +<5D> <5E> <005D> +<61> <7A> <0061> +<7B> <7C> <2013> +endbfrange +42 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <00660066> +<0C> <00660069> +<0D> <0066006C> +<0E> <006600660069> +<0F> <00660066006C> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<21> <0021> +<22> <201D> +<23> <0023> +<24> <00A3> +<27> <2019> +<3C> <00A1> +<3D> <003D> +<3E> <00BF> +<5C> <201C> +<5F> <02D9> +<60> <2018> +<7D> <02DD> +<7E> <007E> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1IT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +% +% \cmapOT1TT + \begingroup + \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. + \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap +%%DocumentNeededResources: ProcSet (CIDInit) +%%IncludeResource: ProcSet (CIDInit) +%%BeginResource: CMap (TeX-OT1TT-0) +%%Title: (TeX-OT1TT-0 TeX OT1TT 0) +%%Version: 1.000 +%%EndComments +/CIDInit /ProcSet findresource begin +12 dict begin +begincmap +/CIDSystemInfo +<< /Registry (TeX) +/Ordering (OT1TT) +/Supplement 0 +>> def +/CMapName /TeX-OT1TT-0 def +/CMapType 2 def +1 begincodespacerange +<00> <7F> +endcodespacerange +5 beginbfrange +<00> <01> <0393> +<09> <0A> <03A8> +<21> <26> <0021> +<28> <5F> <0028> +<61> <7E> <0061> +endbfrange +32 beginbfchar +<02> <0398> +<03> <039B> +<04> <039E> +<05> <03A0> +<06> <03A3> +<07> <03D2> +<08> <03A6> +<0B> <2191> +<0C> <2193> +<0D> <0027> +<0E> <00A1> +<0F> <00BF> +<10> <0131> +<11> <0237> +<12> <0060> +<13> <00B4> +<14> <02C7> +<15> <02D8> +<16> <00AF> +<17> <02DA> +<18> <00B8> +<19> <00DF> +<1A> <00E6> +<1B> <0153> +<1C> <00F8> +<1D> <00C6> +<1E> <0152> +<1F> <00D8> +<20> <2423> +<27> <2019> +<60> <2018> +<7F> <00A8> +endbfchar +endcmap +CMapName currentdict /CMap defineresource pop +end +end +%%EndResource +%%EOF + }\endgroup + \expandafter\edef\csname cmapOT1TT\endcsname#1{% + \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% + }% +\else + \expandafter\let\csname cmapOT1\endcsname\gobble + \expandafter\let\csname cmapOT1IT\endcsname\gobble + \expandafter\let\csname cmapOT1TT\endcsname\gobble +\fi + % Set the font macro #1 to the font named #2, adding on the % specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} +% #3 is the font's design size, #4 is a scale factor, #5 is the CMap +% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass +% empty to omit). +\def\setfont#1#2#3#4#5{% + \font#1=\fontprefix#2#3 scaled #4 + \csname cmap#5\endcsname#1% +} +% This is what gets called when #5 of \setfont is empty. +\let\cmap\gobble % Use cm as the default font prefix. @@ -1588,59 +1878,59 @@ output) for that.)} % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep % A few fonts for @defun names and args. -\setfont\defbf\bfshape{10}{\magstep1} -\setfont\deftt\ttshape{10}{\magstep1} -\setfont\defttsl\ttslshape{10}{\magstep1} +\setfont\defbf\bfshape{10}{\magstep1}{OT1} +\setfont\deftt\ttshape{10}{\magstep1}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 % Fonts for small examples (8pt). \def\smallernominalsize{8pt} -\setfont\smallerrm\rmshape{8}{1000} -\setfont\smallertt\ttshape{8}{1000} -\setfont\smallerbf\bfshape{10}{800} -\setfont\smallerit\itshape{8}{1000} -\setfont\smallersl\slshape{8}{1000} -\setfont\smallersf\sfshape{8}{1000} -\setfont\smallersc\scshape{10}{800} -\setfont\smallerttsl\ttslshape{10}{800} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\authorrm{\secrm} @@ -1648,53 +1938,53 @@ output) for that.)} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} +\setfont\chaprm\rmbshape{12}{\magstep2}{OT1} +\setfont\chapit\itbshape{10}{\magstep3}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep3}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} +\setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} +\setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 % Section fonts (14.4pt). \def\secnominalsize{14pt} -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} +\setfont\secrm\rmbshape{12}{\magstep1}{OT1} +\setfont\secit\itbshape{10}{\magstep2}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep2}{OT1} +\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} +\setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} +\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} +\setfont\ssecit\itbshape{10}{1315}{OT1IT} +\setfont\ssecsl\slbshape{10}{1315}{OT1} +\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} +\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{1315} +\setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} -\setfont\reducedrm\rmshape{10}{1000} -\setfont\reducedtt\ttshape{10}{1000} -\setfont\reducedbf\bfshape{10}{1000} -\setfont\reducedit\itshape{10}{1000} -\setfont\reducedsl\slshape{10}{1000} -\setfont\reducedsf\sfshape{10}{1000} -\setfont\reducedsc\scshape{10}{1000} -\setfont\reducedttsl\ttslshape{10}{1000} +\setfont\reducedrm\rmshape{10}{1000}{OT1} +\setfont\reducedtt\ttshape{10}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{1000}{OT1} +\setfont\reducedit\itshape{10}{1000}{OT1IT} +\setfont\reducedsl\slshape{10}{1000}{OT1} +\setfont\reducedsf\sfshape{10}{1000}{OT1} +\setfont\reducedsc\scshape{10}{1000}{OT1} +\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 @@ -1713,59 +2003,59 @@ output) for that.)} % Text fonts (10pt). \def\textnominalsize{10pt} \edef\mainmagstep{1000} -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} +\setfont\textrm\rmshape{10}{\mainmagstep}{OT1} +\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} +\setfont\textbf\bfshape{10}{\mainmagstep}{OT1} +\setfont\textit\itshape{10}{\mainmagstep}{OT1IT} +\setfont\textsl\slshape{10}{\mainmagstep}{OT1} +\setfont\textsf\sfshape{10}{\mainmagstep}{OT1} +\setfont\textsc\scshape{10}{\mainmagstep}{OT1} +\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep % A few fonts for @defun names and args. -\setfont\defbf\bfshape{10}{\magstephalf} -\setfont\deftt\ttshape{10}{\magstephalf} -\setfont\defttsl\ttslshape{10}{\magstephalf} +\setfont\defbf\bfshape{10}{\magstephalf}{OT1} +\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} +\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} +\setfont\smallrm\rmshape{9}{1000}{OT1} +\setfont\smalltt\ttshape{9}{1000}{OT1TT} +\setfont\smallbf\bfshape{10}{900}{OT1} +\setfont\smallit\itshape{9}{1000}{OT1IT} +\setfont\smallsl\slshape{9}{1000}{OT1} +\setfont\smallsf\sfshape{9}{1000}{OT1} +\setfont\smallsc\scshape{10}{900}{OT1} +\setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 % Fonts for small examples (8pt). \def\smallernominalsize{8pt} -\setfont\smallerrm\rmshape{8}{1000} -\setfont\smallertt\ttshape{8}{1000} -\setfont\smallerbf\bfshape{10}{800} -\setfont\smallerit\itshape{8}{1000} -\setfont\smallersl\slshape{8}{1000} -\setfont\smallersf\sfshape{8}{1000} -\setfont\smallersc\scshape{10}{800} -\setfont\smallerttsl\ttslshape{10}{800} +\setfont\smallerrm\rmshape{8}{1000}{OT1} +\setfont\smallertt\ttshape{8}{1000}{OT1TT} +\setfont\smallerbf\bfshape{10}{800}{OT1} +\setfont\smallerit\itshape{8}{1000}{OT1IT} +\setfont\smallersl\slshape{8}{1000}{OT1} +\setfont\smallersf\sfshape{8}{1000}{OT1} +\setfont\smallersc\scshape{10}{800}{OT1} +\setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} +\setfont\titlerm\rmbshape{12}{\magstep3}{OT1} +\setfont\titleit\itbshape{10}{\magstep4}{OT1IT} +\setfont\titlesl\slbshape{10}{\magstep4}{OT1} +\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} +\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} +\setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} +\setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\authorrm{\secrm} @@ -1773,53 +2063,53 @@ output) for that.)} % Chapter fonts (14.4pt). \def\chapnominalsize{14pt} -\setfont\chaprm\rmbshape{12}{\magstep1} -\setfont\chapit\itbshape{10}{\magstep2} -\setfont\chapsl\slbshape{10}{\magstep2} -\setfont\chaptt\ttbshape{12}{\magstep1} -\setfont\chapttsl\ttslshape{10}{\magstep2} -\setfont\chapsf\sfbshape{12}{\magstep1} +\setfont\chaprm\rmbshape{12}{\magstep1}{OT1} +\setfont\chapit\itbshape{10}{\magstep2}{OT1IT} +\setfont\chapsl\slbshape{10}{\magstep2}{OT1} +\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} +\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} +\setfont\chapsf\sfbshape{12}{\magstep1}{OT1} \let\chapbf\chaprm -\setfont\chapsc\scbshape{10}{\magstep2} +\setfont\chapsc\scbshape{10}{\magstep2}{OT1} \font\chapi=cmmi12 scaled \magstep1 \font\chapsy=cmsy10 scaled \magstep2 % Section fonts (12pt). \def\secnominalsize{12pt} -\setfont\secrm\rmbshape{12}{1000} -\setfont\secit\itbshape{10}{\magstep1} -\setfont\secsl\slbshape{10}{\magstep1} -\setfont\sectt\ttbshape{12}{1000} -\setfont\secttsl\ttslshape{10}{\magstep1} -\setfont\secsf\sfbshape{12}{1000} +\setfont\secrm\rmbshape{12}{1000}{OT1} +\setfont\secit\itbshape{10}{\magstep1}{OT1IT} +\setfont\secsl\slbshape{10}{\magstep1}{OT1} +\setfont\sectt\ttbshape{12}{1000}{OT1TT} +\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} +\setfont\secsf\sfbshape{12}{1000}{OT1} \let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep1} +\setfont\secsc\scbshape{10}{\magstep1}{OT1} \font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 % Subsection fonts (10pt). \def\ssecnominalsize{10pt} -\setfont\ssecrm\rmbshape{10}{1000} -\setfont\ssecit\itbshape{10}{1000} -\setfont\ssecsl\slbshape{10}{1000} -\setfont\ssectt\ttbshape{10}{1000} -\setfont\ssecttsl\ttslshape{10}{1000} -\setfont\ssecsf\sfbshape{10}{1000} +\setfont\ssecrm\rmbshape{10}{1000}{OT1} +\setfont\ssecit\itbshape{10}{1000}{OT1IT} +\setfont\ssecsl\slbshape{10}{1000}{OT1} +\setfont\ssectt\ttbshape{10}{1000}{OT1TT} +\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} +\setfont\ssecsf\sfbshape{10}{1000}{OT1} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{1000} +\setfont\ssecsc\scbshape{10}{1000}{OT1} \font\sseci=cmmi10 \font\ssecsy=cmsy10 % Reduced fonts for @acro in text (9pt). \def\reducednominalsize{9pt} -\setfont\reducedrm\rmshape{9}{1000} -\setfont\reducedtt\ttshape{9}{1000} -\setfont\reducedbf\bfshape{10}{900} -\setfont\reducedit\itshape{9}{1000} -\setfont\reducedsl\slshape{9}{1000} -\setfont\reducedsf\sfshape{9}{1000} -\setfont\reducedsc\scshape{10}{900} -\setfont\reducedttsl\ttslshape{10}{900} +\setfont\reducedrm\rmshape{9}{1000}{OT1} +\setfont\reducedtt\ttshape{9}{1000}{OT1TT} +\setfont\reducedbf\bfshape{10}{900}{OT1} +\setfont\reducedit\itshape{9}{1000}{OT1IT} +\setfont\reducedsl\slshape{9}{1000}{OT1} +\setfont\reducedsf\sfshape{9}{1000}{OT1} +\setfont\reducedsc\scshape{10}{900}{OT1} +\setfont\reducedttsl\ttslshape{10}{900}{OT1TT} \font\reducedi=cmmi9 \font\reducedsy=cmsy9 @@ -1977,10 +2267,10 @@ output) for that.)} \newcount\fontdepth \fontdepth=0 % Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 -\setfont\shortcontsl\slshape{12}{1000} -\setfont\shortconttt\ttshape{12}{1000} +\setfont\shortcontrm\rmshape{12}{1000}{OT1} +\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000}{OT1} +\setfont\shortconttt\ttshape{12}{1000}{OT1TT} %% Add scribe-like font environments, plus @l for inline lisp (usually sans %% serif) and @ii for TeX italic @@ -2043,7 +2333,7 @@ output) for that.)} \null } \def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} +\setfont\keyrm\rmshape{8}{1000}{OT1} \font\keysy=cmsy9 \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% @@ -3747,11 +4037,7 @@ output) for that.)} % \edef\writeto{\csname#1indfile\endcsname}% % - \ifvmode - \dosubindsanitize - \else - \dosubindwrite - \fi + \safewhatsit\dosubindwrite }% \fi } @@ -3788,13 +4074,13 @@ output) for that.)} \temp } -% Take care of unwanted page breaks: +% Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the -% \write will make \lastskip zero. The result is that sequences -% like this: +% \write or \pdfdest will make \lastskip zero. The result is that +% sequences like this: % @end defun % @tindex whatever % @defun ... @@ -3818,25 +4104,31 @@ output) for that.)} % \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} % +\newskip\whatsitskip +\newcount\whatsitpenalty +% % ..., ready, GO: % -\def\dosubindsanitize{% +\def\safewhatsit#1{% +\ifhmode + #1% +\else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. - \skip0 = \lastskip + \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% - \count255 = \lastpenalty + \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this - % -\skip0 glue we're inserting is preceded by a + % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else - \vskip-\skip0 + \vskip-\whatsitskip \fi % - \dosubindwrite + #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and @@ -3850,13 +4142,14 @@ output) for that.)} % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. - \ifnum\count255>9999 \penalty\count255 \fi + \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. - \nobreak\vskip\skip0 + \nobreak\vskip\whatsitskip \fi +\fi } % The index entry written in the file actually looks like @@ -3899,6 +4192,7 @@ output) for that.)} % \smallfonts \rm \tolerance = 9500 + \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. @@ -4028,11 +4322,8 @@ output) for that.)} % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#1}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd + \setbox\boxA = \hbox{#1}% + \ifdim\wd\boxA = 0pt \ % \else % @@ -4698,6 +4989,7 @@ output) for that.)} \donoderef{#2}% % % Typeset the actual heading. + \nobreak % Avoid page breaks at the interline glue. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% @@ -4904,7 +5196,7 @@ output) for that.)} \def\readtocfile{% \setupdatafile \activecatcodes - \input \jobname.toc + \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in @@ -4935,11 +5227,16 @@ output) for that.)} \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } +% redefined for the two-volume lispref. We always output on +% \jobname.toc even if this is redefined. +% +\def\tocreadfilename{\jobname.toc} % Normal (long) toc. +% \def\contents{% \startcontents{\putwordTOC}% - \openin 1 \jobname.toc + \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi @@ -4977,7 +5274,7 @@ output) for that.)} \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry - \openin 1 \jobname.toc + \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi @@ -5490,11 +5787,11 @@ output) for that.)} % regular 0x27. % \def\codequoteright{% - \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax - '% - \else - \char'15 - \fi + \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else \char'15 \fi + \else \char'15 \fi } % % and a similar option for the left quote char vs. a grave accent. @@ -5502,11 +5799,11 @@ output) for that.)} % the code environments to do likewise. % \def\codequoteleft{% - \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax - `% - \else - \char'22 - \fi + \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + `% + \else \char'22 \fi + \else \char'22 \fi } % \begingroup @@ -5631,21 +5928,28 @@ output) for that.)} \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt +\newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak + \defunpenalty=10003 % Will keep this @deffn together with the + % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted - % by \defargscommonending, instead of 10000, since the sectioning + % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. - % - \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % As a minor refinement, we avoid "club" headers by signalling + % with penalty of 10003 after the very first @deffn in the + % sequence (see above), and penalty of 10002 after any following + % @def command. + \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. @@ -5663,7 +5967,7 @@ output) for that.)} % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. - \ifnum\lastpenalty=10002 \penalty3000 \fi + \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% @@ -5681,7 +5985,7 @@ output) for that.)} \advance\rightskip by 0pt plus 1fil \endgraf \nobreak\vskip -\parskip - \penalty 10002 % signal to \startdefun and \dodefunx + \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts @@ -6050,6 +6354,10 @@ output) for that.)} % all characters are catcode 10, 11 or 12, except \ which is active % (as in normal texinfo). It is necessary to change the definition of \. +% Non-ASCII encodings make 8-bit characters active, so un-activate +% them to avoid their expansion. Must do this non-globally, to +% confine the change to the current group. + % It's necessary to have hard CRs when the macro is executed. This is % done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. @@ -6064,6 +6372,7 @@ output) for that.)} \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other + \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi } \def\scanargctxt{% @@ -6347,7 +6656,7 @@ output) for that.)} \toks0 = \expandafter{\thissection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. - \writexrdef{pg}{\folio}% will be written later, during \shipout + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout }% \fi } @@ -6407,7 +6716,7 @@ output) for that.)} goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% - \linkcolor + \setcolor{\linkcolor}% \fi % % Float references are printed completely differently: "Figure 1.2" @@ -7152,22 +7461,41 @@ output) for that.)} % @documentlanguage is usually given very early, just after % @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. +% properly. Single argument is the language (de) or locale (de_DE) +% abbreviation. It would be nice if we could set up a hyphenation file. % -\parseargdef\documentlanguage{% +{ + \catcode`\_ = \active + \globaldefs=1 +\parseargdef\documentlanguage{\begingroup + \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. + % Read the file by the name they passed if it exists. \openin 1 txi-#1.tex \ifeof 1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% + \documentlanguagetrywithoutunderscore{#1_\finish}% \else \input txi-#1.tex \fi \closein 1 \endgroup +\endgroup} +} +% +% If they passed de_DE, and txi-de_DE.tex doesn't exist, +% try txi-de.tex. +% +\def\documentlanguagetrywithoutunderscore#1_#2\finish{% + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 } +% \newhelp\nolanghelp{The given language definition file cannot be found or is empty. Maybe you need to install it? In the current directory should work if nowhere else does.} @@ -7177,7 +7505,15 @@ should work if nowhere else does.} \def\setnonasciicharscatcode#1{% \count255=128 \loop\ifnum\count255<256 - \global\catcode\count255=#1 + \global\catcode\count255=#1\relax + \advance\count255 by 1 + \repeat +} + +\def\setnonasciicharscatcodenonglobal#1{% + \count255=128 + \loop\ifnum\count255<256 + \catcode\count255=#1\relax \advance\count255 by 1 \repeat } @@ -8034,6 +8370,10 @@ should work if nowhere else does.} \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax + % if we don't reset these, they will remain at "1 true in" of + % whatever layout pdftex was dumped with. + \pdfhorigin = 1 true in + \pdfvorigin = 1 true in \fi % \setleading{\textleading} @@ -8060,7 +8400,7 @@ should work if nowhere else does.} \textleading = 12pt % \internalpagesizes{7.5in}{5in}% - {\voffset}{.25in}% + {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % @@ -8169,7 +8509,7 @@ should work if nowhere else does.} \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % - \dimen0 = #1 + \dimen0 = #1\relax \advance\dimen0 by \voffset % \dimen2 = \hsize diff -ruNp m4-1.4.9/doc/version.texi m4-1.4.10/doc/version.texi --- m4-1.4.9/doc/version.texi 2007-03-23 07:36:04.000000000 -0600 +++ m4-1.4.10/doc/version.texi 2007-07-09 21:20:49.000000000 -0600 @@ -1,4 +1,4 @@ -@set UPDATED 23 March 2007 -@set UPDATED-MONTH March 2007 -@set EDITION 1.4.9 -@set VERSION 1.4.9 +@set UPDATED 4 July 2007 +@set UPDATED-MONTH July 2007 +@set EDITION 1.4.10 +@set VERSION 1.4.10 diff -ruNp m4-1.4.9/examples/Makefile.am m4-1.4.10/examples/Makefile.am --- m4-1.4.9/examples/Makefile.am 2006-10-27 06:13:13.000000000 -0600 +++ m4-1.4.10/examples/Makefile.am 2007-07-04 21:56:03.000000000 -0600 @@ -1,10 +1,10 @@ ## This file is part of GNU M4. ## -## Copyright (C) 2006 Free Software Foundation, Inc. +## Copyright (C) 2006, 2007 Free Software Foundation, Inc. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or +## 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, diff -ruNp m4-1.4.9/examples/Makefile.in m4-1.4.10/examples/Makefile.in --- m4-1.4.9/examples/Makefile.in 2007-03-23 07:32:34.000000000 -0600 +++ m4-1.4.10/examples/Makefile.in 2007-07-09 21:15:31.000000000 -0600 @@ -34,36 +34,48 @@ host_triplet = @host@ subdir = examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ - $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/closein.m4 \ $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ - $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ - $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ - $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/inline.m4 \ + $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ + $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ + $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ + $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/localcharset.m4 \ - $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ - $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ - $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ - $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ + $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/printf-frexp.m4 \ + $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ + $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ + $(top_srcdir)/m4/sig_atomic_t.m4 $(top_srcdir)/m4/signal_h.m4 \ + $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/signbit.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ @@ -77,13 +89,6 @@ CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ -ABSOLUTE_STDLIB_H = @ABSOLUTE_STDLIB_H@ -ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ -ABSOLUTE_SYS_TIME_H = @ABSOLUTE_SYS_TIME_H@ -ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@ -ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@ -ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ @@ -111,30 +116,80 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ +FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREXP = @GNULIB_FREXP@ +GNULIB_FREXPL = @GNULIB_FREXPL@ +GNULIB_FSEEK = @GNULIB_FSEEK@ +GNULIB_FSEEKO = @GNULIB_FSEEKO@ +GNULIB_FTELL = @GNULIB_FTELL@ +GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LDEXPL = @GNULIB_LDEXPL@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ +GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ +GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ +GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ +GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ +GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ +HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ +HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ +HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ +HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ +HAVE_DECL_SINL = @HAVE_DECL_SINL@ +HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ +HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_FSEEKO = @HAVE_FSEEKO@ +HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_IO_H = @HAVE_IO_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SIGSET_T = @HAVE_SIGSET_T@ +HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ @@ -143,24 +198,40 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_VASPRINTF = @HAVE_VASPRINTF@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE__BOOL = @HAVE__BOOL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ +NEXT_FLOAT_H = @NEXT_FLOAT_H@ +NEXT_MATH_H = @NEXT_MATH_H@ +NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDIO_H = @NEXT_STDIO_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -173,9 +244,30 @@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREXP = @REPLACE_FREXP@ +REPLACE_FREXPL = @REPLACE_FREXPL@ +REPLACE_FSEEK = @REPLACE_FSEEK@ +REPLACE_FSEEKO = @REPLACE_FSEEKO@ +REPLACE_FTELL = @REPLACE_FTELL@ +REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ +REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ +REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ +REPLACE_VPRINTF = @REPLACE_VPRINTF@ +REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ +REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ diff -ruNp m4-1.4.9/gendocs.sh m4-1.4.10/gendocs.sh --- m4-1.4.9/gendocs.sh 2007-03-23 06:50:31.000000000 -0600 +++ m4-1.4.10/gendocs.sh 2007-07-04 22:02:42.000000000 -0600 @@ -2,14 +2,14 @@ # gendocs.sh -- generate a GNU manual in many formats. This script is # mentioned in maintain.texi. See the help message below for usage details. -scriptversion=2006-07-15.08 +scriptversion=2007-07-01.15 -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# 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 @@ -17,10 +17,8 @@ scriptversion=2006-07-15.08 # 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, you can either send email to this -# program's maintainer or write to: The Free Software Foundation, -# Inc.; 51 Franklin Street, Fifth Floor; Boston, MA 02110-1301, USA. -# +# along with this program. If not, see . +# # Original author: Mohit Agarwal. # Send bug reports and any other correspondence to bug-texinfo@gnu.org. @@ -30,19 +28,20 @@ srcdir=`pwd` scripturl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs.sh" templateurl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs_template" +: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="} : ${MAKEINFO="makeinfo"} : ${TEXI2DVI="texi2dvi -t @finalout"} : ${DVIPS="dvips"} -: ${DOCBOOK2TXT="docbook2txt"} : ${DOCBOOK2HTML="docbook2html"} : ${DOCBOOK2PDF="docbook2pdf"} : ${DOCBOOK2PS="docbook2ps"} +: ${DOCBOOK2TXT="docbook2txt"} : ${GENDOCS_TEMPLATE_DIR="."} unset CDPATH version="gendocs.sh $scriptversion -Copyright (C) 2006 Free Software Foundation, Inc. +Copyright (C) 2007 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING." @@ -83,9 +82,20 @@ times with different YOURMANUAL values, directory with -o each time. Then write (by hand) an overall index.html with links to them all. +If a manual's texinfo sources are spread across several directories, +first copy or symlink all Texinfo sources into a single directory. +(Part of the script's work is to make a tar.gz of the sources.) + You can set the environment variables MAKEINFO, TEXI2DVI, and DVIPS to control the programs that get executed, and GENDOCS_TEMPLATE_DIR to -control where the gendocs_template file is looked for. +control where the gendocs_template file is looked for. (With --docbook, +the environment variables DOCBOOK2HTML, DOCBOOK2PDF, DOCBOOK2PS, and +DOCBOOK2TXT are also respected.) + +By default, makeinfo is run in the default (English) locale, since +that's the language of most Texinfo manuals. If you happen to have a +non-English manual and non-English web site, check the SETLANG setting +in the source. Email bug reports or enhancement requests to bug-texinfo@gnu.org. " @@ -144,7 +154,7 @@ fi echo Generating output formats for $srcfile -cmd="${MAKEINFO} -o $PACKAGE.info \"$srcfile\"" +cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\"" echo "Generating info files... ($cmd)" eval "$cmd" mkdir -p $outdir/ @@ -175,7 +185,7 @@ eval "$cmd" pdf_size=`calcsize $PACKAGE.pdf` mv $PACKAGE.pdf $outdir/ -cmd="${MAKEINFO} -o $PACKAGE.txt --no-split --no-headers \"$srcfile\"" +cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\"" echo "Generating ASCII... ($cmd)" eval "$cmd" ascii_size=`calcsize $PACKAGE.txt` @@ -183,7 +193,7 @@ gzip -f -9 -c $PACKAGE.txt >$outdir/$PAC ascii_gz_size=`calcsize $outdir/$PACKAGE.txt.gz` mv $PACKAGE.txt $outdir/ -cmd="${MAKEINFO} --no-split --html -o $PACKAGE.html $html \"$srcfile\"" +cmd="$SETLANG $MAKEINFO --no-split --html -o $PACKAGE.html $html \"$srcfile\"" echo "Generating monolithic html... ($cmd)" rm -rf $PACKAGE.html # in case a directory is left over eval "$cmd" @@ -192,7 +202,7 @@ gzip -f -9 -c $PACKAGE.html >$outdir/$PA html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz` mv $PACKAGE.html $outdir/ -cmd="${MAKEINFO} --html -o $PACKAGE.html $html \"$srcfile\"" +cmd="$SETLANG $MAKEINFO --html -o $PACKAGE.html $html \"$srcfile\"" echo "Generating html by node... ($cmd)" eval "$cmd" split_html_dir=$PACKAGE.html @@ -212,7 +222,7 @@ tar cvzfh $outdir/$PACKAGE.texi.tar.gz $ texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz` if test -n "$docbook"; then - cmd="${MAKEINFO} -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml" + cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml" echo "Generating docbook XML... $(cmd)" eval "$cmd" docbook_xml_size=`calcsize $PACKAGE-db.xml` diff -ruNp m4-1.4.9/lib/Makefile.am m4-1.4.10/lib/Makefile.am --- m4-1.4.9/lib/Makefile.am 2007-03-23 06:52:16.000000000 -0600 +++ m4-1.4.10/lib/Makefile.am 2007-07-09 21:13:55.000000000 -0600 @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 avltree-oset binary-io clean-temp cloexec close-stream closeout config-h error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io verror version-etc-fsf xalloc xvasprintf +# Reproduce by: gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --with-tests --no-libtool --macro-prefix=M4 assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer free fseeko gendocs getopt gnupload gpl-3.0 mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io vasprintf-posix verror version-etc version-etc-fsf xalloc xvasprintf AUTOMAKE_OPTIONS = 1.5 gnits @@ -34,6 +34,15 @@ libm4_a_LIBADD = $(M4_LIBOBJS) libm4_a_DEPENDENCIES = $(M4_LIBOBJS) EXTRA_libm4_a_SOURCES = +## begin gnulib module absolute-header + +# Use this preprocessor expression to decide whether #include_next works. +# Do not rely on a 'configure'-time test for this, since the expression +# might appear in an installed header, which is used by some other compiler. +HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER) + +## end gnulib module absolute-header + ## begin gnulib module alloca @@ -62,13 +71,17 @@ EXTRA_DIST += alloca_.h ## end gnulib module alloca-opt -## begin gnulib module allocsa +## begin gnulib module array-list + +libm4_a_SOURCES += gl_array_list.h gl_array_list.c + +## end gnulib module array-list -libm4_a_SOURCES += allocsa.h allocsa.c +## begin gnulib module array-oset -EXTRA_DIST += allocsa.valgrind +libm4_a_SOURCES += gl_array_oset.h gl_array_oset.c -## end gnulib module allocsa +## end gnulib module array-oset ## begin gnulib module avltree-oset @@ -106,6 +119,15 @@ EXTRA_libm4_a_SOURCES += close-stream.c ## end gnulib module close-stream +## begin gnulib module closein + + +EXTRA_DIST += closein.c closein.h + +EXTRA_libm4_a_SOURCES += closein.c + +## end gnulib module closein + ## begin gnulib module closeout @@ -195,6 +217,35 @@ libm4_a_SOURCES += fatal-signal.h fatal- ## end gnulib module fatal-signal +## begin gnulib module fflush + + +EXTRA_DIST += fflush.c + +EXTRA_libm4_a_SOURCES += fflush.c + +## end gnulib module fflush + +## begin gnulib module float + +BUILT_SOURCES += $(FLOAT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +float.h: float_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ + < $(srcdir)/float_.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += float.h float.h-t + +EXTRA_DIST += float_.h + +## end gnulib module float + ## begin gnulib module fopen-safer @@ -213,6 +264,29 @@ EXTRA_libm4_a_SOURCES += __fpending.c ## end gnulib module fpending +## begin gnulib module fpucw + + +EXTRA_DIST += fpucw.h + +## end gnulib module fpucw + +## begin gnulib module fpurge + +libm4_a_SOURCES += fpurge.c + +EXTRA_DIST += fpurge.h + +## end gnulib module fpurge + +## begin gnulib module freading + +libm4_a_SOURCES += freading.c + +EXTRA_DIST += freading.h + +## end gnulib module freading + ## begin gnulib module free @@ -222,6 +296,33 @@ EXTRA_libm4_a_SOURCES += free.c ## end gnulib module free +## begin gnulib module frexpl-nolibm + + +EXTRA_DIST += frexp.c frexpl.c + +EXTRA_libm4_a_SOURCES += frexp.c frexpl.c + +## end gnulib module frexpl-nolibm + +## begin gnulib module fseeko + + +EXTRA_DIST += fseeko.c + +EXTRA_libm4_a_SOURCES += fseeko.c + +## end gnulib module fseeko + +## begin gnulib module ftello + + +EXTRA_DIST += ftello.c + +EXTRA_libm4_a_SOURCES += ftello.c + +## end gnulib module ftello + ## begin gnulib module getopt BUILT_SOURCES += $(GETOPT_H) @@ -256,6 +357,40 @@ EXTRA_libm4_a_SOURCES += gettimeofday.c ## end gnulib module gettimeofday +## begin gnulib module intprops + + +EXTRA_DIST += intprops.h + +## end gnulib module intprops + +## begin gnulib module isnan-nolibm + + +EXTRA_DIST += float+.h isnan.c isnan.h + +EXTRA_libm4_a_SOURCES += isnan.c + +## end gnulib module isnan-nolibm + +## begin gnulib module isnanf-nolibm + + +EXTRA_DIST += float+.h isnan.c isnanf.c isnanf.h + +EXTRA_libm4_a_SOURCES += isnan.c isnanf.c + +## end gnulib module isnanf-nolibm + +## begin gnulib module isnanl-nolibm + + +EXTRA_DIST += float+.h isnan.c isnanl-nolibm.h isnanl.c + +EXTRA_libm4_a_SOURCES += isnan.c isnanl.c + +## end gnulib module isnanl-nolibm + ## begin gnulib module link-warning LINK_WARNING_H=$(top_srcdir)/./link-warning.h @@ -332,6 +467,15 @@ EXTRA_DIST += config.charset ref-add.sin ## end gnulib module localcharset +## begin gnulib module lseek + + +EXTRA_DIST += lseek.c + +EXTRA_libm4_a_SOURCES += lseek.c + +## end gnulib module lseek + ## begin gnulib module malloc @@ -341,6 +485,57 @@ EXTRA_libm4_a_SOURCES += malloc.c ## end gnulib module malloc +## begin gnulib module malloca + +libm4_a_SOURCES += malloca.c + +EXTRA_DIST += malloca.h malloca.valgrind + +## end gnulib module malloca + +## begin gnulib module math + +BUILT_SOURCES += math.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +math.h: math_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_MATH_H''@|$(NEXT_MATH_H)|g' \ + -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \ + -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \ + -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \ + -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \ + -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \ + -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ + -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ + -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ + -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \ + -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \ + -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \ + -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \ + -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ + -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ + -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ + -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ + -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ + -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ + -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \ + -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \ + -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \ + -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/math_.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += math.h math.h-t + +EXTRA_DIST += math_.h + +## end gnulib module math + ## begin gnulib module mkdtemp @@ -381,6 +576,30 @@ EXTRA_DIST += pathmax.h ## end gnulib module pathmax +## begin gnulib module printf-frexp + +libm4_a_SOURCES += printf-frexp.c + +EXTRA_DIST += printf-frexp.h + +## end gnulib module printf-frexp + +## begin gnulib module printf-frexpl + +libm4_a_SOURCES += printf-frexpl.c + +EXTRA_DIST += printf-frexp.c printf-frexpl.h + +EXTRA_libm4_a_SOURCES += printf-frexp.c + +## end gnulib module printf-frexpl + +## begin gnulib module progname + +libm4_a_SOURCES += progname.h progname.c + +## end gnulib module progname + ## begin gnulib module quotearg @@ -399,10 +618,43 @@ EXTRA_libm4_a_SOURCES += regcomp.c regex ## end gnulib module regex +## begin gnulib module signal + +BUILT_SOURCES += signal.h + +# We need the following in order to create when the system +# doesn't have a complete one. +signal.h: signal_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ + -e 's|@''GNULIB_SIGPROCMASK''@|$(GNULIB_SIGPROCMASK)|g' \ + -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ + -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/signal_.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += signal.h signal.h-t + +EXTRA_DIST += signal_.h + +## end gnulib module signal + +## begin gnulib module signbit + + +EXTRA_DIST += float+.h signbitd.c signbitf.c signbitl.c + +EXTRA_libm4_a_SOURCES += signbitd.c signbitf.c signbitl.c + +## end gnulib module signbit + ## begin gnulib module sigprocmask -EXTRA_DIST += sigprocmask.c sigprocmask.h +EXTRA_DIST += sigprocmask.c EXTRA_libm4_a_SOURCES += sigprocmask.c @@ -442,7 +694,8 @@ stdint.h: stdint_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ @@ -471,6 +724,58 @@ EXTRA_DIST += stdint_.h ## end gnulib module stdint +## begin gnulib module stdio + +BUILT_SOURCES += stdio.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdio.h: stdio_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ + -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ + -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ + -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ + -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ + -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ + -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ + -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ + -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ + -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ + -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ + -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ + -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ + -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ + -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ + -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ + -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ + -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ + -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ + -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ + -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ + -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ + -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ + -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ + -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ + -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ + -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/stdio_.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += stdio.h stdio.h-t + +EXTRA_DIST += stdio_.h + +## end gnulib module stdio + ## begin gnulib module stdlib BUILT_SOURCES += stdlib.h @@ -480,7 +785,8 @@ BUILT_SOURCES += stdlib.h stdlib.h: stdlib_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''ABSOLUTE_STDLIB_H''@|$(ABSOLUTE_STDLIB_H)|g' \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ @@ -521,18 +827,22 @@ BUILT_SOURCES += $(SYS_STAT_H) # We need the following in order to create when the system # has one that is incomplete. -sys/stat.h: stat_.h +sys/stat.h: sys_stat_.h @MKDIR_P@ sys rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ - < $(srcdir)/stat_.h; \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ + -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \ + -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ + -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \ + < $(srcdir)/sys_stat_.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t MOSTLYCLEANDIRS += sys -EXTRA_DIST += stat_.h +EXTRA_DIST += sys_stat_.h ## end gnulib module sys_stat @@ -547,7 +857,8 @@ sys/time.h: sys_time_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \ - -e 's|@''ABSOLUTE_SYS_TIME_H''@|$(ABSOLUTE_SYS_TIME_H)|g' \ + -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ < $(srcdir)/sys_time_.h; \ @@ -584,21 +895,28 @@ unistd.h: unistd_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ - -e 's|@''ABSOLUTE_UNISTD_H''@|$(ABSOLUTE_UNISTD_H)|g' \ + -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ + -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ + -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ + -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ + -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ + -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ < $(srcdir)/unistd_.h; \ } > $@-t mv $@-t $@ @@ -627,7 +945,7 @@ EXTRA_DIST += unlocked-io.h ## begin gnulib module vasnprintf -EXTRA_DIST += asnprintf.c printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h +EXTRA_DIST += asnprintf.c float+.h printf-args.c printf-args.h printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h EXTRA_libm4_a_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c @@ -636,7 +954,7 @@ EXTRA_libm4_a_SOURCES += asnprintf.c pri ## begin gnulib module vasprintf -EXTRA_DIST += asprintf.c vasprintf.c vasprintf.h +EXTRA_DIST += asprintf.c vasprintf.c EXTRA_libm4_a_SOURCES += asprintf.c vasprintf.c @@ -675,7 +993,13 @@ BUILT_SOURCES += $(WCHAR_H) wchar.h: wchar_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''ABSOLUTE_WCHAR_H''@|$(ABSOLUTE_WCHAR_H)|g' \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ + -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ + -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/wchar_.h; \ } > $@-t mv $@-t $@ @@ -695,8 +1019,9 @@ wctype.h: wctype_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ - -e 's|@''ABSOLUTE_WCTYPE_H''@|$(ABSOLUTE_WCTYPE_H)|g' \ - -e 's/@''HAVE_WCTYPE_CTMP_BUG''@/$(HAVE_WCTYPE_CTMP_BUG)/g' \ + -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ < $(srcdir)/wctype_.h; \ } > $@-t @@ -722,11 +1047,13 @@ libm4_a_SOURCES += xalloc-die.c ## end gnulib module xalloc-die -## begin gnulib module xallocsa +## begin gnulib module xmalloca + +libm4_a_SOURCES += xmalloca.c -libm4_a_SOURCES += xallocsa.h xallocsa.c +EXTRA_DIST += xmalloca.h -## end gnulib module xallocsa +## end gnulib module xmalloca ## begin gnulib module xsize @@ -748,4 +1075,5 @@ mostlyclean-local: mostlyclean-generic if test -n "$$dir" && test -d $$dir; then \ echo "rmdir $$dir"; rmdir $$dir; \ fi; \ - done + done; \ + : diff -ruNp m4-1.4.9/lib/Makefile.in m4-1.4.10/lib/Makefile.in --- m4-1.4.9/lib/Makefile.in 2007-03-23 07:32:35.000000000 -0600 +++ m4-1.4.10/lib/Makefile.in 2007-07-09 21:15:33.000000000 -0600 @@ -23,7 +23,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 avltree-oset binary-io clean-temp cloexec close-stream closeout config-h error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io verror version-etc-fsf xalloc xvasprintf +# Reproduce by: gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --with-tests --no-libtool --macro-prefix=M4 assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer free fseeko gendocs getopt gnupload gpl-3.0 mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io vasprintf-posix verror version-etc version-etc-fsf xalloc xvasprintf @@ -49,36 +49,48 @@ subdir = lib DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.hin alloca.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ - $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/closein.m4 \ $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ - $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ - $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ - $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/inline.m4 \ + $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ + $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ + $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ + $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/localcharset.m4 \ - $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ - $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ - $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ - $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ + $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/printf-frexp.m4 \ + $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ + $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ + $(top_srcdir)/m4/sig_atomic_t.m4 $(top_srcdir)/m4/signal_h.m4 \ + $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/signbit.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ @@ -94,13 +106,16 @@ AR = ar ARFLAGS = cru libm4_a_AR = $(AR) $(ARFLAGS) am__DEPENDENCIES_1 = -am_libm4_a_OBJECTS = allocsa.$(OBJEXT) gl_avltree_oset.$(OBJEXT) \ - clean-temp.$(OBJEXT) fatal-signal.$(OBJEXT) \ +am_libm4_a_OBJECTS = gl_array_list.$(OBJEXT) gl_array_oset.$(OBJEXT) \ + gl_avltree_oset.$(OBJEXT) clean-temp.$(OBJEXT) \ + fatal-signal.$(OBJEXT) fpurge.$(OBJEXT) freading.$(OBJEXT) \ gl_linkedhash_list.$(OBJEXT) gl_list.$(OBJEXT) \ - localcharset.$(OBJEXT) gl_oset.$(OBJEXT) tmpdir.$(OBJEXT) \ - verror.$(OBJEXT) version-etc.$(OBJEXT) \ - version-etc-fsf.$(OBJEXT) xalloc-die.$(OBJEXT) \ - xallocsa.$(OBJEXT) xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT) + localcharset.$(OBJEXT) malloca.$(OBJEXT) gl_oset.$(OBJEXT) \ + printf-frexp.$(OBJEXT) printf-frexpl.$(OBJEXT) \ + progname.$(OBJEXT) tmpdir.$(OBJEXT) verror.$(OBJEXT) \ + version-etc.$(OBJEXT) version-etc-fsf.$(OBJEXT) \ + xalloc-die.$(OBJEXT) xmalloca.$(OBJEXT) xvasprintf.$(OBJEXT) \ + xasprintf.$(OBJEXT) libm4_a_OBJECTS = $(am_libm4_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) DEFAULT_INCLUDES = -I.@am__isrc@ @@ -116,13 +131,6 @@ HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ -ABSOLUTE_STDLIB_H = @ABSOLUTE_STDLIB_H@ -ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ -ABSOLUTE_SYS_TIME_H = @ABSOLUTE_SYS_TIME_H@ -ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@ -ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@ -ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ @@ -150,30 +158,80 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ +FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREXP = @GNULIB_FREXP@ +GNULIB_FREXPL = @GNULIB_FREXPL@ +GNULIB_FSEEK = @GNULIB_FSEEK@ +GNULIB_FSEEKO = @GNULIB_FSEEKO@ +GNULIB_FTELL = @GNULIB_FTELL@ +GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LDEXPL = @GNULIB_LDEXPL@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ +GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ +GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ +GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ +GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ +GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ +HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ +HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ +HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ +HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ +HAVE_DECL_SINL = @HAVE_DECL_SINL@ +HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ +HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_FSEEKO = @HAVE_FSEEKO@ +HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_IO_H = @HAVE_IO_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SIGSET_T = @HAVE_SIGSET_T@ +HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ @@ -182,24 +240,40 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_VASPRINTF = @HAVE_VASPRINTF@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE__BOOL = @HAVE__BOOL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ +NEXT_FLOAT_H = @NEXT_FLOAT_H@ +NEXT_MATH_H = @NEXT_MATH_H@ +NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDIO_H = @NEXT_STDIO_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -212,9 +286,30 @@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREXP = @REPLACE_FREXP@ +REPLACE_FREXPL = @REPLACE_FREXPL@ +REPLACE_FSEEK = @REPLACE_FSEEK@ +REPLACE_FSEEKO = @REPLACE_FSEEKO@ +REPLACE_FTELL = @REPLACE_FTELL@ +REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ +REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ +REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ +REPLACE_VPRINTF = @REPLACE_VPRINTF@ +REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ +REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ @@ -282,55 +377,73 @@ AUTOMAKE_OPTIONS = 1.5 gnits noinst_HEADERS = noinst_LIBRARIES = libm4.a noinst_LTLIBRARIES = -EXTRA_DIST = alloca.c alloca_.h allocsa.valgrind cloexec.c cloexec.h \ - close-stream.c close-stream.h closeout.c closeout.h error.c \ - error.h exitfail.c exitfail.h fopen-safer.c stdio--.h \ - stdio-safer.h __fpending.c __fpending.h free.c getopt.c \ - getopt1.c getopt_.h getopt_int.h gettimeofday.c config.charset \ - ref-add.sin ref-del.sin malloc.c mkdtemp.c mkstemp.c obstack.c \ - obstack.h pathmax.h quotearg.c quotearg.h regcomp.c regex.c \ - regex.h regex_internal.c regex_internal.h regexec.c \ - sigprocmask.c sigprocmask.h stdbool_.h stdint_.h stdlib_.h \ - mkstemp-safer.c stdlib--.h stdlib-safer.h strtol.c stat_.h \ - sys_time_.h tempname.c tempname.h unistd_.h dup-safer.c \ - fd-safer.c pipe-safer.c unistd--.h unistd-safer.h \ - unlocked-io.h asnprintf.c printf-args.c printf-args.h \ - printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h \ - asprintf.c vasprintf.c vasprintf.h wchar_.h wctype_.h xalloc.h \ - xmalloc.c xalloc.h -BUILT_SOURCES = $(ALLOCA_H) configmake.h $(GETOPT_H) $(STDBOOL_H) \ - $(STDINT_H) stdlib.h $(SYS_STAT_H) $(SYS_TIME_H) unistd.h \ - $(WCHAR_H) $(WCTYPE_H) +EXTRA_DIST = alloca.c alloca_.h cloexec.c cloexec.h close-stream.c \ + close-stream.h closein.c closein.h closeout.c closeout.h \ + error.c error.h exitfail.c exitfail.h fflush.c float_.h \ + fopen-safer.c stdio--.h stdio-safer.h __fpending.c \ + __fpending.h fpucw.h fpurge.h freading.h free.c frexp.c \ + frexpl.c fseeko.c ftello.c getopt.c getopt1.c getopt_.h \ + getopt_int.h gettimeofday.c intprops.h float+.h isnan.c \ + isnan.h float+.h isnan.c isnanf.c isnanf.h float+.h isnan.c \ + isnanl-nolibm.h isnanl.c config.charset ref-add.sin \ + ref-del.sin lseek.c malloc.c malloca.h malloca.valgrind \ + math_.h mkdtemp.c mkstemp.c obstack.c obstack.h pathmax.h \ + printf-frexp.h printf-frexp.c printf-frexpl.h quotearg.c \ + quotearg.h regcomp.c regex.c regex.h regex_internal.c \ + regex_internal.h regexec.c signal_.h float+.h signbitd.c \ + signbitf.c signbitl.c sigprocmask.c stdbool_.h stdint_.h \ + stdio_.h stdlib_.h mkstemp-safer.c stdlib--.h stdlib-safer.h \ + strtol.c sys_stat_.h sys_time_.h tempname.c tempname.h \ + unistd_.h dup-safer.c fd-safer.c pipe-safer.c unistd--.h \ + unistd-safer.h unlocked-io.h asnprintf.c float+.h \ + printf-args.c printf-args.h printf-parse.c printf-parse.h \ + vasnprintf.c vasnprintf.h asprintf.c vasprintf.c wchar_.h \ + wctype_.h xalloc.h xmalloc.c xmalloca.h xalloc.h +BUILT_SOURCES = $(ALLOCA_H) configmake.h $(FLOAT_H) $(GETOPT_H) math.h \ + signal.h $(STDBOOL_H) $(STDINT_H) stdio.h stdlib.h \ + $(SYS_STAT_H) $(SYS_TIME_H) unistd.h $(WCHAR_H) $(WCTYPE_H) SUFFIXES = .sed .sin -MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t getopt.h \ - getopt.h-t stdbool.h stdbool.h-t stdint.h stdint.h-t stdlib.h \ - stdlib.h-t sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t \ - unistd.h unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t +MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t float.h \ + float.h-t getopt.h getopt.h-t math.h math.h-t signal.h \ + signal.h-t stdbool.h stdbool.h-t stdint.h stdint.h-t stdio.h \ + stdio.h-t stdlib.h stdlib.h-t sys/stat.h sys/stat.h-t \ + sys/time.h sys/time.h-t unistd.h unistd.h-t wchar.h wchar.h-t \ + wctype.h wctype.h-t MOSTLYCLEANDIRS = sys CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \ ref-del.sed DISTCLEANFILES = MAINTAINERCLEANFILES = AM_CPPFLAGS = -libm4_a_SOURCES = allocsa.h allocsa.c gl_avltree_oset.h \ - gl_avltree_oset.c gl_anytree_oset.h binary-io.h clean-temp.h \ - clean-temp.c fatal-signal.h fatal-signal.c gettext.h \ +libm4_a_SOURCES = gl_array_list.h gl_array_list.c gl_array_oset.h \ + gl_array_oset.c gl_avltree_oset.h gl_avltree_oset.c \ + gl_anytree_oset.h binary-io.h clean-temp.h clean-temp.c \ + fatal-signal.h fatal-signal.c fpurge.c freading.c gettext.h \ gl_linkedhash_list.h gl_linkedhash_list.c gl_anyhash_list1.h \ gl_anyhash_list2.h gl_anylinked_list1.h gl_anylinked_list2.h \ - gl_list.h gl_list.c localcharset.h localcharset.c gl_oset.h \ - gl_oset.c size_max.h tmpdir.h tmpdir.c verify.h verror.h \ + gl_list.h gl_list.c localcharset.h localcharset.c malloca.c \ + gl_oset.h gl_oset.c printf-frexp.c printf-frexpl.c progname.h \ + progname.c size_max.h tmpdir.h tmpdir.c verify.h verror.h \ verror.c version-etc.h version-etc.c version-etc-fsf.c \ - xalloc-die.c xallocsa.h xallocsa.c xsize.h xvasprintf.h \ - xvasprintf.c xasprintf.c + xalloc-die.c xmalloca.c xsize.h xvasprintf.h xvasprintf.c \ + xasprintf.c libm4_a_LIBADD = $(M4_LIBOBJS) @ALLOCA@ libm4_a_DEPENDENCIES = $(M4_LIBOBJS) @ALLOCA@ -EXTRA_libm4_a_SOURCES = alloca.c cloexec.c close-stream.c closeout.c \ - error.c exitfail.c fopen-safer.c __fpending.c free.c getopt.c \ - getopt1.c gettimeofday.c malloc.c mkdtemp.c mkstemp.c \ - obstack.c quotearg.c regcomp.c regex.c regex_internal.c \ - regexec.c sigprocmask.c mkstemp-safer.c strtol.c tempname.c \ - dup-safer.c fd-safer.c pipe-safer.c asnprintf.c printf-args.c \ +EXTRA_libm4_a_SOURCES = alloca.c cloexec.c close-stream.c closein.c \ + closeout.c error.c exitfail.c fflush.c fopen-safer.c \ + __fpending.c free.c frexp.c frexpl.c fseeko.c ftello.c \ + getopt.c getopt1.c gettimeofday.c isnan.c isnan.c isnanf.c \ + isnan.c isnanl.c lseek.c malloc.c mkdtemp.c mkstemp.c \ + obstack.c printf-frexp.c quotearg.c regcomp.c regex.c \ + regex_internal.c regexec.c signbitd.c signbitf.c signbitl.c \ + sigprocmask.c mkstemp-safer.c strtol.c tempname.c dup-safer.c \ + fd-safer.c pipe-safer.c asnprintf.c printf-args.c \ printf-parse.c vasnprintf.c asprintf.c vasprintf.c xmalloc.c + +# Use this preprocessor expression to decide whether #include_next works. +# Do not rely on a 'configure'-time test for this, since the expression +# might appear in an installed header, which is used by some other compiler. +HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER) LINK_WARNING_H = $(top_srcdir)/./link-warning.h charset_alias = $(DESTDIR)$(libdir)/charset.alias charset_tmp = $(DESTDIR)$(libdir)/charset.tmp @@ -411,41 +524,61 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/__fpending.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloca.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocsa.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clean-temp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close-stream.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closein.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closeout.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fatal-signal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fflush.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fopen-safer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fpurge.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freading.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/free.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frexp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frexpl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fseeko.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftello.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_array_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_array_oset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_avltree_oset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_linkedhash_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_oset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnan.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnanf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isnanl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lseek.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdtemp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkstemp-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkstemp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obstack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipe-safer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-args.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-frexp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-frexpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printf-parse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quotearg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regcomp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex_internal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regexec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signbitd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signbitf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signbitl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigprocmask.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tempname.Po@am__quote@ @@ -456,9 +589,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version-etc-fsf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version-etc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xallocsa.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xasprintf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloca.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xvasprintf.Po@am__quote@ .c.o: @@ -719,6 +852,17 @@ configmake.h: Makefile } | sed '/""/d' > $@-t mv $@-t $@ +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +float.h: float_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ + < $(srcdir)/float_.h; \ + } > $@-t + mv $@-t $@ + # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt_.h @@ -770,6 +914,55 @@ charset.alias: config.charset sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@ mv t-$@ $@ +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +math.h: math_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_MATH_H''@|$(NEXT_MATH_H)|g' \ + -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \ + -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \ + -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \ + -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \ + -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \ + -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \ + -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \ + -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \ + -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \ + -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \ + -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \ + -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \ + -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ + -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ + -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ + -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ + -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ + -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ + -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \ + -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \ + -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \ + -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/math_.h; \ + } > $@-t + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have a complete one. +signal.h: signal_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ + -e 's|@''GNULIB_SIGPROCMASK''@|$(GNULIB_SIGPROCMASK)|g' \ + -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ + -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/signal_.h; \ + } > $@-t + mv $@-t $@ + # We need the following in order to create when the system # doesn't have one that works. stdbool.h: stdbool_.h @@ -785,7 +978,8 @@ stdint.h: stdint_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ + -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ @@ -809,12 +1003,56 @@ stdint.h: stdint_.h } > $@-t mv $@-t $@ +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdio.h: stdio_.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ + -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ + -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ + -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ + -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ + -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ + -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ + -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ + -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ + -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ + -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ + -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ + -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ + -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ + -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ + -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ + -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ + -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ + -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ + -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ + -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ + -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ + -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ + -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ + -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ + -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ + -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ + -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ + < $(srcdir)/stdio_.h; \ + } > $@-t + mv $@-t $@ + # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdlib.h: stdlib_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''ABSOLUTE_STDLIB_H''@|$(ABSOLUTE_STDLIB_H)|g' \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ @@ -828,12 +1066,16 @@ stdlib.h: stdlib_.h # We need the following in order to create when the system # has one that is incomplete. -sys/stat.h: stat_.h +sys/stat.h: sys_stat_.h @MKDIR_P@ sys rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \ - < $(srcdir)/stat_.h; \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ + -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \ + -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ + -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \ + < $(srcdir)/sys_stat_.h; \ } > $@-t mv $@-t $@ @@ -844,7 +1086,8 @@ sys/time.h: sys_time_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \ - -e 's|@''ABSOLUTE_SYS_TIME_H''@|$(ABSOLUTE_SYS_TIME_H)|g' \ + -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ < $(srcdir)/sys_time_.h; \ @@ -857,21 +1100,28 @@ unistd.h: unistd_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ - -e 's|@''ABSOLUTE_UNISTD_H''@|$(ABSOLUTE_UNISTD_H)|g' \ + -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ + -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ + -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ + -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ + -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ + -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ < $(srcdir)/unistd_.h; \ } > $@-t mv $@-t $@ @@ -881,7 +1131,13 @@ unistd.h: unistd_.h wchar.h: wchar_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''ABSOLUTE_WCHAR_H''@|$(ABSOLUTE_WCHAR_H)|g' \ + sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ + -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ + -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/wchar_.h; \ } > $@-t mv $@-t $@ @@ -892,8 +1148,9 @@ wctype.h: wctype_.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ - -e 's|@''ABSOLUTE_WCTYPE_H''@|$(ABSOLUTE_WCTYPE_H)|g' \ - -e 's/@''HAVE_WCTYPE_CTMP_BUG''@/$(HAVE_WCTYPE_CTMP_BUG)/g' \ + -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ + -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ < $(srcdir)/wctype_.h; \ } > $@-t @@ -904,7 +1161,8 @@ mostlyclean-local: mostlyclean-generic if test -n "$$dir" && test -d $$dir; then \ echo "rmdir $$dir"; rmdir $$dir; \ fi; \ - done + done; \ + : # 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 -ruNp m4-1.4.9/lib/alloca_.h m4-1.4.10/lib/alloca_.h --- m4-1.4.9/lib/alloca_.h 2007-03-23 06:50:39.000000000 -0600 +++ m4-1.4.10/lib/alloca_.h 2007-05-30 19:30:14.000000000 -0600 @@ -1,6 +1,6 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006 Free Software + Copyright (C) 1995, 1999, 2001-2004, 2006-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -20,8 +20,8 @@ /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H means there is a real alloca function. */ -#ifndef _GNULIB_ALLOCA_H -# define _GNULIB_ALLOCA_H +#ifndef _GL_ALLOCA_H +#define _GL_ALLOCA_H /* alloca (N) returns a pointer to N bytes of memory allocated on the stack, which will last until the function returns. @@ -51,4 +51,4 @@ void *alloca (size_t); # endif #endif -#endif /* _GNULIB_ALLOCA_H */ +#endif /* _GL_ALLOCA_H */ diff -ruNp m4-1.4.9/lib/allocsa.c m4-1.4.10/lib/allocsa.c --- m4-1.4.9/lib/allocsa.c 2007-03-23 06:50:39.000000000 -0600 +++ m4-1.4.10/lib/allocsa.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,137 +0,0 @@ -/* Safe automatic memory allocation. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. - Written by Bruno Haible , 2003. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include - -/* Specification. */ -#include "allocsa.h" - -/* The speed critical point in this file is freesa() applied to an alloca() - result: it must be fast, to match the speed of alloca(). The speed of - mallocsa() and freesa() in the other case are not critical, because they - are only invoked for big memory sizes. */ - -#if HAVE_ALLOCA - -/* Store the mallocsa() results in a hash table. This is needed to reliably - distinguish a mallocsa() result and an alloca() result. - - Although it is possible that the same pointer is returned by alloca() and - by mallocsa() at different times in the same application, it does not lead - to a bug in freesa(), because: - - Before a pointer returned by alloca() can point into malloc()ed memory, - the function must return, and once this has happened the programmer must - not call freesa() on it anyway. - - Before a pointer returned by mallocsa() can point into the stack, it - must be freed. The only function that can free it is freesa(), and - when freesa() frees it, it also removes it from the hash table. */ - -#define MAGIC_NUMBER 0x1415fb4a -#define MAGIC_SIZE sizeof (int) -/* This is how the header info would look like without any alignment - considerations. */ -struct preliminary_header { void *next; char room[MAGIC_SIZE]; }; -/* But the header's size must be a multiple of sa_alignment_max. */ -#define HEADER_SIZE \ - (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max) -struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; }; -/* Verify that HEADER_SIZE == sizeof (struct header). */ -typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1]; -/* We make the hash table quite big, so that during lookups the probability - of empty hash buckets is quite high. There is no need to make the hash - table resizable, because when the hash table gets filled so much that the - lookup becomes slow, it means that the application has memory leaks. */ -#define HASH_TABLE_SIZE 257 -static void * mallocsa_results[HASH_TABLE_SIZE]; - -#endif - -void * -mallocsa (size_t n) -{ -#if HAVE_ALLOCA - /* Allocate one more word, that serves as an indicator for malloc()ed - memory, so that freesa() of an alloca() result is fast. */ - size_t nplus = n + HEADER_SIZE; - - if (nplus >= n) - { - char *p = (char *) malloc (nplus); - - if (p != NULL) - { - size_t slot; - - p += HEADER_SIZE; - - /* Put a magic number into the indicator word. */ - ((int *) p)[-1] = MAGIC_NUMBER; - - /* Enter p into the hash table. */ - slot = (unsigned long) p % HASH_TABLE_SIZE; - ((struct header *) (p - HEADER_SIZE))->next = mallocsa_results[slot]; - mallocsa_results[slot] = p; - - return p; - } - } - /* Out of memory. */ - return NULL; -#else -# if !MALLOC_0_IS_NONNULL - if (n == 0) - n = 1; -# endif - return malloc (n); -#endif -} - -#if HAVE_ALLOCA -void -freesa (void *p) -{ - /* mallocsa() may have returned NULL. */ - if (p != NULL) - { - /* Attempt to quickly distinguish the mallocsa() result - which has - a magic indicator word - and the alloca() result - which has an - uninitialized indicator word. It is for this test that sa_increment - additional bytes are allocated in the alloca() case. */ - if (((int *) p)[-1] == MAGIC_NUMBER) - { - /* Looks like a mallocsa() result. To see whether it really is one, - perform a lookup in the hash table. */ - size_t slot = (unsigned long) p % HASH_TABLE_SIZE; - void **chain = &mallocsa_results[slot]; - for (; *chain != NULL;) - { - if (*chain == p) - { - /* Found it. Remove it from the hash table and free it. */ - char *p_begin = (char *) p - HEADER_SIZE; - *chain = ((struct header *) p_begin)->next; - free (p_begin); - return; - } - chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next; - } - } - /* At this point, we know it was not a mallocsa() result. */ - } -} -#endif diff -ruNp m4-1.4.9/lib/allocsa.h m4-1.4.10/lib/allocsa.h --- m4-1.4.9/lib/allocsa.h 2007-03-23 06:50:40.000000000 -0600 +++ m4-1.4.10/lib/allocsa.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,128 +0,0 @@ -/* Safe automatic memory allocation. - Copyright (C) 2003-2007 Free Software Foundation, Inc. - Written by Bruno Haible , 2003. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _ALLOCSA_H -#define _ALLOCSA_H - -#include -#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call - alloca(N); otherwise it returns NULL. It either returns N bytes of - memory allocated on the stack, that lasts until the function returns, - or NULL. - Use of safe_alloca should be avoided: - - inside arguments of function calls - undefined behaviour, - - in inline functions - the allocation may actually last until the - calling function returns. -*/ -#if HAVE_ALLOCA -/* The OS usually guarantees only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - allocate anything larger than 4096 bytes. Also care for the possibility - of a few compiler-allocated temporary stack slots. - This must be a macro, not an inline function. */ -# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL) -#else -# define safe_alloca(N) ((N), NULL) -#endif - -/* allocsa(N) is a safe variant of alloca(N). It allocates N bytes of - memory allocated on the stack, that must be freed using freesa() before - the function returns. Upon failure, it returns NULL. */ -#if HAVE_ALLOCA -# define allocsa(N) \ - ((N) < 4032 - sa_increment \ - ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ - : mallocsa (N)) -#else -# define allocsa(N) \ - mallocsa (N) -#endif -extern void * mallocsa (size_t n); - -/* Free a block of memory allocated through allocsa(). */ -#if HAVE_ALLOCA -extern void freesa (void *p); -#else -# define freesa free -#endif - -/* Maybe we should also define a variant - nallocsa (size_t n, size_t s) - behaves like allocsa (n * s) - If this would be useful in your application. please speak up. */ - - -#ifdef __cplusplus -} -#endif - - -/* ------------------- Auxiliary, non-public definitions ------------------- */ - -/* Determine the alignment of a type at compile time. */ -#if defined __GNUC__ -# define sa_alignof __alignof__ -#elif defined __cplusplus - template struct sa_alignof_helper { char __slot1; type __slot2; }; -# define sa_alignof(type) offsetof (sa_alignof_helper, __slot2) -#elif defined __hpux - /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof - values. */ -# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) -#elif defined _AIX - /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof - values. */ -# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) -#else -# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) -#endif - -enum -{ -/* The desired alignment of memory allocations is the maximum alignment - among all elementary types. */ - sa_alignment_long = sa_alignof (long), - sa_alignment_double = sa_alignof (double), -#if HAVE_LONG_LONG_INT - sa_alignment_longlong = sa_alignof (long long), -#endif -#if HAVE_LONG_DOUBLE - sa_alignment_longdouble = sa_alignof (long double), -#endif - sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) -#if HAVE_LONG_LONG_INT - | (sa_alignment_longlong - 1) -#endif -#if HAVE_LONG_DOUBLE - | (sa_alignment_longdouble - 1) -#endif - ) + 1, -/* The increment that guarantees room for a magic word must be >= sizeof (int) - and a multiple of sa_alignment_max. */ - sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max -}; - -#endif /* _ALLOCSA_H */ diff -ruNp m4-1.4.9/lib/allocsa.valgrind m4-1.4.10/lib/allocsa.valgrind --- m4-1.4.9/lib/allocsa.valgrind 2007-03-23 06:50:40.000000000 -0600 +++ m4-1.4.10/lib/allocsa.valgrind 1969-12-31 17:00:00.000000000 -0700 @@ -1,7 +0,0 @@ -# Suppress a valgrind message about use of uninitialized memory in freesa(). -# This use is OK because it provides only a speedup. -{ - freesa - Memcheck:Cond - fun:freesa -} diff -ruNp m4-1.4.9/lib/asprintf.c m4-1.4.10/lib/asprintf.c --- m4-1.4.9/lib/asprintf.c 2007-03-23 06:50:40.000000000 -0600 +++ m4-1.4.10/lib/asprintf.c 2007-05-30 19:30:14.000000000 -0600 @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,11 @@ #include /* Specification. */ -#include "vasprintf.h" +#ifdef IN_LIBASPRINTF +# include "vasprintf.h" +#else +# include +#endif #include diff -ruNp m4-1.4.9/lib/clean-temp.c m4-1.4.10/lib/clean-temp.c --- m4-1.4.9/lib/clean-temp.c 2007-03-23 06:50:41.000000000 -0600 +++ m4-1.4.10/lib/clean-temp.c 2007-07-05 05:47:52.000000000 -0600 @@ -40,7 +40,7 @@ #include "pathmax.h" #include "tmpdir.h" #include "xalloc.h" -#include "xallocsa.h" +#include "xmalloca.h" #include "gl_linkedhash_list.h" #include "gettext.h" #if GNULIB_FWRITEERROR @@ -327,7 +327,7 @@ create_temp_dir (const char *prefix, con false); /* Create the temporary directory. */ - xtemplate = (char *) xallocsa (PATH_MAX); + xtemplate = (char *) xmalloca (PATH_MAX); if (path_search (xtemplate, PATH_MAX, parentdir, prefix, parentdir == NULL)) { error (0, errno, @@ -354,11 +354,11 @@ create_temp_dir (const char *prefix, con block because then the cleanup handler would not remove the directory if xstrdup fails. */ tmpdir->dirname = xstrdup (tmpdirname); - freesa (xtemplate); + freea (xtemplate); return (struct temp_dir *) tmpdir; quit: - freesa (xtemplate); + freea (xtemplate); return NULL; } @@ -665,14 +665,14 @@ fopen_temp (const char *file_name, const if (supports_delete_on_close ()) { size_t mode_len = strlen (mode); - char *augmented_mode = (char *) xallocsa (mode_len + 2); + char *augmented_mode = (char *) xmalloca (mode_len + 2); memcpy (augmented_mode, mode, mode_len); memcpy (augmented_mode + mode_len, "D", 2); fp = fopen (file_name, augmented_mode); saved_errno = errno; - freesa (augmented_mode); + freea (augmented_mode); } else #endif diff -ruNp m4-1.4.9/lib/closein.c m4-1.4.10/lib/closein.c --- m4-1.4.9/lib/closein.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/closein.c 2007-05-30 19:30:16.000000000 -0600 @@ -0,0 +1,105 @@ +/* Close standard input, rewinding seekable stdin if necessary. + + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#include "closein.h" + +#include +#include +#include +#include + +#include "gettext.h" +#define _(msgid) gettext (msgid) + +#include "close-stream.h" +#include "closeout.h" +#include "error.h" +#include "exitfail.h" +#include "quotearg.h" + +static const char *file_name; + +/* Set the file name to be reported in the event an error is detected + on stdin by close_stdin. See also close_stdout_set_file_name, if + an error is detected when closing stdout. */ +void +close_stdin_set_file_name (const char *file) +{ + file_name = file; +} + +/* Close standard input, rewinding any unused input if stdin is + seekable. On error, issue a diagnostic and _exit with status + 'exit_failure'. Then call close_stdout. + + Most programs can get by with close_stdout. close_stdin is only + needed when a program wants to guarantee that partially read input + from seekable stdin is not consumed, for any subsequent clients. + For example, POSIX requires that these two commands behave alike: + + (sed -ne 1q; cat) < file + tail -n 1 file + + Since close_stdin is commonly registered via 'atexit', POSIX + and the C standard both say that it should not call 'exit', + because the behavior is undefined if 'exit' is called more than + once. So it calls '_exit' instead of 'exit'. If close_stdin + is registered via atexit before other functions are registered, + the other functions can act before this _exit is invoked. + + Applications that use close_stdout should flush any streams other + than stdin, stdout, and stderr before exiting, since the call to + _exit will bypass other buffer flushing. Applications should be + flushing and closing other streams anyway, to check for I/O errors. + Also, applications should not use tmpfile, since _exit can bypass + the removal of these files. + + It's important to detect such failures and exit nonzero because many + tools (most notably `make' and other build-management systems) depend + on being able to detect failure in other tools via their exit status. */ + +void +close_stdin (void) +{ + bool fail = false; + + /* Only attempt flush if stdin is seekable, as fflush is entitled to + fail on non-seekable streams. */ + if (fseeko (stdin, 0, SEEK_CUR) == 0 && fflush (stdin) != 0) + fail = true; + if (close_stream (stdin) != 0) + fail = true; + if (fail) + { + /* Report failure, but defer exit until after closing stdout, + since the failure report should still be flushed. */ + char const *close_error = _("error closing file"); + if (file_name) + error (0, errno, "%s: %s", quotearg_colon (file_name), + close_error); + else + error (0, errno, "%s", close_error); + } + + close_stdout (); + + if (fail) + _exit (exit_failure); +} diff -ruNp m4-1.4.9/lib/closein.h m4-1.4.10/lib/closein.h --- m4-1.4.9/lib/closein.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/closein.h 2007-05-30 19:30:16.000000000 -0600 @@ -0,0 +1,33 @@ +/* Close standard input, rewinding seekable stdin if necessary. + + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_CLOSEIN_H +# define _GL_CLOSEIN_H 1 + +# ifdef __cplusplus +extern "C" { +# endif + +void close_stdin_set_file_name (const char *file); +void close_stdin (void); + +# ifdef __cplusplus +} +# endif + +#endif diff -ruNp m4-1.4.9/lib/config.hin m4-1.4.10/lib/config.hin --- m4-1.4.9/lib/config.hin 2007-03-23 07:35:12.000000000 -0600 +++ m4-1.4.10/lib/config.hin 2007-07-09 21:15:22.000000000 -0600 @@ -1,26 +1,5 @@ /* lib/config.hin. Generated from configure.ac by autoheader. */ -/* Define this to an absolute name of . */ -#undef ABSOLUTE_STDINT_H - -/* Define this to an absolute name of . */ -#undef ABSOLUTE_STDLIB_H - -/* Define this to an absolute name of . */ -#undef ABSOLUTE_SYS_STAT_H - -/* Define this to an absolute name of . */ -#undef ABSOLUTE_SYS_TIME_H - -/* Define this to an absolute name of . */ -#undef ABSOLUTE_UNISTD_H - -/* Define this to an absolute name of . */ -#undef ABSOLUTE_WCHAR_H - -/* Define this to an absolute name of . */ -#undef ABSOLUTE_WCTYPE_H - /* Define to the number of bits in type 'ptrdiff_t'. */ #undef BITSIZEOF_PTRDIFF_T @@ -36,6 +15,10 @@ /* Define to the number of bits in type 'wint_t'. */ #undef BITSIZEOF_WINT_T +/* Define if you wish *printf() functions that have a safe handling of + non-IEEE-754 'long double' values. */ +#undef CHECK_PRINTF_SAFE + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ @@ -44,12 +27,38 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA +/* Define as the bit index in the word where to find bit 0 of the exponent of + 'double'. */ +#undef DBL_EXPBIT0_BIT + +/* Define as the word index where to find the exponent of 'double'. */ +#undef DBL_EXPBIT0_WORD + +/* Define as the bit index in the word where to find the sign of 'double'. */ +#undef DBL_SIGNBIT_BIT + +/* Define as the word index where to find the sign of 'double'. */ +#undef DBL_SIGNBIT_WORD + /* Define to 1 if the changeword(REGEXP) functionality is wanted */ #undef ENABLE_CHANGEWORD /* Define as good substitute value for EOVERFLOW. */ #undef EOVERFLOW +/* Define as the bit index in the word where to find bit 0 of the exponent of + 'float'. */ +#undef FLT_EXPBIT0_BIT + +/* Define as the word index where to find the exponent of 'float'. */ +#undef FLT_EXPBIT0_WORD + +/* Define as the bit index in the word where to find the sign of 'float'. */ +#undef FLT_SIGNBIT_BIT + +/* Define as the word index where to find the sign of 'float'. */ +#undef FLT_SIGNBIT_WORD + /* Define to 1 if the return value of system() disagrees with pclose(). */ #undef FUNC_SYSTEM_BROKEN @@ -70,10 +79,34 @@ includes only if HAVE_ALLOCA_H is defined. */ #undef HAVE_ALLOCA_H +/* Define if the copysignf function is declared in and available in + libc. */ +#undef HAVE_COPYSIGNF_IN_LIBC + +/* Define if the copysignl function is declared in and available in + libc. */ +#undef HAVE_COPYSIGNL_IN_LIBC + +/* Define if the copysign function is declared in and available in + libc. */ +#undef HAVE_COPYSIGN_IN_LIBC + /* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_CLEARERR_UNLOCKED +/* Define to 1 if you have the declaration of `copysign', and to 0 if you + don't. */ +#undef HAVE_DECL_COPYSIGN + +/* Define to 1 if you have the declaration of `copysignf', and to 0 if you + don't. */ +#undef HAVE_DECL_COPYSIGNF + +/* Define to 1 if you have the declaration of `copysignl', and to 0 if you + don't. */ +#undef HAVE_DECL_COPYSIGNL + /* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FEOF_UNLOCKED @@ -90,6 +123,10 @@ you don't. */ #undef HAVE_DECL_FGETS_UNLOCKED +/* Define to 1 if you have the declaration of `fpurge', and to 0 if you don't. + */ +#undef HAVE_DECL_FPURGE + /* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_FPUTC_UNLOCKED @@ -138,10 +175,29 @@ don't. */ #undef HAVE_DECL_STRERROR_R +/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you + don't. */ +#undef HAVE_DECL__SNPRINTF + /* Define to 1 if you have the declaration of `__fpending', and to 0 if you don't. */ #undef HAVE_DECL___FPENDING +/* Define to 1 if you have the header file. */ +#undef HAVE_FLOAT_H + +/* Define to 1 if you have the `fpurge' function. */ +#undef HAVE_FPURGE + +/* Define if the frexpl function is available in libc. */ +#undef HAVE_FREXPL_IN_LIBC + +/* Define if the frexp function is available in libc. */ +#undef HAVE_FREXP_IN_LIBC + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#undef HAVE_FSEEKO + /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H @@ -151,6 +207,9 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY +/* Define if your compiler supports the #include_next directive. */ +#undef HAVE_INCLUDE_NEXT + /* Define to 1 if the compiler supports one of the keywords 'inline', '__inline__', '__inline' and effectively inlines functions marked as such. */ @@ -169,6 +228,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_IO_H +/* Define to 1 if you have the `isblank' function. */ +#undef HAVE_ISBLANK + +/* Define if the isnan(float) function is available in libc. */ +#undef HAVE_ISNANF_IN_LIBC + +/* Define if the isnan(long double) function is available in libc. */ +#undef HAVE_ISNANL_IN_LIBC + +/* Define if the isnan(double) function is available in libc. */ +#undef HAVE_ISNAN_IN_LIBC + /* Define to 1 if you have the `iswcntrl' function. */ #undef HAVE_ISWCNTRL @@ -178,15 +249,18 @@ /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET +/* Define if the ldexpl function is available in libc. */ +#undef HAVE_LDEXPL_IN_LIBC + +/* Define if the ldexp function is available in libc. */ +#undef HAVE_LDEXP_IN_LIBC + /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H -/* Define if you have the 'long double' type. */ -#undef HAVE_LONG_DOUBLE - /* Define if you have the 'long long' type. */ #undef HAVE_LONG_LONG @@ -200,6 +274,9 @@ to 0 otherwise. */ #undef HAVE_MALLOC +/* Define to 1 if you have the header file. */ +#undef HAVE_MATH_H + /* Define to 1 if you have the `mbrtowc' function. */ #undef HAVE_MBRTOWC @@ -215,15 +292,15 @@ /* Define to 1 if you have the `mkdtemp' function. */ #undef HAVE_MKDTEMP +/* Define to 1 if you have the `nl_langinfo' function. */ +#undef HAVE_NL_LANGINFO + /* Define to 1 if libc includes obstacks. */ #undef HAVE_OBSTACK /* Define to 1 if you have the `pipe' function. */ #undef HAVE_PIPE -/* Define to 1 if you have the sigset_t type and the sigprocmask function. */ -#undef HAVE_POSIX_SIGNALBLOCKING - /* Define to 1 if the system has the type `ptrdiff_t'. */ #undef HAVE_PTRDIFF_T @@ -248,6 +325,9 @@ /* Define to 1 if the system has the type `siginfo_t'. */ #undef HAVE_SIGINFO_T +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + /* Define to 1 if 'sig_atomic_t' is a signed integer type. */ #undef HAVE_SIGNED_SIG_ATOMIC_T @@ -257,8 +337,7 @@ /* Define to 1 if 'wint_t' is a signed integer type. */ #undef HAVE_SIGNED_WINT_T -/* Define to 1 if you lack the sigprocmask function but have the sigset_t - type. */ +/* Define to 1 if the system has the type `sigset_t'. */ #undef HAVE_SIGSET_T /* Define to 1 if you have the `sigstack' function. */ @@ -292,6 +371,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_EXT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -379,12 +461,66 @@ /* Define to 1 if you have the `__fpending' function. */ #undef HAVE___FPENDING +/* Define to 1 if you have the `__fpurge' function. */ +#undef HAVE___FPURGE + +/* Define to 1 if you have the `__freading' function. */ +#undef HAVE___FREADING + /* Define to 1 if you have the `__secure_getenv' function. */ #undef HAVE___SECURE_GETENV +/* Define as the bit index in the word where to find bit 0 of the exponent of + 'long double'. */ +#undef LDBL_EXPBIT0_BIT + +/* Define as the word index where to find the exponent of 'long double'. */ +#undef LDBL_EXPBIT0_WORD + +/* Define as the bit index in the word where to find the sign of 'long + double'. */ +#undef LDBL_SIGNBIT_BIT + +/* Define as the word index where to find the sign of 'long double'. */ +#undef LDBL_SIGNBIT_WORD + +/* Define to 1 if lseek does not detect pipes. */ +#undef LSEEK_PIPE_BROKEN + /* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ #undef MALLOC_0_IS_NONNULL +/* Define to 1 if assertions should be disabled. */ +#undef NDEBUG + +/* Define if the vasnprintf implementation needs special code for the 'a' and + 'A' directives. */ +#undef NEED_PRINTF_DIRECTIVE_A + +/* Define if the vasnprintf implementation needs special code for the 'F' + directive. */ +#undef NEED_PRINTF_DIRECTIVE_F + +/* Define if the vasnprintf implementation needs special code for the ' flag. + */ +#undef NEED_PRINTF_FLAG_GROUPING + +/* Define if the vasnprintf implementation needs special code for the 0 flag. + */ +#undef NEED_PRINTF_FLAG_ZERO + +/* Define if the vasnprintf implementation needs special code for infinite + 'double' arguments. */ +#undef NEED_PRINTF_INFINITE_DOUBLE + +/* Define if the vasnprintf implementation needs special code for infinite + 'long double' arguments. */ +#undef NEED_PRINTF_INFINITE_LONG_DOUBLE + +/* Define if the vasnprintf implementation needs special code for 'long + double' arguments. */ +#undef NEED_PRINTF_LONG_DOUBLE + /* Name of package */ #undef PACKAGE @@ -413,9 +549,6 @@ /* Define if vasnprintf exists but is overridden by gnulib. */ #undef REPLACE_VASNPRINTF -/* Define if vasprintf exists but is overridden by gnulib. */ -#undef REPLACE_VASPRINTF - /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE @@ -488,6 +621,9 @@ # undef _GNU_SOURCE #endif +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +#undef _LARGEFILE_SOURCE + /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES diff -ruNp m4-1.4.9/lib/fatal-signal.c m4-1.4.10/lib/fatal-signal.c --- m4-1.4.9/lib/fatal-signal.c 2007-03-23 06:50:44.000000000 -0600 +++ m4-1.4.10/lib/fatal-signal.c 2007-05-30 19:30:18.000000000 -0600 @@ -1,5 +1,5 @@ /* Emergency actions in case of a fatal signal. - Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software; you can redistribute it and/or modify @@ -27,7 +27,6 @@ #include #include -#include "sigprocmask.h" #include "xalloc.h" #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) diff -ruNp m4-1.4.9/lib/fflush.c m4-1.4.10/lib/fflush.c --- m4-1.4.9/lib/fflush.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/fflush.c 2007-05-30 19:30:18.000000000 -0600 @@ -0,0 +1,91 @@ +/* fflush.c -- allow flushing input streams + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake. */ + +#include + +/* Specification. */ +#include + +#include +#include + +#include "freading.h" +#include "fpurge.h" + +#undef fflush + +/* Flush all pending data on STREAM according to POSIX rules. Both + output and seekable input streams are supported. */ +int +rpl_fflush (FILE *stream) +{ + int result; + off_t pos; + + /* When stream is NULL, POSIX and C99 only require flushing of "output + streams and update streams in which the most recent operation was not + input", and all implementations do this. + + When stream is "an output stream or an update stream in which the most + recent operation was not input", POSIX and C99 requires that fflush + writes out any buffered data, and all implementations do this. + + When stream is, however, an input stream or an update stream in + which the most recent operation was input, C99 specifies nothing, + and POSIX only specifies behavior if the stream is seekable. + mingw, in particular, drops the input buffer, leaving the file + descriptor positioned at the end of the input buffer. I.e. ftell + (stream) is lost. We don't want to call the implementation's + fflush in this case. + + We test ! freading (stream) here, rather than fwriting (stream), because + what we need to know is whether the stream holds a "read buffer", and on + mingw this is indicated by _IOREAD, regardless of _IOWRT. */ + if (stream == NULL || ! freading (stream)) + return fflush (stream); + + /* POSIX does not specify fflush behavior for non-seekable input + streams. Some implementations purge unread data, some return + EBADF, some do nothing. */ + pos = ftello (stream); + if (pos == -1) + { + errno = EBADF; + return EOF; + } + + /* To get here, we must be flushing a seekable input stream, so the + semantics of fpurge are now appropriate to clear the buffer. To + avoid losing data, the lseek is also necessary. */ + result = fpurge (stream); + if (result != 0) + return result; + + pos = lseek (fileno (stream), pos, SEEK_SET); + if (pos == -1) + return EOF; + /* After a successful lseek, update the file descriptor's position cache + in the stream. */ +#if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ + stream->_offset = pos; + stream->_flags |= __SOFF; +#endif + + return 0; +} diff -ruNp m4-1.4.9/lib/float+.h m4-1.4.10/lib/float+.h --- m4-1.4.9/lib/float+.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/float+.h 2007-05-30 19:30:19.000000000 -0600 @@ -0,0 +1,148 @@ +/* Supplemental information about the floating-point formats. + Copyright (C) 2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2007. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _FLOATPLUS_H +#define _FLOATPLUS_H + +#include +#include + +/* Number of bits in the mantissa of a floating-point number, including the + "hidden bit". */ +#if FLT_RADIX == 2 +# define FLT_MANT_BIT FLT_MANT_DIG +# define DBL_MANT_BIT DBL_MANT_DIG +# define LDBL_MANT_BIT LDBL_MANT_DIG +#elif FLT_RADIX == 4 +# define FLT_MANT_BIT (FLT_MANT_DIG * 2) +# define DBL_MANT_BIT (DBL_MANT_DIG * 2) +# define LDBL_MANT_BIT (LDBL_MANT_DIG * 2) +#elif FLT_RADIX == 16 +# define FLT_MANT_BIT (FLT_MANT_DIG * 4) +# define DBL_MANT_BIT (DBL_MANT_DIG * 4) +# define LDBL_MANT_BIT (LDBL_MANT_DIG * 4) +#endif + +/* Bit mask that can be used to mask the exponent, as an unsigned number. */ +#define FLT_EXP_MASK ((FLT_MAX_EXP - FLT_MIN_EXP) | 7) +#define DBL_EXP_MASK ((DBL_MAX_EXP - DBL_MIN_EXP) | 7) +#define LDBL_EXP_MASK ((LDBL_MAX_EXP - LDBL_MIN_EXP) | 7) + +/* Number of bits used for the exponent of a floating-point number, including + the exponent's sign. */ +#define FLT_EXP_BIT \ + (FLT_EXP_MASK < 0x100 ? 8 : \ + FLT_EXP_MASK < 0x200 ? 9 : \ + FLT_EXP_MASK < 0x400 ? 10 : \ + FLT_EXP_MASK < 0x800 ? 11 : \ + FLT_EXP_MASK < 0x1000 ? 12 : \ + FLT_EXP_MASK < 0x2000 ? 13 : \ + FLT_EXP_MASK < 0x4000 ? 14 : \ + FLT_EXP_MASK < 0x8000 ? 15 : \ + FLT_EXP_MASK < 0x10000 ? 16 : \ + FLT_EXP_MASK < 0x20000 ? 17 : \ + FLT_EXP_MASK < 0x40000 ? 18 : \ + FLT_EXP_MASK < 0x80000 ? 19 : \ + FLT_EXP_MASK < 0x100000 ? 20 : \ + FLT_EXP_MASK < 0x200000 ? 21 : \ + FLT_EXP_MASK < 0x400000 ? 22 : \ + FLT_EXP_MASK < 0x800000 ? 23 : \ + FLT_EXP_MASK < 0x1000000 ? 24 : \ + FLT_EXP_MASK < 0x2000000 ? 25 : \ + FLT_EXP_MASK < 0x4000000 ? 26 : \ + FLT_EXP_MASK < 0x8000000 ? 27 : \ + FLT_EXP_MASK < 0x10000000 ? 28 : \ + FLT_EXP_MASK < 0x20000000 ? 29 : \ + FLT_EXP_MASK < 0x40000000 ? 30 : \ + FLT_EXP_MASK <= 0x7fffffff ? 31 : \ + 32) +#define DBL_EXP_BIT \ + (DBL_EXP_MASK < 0x100 ? 8 : \ + DBL_EXP_MASK < 0x200 ? 9 : \ + DBL_EXP_MASK < 0x400 ? 10 : \ + DBL_EXP_MASK < 0x800 ? 11 : \ + DBL_EXP_MASK < 0x1000 ? 12 : \ + DBL_EXP_MASK < 0x2000 ? 13 : \ + DBL_EXP_MASK < 0x4000 ? 14 : \ + DBL_EXP_MASK < 0x8000 ? 15 : \ + DBL_EXP_MASK < 0x10000 ? 16 : \ + DBL_EXP_MASK < 0x20000 ? 17 : \ + DBL_EXP_MASK < 0x40000 ? 18 : \ + DBL_EXP_MASK < 0x80000 ? 19 : \ + DBL_EXP_MASK < 0x100000 ? 20 : \ + DBL_EXP_MASK < 0x200000 ? 21 : \ + DBL_EXP_MASK < 0x400000 ? 22 : \ + DBL_EXP_MASK < 0x800000 ? 23 : \ + DBL_EXP_MASK < 0x1000000 ? 24 : \ + DBL_EXP_MASK < 0x2000000 ? 25 : \ + DBL_EXP_MASK < 0x4000000 ? 26 : \ + DBL_EXP_MASK < 0x8000000 ? 27 : \ + DBL_EXP_MASK < 0x10000000 ? 28 : \ + DBL_EXP_MASK < 0x20000000 ? 29 : \ + DBL_EXP_MASK < 0x40000000 ? 30 : \ + DBL_EXP_MASK <= 0x7fffffff ? 31 : \ + 32) +#define LDBL_EXP_BIT \ + (LDBL_EXP_MASK < 0x100 ? 8 : \ + LDBL_EXP_MASK < 0x200 ? 9 : \ + LDBL_EXP_MASK < 0x400 ? 10 : \ + LDBL_EXP_MASK < 0x800 ? 11 : \ + LDBL_EXP_MASK < 0x1000 ? 12 : \ + LDBL_EXP_MASK < 0x2000 ? 13 : \ + LDBL_EXP_MASK < 0x4000 ? 14 : \ + LDBL_EXP_MASK < 0x8000 ? 15 : \ + LDBL_EXP_MASK < 0x10000 ? 16 : \ + LDBL_EXP_MASK < 0x20000 ? 17 : \ + LDBL_EXP_MASK < 0x40000 ? 18 : \ + LDBL_EXP_MASK < 0x80000 ? 19 : \ + LDBL_EXP_MASK < 0x100000 ? 20 : \ + LDBL_EXP_MASK < 0x200000 ? 21 : \ + LDBL_EXP_MASK < 0x400000 ? 22 : \ + LDBL_EXP_MASK < 0x800000 ? 23 : \ + LDBL_EXP_MASK < 0x1000000 ? 24 : \ + LDBL_EXP_MASK < 0x2000000 ? 25 : \ + LDBL_EXP_MASK < 0x4000000 ? 26 : \ + LDBL_EXP_MASK < 0x8000000 ? 27 : \ + LDBL_EXP_MASK < 0x10000000 ? 28 : \ + LDBL_EXP_MASK < 0x20000000 ? 29 : \ + LDBL_EXP_MASK < 0x40000000 ? 30 : \ + LDBL_EXP_MASK <= 0x7fffffff ? 31 : \ + 32) + +/* Number of bits used for a floating-point number: the mantissa (not + counting the "hidden bit", since it may or may not be explicit), the + exponent, and the sign. */ +#define FLT_TOTAL_BIT ((FLT_MANT_BIT - 1) + FLT_EXP_BIT + 1) +#define DBL_TOTAL_BIT ((DBL_MANT_BIT - 1) + DBL_EXP_BIT + 1) +#define LDBL_TOTAL_BIT ((LDBL_MANT_BIT - 1) + LDBL_EXP_BIT + 1) + +/* Number of bytes used for a floating-point number. + This can be smaller than the 'sizeof'. For example, on i386 systems, + 'long double' most often have LDBL_MANT_BIT = 64, LDBL_EXP_BIT = 16, hence + LDBL_TOTAL_BIT = 80 bits, i.e. 10 bytes of consecutive memory, but + sizeof (long double) = 12 or = 16. */ +#define SIZEOF_FLT ((FLT_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) +#define SIZEOF_DBL ((DBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) +#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT) + +/* Verify that SIZEOF_FLT <= sizeof (float) etc. */ +typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1]; +typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1]; +typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1]; + +#endif /* _FLOATPLUS_H */ diff -ruNp m4-1.4.9/lib/float_.h m4-1.4.10/lib/float_.h --- m4-1.4.9/lib/float_.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/float_.h 2007-07-05 05:47:59.000000000 -0600 @@ -0,0 +1,59 @@ +/* A correct . + + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_FLOAT_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_FLOAT_H@ + +#ifndef _GL_FLOAT_H +#define _GL_FLOAT_H + +/* 'long double' properties. */ +#if defined __i386__ && defined __BEOS__ +/* Number of mantissa units, in base FLT_RADIX. */ +# undef LDBL_MANT_DIG +# define LDBL_MANT_DIG 64 +/* Number of decimal digits that is sufficient for representing a number. */ +# undef LDBL_DIG +# define LDBL_DIG 18 +/* x-1 where x is the smallest representable number > 1. */ +# undef LDBL_EPSILON +# define LDBL_EPSILON 1.0842021724855044340E-19L +/* Minimum e such that FLT_RADIX^(e-1) is a normalized number. */ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number. */ +# undef LDBL_MAX_EXP +# define LDBL_MAX_EXP 16384 +/* Minimum positive normalized number. */ +# undef LDBL_MIN +# define LDBL_MIN 3.3621031431120935063E-4932L +/* Maximum representable finite number. */ +# undef LDBL_MAX +# define LDBL_MAX 1.1897314953572317650E+4932L +/* Minimum e such that 10^e is in the range of normalized numbers. */ +# undef LDBL_MIN_10_EXP +# define LDBL_MIN_10_EXP (-4931) +/* Maximum e such that 10^e is in the range of representable finite numbers. */ +# undef LDBL_MAX_10_EXP +# define LDBL_MAX_10_EXP 4932 +#endif + +#endif /* _GL_FLOAT_H */ +#endif /* _GL_FLOAT_H */ diff -ruNp m4-1.4.9/lib/fpucw.h m4-1.4.10/lib/fpucw.h --- m4-1.4.9/lib/fpucw.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/fpucw.h 2007-05-30 19:30:19.000000000 -0600 @@ -0,0 +1,108 @@ +/* Manipulating the FPU control word. + Copyright (C) 2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2007. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _FPUCW_H +#define _FPUCW_H + +/* The i386 floating point hardware (the 387 compatible FPU, not the modern + SSE/SSE2 hardware) has a controllable rounding precision. It is specified + through the 'PC' bits in the FPU control word ('fctrl' register). (See + the GNU libc i386 header for details.) + + On some platforms, such as Linux or Solaris, the default precision setting + is set to "extended precision". This means that 'long double' instructions + operate correctly, but 'double' computations often produce slightly + different results as on strictly IEEE 754 conforming systems. + + On some platforms, such as NetBSD, the default precision is set to + "double precision". This means that 'long double' instructions will operate + only as 'double', i.e. lead wrong results. + + The FPU control word is under control of the application, i.e. it is + not required to be set either way by the ABI. (In fact, the i386 ABI + http://refspecs.freestandards.org/elf/abi386-4.pdf page 3-12 = page 38 + is not clear about it. But in any case, gcc treats the control word + like a "preserved" register: it emits code that assumes that the control + word is preserved across calls, and it restores the control word at the + end of functions that modify it.) + + See Vincent Lefèvre's page http://www.vinc17.org/research/extended.en.html + for a good explanation. + See http://www.uwsg.iu.edu/hypermail/linux/kernel/0103.0/0453.html for + some argumentation which setting should be the default. */ + +/* This header file provides the following facilities: + fpucw_t integral type holding the value of 'fctrl' + FPU_PC_MASK bit mask denoting the precision control + FPU_PC_DOUBLE precision control for 53 bits mantissa + FPU_PC_EXTENDED precision control for 64 bits mantissa + GET_FPUCW () yields the current FPU control word + SET_FPUCW (word) sets the FPU control word + DECL_LONG_DOUBLE_ROUNDING variable declaration for + BEGIN/END_LONG_DOUBLE_ROUNDING + BEGIN_LONG_DOUBLE_ROUNDING () starts a sequence of instructions with + 'long double' safe operation precision + END_LONG_DOUBLE_ROUNDING () ends a sequence of instructions with + 'long double' safe operation precision + */ + +/* Inline assembler like this works only with GNU C. */ +#if defined __i386__ && defined __GNUC__ + +typedef unsigned short fpucw_t; /* glibc calls this fpu_control_t */ + +# define FPU_PC_MASK 0x0300 +# define FPU_PC_DOUBLE 0x200 /* glibc calls this _FPU_DOUBLE */ +# define FPU_PC_EXTENDED 0x300 /* glibc calls this _FPU_EXTENDED */ + +# define GET_FPUCW() \ + ({ fpucw_t _cw; \ + __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_cw)); \ + _cw; \ + }) +# define SET_FPUCW(word) \ + (void)({ fpucw_t _ncw = (word); \ + __asm__ __volatile__ ("fldcw %0" : : "m" (*&_ncw)); \ + }) + +# define DECL_LONG_DOUBLE_ROUNDING \ + fpucw_t oldcw; +# define BEGIN_LONG_DOUBLE_ROUNDING() \ + (void)(oldcw = GET_FPUCW (), \ + SET_FPUCW ((oldcw & ~FPU_PC_MASK) | FPU_PC_EXTENDED)) +# define END_LONG_DOUBLE_ROUNDING() \ + SET_FPUCW (oldcw) + +#else + +typedef unsigned int fpucw_t; + +# define FPU_PC_MASK 0 +# define FPU_PC_DOUBLE 0 +# define FPU_PC_EXTENDED 0 + +# define GET_FPUCW() 0 +# define SET_FPUCW(word) (void)(word) + +# define DECL_LONG_DOUBLE_ROUNDING +# define BEGIN_LONG_DOUBLE_ROUNDING() +# define END_LONG_DOUBLE_ROUNDING() + +#endif + +#endif /* _FPUCW_H */ diff -ruNp m4-1.4.9/lib/fpurge.c m4-1.4.10/lib/fpurge.c --- m4-1.4.9/lib/fpurge.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/fpurge.c 2007-07-05 05:48:00.000000000 -0600 @@ -0,0 +1,112 @@ +/* Flushing buffers of a FILE stream. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "fpurge.h" + +#if HAVE___FPURGE /* glibc >= 2.2, Solaris >= 7 */ +# include +#endif +#include + +int +fpurge (FILE *fp) +{ +#if HAVE___FPURGE /* glibc >= 2.2, Solaris >= 7 */ + + __fpurge (fp); + /* The __fpurge function does not have a return value. */ + return 0; + +#elif HAVE_FPURGE /* FreeBSD, NetBSD, OpenBSD, MacOS X */ + + /* Call the system's fpurge function. */ +# undef fpurge +# if !HAVE_DECL_FPURGE + extern int fpurge (FILE *); +# endif + int result = fpurge (fp); +# if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ + if (result == 0) + /* Correct the invariants that fpurge broke. + on BSD systems says: + "The following always hold: if _flags & __SRD, _w is 0." + If this invariant is not fulfilled and the stream is read-write but + currently writing, subsequent putc or fputc calls will write directly + into the buffer, although they shouldn't be allowed to. */ + if ((fp->_flags & __SRD) != 0) + fp->_w = 0; +# endif + return result; + +#else + + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +# if defined _IO_ferror_unlocked /* GNU libc, BeOS */ + fp->_IO_read_end = fp->_IO_read_ptr; + fp->_IO_write_ptr = fp->_IO_write_base; + /* Avoid memory leak when there is an active ungetc buffer. */ + if (fp->_IO_save_base != NULL) + { + free (fp->_IO_save_base); + fp->_IO_save_base = NULL; + } + return 0; +# elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ + fp->_p = fp->_bf._base; + fp->_r = 0; + fp->_w = ((fp->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */ + ? fp->_bf._size + : 0); + /* Avoid memory leak when there is an active ungetc buffer. */ +# if defined __NetBSD__ || defined __OpenBSD__ /* NetBSD, OpenBSD */ + /* See + and */ +# define fp_ub ((struct { struct __sbuf _ub; } *) fp->_ext._base)->_ub +# else /* FreeBSD, MacOS X, Cygwin */ +# define fp_ub fp->_ub +# endif + if (fp_ub._base != NULL) + { + if (fp_ub._base != fp->_ubuf) + free (fp_ub._base); + fp_ub._base = NULL; + } + return 0; +# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ + fp->_ptr = fp->_base; + if (fp->_ptr != NULL) + fp->_cnt = 0; + return 0; +# elif defined __UCLIBC__ /* uClibc */ +# ifdef __STDIO_BUFFERS + if (fp->__modeflags & __FLAG_WRITING) + fp->__bufpos = fp->__bufstart; + else if (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) + fp->__bufpos = fp->__bufread; +# endif + return 0; +# else + #error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib." +# endif + +#endif +} diff -ruNp m4-1.4.9/lib/fpurge.h m4-1.4.10/lib/fpurge.h --- m4-1.4.9/lib/fpurge.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/fpurge.h 2007-05-30 19:30:20.000000000 -0600 @@ -0,0 +1,39 @@ +/* Flushing buffers of a FILE stream. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_FPURGE_H +#define _GL_FPURGE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Discard all pending buffered I/O on the stream STREAM. + STREAM must not be wide-character oriented. + Return 0 if successful. Upon error, return -1 and set errno. */ +#if HAVE_FPURGE +# define fpurge rpl_fpurge +#endif +extern int fpurge (FILE *stream); + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_FPURGE_H */ diff -ruNp m4-1.4.9/lib/freading.c m4-1.4.10/lib/freading.c --- m4-1.4.9/lib/freading.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/freading.c 2007-07-05 05:48:00.000000000 -0600 @@ -0,0 +1,48 @@ +/* Retrieve information about a FILE stream. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "freading.h" + +/* Don't use glibc's __freading function, see + */ +#if !(HAVE___FREADING && !defined __GLIBC__) + +bool +freading (FILE *fp) +{ + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ + return ((fp->_flags & _IO_NO_WRITES) != 0 + || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 + && fp->_IO_read_base != NULL)); +#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ + return (fp->_flags & __SRD) != 0; +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ + return (fp->_flag & _IOREAD) != 0; +#elif defined __UCLIBC__ /* uClibc */ + return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0; +#else + #error "Please port gnulib freading.c to your platform!" +#endif +} + +#endif diff -ruNp m4-1.4.9/lib/freading.h m4-1.4.10/lib/freading.h --- m4-1.4.9/lib/freading.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/freading.h 2007-05-30 19:30:20.000000000 -0600 @@ -0,0 +1,53 @@ +/* Retrieve information about a FILE stream. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include +#include + +/* Return true if the stream STREAM is opened read-only, or if the + last operation on the stream was a read operation. Return false if + the stream is opened write-only or append-only, or if it supports + writing and there is no current read operation (such as fputc). + + freading and fwriting will never both be true. If STREAM supports + both reads and writes, then: + - both freading and fwriting might be false when the stream is first + opened, after read encounters EOF, or after fflush, + - freading might be false or true and fwriting might be false + after repositioning (such as fseek, fsetpos, or rewind), + depending on the underlying implementation. + + STREAM must not be wide-character oriented. */ + +#if HAVE___FREADING && !defined __GLIBC__ /* Solaris >= 7, not glibc >= 2.2 */ + +# include +# define freading(stream) (__freading (stream) != 0) + +#else + +# ifdef __cplusplus +extern "C" { +# endif + +extern bool freading (FILE *stream); + +# ifdef __cplusplus +} +# endif + +#endif diff -ruNp m4-1.4.9/lib/frexp.c m4-1.4.10/lib/frexp.c --- m4-1.4.9/lib/frexp.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/frexp.c 2007-05-30 19:30:21.000000000 -0600 @@ -0,0 +1,167 @@ +/* Split a double into fraction and mantissa. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paolo Bonzini , 2003, and + Bruno Haible , 2007. */ + +#include + +/* Specification. */ +#include + +#include +#ifdef USE_LONG_DOUBLE +# include "isnanl-nolibm.h" +# include "fpucw.h" +#else +# include "isnan.h" +#endif + +/* This file assumes FLT_RADIX = 2. If FLT_RADIX is a power of 2 greater + than 2, or not even a power of 2, some rounding errors can occur, so that + then the returned mantissa is only guaranteed to be <= 1.0, not < 1.0. */ + +#ifdef USE_LONG_DOUBLE +# define FUNC frexpl +# define DOUBLE long double +# define ISNAN isnanl +# define DECL_ROUNDING DECL_LONG_DOUBLE_ROUNDING +# define BEGIN_ROUNDING() BEGIN_LONG_DOUBLE_ROUNDING () +# define END_ROUNDING() END_LONG_DOUBLE_ROUNDING () +# define L_(literal) literal##L +#else +# define FUNC frexp +# define DOUBLE double +# define ISNAN isnan +# define DECL_ROUNDING +# define BEGIN_ROUNDING() +# define END_ROUNDING() +# define L_(literal) literal +#endif + +DOUBLE +FUNC (DOUBLE x, int *exp) +{ + int sign; + int exponent; + DECL_ROUNDING + + /* Test for NaN, infinity, and zero. */ + if (ISNAN (x) || x + x == x) + { + *exp = 0; + return x; + } + + sign = 0; + if (x < 0) + { + x = - x; + sign = -1; + } + + BEGIN_ROUNDING (); + + { + /* Since the exponent is an 'int', it fits in 64 bits. Therefore the + loops are executed no more than 64 times. */ + DOUBLE pow2[64]; /* pow2[i] = 2^2^i */ + DOUBLE powh[64]; /* powh[i] = 2^-2^i */ + int i; + + exponent = 0; + if (x >= L_(1.0)) + { + /* A positive exponent. */ + DOUBLE pow2_i; /* = pow2[i] */ + DOUBLE powh_i; /* = powh[i] */ + + /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, + x * 2^exponent = argument, x >= 1.0. */ + for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); + ; + i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) + { + if (x >= pow2_i) + { + exponent += (1 << i); + x *= powh_i; + } + else + break; + + pow2[i] = pow2_i; + powh[i] = powh_i; + } + /* Avoid making x too small, as it could become a denormalized + number and thus lose precision. */ + while (i > 0 && x < pow2[i - 1]) + { + i--; + powh_i = powh[i]; + } + exponent += (1 << i); + x *= powh_i; + /* Here 2^-2^i <= x < 1.0. */ + } + else + { + /* A negative or zero exponent. */ + DOUBLE pow2_i; /* = pow2[i] */ + DOUBLE powh_i; /* = powh[i] */ + + /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, + x * 2^exponent = argument, x < 1.0. */ + for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); + ; + i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) + { + if (x < powh_i) + { + exponent -= (1 << i); + x *= pow2_i; + } + else + break; + + pow2[i] = pow2_i; + powh[i] = powh_i; + } + /* Here 2^-2^i <= x < 1.0. */ + } + + /* Invariants: x * 2^exponent = argument, and 2^-2^i <= x < 1.0. */ + while (i > 0) + { + i--; + if (x < powh[i]) + { + exponent -= (1 << i); + x *= pow2[i]; + } + } + /* Here 0.5 <= x < 1.0. */ + } + + if (sign < 0) + x = - x; + + END_ROUNDING (); + + *exp = exponent; + return x; +} diff -ruNp m4-1.4.9/lib/frexpl.c m4-1.4.10/lib/frexpl.c --- m4-1.4.9/lib/frexpl.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/frexpl.c 2007-05-30 19:30:21.000000000 -0600 @@ -0,0 +1,19 @@ +/* Split a 'long double' into fraction and mantissa. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define USE_LONG_DOUBLE +#include "frexp.c" diff -ruNp m4-1.4.9/lib/fseeko.c m4-1.4.10/lib/fseeko.c --- m4-1.4.9/lib/fseeko.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/fseeko.c 2007-07-05 05:48:02.000000000 -0600 @@ -0,0 +1,114 @@ +/* An fseeko() function that, together with fflush(), is POSIX compliant. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include + +/* Get off_t and lseek. */ +#include + +#undef fseeko +#if !HAVE_FSEEKO +# undef fseek +# define fseeko fseek +#endif + +int +rpl_fseeko (FILE *fp, off_t offset, int whence) +{ +#if LSEEK_PIPE_BROKEN + /* mingw gives bogus answers rather than failure on non-seekable files. */ + if (lseek (fileno (fp), 0, SEEK_CUR) == -1) + return EOF; +#endif + + /* These tests are based on fpurge.c. */ +#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ + if (fp->_IO_read_end == fp->_IO_read_ptr + && fp->_IO_write_ptr == fp->_IO_write_base + && fp->_IO_save_base == NULL) +#elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ +# if defined __NetBSD__ || defined __OpenBSD__ /* NetBSD, OpenBSD */ + /* See + and */ +# define fp_ub ((struct { struct __sbuf _ub; } *) fp->_ext._base)->_ub +# else /* FreeBSD, MacOS X, Cygwin */ +# define fp_ub fp->_ub +# endif +# if defined __SL64 && defined __SCLE /* Cygwin */ + if ((fp->_flags & __SL64) == 0) + { + /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit + mode; but has an fseeko that requires 64-bit mode. */ + FILE *tmp = fopen ("/dev/null", "r"); + if (!tmp) + return -1; + fp->_flags |= __SL64; + fp->_seek64 = tmp->_seek64; + fclose (tmp); + } +# endif + if (fp->_p == fp->_bf._base + && fp->_r == 0 + && fp->_w == ((fp->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */ + ? fp->_bf._size + : 0) + && fp_ub._base == NULL) +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +# if defined __sun && defined __sparc && defined _LP64 /* Solaris/SPARC 64-bit */ +# define fp_ ((struct { unsigned char *_ptr; \ + unsigned char *_base; \ + unsigned char *_end; \ + long _cnt; \ + } *) fp) + if (fp_->_ptr == fp_->_base + && (fp_->_ptr == NULL || fp_->_cnt == 0)) +# else + if (fp->_ptr == fp->_base + && (fp->_ptr == NULL || fp->_cnt == 0)) +# endif +#elif defined __UCLIBC__ /* uClibc */ + if (((fp->__modeflags & __FLAG_WRITING) == 0 + || fp->__bufpos == fp->__bufstart) + && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0 + || fp->__bufpos == fp->__bufread)) +#else + #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib." +#endif + { + off_t pos = lseek (fileno (fp), offset, whence); + if (pos == -1) + { +#if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ + fp->_flags &= ~__SOFF; +#endif + return -1; + } + else + { +#if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ + fp->_offset = pos; + fp->_flags |= __SOFF; +#endif + return 0; + } + } + else + return fseeko (fp, offset, whence); +} diff -ruNp m4-1.4.9/lib/ftello.c m4-1.4.10/lib/ftello.c --- m4-1.4.9/lib/ftello.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/ftello.c 2007-05-30 19:30:21.000000000 -0600 @@ -0,0 +1,55 @@ +/* An ftello() function that works around platform bugs. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include + +/* Get lseek. */ +#include + +#undef ftello +#if !HAVE_FTELLO +# undef ftell +# define ftello ftell +#endif + +off_t +rpl_ftello (FILE *fp) +{ +#if LSEEK_PIPE_BROKEN + /* mingw gives bogus answers rather than failure on non-seekable files. */ + if (lseek (fileno (fp), 0, SEEK_CUR) == -1) + return -1; +#endif + +#if defined __SL64 && defined __SCLE /* Cygwin */ + if ((fp->_flags & __SL64) == 0) + { + /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit + mode; but has an ftello that requires 64-bit mode. */ + FILE *tmp = fopen ("/dev/null", "r"); + if (!tmp) + return -1; + fp->_flags |= __SL64; + fp->_seek64 = tmp->_seek64; + fclose (tmp); + } +#endif + return ftello (fp); +} diff -ruNp m4-1.4.9/lib/gl_array_list.c m4-1.4.10/lib/gl_array_list.c --- m4-1.4.9/lib/gl_array_list.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/gl_array_list.c 2007-05-30 19:30:23.000000000 -0600 @@ -0,0 +1,647 @@ +/* Sequential list data type implemented by an array. + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "gl_array_list.h" + +#include +/* Get memcpy. */ +#include + +#include "xalloc.h" + +/* Checked size_t computations. */ +#include "xsize.h" + +#ifndef uintptr_t +# define uintptr_t unsigned long +#endif + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +/* Concrete gl_list_impl type, valid for this file only. */ +struct gl_list_impl +{ + struct gl_list_impl_base base; + /* An array of ALLOCATED elements, of which the first COUNT are used. + 0 <= COUNT <= ALLOCATED. */ + const void **elements; + size_t count; + size_t allocated; +}; + +/* struct gl_list_node_impl doesn't exist here. The pointers are actually + indices + 1. */ +#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t)(size_t)((index) + 1) +#define NODE_TO_INDEX(node) ((uintptr_t)(node) - 1) + +static gl_list_t +gl_array_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates) +{ + struct gl_list_impl *list = XMALLOC (struct gl_list_impl); + + list->base.vtable = implementation; + list->base.equals_fn = equals_fn; + list->base.hashcode_fn = hashcode_fn; + list->base.dispose_fn = dispose_fn; + list->base.allow_duplicates = allow_duplicates; + list->elements = NULL; + list->count = 0; + list->allocated = 0; + + return list; +} + +static gl_list_t +gl_array_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents) +{ + struct gl_list_impl *list = XMALLOC (struct gl_list_impl); + + list->base.vtable = implementation; + list->base.equals_fn = equals_fn; + list->base.hashcode_fn = hashcode_fn; + list->base.dispose_fn = dispose_fn; + list->base.allow_duplicates = allow_duplicates; + if (count > 0) + { + list->elements = XNMALLOC (count, const void *); + memcpy (list->elements, contents, count * sizeof (const void *)); + } + else + list->elements = NULL; + list->count = count; + list->allocated = count; + + return list; +} + +static size_t +gl_array_size (gl_list_t list) +{ + return list->count; +} + +static const void * +gl_array_node_value (gl_list_t list, gl_list_node_t node) +{ + uintptr_t index = NODE_TO_INDEX (node); + if (!(index < list->count)) + /* Invalid argument. */ + abort (); + return list->elements[index]; +} + +static gl_list_node_t +gl_array_next_node (gl_list_t list, gl_list_node_t node) +{ + uintptr_t index = NODE_TO_INDEX (node); + if (!(index < list->count)) + /* Invalid argument. */ + abort (); + index++; + if (index < list->count) + return INDEX_TO_NODE (index); + else + return NULL; +} + +static gl_list_node_t +gl_array_previous_node (gl_list_t list, gl_list_node_t node) +{ + uintptr_t index = NODE_TO_INDEX (node); + if (!(index < list->count)) + /* Invalid argument. */ + abort (); + if (index > 0) + return INDEX_TO_NODE (index - 1); + else + return NULL; +} + +static const void * +gl_array_get_at (gl_list_t list, size_t position) +{ + size_t count = list->count; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + return list->elements[position]; +} + +static gl_list_node_t +gl_array_set_at (gl_list_t list, size_t position, const void *elt) +{ + size_t count = list->count; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + list->elements[position] = elt; + return INDEX_TO_NODE (position); +} + +static size_t +gl_array_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + size_t count = list->count; + + if (!(start_index <= end_index && end_index <= count)) + /* Invalid arguments. */ + abort (); + + if (start_index < end_index) + { + gl_listelement_equals_fn equals = list->base.equals_fn; + if (equals != NULL) + { + size_t i; + + for (i = start_index;;) + { + if (equals (elt, list->elements[i])) + return i; + i++; + if (i == end_index) + break; + } + } + else + { + size_t i; + + for (i = start_index;;) + { + if (elt == list->elements[i]) + return i; + i++; + if (i == end_index) + break; + } + } + } + return (size_t)(-1); +} + +static gl_list_node_t +gl_array_search_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + size_t index = gl_array_indexof_from_to (list, start_index, end_index, elt); + return INDEX_TO_NODE (index); +} + +/* Ensure that list->allocated > list->count. */ +static void +grow (gl_list_t list) +{ + size_t new_allocated; + size_t memory_size; + const void **memory; + + new_allocated = xtimes (list->allocated, 2); + new_allocated = xsum (new_allocated, 1); + memory_size = xtimes (new_allocated, sizeof (const void *)); + if (size_overflow_p (memory_size)) + /* Overflow, would lead to out of memory. */ + xalloc_die (); + memory = (const void **) xrealloc (list->elements, memory_size); + if (memory == NULL) + /* Out of memory. */ + xalloc_die (); + list->elements = memory; + list->allocated = new_allocated; +} + +static gl_list_node_t +gl_array_add_first (gl_list_t list, const void *elt) +{ + size_t count = list->count; + const void **elements; + size_t i; + + if (count == list->allocated) + grow (list); + elements = list->elements; + for (i = count; i > 0; i--) + elements[i] = elements[i - 1]; + elements[0] = elt; + list->count = count + 1; + return INDEX_TO_NODE (0); +} + +static gl_list_node_t +gl_array_add_last (gl_list_t list, const void *elt) +{ + size_t count = list->count; + + if (count == list->allocated) + grow (list); + list->elements[count] = elt; + list->count = count + 1; + return INDEX_TO_NODE (count); +} + +static gl_list_node_t +gl_array_add_before (gl_list_t list, gl_list_node_t node, const void *elt) +{ + size_t count = list->count; + uintptr_t index = NODE_TO_INDEX (node); + size_t position; + const void **elements; + size_t i; + + if (!(index < count)) + /* Invalid argument. */ + abort (); + position = index; + if (count == list->allocated) + grow (list); + elements = list->elements; + for (i = count; i > position; i--) + elements[i] = elements[i - 1]; + elements[position] = elt; + list->count = count + 1; + return INDEX_TO_NODE (position); +} + +static gl_list_node_t +gl_array_add_after (gl_list_t list, gl_list_node_t node, const void *elt) +{ + size_t count = list->count; + uintptr_t index = NODE_TO_INDEX (node); + size_t position; + const void **elements; + size_t i; + + if (!(index < count)) + /* Invalid argument. */ + abort (); + position = index + 1; + if (count == list->allocated) + grow (list); + elements = list->elements; + for (i = count; i > position; i--) + elements[i] = elements[i - 1]; + elements[position] = elt; + list->count = count + 1; + return INDEX_TO_NODE (position); +} + +static gl_list_node_t +gl_array_add_at (gl_list_t list, size_t position, const void *elt) +{ + size_t count = list->count; + const void **elements; + size_t i; + + if (!(position <= count)) + /* Invalid argument. */ + abort (); + if (count == list->allocated) + grow (list); + elements = list->elements; + for (i = count; i > position; i--) + elements[i] = elements[i - 1]; + elements[position] = elt; + list->count = count + 1; + return INDEX_TO_NODE (position); +} + +static bool +gl_array_remove_node (gl_list_t list, gl_list_node_t node) +{ + size_t count = list->count; + uintptr_t index = NODE_TO_INDEX (node); + size_t position; + const void **elements; + size_t i; + + if (!(index < count)) + /* Invalid argument. */ + abort (); + position = index; + elements = list->elements; + if (list->base.dispose_fn != NULL) + list->base.dispose_fn (elements[position]); + for (i = position + 1; i < count; i++) + elements[i - 1] = elements[i]; + list->count = count - 1; + return true; +} + +static bool +gl_array_remove_at (gl_list_t list, size_t position) +{ + size_t count = list->count; + const void **elements; + size_t i; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + elements = list->elements; + if (list->base.dispose_fn != NULL) + list->base.dispose_fn (elements[position]); + for (i = position + 1; i < count; i++) + elements[i - 1] = elements[i]; + list->count = count - 1; + return true; +} + +static bool +gl_array_remove (gl_list_t list, const void *elt) +{ + size_t position = gl_array_indexof_from_to (list, 0, list->count, elt); + if (position == (size_t)(-1)) + return false; + else + return gl_array_remove_at (list, position); +} + +static void +gl_array_list_free (gl_list_t list) +{ + if (list->elements != NULL) + { + if (list->base.dispose_fn != NULL) + { + size_t count = list->count; + + if (count > 0) + { + gl_listelement_dispose_fn dispose = list->base.dispose_fn; + const void **elements = list->elements; + + do + dispose (*elements++); + while (--count > 0); + } + } + free (list->elements); + } + free (list); +} + +/* --------------------- gl_list_iterator_t Data Type --------------------- */ + +static gl_list_iterator_t +gl_array_iterator (gl_list_t list) +{ + gl_list_iterator_t result; + + result.vtable = list->base.vtable; + result.list = list; + result.count = list->count; + result.p = list->elements + 0; + result.q = list->elements + list->count; +#ifdef lint + result.i = 0; + result.j = 0; +#endif + + return result; +} + +static gl_list_iterator_t +gl_array_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) +{ + gl_list_iterator_t result; + + if (!(start_index <= end_index && end_index <= list->count)) + /* Invalid arguments. */ + abort (); + result.vtable = list->base.vtable; + result.list = list; + result.count = list->count; + result.p = list->elements + start_index; + result.q = list->elements + end_index; +#ifdef lint + result.i = 0; + result.j = 0; +#endif + + return result; +} + +static bool +gl_array_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep) +{ + gl_list_t list = iterator->list; + if (iterator->count != list->count) + { + if (iterator->count != list->count + 1) + /* Concurrent modifications were done on the list. */ + abort (); + /* The last returned element was removed. */ + iterator->count--; + iterator->p = (const void **) iterator->p - 1; + iterator->q = (const void **) iterator->q - 1; + } + if (iterator->p < iterator->q) + { + const void **p = (const void **) iterator->p; + *eltp = *p; + if (nodep != NULL) + *nodep = INDEX_TO_NODE (p - list->elements); + iterator->p = p + 1; + return true; + } + else + return false; +} + +static void +gl_array_iterator_free (gl_list_iterator_t *iterator) +{ +} + +/* ---------------------- Sorted gl_list_t Data Type ---------------------- */ + +static size_t +gl_array_sortedlist_indexof_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t low, size_t high, + const void *elt) +{ + if (!(low <= high && high <= list->count)) + /* Invalid arguments. */ + abort (); + if (low < high) + { + /* At each loop iteration, low < high; for indices < low the values + are smaller than ELT; for indices >= high the values are greater + than ELT. So, if the element occurs in the list, it is at + low <= position < high. */ + do + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + int cmp = compar (list->elements[mid], elt); + + if (cmp < 0) + low = mid + 1; + else if (cmp > 0) + high = mid; + else /* cmp == 0 */ + { + /* We have an element equal to ELT at index MID. But we need + the minimal such index. */ + high = mid; + /* At each loop iteration, low <= high and + compar (list->elements[high], elt) == 0, + and we know that the first occurrence of the element is at + low <= position <= high. */ + while (low < high) + { + size_t mid2 = low + (high - low) / 2; /* low <= mid2 < high */ + int cmp2 = compar (list->elements[mid2], elt); + + if (cmp2 < 0) + low = mid2 + 1; + else if (cmp2 > 0) + /* The list was not sorted. */ + abort (); + else /* cmp2 == 0 */ + { + if (mid2 == low) + break; + high = mid2 - 1; + } + } + return low; + } + } + while (low < high); + /* Here low == high. */ + } + return (size_t)(-1); +} + +static size_t +gl_array_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + return gl_array_sortedlist_indexof_from_to (list, compar, 0, list->count, + elt); +} + +static gl_list_node_t +gl_array_sortedlist_search_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t low, size_t high, + const void *elt) +{ + size_t index = + gl_array_sortedlist_indexof_from_to (list, compar, low, high, elt); + return INDEX_TO_NODE (index); +} + +static gl_list_node_t +gl_array_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + size_t index = + gl_array_sortedlist_indexof_from_to (list, compar, 0, list->count, elt); + return INDEX_TO_NODE (index); +} + +static gl_list_node_t +gl_array_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + size_t count = list->count; + size_t low = 0; + size_t high = count; + + /* At each loop iteration, low <= high; for indices < low the values are + smaller than ELT; for indices >= high the values are greater than ELT. */ + while (low < high) + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + int cmp = compar (list->elements[mid], elt); + + if (cmp < 0) + low = mid + 1; + else if (cmp > 0) + high = mid; + else /* cmp == 0 */ + { + low = mid; + break; + } + } + return gl_array_add_at (list, low, elt); +} + +static bool +gl_array_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + size_t index = gl_array_sortedlist_indexof (list, compar, elt); + if (index == (size_t)(-1)) + return false; + else + return gl_array_remove_at (list, index); +} + + +const struct gl_list_implementation gl_array_list_implementation = + { + gl_array_create_empty, + gl_array_create, + gl_array_size, + gl_array_node_value, + gl_array_next_node, + gl_array_previous_node, + gl_array_get_at, + gl_array_set_at, + gl_array_search_from_to, + gl_array_indexof_from_to, + gl_array_add_first, + gl_array_add_last, + gl_array_add_before, + gl_array_add_after, + gl_array_add_at, + gl_array_remove_node, + gl_array_remove_at, + gl_array_remove, + gl_array_list_free, + gl_array_iterator, + gl_array_iterator_from_to, + gl_array_iterator_next, + gl_array_iterator_free, + gl_array_sortedlist_search, + gl_array_sortedlist_search_from_to, + gl_array_sortedlist_indexof, + gl_array_sortedlist_indexof_from_to, + gl_array_sortedlist_add, + gl_array_sortedlist_remove + }; diff -ruNp m4-1.4.9/lib/gl_array_list.h m4-1.4.10/lib/gl_array_list.h --- m4-1.4.9/lib/gl_array_list.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/gl_array_list.h 2007-05-30 19:30:24.000000000 -0600 @@ -0,0 +1,35 @@ +/* Sequential list data type implemented by an array. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_ARRAY_LIST_H +#define _GL_ARRAY_LIST_H + +#include "gl_list.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const struct gl_list_implementation gl_array_list_implementation; +#define GL_ARRAY_LIST &gl_array_list_implementation + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_ARRAY_LIST_H */ diff -ruNp m4-1.4.9/lib/gl_array_oset.c m4-1.4.10/lib/gl_array_oset.c --- m4-1.4.9/lib/gl_array_oset.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/gl_array_oset.c 2007-05-30 19:30:24.000000000 -0600 @@ -0,0 +1,352 @@ +/* Ordered set data type implemented by an array. + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "gl_array_oset.h" + +#include + +#include "xalloc.h" + +/* Checked size_t computations. */ +#include "xsize.h" + +/* -------------------------- gl_oset_t Data Type -------------------------- */ + +/* Concrete gl_oset_impl type, valid for this file only. */ +struct gl_oset_impl +{ + struct gl_oset_impl_base base; + /* An array of ALLOCATED elements, of which the first COUNT are used. + 0 <= COUNT <= ALLOCATED. */ + const void **elements; + size_t count; + size_t allocated; +}; + +static gl_oset_t +gl_array_create_empty (gl_oset_implementation_t implementation, + gl_setelement_compar_fn compar_fn, + gl_setelement_dispose_fn dispose_fn) +{ + struct gl_oset_impl *set = XMALLOC (struct gl_oset_impl); + + set->base.vtable = implementation; + set->base.compar_fn = compar_fn; + set->base.dispose_fn = dispose_fn; + set->elements = NULL; + set->count = 0; + set->allocated = 0; + + return set; +} + +static size_t +gl_array_size (gl_oset_t set) +{ + return set->count; +} + +static size_t +gl_array_indexof (gl_oset_t set, const void *elt) +{ + size_t count = set->count; + + if (count > 0) + { + gl_setelement_compar_fn compar = set->base.compar_fn; + size_t low = 0; + size_t high = count; + + /* At each loop iteration, low < high; for indices < low the values + are smaller than ELT; for indices >= high the values are greater + than ELT. So, if the element occurs in the list, it is at + low <= position < high. */ + do + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + int cmp = (compar != NULL + ? compar (set->elements[mid], elt) + : (set->elements[mid] > elt ? 1 : + set->elements[mid] < elt ? -1 : 0)); + + if (cmp < 0) + low = mid + 1; + else if (cmp > 0) + high = mid; + else /* cmp == 0 */ + /* We have an element equal to ELT at index MID. */ + return mid; + } + while (low < high); + } + return (size_t)(-1); +} + +static bool +gl_array_search (gl_oset_t set, const void *elt) +{ + return gl_array_indexof (set, elt) != (size_t)(-1); +} + +static bool +gl_array_search_atleast (gl_oset_t set, + gl_setelement_threshold_fn threshold_fn, + const void *threshold, + const void **eltp) +{ + size_t count = set->count; + + if (count > 0) + { + size_t low = 0; + size_t high = count; + + /* At each loop iteration, low < high; for indices < low the values are + smaller than THRESHOLD; for indices >= high the values are nonexistent. + So, if an element >= THRESHOLD occurs in the list, it is at + low <= position < high. */ + do + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + + if (! threshold_fn (set->elements[mid], threshold)) + low = mid + 1; + else + { + /* We have an element >= THRESHOLD at index MID. But we need the + minimal such index. */ + high = mid; + /* At each loop iteration, low <= high and + compar (list->elements[high], value) >= 0, + and we know that the first occurrence of the element is at + low <= position <= high. */ + while (low < high) + { + size_t mid2 = low + (high - low) / 2; /* low <= mid2 < high */ + + if (! threshold_fn (set->elements[mid2], threshold)) + low = mid2 + 1; + else + high = mid2; + } + *eltp = set->elements[low]; + return true; + } + } + while (low < high); + } + return false; +} + +/* Ensure that set->allocated > set->count. */ +static void +grow (gl_oset_t set) +{ + size_t new_allocated; + size_t memory_size; + const void **memory; + + new_allocated = xtimes (set->allocated, 2); + new_allocated = xsum (new_allocated, 1); + memory_size = xtimes (new_allocated, sizeof (const void *)); + if (size_overflow_p (memory_size)) + /* Overflow, would lead to out of memory. */ + xalloc_die (); + memory = (const void **) xrealloc (set->elements, memory_size); + if (memory == NULL) + /* Out of memory. */ + xalloc_die (); + set->elements = memory; + set->allocated = new_allocated; +} + +/* Add the given element ELT at the given position, + 0 <= position <= gl_oset_size (set). */ +static inline void +gl_array_add_at (gl_oset_t set, size_t position, const void *elt) +{ + size_t count = set->count; + const void **elements; + size_t i; + + if (count == set->allocated) + grow (set); + elements = set->elements; + for (i = count; i > position; i--) + elements[i] = elements[i - 1]; + elements[position] = elt; + set->count = count + 1; +} + +/* Remove the element at the given position, + 0 <= position < gl_oset_size (set). */ +static inline void +gl_array_remove_at (gl_oset_t set, size_t position) +{ + size_t count = set->count; + const void **elements; + size_t i; + + elements = set->elements; + if (set->base.dispose_fn != NULL) + set->base.dispose_fn (elements[position]); + for (i = position + 1; i < count; i++) + elements[i - 1] = elements[i]; + set->count = count - 1; +} + +static bool +gl_array_add (gl_oset_t set, const void *elt) +{ + size_t count = set->count; + size_t low = 0; + + if (count > 0) + { + gl_setelement_compar_fn compar = set->base.compar_fn; + size_t high = count; + + /* At each loop iteration, low < high; for indices < low the values + are smaller than ELT; for indices >= high the values are greater + than ELT. So, if the element occurs in the list, it is at + low <= position < high. */ + do + { + size_t mid = low + (high - low) / 2; /* low <= mid < high */ + int cmp = (compar != NULL + ? compar (set->elements[mid], elt) + : (set->elements[mid] > elt ? 1 : + set->elements[mid] < elt ? -1 : 0)); + + if (cmp < 0) + low = mid + 1; + else if (cmp > 0) + high = mid; + else /* cmp == 0 */ + return false; + } + while (low < high); + } + gl_array_add_at (set, low, elt); + return true; +} + +static bool +gl_array_remove (gl_oset_t set, const void *elt) +{ + size_t index = gl_array_indexof (set, elt); + if (index != (size_t)(-1)) + { + gl_array_remove_at (set, index); + return true; + } + else + return false; +} + +static void +gl_array_free (gl_oset_t set) +{ + if (set->elements != NULL) + { + if (set->base.dispose_fn != NULL) + { + size_t count = set->count; + + if (count > 0) + { + gl_setelement_dispose_fn dispose = set->base.dispose_fn; + const void **elements = set->elements; + + do + dispose (*elements++); + while (--count > 0); + } + } + free (set->elements); + } + free (set); +} + +/* --------------------- gl_oset_iterator_t Data Type --------------------- */ + +static gl_oset_iterator_t +gl_array_iterator (gl_oset_t set) +{ + gl_oset_iterator_t result; + + result.vtable = set->base.vtable; + result.set = set; + result.count = set->count; + result.p = set->elements + 0; + result.q = set->elements + set->count; +#ifdef lint + result.i = 0; + result.j = 0; +#endif + + return result; +} + +static bool +gl_array_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) +{ + gl_oset_t set = iterator->set; + if (iterator->count != set->count) + { + if (iterator->count != set->count + 1) + /* Concurrent modifications were done on the set. */ + abort (); + /* The last returned element was removed. */ + iterator->count--; + iterator->p = (const void **) iterator->p - 1; + iterator->q = (const void **) iterator->q - 1; + } + if (iterator->p < iterator->q) + { + const void **p = (const void **) iterator->p; + *eltp = *p; + iterator->p = p + 1; + return true; + } + else + return false; +} + +static void +gl_array_iterator_free (gl_oset_iterator_t *iterator) +{ +} + + +const struct gl_oset_implementation gl_array_oset_implementation = + { + gl_array_create_empty, + gl_array_size, + gl_array_search, + gl_array_search_atleast, + gl_array_add, + gl_array_remove, + gl_array_free, + gl_array_iterator, + gl_array_iterator_next, + gl_array_iterator_free + }; diff -ruNp m4-1.4.9/lib/gl_array_oset.h m4-1.4.10/lib/gl_array_oset.h --- m4-1.4.9/lib/gl_array_oset.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/gl_array_oset.h 2007-05-30 19:30:24.000000000 -0600 @@ -0,0 +1,35 @@ +/* Ordered set data type implemented by an array. + Copyright (C) 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_ARRAY_OSET_H +#define _GL_ARRAY_OSET_H + +#include "gl_oset.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const struct gl_oset_implementation gl_array_oset_implementation; +#define GL_ARRAY_OSET &gl_array_oset_implementation + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_ARRAY_OSET_H */ diff -ruNp m4-1.4.9/lib/intprops.h m4-1.4.10/lib/intprops.h --- m4-1.4.9/lib/intprops.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/intprops.h 2007-05-30 19:30:26.000000000 -0600 @@ -0,0 +1,78 @@ +/* intprops.h -- properties of integer types + + Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#include + +/* The extra casts in the following macros work around compiler bugs, + e.g., in Cray C 5.0.3.0. */ + +/* True if the arithmetic type T is an integer type. bool counts as + an integer. */ +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) + +/* True if negative values of the signed integer type T use two's + complement, ones' complement, or signed magnitude representation, + respectively. Much GNU code assumes two's complement, but some + people like to be portable to all possible C hosts. */ +#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) + +/* True if the arithmetic type T is signed. */ +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* The maximum and minimum values for the integer type T. These + macros have undefined behavior if T is signed and has padding bits. + If this is a problem for you, please let us know how to fix it for + your host. */ +#define TYPE_MINIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ + : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + +/* Return zero if T can be determined to be an unsigned type. + Otherwise, return 1. + When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a + tighter bound. Otherwise, it overestimates the true bound by one byte + when applied to unsigned types of size 2, 4, 16, ... bytes. + The symbol signed_type_or_expr__ is private to this header file. */ +#if __GNUC__ >= 2 +# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define signed_type_or_expr__(t) 1 +#endif + +/* Bound on length of the string representing an integer type or expression T. + Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485; + add 1 for integer division truncation; add 1 more for a minus sign + if needed. */ +#define INT_STRLEN_BOUND(t) \ + ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \ + + signed_type_or_expr__ (t) + 1) + +/* Bound on buffer size needed to represent an integer type or expression T, + including the terminating null. */ +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) diff -ruNp m4-1.4.9/lib/isnan.c m4-1.4.10/lib/isnan.c --- m4-1.4.9/lib/isnan.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/isnan.c 2007-07-05 05:48:08.000000000 -0600 @@ -0,0 +1,148 @@ +/* Test for NaN that does not need libm. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include +#include + +#include "float+.h" + +#ifdef USE_LONG_DOUBLE +# define FUNC rpl_isnanl +# define DOUBLE long double +# define MAX_EXP LDBL_MAX_EXP +# define MIN_EXP LDBL_MIN_EXP +# if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT +# define KNOWN_EXPBIT0_LOCATION +# define EXPBIT0_WORD LDBL_EXPBIT0_WORD +# define EXPBIT0_BIT LDBL_EXPBIT0_BIT +# endif +# define SIZE SIZEOF_LDBL +# define L_(literal) literal##L +#elif ! defined USE_FLOAT +# define FUNC rpl_isnan +# define DOUBLE double +# define MAX_EXP DBL_MAX_EXP +# define MIN_EXP DBL_MIN_EXP +# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT +# define KNOWN_EXPBIT0_LOCATION +# define EXPBIT0_WORD DBL_EXPBIT0_WORD +# define EXPBIT0_BIT DBL_EXPBIT0_BIT +# endif +# define SIZE SIZEOF_DBL +# define L_(literal) literal +#else /* defined USE_FLOAT */ +# define FUNC rpl_isnanf +# define DOUBLE float +# define MAX_EXP FLT_MAX_EXP +# define MIN_EXP FLT_MIN_EXP +# if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT +# define KNOWN_EXPBIT0_LOCATION +# define EXPBIT0_WORD FLT_EXPBIT0_WORD +# define EXPBIT0_BIT FLT_EXPBIT0_BIT +# endif +# define SIZE SIZEOF_FLT +# define L_(literal) literal##f +#endif + +#define EXP_MASK ((MAX_EXP - MIN_EXP) | 7) + +#define NWORDS \ + ((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double; + +int +FUNC (DOUBLE x) +{ +#ifdef KNOWN_EXPBIT0_LOCATION +# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) + /* Special CPU dependent code is needed to treat bit patterns outside the + IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals) as NaNs. + These bit patterns are: + - exponent = 0x0001..0x7FFF, mantissa bit 63 = 0, + - exponent = 0x0000, mantissa bit 63 = 1. + The NaN bit pattern is: + - exponent = 0x7FFF, mantissa >= 0x8000000000000001. */ + memory_double m; + unsigned int exponent; + + m.value = x; + exponent = (m.word[EXPBIT0_WORD] >> EXPBIT0_BIT) & EXP_MASK; +# ifdef WORDS_BIGENDIAN + /* Big endian: EXPBIT0_WORD = 0, EXPBIT0_BIT = 16. */ + if (exponent == 0) + return 1 & (m.word[0] >> 15); + else if (exponent == EXP_MASK) + return (((m.word[0] ^ 0x8000U) << 16) | m.word[1] | (m.word[2] >> 16)) != 0; + else + return 1 & ~(m.word[0] >> 15); +# else + /* Little endian: EXPBIT0_WORD = 2, EXPBIT0_BIT = 0. */ + if (exponent == 0) + return (m.word[1] >> 31); + else if (exponent == EXP_MASK) + return ((m.word[1] ^ 0x80000000U) | m.word[0]) != 0; + else + return (m.word[1] >> 31) ^ 1; +# endif +# else + /* Be careful to not do any floating-point operation on x, such as x == x, + because x may be a signaling NaN. */ +# if defined __SUNPRO_C || defined __DECC || (defined __sgi && !defined __GNUC__) + /* The Sun C 5.0 compilers and the Compaq (ex-DEC) 6.4 compilers don't + recognize the initializers as constant expressions. The latter compiler + also fails when constant-folding 0.0 / 0.0 even when constant-folding is + not required. The SGI MIPSpro C compiler complains about "floating-point + operation result is out of range". */ + static DOUBLE zero = L_(0.0); + memory_double nan; + DOUBLE plus_inf = L_(1.0) / L_(0.0); + DOUBLE minus_inf = -L_(1.0) / L_(0.0); + nan.value = zero / zero; +# else + static memory_double nan = { L_(0.0) / L_(0.0) }; + static DOUBLE plus_inf = L_(1.0) / L_(0.0); + static DOUBLE minus_inf = -L_(1.0) / L_(0.0); +# endif + { + memory_double m; + + /* A NaN can be recognized through its exponent. But exclude +Infinity and + -Infinity, which have the same exponent. */ + m.value = x; + if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD]) + & (EXP_MASK << EXPBIT0_BIT)) + == 0) + return (memcmp (&m.value, &plus_inf, SIZE) != 0 + && memcmp (&m.value, &minus_inf, SIZE) != 0); + else + return 0; + } +# endif +#else + /* The configuration did not find sufficient information. Give up about + the signaling NaNs, handle only the quiet NaNs. */ + if (x == x) + return 0; + else + return 1; +#endif +} diff -ruNp m4-1.4.9/lib/isnan.h m4-1.4.10/lib/isnan.h --- m4-1.4.9/lib/isnan.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/isnan.h 2007-05-30 19:30:26.000000000 -0600 @@ -0,0 +1,26 @@ +/* Test for NaN that does not need libm. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_ISNAN_IN_LIBC +/* Get declaration of isnan macro. */ +# include +#else +/* Test whether X is a NaN. */ +# undef isnan +# define isnan rpl_isnan +extern int isnan (double x); +#endif diff -ruNp m4-1.4.9/lib/isnanf.c m4-1.4.10/lib/isnanf.c --- m4-1.4.9/lib/isnanf.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/isnanf.c 2007-05-30 19:30:26.000000000 -0600 @@ -0,0 +1,21 @@ +/* Test for NaN that does not need libm. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#define USE_FLOAT +#include "isnan.c" diff -ruNp m4-1.4.9/lib/isnanf.h m4-1.4.10/lib/isnanf.h --- m4-1.4.9/lib/isnanf.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/isnanf.h 2007-05-30 19:30:27.000000000 -0600 @@ -0,0 +1,30 @@ +/* Test for NaN that does not need libm. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_ISNANF_IN_LIBC +/* Get declaration of isnan macro or (older) isnanf function. */ +# include +# ifdef isnan +# undef isnanf +# define isnanf(x) isnan ((float)(x)) +# endif +#else +/* Test whether X is a NaN. */ +# undef isnanf +# define isnanf rpl_isnanf +extern int isnanf (float x); +#endif diff -ruNp m4-1.4.9/lib/isnanl-nolibm.h m4-1.4.10/lib/isnanl-nolibm.h --- m4-1.4.9/lib/isnanl-nolibm.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/isnanl-nolibm.h 2007-05-30 19:30:27.000000000 -0600 @@ -0,0 +1,30 @@ +/* Test for NaN that does not need libm. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_ISNANL_IN_LIBC +/* Get declaration of isnan macro or (older) isnanl function. */ +# include +# ifdef isnan +# undef isnanl +# define isnanl(x) isnan ((long double)(x)) +# endif +#else +/* Test whether X is a NaN. */ +# undef isnanl +# define isnanl rpl_isnanl +extern int isnanl (long double x); +#endif diff -ruNp m4-1.4.9/lib/isnanl.c m4-1.4.10/lib/isnanl.c --- m4-1.4.9/lib/isnanl.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/isnanl.c 2007-05-30 19:30:27.000000000 -0600 @@ -0,0 +1,21 @@ +/* Test for NaN that does not need libm. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#define USE_LONG_DOUBLE +#include "isnan.c" diff -ruNp m4-1.4.9/lib/lseek.c m4-1.4.10/lib/lseek.c --- m4-1.4.9/lib/lseek.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/lseek.c 2007-05-30 19:30:28.000000000 -0600 @@ -0,0 +1,46 @@ +/* An lseek() function that detects pipes. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include + +/* Get GetFileType. The replacement lseek is only used on mingw, so + this include can be unconditional. */ +#include +#include + +#undef lseek + +off_t +rpl_lseek (int fd, off_t offset, int whence) +{ + /* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */ + HANDLE h = (HANDLE) _get_osfhandle (fd); + if (h == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + if (GetFileType (h) != FILE_TYPE_DISK) + { + errno = ESPIPE; + return -1; + } + return lseek (fd, offset, whence); +} diff -ruNp m4-1.4.9/lib/malloca.c m4-1.4.10/lib/malloca.c --- m4-1.4.9/lib/malloca.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/malloca.c 2007-07-04 22:02:40.000000000 -0600 @@ -0,0 +1,137 @@ +/* Safe automatic memory allocation. + Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "malloca.h" + +/* The speed critical point in this file is freea() applied to an alloca() + result: it must be fast, to match the speed of alloca(). The speed of + mmalloca() and freea() in the other case are not critical, because they + are only invoked for big memory sizes. */ + +#if HAVE_ALLOCA + +/* Store the mmalloca() results in a hash table. This is needed to reliably + distinguish a mmalloca() result and an alloca() result. + + Although it is possible that the same pointer is returned by alloca() and + by mmalloca() at different times in the same application, it does not lead + to a bug in freea(), because: + - Before a pointer returned by alloca() can point into malloc()ed memory, + the function must return, and once this has happened the programmer must + not call freea() on it anyway. + - Before a pointer returned by mmalloca() can point into the stack, it + must be freed. The only function that can free it is freea(), and + when freea() frees it, it also removes it from the hash table. */ + +#define MAGIC_NUMBER 0x1415fb4a +#define MAGIC_SIZE sizeof (int) +/* This is how the header info would look like without any alignment + considerations. */ +struct preliminary_header { void *next; char room[MAGIC_SIZE]; }; +/* But the header's size must be a multiple of sa_alignment_max. */ +#define HEADER_SIZE \ + (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max) +struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; }; +/* Verify that HEADER_SIZE == sizeof (struct header). */ +typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1]; +/* We make the hash table quite big, so that during lookups the probability + of empty hash buckets is quite high. There is no need to make the hash + table resizable, because when the hash table gets filled so much that the + lookup becomes slow, it means that the application has memory leaks. */ +#define HASH_TABLE_SIZE 257 +static void * mmalloca_results[HASH_TABLE_SIZE]; + +#endif + +void * +mmalloca (size_t n) +{ +#if HAVE_ALLOCA + /* Allocate one more word, that serves as an indicator for malloc()ed + memory, so that freea() of an alloca() result is fast. */ + size_t nplus = n + HEADER_SIZE; + + if (nplus >= n) + { + char *p = (char *) malloc (nplus); + + if (p != NULL) + { + size_t slot; + + p += HEADER_SIZE; + + /* Put a magic number into the indicator word. */ + ((int *) p)[-1] = MAGIC_NUMBER; + + /* Enter p into the hash table. */ + slot = (unsigned long) p % HASH_TABLE_SIZE; + ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot]; + mmalloca_results[slot] = p; + + return p; + } + } + /* Out of memory. */ + return NULL; +#else +# if !MALLOC_0_IS_NONNULL + if (n == 0) + n = 1; +# endif + return malloc (n); +#endif +} + +#if HAVE_ALLOCA +void +freea (void *p) +{ + /* mmalloca() may have returned NULL. */ + if (p != NULL) + { + /* Attempt to quickly distinguish the mmalloca() result - which has + a magic indicator word - and the alloca() result - which has an + uninitialized indicator word. It is for this test that sa_increment + additional bytes are allocated in the alloca() case. */ + if (((int *) p)[-1] == MAGIC_NUMBER) + { + /* Looks like a mmalloca() result. To see whether it really is one, + perform a lookup in the hash table. */ + size_t slot = (unsigned long) p % HASH_TABLE_SIZE; + void **chain = &mmalloca_results[slot]; + for (; *chain != NULL;) + { + if (*chain == p) + { + /* Found it. Remove it from the hash table and free it. */ + char *p_begin = (char *) p - HEADER_SIZE; + *chain = ((struct header *) p_begin)->next; + free (p_begin); + return; + } + chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next; + } + } + /* At this point, we know it was not a mmalloca() result. */ + } +} +#endif diff -ruNp m4-1.4.9/lib/malloca.h m4-1.4.10/lib/malloca.h --- m4-1.4.9/lib/malloca.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/malloca.h 2007-07-04 22:02:40.000000000 -0600 @@ -0,0 +1,124 @@ +/* Safe automatic memory allocation. + Copyright (C) 2003-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _MALLOCA_H +#define _MALLOCA_H + +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call + alloca(N); otherwise it returns NULL. It either returns N bytes of + memory allocated on the stack, that lasts until the function returns, + or NULL. + Use of safe_alloca should be avoided: + - inside arguments of function calls - undefined behaviour, + - in inline functions - the allocation may actually last until the + calling function returns. +*/ +#if HAVE_ALLOCA +/* The OS usually guarantees only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + allocate anything larger than 4096 bytes. Also care for the possibility + of a few compiler-allocated temporary stack slots. + This must be a macro, not an inline function. */ +# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL) +#else +# define safe_alloca(N) ((void) (N), NULL) +#endif + +/* malloca(N) is a safe variant of alloca(N). It allocates N bytes of + memory allocated on the stack, that must be freed using freea() before + the function returns. Upon failure, it returns NULL. */ +#if HAVE_ALLOCA +# define malloca(N) \ + ((N) < 4032 - sa_increment \ + ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ + : mmalloca (N)) +#else +# define malloca(N) \ + mmalloca (N) +#endif +extern void * mmalloca (size_t n); + +/* Free a block of memory allocated through malloca(). */ +#if HAVE_ALLOCA +extern void freea (void *p); +#else +# define freea free +#endif + +/* Maybe we should also define a variant + nmalloca (size_t n, size_t s) - behaves like malloca (n * s) + If this would be useful in your application. please speak up. */ + + +#ifdef __cplusplus +} +#endif + + +/* ------------------- Auxiliary, non-public definitions ------------------- */ + +/* Determine the alignment of a type at compile time. */ +#if defined __GNUC__ +# define sa_alignof __alignof__ +#elif defined __cplusplus + template struct sa_alignof_helper { char __slot1; type __slot2; }; +# define sa_alignof(type) offsetof (sa_alignof_helper, __slot2) +#elif defined __hpux + /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#elif defined _AIX + /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#else +# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) +#endif + +enum +{ +/* The desired alignment of memory allocations is the maximum alignment + among all elementary types. */ + sa_alignment_long = sa_alignof (long), + sa_alignment_double = sa_alignof (double), +#if HAVE_LONG_LONG_INT + sa_alignment_longlong = sa_alignof (long long), +#endif + sa_alignment_longdouble = sa_alignof (long double), + sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) +#if HAVE_LONG_LONG_INT + | (sa_alignment_longlong - 1) +#endif + | (sa_alignment_longdouble - 1) + ) + 1, +/* The increment that guarantees room for a magic word must be >= sizeof (int) + and a multiple of sa_alignment_max. */ + sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max +}; + +#endif /* _MALLOCA_H */ diff -ruNp m4-1.4.9/lib/malloca.valgrind m4-1.4.10/lib/malloca.valgrind --- m4-1.4.9/lib/malloca.valgrind 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/malloca.valgrind 2007-07-04 22:02:40.000000000 -0600 @@ -0,0 +1,7 @@ +# Suppress a valgrind message about use of uninitialized memory in freea(). +# This use is OK because it provides only a speedup. +{ + freea + Memcheck:Cond + fun:freea +} diff -ruNp m4-1.4.9/lib/math_.h m4-1.4.10/lib/math_.h --- m4-1.4.9/lib/math_.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/math_.h 2007-07-05 05:48:12.000000000 -0600 @@ -0,0 +1,265 @@ +/* A GNU-like . + + Copyright (C) 2002-2003, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _GL_MATH_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_MATH_H@ + +#ifndef _GL_MATH_H +#define _GL_MATH_H + + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Write x as + x = mantissa * 2^exp + where + If x finite and nonzero: 0.5 <= |mantissa| < 1.0. + If x is zero: mantissa = x, exp = 0. + If x is infinite or NaN: mantissa = x, exp unspecified. + Store exp and return mantissa. */ +#if @GNULIB_FREXP@ +# if @REPLACE_FREXP@ +# define frexp rpl_frexp +extern double frexp (double x, int *exp); +# endif +#elif defined GNULIB_POSIXCHECK +# undef frexp +# define frexp(x,e) \ + (GL_LINK_WARNING ("frexp is unportable - " \ + "use gnulib module frexp for portability"), \ + frexp (x, e)) +#endif + + +#if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@ +extern long double acosl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef acosl +# define acosl(x) \ + (GL_LINK_WARNING ("acosl is unportable - " \ + "use gnulib module mathl for portability"), \ + acosl (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@ +extern long double asinl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef asinl +# define asinl(x) \ + (GL_LINK_WARNING ("asinl is unportable - " \ + "use gnulib module mathl for portability"), \ + asinl (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@ +extern long double atanl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef atanl +# define atanl(x) \ + (GL_LINK_WARNING ("atanl is unportable - " \ + "use gnulib module mathl for portability"), \ + atanl (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_CEILL@ +extern long double ceill (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef ceill +# define ceill(x) \ + (GL_LINK_WARNING ("ceill is unportable - " \ + "use gnulib module mathl for portability"), \ + ceill (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_COSL@ +extern long double cosl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef cosl +# define cosl(x) \ + (GL_LINK_WARNING ("cosl is unportable - " \ + "use gnulib module mathl for portability"), \ + cosl (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@ +extern long double expl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef expl +# define expl(x) \ + (GL_LINK_WARNING ("expl is unportable - " \ + "use gnulib module mathl for portability"), \ + expl (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_FLOORL@ +extern long double floorl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef floorl +# define floorl(x) \ + (GL_LINK_WARNING ("floorl is unportable - " \ + "use gnulib module mathl for portability"), \ + floorl (x)) +#endif + +/* Write x as + x = mantissa * 2^exp + where + If x finite and nonzero: 0.5 <= |mantissa| < 1.0. + If x is zero: mantissa = x, exp = 0. + If x is infinite or NaN: mantissa = x, exp unspecified. + Store exp and return mantissa. */ +#if @GNULIB_FREXPL@ && @REPLACE_FREXPL@ +# define frexpl rpl_frexpl +#endif +#if (@GNULIB_FREXPL@ && @REPLACE_FREXPL@) || !@HAVE_DECL_FREXPL@ +extern long double frexpl (long double x, int *exp); +#endif +#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK +# undef frexpl +# define frexpl(x,e) \ + (GL_LINK_WARNING ("frexpl is unportable - " \ + "use gnulib module frexpl for portability"), \ + frexpl (x, e)) +#endif + +/* Return x * 2^exp. */ +#if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ +# define ldexpl rpl_ldexpl +#endif +#if (@GNULIB_LDEXPL@ && @REPLACE_LDEXPL@) || !@HAVE_DECL_LDEXPL@ +extern long double ldexpl (long double x, int exp); +#endif +#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK +# undef ldexpl +# define ldexpl(x,e) \ + (GL_LINK_WARNING ("ldexpl is unportable - " \ + "use gnulib module ldexpl for portability"), \ + ldexpl (x, e)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_LOGL@ +extern long double logl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef logl +# define logl(x) \ + (GL_LINK_WARNING ("logl is unportable - " \ + "use gnulib module mathl for portability"), \ + logl (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_SINL@ +extern long double sinl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef sinl +# define sinl(x) \ + (GL_LINK_WARNING ("sinl is unportable - " \ + "use gnulib module mathl for portability"), \ + sinl (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@ +extern long double sqrtl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef sqrtl +# define sqrtl(x) \ + (GL_LINK_WARNING ("sqrtl is unportable - " \ + "use gnulib module mathl for portability"), \ + sqrtl (x)) +#endif + +#if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@ +extern long double tanl (long double x); +#endif +#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK +# undef tanl +# define tanl(x) \ + (GL_LINK_WARNING ("tanl is unportable - " \ + "use gnulib module mathl for portability"), \ + tanl (x)) +#endif + + +#if @GNULIB_SIGNBIT@ +# if @REPLACE_SIGNBIT@ +# undef signbit +extern int gl_signbitf (float arg); +extern int gl_signbitd (double arg); +extern int gl_signbitl (long double arg); +# if __GNUC__ >= 2 && !__STRICT_ANSI__ +# if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT +# define gl_signbitf(arg) \ + ({ union { float _value; \ + unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ + } _m; \ + _m._value = (arg); \ + (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ + }) +# endif +# if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT +# define gl_signbitd(arg) \ + ({ union { double _value; \ + unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ + } _m; \ + _m._value = (arg); \ + (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ + }) +# endif +# if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT +# define gl_signbitl(arg) \ + ({ union { long double _value; \ + unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ + } _m; \ + _m._value = (arg); \ + (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ + }) +# endif +# endif +# define signbit(x) \ + (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \ + sizeof (x) == sizeof (double) ? gl_signbitd (x) : \ + gl_signbitf (x)) +# endif +#elif defined GNULIB_POSIXCHECK + /* How to override a macro? */ +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_MATH_H */ +#endif /* _GL_MATH_H */ diff -ruNp m4-1.4.9/lib/printf-args.c m4-1.4.10/lib/printf-args.c --- m4-1.4.9/lib/printf-args.c 2007-03-23 06:50:53.000000000 -0600 +++ m4-1.4.10/lib/printf-args.c 2007-07-05 05:48:14.000000000 -0600 @@ -15,16 +15,25 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +/* This file can be parametrized with the following macros: + ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. + PRINTF_FETCHARGS Name of the function to be defined. + STATIC Set to 'static' to declare the function static. */ + +#ifndef PRINTF_FETCHARGS +# include +#endif /* Specification. */ -#include "printf-args.h" +#ifndef PRINTF_FETCHARGS +# include "printf-args.h" +#endif #ifdef STATIC STATIC #endif int -printf_fetchargs (va_list args, arguments *a) +PRINTF_FETCHARGS (va_list args, arguments *a) { size_t i; argument *ap; @@ -67,11 +76,9 @@ printf_fetchargs (va_list args, argument case TYPE_DOUBLE: ap->a.a_double = va_arg (args, double); break; -#if HAVE_LONG_DOUBLE case TYPE_LONGDOUBLE: ap->a.a_longdouble = va_arg (args, long double); break; -#endif case TYPE_CHAR: ap->a.a_char = va_arg (args, int); break; @@ -133,6 +140,45 @@ printf_fetchargs (va_list args, argument ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); break; #endif +#if ENABLE_UNISTDIO + /* The unistdio extensions. */ + case TYPE_U8_STRING: + ap->a.a_u8_string = va_arg (args, const uint8_t *); + /* A null pointer is an invalid argument for "%U", but in practice + it occurs quite frequently in printf statements that produce + debug output. Use a fallback in this case. */ + if (ap->a.a_u8_string == NULL) + { + static const uint8_t u8_null_string[] = + { '(', 'N', 'U', 'L', 'L', ')', 0 }; + ap->a.a_u8_string = u8_null_string; + } + break; + case TYPE_U16_STRING: + ap->a.a_u16_string = va_arg (args, const uint16_t *); + /* A null pointer is an invalid argument for "%lU", but in practice + it occurs quite frequently in printf statements that produce + debug output. Use a fallback in this case. */ + if (ap->a.a_u16_string == NULL) + { + static const uint16_t u16_null_string[] = + { '(', 'N', 'U', 'L', 'L', ')', 0 }; + ap->a.a_u16_string = u16_null_string; + } + break; + case TYPE_U32_STRING: + ap->a.a_u32_string = va_arg (args, const uint32_t *); + /* A null pointer is an invalid argument for "%llU", but in practice + it occurs quite frequently in printf statements that produce + debug output. Use a fallback in this case. */ + if (ap->a.a_u32_string == NULL) + { + static const uint32_t u32_null_string[] = + { '(', 'N', 'U', 'L', 'L', ')', 0 }; + ap->a.a_u32_string = u32_null_string; + } + break; +#endif default: /* Unknown type. */ return -1; diff -ruNp m4-1.4.9/lib/printf-args.h m4-1.4.10/lib/printf-args.h --- m4-1.4.9/lib/printf-args.h 2007-03-23 06:50:53.000000000 -0600 +++ m4-1.4.10/lib/printf-args.h 2007-07-05 05:48:14.000000000 -0600 @@ -18,6 +18,16 @@ #ifndef _PRINTF_ARGS_H #define _PRINTF_ARGS_H +/* This file can be parametrized with the following macros: + ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. + PRINTF_FETCHARGS Name of the function to be declared. + STATIC Set to 'static' to declare the function static. */ + +/* Default parameters. */ +#ifndef PRINTF_FETCHARGS +# define PRINTF_FETCHARGS printf_fetchargs +#endif + /* Get size_t. */ #include @@ -52,9 +62,7 @@ typedef enum TYPE_ULONGLONGINT, #endif TYPE_DOUBLE, -#if HAVE_LONG_DOUBLE TYPE_LONGDOUBLE, -#endif TYPE_CHAR, #if HAVE_WINT_T TYPE_WIDE_CHAR, @@ -71,6 +79,12 @@ typedef enum #if HAVE_LONG_LONG_INT , TYPE_COUNT_LONGLONGINT_POINTER #endif +#if ENABLE_UNISTDIO + /* The unistdio extensions. */ +, TYPE_U8_STRING +, TYPE_U16_STRING +, TYPE_U32_STRING +#endif } arg_type; /* Polymorphic argument */ @@ -93,9 +107,7 @@ typedef struct #endif float a_float; double a_double; -#if HAVE_LONG_DOUBLE long double a_longdouble; -#endif int a_char; #if HAVE_WINT_T wint_t a_wide_char; @@ -112,6 +124,12 @@ typedef struct #if HAVE_LONG_LONG_INT long long int * a_count_longlongint_pointer; #endif +#if ENABLE_UNISTDIO + /* The unistdio extensions. */ + const uint8_t * a_u8_string; + const uint16_t * a_u16_string; + const uint32_t * a_u32_string; +#endif } a; } @@ -131,6 +149,6 @@ STATIC #else extern #endif -int printf_fetchargs (va_list args, arguments *a); +int PRINTF_FETCHARGS (va_list args, arguments *a); #endif /* _PRINTF_ARGS_H */ diff -ruNp m4-1.4.9/lib/printf-frexp.c m4-1.4.10/lib/printf-frexp.c --- m4-1.4.9/lib/printf-frexp.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/printf-frexp.c 2007-05-30 19:30:30.000000000 -0600 @@ -0,0 +1,189 @@ +/* Split a double into fraction and mantissa, for hexadecimal printf. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#ifdef USE_LONG_DOUBLE +# include "printf-frexpl.h" +#else +# include "printf-frexp.h" +#endif + +#include +#include +#ifdef USE_LONG_DOUBLE +# include "fpucw.h" +#endif + +/* This file assumes FLT_RADIX = 2. If FLT_RADIX is a power of 2 greater + than 2, or not even a power of 2, some rounding errors can occur, so that + then the returned mantissa is only guaranteed to be <= 2.0, not < 2.0. */ + +#ifdef USE_LONG_DOUBLE +# define FUNC printf_frexpl +# define DOUBLE long double +# define MIN_EXP LDBL_MIN_EXP +# if HAVE_FREXPL_IN_LIBC && HAVE_LDEXPL_IN_LIBC +# define USE_FREXP_LDEXP +# define FREXP frexpl +# define LDEXP ldexpl +# endif +# define DECL_ROUNDING DECL_LONG_DOUBLE_ROUNDING +# define BEGIN_ROUNDING() BEGIN_LONG_DOUBLE_ROUNDING () +# define END_ROUNDING() END_LONG_DOUBLE_ROUNDING () +# define L_(literal) literal##L +#else +# define FUNC printf_frexp +# define DOUBLE double +# define MIN_EXP DBL_MIN_EXP +# if HAVE_FREXP_IN_LIBC && HAVE_LDEXP_IN_LIBC +# define USE_FREXP_LDEXP +# define FREXP frexp +# define LDEXP ldexp +# endif +# define DECL_ROUNDING +# define BEGIN_ROUNDING() +# define END_ROUNDING() +# define L_(literal) literal +#endif + +DOUBLE +FUNC (DOUBLE x, int *exp) +{ + int exponent; + DECL_ROUNDING + + BEGIN_ROUNDING (); + +#ifdef USE_FREXP_LDEXP + /* frexp and ldexp are usually faster than the loop below. */ + x = FREXP (x, &exponent); + + x = x + x; + exponent -= 1; + + if (exponent < MIN_EXP - 1) + { + x = LDEXP (x, exponent - (MIN_EXP - 1)); + exponent = MIN_EXP - 1; + } +#else + { + /* Since the exponent is an 'int', it fits in 64 bits. Therefore the + loops are executed no more than 64 times. */ + DOUBLE pow2[64]; /* pow2[i] = 2^2^i */ + DOUBLE powh[64]; /* powh[i] = 2^-2^i */ + int i; + + exponent = 0; + if (x >= L_(1.0)) + { + /* A nonnegative exponent. */ + { + DOUBLE pow2_i; /* = pow2[i] */ + DOUBLE powh_i; /* = powh[i] */ + + /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, + x * 2^exponent = argument, x >= 1.0. */ + for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); + ; + i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) + { + if (x >= pow2_i) + { + exponent += (1 << i); + x *= powh_i; + } + else + break; + + pow2[i] = pow2_i; + powh[i] = powh_i; + } + } + /* Here 1.0 <= x < 2^2^i. */ + } + else + { + /* A negative exponent. */ + { + DOUBLE pow2_i; /* = pow2[i] */ + DOUBLE powh_i; /* = powh[i] */ + + /* Invariants: pow2_i = 2^2^i, powh_i = 2^-2^i, + x * 2^exponent = argument, x < 1.0, exponent >= MIN_EXP - 1. */ + for (i = 0, pow2_i = L_(2.0), powh_i = L_(0.5); + ; + i++, pow2_i = pow2_i * pow2_i, powh_i = powh_i * powh_i) + { + if (exponent - (1 << i) < MIN_EXP - 1) + break; + + exponent -= (1 << i); + x *= pow2_i; + if (x >= L_(1.0)) + break; + + pow2[i] = pow2_i; + powh[i] = powh_i; + } + } + /* Here either x < 1.0 and exponent - 2^i < MIN_EXP - 1 <= exponent, + or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1. */ + + if (x < L_(1.0)) + /* Invariants: x * 2^exponent = argument, x < 1.0 and + exponent - 2^i < MIN_EXP - 1 <= exponent. */ + while (i > 0) + { + i--; + if (exponent - (1 << i) >= MIN_EXP - 1) + { + exponent -= (1 << i); + x *= pow2[i]; + if (x >= L_(1.0)) + break; + } + } + + /* Here either x < 1.0 and exponent = MIN_EXP - 1, + or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1. */ + } + + /* Invariants: x * 2^exponent = argument, and + either x < 1.0 and exponent = MIN_EXP - 1, + or 1.0 <= x < 2^2^i and exponent >= MIN_EXP - 1. */ + while (i > 0) + { + i--; + if (x >= pow2[i]) + { + exponent += (1 << i); + x *= powh[i]; + } + } + /* Here either x < 1.0 and exponent = MIN_EXP - 1, + or 1.0 <= x < 2.0 and exponent >= MIN_EXP - 1. */ + } +#endif + + END_ROUNDING (); + + *exp = exponent; + return x; +} diff -ruNp m4-1.4.9/lib/printf-frexp.h m4-1.4.10/lib/printf-frexp.h --- m4-1.4.9/lib/printf-frexp.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/printf-frexp.h 2007-05-30 19:30:31.000000000 -0600 @@ -0,0 +1,24 @@ +/* Split a double into fraction and mantissa, for hexadecimal printf. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Write a finite, positive number x as + x = mantissa * 2^exp + where exp >= DBL_MIN_EXP - 1, + mantissa < 2.0, + if x is not a denormalized number then mantissa >= 1.0. + Store exp and return mantissa. */ +extern double printf_frexp (double x, int *exp); diff -ruNp m4-1.4.9/lib/printf-frexpl.c m4-1.4.10/lib/printf-frexpl.c --- m4-1.4.9/lib/printf-frexpl.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/printf-frexpl.c 2007-05-30 19:30:31.000000000 -0600 @@ -0,0 +1,19 @@ +/* Split a 'long double' into fraction and mantissa, for hexadecimal printf. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define USE_LONG_DOUBLE +#include "printf-frexp.c" diff -ruNp m4-1.4.9/lib/printf-frexpl.h m4-1.4.10/lib/printf-frexpl.h --- m4-1.4.9/lib/printf-frexpl.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/printf-frexpl.h 2007-05-30 19:30:31.000000000 -0600 @@ -0,0 +1,24 @@ +/* Split a 'long double' into fraction and mantissa, for hexadecimal printf. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Write a finite, positive number x as + x = mantissa * 2^exp + where exp >= LDBL_MIN_EXP - 1, + mantissa < 2.0, + if x is not a denormalized number then mantissa >= 1.0. + Store exp and return mantissa. */ +extern long double printf_frexpl (long double x, int *exp); diff -ruNp m4-1.4.9/lib/printf-parse.c m4-1.4.10/lib/printf-parse.c --- m4-1.4.9/lib/printf-parse.c 2007-03-23 06:50:53.000000000 -0600 +++ m4-1.4.10/lib/printf-parse.c 2007-07-05 05:48:16.000000000 -0600 @@ -15,25 +15,50 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +/* This file can be parametrized with the following macros: + CHAR_T The element type of the format string. + CHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters + in the format string are ASCII. + DIRECTIVE Structure denoting a format directive. + Depends on CHAR_T. + DIRECTIVES Structure denoting the set of format directives of a + format string. Depends on CHAR_T. + PRINTF_PARSE Function that parses a format string. + Depends on CHAR_T. + STATIC Set to 'static' to declare the function static. + ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. */ + +#ifndef PRINTF_PARSE +# include +#endif /* Specification. */ -#if WIDE_CHAR_VERSION -# include "wprintf-parse.h" -#else +#ifndef PRINTF_PARSE # include "printf-parse.h" #endif +/* Default parameters. */ +#ifndef PRINTF_PARSE +# define PRINTF_PARSE printf_parse +# define CHAR_T char +# define DIRECTIVE char_directive +# define DIRECTIVES char_directives +#endif + /* Get size_t, NULL. */ #include /* Get intmax_t. */ -#if HAVE_STDINT_H_WITH_UINTMAX +#ifdef IN_LIBINTL +# if HAVE_STDINT_H_WITH_UINTMAX +# include +# endif +# if HAVE_INTTYPES_H_WITH_UINTMAX +# include +# endif +#else # include #endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -# include -#endif /* malloc(), realloc(), free(). */ #include @@ -41,16 +66,9 @@ /* Checked size_t computations. */ #include "xsize.h" -#if WIDE_CHAR_VERSION -# define PRINTF_PARSE wprintf_parse -# define CHAR_T wchar_t -# define DIRECTIVE wchar_t_directive -# define DIRECTIVES wchar_t_directives -#else -# define PRINTF_PARSE printf_parse -# define CHAR_T char -# define DIRECTIVE char_directive -# define DIRECTIVES char_directives +#if CHAR_T_ONLY_ASCII +/* c_isascii(). */ +# include "c-ctype.h" #endif #ifdef STATIC @@ -115,7 +133,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRE if (c == '%') { size_t arg_index = ARG_NONE; - DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */ + DIRECTIVE *dp = &d->dir[d->count]; /* pointer to next directive */ /* Initialize the next directive. */ dp->dir_start = cp - 1; @@ -326,7 +344,6 @@ PRINTF_PARSE (const CHAR_T *format, DIRE flags += 8; cp++; } -#if HAVE_INTMAX_T else if (*cp == 'j') { if (sizeof (intmax_t) > sizeof (long)) @@ -341,7 +358,6 @@ PRINTF_PARSE (const CHAR_T *format, DIRE } cp++; } -#endif else if (*cp == 'z' || *cp == 'Z') { /* 'z' is standardized in ISO C 99, but glibc uses 'Z' @@ -419,12 +435,10 @@ PRINTF_PARSE (const CHAR_T *format, DIRE break; case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': -#if HAVE_LONG_DOUBLE if (flags >= 16 || (flags & 4)) type = TYPE_LONGDOUBLE; else -#endif - type = TYPE_DOUBLE; + type = TYPE_DOUBLE; break; case 'c': if (flags >= 8) @@ -479,6 +493,17 @@ PRINTF_PARSE (const CHAR_T *format, DIRE else type = TYPE_COUNT_INT_POINTER; break; +#if ENABLE_UNISTDIO + /* The unistdio extensions. */ + case 'U': + if (flags >= 16) + type = TYPE_U32_STRING; + else if (flags >= 8) + type = TYPE_U16_STRING; + else + type = TYPE_U8_STRING; + break; +#endif case '%': type = TYPE_NONE; break; @@ -522,6 +547,13 @@ PRINTF_PARSE (const CHAR_T *format, DIRE d->dir = memory; } } +#if CHAR_T_ONLY_ASCII + else if (!c_isascii (c)) + { + /* Non-ASCII character. Not supported. */ + goto error; + } +#endif } d->dir[d->count].dir_start = cp; @@ -537,7 +569,8 @@ error: return -1; } +#undef PRINTF_PARSE #undef DIRECTIVES #undef DIRECTIVE +#undef CHAR_T_ONLY_ASCII #undef CHAR_T -#undef PRINTF_PARSE diff -ruNp m4-1.4.9/lib/printf-parse.h m4-1.4.10/lib/printf-parse.h --- m4-1.4.9/lib/printf-parse.h 2007-03-23 06:50:53.000000000 -0600 +++ m4-1.4.10/lib/printf-parse.h 2007-07-05 05:48:16.000000000 -0600 @@ -1,5 +1,5 @@ /* Parse printf format string. - Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,10 @@ #ifndef _PRINTF_PARSE_H #define _PRINTF_PARSE_H +/* This file can be parametrized with the following macros: + ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. + STATIC Set to 'static' to declare the function static. */ + #include "printf-args.h" @@ -32,6 +36,9 @@ /* arg_index value indicating that no argument is consumed. */ #define ARG_NONE (~(size_t)0) +/* xxx_directive: A parsed directive. + xxx_directives: A parsed format string. */ + /* A parsed directive. */ typedef struct { @@ -44,7 +51,7 @@ typedef struct const char* precision_start; const char* precision_end; size_t precision_arg_index; - char conversion; /* d i o u x X f e E g G c s p n U % but not C S */ + char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ size_t arg_index; } char_directive; @@ -59,16 +66,114 @@ typedef struct } char_directives; +#if ENABLE_UNISTDIO + +/* A parsed directive. */ +typedef struct +{ + const uint8_t* dir_start; + const uint8_t* dir_end; + int flags; + const uint8_t* width_start; + const uint8_t* width_end; + size_t width_arg_index; + const uint8_t* precision_start; + const uint8_t* precision_end; + size_t precision_arg_index; + uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ + size_t arg_index; +} +u8_directive; + +/* A parsed format string. */ +typedef struct +{ + size_t count; + u8_directive *dir; + size_t max_width_length; + size_t max_precision_length; +} +u8_directives; + +/* A parsed directive. */ +typedef struct +{ + const uint16_t* dir_start; + const uint16_t* dir_end; + int flags; + const uint16_t* width_start; + const uint16_t* width_end; + size_t width_arg_index; + const uint16_t* precision_start; + const uint16_t* precision_end; + size_t precision_arg_index; + uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ + size_t arg_index; +} +u16_directive; + +/* A parsed format string. */ +typedef struct +{ + size_t count; + u16_directive *dir; + size_t max_width_length; + size_t max_precision_length; +} +u16_directives; + +/* A parsed directive. */ +typedef struct +{ + const uint32_t* dir_start; + const uint32_t* dir_end; + int flags; + const uint32_t* width_start; + const uint32_t* width_end; + size_t width_arg_index; + const uint32_t* precision_start; + const uint32_t* precision_end; + size_t precision_arg_index; + uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */ + size_t arg_index; +} +u32_directive; + +/* A parsed format string. */ +typedef struct +{ + size_t count; + u32_directive *dir; + size_t max_width_length; + size_t max_precision_length; +} +u32_directives; + +#endif + /* Parses the format string. Fills in the number N of directives, and fills in directives[0], ..., directives[N-1], and sets directives[N].dir_start to the end of the format string. Also fills in the arg_type fields of the arguments and the needed count of arguments. */ -#ifdef STATIC -STATIC +#if ENABLE_UNISTDIO +extern int + ulc_printf_parse (const char *format, char_directives *d, arguments *a); +extern int + u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a); +extern int + u16_printf_parse (const uint16_t *format, u16_directives *d, + arguments *a); +extern int + u32_printf_parse (const uint32_t *format, u32_directives *d, + arguments *a); #else +# ifdef STATIC +STATIC +# else extern -#endif +# endif int printf_parse (const char *format, char_directives *d, arguments *a); +#endif #endif /* _PRINTF_PARSE_H */ diff -ruNp m4-1.4.9/lib/progname.c m4-1.4.10/lib/progname.c --- m4-1.4.9/lib/progname.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/progname.c 2007-05-30 19:30:32.000000000 -0600 @@ -0,0 +1,50 @@ +/* Program name management. + Copyright (C) 2001-2003, 2005-2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2001. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + + +#include + +/* Specification. */ +#undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */ +#include "progname.h" + +#include + + +/* String containing name the program is called with. + To be initialized by main(). */ +const char *program_name = NULL; + +/* Set program_name, based on argv[0]. */ +void +set_program_name (const char *argv0) +{ + /* libtool creates a temporary executable whose name is sometimes prefixed + with "lt-" (depends on the platform). It also makes argv[0] absolute. + Remove this "/.libs/" or "/.libs/lt-" prefix here. */ + const char *slash; + const char *base; + + slash = strrchr (argv0, '/'); + base = (slash != NULL ? slash + 1 : argv0); + if (base - argv0 >= 7 && memcmp (base - 7, "/.libs/", 7) == 0) + argv0 = base; + if (strncmp (base, "lt-", 3) == 0) + argv0 = base + 3; + program_name = argv0; +} diff -ruNp m4-1.4.9/lib/progname.h m4-1.4.10/lib/progname.h --- m4-1.4.9/lib/progname.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/progname.h 2007-05-30 19:30:32.000000000 -0600 @@ -0,0 +1,61 @@ +/* Program name management. + Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. + Written by Bruno Haible , 2001. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _PROGNAME_H +#define _PROGNAME_H + +/* Programs using this file should do the following in main(): + set_program_name (argv[0]); + */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* String containing name the program is called with. */ +extern const char *program_name; + +/* Set program_name, based on argv[0]. */ +extern void set_program_name (const char *argv0); + +#if ENABLE_RELOCATABLE + +/* Set program_name, based on argv[0], and original installation prefix and + directory, for relocatability. */ +extern void set_program_name_and_installdir (const char *argv0, + const char *orig_installprefix, + const char *orig_installdir); +#undef set_program_name +#define set_program_name(ARG0) \ + set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) + +/* Return the full pathname of the current executable, based on the earlier + call to set_program_name_and_installdir. Return NULL if unknown. */ +extern char *get_full_program_name (void); + +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* _PROGNAME_H */ diff -ruNp m4-1.4.9/lib/regex_internal.h m4-1.4.10/lib/regex_internal.h --- m4-1.4.9/lib/regex_internal.h 2007-03-23 06:50:55.000000000 -0600 +++ m4-1.4.10/lib/regex_internal.h 2007-07-05 05:48:20.000000000 -0600 @@ -48,7 +48,7 @@ #endif /* In case that the system doesn't have isblank(). */ -#if !defined _LIBC && !HAVE_DECL_ISBLANK && !defined isblank +#if !defined _LIBC && ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK)) # define isblank(ch) ((ch) == ' ' || (ch) == '\t') #endif diff -ruNp m4-1.4.9/lib/regexec.c m4-1.4.10/lib/regexec.c --- m4-1.4.9/lib/regexec.c 2007-03-23 06:50:56.000000000 -0600 +++ m4-1.4.10/lib/regexec.c 2007-05-30 19:30:35.000000000 -0600 @@ -1,5 +1,6 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, + Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -2338,7 +2339,7 @@ transit_state (reg_errcode_t *err, re_ma } /* Update the state_log if we need */ -re_dfastate_t * +static re_dfastate_t * internal_function merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, re_dfastate_t *next_state) diff -ruNp m4-1.4.9/lib/signal_.h m4-1.4.10/lib/signal_.h --- m4-1.4.9/lib/signal_.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/signal_.h 2007-07-05 05:48:20.000000000 -0600 @@ -0,0 +1,98 @@ +/* A GNU-like . + + Copyright (C) 2006-2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if defined __need_sig_atomic_t || defined __need_sigset_t +/* Special invocation convention inside glibc header files. */ + +# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_SIGNAL_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ + +#ifndef _GL_SIGNAL_H +#define _GL_SIGNAL_H + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if !@HAVE_POSIX_SIGNALBLOCKING@ + +/* Mingw defines sigset_t not in , but in . */ +# include + +/* Maximum signal number + 1. */ +# ifndef NSIG +# define NSIG 32 +# endif + +/* This code supports only 32 signals. */ +typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1]; + +/* A set or mask of signals. */ +# if !@HAVE_SIGSET_T@ +typedef unsigned int sigset_t; +# endif + +/* Test whether a given signal is contained in a signal set. */ +extern int sigismember (const sigset_t *set, int sig); + +/* Initialize a signal set to the empty set. */ +extern int sigemptyset (sigset_t *set); + +/* Add a signal to a signal set. */ +extern int sigaddset (sigset_t *set, int sig); + +/* Remove a signal from a signal set. */ +extern int sigdelset (sigset_t *set, int sig); + +/* Fill a signal set with all possible signals. */ +extern int sigfillset (sigset_t *set); + +/* Return the set of those blocked signals that are pending. */ +extern int sigpending (sigset_t *set); + +/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET. + Then, if SET is not NULL, affect the current set of blocked signals by + combining it with *SET as indicated in OPERATION. + In this implementation, you are not allowed to change a signal handler + while the signal is blocked. */ +# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */ +# define SIG_SETMASK 1 /* blocked_set = *set; */ +# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ +extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set); + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_SIGNAL_H */ +#endif /* _GL_SIGNAL_H */ +#endif diff -ruNp m4-1.4.9/lib/signbitd.c m4-1.4.10/lib/signbitd.c --- m4-1.4.9/lib/signbitd.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/signbitd.c 2007-05-30 19:30:35.000000000 -0600 @@ -0,0 +1,63 @@ +/* signbit() macro: Determine the sign bit of a floating-point number. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include + +#include +#include "isnan.h" +#include "float+.h" + +#undef gl_signbitd + +int +gl_signbitd (double arg) +{ +#if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT + /* The use of a union to extract the bits of the representation of a + 'long double' is safe in practice, despite of the "aliasing rules" of + C99, because the GCC docs say + "Even with '-fstrict-aliasing', type-punning is allowed, provided the + memory is accessed through the union type." + and similarly for other compilers. */ +# define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + union { double value; unsigned int word[NWORDS]; } m; + m.value = arg; + return (m.word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; +#elif HAVE_COPYSIGN_IN_LIBC + return copysign (1.0, arg) < 0; +#else + /* This does not do the right thing for NaN, but this is irrelevant for + most use cases. */ + if (isnan (arg)) + return 0; + if (arg < 0.0) + return 1; + else if (arg == 0.0) + { + /* Distinguish 0.0 and -0.0. */ + static double plus_zero = 0.0; + double arg_mem = arg; + return (memcmp (&plus_zero, &arg_mem, SIZEOF_DBL) != 0); + } + else + return 0; +#endif +} diff -ruNp m4-1.4.9/lib/signbitf.c m4-1.4.10/lib/signbitf.c --- m4-1.4.9/lib/signbitf.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/signbitf.c 2007-05-30 19:30:35.000000000 -0600 @@ -0,0 +1,63 @@ +/* signbit() macro: Determine the sign bit of a floating-point number. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include + +#include +#include "isnanf.h" +#include "float+.h" + +#undef gl_signbitf + +int +gl_signbitf (float arg) +{ +#if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT + /* The use of a union to extract the bits of the representation of a + 'long double' is safe in practice, despite of the "aliasing rules" of + C99, because the GCC docs say + "Even with '-fstrict-aliasing', type-punning is allowed, provided the + memory is accessed through the union type." + and similarly for other compilers. */ +# define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + union { float value; unsigned int word[NWORDS]; } m; + m.value = arg; + return (m.word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; +#elif HAVE_COPYSIGNF_IN_LIBC + return copysignf (1.0f, arg) < 0; +#else + /* This does not do the right thing for NaN, but this is irrelevant for + most use cases. */ + if (isnanf (arg)) + return 0; + if (arg < 0.0f) + return 1; + else if (arg == 0.0f) + { + /* Distinguish 0.0f and -0.0f. */ + static float plus_zero = 0.0f; + float arg_mem = arg; + return (memcmp (&plus_zero, &arg_mem, SIZEOF_FLT) != 0); + } + else + return 0; +#endif +} diff -ruNp m4-1.4.9/lib/signbitl.c m4-1.4.10/lib/signbitl.c --- m4-1.4.9/lib/signbitl.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/signbitl.c 2007-05-30 19:30:36.000000000 -0600 @@ -0,0 +1,63 @@ +/* signbit() macro: Determine the sign bit of a floating-point number. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include + +#include +#include "isnanl-nolibm.h" +#include "float+.h" + +#undef gl_signbitl + +int +gl_signbitl (long double arg) +{ +#if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT + /* The use of a union to extract the bits of the representation of a + 'long double' is safe in practice, despite of the "aliasing rules" of + C99, because the GCC docs say + "Even with '-fstrict-aliasing', type-punning is allowed, provided the + memory is accessed through the union type." + and similarly for other compilers. */ +# define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + union { long double value; unsigned int word[NWORDS]; } m; + m.value = arg; + return (m.word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; +#elif HAVE_COPYSIGNL_IN_LIBC + return copysignl (1.0L, arg) < 0; +#else + /* This does not do the right thing for NaN, but this is irrelevant for + most use cases. */ + if (isnanl (arg)) + return 0; + if (arg < 0.0L) + return 1; + else if (arg == 0.0L) + { + /* Distinguish 0.0L and -0.0L. */ + static long double plus_zero = 0.0L; + long double arg_mem = arg; + return (memcmp (&plus_zero, &arg_mem, SIZEOF_LDBL) != 0); + } + else + return 0; +#endif +} diff -ruNp m4-1.4.9/lib/sigprocmask.c m4-1.4.10/lib/sigprocmask.c --- m4-1.4.9/lib/sigprocmask.c 2007-03-23 06:50:56.000000000 -0600 +++ m4-1.4.10/lib/sigprocmask.c 2007-05-30 19:30:36.000000000 -0600 @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ #include /* Specification. */ -#include "sigprocmask.h" +#include #include #include diff -ruNp m4-1.4.9/lib/sigprocmask.h m4-1.4.10/lib/sigprocmask.h --- m4-1.4.9/lib/sigprocmask.h 2007-03-23 06:50:56.000000000 -0600 +++ m4-1.4.10/lib/sigprocmask.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,69 +0,0 @@ -/* POSIX compatible signal blocking. - Copyright (C) 2006 Free Software Foundation, Inc. - Written by Bruno Haible , 2006. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include - -#if ! HAVE_POSIX_SIGNALBLOCKING - -/* Mingw defines sigset_t not in , but in . */ -# include - -# include "verify.h" - -/* Maximum signal number + 1. */ -# ifndef NSIG -# define NSIG 32 -# endif - -/* This code supports only 32 signals. */ -verify (NSIG <= 32); - -/* A set or mask of signals. */ -# if !HAVE_SIGSET_T -typedef unsigned int sigset_t; -# endif - -/* Test whether a given signal is contained in a signal set. */ -extern int sigismember (const sigset_t *set, int sig); - -/* Initialize a signal set to the empty set. */ -extern int sigemptyset (sigset_t *set); - -/* Add a signal to a signal set. */ -extern int sigaddset (sigset_t *set, int sig); - -/* Remove a signal from a signal set. */ -extern int sigdelset (sigset_t *set, int sig); - -/* Fill a signal set with all possible signals. */ -extern int sigfillset (sigset_t *set); - -/* Return the set of those blocked signals that are pending. */ -extern int sigpending (sigset_t *set); - -/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET. - Then, if SET is not NULL, affect the current set of blocked signals by - combining it with *SET as indicated in OPERATION. - In this implementation, you are not allowed to change a signal handler - while the signal is blocked. */ -# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */ -# define SIG_SETMASK 1 /* blocked_set = *set; */ -# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ -extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set); - -#endif diff -ruNp m4-1.4.9/lib/stat_.h m4-1.4.10/lib/stat_.h --- m4-1.4.9/lib/stat_.h 2007-03-23 06:50:56.000000000 -0600 +++ m4-1.4.10/lib/stat_.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,275 +0,0 @@ -/* Provide a more complete sys/stat header file. - Copyright (C) 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ - -#ifndef _gl_SYS_STAT_H -#define _gl_SYS_STAT_H - -/* This file is supposed to be used on platforms where is - incomplete. It is intended to provide definitions and prototypes - needed by an application. Start with what the system provides. */ -#include @ABSOLUTE_SYS_STAT_H@ - -#ifndef S_IFMT -# define S_IFMT 0170000 -#endif - -#if STAT_MACROS_BROKEN -# undef S_ISBLK -# undef S_ISCHR -# undef S_ISDIR -# undef S_ISFIFO -# undef S_ISLNK -# undef S_ISNAM -# undef S_ISMPB -# undef S_ISMPC -# undef S_ISNWK -# undef S_ISREG -# undef S_ISSOCK -#endif - -#ifndef S_ISBLK -# ifdef S_IFBLK -# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -# else -# define S_ISBLK(m) 0 -# endif -#endif - -#ifndef S_ISCHR -# ifdef S_IFCHR -# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -# else -# define S_ISCHR(m) 0 -# endif -#endif - -#ifndef S_ISDIR -# ifdef S_IFDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# else -# define S_ISDIR(m) 0 -# endif -#endif - -#ifndef S_ISDOOR /* Solaris 2.5 and up */ -# define S_ISDOOR(m) 0 -#endif - -#ifndef S_ISFIFO -# ifdef S_IFIFO -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -# else -# define S_ISFIFO(m) 0 -# endif -#endif - -#ifndef S_ISLNK -# ifdef S_IFLNK -# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -# else -# define S_ISLNK(m) 0 -# endif -#endif - -#ifndef S_ISMPB /* V7 */ -# ifdef S_IFMPB -# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) -# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) -# else -# define S_ISMPB(m) 0 -# define S_ISMPC(m) 0 -# endif -#endif - -#ifndef S_ISNAM /* Xenix */ -# ifdef S_IFNAM -# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) -# else -# define S_ISNAM(m) 0 -# endif -#endif - -#ifndef S_ISNWK /* HP/UX */ -# ifdef S_IFNWK -# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) -# else -# define S_ISNWK(m) 0 -# endif -#endif - -#ifndef S_ISPORT /* Solaris 10 and up */ -# define S_ISPORT(m) 0 -#endif - -#ifndef S_ISREG -# ifdef S_IFREG -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -# else -# define S_ISREG(m) 0 -# endif -#endif - -#ifndef S_ISSOCK -# ifdef S_IFSOCK -# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -# else -# define S_ISSOCK(m) 0 -# endif -#endif - - -#ifndef S_TYPEISMQ -# define S_TYPEISMQ(p) 0 -#endif - -#ifndef S_TYPEISTMO -# define S_TYPEISTMO(p) 0 -#endif - - -#ifndef S_TYPEISSEM -# ifdef S_INSEM -# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) -# else -# define S_TYPEISSEM(p) 0 -# endif -#endif - -#ifndef S_TYPEISSHM -# ifdef S_INSHD -# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) -# else -# define S_TYPEISSHM(p) 0 -# endif -#endif - -/* high performance ("contiguous data") */ -#ifndef S_ISCTG -# define S_ISCTG(p) 0 -#endif - -/* Cray DMF (data migration facility): off line, with data */ -#ifndef S_ISOFD -# define S_ISOFD(p) 0 -#endif - -/* Cray DMF (data migration facility): off line, with no data */ -#ifndef S_ISOFL -# define S_ISOFL(p) 0 -#endif - -/* 4.4BSD whiteout */ -#ifndef S_ISWHT -# define S_ISWHT(m) 0 -#endif - -/* If any of the following are undefined, - define them to their de facto standard values. */ -#if !S_ISUID -# define S_ISUID 04000 -#endif -#if !S_ISGID -# define S_ISGID 02000 -#endif - -/* S_ISVTX is a common extension to POSIX. */ -#ifndef S_ISVTX -# define S_ISVTX 01000 -#endif - -#if !S_IRUSR && S_IREAD -# define S_IRUSR S_IREAD -#endif -#if !S_IRUSR -# define S_IRUSR 00400 -#endif -#if !S_IRGRP -# define S_IRGRP (S_IRUSR >> 3) -#endif -#if !S_IROTH -# define S_IROTH (S_IRUSR >> 6) -#endif - -#if !S_IWUSR && S_IWRITE -# define S_IWUSR S_IWRITE -#endif -#if !S_IWUSR -# define S_IWUSR 00200 -#endif -#if !S_IWGRP -# define S_IWGRP (S_IWUSR >> 3) -#endif -#if !S_IWOTH -# define S_IWOTH (S_IWUSR >> 6) -#endif - -#if !S_IXUSR && S_IEXEC -# define S_IXUSR S_IEXEC -#endif -#if !S_IXUSR -# define S_IXUSR 00100 -#endif -#if !S_IXGRP -# define S_IXGRP (S_IXUSR >> 3) -#endif -#if !S_IXOTH -# define S_IXOTH (S_IXUSR >> 6) -#endif - -#if !S_IRWXU -# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) -#endif -#if !S_IRWXG -# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) -#endif -#if !S_IRWXO -# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) -#endif - -/* S_IXUGO is a common extension to POSIX. */ -#if !S_IXUGO -# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) -#endif - -#ifndef S_IRWXUGO -# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) -#endif - -/* mingw does not support symlinks, therefore it does not have lstat. But - without links, stat does just fine. */ -#if ! HAVE_LSTAT -# define lstat stat -#endif - -/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. - Additionally, it declares _mkdir (and depending on compile flags, an - alias mkdir), only in the nonstandard io.h. */ -#if ! HAVE_DECL_MKDIR && HAVE_IO_H -# include - -static inline int -rpl_mkdir (char const *name, mode_t mode) -{ - return _mkdir (name); -} - -# define mkdir rpl_mkdir -#endif - -#endif /* _gl_SYS_STAT_H */ diff -ruNp m4-1.4.9/lib/stdbool_.h m4-1.4.10/lib/stdbool_.h --- m4-1.4.9/lib/stdbool_.h 2007-03-23 06:50:57.000000000 -0600 +++ m4-1.4.10/lib/stdbool_.h 2007-05-30 19:30:37.000000000 -0600 @@ -15,8 +15,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _STDBOOL_H -#define _STDBOOL_H +#ifndef _GL_STDBOOL_H +#define _GL_STDBOOL_H /* ISO C 99 for platforms that lack it. */ @@ -115,4 +115,4 @@ typedef enum { _Bool_must_promote_to_int #define true 1 #define __bool_true_false_are_defined 1 -#endif /* _STDBOOL_H */ +#endif /* _GL_STDBOOL_H */ diff -ruNp m4-1.4.9/lib/stdint_.h m4-1.4.10/lib/stdint_.h --- m4-1.4.9/lib/stdint_.h 2007-03-23 06:50:57.000000000 -0600 +++ m4-1.4.10/lib/stdint_.h 2007-07-05 05:48:22.000000000 -0600 @@ -16,14 +16,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _GL_STDINT_H -#define _GL_STDINT_H - /* * ISO C 99 for platforms that lack it. * */ +#ifndef _GL_STDINT_H + /* Get those types that are already defined in other system include files, so that we can "#define int8_t signed char" below without worrying about a later system include file containing a "typedef @@ -42,16 +41,20 @@ /* Other systems may have an incomplete or buggy . Include it before , since any "#include " in would reinclude us, skipping our contents because - _GL_STDINT_H is defined. */ -# include @ABSOLUTE_STDINT_H@ + _GL_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ #endif +#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _GL_STDINT_H + /* defines some of the stdint.h types as well, on glibc, IRIX 6.5, and OpenBSD 3.8 (via ). AIX 5.2 isn't needed and causes troubles. MacOS X 10.4.6 includes (which is us), but relies on the system definitions, so include - after @ABSOLUTE_STDINT_H@. */ + after @NEXT_STDINT_H@. */ #if @HAVE_SYS_TYPES_H@ && ! defined _AIX # include #endif @@ -502,3 +505,4 @@ #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ #endif /* _GL_STDINT_H */ +#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ diff -ruNp m4-1.4.9/lib/stdio_.h m4-1.4.10/lib/stdio_.h --- m4-1.4.9/lib/stdio_.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/stdio_.h 2007-07-05 05:48:23.000000000 -0600 @@ -0,0 +1,312 @@ +/* A GNU-like . + + Copyright (C) 2004, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if defined __need_FILE || defined __need___FILE +/* Special invocation convention inside glibc header files. */ + +#@INCLUDE_NEXT@ @NEXT_STDIO_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_STDIO_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDIO_H@ + +#ifndef _GL_STDIO_H +#define _GL_STDIO_H + +#include +#include + +#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) +/* Get off_t. */ +# include +#endif + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# define __attribute__(Spec) /* empty */ +# endif +/* The __-protected variants of `format' and `printf' attributes + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +# define __format__ format +# define __printf__ printf +# endif +#endif + + +/* The definition of GL_LINK_WARNING is copied here. */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +#if @GNULIB_FPRINTF_POSIX@ +# if @REPLACE_FPRINTF@ +# define fprintf rpl_fprintf +extern int fprintf (FILE *fp, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fprintf +# define fprintf \ + (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \ + "use gnulib module fprintf-posix for portable " \ + "POSIX compliance"), \ + fprintf) +#endif + +#if @GNULIB_VFPRINTF_POSIX@ +# if @REPLACE_VFPRINTF@ +# define vfprintf rpl_vfprintf +extern int vfprintf (FILE *fp, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vfprintf +# define vfprintf(s,f,a) \ + (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \ + "use gnulib module vfprintf-posix for portable " \ + "POSIX compliance"), \ + vfprintf (s, f, a)) +#endif + +#if @GNULIB_PRINTF_POSIX@ +# if @REPLACE_PRINTF@ +/* Don't break __attribute__((format(printf,M,N))). */ +# define printf __printf__ +extern int printf (const char *format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef printf +# define printf \ + (GL_LINK_WARNING ("printf is not always POSIX compliant - " \ + "use gnulib module printf-posix for portable " \ + "POSIX compliance"), \ + printf) +/* Don't break __attribute__((format(printf,M,N))). */ +# define format(kind,m,n) format (__##kind##__, m, n) +# define __format__(kind,m,n) __format__ (__##kind##__, m, n) +# define ____printf____ __printf__ +# define ____scanf____ __scanf__ +# define ____strftime____ __strftime__ +# define ____strfmon____ __strfmon__ +#endif + +#if @GNULIB_VPRINTF_POSIX@ +# if @REPLACE_VPRINTF@ +# define vprintf rpl_vprintf +extern int vprintf (const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 1, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vprintf +# define vprintf(f,a) \ + (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \ + "use gnulib module vprintf-posix for portable " \ + "POSIX compliance"), \ + vprintf (f, a)) +#endif + +#if @GNULIB_SNPRINTF@ +# if @REPLACE_SNPRINTF@ +# define snprintf rpl_snprintf +# endif +# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@ +extern int snprintf (char *str, size_t size, const char *format, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef snprintf +# define snprintf \ + (GL_LINK_WARNING ("snprintf is unportable - " \ + "use gnulib module snprintf for portability"), \ + snprintf) +#endif + +#if @GNULIB_VSNPRINTF@ +# if @REPLACE_VSNPRINTF@ +# define vsnprintf rpl_vsnprintf +# endif +# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@ +extern int vsnprintf (char *str, size_t size, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 3, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsnprintf +# define vsnprintf(b,s,f,a) \ + (GL_LINK_WARNING ("vsnprintf is unportable - " \ + "use gnulib module vsnprintf for portability"), \ + vsnprintf (b, s, f, a)) +#endif + +#if @GNULIB_SPRINTF_POSIX@ +# if @REPLACE_SPRINTF@ +# define sprintf rpl_sprintf +extern int sprintf (char *str, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef sprintf +# define sprintf \ + (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \ + "use gnulib module sprintf-posix for portable " \ + "POSIX compliance"), \ + sprintf) +#endif + +#if @GNULIB_VSPRINTF_POSIX@ +# if @REPLACE_VSPRINTF@ +# define vsprintf rpl_vsprintf +extern int vsprintf (char *str, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsprintf +# define vsprintf(b,f,a) \ + (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \ + "use gnulib module vsprintf-posix for portable " \ + "POSIX compliance"), \ + vsprintf (b, f, a)) +#endif + +#if @GNULIB_VASPRINTF@ +# if @REPLACE_VASPRINTF@ +# define asprintf rpl_asprintf +# define vasprintf rpl_vasprintf +# endif +# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@ + /* Write formatted output to a string dynamically allocated with malloc(). + If the memory allocation succeeds, store the address of the string in + *RESULT and return the number of resulting bytes, excluding the trailing + NUL. Upon memory allocation error, or some other error, return -1. */ + extern int asprintf (char **result, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + extern int vasprintf (char **result, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#endif + +#if @GNULIB_FSEEKO@ +# if @REPLACE_FSEEKO@ +/* Provide fseek, fseeko functions that are aware of a preceding + fflush(), and which detect pipes. */ +# define fseeko rpl_fseeko +extern int fseeko (FILE *fp, off_t offset, int whence); +# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence) +# endif +#elif defined GNULIB_POSIXCHECK +# undef fseeko +# define fseeko(f,o,w) \ + (GL_LINK_WARNING ("fseeko is unportable - " \ + "use gnulib module fseeko for portability"), \ + fseeko (f, o, w)) +#endif + +#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@ +extern int rpl_fseek (FILE *fp, long offset, int whence); +# undef fseek +# if defined GNULIB_POSIXCHECK +# define fseek(f,o,w) \ + (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use fseeko function for handling of large files"), \ + rpl_fseek (f, o, w)) +# else +# define fseek rpl_fseek +# endif +#elif defined GNULIB_POSIXCHECK +# ifndef fseek +# define fseek(f,o,w) \ + (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use fseeko function for handling of large files"), \ + fseek (f, o, w)) +# endif +#endif + +#if @GNULIB_FTELLO@ +# if @REPLACE_FTELLO@ +# define ftello rpl_ftello +extern off_t ftello (FILE *fp); +# define ftell(fp) ftello (fp) +# endif +#elif defined GNULIB_POSIXCHECK +# undef ftello +# define ftello(f) \ + (GL_LINK_WARNING ("ftello is unportable - " \ + "use gnulib module ftello for portability"), \ + ftello (f)) +#endif + +#if @GNULIB_FTELL@ && @REPLACE_FTELL@ +extern long rpl_ftell (FILE *fp); +# undef ftell +# if GNULIB_POSIXCHECK +# define ftell(f) \ + (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use ftello function for handling of large files"), \ + rpl_ftell (f)) +# else +# define ftell rpl_ftell +# endif +#elif defined GNULIB_POSIXCHECK +# ifndef ftell +# define ftell(f) \ + (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use ftello function for handling of large files"), \ + ftell (f)) +# endif +#endif + +#if @GNULIB_FFLUSH@ +# if @REPLACE_FFLUSH@ +# define fflush rpl_fflush + /* Flush all pending data on STREAM according to POSIX rules. Both + output and seekable input streams are supported. + Note! LOSS OF DATA can occur if fflush is applied on an input stream + that is _not_seekable_ or on an update stream that is _not_seekable_ + and in which the most recent operation was input. Seekability can + be tested with lseek(fileno(fp),0,SEEK_CUR). */ + extern int fflush (FILE *gl_stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fflush +# define fflush(f) \ + (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \ + "use gnulib module fflush for portable " \ + "POSIX compliance"), \ + fflush (f)) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_STDIO_H */ +#endif /* _GL_STDIO_H */ +#endif diff -ruNp m4-1.4.9/lib/stdlib_.h m4-1.4.10/lib/stdlib_.h --- m4-1.4.9/lib/stdlib_.h 2007-03-23 06:50:58.000000000 -0600 +++ m4-1.4.10/lib/stdlib_.h 2007-07-05 05:48:24.000000000 -0600 @@ -19,28 +19,18 @@ #if defined __need_malloc_and_calloc /* Special invocation convention inside glibc header files. */ -/* This #pragma avoids a warning with "gcc -Wall" on some glibc systems - on which has an inappropriate declaration, see - . */ -#ifdef __GNUC__ -# pragma GCC system_header -#endif - -#include @ABSOLUTE_STDLIB_H@ +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ #else /* Normal invocation convention. */ + #ifndef _GL_STDLIB_H -#define _GL_STDLIB_H -/* This #pragma avoids a warning with "gcc -Wall" on some glibc systems - on which has an inappropriate declaration, see - . */ -#ifdef __GNUC__ -# pragma GCC system_header -#endif +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ -#include @ABSOLUTE_STDLIB_H@ +#ifndef _GL_STDLIB_H +#define _GL_STDLIB_H /* The definition of GL_LINK_WARNING is copied here. */ @@ -96,7 +86,7 @@ extern int getsubopt (char **optionp, ch they are replaced with a string that makes the directory name unique. Returns TEMPLATE, or a null pointer if it cannot get a unique name. The directory is created mode 700. */ -extern char * mkdtemp (char *template); +extern char * mkdtemp (char * /*template*/); # endif #elif defined GNULIB_POSIXCHECK # undef mkdtemp @@ -119,7 +109,7 @@ extern char * mkdtemp (char *template); Returns the open file descriptor if successful, otherwise -1 and errno set. */ # define mkstemp rpl_mkstemp -extern int mkstemp (char *template); +extern int mkstemp (char * /*template*/); # else /* On MacOS X 10.3, only declares mkstemp. */ # include @@ -138,4 +128,5 @@ extern int mkstemp (char *template); #endif #endif /* _GL_STDLIB_H */ +#endif /* _GL_STDLIB_H */ #endif diff -ruNp m4-1.4.9/lib/sys_stat_.h m4-1.4.10/lib/sys_stat_.h --- m4-1.4.9/lib/sys_stat_.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/sys_stat_.h 2007-07-05 05:48:25.000000000 -0600 @@ -0,0 +1,280 @@ +/* Provide a more complete sys/stat header file. + Copyright (C) 2006, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ + +/* This file is supposed to be used on platforms where is + incomplete. It is intended to provide definitions and prototypes + needed by an application. Start with what the system provides. */ + +#ifndef _GL_SYS_STAT_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ + +#ifndef _GL_SYS_STAT_H +#define _GL_SYS_STAT_H + +#ifndef S_IFMT +# define S_IFMT 0170000 +#endif + +#if STAT_MACROS_BROKEN +# undef S_ISBLK +# undef S_ISCHR +# undef S_ISDIR +# undef S_ISFIFO +# undef S_ISLNK +# undef S_ISNAM +# undef S_ISMPB +# undef S_ISMPC +# undef S_ISNWK +# undef S_ISREG +# undef S_ISSOCK +#endif + +#ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +#endif + +#ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +#endif + +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +#endif + +#ifndef S_ISDOOR /* Solaris 2.5 and up */ +# define S_ISDOOR(m) 0 +#endif + +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +#endif + +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +#endif + +#ifndef S_ISMPB /* V7 */ +# ifdef S_IFMPB +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +# else +# define S_ISMPB(m) 0 +# define S_ISMPC(m) 0 +# endif +#endif + +#ifndef S_ISNAM /* Xenix */ +# ifdef S_IFNAM +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) +# else +# define S_ISNAM(m) 0 +# endif +#endif + +#ifndef S_ISNWK /* HP/UX */ +# ifdef S_IFNWK +# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) +# else +# define S_ISNWK(m) 0 +# endif +#endif + +#ifndef S_ISPORT /* Solaris 10 and up */ +# define S_ISPORT(m) 0 +#endif + +#ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +#endif + +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +#endif + + +#ifndef S_TYPEISMQ +# define S_TYPEISMQ(p) 0 +#endif + +#ifndef S_TYPEISTMO +# define S_TYPEISTMO(p) 0 +#endif + + +#ifndef S_TYPEISSEM +# ifdef S_INSEM +# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) +# else +# define S_TYPEISSEM(p) 0 +# endif +#endif + +#ifndef S_TYPEISSHM +# ifdef S_INSHD +# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) +# else +# define S_TYPEISSHM(p) 0 +# endif +#endif + +/* high performance ("contiguous data") */ +#ifndef S_ISCTG +# define S_ISCTG(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with data */ +#ifndef S_ISOFD +# define S_ISOFD(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with no data */ +#ifndef S_ISOFL +# define S_ISOFL(p) 0 +#endif + +/* 4.4BSD whiteout */ +#ifndef S_ISWHT +# define S_ISWHT(m) 0 +#endif + +/* If any of the following are undefined, + define them to their de facto standard values. */ +#if !S_ISUID +# define S_ISUID 04000 +#endif +#if !S_ISGID +# define S_ISGID 02000 +#endif + +/* S_ISVTX is a common extension to POSIX. */ +#ifndef S_ISVTX +# define S_ISVTX 01000 +#endif + +#if !S_IRUSR && S_IREAD +# define S_IRUSR S_IREAD +#endif +#if !S_IRUSR +# define S_IRUSR 00400 +#endif +#if !S_IRGRP +# define S_IRGRP (S_IRUSR >> 3) +#endif +#if !S_IROTH +# define S_IROTH (S_IRUSR >> 6) +#endif + +#if !S_IWUSR && S_IWRITE +# define S_IWUSR S_IWRITE +#endif +#if !S_IWUSR +# define S_IWUSR 00200 +#endif +#if !S_IWGRP +# define S_IWGRP (S_IWUSR >> 3) +#endif +#if !S_IWOTH +# define S_IWOTH (S_IWUSR >> 6) +#endif + +#if !S_IXUSR && S_IEXEC +# define S_IXUSR S_IEXEC +#endif +#if !S_IXUSR +# define S_IXUSR 00100 +#endif +#if !S_IXGRP +# define S_IXGRP (S_IXUSR >> 3) +#endif +#if !S_IXOTH +# define S_IXOTH (S_IXUSR >> 6) +#endif + +#if !S_IRWXU +# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#endif +#if !S_IRWXG +# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +#endif +#if !S_IRWXO +# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +#endif + +/* S_IXUGO is a common extension to POSIX. */ +#if !S_IXUGO +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +#endif + +#ifndef S_IRWXUGO +# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) +#endif + +/* mingw does not support symlinks, therefore it does not have lstat. But + without links, stat does just fine. */ +#if ! @HAVE_LSTAT@ +# define lstat stat +#endif + +/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. + Additionally, it declares _mkdir (and depending on compile flags, an + alias mkdir), only in the nonstandard io.h. */ +#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@ +# include + +static inline int +rpl_mkdir (char const *name, mode_t mode) +{ + return _mkdir (name); +} + +# define mkdir rpl_mkdir +#endif + +#endif /* _GL_SYS_STAT_H */ +#endif /* _GL_SYS_STAT_H */ diff -ruNp m4-1.4.9/lib/sys_time_.h m4-1.4.10/lib/sys_time_.h --- m4-1.4.9/lib/sys_time_.h 2007-03-23 06:50:58.000000000 -0600 +++ m4-1.4.10/lib/sys_time_.h 2007-07-09 21:12:29.000000000 -0600 @@ -18,27 +18,35 @@ /* Written by Paul Eggert. */ -#ifndef _gl_SYS_TIME_H -#define _gl_SYS_TIME_H +#if defined _GL_SYS_TIME_H + +/* Simply delegate to the system's header, without adding anything. */ +# if @HAVE_SYS_TIME_H@ +# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ +# endif -#if @HAVE_SYS_TIME_H@ -# include @ABSOLUTE_SYS_TIME_H@ #else -# include -#endif -#if ! @HAVE_STRUCT_TIMEVAL@ +# define _GL_SYS_TIME_H + +# if @HAVE_SYS_TIME_H@ +# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ +# else +# include +# endif + +# if ! @HAVE_STRUCT_TIMEVAL@ struct timeval { time_t tv_sec; long int tv_usec; }; -#endif +# endif -#if @REPLACE_GETTIMEOFDAY@ -# undef gettimeofday -# define gettimeofday rpl_gettimeofday +# if @REPLACE_GETTIMEOFDAY@ +# undef gettimeofday +# define gettimeofday rpl_gettimeofday int gettimeofday (struct timeval *restrict, void *restrict); -#endif +# endif -#endif /* _gl_SYS_TIME_H */ +#endif /* _GL_SYS_TIME_H */ diff -ruNp m4-1.4.9/lib/unistd_.h m4-1.4.10/lib/unistd_.h --- m4-1.4.9/lib/unistd_.h 2007-03-23 06:51:00.000000000 -0600 +++ m4-1.4.10/lib/unistd_.h 2007-07-05 05:48:26.000000000 -0600 @@ -16,12 +16,22 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GL_UNISTD_H -#define _GL_UNISTD_H +/* The include_next requires a split double-inclusion guard. */ #if @HAVE_UNISTD_H@ -# include @ABSOLUTE_UNISTD_H@ +# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ #endif +#ifndef _GL_UNISTD_H +#define _GL_UNISTD_H + +/* mingw doesn't define the SEEK_* macros in . */ +#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) +# include +#endif + +/* mingw fails to declare _exit in . */ +#include /* The definition of GL_LINK_WARNING is copied here. */ @@ -35,13 +45,18 @@ extern "C" { #if @GNULIB_CHOWN@ # if @REPLACE_CHOWN@ +# ifndef REPLACE_CHOWN +# define REPLACE_CHOWN 1 +# endif +# if REPLACE_CHOWN /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE - to GID (if GID is not -1). + to GID (if GID is not -1). Follow symbolic links. Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification . */ -# define chown rpl_chown +# define chown rpl_chown extern int chown (const char *file, uid_t uid, gid_t gid); +# endif # endif #elif defined GNULIB_POSIXCHECK # undef chown @@ -165,6 +180,43 @@ extern int getlogin_r (char *name, size_ #endif +#if @GNULIB_LCHOWN@ +# if @REPLACE_LCHOWN@ +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE + to GID (if GID is not -1). Do not follow symbolic links. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +# define lchown rpl_lchown +extern int lchown (char const *file, uid_t owner, gid_t group); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lchown +# define lchown(f,u,g) \ + (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \ + "systems - use gnulib module lchown for portability"), \ + lchown (f, u, g)) +#endif + + +#if @GNULIB_LSEEK@ +# if @REPLACE_LSEEK@ +/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. + Return the new offset if successful, otherwise -1 and errno set. + See the POSIX:2001 specification + . */ +# define lseek rpl_lseek + extern off_t lseek (int fd, off_t offset, int whence); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lseek +# define lseek(f,o,w) \ + (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \ + "systems - use gnulib module lseek for portability"), \ + lseek (f, o, w)) +#endif + + #if @GNULIB_READLINK@ /* Read the contents of the symbolic link FILE and place the first BUFSIZE bytes of it into BUF. Return the number of bytes placed into BUF if @@ -184,9 +236,27 @@ extern int readlink (const char *file, c #endif +#if @GNULIB_SLEEP@ +/* Pause the execution of the current thread for N seconds. + Returns the number of seconds left to sleep. + See the POSIX:2001 specification + . */ +# if !@HAVE_SLEEP@ +extern unsigned int sleep (unsigned int n); +# endif +#elif defined GNULIB_POSIXCHECK +# undef sleep +# define sleep(n) \ + (GL_LINK_WARNING ("sleep is unportable - " \ + "use gnulib module sleep for portability"), \ + sleep (n)) +#endif + + #ifdef __cplusplus } #endif #endif /* _GL_UNISTD_H */ +#endif /* _GL_UNISTD_H */ diff -ruNp m4-1.4.9/lib/vasnprintf.c m4-1.4.10/lib/vasnprintf.c --- m4-1.4.9/lib/vasnprintf.c 2007-03-23 06:51:01.000000000 -0600 +++ m4-1.4.10/lib/vasnprintf.c 2007-07-05 05:48:27.000000000 -0600 @@ -15,6 +15,35 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* This file can be parametrized with the following macros: + VASNPRINTF The name of the function being defined. + FCHAR_T The element type of the format string. + DCHAR_T The element type of the destination (result) string. + FCHAR_T_ONLY_ASCII Set to 1 to enable verification that all characters + in the format string are ASCII. MUST be set if + FCHAR_T and DCHAR_T are not the same type. + DIRECTIVE Structure denoting a format directive. + Depends on FCHAR_T. + DIRECTIVES Structure denoting the set of format directives of a + format string. Depends on FCHAR_T. + PRINTF_PARSE Function that parses a format string. + Depends on FCHAR_T. + DCHAR_CPY memcpy like function for DCHAR_T[] arrays. + DCHAR_SET memset like function for DCHAR_T[] arrays. + DCHAR_MBSNLEN mbsnlen like function for DCHAR_T[] arrays. + SNPRINTF The system's snprintf (or similar) function. + This may be either snprintf or swprintf. + TCHAR_T The element type of the argument and result string + of the said SNPRINTF function. This may be either + char or wchar_t. The code exploits that + sizeof (TCHAR_T) | sizeof (DCHAR_T) and + alignof (TCHAR_T) <= alignof (DCHAR_T). + DCHAR_IS_TCHAR Set to 1 if DCHAR_T and TCHAR_T are the same type. + DCHAR_CONV_FROM_ENCODING A function to convert from char[] to DCHAR[]. + DCHAR_IS_UINT8_T Set to 1 if DCHAR_T is uint8_t. + DCHAR_IS_UINT16_T Set to 1 if DCHAR_T is uint16_t. + DCHAR_IS_UINT32_T Set to 1 if DCHAR_T is uint32_t. */ + /* Tell glibc's to provide a prototype for snprintf(). This must come before because may include , and once has been included, it's too late. */ @@ -22,16 +51,20 @@ # define _GNU_SOURCE 1 #endif -#include +#ifndef VASNPRINTF +# include +#endif #ifndef IN_LIBINTL # include #endif /* Specification. */ -#if WIDE_CHAR_VERSION -# include "vasnwprintf.h" -#else -# include "vasnprintf.h" +#ifndef VASNPRINTF +# if WIDE_CHAR_VERSION +# include "vasnwprintf.h" +# else +# include "vasnprintf.h" +# endif #endif #include /* localeconv() */ @@ -41,22 +74,44 @@ #include /* errno */ #include /* CHAR_BIT */ #include /* DBL_MAX_EXP, LDBL_MAX_EXP */ -#if WIDE_CHAR_VERSION -# include "wprintf-parse.h" -#else -# include "printf-parse.h" +#if HAVE_NL_LANGINFO +# include +#endif +#ifndef VASNPRINTF +# if WIDE_CHAR_VERSION +# include "wprintf-parse.h" +# else +# include "printf-parse.h" +# endif #endif /* Checked size_t computations. */ #include "xsize.h" +#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL +# include +# include "float+.h" +# include "fpucw.h" +#endif + +#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL +# include +# include "isnan.h" +#endif + +#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL +# include +# include "isnanl-nolibm.h" +# include "fpucw.h" +#endif + #if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL +# include # include "isnan.h" +# include "printf-frexp.h" # include "isnanl-nolibm.h" -# if HAVE_LONG_DOUBLE -# include "printf-frexp.h" -# include "printf-frexpl.h" -# endif +# include "printf-frexpl.h" +# include "fpucw.h" #endif /* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ @@ -87,12 +142,32 @@ local_wcslen (const wchar_t *s) # endif #endif +/* Default parameters. */ +#ifndef VASNPRINTF +# if WIDE_CHAR_VERSION +# define VASNPRINTF vasnwprintf +# define FCHAR_T wchar_t +# define DCHAR_T wchar_t +# define TCHAR_T wchar_t +# define DCHAR_IS_TCHAR 1 +# define DIRECTIVE wchar_t_directive +# define DIRECTIVES wchar_t_directives +# define PRINTF_PARSE wprintf_parse +# define DCHAR_CPY wmemcpy +# else +# define VASNPRINTF vasnprintf +# define FCHAR_T char +# define DCHAR_T char +# define TCHAR_T char +# define DCHAR_IS_TCHAR 1 +# define DIRECTIVE char_directive +# define DIRECTIVES char_directives +# define PRINTF_PARSE printf_parse +# define DCHAR_CPY memcpy +# endif +#endif #if WIDE_CHAR_VERSION -# define VASNPRINTF vasnwprintf -# define CHAR_T wchar_t -# define DIRECTIVE wchar_t_directive -# define DIRECTIVES wchar_t_directives -# define PRINTF_PARSE wprintf_parse + /* TCHAR_T is wchar_t. */ # define USE_SNPRINTF 1 # if HAVE_DECL__SNWPRINTF /* On Windows, the function swprintf() has a different signature than @@ -103,12 +178,15 @@ local_wcslen (const wchar_t *s) # define SNPRINTF swprintf # endif #else -# define VASNPRINTF vasnprintf -# define CHAR_T char -# define DIRECTIVE char_directive -# define DIRECTIVES char_directives -# define PRINTF_PARSE printf_parse -# define USE_SNPRINTF (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) + /* TCHAR_T is char. */ +# /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'. + But don't use it on BeOS, since BeOS snprintf produces no output if the + size argument is >= 0x3000000. */ +# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ +# define USE_SNPRINTF 1 +# else +# define USE_SNPRINTF 0 +# endif # if HAVE_DECL__SNPRINTF /* Windows. */ # define SNPRINTF _snprintf @@ -122,8 +200,997 @@ local_wcslen (const wchar_t *s) /* Here we need to call the native sprintf, not rpl_sprintf. */ #undef sprintf -CHAR_T * -VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list args) +#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL +/* Determine the decimal-point character according to the current locale. */ +# ifndef decimal_point_char_defined +# define decimal_point_char_defined 1 +static char +decimal_point_char () +{ + const char *point; + /* Determine it in a multithread-safe way. We know nl_langinfo is + multithread-safe on glibc systems, but is not required to be multithread- + safe by POSIX. sprintf(), however, is multithread-safe. localeconv() + is rarely multithread-safe. */ +# if HAVE_NL_LANGINFO && __GLIBC__ + point = nl_langinfo (RADIXCHAR); +# elif 1 + char pointbuf[5]; + sprintf (pointbuf, "%#.0f", 1.0); + point = &pointbuf[1]; +# else + point = localeconv () -> decimal_point; +# endif + /* The decimal point is always a single byte: either '.' or ','. */ + return (point[0] != '\0' ? point[0] : '.'); +} +# endif +#endif + +#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL + +/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */ +static int +is_infinite_or_zero (double x) +{ + return isnan (x) || x + x == x; +} + +#endif + +#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL + +/* Equivalent to !isfinite(x), but does not require libm. */ +static int +is_infinitel (long double x) +{ + return isnanl (x) || (x + x == x && x != 0.0L); +} + +#endif + +#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL + +/* Converting 'long double' to decimal without rare rounding bugs requires + real bignums. We use the naming conventions of GNU gmp, but vastly simpler + (and slower) algorithms. */ + +typedef unsigned int mp_limb_t; +# define GMP_LIMB_BITS 32 +typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS) - 1]; + +typedef unsigned long long mp_twolimb_t; +# define GMP_TWOLIMB_BITS 64 +typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS) - 1]; + +/* Representation of a bignum >= 0. */ +typedef struct +{ + size_t nlimbs; + mp_limb_t *limbs; /* Bits in little-endian order, allocated with malloc(). */ +} mpn_t; + +/* Compute the product of two bignums >= 0. + Return the allocated memory in case of success, NULL in case of memory + allocation failure. */ +static void * +multiply (mpn_t src1, mpn_t src2, mpn_t *dest) +{ + const mp_limb_t *p1; + const mp_limb_t *p2; + size_t len1; + size_t len2; + + if (src1.nlimbs <= src2.nlimbs) + { + len1 = src1.nlimbs; + p1 = src1.limbs; + len2 = src2.nlimbs; + p2 = src2.limbs; + } + else + { + len1 = src2.nlimbs; + p1 = src2.limbs; + len2 = src1.nlimbs; + p2 = src1.limbs; + } + /* Now 0 <= len1 <= len2. */ + if (len1 == 0) + { + /* src1 or src2 is zero. */ + dest->nlimbs = 0; + dest->limbs = (mp_limb_t *) malloc (1); + } + else + { + /* Here 1 <= len1 <= len2. */ + size_t dlen; + mp_limb_t *dp; + size_t k, i, j; + + dlen = len1 + len2; + dp = (mp_limb_t *) malloc (dlen * sizeof (mp_limb_t)); + if (dp == NULL) + return NULL; + for (k = len2; k > 0; ) + dp[--k] = 0; + for (i = 0; i < len1; i++) + { + mp_limb_t digit1 = p1[i]; + mp_twolimb_t carry = 0; + for (j = 0; j < len2; j++) + { + mp_limb_t digit2 = p2[j]; + carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; + carry += dp[i + j]; + dp[i + j] = (mp_limb_t) carry; + carry = carry >> GMP_LIMB_BITS; + } + dp[i + len2] = (mp_limb_t) carry; + } + /* Normalise. */ + while (dlen > 0 && dp[dlen - 1] == 0) + dlen--; + dest->nlimbs = dlen; + dest->limbs = dp; + } + return dest->limbs; +} + +/* Compute the quotient of a bignum a >= 0 and a bignum b > 0. + a is written as a = q * b + r with 0 <= r < b. q is the quotient, r + the remainder. + Finally, round-to-even is performed: If r > b/2 or if r = b/2 and q is odd, + q is incremented. + Return the allocated memory in case of success, NULL in case of memory + allocation failure. */ +static void * +divide (mpn_t a, mpn_t b, mpn_t *q) +{ + /* Algorithm: + First normalise a and b: a=[a[m-1],...,a[0]], b=[b[n-1],...,b[0]] + with m>=0 and n>0 (in base beta = 2^GMP_LIMB_BITS). + If m=n=1, perform a single-precision division: + r:=0, j:=m, + while j>0 do + {Here (q[m-1]*beta^(m-1)+...+q[j]*beta^j) * b[0] + r*beta^j = + = a[m-1]*beta^(m-1)+...+a[j]*beta^j und 0<=r=n>1, perform a multiple-precision division: + We have a/b < beta^(m-n+1). + s:=intDsize-1-(hightest bit in b[n-1]), 0<=s=beta/2. + For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).} + Compute q* : + q* := floor((r[j+n]*beta+r[j+n-1])/b[n-1]). + In case of overflow (q* >= beta) set q* := beta-1. + Compute c2 := ((r[j+n]*beta+r[j+n-1]) - q* * b[n-1])*beta + r[j+n-2] + and c3 := b[n-2] * q*. + {We have 0 <= c2 < 2*beta^2, even 0 <= c2 < beta^2 if no overflow + occurred. Furthermore 0 <= c3 < beta^2. + If there was overflow and + r[j+n]*beta+r[j+n-1] - q* * b[n-1] >= beta, i.e. c2 >= beta^2, + the next test can be skipped.} + While c3 > c2, {Here 0 <= c2 < c3 < beta^2} + Put q* := q* - 1, c2 := c2 + b[n-1]*beta, c3 := c3 - b[n-2]. + If q* > 0: + Put r := r - b * q* * beta^j. In detail: + [r[n+j],...,r[j]] := [r[n+j],...,r[j]] - q* * [b[n-1],...,b[0]]. + hence: u:=0, for i:=0 to n-1 do + u := u + q* * b[i], + r[j+i]:=r[j+i]-(u mod beta) (+ beta, if carry), + u:=u div beta (+ 1, if carry in subtraction) + r[n+j]:=r[n+j]-u. + {Since always u = (q* * [b[i-1],...,b[0]] div beta^i) + 1 + < q* + 1 <= beta, + the carry u does not overflow.} + If a negative carry occurs, put q* := q* - 1 + and [r[n+j],...,r[j]] := [r[n+j],...,r[j]] + [0,b[n-1],...,b[0]]. + Set q[j] := q*. + Normalise [q[m-n],..,q[0]]; this yields the quotient q. + Shift [r[n-1],...,r[0]] right by s bits and normalise; this yields the + rest r. + The room for q[j] can be allocated at the memory location of r[n+j]. + Finally, round-to-even: + Shift r left by 1 bit. + If r > b or if r = b and q[0] is odd, q := q+1. + */ + const mp_limb_t *a_ptr = a.limbs; + size_t a_len = a.nlimbs; + const mp_limb_t *b_ptr = b.limbs; + size_t b_len = b.nlimbs; + mp_limb_t *roomptr; + mp_limb_t *tmp_roomptr = NULL; + mp_limb_t *q_ptr; + size_t q_len; + mp_limb_t *r_ptr; + size_t r_len; + + /* Allocate room for a_len+2 digits. + (Need a_len+1 digits for the real division and 1 more digit for the + final rounding of q.) */ + roomptr = (mp_limb_t *) malloc ((a_len + 2) * sizeof (mp_limb_t)); + if (roomptr == NULL) + return NULL; + + /* Normalise a. */ + while (a_len > 0 && a_ptr[a_len - 1] == 0) + a_len--; + + /* Normalise b. */ + for (;;) + { + if (b_len == 0) + /* Division by zero. */ + abort (); + if (b_ptr[b_len - 1] == 0) + b_len--; + else + break; + } + + /* Here m = a_len >= 0 and n = b_len > 0. */ + + if (a_len < b_len) + { + /* m beta^(m-2) <= a/b < beta^m */ + r_ptr = roomptr; + q_ptr = roomptr + 1; + { + mp_limb_t den = b_ptr[0]; + mp_limb_t remainder = 0; + const mp_limb_t *sourceptr = a_ptr + a_len; + mp_limb_t *destptr = q_ptr + a_len; + size_t count; + for (count = a_len; count > 0; count--) + { + mp_twolimb_t num = + ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--sourceptr; + *--destptr = num / den; + remainder = num % den; + } + /* Normalise and store r. */ + if (remainder > 0) + { + r_ptr[0] = remainder; + r_len = 1; + } + else + r_len = 0; + /* Normalise q. */ + q_len = a_len; + if (q_ptr[q_len - 1] == 0) + q_len--; + } + } + else + { + /* n>1: multiple precision division. + beta^(m-1) <= a < beta^m, beta^(n-1) <= b < beta^n ==> + beta^(m-n-1) <= a/b < beta^(m-n+1). */ + /* Determine s. */ + size_t s; + { + mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */ + s = 31; + if (msd >= 0x10000) + { + msd = msd >> 16; + s -= 16; + } + if (msd >= 0x100) + { + msd = msd >> 8; + s -= 8; + } + if (msd >= 0x10) + { + msd = msd >> 4; + s -= 4; + } + if (msd >= 0x4) + { + msd = msd >> 2; + s -= 2; + } + if (msd >= 0x2) + { + msd = msd >> 1; + s -= 1; + } + } + /* 0 <= s < GMP_LIMB_BITS. + Copy b, shifting it left by s bits. */ + if (s > 0) + { + tmp_roomptr = (mp_limb_t *) malloc (b_len * sizeof (mp_limb_t)); + if (tmp_roomptr == NULL) + { + free (roomptr); + return NULL; + } + { + const mp_limb_t *sourceptr = b_ptr; + mp_limb_t *destptr = tmp_roomptr; + mp_twolimb_t accu = 0; + size_t count; + for (count = b_len; count > 0; count--) + { + accu += (mp_twolimb_t) *sourceptr++ << s; + *destptr++ = (mp_limb_t) accu; + accu = accu >> GMP_LIMB_BITS; + } + /* accu must be zero, since that was how s was determined. */ + if (accu != 0) + abort (); + } + b_ptr = tmp_roomptr; + } + /* Copy a, shifting it left by s bits, yields r. + Memory layout: + At the beginning: r = roomptr[0..a_len], + at the end: r = roomptr[0..b_len-1], q = roomptr[b_len..a_len] */ + r_ptr = roomptr; + if (s == 0) + { + memcpy (r_ptr, a_ptr, a_len * sizeof (mp_limb_t)); + r_ptr[a_len] = 0; + } + else + { + const mp_limb_t *sourceptr = a_ptr; + mp_limb_t *destptr = r_ptr; + mp_twolimb_t accu = 0; + size_t count; + for (count = a_len; count > 0; count--) + { + accu += (mp_twolimb_t) *sourceptr++ << s; + *destptr++ = (mp_limb_t) accu; + accu = accu >> GMP_LIMB_BITS; + } + *destptr++ = (mp_limb_t) accu; + } + q_ptr = roomptr + b_len; + q_len = a_len - b_len + 1; /* q will have m-n+1 limbs */ + { + size_t j = a_len - b_len; /* m-n */ + mp_limb_t b_msd = b_ptr[b_len - 1]; /* b[n-1] */ + mp_limb_t b_2msd = b_ptr[b_len - 2]; /* b[n-2] */ + mp_twolimb_t b_msdd = /* b[n-1]*beta+b[n-2] */ + ((mp_twolimb_t) b_msd << GMP_LIMB_BITS) | b_2msd; + /* Division loop, traversed m-n+1 times. + j counts down, b is unchanged, beta/2 <= b[n-1] < beta. */ + for (;;) + { + mp_limb_t q_star; + mp_limb_t c1; + if (r_ptr[j + b_len] < b_msd) /* r[j+n] < b[n-1] ? */ + { + /* Divide r[j+n]*beta+r[j+n-1] by b[n-1], no overflow. */ + mp_twolimb_t num = + ((mp_twolimb_t) r_ptr[j + b_len] << GMP_LIMB_BITS) + | r_ptr[j + b_len - 1]; + q_star = num / b_msd; + c1 = num % b_msd; + } + else + { + /* Overflow, hence r[j+n]*beta+r[j+n-1] >= beta*b[n-1]. */ + q_star = (mp_limb_t)~(mp_limb_t)0; /* q* = beta-1 */ + /* Test whether r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] >= beta + <==> r[j+n]*beta+r[j+n-1] + b[n-1] >= beta*b[n-1]+beta + <==> b[n-1] < floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) + {<= beta !}. + If yes, jump directly to the subtraction loop. + (Otherwise, r[j+n]*beta+r[j+n-1] - (beta-1)*b[n-1] < beta + <==> floor((r[j+n]*beta+r[j+n-1]+b[n-1])/beta) = b[n-1] ) */ + if (r_ptr[j + b_len] > b_msd + || (c1 = r_ptr[j + b_len - 1] + b_msd) < b_msd) + /* r[j+n] >= b[n-1]+1 or + r[j+n] = b[n-1] and the addition r[j+n-1]+b[n-1] gives a + carry. */ + goto subtract; + } + /* q_star = q*, + c1 = (r[j+n]*beta+r[j+n-1]) - q* * b[n-1] (>=0, 0, decrease it by + b[n-1]*beta+b[n-2]. Because of b[n-1]*beta+b[n-2] >= beta^2/2 + this can happen only twice. */ + if (c3 > c2) + { + q_star = q_star - 1; /* q* := q* - 1 */ + if (c3 - c2 > b_msdd) + q_star = q_star - 1; /* q* := q* - 1 */ + } + } + if (q_star > 0) + subtract: + { + /* Subtract r := r - b * q* * beta^j. */ + mp_limb_t cr; + { + const mp_limb_t *sourceptr = b_ptr; + mp_limb_t *destptr = r_ptr + j; + mp_twolimb_t carry = 0; + size_t count; + for (count = b_len; count > 0; count--) + { + /* Here 0 <= carry <= q*. */ + carry = + carry + + (mp_twolimb_t) q_star * (mp_twolimb_t) *sourceptr++ + + (mp_limb_t) ~(*destptr); + /* Here 0 <= carry <= beta*q* + beta-1. */ + *destptr++ = ~(mp_limb_t) carry; + carry = carry >> GMP_LIMB_BITS; /* <= q* */ + } + cr = (mp_limb_t) carry; + } + /* Subtract cr from r_ptr[j + b_len], then forget about + r_ptr[j + b_len]. */ + if (cr > r_ptr[j + b_len]) + { + /* Subtraction gave a carry. */ + q_star = q_star - 1; /* q* := q* - 1 */ + /* Add b back. */ + { + const mp_limb_t *sourceptr = b_ptr; + mp_limb_t *destptr = r_ptr + j; + mp_limb_t carry = 0; + size_t count; + for (count = b_len; count > 0; count--) + { + mp_limb_t source1 = *sourceptr++; + mp_limb_t source2 = *destptr; + *destptr++ = source1 + source2 + carry; + carry = + (carry + ? source1 >= (mp_limb_t) ~source2 + : source1 > (mp_limb_t) ~source2); + } + } + /* Forget about the carry and about r[j+n]. */ + } + } + /* q* is determined. Store it as q[j]. */ + q_ptr[j] = q_star; + if (j == 0) + break; + j--; + } + } + r_len = b_len; + /* Normalise q. */ + if (q_ptr[q_len - 1] == 0) + q_len--; +# if 0 /* Not needed here, since we need r only to compare it with b/2, and + b is shifted left by s bits. */ + /* Shift r right by s bits. */ + if (s > 0) + { + mp_limb_t ptr = r_ptr + r_len; + mp_twolimb_t accu = 0; + size_t count; + for (count = r_len; count > 0; count--) + { + accu = (mp_twolimb_t) (mp_limb_t) accu << GMP_LIMB_BITS; + accu += (mp_twolimb_t) *--ptr << (GMP_LIMB_BITS - s); + *ptr = (mp_limb_t) (accu >> GMP_LIMB_BITS); + } + } +# endif + /* Normalise r. */ + while (r_len > 0 && r_ptr[r_len - 1] == 0) + r_len--; + } + /* Compare r << 1 with b. */ + if (r_len > b_len) + goto increment_q; + { + size_t i; + for (i = b_len;;) + { + mp_limb_t r_i = + (i <= r_len && i > 0 ? r_ptr[i - 1] >> (GMP_LIMB_BITS - 1) : 0) + | (i < r_len ? r_ptr[i] << 1 : 0); + mp_limb_t b_i = (i < b_len ? b_ptr[i] : 0); + if (r_i > b_i) + goto increment_q; + if (r_i < b_i) + goto keep_q; + if (i == 0) + break; + i--; + } + } + if (q_len > 0 && ((q_ptr[0] & 1) != 0)) + /* q is odd. */ + increment_q: + { + size_t i; + for (i = 0; i < q_len; i++) + if (++(q_ptr[i]) != 0) + goto keep_q; + q_ptr[q_len++] = 1; + } + keep_q: + if (tmp_roomptr != NULL) + free (tmp_roomptr); + q->limbs = q_ptr; + q->nlimbs = q_len; + return roomptr; +} + +/* Convert a bignum a >= 0, multiplied with 10^extra_zeroes, to decimal + representation. + Destroys the contents of a. + Return the allocated memory - containing the decimal digits in low-to-high + order, terminated with a NUL character - in case of success, NULL in case + of memory allocation failure. */ +static char * +convert_to_decimal (mpn_t a, size_t extra_zeroes) +{ + mp_limb_t *a_ptr = a.limbs; + size_t a_len = a.nlimbs; + /* 0.03345 is slightly larger than log(2)/(9*log(10)). */ + size_t c_len = 9 * ((size_t)(a_len * (GMP_LIMB_BITS * 0.03345f)) + 1); + char *c_ptr = (char *) malloc (xsum (c_len, extra_zeroes)); + if (c_ptr != NULL) + { + char *d_ptr = c_ptr; + for (; extra_zeroes > 0; extra_zeroes--) + *d_ptr++ = '0'; + while (a_len > 0) + { + /* Divide a by 10^9, in-place. */ + mp_limb_t remainder = 0; + mp_limb_t *ptr = a_ptr + a_len; + size_t count; + for (count = a_len; count > 0; count--) + { + mp_twolimb_t num = + ((mp_twolimb_t) remainder << GMP_LIMB_BITS) | *--ptr; + *ptr = num / 1000000000; + remainder = num % 1000000000; + } + /* Store the remainder as 9 decimal digits. */ + for (count = 9; count > 0; count--) + { + *d_ptr++ = '0' + (remainder % 10); + remainder = remainder / 10; + } + /* Normalize a. */ + if (a_ptr[a_len - 1] == 0) + a_len--; + } + /* Remove leading zeroes. */ + while (d_ptr > c_ptr && d_ptr[-1] == '0') + d_ptr--; + /* But keep at least one zero. */ + if (d_ptr == c_ptr) + *d_ptr++ = '0'; + /* Terminate the string. */ + *d_ptr = '\0'; + } + return c_ptr; +} + +/* Assuming x is finite and >= 0: + write x as x = 2^e * m, where m is a bignum. + Return the allocated memory in case of success, NULL in case of memory + allocation failure. */ +static void * +decode_long_double (long double x, int *ep, mpn_t *mp) +{ + mpn_t m; + int exp; + long double y; + size_t i; + + /* Allocate memory for result. */ + m.nlimbs = (LDBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; + m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t)); + if (m.limbs == NULL) + return NULL; + /* Split into exponential part and mantissa. */ + y = frexpl (x, &exp); + if (!(y >= 0.0L && y < 1.0L)) + abort (); + /* x = 2^exp * y = 2^(exp - LDBL_MANT_BIT) * (y * LDBL_MANT_BIT), and the + latter is an integer. */ + /* Convert the mantissa (y * LDBL_MANT_BIT) to a sequence of limbs. + I'm not sure whether it's safe to cast a 'long double' value between + 2^31 and 2^32 to 'unsigned int', therefore play safe and cast only + 'long double' values between 0 and 2^16 (to 'unsigned int' or 'int', + doesn't matter). */ +# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0 +# if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2 + { + mp_limb_t hi, lo; + y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2)); + hi = (int) y; + y -= hi; + if (!(y >= 0.0L && y < 1.0L)) + abort (); + y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); + lo = (int) y; + y -= lo; + if (!(y >= 0.0L && y < 1.0L)) + abort (); + m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo; + } +# else + { + mp_limb_t d; + y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS); + d = (int) y; + y -= d; + if (!(y >= 0.0L && y < 1.0L)) + abort (); + m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d; + } +# endif +# endif + for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; ) + { + mp_limb_t hi, lo; + y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); + hi = (int) y; + y -= hi; + if (!(y >= 0.0L && y < 1.0L)) + abort (); + y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2); + lo = (int) y; + y -= lo; + if (!(y >= 0.0L && y < 1.0L)) + abort (); + m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo; + } + if (!(y == 0.0L)) + abort (); + /* Normalise. */ + while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0) + m.nlimbs--; + *mp = m; + *ep = exp - LDBL_MANT_BIT; + return m.limbs; +} + +/* Assuming x is finite and >= 0, and n is an integer: + Returns the decimal representation of round (x * 10^n). + Return the allocated memory - containing the decimal digits in low-to-high + order, terminated with a NUL character - in case of success, NULL in case + of memory allocation failure. */ +static char * +scale10_round_decimal_long_double (long double x, int n) +{ + int e; + mpn_t m; + void *memory = decode_long_double (x, &e, &m); + int s; + size_t extra_zeroes; + unsigned int abs_n; + unsigned int abs_s; + mp_limb_t *pow5_ptr; + size_t pow5_len; + unsigned int s_limbs; + unsigned int s_bits; + mpn_t pow5; + mpn_t z; + void *z_memory; + char *digits; + + if (memory == NULL) + return NULL; + /* x = 2^e * m, hence + y = round (2^e * 10^n * m) = round (2^(e+n) * 5^n * m) + = round (2^s * 5^n * m). */ + s = e + n; + extra_zeroes = 0; + /* Factor out a common power of 10 if possible. */ + if (s > 0 && n > 0) + { + extra_zeroes = (s < n ? s : n); + s -= extra_zeroes; + n -= extra_zeroes; + } + /* Here y = round (2^s * 5^n * m) * 10^extra_zeroes. + Before converting to decimal, we need to compute + z = round (2^s * 5^n * m). */ + /* Compute 5^|n|, possibly shifted by |s| bits if n and s have the same + sign. 2.322 is slightly larger than log(5)/log(2). */ + abs_n = (n >= 0 ? n : -n); + abs_s = (s >= 0 ? s : -s); + pow5_ptr = (mp_limb_t *) malloc (((int)(abs_n * (2.322f / GMP_LIMB_BITS)) + 1 + + abs_s / GMP_LIMB_BITS + 1) + * sizeof (mp_limb_t)); + if (pow5_ptr == NULL) + { + free (memory); + return NULL; + } + /* Initialize with 1. */ + pow5_ptr[0] = 1; + pow5_len = 1; + /* Multiply with 5^|n|. */ + if (abs_n > 0) + { + static mp_limb_t const small_pow5[13 + 1] = + { + 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, + 48828125, 244140625, 1220703125 + }; + unsigned int n13; + for (n13 = 0; n13 <= abs_n; n13 += 13) + { + mp_limb_t digit1 = small_pow5[n13 + 13 <= abs_n ? 13 : abs_n - n13]; + size_t j; + mp_twolimb_t carry = 0; + for (j = 0; j < pow5_len; j++) + { + mp_limb_t digit2 = pow5_ptr[j]; + carry += (mp_twolimb_t) digit1 * (mp_twolimb_t) digit2; + pow5_ptr[j] = (mp_limb_t) carry; + carry = carry >> GMP_LIMB_BITS; + } + if (carry > 0) + pow5_ptr[pow5_len++] = (mp_limb_t) carry; + } + } + s_limbs = abs_s / GMP_LIMB_BITS; + s_bits = abs_s % GMP_LIMB_BITS; + if (n >= 0 ? s >= 0 : s <= 0) + { + /* Multiply with 2^|s|. */ + if (s_bits > 0) + { + mp_limb_t *ptr = pow5_ptr; + mp_twolimb_t accu = 0; + size_t count; + for (count = pow5_len; count > 0; count--) + { + accu += (mp_twolimb_t) *ptr << s_bits; + *ptr++ = (mp_limb_t) accu; + accu = accu >> GMP_LIMB_BITS; + } + if (accu > 0) + { + *ptr = (mp_limb_t) accu; + pow5_len++; + } + } + if (s_limbs > 0) + { + size_t count; + for (count = pow5_len; count > 0;) + { + count--; + pow5_ptr[s_limbs + count] = pow5_ptr[count]; + } + for (count = s_limbs; count > 0;) + { + count--; + pow5_ptr[count] = 0; + } + pow5_len += s_limbs; + } + pow5.limbs = pow5_ptr; + pow5.nlimbs = pow5_len; + if (n >= 0) + { + /* Multiply m with pow5. No division needed. */ + z_memory = multiply (m, pow5, &z); + } + else + { + /* Divide m by pow5 and round. */ + z_memory = divide (m, pow5, &z); + } + } + else + { + pow5.limbs = pow5_ptr; + pow5.nlimbs = pow5_len; + if (n >= 0) + { + /* n >= 0, s < 0. + Multiply m with pow5, then divide by 2^|s|. */ + mpn_t numerator; + mpn_t denominator; + void *tmp_memory; + tmp_memory = multiply (m, pow5, &numerator); + if (tmp_memory == NULL) + { + free (pow5_ptr); + free (memory); + return NULL; + } + /* Construct 2^|s|. */ + { + mp_limb_t *ptr = pow5_ptr + pow5_len; + size_t i; + for (i = 0; i < s_limbs; i++) + ptr[i] = 0; + ptr[s_limbs] = (mp_limb_t) 1 << s_bits; + denominator.limbs = ptr; + denominator.nlimbs = s_limbs + 1; + } + z_memory = divide (numerator, denominator, &z); + free (tmp_memory); + } + else + { + /* n < 0, s > 0. + Multiply m with 2^s, then divide by pow5. */ + mpn_t numerator; + mp_limb_t *num_ptr; + num_ptr = (mp_limb_t *) malloc ((m.nlimbs + s_limbs + 1) + * sizeof (mp_limb_t)); + if (num_ptr == NULL) + { + free (pow5_ptr); + free (memory); + return NULL; + } + { + mp_limb_t *destptr = num_ptr; + { + size_t i; + for (i = 0; i < s_limbs; i++) + *destptr++ = 0; + } + if (s_bits > 0) + { + const mp_limb_t *sourceptr = m.limbs; + mp_twolimb_t accu = 0; + size_t count; + for (count = m.nlimbs; count > 0; count--) + { + accu += (mp_twolimb_t) *sourceptr++ << s; + *destptr++ = (mp_limb_t) accu; + accu = accu >> GMP_LIMB_BITS; + } + if (accu > 0) + *destptr++ = (mp_limb_t) accu; + } + else + { + const mp_limb_t *sourceptr = m.limbs; + size_t count; + for (count = m.nlimbs; count > 0; count--) + *destptr++ = *sourceptr++; + } + numerator.limbs = num_ptr; + numerator.nlimbs = destptr - num_ptr; + } + z_memory = divide (numerator, pow5, &z); + free (num_ptr); + } + } + free (pow5_ptr); + free (memory); + + /* Here y = round (x * 10^n) = z * 10^extra_zeroes. */ + + if (z_memory == NULL) + return NULL; + digits = convert_to_decimal (z, extra_zeroes); + free (z_memory); + return digits; +} + +/* Assuming x is finite and > 0: + Return an approximation for n with 10^n <= x < 10^(n+1). + The approximation is usually the right n, but may be off by 1 sometimes. */ +static int +floorlog10l (long double x) +{ + int exp; + long double y; + double z; + double l; + + /* Split into exponential part and mantissa. */ + y = frexpl (x, &exp); + if (!(y >= 0.0L && y < 1.0L)) + abort (); + if (y == 0.0L) + return INT_MIN; + if (y < 0.5L) + { + while (y < (1.0L / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2)))) + { + y *= 1.0L * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2)); + exp -= GMP_LIMB_BITS; + } + if (y < (1.0L / (1 << 16))) + { + y *= 1.0L * (1 << 16); + exp -= 16; + } + if (y < (1.0L / (1 << 8))) + { + y *= 1.0L * (1 << 8); + exp -= 8; + } + if (y < (1.0L / (1 << 4))) + { + y *= 1.0L * (1 << 4); + exp -= 4; + } + if (y < (1.0L / (1 << 2))) + { + y *= 1.0L * (1 << 2); + exp -= 2; + } + if (y < (1.0L / (1 << 1))) + { + y *= 1.0L * (1 << 1); + exp -= 1; + } + } + if (!(y >= 0.5L && y < 1.0L)) + abort (); + /* Compute an approximation for l = log2(x) = exp + log2(y). */ + l = exp; + z = y; + if (z < 0.70710678118654752444) + { + z *= 1.4142135623730950488; + l -= 0.5; + } + if (z < 0.8408964152537145431) + { + z *= 1.1892071150027210667; + l -= 0.25; + } + if (z < 0.91700404320467123175) + { + z *= 1.0905077326652576592; + l -= 0.125; + } + if (z < 0.9576032806985736469) + { + z *= 1.0442737824274138403; + l -= 0.0625; + } + /* Now 0.95 <= z <= 1.01. */ + z = 1 - z; + /* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ... + Four terms are enough to get an approximation with error < 10^-7. */ + l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25))); + /* Finally multiply with log(2)/log(10), yields an approximation for + log10(x). */ + l *= 0.30102999566398119523; + /* Round down to the next integer. */ + return (int) l + (l < 0 ? -1 : 0); +} + +#endif + +DCHAR_T * +VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, + const FCHAR_T *format, va_list args) { DIRECTIVES d; arguments a; @@ -139,7 +1206,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l if (a.arg) \ free (a.arg); - if (printf_fetchargs (args, &a) < 0) + if (PRINTF_FETCHARGS (args, &a) < 0) { CLEANUP (); errno = EINVAL; @@ -148,13 +1215,13 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l { size_t buf_neededlength; - CHAR_T *buf; - CHAR_T *buf_malloced; - const CHAR_T *cp; + TCHAR_T *buf; + TCHAR_T *buf_malloced; + const FCHAR_T *cp; size_t i; DIRECTIVE *dp; /* Output string accumulator. */ - CHAR_T *result; + DCHAR_T *result; size_t allocated; size_t length; @@ -163,18 +1230,18 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l buf_neededlength = xsum4 (7, d.max_width_length, d.max_precision_length, 6); #if HAVE_ALLOCA - if (buf_neededlength < 4000 / sizeof (CHAR_T)) + if (buf_neededlength < 4000 / sizeof (TCHAR_T)) { - buf = (CHAR_T *) alloca (buf_neededlength * sizeof (CHAR_T)); + buf = (TCHAR_T *) alloca (buf_neededlength * sizeof (TCHAR_T)); buf_malloced = NULL; } else #endif { - size_t buf_memsize = xtimes (buf_neededlength, sizeof (CHAR_T)); + size_t buf_memsize = xtimes (buf_neededlength, sizeof (TCHAR_T)); if (size_overflow_p (buf_memsize)) goto out_of_memory_1; - buf = (CHAR_T *) malloc (buf_memsize); + buf = (TCHAR_T *) malloc (buf_memsize); if (buf == NULL) goto out_of_memory_1; buf_malloced = buf; @@ -201,22 +1268,22 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l if ((needed) > allocated) \ { \ size_t memory_size; \ - CHAR_T *memory; \ + DCHAR_T *memory; \ \ allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ if ((needed) > allocated) \ allocated = (needed); \ - memory_size = xtimes (allocated, sizeof (CHAR_T)); \ + memory_size = xtimes (allocated, sizeof (DCHAR_T)); \ if (size_overflow_p (memory_size)) \ goto out_of_memory; \ if (result == resultbuf || result == NULL) \ - memory = (CHAR_T *) malloc (memory_size); \ + memory = (DCHAR_T *) malloc (memory_size); \ else \ - memory = (CHAR_T *) realloc (result, memory_size); \ + memory = (DCHAR_T *) realloc (result, memory_size); \ if (memory == NULL) \ goto out_of_memory; \ if (result == resultbuf && length > 0) \ - memcpy (memory, result, length * sizeof (CHAR_T)); \ + DCHAR_CPY (memory, result, length); \ result = memory; \ } @@ -228,8 +1295,20 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l size_t augmented_length = xsum (length, n); ENSURE_ALLOCATION (augmented_length); - memcpy (result + length, cp, n * sizeof (CHAR_T)); - length = augmented_length; + /* This copies a piece of FCHAR_T[] into a DCHAR_T[]. Here we + need that the format string contains only ASCII characters + if FCHAR_T and DCHAR_T are not the same type. */ + if (sizeof (FCHAR_T) == sizeof (DCHAR_T)) + { + DCHAR_CPY (result + length, (const DCHAR_T *) cp, n); + length = augmented_length; + } + else + { + do + result[length++] = (unsigned char) *cp++; + while (--n > 0); + } } if (i == d.count) break; @@ -276,8 +1355,9 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l abort (); } } -#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL - else if (dp->conversion == 'a' || dp->conversion == 'A') +#if ENABLE_UNISTDIO + /* The unistdio extensions. */ + else if (dp->conversion == 'U') { arg_type type = a.arg[dp->arg_index].type; int flags = dp->flags; @@ -285,11 +1365,6 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l size_t width; int has_precision; size_t precision; - size_t tmp_length; - CHAR_T tmpbuf[700]; - CHAR_T *tmp; - CHAR_T *pad_ptr; - CHAR_T *p; has_width = 0; width = 0; @@ -314,7 +1389,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } else { - const CHAR_T *digitp = dp->width_start; + const FCHAR_T *digitp = dp->width_start; do width = xsum (xtimes (width, 10), *digitp++ - '0'); @@ -344,7 +1419,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } else { - const CHAR_T *digitp = dp->precision_start + 1; + const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) @@ -353,50 +1428,515 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } } - /* Allocate a temporary buffer of sufficient size. */ -# if HAVE_LONG_DOUBLE - if (type == TYPE_LONGDOUBLE) - tmp_length = - (unsigned int) ((LDBL_DIG + 1) - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - else -# endif - tmp_length = - (unsigned int) ((DBL_DIG + 1) - * 0.831 /* decimal -> hexadecimal */ - ) - + 1; /* turn floor into ceil */ - if (tmp_length < precision) - tmp_length = precision; - /* Account for sign, decimal point etc. */ - tmp_length = xsum (tmp_length, 12); - - if (tmp_length < width) - tmp_length = width; - - tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ - - if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T)) - tmp = tmpbuf; - else + switch (type) { - size_t tmp_memsize = xtimes (tmp_length, sizeof (CHAR_T)); + case TYPE_U8_STRING: + { + const uint8_t *arg = a.arg[dp->arg_index].a.a_u8_string; + const uint8_t *arg_end; + size_t characters; + + if (has_precision) + { + /* Use only PRECISION characters, from the left. */ + arg_end = arg; + characters = 0; + for (; precision > 0; precision--) + { + int count = u8_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else if (has_width) + { + /* Use the entire string, and count the number of + characters. */ + arg_end = arg; + characters = 0; + for (;;) + { + int count = u8_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else + { + /* Use the entire string. */ + arg_end = arg + u8_strlen (arg); + /* The number of characters doesn't matter. */ + characters = 0; + } - if (size_overflow_p (tmp_memsize)) - /* Overflow, would lead to out of memory. */ - goto out_of_memory; - tmp = (CHAR_T *) malloc (tmp_memsize); - if (tmp == NULL) - /* Out of memory. */ - goto out_of_memory; - } + if (has_width && width > characters + && !(dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } - pad_ptr = NULL; - p = tmp; -# if HAVE_LONG_DOUBLE - if (type == TYPE_LONGDOUBLE) +# if DCHAR_IS_UINT8_T + { + size_t n = arg_end - arg; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_CPY (result + length, arg, n); + length += n; + } +# else + { /* Convert. */ + DCHAR_T *converted = result + length; + size_t converted_len = allocated - length; +# if DCHAR_IS_TCHAR + /* Convert from UTF-8 to locale encoding. */ + if (u8_conv_to_encoding (locale_charset (), + iconveh_question_mark, + arg, arg_end - arg, NULL, + &converted, &converted_len) + < 0) +# else + /* Convert from UTF-8 to UTF-16/UTF-32. */ + converted = + U8_TO_DCHAR (arg, arg_end - arg, + converted, &converted_len); + if (converted == NULL) +# endif + { + int saved_errno = errno; + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + if (converted != result + length) + { + ENSURE_ALLOCATION (xsum (length, converted_len)); + DCHAR_CPY (result + length, converted, converted_len); + free (converted); + } + length += converted_len; + } +# endif + + if (has_width && width > characters + && (dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + } + break; + + case TYPE_U16_STRING: + { + const uint16_t *arg = a.arg[dp->arg_index].a.a_u16_string; + const uint16_t *arg_end; + size_t characters; + + if (has_precision) + { + /* Use only PRECISION characters, from the left. */ + arg_end = arg; + characters = 0; + for (; precision > 0; precision--) + { + int count = u16_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else if (has_width) + { + /* Use the entire string, and count the number of + characters. */ + arg_end = arg; + characters = 0; + for (;;) + { + int count = u16_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else + { + /* Use the entire string. */ + arg_end = arg + u16_strlen (arg); + /* The number of characters doesn't matter. */ + characters = 0; + } + + if (has_width && width > characters + && !(dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + +# if DCHAR_IS_UINT16_T + { + size_t n = arg_end - arg; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_CPY (result + length, arg, n); + length += n; + } +# else + { /* Convert. */ + DCHAR_T *converted = result + length; + size_t converted_len = allocated - length; +# if DCHAR_IS_TCHAR + /* Convert from UTF-16 to locale encoding. */ + if (u16_conv_to_encoding (locale_charset (), + iconveh_question_mark, + arg, arg_end - arg, NULL, + &converted, &converted_len) + < 0) +# else + /* Convert from UTF-16 to UTF-8/UTF-32. */ + converted = + U16_TO_DCHAR (arg, arg_end - arg, + converted, &converted_len); + if (converted == NULL) +# endif + { + int saved_errno = errno; + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + if (converted != result + length) + { + ENSURE_ALLOCATION (xsum (length, converted_len)); + DCHAR_CPY (result + length, converted, converted_len); + free (converted); + } + length += converted_len; + } +# endif + + if (has_width && width > characters + && (dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + } + break; + + case TYPE_U32_STRING: + { + const uint32_t *arg = a.arg[dp->arg_index].a.a_u32_string; + const uint32_t *arg_end; + size_t characters; + + if (has_precision) + { + /* Use only PRECISION characters, from the left. */ + arg_end = arg; + characters = 0; + for (; precision > 0; precision--) + { + int count = u32_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else if (has_width) + { + /* Use the entire string, and count the number of + characters. */ + arg_end = arg; + characters = 0; + for (;;) + { + int count = u32_strmblen (arg_end); + if (count == 0) + break; + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EILSEQ; + return NULL; + } + arg_end += count; + characters++; + } + } + else + { + /* Use the entire string. */ + arg_end = arg + u32_strlen (arg); + /* The number of characters doesn't matter. */ + characters = 0; + } + + if (has_width && width > characters + && !(dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + +# if DCHAR_IS_UINT32_T + { + size_t n = arg_end - arg; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_CPY (result + length, arg, n); + length += n; + } +# else + { /* Convert. */ + DCHAR_T *converted = result + length; + size_t converted_len = allocated - length; +# if DCHAR_IS_TCHAR + /* Convert from UTF-32 to locale encoding. */ + if (u32_conv_to_encoding (locale_charset (), + iconveh_question_mark, + arg, arg_end - arg, NULL, + &converted, &converted_len) + < 0) +# else + /* Convert from UTF-32 to UTF-8/UTF-16. */ + converted = + U32_TO_DCHAR (arg, arg_end - arg, + converted, &converted_len); + if (converted == NULL) +# endif + { + int saved_errno = errno; + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + if (converted != result + length) + { + ENSURE_ALLOCATION (xsum (length, converted_len)); + DCHAR_CPY (result + length, converted, converted_len); + free (converted); + } + length += converted_len; + } +# endif + + if (has_width && width > characters + && (dp->flags & FLAG_LEFT)) + { + size_t n = width - characters; + ENSURE_ALLOCATION (xsum (length, n)); + DCHAR_SET (result + length, ' ', n); + length += n; + } + } + break; + + default: + abort (); + } + } +#endif +#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL + else if (dp->conversion == 'a' || dp->conversion == 'A') + { + arg_type type = a.arg[dp->arg_index].type; + int flags = dp->flags; + int has_width; + size_t width; + int has_precision; + size_t precision; + size_t tmp_length; + DCHAR_T tmpbuf[700]; + DCHAR_T *tmp; + DCHAR_T *pad_ptr; + DCHAR_T *p; + + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = (unsigned int) (-arg); + } + else + width = arg; + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + has_width = 1; + } + + has_precision = 0; + precision = 0; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } + + /* Allocate a temporary buffer of sufficient size. */ + if (type == TYPE_LONGDOUBLE) + tmp_length = + (unsigned int) ((LDBL_DIG + 1) + * 0.831 /* decimal -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + else + tmp_length = + (unsigned int) ((DBL_DIG + 1) + * 0.831 /* decimal -> hexadecimal */ + ) + + 1; /* turn floor into ceil */ + if (tmp_length < precision) + tmp_length = precision; + /* Account for sign, decimal point etc. */ + tmp_length = xsum (tmp_length, 12); + + if (tmp_length < width) + tmp_length = width; + + tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ + + if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) + tmp = tmpbuf; + else + { + size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); + + if (size_overflow_p (tmp_memsize)) + /* Overflow, would lead to out of memory. */ + goto out_of_memory; + tmp = (DCHAR_T *) malloc (tmp_memsize); + if (tmp == NULL) + /* Out of memory. */ + goto out_of_memory; + } + + pad_ptr = NULL; + p = tmp; + if (type == TYPE_LONGDOUBLE) { long double arg = a.arg[dp->arg_index].a.a_longdouble; @@ -414,25 +1954,15 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l else { int sign = 0; + DECL_LONG_DOUBLE_ROUNDING + + BEGIN_LONG_DOUBLE_ROUNDING (); - if (arg < 0.0L) + if (signbit (arg)) /* arg < 0.0L or negative zero */ { sign = -1; arg = -arg; } - else if (arg == 0.0L) - { - /* Distinguish 0.0L and -0.0L. */ - static long double plus_zero = 0.0L; - long double arg_mem; - memset (&arg_mem, 0, sizeof (long double)); - arg_mem = arg; - if (memcmp (&plus_zero, &arg_mem, sizeof (long double)) != 0) - { - sign = -1; - arg = -arg; - } - } if (sign < 0) *p++ = '-'; @@ -504,11 +2034,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l if ((flags & FLAG_ALT) || mantissa > 0.0L || precision > 0) { - const char *point = - localeconv () -> decimal_point; - /* The decimal point is always a single byte: - either '.' or ','. */ - *p++ = (point[0] != '\0' ? point[0] : '.'); + *p++ = decimal_point_char (); /* This loop terminates because we assume that FLT_RADIX is a power of 2. */ while (mantissa > 0.0L) @@ -531,22 +2057,36 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } } *p++ = dp->conversion - 'A' + 'P'; -# if WIDE_CHAR_VERSION +# if WIDE_CHAR_VERSION { static const wchar_t decimal_format[] = { '%', '+', 'd', '\0' }; SNPRINTF (p, 6 + 1, decimal_format, exponent); } -# else - sprintf (p, "%+d", exponent); -# endif while (*p != '\0') p++; +# else + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, "%+d", exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, "%+d", exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } +# endif } + + END_LONG_DOUBLE_ROUNDING (); } } else -# endif { double arg = a.arg[dp->arg_index].a.a_double; @@ -565,23 +2105,739 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l { int sign = 0; - if (arg < 0.0) + if (signbit (arg)) /* arg < 0.0 or negative zero */ { sign = -1; arg = -arg; } - else if (arg == 0.0) + + if (sign < 0) + *p++ = '-'; + else if (flags & FLAG_SHOWSIGN) + *p++ = '+'; + else if (flags & FLAG_SPACE) + *p++ = ' '; + + if (arg > 0.0 && arg + arg == arg) + { + if (dp->conversion == 'A') + { + *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; + } + else + { + *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; + } + } + else { - /* Distinguish 0.0 and -0.0. */ - static double plus_zero = 0.0; - double arg_mem; - memset (&arg_mem, 0, sizeof (double)); - arg_mem = arg; - if (memcmp (&plus_zero, &arg_mem, sizeof (double)) != 0) + int exponent; + double mantissa; + + if (arg > 0.0) + mantissa = printf_frexp (arg, &exponent); + else { - sign = -1; - arg = -arg; + exponent = 0; + mantissa = 0.0; } + + if (has_precision + && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) + { + /* Round the mantissa. */ + double tail = mantissa; + size_t q; + + for (q = precision; ; q--) + { + int digit = (int) tail; + tail -= digit; + if (q == 0) + { + if (digit & 1 ? tail >= 0.5 : tail > 0.5) + tail = 1 - tail; + else + tail = - tail; + break; + } + tail *= 16.0; + } + if (tail != 0.0) + for (q = precision; q > 0; q--) + tail *= 0.0625; + mantissa += tail; + } + + *p++ = '0'; + *p++ = dp->conversion - 'A' + 'X'; + pad_ptr = p; + { + int digit; + + digit = (int) mantissa; + mantissa -= digit; + *p++ = '0' + digit; + if ((flags & FLAG_ALT) + || mantissa > 0.0 || precision > 0) + { + *p++ = decimal_point_char (); + /* This loop terminates because we assume + that FLT_RADIX is a power of 2. */ + while (mantissa > 0.0) + { + mantissa *= 16.0; + digit = (int) mantissa; + mantissa -= digit; + *p++ = digit + + (digit < 10 + ? '0' + : dp->conversion - 10); + if (precision > 0) + precision--; + } + while (precision > 0) + { + *p++ = '0'; + precision--; + } + } + } + *p++ = dp->conversion - 'A' + 'P'; +# if WIDE_CHAR_VERSION + { + static const wchar_t decimal_format[] = + { '%', '+', 'd', '\0' }; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; +# else + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, "%+d", exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, "%+d", exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } +# endif + } + } + } + /* The generated string now extends from tmp to p, with the + zero padding insertion point being at pad_ptr. */ + if (has_width && p - tmp < width) + { + size_t pad = width - (p - tmp); + DCHAR_T *end = p + pad; + + if (flags & FLAG_LEFT) + { + /* Pad with spaces on the right. */ + for (; pad > 0; pad--) + *p++ = ' '; + } + else if ((flags & FLAG_ZERO) && pad_ptr != NULL) + { + /* Pad with zeroes. */ + DCHAR_T *q = end; + + while (p > pad_ptr) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = '0'; + } + else + { + /* Pad with spaces on the left. */ + DCHAR_T *q = end; + + while (p > tmp) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = ' '; + } + + p = end; + } + + { + size_t count = p - tmp; + + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); + + /* Make room for the result. */ + if (count >= allocated - length) + { + size_t n = xsum (length, count); + + ENSURE_ALLOCATION (n); + } + + /* Append the result. */ + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); + if (tmp != tmpbuf) + free (tmp); + length += count; + } + } +#endif +#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL + else if ((dp->conversion == 'f' || dp->conversion == 'F' + || dp->conversion == 'e' || dp->conversion == 'E' + || dp->conversion == 'g' || dp->conversion == 'G' + || dp->conversion == 'a' || dp->conversion == 'A') + && (0 +# if NEED_PRINTF_INFINITE_DOUBLE + || (a.arg[dp->arg_index].type == TYPE_DOUBLE + /* The systems (mingw) which produce wrong output + for Inf, -Inf, and NaN also do so for -0.0. + Therefore we treat this case here as well. */ + && is_infinite_or_zero (a.arg[dp->arg_index].a.a_double)) +# endif +# if NEED_PRINTF_LONG_DOUBLE + || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE +# elif NEED_PRINTF_INFINITE_LONG_DOUBLE + || (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE + /* Some systems produce wrong output for Inf, + -Inf, and NaN. */ + && is_infinitel (a.arg[dp->arg_index].a.a_longdouble)) +# endif + )) + { +# if NEED_PRINTF_INFINITE_DOUBLE && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) + arg_type type = a.arg[dp->arg_index].type; +# endif + int flags = dp->flags; + int has_width; + size_t width; + int has_precision; + size_t precision; + size_t tmp_length; + DCHAR_T tmpbuf[700]; + DCHAR_T *tmp; + DCHAR_T *pad_ptr; + DCHAR_T *p; + + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = (unsigned int) (-arg); + } + else + width = arg; + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + has_width = 1; + } + + has_precision = 0; + precision = 0; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + /* "A negative precision is taken as if the precision + were omitted." */ + if (arg >= 0) + { + precision = arg; + has_precision = 1; + } + } + else + { + const FCHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + while (digitp != dp->precision_end) + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + has_precision = 1; + } + } + + /* POSIX specifies the default precision to be 6 for %f, %F, + %e, %E, but not for %g, %G. Implementations appear to use + the same default precision also for %g, %G. */ + if (!has_precision) + precision = 6; + + /* Allocate a temporary buffer of sufficient size. */ +# if NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE + tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0); +# elif NEED_PRINTF_LONG_DOUBLE + tmp_length = LDBL_DIG + 1; +# else + tmp_length = 0; +# endif + if (tmp_length < precision) + tmp_length = precision; +# if NEED_PRINTF_LONG_DOUBLE +# if NEED_PRINTF_INFINITE_DOUBLE + if (type == TYPE_LONGDOUBLE) +# endif + if (dp->conversion == 'f' || dp->conversion == 'F') + { + long double arg = a.arg[dp->arg_index].a.a_longdouble; + if (!(isnanl (arg) || arg + arg == arg)) + { + /* arg is finite and nonzero. */ + int exponent = floorlog10l (arg < 0 ? -arg : arg); + if (exponent >= 0 && tmp_length < exponent + precision) + tmp_length = exponent + precision; + } + } +# endif + /* Account for sign, decimal point etc. */ + tmp_length = xsum (tmp_length, 12); + + if (tmp_length < width) + tmp_length = width; + + tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ + + if (tmp_length <= sizeof (tmpbuf) / sizeof (DCHAR_T)) + tmp = tmpbuf; + else + { + size_t tmp_memsize = xtimes (tmp_length, sizeof (DCHAR_T)); + + if (size_overflow_p (tmp_memsize)) + /* Overflow, would lead to out of memory. */ + goto out_of_memory; + tmp = (DCHAR_T *) malloc (tmp_memsize); + if (tmp == NULL) + /* Out of memory. */ + goto out_of_memory; + } + + pad_ptr = NULL; + p = tmp; + +# if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE +# if NEED_PRINTF_INFINITE_DOUBLE + if (type == TYPE_LONGDOUBLE) +# endif + { + long double arg = a.arg[dp->arg_index].a.a_longdouble; + + if (isnanl (arg)) + { + if (dp->conversion >= 'A' && dp->conversion <= 'Z') + { + *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; + } + else + { + *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; + } + } + else + { + int sign = 0; + DECL_LONG_DOUBLE_ROUNDING + + BEGIN_LONG_DOUBLE_ROUNDING (); + + if (signbit (arg)) /* arg < 0.0L or negative zero */ + { + sign = -1; + arg = -arg; + } + + if (sign < 0) + *p++ = '-'; + else if (flags & FLAG_SHOWSIGN) + *p++ = '+'; + else if (flags & FLAG_SPACE) + *p++ = ' '; + + if (arg > 0.0L && arg + arg == arg) + { + if (dp->conversion >= 'A' && dp->conversion <= 'Z') + { + *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; + } + else + { + *p++ = 'i'; *p++ = 'n'; *p++ = 'f'; + } + } + else + { +# if NEED_PRINTF_LONG_DOUBLE + pad_ptr = p; + + if (dp->conversion == 'f' || dp->conversion == 'F') + { + char *digits; + size_t ndigits; + + digits = + scale10_round_decimal_long_double (arg, precision); + if (digits == NULL) + { + END_LONG_DOUBLE_ROUNDING (); + goto out_of_memory; + } + ndigits = strlen (digits); + + if (ndigits > precision) + do + { + --ndigits; + *p++ = digits[ndigits]; + } + while (ndigits > precision); + else + *p++ = '0'; + /* Here ndigits <= precision. */ + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > ndigits; precision--) + *p++ = '0'; + while (ndigits > 0) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + + free (digits); + } + else if (dp->conversion == 'e' || dp->conversion == 'E') + { + int exponent; + + if (arg == 0.0L) + { + exponent = 0; + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; + } + } + else + { + /* arg > 0.0L. */ + int adjusted; + char *digits; + size_t ndigits; + + exponent = floorlog10l (arg); + adjusted = 0; + for (;;) + { + digits = + scale10_round_decimal_long_double (arg, + (int)precision - exponent); + if (digits == NULL) + { + END_LONG_DOUBLE_ROUNDING (); + goto out_of_memory; + } + ndigits = strlen (digits); + + if (ndigits == precision + 1) + break; + if (ndigits < precision + || ndigits > precision + 2) + /* The exponent was not guessed + precisely enough. */ + abort (); + if (adjusted) + /* None of two values of exponent is + the right one. Prevent an endless + loop. */ + abort (); + free (digits); + if (ndigits == precision) + exponent -= 1; + else + exponent += 1; + adjusted = 1; + } + + /* Here ndigits = precision+1. */ + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + while (ndigits > 0) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + + free (digits); + } + + *p++ = dp->conversion; /* 'e' or 'E' */ +# if WIDE_CHAR_VERSION + { + static const wchar_t decimal_format[] = + { '%', '+', '.', '2', 'd', '\0' }; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; +# else + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, "%+.2d", exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, "%+.2d", exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } +# endif + } + else if (dp->conversion == 'g' || dp->conversion == 'G') + { + if (precision == 0) + precision = 1; + /* precision >= 1. */ + + if (arg == 0.0L) + /* The exponent is 0, >= -4, < precision. + Use fixed-point notation. */ + { + size_t ndigits = precision; + /* Number of trailing zeroes that have to be + dropped. */ + size_t nzeroes = + (flags & FLAG_ALT ? 0 : precision - 1); + + --ndigits; + *p++ = '0'; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = '0'; + } + } + } + else + { + /* arg > 0.0L. */ + int exponent; + int adjusted; + char *digits; + size_t ndigits; + size_t nzeroes; + + exponent = floorlog10l (arg); + adjusted = 0; + for (;;) + { + digits = + scale10_round_decimal_long_double (arg, + (int)(precision - 1) - exponent); + if (digits == NULL) + { + END_LONG_DOUBLE_ROUNDING (); + goto out_of_memory; + } + ndigits = strlen (digits); + + if (ndigits == precision) + break; + if (ndigits < precision - 1 + || ndigits > precision + 1) + /* The exponent was not guessed + precisely enough. */ + abort (); + if (adjusted) + /* None of two values of exponent is + the right one. Prevent an endless + loop. */ + abort (); + free (digits); + if (ndigits < precision) + exponent -= 1; + else + exponent += 1; + adjusted = 1; + } + /* Here ndigits = precision. */ + + /* Determine the number of trailing zeroes + that have to be dropped. */ + nzeroes = 0; + if ((flags & FLAG_ALT) == 0) + while (nzeroes < ndigits + && digits[nzeroes] == '0') + nzeroes++; + + /* The exponent is now determined. */ + if (exponent >= -4 + && exponent < (long)precision) + { + /* Fixed-point notation: + max(exponent,0)+1 digits, then the + decimal point, then the remaining + digits without trailing zeroes. */ + if (exponent >= 0) + { + size_t count = exponent + 1; + /* Note: count <= precision = ndigits. */ + for (; count > 0; count--) + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + } + else + { + size_t count = -exponent - 1; + *p++ = '0'; + *p++ = decimal_point_char (); + for (; count > 0; count--) + *p++ = '0'; + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + } + else + { + /* Exponential notation. */ + *p++ = digits[--ndigits]; + if ((flags & FLAG_ALT) || ndigits > nzeroes) + { + *p++ = decimal_point_char (); + while (ndigits > nzeroes) + { + --ndigits; + *p++ = digits[ndigits]; + } + } + *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */ +# if WIDE_CHAR_VERSION + { + static const wchar_t decimal_format[] = + { '%', '+', '.', '2', 'd', '\0' }; + SNPRINTF (p, 6 + 1, decimal_format, exponent); + } + while (*p != '\0') + p++; +# else + if (sizeof (DCHAR_T) == 1) + { + sprintf ((char *) p, "%+.2d", exponent); + while (*p != '\0') + p++; + } + else + { + char expbuf[6 + 1]; + const char *ep; + sprintf (expbuf, "%+.2d", exponent); + for (ep = expbuf; (*p = *ep) != '\0'; ep++) + p++; + } +# endif + } + + free (digits); + } + } + else + abort (); +# else + /* arg is finite. */ + abort (); +# endif + } + + END_LONG_DOUBLE_ROUNDING (); + } + } +# if NEED_PRINTF_INFINITE_DOUBLE + else +# endif +# endif +# if NEED_PRINTF_INFINITE_DOUBLE + { + /* Simpler than above: handle only NaN, Infinity, zero. */ + double arg = a.arg[dp->arg_index].a.a_double; + + if (isnan (arg)) + { + if (dp->conversion >= 'A' && dp->conversion <= 'Z') + { + *p++ = 'N'; *p++ = 'A'; *p++ = 'N'; + } + else + { + *p++ = 'n'; *p++ = 'a'; *p++ = 'n'; + } + } + else + { + int sign = 0; + + if (signbit (arg)) /* arg < 0.0L or negative zero */ + { + sign = -1; + arg = -arg; } if (sign < 0) @@ -593,7 +2849,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l if (arg > 0.0 && arg + arg == arg) { - if (dp->conversion == 'A') + if (dp->conversion >= 'A' && dp->conversion <= 'Z') { *p++ = 'I'; *p++ = 'N'; *p++ = 'F'; } @@ -604,103 +2860,65 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } else { - int exponent; - double mantissa; + if (!(arg == 0.0)) + abort (); - if (arg > 0.0) - mantissa = printf_frexp (arg, &exponent); - else - { - exponent = 0; - mantissa = 0.0; - } + pad_ptr = p; - if (has_precision - && precision < (unsigned int) ((DBL_DIG + 1) * 0.831) + 1) + if (dp->conversion == 'f' || dp->conversion == 'F') { - /* Round the mantissa. */ - double tail = mantissa; - size_t q; - - for (q = precision; ; q--) + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) { - int digit = (int) tail; - tail -= digit; - if (q == 0) - { - if (digit & 1 ? tail >= 0.5 : tail > 0.5) - tail = 1 - tail; - else - tail = - tail; - break; - } - tail *= 16.0; + *p++ = decimal_point_char (); + for (; precision > 0; precision--) + *p++ = '0'; } - if (tail != 0.0) - for (q = precision; q > 0; q--) - tail *= 0.0625; - mantissa += tail; } - - *p++ = '0'; - *p++ = dp->conversion - 'A' + 'X'; - pad_ptr = p; - { - int digit; - - digit = (int) mantissa; - mantissa -= digit; - *p++ = '0' + digit; - if ((flags & FLAG_ALT) - || mantissa > 0.0 || precision > 0) - { - const char *point = - localeconv () -> decimal_point; - /* The decimal point is always a single byte: - either '.' or ','. */ - *p++ = (point[0] != '\0' ? point[0] : '.'); - /* This loop terminates because we assume - that FLT_RADIX is a power of 2. */ - while (mantissa > 0.0) - { - mantissa *= 16.0; - digit = (int) mantissa; - mantissa -= digit; - *p++ = digit - + (digit < 10 - ? '0' - : dp->conversion - 10); - if (precision > 0) - precision--; - } - while (precision > 0) - { + else if (dp->conversion == 'e' || dp->conversion == 'E') + { + *p++ = '0'; + if ((flags & FLAG_ALT) || precision > 0) + { + *p++ = decimal_point_char (); + for (; precision > 0; precision--) *p++ = '0'; - precision--; - } - } + } + *p++ = dp->conversion; /* 'e' or 'E' */ + *p++ = '+'; + /* Produce the same number of exponent digits as + the native printf implementation. */ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + *p++ = '0'; +# endif + *p++ = '0'; + *p++ = '0'; } - *p++ = dp->conversion - 'A' + 'P'; -# if WIDE_CHAR_VERSION + else if (dp->conversion == 'g' || dp->conversion == 'G') { - static const wchar_t decimal_format[] = - { '%', '+', 'd', '\0' }; - SNPRINTF (p, 6 + 1, decimal_format, exponent); + *p++ = '0'; + if (flags & FLAG_ALT) + { + size_t ndigits = + (precision > 0 ? precision - 1 : 0); + *p++ = decimal_point_char (); + for (; ndigits > 0; --ndigits) + *p++ = '0'; + } } -# else - sprintf (p, "%+d", exponent); -# endif - while (*p != '\0') - p++; + else + abort (); } } } +# endif + /* The generated string now extends from tmp to p, with the zero padding insertion point being at pad_ptr. */ if (has_width && p - tmp < width) { size_t pad = width - (p - tmp); - CHAR_T *end = p + pad; + DCHAR_T *end = p + pad; if (flags & FLAG_LEFT) { @@ -711,7 +2929,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l else if ((flags & FLAG_ZERO) && pad_ptr != NULL) { /* Pad with zeroes. */ - CHAR_T *q = end; + DCHAR_T *q = end; while (p > pad_ptr) *--q = *--p; @@ -721,7 +2939,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l else { /* Pad with spaces on the left. */ - CHAR_T *q = end; + DCHAR_T *q = end; while (p > tmp) *--q = *--p; @@ -749,7 +2967,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } /* Append the result. */ - memcpy (result + length, tmp, count * sizeof (CHAR_T)); + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); if (tmp != tmpbuf) free (tmp); length += count; @@ -759,42 +2977,65 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l else { arg_type type = a.arg[dp->arg_index].type; - CHAR_T *p; + int flags = dp->flags; +#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO + int has_width; + size_t width; +#endif +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO + int pad_ourselves; +#else +# define pad_ourselves 0 +#endif + TCHAR_T *fbp; unsigned int prefix_count; int prefixes[2]; #if !USE_SNPRINTF size_t tmp_length; - CHAR_T tmpbuf[700]; - CHAR_T *tmp; + TCHAR_T tmpbuf[700]; + TCHAR_T *tmp; +#endif + +#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO + has_width = 0; + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + if (arg < 0) + { + /* "A negative field width is taken as a '-' flag + followed by a positive field width." */ + flags |= FLAG_LEFT; + width = (unsigned int) (-arg); + } + else + width = arg; + } + else + { + const FCHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + has_width = 1; + } +#endif +#if !USE_SNPRINTF /* Allocate a temporary buffer of sufficient size for calling sprintf. */ { - size_t width; size_t precision; - width = 0; - if (dp->width_start != dp->width_end) - { - if (dp->width_arg_index != ARG_NONE) - { - int arg; - - if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) - abort (); - arg = a.arg[dp->width_arg_index].a.a_int; - width = (arg < 0 ? (unsigned int) (-arg) : arg); - } - else - { - const CHAR_T *digitp = dp->width_start; - - do - width = xsum (xtimes (width, 10), *digitp++ - '0'); - while (digitp != dp->width_end); - } - } - precision = 6; if (dp->precision_start != dp->precision_end) { @@ -809,7 +3050,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } else { - const CHAR_T *digitp = dp->precision_start + 1; + const FCHAR_T *digitp = dp->precision_start + 1; precision = 0; while (digitp != dp->precision_end) @@ -907,7 +3148,6 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l break; case 'f': case 'F': -# if HAVE_LONG_DOUBLE if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_MAX_EXP @@ -917,7 +3157,6 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ else -# endif tmp_length = (unsigned int) (DBL_MAX_EXP * 0.30103 /* binary -> decimal */ @@ -935,7 +3174,6 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l break; case 'a': case 'A': -# if HAVE_LONG_DOUBLE if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_DIG @@ -943,7 +3181,6 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l ) + 1; /* turn floor into ceil */ else -# endif tmp_length = (unsigned int) (DBL_DIG * 0.831 /* decimal -> hexadecimal */ @@ -993,55 +3230,121 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l abort (); } +# if ENABLE_UNISTDIO + /* Padding considers the number of characters, therefore the + number of elements after padding may be + > max (tmp_length, width) + but is certainly + <= tmp_length + width. */ + tmp_length = xsum (tmp_length, width); +# else + /* Padding considers the number of elements, says POSIX. */ if (tmp_length < width) tmp_length = width; +# endif tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ } - if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T)) + if (tmp_length <= sizeof (tmpbuf) / sizeof (TCHAR_T)) tmp = tmpbuf; else { - size_t tmp_memsize = xtimes (tmp_length, sizeof (CHAR_T)); + size_t tmp_memsize = xtimes (tmp_length, sizeof (TCHAR_T)); if (size_overflow_p (tmp_memsize)) /* Overflow, would lead to out of memory. */ goto out_of_memory; - tmp = (CHAR_T *) malloc (tmp_memsize); + tmp = (TCHAR_T *) malloc (tmp_memsize); if (tmp == NULL) /* Out of memory. */ goto out_of_memory; } #endif + /* Decide whether to perform the padding ourselves. */ +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO + switch (dp->conversion) + { +# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO + /* If we need conversion from TCHAR_T[] to DCHAR_T[], we need + to perform the padding after this conversion. Functions + with unistdio extensions perform the padding based on + character count rather than element count. */ + case 'c': case 's': +# endif +# if NEED_PRINTF_FLAG_ZERO + case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': + case 'a': case 'A': +# endif + pad_ourselves = 1; + break; + default: + pad_ourselves = 0; + break; + } +#endif + /* Construct the format string for calling snprintf or sprintf. */ - p = buf; - *p++ = '%'; - if (dp->flags & FLAG_GROUP) - *p++ = '\''; - if (dp->flags & FLAG_LEFT) - *p++ = '-'; - if (dp->flags & FLAG_SHOWSIGN) - *p++ = '+'; - if (dp->flags & FLAG_SPACE) - *p++ = ' '; - if (dp->flags & FLAG_ALT) - *p++ = '#'; - if (dp->flags & FLAG_ZERO) - *p++ = '0'; - if (dp->width_start != dp->width_end) + fbp = buf; + *fbp++ = '%'; +#if NEED_PRINTF_FLAG_GROUPING + /* The underlying implementation doesn't support the ' flag. + Produce no grouping characters in this case; this is + acceptable because the grouping is locale dependent. */ +#else + if (flags & FLAG_GROUP) + *fbp++ = '\''; +#endif + if (flags & FLAG_LEFT) + *fbp++ = '-'; + if (flags & FLAG_SHOWSIGN) + *fbp++ = '+'; + if (flags & FLAG_SPACE) + *fbp++ = ' '; + if (flags & FLAG_ALT) + *fbp++ = '#'; + if (!pad_ourselves) { - size_t n = dp->width_end - dp->width_start; - memcpy (p, dp->width_start, n * sizeof (CHAR_T)); - p += n; + if (flags & FLAG_ZERO) + *fbp++ = '0'; + if (dp->width_start != dp->width_end) + { + size_t n = dp->width_end - dp->width_start; + /* The width specification is known to consist only + of standard ASCII characters. */ + if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) + { + memcpy (fbp, dp->width_start, n * sizeof (TCHAR_T)); + fbp += n; + } + else + { + const FCHAR_T *mp = dp->width_start; + do + *fbp++ = (unsigned char) *mp++; + while (--n > 0); + } + } } if (dp->precision_start != dp->precision_end) { size_t n = dp->precision_end - dp->precision_start; - memcpy (p, dp->precision_start, n * sizeof (CHAR_T)); - p += n; + /* The precision specification is known to consist only + of standard ASCII characters. */ + if (sizeof (FCHAR_T) == sizeof (TCHAR_T)) + { + memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T)); + fbp += n; + } + else + { + const FCHAR_T *mp = dp->precision_start; + do + *fbp++ = (unsigned char) *mp++; + while (--n > 0); + } } switch (type) @@ -1049,8 +3352,15 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l #if HAVE_LONG_LONG_INT case TYPE_LONGLONGINT: case TYPE_ULONGLONGINT: - *p++ = 'l'; +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + *fbp++ = 'I'; + *fbp++ = '6'; + *fbp++ = '4'; + break; +# else + *fbp++ = 'l'; /*FALLTHROUGH*/ +# endif #endif case TYPE_LONGINT: case TYPE_ULONGINT: @@ -1060,28 +3370,31 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l #if HAVE_WCHAR_T case TYPE_WIDE_STRING: #endif - *p++ = 'l'; + *fbp++ = 'l'; break; -#if HAVE_LONG_DOUBLE case TYPE_LONGDOUBLE: - *p++ = 'L'; + *fbp++ = 'L'; break; -#endif default: break; } - *p = dp->conversion; +#if NEED_PRINTF_DIRECTIVE_F + if (dp->conversion == 'F') + *fbp = 'f'; + else +#endif + *fbp = dp->conversion; #if USE_SNPRINTF - p[1] = '%'; - p[2] = 'n'; - p[3] = '\0'; + fbp[1] = '%'; + fbp[2] = 'n'; + fbp[3] = '\0'; #else - p[1] = '\0'; + fbp[1] = '\0'; #endif /* Construct the arguments for calling snprintf or sprintf. */ prefix_count = 0; - if (dp->width_arg_index != ARG_NONE) + if (!pad_ourselves && dp->width_arg_index != ARG_NONE) { if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) abort (); @@ -1095,39 +3408,46 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } #if USE_SNPRINTF + /* The SNPRINTF result is appended after result[0..length]. + The latter is an array of DCHAR_T; SNPRINTF appends an + array of TCHAR_T to it. This is possible because + sizeof (TCHAR_T) divides sizeof (DCHAR_T) and + alignof (TCHAR_T) <= alignof (DCHAR_T). */ +# define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T)) /* Prepare checking whether snprintf returns the count via %n. */ ENSURE_ALLOCATION (xsum (length, 1)); - result[length] = '\0'; + *(TCHAR_T *) (result + length) = '\0'; #endif for (;;) { - size_t maxlen; - int count; - int retcount; - - maxlen = allocated - length; - count = -1; - retcount = 0; + int count = -1; #if USE_SNPRINTF - /* SNPRINTF can fail if maxlen > INT_MAX. */ - if (maxlen > INT_MAX) + int retcount = 0; + size_t maxlen = allocated - length; + /* SNPRINTF can fail if its second argument is + > INT_MAX. */ + if (maxlen > INT_MAX / TCHARS_PER_DCHAR) goto overflow; + maxlen = maxlen * TCHARS_PER_DCHAR; # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ { \ case 0: \ - retcount = SNPRINTF (result + length, maxlen, buf, \ + retcount = SNPRINTF ((TCHAR_T *) (result + length), \ + maxlen, buf, \ arg, &count); \ break; \ case 1: \ - retcount = SNPRINTF (result + length, maxlen, buf, \ + retcount = SNPRINTF ((TCHAR_T *) (result + length), \ + maxlen, buf, \ prefixes[0], arg, &count); \ break; \ case 2: \ - retcount = SNPRINTF (result + length, maxlen, buf, \ + retcount = SNPRINTF ((TCHAR_T *) (result + length), \ + maxlen, buf, \ prefixes[0], prefixes[1], arg, \ &count); \ break; \ @@ -1223,14 +3543,12 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l SNPRINTF_BUF (arg); } break; -#if HAVE_LONG_DOUBLE case TYPE_LONGDOUBLE: { long double arg = a.arg[dp->arg_index].a.a_longdouble; SNPRINTF_BUF (arg); } break; -#endif case TYPE_CHAR: { int arg = a.arg[dp->arg_index].a.a_char; @@ -1278,7 +3596,8 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l { /* Verify that snprintf() has NUL-terminated its result. */ - if (count < maxlen && result[length + count] != '\0') + if (count < maxlen + && ((TCHAR_T *) (result + length)) [count] != '\0') abort (); /* Portability hack. */ if (retcount > count) @@ -1288,11 +3607,11 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l { /* snprintf() doesn't understand the '%n' directive. */ - if (p[1] != '\0') + if (fbp[1] != '\0') { /* Don't use the '%n' directive; instead, look at the snprintf() return value. */ - p[1] = '\0'; + fbp[1] = '\0'; continue; } else @@ -1328,37 +3647,261 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l return NULL; } -#if !USE_SNPRINTF +#if USE_SNPRINTF + /* Handle overflow of the allocated buffer. */ + if (count >= maxlen) + { + /* Need at least count * sizeof (TCHAR_T) bytes. But + allocate proportionally, to avoid looping eternally + if snprintf() reports a too small count. */ + size_t n = + xmax (xsum (length, + (count + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR), + xtimes (allocated, 2)); + + ENSURE_ALLOCATION (n); + continue; + } +#endif + +#if !DCHAR_IS_TCHAR +# if !USE_SNPRINTF if (count >= tmp_length) /* tmp_length was incorrectly calculated - fix the code above! */ abort (); +# endif + + /* Convert from TCHAR_T[] to DCHAR_T[]. */ + if (dp->conversion == 'c' || dp->conversion == 's') + { + /* type = TYPE_CHAR or TYPE_WIDE_CHAR or TYPE_STRING + TYPE_WIDE_STRING. + The result string is not certainly ASCII. */ + const TCHAR_T *tmpsrc; + DCHAR_T *tmpdst; + size_t tmpdst_len; + /* This code assumes that TCHAR_T is 'char'. */ + typedef int TCHAR_T_verify + [2 * (sizeof (TCHAR_T) == 1) - 1]; +# if USE_SNPRINTF + tmpsrc = (TCHAR_T *) (result + length); +# else + tmpsrc = tmp; +# endif + tmpdst = NULL; + tmpdst_len = 0; + if (DCHAR_CONV_FROM_ENCODING (locale_charset (), + iconveh_question_mark, + tmpsrc, count, + NULL, + &tmpdst, &tmpdst_len) + < 0) + { + int saved_errno = errno; + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = saved_errno; + return NULL; + } + ENSURE_ALLOCATION (xsum (length, tmpdst_len)); + DCHAR_CPY (result + length, tmpdst, tmpdst_len); + free (tmpdst); + count = tmpdst_len; + } + else + { + /* The result string is ASCII. + Simple 1:1 conversion. */ +# if USE_SNPRINTF + /* If sizeof (DCHAR_T) == sizeof (TCHAR_T), it's a + no-op conversion, in-place on the array starting + at (result + length). */ + if (sizeof (DCHAR_T) != sizeof (TCHAR_T)) +# endif + { + const TCHAR_T *tmpsrc; + DCHAR_T *tmpdst; + size_t n; + +# if USE_SNPRINTF + if (result == resultbuf) + { + tmpsrc = (TCHAR_T *) (result + length); + /* ENSURE_ALLOCATION will not move tmpsrc + (because it's part of resultbuf). */ + ENSURE_ALLOCATION (xsum (length, count)); + } + else + { + /* ENSURE_ALLOCATION will move the array + (because it uses realloc(). */ + ENSURE_ALLOCATION (xsum (length, count)); + tmpsrc = (TCHAR_T *) (result + length); + } +# else + tmpsrc = tmp; + ENSURE_ALLOCATION (xsum (length, count)); +# endif + tmpdst = result + length; + /* Copy backwards, because of overlapping. */ + tmpsrc += count; + tmpdst += count; + for (n = count; n > 0; n--) + *--tmpdst = (unsigned char) *--tmpsrc; + } + } #endif +#if DCHAR_IS_TCHAR && !USE_SNPRINTF /* Make room for the result. */ - if (count >= maxlen) + if (count > allocated - length) { - /* Need at least count bytes. But allocate - proportionally, to avoid looping eternally if - snprintf() reports a too small count. */ + /* Need at least count elements. But allocate + proportionally. */ size_t n = xmax (xsum (length, count), xtimes (allocated, 2)); ENSURE_ALLOCATION (n); -#if USE_SNPRINTF - continue; + } #endif + + /* Here count <= allocated - length. */ + + /* Perform padding. */ +#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO + if (pad_ourselves && has_width) + { + size_t w; +# if ENABLE_UNISTDIO + /* Outside POSIX, it's preferrable to compare the width + against the number of _characters_ of the converted + value. */ + w = DCHAR_MBSNLEN (result + length, count); +# else + /* The width is compared against the number of _bytes_ + of the converted value, says POSIX. */ + w = count; +# endif + if (w < width) + { + size_t pad = width - w; +# if USE_SNPRINTF + /* Make room for the result. */ + if (xsum (count, pad) > allocated - length) + { + /* Need at least count + pad elements. But + allocate proportionally. */ + size_t n = + xmax (xsum3 (length, count, pad), + xtimes (allocated, 2)); + + length += count; + ENSURE_ALLOCATION (n); + length -= count; + } + /* Here count + pad <= allocated - length. */ +# endif + { +# if !DCHAR_IS_TCHAR || USE_SNPRINTF + DCHAR_T * const rp = result + length; +# else + DCHAR_T * const rp = tmp; +# endif + DCHAR_T *p = rp + count; + DCHAR_T *end = p + pad; +# if NEED_PRINTF_FLAG_ZERO + DCHAR_T *pad_ptr; +# if !DCHAR_IS_TCHAR + if (dp->conversion == 'c' + || dp->conversion == 's') + /* No zero-padding for string directives. */ + pad_ptr = NULL; + else +# endif + { + pad_ptr = (*rp == '-' ? rp + 1 : rp); + /* No zero-padding of "inf" and "nan". */ + if ((*pad_ptr >= 'A' && *pad_ptr <= 'Z') + || (*pad_ptr >= 'a' && *pad_ptr <= 'z')) + pad_ptr = NULL; + } +# endif + /* The generated string now extends from rp to p, + with the zero padding insertion point being at + pad_ptr. */ + + count = count + pad; /* = end - rp */ + + if (flags & FLAG_LEFT) + { + /* Pad with spaces on the right. */ + for (; pad > 0; pad--) + *p++ = ' '; + } +# if NEED_PRINTF_FLAG_ZERO + else if ((flags & FLAG_ZERO) && pad_ptr != NULL) + { + /* Pad with zeroes. */ + DCHAR_T *q = end; + + while (p > pad_ptr) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = '0'; + } +# endif + else + { + /* Pad with spaces on the left. */ + DCHAR_T *q = end; + + while (p > rp) + *--q = *--p; + for (; pad > 0; pad--) + *p++ = ' '; + } + } + } } +#endif -#if USE_SNPRINTF +#if DCHAR_IS_TCHAR && !USE_SNPRINTF + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); +#endif + + /* Here still count <= allocated - length. */ + +#if !DCHAR_IS_TCHAR || USE_SNPRINTF /* The snprintf() result did fit. */ #else /* Append the sprintf() result. */ - memcpy (result + length, tmp, count * sizeof (CHAR_T)); + memcpy (result + length, tmp, count * sizeof (DCHAR_T)); +#endif +#if !USE_SNPRINTF if (tmp != tmpbuf) free (tmp); #endif +#if NEED_PRINTF_DIRECTIVE_F + if (dp->conversion == 'F') + { + /* Convert the %f result to upper case for %F. */ + DCHAR_T *rp = result + length; + size_t rc; + for (rc = count; rc > 0; rc--, rp++) + if (*rp >= 'a' && *rp <= 'z') + *rp = *rp - 'a' + 'A'; + } +#endif + length += count; break; } @@ -1373,9 +3916,9 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l if (result != resultbuf && length + 1 < allocated) { /* Shrink the allocated memory if possible. */ - CHAR_T *memory; + DCHAR_T *memory; - memory = (CHAR_T *) realloc (result, (length + 1) * sizeof (CHAR_T)); + memory = (DCHAR_T *) realloc (result, (length + 1) * sizeof (DCHAR_T)); if (memory != NULL) result = memory; } @@ -1411,10 +3954,13 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *l } } +#undef TCHARS_PER_DCHAR #undef SNPRINTF #undef USE_SNPRINTF #undef PRINTF_PARSE #undef DIRECTIVES #undef DIRECTIVE -#undef CHAR_T +#undef TCHAR_T +#undef DCHAR_T +#undef FCHAR_T #undef VASNPRINTF diff -ruNp m4-1.4.9/lib/vasprintf.c m4-1.4.10/lib/vasprintf.c --- m4-1.4.9/lib/vasprintf.c 2007-03-23 06:51:01.000000000 -0600 +++ m4-1.4.10/lib/vasprintf.c 2007-05-30 19:30:42.000000000 -0600 @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,11 @@ #include /* Specification. */ -#include "vasprintf.h" +#ifdef IN_LIBASPRINTF +# include "vasprintf.h" +#else +# include +#endif #include #include diff -ruNp m4-1.4.9/lib/vasprintf.h m4-1.4.10/lib/vasprintf.h --- m4-1.4.9/lib/vasprintf.h 2007-03-23 06:51:01.000000000 -0600 +++ m4-1.4.10/lib/vasprintf.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,69 +0,0 @@ -/* vsprintf with automatic memory allocation. - Copyright (C) 2002-2003, 2007 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _VASPRINTF_H -#define _VASPRINTF_H - -#if HAVE_VASPRINTF - -/* Get asprintf(), vasprintf() declarations. */ -#include - -#endif - -#if !HAVE_VASPRINTF || REPLACE_VASPRINTF - -/* Get va_list. */ -#include - -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ -# define __attribute__(Spec) /* empty */ -# endif -/* The __-protected variants of `format' and `printf' attributes - are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __format__ format -# define __printf__ printf -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Write formatted output to a string dynamically allocated with malloc(). - If the memory allocation succeeds, store the address of the string in - *RESULT and return the number of resulting bytes, excluding the trailing - NUL. Upon memory allocation error, or some other error, return -1. */ -#if REPLACE_VASPRINTF -# define asprintf rpl_asprintf -# define vasprintf rpl_vasprintf -#endif -extern int asprintf (char **result, const char *format, ...) - __attribute__ ((__format__ (__printf__, 2, 3))); -extern int vasprintf (char **result, const char *format, va_list args) - __attribute__ ((__format__ (__printf__, 2, 0))); - -#ifdef __cplusplus -} -#endif - -#endif - -#endif /* _VASPRINTF_H */ diff -ruNp m4-1.4.9/lib/version-etc.c m4-1.4.10/lib/version-etc.c --- m4-1.4.9/lib/version-etc.c 2007-03-23 06:51:02.000000000 -0600 +++ m4-1.4.10/lib/version-etc.c 2007-07-05 05:48:29.000000000 -0600 @@ -3,7 +3,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -67,7 +67,7 @@ version_etc_va (FILE *stream, fputs (_("\ \n\ -License GPLv2+: GNU GPL version 2 or later \n\ +License GPLv3+: GNU GPL version 3 or later \n\ This is free software: you are free to change and redistribute it.\n\ There is NO WARRANTY, to the extent permitted by law.\n\ \n\ diff -ruNp m4-1.4.9/lib/wchar_.h m4-1.4.10/lib/wchar_.h --- m4-1.4.9/lib/wchar_.h 2007-03-23 06:51:03.000000000 -0600 +++ m4-1.4.10/lib/wchar_.h 2007-07-09 21:12:32.000000000 -0600 @@ -22,11 +22,11 @@ * ISO C 99 for platforms that have issues. * * - * For now, this just ensures proper prerequisite inclusion order. + * For now, this just ensures proper prerequisite inclusion order and + * the declaration of wcwidth(). */ #ifndef _GL_WCHAR_H -#define _GL_WCHAR_H /* Tru64 with Desktop Toolkit C has a bug: must be included before . @@ -36,7 +36,47 @@ #include #include -/* Include the original . */ -#include @ABSOLUTE_WCHAR_H@ +/* Include the original if it exists. + Some builds of uClibc lack it. */ +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_WCHAR_H@ +# @INCLUDE_NEXT@ @NEXT_WCHAR_H@ +#endif + +#ifndef _GL_WCHAR_H +#define _GL_WCHAR_H + +/* The definition of GL_LINK_WARNING is copied here. */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Return the number of screen columns needed for WC. */ +#if @GNULIB_WCWIDTH@ +# if @REPLACE_WCWIDTH@ +# undef wcwidth +# define wcwidth rpl_wcwidth +extern int wcwidth (wchar_t); +# else +# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@ +/* wcwidth exists but is not declared. */ +extern int wcwidth (int /* actually wchar_t */); +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# undef wcwidth +# define wcwidth(w) \ + (GL_LINK_WARNING ("wcwidth is unportable - " \ + "use gnulib module wcwidth for portability"), \ + wcwidth (w)) +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_WCHAR_H */ #endif /* _GL_WCHAR_H */ diff -ruNp m4-1.4.9/lib/wctype_.h m4-1.4.10/lib/wctype_.h --- m4-1.4.9/lib/wctype_.h 2007-03-23 06:51:03.000000000 -0600 +++ m4-1.4.10/lib/wctype_.h 2007-07-05 05:48:30.000000000 -0600 @@ -27,7 +27,6 @@ */ #ifndef _GL_WCTYPE_H -#define _GL_WCTYPE_H #if @HAVE_WINT_T@ /* Solaris 2.5 has a bug: must be included before . @@ -39,20 +38,27 @@ # include # include # include -typedef wint_t __wctype_wint_t; -#else -typedef int __wctype_wint_t; #endif /* Include the original if it exists. BeOS 5 has the functions but no . */ +/* The include_next requires a split double-inclusion guard. */ #if @HAVE_WCTYPE_H@ -# include @ABSOLUTE_WCTYPE_H@ +# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@ +#endif + +#ifndef _GL_WCTYPE_H +#define _GL_WCTYPE_H + +#if @HAVE_WINT_T@ +typedef wint_t __wctype_wint_t; +#else +typedef int __wctype_wint_t; #endif /* FreeBSD 4.4 to 4.11 has but lacks the functions. Assume all 12 functions are implemented the same way, or not at all. */ -#if ! HAVE_ISWCNTRL +#if ! @HAVE_ISWCNTRL@ /* IRIX 5.3 has macros but no functions, its isw* macros refer to an undefined variable _ctmp_ and to macros like _P, and they @@ -152,3 +158,4 @@ iswxdigit (__wctype_wint_t wc) # endif /* ! HAVE_ISWCNTRL */ #endif /* _GL_WCTYPE_H */ +#endif /* _GL_WCTYPE_H */ diff -ruNp m4-1.4.9/lib/xallocsa.c m4-1.4.10/lib/xallocsa.c --- m4-1.4.9/lib/xallocsa.c 2007-03-23 06:51:03.000000000 -0600 +++ m4-1.4.10/lib/xallocsa.c 1969-12-31 17:00:00.000000000 -0700 @@ -1,35 +0,0 @@ -/* Safe automatic memory allocation with out of memory checking. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. - Written by Bruno Haible , 2003. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include - -/* Specification. */ -#include "xallocsa.h" - -#include "xalloc.h" - -void * -xmallocsa (size_t n) -{ - void *p; - - p = mallocsa (n); - if (p == NULL) - xalloc_die (); - return p; -} diff -ruNp m4-1.4.9/lib/xallocsa.h m4-1.4.10/lib/xallocsa.h --- m4-1.4.9/lib/xallocsa.h 2007-03-23 06:51:03.000000000 -0600 +++ m4-1.4.10/lib/xallocsa.h 1969-12-31 17:00:00.000000000 -0700 @@ -1,54 +0,0 @@ -/* Safe automatic memory allocation with out of memory checking. - Copyright (C) 2003, 2005 Free Software Foundation, Inc. - Written by Bruno Haible , 2003. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _XALLOCSA_H -#define _XALLOCSA_H - -#include "allocsa.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* xallocsa(N) is a checking safe variant of alloca(N). It allocates N bytes - of memory allocated on the stack, that must be freed using freesa() before - the function returns. Upon failure, it exits with an error message. */ -#if HAVE_ALLOCA -# define xallocsa(N) \ - ((N) < 4032 - sa_increment \ - ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ - : xmallocsa (N)) -extern void * xmallocsa (size_t n); -#else -# define xallocsa(N) \ - xmalloc (N) -#endif - -/* Maybe we should also define a variant - xnallocsa (size_t n, size_t s) - behaves like xallocsa (n * s) - If this would be useful in your application. please speak up. */ - - -#ifdef __cplusplus -} -#endif - - -#endif /* _XALLOCSA_H */ diff -ruNp m4-1.4.9/lib/xmalloca.c m4-1.4.10/lib/xmalloca.c --- m4-1.4.9/lib/xmalloca.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/xmalloca.c 2007-07-04 22:02:40.000000000 -0600 @@ -0,0 +1,35 @@ +/* Safe automatic memory allocation with out of memory checking. + Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +/* Specification. */ +#include "xmalloca.h" + +#include "xalloc.h" + +void * +xmmalloca (size_t n) +{ + void *p; + + p = mmalloca (n); + if (p == NULL) + xalloc_die (); + return p; +} diff -ruNp m4-1.4.9/lib/xmalloca.h m4-1.4.10/lib/xmalloca.h --- m4-1.4.9/lib/xmalloca.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/lib/xmalloca.h 2007-07-04 22:02:41.000000000 -0600 @@ -0,0 +1,54 @@ +/* Safe automatic memory allocation with out of memory checking. + Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _XMALLOCA_H +#define _XMALLOCA_H + +#include "malloca.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* xmalloca(N) is a checking safe variant of alloca(N). It allocates N bytes + of memory allocated on the stack, that must be freed using freesa() before + the function returns. Upon failure, it exits with an error message. */ +#if HAVE_ALLOCA +# define xmalloca(N) \ + ((N) < 4032 - sa_increment \ + ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \ + : xmmalloca (N)) +extern void * xmmalloca (size_t n); +#else +# define xmalloca(N) \ + xmalloc (N) +#endif + +/* Maybe we should also define a variant + xnmalloca (size_t n, size_t s) - behaves like xmalloca (n * s) + If this would be useful in your application. please speak up. */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* _XMALLOCA_H */ diff -ruNp m4-1.4.9/lib/xvasprintf.c m4-1.4.10/lib/xvasprintf.c --- m4-1.4.9/lib/xvasprintf.c 2007-03-23 06:51:04.000000000 -0600 +++ m4-1.4.10/lib/xvasprintf.c 2007-05-30 19:30:46.000000000 -0600 @@ -1,5 +1,5 @@ /* vasprintf and asprintf with out-of-memory checking. - Copyright (C) 1999, 2002-2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2002-2004, 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,8 +23,8 @@ #include #include #include +#include -#include "vasprintf.h" #include "xalloc.h" /* Checked size_t computations. */ diff -ruNp m4-1.4.9/local/doc/gpl-3.0.texi.diff m4-1.4.10/local/doc/gpl-3.0.texi.diff --- m4-1.4.9/local/doc/gpl-3.0.texi.diff 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/local/doc/gpl-3.0.texi.diff 2007-07-05 05:45:22.000000000 -0600 @@ -0,0 +1,36 @@ +--- ../gnulib/doc/gpl-3.0.texi 2007-07-04 11:50:35.890625000 -0600 ++++ doc/gpl-3.0.texi 2007-07-04 20:58:11.468750000 -0600 +@@ -1,5 +1,5 @@ + @node Copying +-@unnumbered GNU General Public License ++@appendixsec GNU General Public License + @center Version 3, 29 June 2007 + + @c This file is intended to be included in another file. +@@ -222,7 +222,7 @@ + conditions: + + @enumerate a +-@item ++@item + The work must carry prominent notices stating that you modified it, + and giving a relevant date. + +@@ -670,7 +670,7 @@ + the ``copyright'' line and a pointer to where the full notice is found. + + @smallexample +-@var{one line to give the program's name and a brief idea of what it does.} ++@var{one line to give the program's name and a brief idea of what it does.} + Copyright (C) @var{year} @var{name of author} + + This program is free software: you can redistribute it and/or modify +@@ -693,7 +693,7 @@ + notice like this when it starts in an interactive mode: + + @smallexample +-@var{program} Copyright (C) @var{year} @var{name of author} ++@var{program} Copyright (C) @var{year} @var{name of author} + This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}. + This is free software, and you are welcome to redistribute it + under certain conditions; type @samp{show c} for details. diff -ruNp m4-1.4.9/local/lib/version-etc.c.diff m4-1.4.10/local/lib/version-etc.c.diff --- m4-1.4.9/local/lib/version-etc.c.diff 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/local/lib/version-etc.c.diff 2007-07-05 05:45:23.000000000 -0600 @@ -0,0 +1,20 @@ +--- ../gnulib/lib/version-etc.c 2007-03-24 07:08:51.698250000 -0600 ++++ lib/version-etc.c 2007-07-04 20:26:39.296875000 -0600 +@@ -3,7 +3,7 @@ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 2, or (at your option) ++ the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, +@@ -67,7 +67,7 @@ + + fputs (_("\ + \n\ +-License GPLv2+: GNU GPL version 2 or later \n\ ++License GPLv3+: GNU GPL version 3 or later \n\ + This is free software: you are free to change and redistribute it.\n\ + There is NO WARRANTY, to the extent permitted by law.\n\ + \n\ diff -ruNp m4-1.4.9/m4/absolute-header.m4 m4-1.4.10/m4/absolute-header.m4 --- m4-1.4.9/m4/absolute-header.m4 2007-03-23 07:14:32.000000000 -0600 +++ m4-1.4.10/m4/absolute-header.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,44 +0,0 @@ -# absolute-header.m4 serial 6 -dnl Copyright (C) 2006 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Derek Price. - -# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...) -# --------------------------------------- -# Find the absolute name of a header file, assuming the header exists. -# If the header were sys/inttypes.h, this macro would define -# ABSOLUTE_SYS_INTTYPES_H to the `""' quoted absolute name of sys/inttypes.h -# in config.h -# (e.g. `#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"'). -# The three "///" are to pacify Sun C 5.8, which otherwise would say -# "warning: #include of /usr/include/... may be non-portable". -# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. -AC_DEFUN([gl_ABSOLUTE_HEADER], -[AC_LANG_PREPROC_REQUIRE()dnl -AC_FOREACH([gl_HEADER_NAME], [$1], - [AS_VAR_PUSHDEF([gl_absolute_header], - [gl_cv_absolute_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl - AC_CACHE_CHECK([absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>], - m4_quote(m4_defn([gl_absolute_header])), - [AS_VAR_PUSHDEF([ac_header_exists], - [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl - AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl - if test AS_VAR_GET(ac_header_exists) = yes; then - AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])]) -dnl eval is necessary to expand ac_cpp. -dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. - AS_VAR_SET(gl_absolute_header, -[`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | -sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;s#^/[^/]#//&#;p;q;}'`]) - fi - AS_VAR_POPDEF([ac_header_exists])dnl - ])dnl - AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_quote(m4_defn([gl_HEADER_NAME]))), - ["AS_VAR_GET(gl_absolute_header)"], - [Define this to an absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.]) - AS_VAR_POPDEF([gl_absolute_header])dnl -])dnl -])# gl_ABSOLUTE_HEADER diff -ruNp m4-1.4.9/m4/allocsa.m4 m4-1.4.10/m4/allocsa.m4 --- m4-1.4.9/m4/allocsa.m4 2007-03-23 07:14:33.000000000 -0600 +++ m4-1.4.10/m4/allocsa.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,15 +0,0 @@ -# allocsa.m4 serial 6 -dnl Copyright (C) 2003-2004, 2006 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_ALLOCSA], -[ - dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables - dnl @ALLOCA@ and @LTALLOCA@. - dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. - AC_REQUIRE([gl_EEMALLOC]) - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_LONGDOUBLE]) -]) diff -ruNp m4-1.4.9/m4/assert.m4 m4-1.4.10/m4/assert.m4 --- m4-1.4.9/m4/assert.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/assert.m4 2007-07-04 22:02:41.000000000 -0600 @@ -0,0 +1,19 @@ +#serial 5 + +# Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl based on code from Eleftherios Gkioulekas + +AC_DEFUN([gl_ASSERT], +[ + AC_MSG_CHECKING(whether to enable assertions) + AC_ARG_ENABLE(assert, + [ --disable-assert turn off assertions], + [ AC_MSG_RESULT(no) + AC_DEFINE(NDEBUG,1,[Define to 1 if assertions should be disabled.]) ], + [ AC_MSG_RESULT(yes) ] + ) +]) diff -ruNp m4-1.4.9/m4/closein.m4 m4-1.4.10/m4/closein.m4 --- m4-1.4.9/m4/closein.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/closein.m4 2007-05-30 19:30:47.000000000 -0600 @@ -0,0 +1,13 @@ +# closein.m4 serial 1 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_CLOSEIN], +[ + AC_LIBOBJ([closein]) + + dnl Prerequisites of lib/closein.c. + : +]) diff -ruNp m4-1.4.9/m4/fflush.m4 m4-1.4.10/m4/fflush.m4 --- m4-1.4.9/m4/fflush.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/fflush.m4 2007-05-30 19:30:49.000000000 -0600 @@ -0,0 +1,52 @@ +# fflush.m4 serial 4 + +# Copyright (C) 2007 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl From Eric Blake + +dnl Find out how to obey POSIX semantics of fflush(stdin) discarding +dnl unread input on seekable streams, rather than C99 undefined semantics. + +AC_DEFUN([gl_FUNC_FFLUSH], +[ + AC_CACHE_CHECK([whether fflush works on input streams], + [gl_cv_func_fflush_stdin], + [echo hello world > conftest.txt + AC_RUN_IFELSE([AC_LANG_PROGRAM( + [[ +#include +#include + ]], [[FILE *f = fopen ("conftest.txt", "r"); + char buffer[10]; + int fd = fileno (f); + if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5) + return 2; + /* For deterministic results, ensure f read a bigger buffer. */ + if (lseek (fd, 0, SEEK_CUR) == 5) + return 3; + /* POSIX requires fflush-fseek to set file offset of fd. */ + if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0) + return 4; + return !(lseek (fd, 0, SEEK_CUR) == 5); + ]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no], + [dnl Pessimistically assume fflush is broken. This is wrong for + dnl at least glibc and cygwin; but lib/fflush.c takes this into account. + gl_cv_func_fflush_stdin=no]) + rm conftest.txt + ]) + if test $gl_cv_func_fflush_stdin = no; then + gl_REPLACE_FFLUSH + fi +]) + +AC_DEFUN([gl_REPLACE_FFLUSH], +[ + AC_LIBOBJ([fflush]) + AC_LIBOBJ([fseeko]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + REPLACE_FFLUSH=1 + REPLACE_FSEEKO=1 +]) diff -ruNp m4-1.4.9/m4/float_h.m4 m4-1.4.10/m4/float_h.m4 --- m4-1.4.9/m4/float_h.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/float_h.m4 2007-07-05 05:48:34.000000000 -0600 @@ -0,0 +1,19 @@ +# float_h.m4 serial 2 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FLOAT_H], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + FLOAT_H= + case "$host_os" in + beos*) + FLOAT_H=float.h + gl_CHECK_NEXT_HEADERS([float.h]) + ;; + esac + AC_SUBST([FLOAT_H]) +]) diff -ruNp m4-1.4.9/m4/fpieee.m4 m4-1.4.10/m4/fpieee.m4 --- m4-1.4.9/m4/fpieee.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/fpieee.m4 2007-05-30 19:30:50.000000000 -0600 @@ -0,0 +1,52 @@ +# fpieee.m4 serial 1 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl IEEE 754 standardized three items: +dnl - The formats of single-float and double-float - nowadays commonly +dnl available as 'float' and 'double' in C and C++. +dnl No autoconf test needed. +dnl - The overflow and division by zero behaviour: The result are values +dnl '±Inf' and 'NaN', rather than exceptions as it was before. +dnl This file provides an autoconf macro for ensuring this behaviour of +dnl floating-point operations. +dnl - A set of conditions (overflow, underflow, inexact, etc.) which can +dnl be configured to trigger an exception. +dnl This cannot be done in a portable way: it depends on the compiler, +dnl libc, kernel, and CPU. No autoconf macro is provided for this. + +dnl Ensure non-trapping behaviour of floating-point overflow and +dnl floating-point division by zero. +dnl (For integer overflow, see gcc's -ftrapv option; for integer division by +dnl zero, see the autoconf macro in intdiv0.m4.) + +AC_DEFUN([gl_FP_IEEE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + # IEEE behaviour is the default on all CPUs except Alpha and SH + # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4 + # and the GCC 4.1.2 manual). + case "$host_cpu" in + alpha*) + # On Alpha systems, a compiler option provides the behaviour. + # See the ieee(3) manual page, also available at + # + if test -n "$GCC"; then + # GCC has the option -mieee. + CPPFLAGS="$CPPFLAGS -mieee" + else + # Compaq (ex-DEC) C has the option -ieee. + CPPFLAGS="$CPPFLAGS -ieee" + fi + ;; + sh*) + if test -n "$GCC"; then + # GCC has the option -mieee. + CPPFLAGS="$CPPFLAGS -mieee" + fi + ;; + esac +]) diff -ruNp m4-1.4.9/m4/fpurge.m4 m4-1.4.10/m4/fpurge.m4 --- m4-1.4.9/m4/fpurge.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/fpurge.m4 2007-05-30 19:30:50.000000000 -0600 @@ -0,0 +1,12 @@ +# fpurge.m4 serial 2 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FPURGE], +[ + AC_CHECK_FUNCS_ONCE([fpurge]) + AC_CHECK_FUNCS_ONCE([__fpurge]) + AC_CHECK_DECLS([fpurge], , , [#include ]) +]) diff -ruNp m4-1.4.9/m4/freading.m4 m4-1.4.10/m4/freading.m4 --- m4-1.4.9/m4/freading.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/freading.m4 2007-05-30 19:30:50.000000000 -0600 @@ -0,0 +1,10 @@ +# freading.m4 serial 1 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FREADING], +[ + AC_CHECK_FUNCS_ONCE([__freading]) +]) diff -ruNp m4-1.4.9/m4/frexp.m4 m4-1.4.10/m4/frexp.m4 --- m4-1.4.9/m4/frexp.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/frexp.m4 2007-05-30 19:30:51.000000000 -0600 @@ -0,0 +1,102 @@ +# frexp.m4 serial 3 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FREXP], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + FREXP_LIBM= + AC_CACHE_CHECK([whether frexp() can be used without linking with libm], + [gl_cv_func_frexp_no_libm], + [ + AC_TRY_LINK([#include + double x;], + [int e; return frexp (x, &e) > 0;], + [gl_cv_func_frexp_no_libm=yes], + [gl_cv_func_frexp_no_libm=no]) + ]) + if test $gl_cv_func_frexp_no_libm = no; then + AC_CACHE_CHECK([whether frexp() can be used with libm], + [gl_cv_func_frexp_in_libm], + [ + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([#include + double x;], + [int e; return frexp (x, &e) > 0;], + [gl_cv_func_frexp_in_libm=yes], + [gl_cv_func_frexp_in_libm=no]) + LIBS="$save_LIBS" + ]) + if test $gl_cv_func_frexp_in_libm = yes; then + FREXP_LIBM=-lm + fi + fi + if test $gl_cv_func_frexp_no_libm = yes \ + || test $gl_cv_func_frexp_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $FREXP_LIBM" + gl_FUNC_FREXP_WORKS + LIBS="$save_LIBS" + case "$gl_cv_func_frexp_works" in + *yes) gl_func_frexp=yes ;; + *) gl_func_frexp=no; REPLACE_FREXP=1; FREXP_LIBM= ;; + esac + else + gl_func_frexp=no + fi + if test $gl_func_frexp = yes; then + AC_DEFINE([HAVE_FREXP], 1, + [Define if the frexp() function is available and works.]) + else + AC_LIBOBJ([frexp]) + fi + AC_SUBST([FREXP_LIBM]) +]) + +dnl Test whether frexp() works also on denormalized numbers (this fails e.g. on +dnl NetBSD 3.0) and on infinite numbers (this fails e.g. on IRIX 6.5). +AC_DEFUN([gl_FUNC_FREXP_WORKS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works], + [ + AC_TRY_RUN([ +#include +#include +int main() +{ + int i; + volatile double x; + /* Test on denormalized numbers. */ + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + ; + if (x > 0.0) + { + int exp; + double y = frexp (x, &exp); + /* On machines with IEEE754 arithmetic: x = 1.11254e-308, exp = -1022. + On NetBSD: y = 0.75. Correct: y = 0.5. */ + if (y != 0.5) + return 1; + } + /* Test on infinite numbers. */ + x = 1.0 / 0.0; + { + int exp; + double y = frexp (x, &exp); + if (y != x) + return 1; + } + return 0; +}], [gl_cv_func_frexp_works=yes], [gl_cv_func_frexp_works=no], + [case "$host_os" in + netbsd* | irix*) gl_cv_func_frexp_works="guessing no";; + *) gl_cv_func_frexp_works="guessing yes";; + esac + ]) + ]) +]) diff -ruNp m4-1.4.9/m4/frexpl.m4 m4-1.4.10/m4/frexpl.m4 --- m4-1.4.9/m4/frexpl.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/frexpl.m4 2007-07-05 05:48:36.000000000 -0600 @@ -0,0 +1,164 @@ +# frexpl.m4 serial 6 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FREXPL], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + FREXPL_LIBM= + AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], + [gl_cv_func_frexpl_no_libm], + [ + AC_TRY_LINK([#include + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_no_libm=yes], + [gl_cv_func_frexpl_no_libm=no]) + ]) + if test $gl_cv_func_frexpl_no_libm = no; then + AC_CACHE_CHECK([whether frexpl() can be used with libm], + [gl_cv_func_frexpl_in_libm], + [ + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([#include + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_in_libm=yes], + [gl_cv_func_frexpl_in_libm=no]) + LIBS="$save_LIBS" + ]) + if test $gl_cv_func_frexpl_in_libm = yes; then + FREXPL_LIBM=-lm + fi + fi + if test $gl_cv_func_frexpl_no_libm = yes \ + || test $gl_cv_func_frexpl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $FREXPL_LIBM" + gl_FUNC_FREXPL_WORKS + LIBS="$save_LIBS" + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl=yes ;; + *) gl_func_frexpl=no; REPLACE_FREXPL=1; FREXPL_LIBM= ;; + esac + else + gl_func_frexpl=no + fi + if test $gl_func_frexpl = yes; then + AC_DEFINE([HAVE_FREXPL], 1, + [Define if the frexpl() function is available.]) + dnl Also check whether it's declared. + dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in . + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include ]) + else + HAVE_DECL_FREXPL=0 + AC_LIBOBJ([frexpl]) + fi + AC_SUBST([FREXPL_LIBM]) +]) + +AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], + [gl_cv_func_frexpl_no_libm], + [ + AC_TRY_LINK([#include + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_no_libm=yes], + [gl_cv_func_frexpl_no_libm=no]) + ]) + if test $gl_cv_func_frexpl_no_libm = yes; then + gl_FUNC_FREXPL_WORKS + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + dnl Set REPLACE_FREXPL here because the system may have frexpl in libm. + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then + AC_DEFINE([HAVE_FREXPL_IN_LIBC], 1, + [Define if the frexpl() function is available in libc.]) + dnl Also check whether it's declared. + dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in . + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include ]) + else + HAVE_DECL_FREXPL=0 + AC_LIBOBJ([frexpl]) + fi +]) + +dnl Test whether frexpl() works on finite numbers (this fails on +dnl MacOS X 10.4/PowerPC, on AIX 5.1, and on BeOS) and also on infinite numbers +dnl (this fails e.g. on IRIX 6.5 and mingw). +AC_DEFUN([gl_FUNC_FREXPL_WORKS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether frexpl works], [gl_cv_func_frexpl_works], + [ + AC_TRY_RUN([ +#include +extern long double frexpl (long double, int *); +int main() +{ + volatile long double x; + /* Test on finite numbers that fails on AIX 5.1. */ + x = 16.0L; + { + int exp = -9999; + frexpl (x, &exp); + if (exp != 5) + return 1; + } + /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl + function returns an invalid (incorrectly normalized) value: it returns + y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } + but the correct result is + 0.505L = { 0x3fe028f5, 0xc28f5c29, 0xbc547ae1, 0x47ae1480 } */ + x = 1.01L; + { + int exp = -9999; + long double y = frexpl (x, &exp); + if (!(exp == 1 && y == 0.505L)) + return 1; + } + /* Test on large finite numbers. This fails on BeOS at i = 16322, while + LDBL_MAX_EXP = 16384. + In the loop end test, we test x against Infinity, rather than comparing + i with LDBL_MAX_EXP, because BeOS has a wrong LDBL_MAX_EXP. */ + { + int i; + for (i = 1, x = 1.0L; x != x + x; i++, x *= 2.0L) + { + int exp = -9999; + frexpl (x, &exp); + if (exp != i) + return 1; + } + } + /* Test on infinite numbers. */ + x = 1.0L / 0.0L; + { + int exp; + long double y = frexpl (x, &exp); + if (y != x) + return 1; + } + return 0; +}], [gl_cv_func_frexpl_works=yes], [gl_cv_func_frexpl_works=no], + [case "$host_os" in + aix* | beos* | darwin* | irix* | mingw* | pw*) + gl_cv_func_frexpl_works="guessing no";; + *) gl_cv_func_frexpl_works="guessing yes";; + esac + ]) + ]) +]) diff -ruNp m4-1.4.9/m4/fseeko.m4 m4-1.4.10/m4/fseeko.m4 --- m4-1.4.9/m4/fseeko.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/fseeko.m4 2007-05-30 19:30:51.000000000 -0600 @@ -0,0 +1,30 @@ +# fseeko.m4 serial 3 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FSEEKO], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) + AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko], + [ + AC_TRY_LINK([#include ], [fseeko (stdin, 0, 0);], + [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no]) + ]) + if test $gl_cv_func_fseeko = no; then + HAVE_FSEEKO=0 + gl_REPLACE_FSEEKO + elif test $gl_cv_var_stdin_large_offset = no; then + gl_REPLACE_FSEEKO + fi +]) + +AC_DEFUN([gl_REPLACE_FSEEKO], +[ + AC_LIBOBJ([fseeko]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + REPLACE_FSEEKO=1 +]) diff -ruNp m4-1.4.9/m4/ftello.m4 m4-1.4.10/m4/ftello.m4 --- m4-1.4.9/m4/ftello.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/ftello.m4 2007-05-30 19:30:51.000000000 -0600 @@ -0,0 +1,30 @@ +# ftello.m4 serial 3 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FTELLO], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_STDIN_LARGE_OFFSET]) + AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello], + [ + AC_TRY_LINK([#include ], [ftello (stdin);], + [gl_cv_func_ftello=yes], [gl_cv_func_ftello=no]) + ]) + if test $gl_cv_func_ftello = no; then + HAVE_FTELLO=0 + gl_REPLACE_FTELLO + elif test $gl_cv_var_stdin_large_offset = no; then + gl_REPLACE_FTELLO + fi +]) + +AC_DEFUN([gl_REPLACE_FTELLO], +[ + AC_LIBOBJ([ftello]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + REPLACE_FTELLO=1 +]) diff -ruNp m4-1.4.9/m4/gnulib-cache.m4 m4-1.4.10/m4/gnulib-cache.m4 --- m4-1.4.9/m4/gnulib-cache.m4 2007-03-23 07:12:38.000000000 -0600 +++ m4-1.4.10/m4/gnulib-cache.m4 2007-07-05 05:45:51.000000000 -0600 @@ -15,16 +15,17 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=M4 avltree-oset binary-io clean-temp cloexec close-stream closeout config-h error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io verror version-etc-fsf xalloc xvasprintf +# gnulib-tool --import --dir=. --local-dir=local --lib=libm4 --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --with-tests --no-libtool --macro-prefix=M4 assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer free fseeko gendocs getopt gnupload gpl-3.0 mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io vasprintf-posix verror version-etc version-etc-fsf xalloc xvasprintf # Specification in the form of a few gnulib-tool.m4 macro invocations: -gl_LOCAL_DIR([]) -gl_MODULES([avltree-oset binary-io clean-temp cloexec close-stream closeout config-h error fdl fopen-safer free gendocs getopt gnupload mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io verror version-etc-fsf xalloc xvasprintf]) +gl_LOCAL_DIR([local]) +gl_MODULES([assert avltree-oset binary-io clean-temp cloexec close-stream closein config-h error fdl fflush fopen-safer free fseeko gendocs getopt gnupload gpl-3.0 mkstemp obstack regex stdbool stdint stdlib-safer strtol unlocked-io vasprintf-posix verror version-etc version-etc-fsf xalloc xvasprintf]) gl_AVOID([]) gl_SOURCE_BASE([lib]) gl_M4_BASE([m4]) gl_DOC_BASE([doc]) gl_TESTS_BASE([tests]) +gl_WITH_TESTS gl_LIB([libm4]) gl_MAKEFILE_NAME([]) gl_MACRO_PREFIX([M4]) diff -ruNp m4-1.4.9/m4/gnulib-comp.m4 m4-1.4.10/m4/gnulib-comp.m4 --- m4-1.4.9/m4/gnulib-comp.m4 2007-03-23 07:16:07.000000000 -0600 +++ m4-1.4.10/m4/gnulib-comp.m4 2007-07-04 22:05:58.000000000 -0600 @@ -27,6 +27,10 @@ AC_DEFUN([M4_EARLY], AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_FUNC_FSEEKO]) + AC_REQUIRE([gl_FP_IEEE]) + AC_REQUIRE([AC_FUNC_FSEEKO]) + AC_REQUIRE([AC_FUNC_FSEEKO]) dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode dnl for the builtin va_copy to work. With Autoconf 2.60 or later, dnl AC_PROG_CC_STDC arranges for this. With older Autoconf AC_PROG_CC_STDC @@ -47,26 +51,50 @@ AC_DEFUN([M4_INIT], gl_ltlibdeps= gl_source_base='lib' gl_FUNC_ALLOCA - gl_ALLOCSA + gl_ASSERT AC_DEFINE([SIGNAL_SAFE_LIST], [1], [Define if lists must be signal-safe.]) gl_CLOEXEC gl_CLOSE_STREAM gl_MODULE_INDICATOR([close-stream]) + gl_CLOSEIN gl_CLOSEOUT gl_CONFIG_H gl_ERROR gl_EXITFAIL gl_FATAL_SIGNAL + gl_FUNC_FFLUSH + gl_STDIO_MODULE_INDICATOR([fflush]) + gl_FLOAT_H gl_FOPEN_SAFER gl_MODULE_INDICATOR([fopen-safer]) gl_FUNC_FPENDING + gl_FUNC_FPURGE + gl_FUNC_FREADING gl_FUNC_FREE + gl_FUNC_FREXPL_NO_LIBM + gl_MATH_MODULE_INDICATOR([frexpl]) + gl_FUNC_FSEEKO + gl_STDIO_MODULE_INDICATOR([fseeko]) + gl_FUNC_FTELLO + gl_STDIO_MODULE_INDICATOR([ftello]) gl_GETOPT + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) gl_FUNC_GETTIMEOFDAY gl_INLINE + gl_FUNC_ISNAN_NO_LIBM + gl_DOUBLE_EXPONENT_LOCATION + gl_FUNC_ISNANF_NO_LIBM + gl_FLOAT_EXPONENT_LOCATION + gl_FUNC_ISNANL_NO_LIBM + gl_LONG_DOUBLE_EXPONENT_LOCATION gl_LIST gl_LOCALCHARSET + gl_FUNC_LSEEK + gl_UNISTD_MODULE_INDICATOR([lseek]) AC_FUNC_MALLOC + gl_MALLOCA + gl_MATH_H gt_FUNC_MKDTEMP gl_STDLIB_MODULE_INDICATOR([mkdtemp]) gl_FUNC_MKSTEMP @@ -75,14 +103,27 @@ AC_DEFUN([M4_INIT], dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). gl_LIST gl_PATHMAX + gl_FUNC_PRINTF_FREXP + gl_FUNC_PRINTF_FREXPL + m4_divert_text([INIT_PREPARE], [gl_printf_safe=yes]) gl_QUOTEARG gl_REGEX + gl_SIGNAL_H + gl_SIGNBIT + gl_MATH_MODULE_INDICATOR([signbit]) + AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION]) + AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) + AC_REQUIRE([gl_LONG_DOUBLE_EXPONENT_LOCATION]) gl_SIGNALBLOCKING + gl_SIGNAL_MODULE_INDICATOR([sigprocmask]) gl_SIZE_MAX gt_TYPE_SSIZE_T gl_STDARG_H AM_STDBOOL_H gl_STDINT_H + gt_TYPE_WCHAR_T + gt_TYPE_WINT_T + gl_STDIO_H gl_STDLIB_H gl_STDLIB_SAFER gl_FUNC_STRTOL @@ -97,6 +138,8 @@ AC_DEFUN([M4_INIT], gl_FUNC_GLIBC_UNLOCKED_IO gl_FUNC_VASNPRINTF gl_FUNC_VASPRINTF + gl_STDIO_MODULE_INDICATOR([vasprintf]) + gl_FUNC_VASPRINTF_POSIX gl_WCHAR_H gl_WCTYPE_H gl_XALLOC @@ -148,13 +191,11 @@ AC_DEFUN([M4_FILE_LIST], [ build-aux/link-warning.h doc/fdl.texi doc/gendocs_template + doc/gpl-3.0.texi lib/__fpending.c lib/__fpending.h lib/alloca.c lib/alloca_.h - lib/allocsa.c - lib/allocsa.h - lib/allocsa.valgrind lib/asnprintf.c lib/asprintf.c lib/binary-io.h @@ -164,6 +205,8 @@ AC_DEFUN([M4_FILE_LIST], [ lib/cloexec.h lib/close-stream.c lib/close-stream.h + lib/closein.c + lib/closein.h lib/closeout.c lib/closeout.h lib/config.charset @@ -175,8 +218,20 @@ AC_DEFUN([M4_FILE_LIST], [ lib/fatal-signal.c lib/fatal-signal.h lib/fd-safer.c + lib/fflush.c + lib/float+.h + lib/float_.h lib/fopen-safer.c + lib/fpucw.h + lib/fpurge.c + lib/fpurge.h + lib/freading.c + lib/freading.h lib/free.c + lib/frexp.c + lib/frexpl.c + lib/fseeko.c + lib/ftello.c lib/getopt.c lib/getopt1.c lib/getopt_.h @@ -188,6 +243,10 @@ AC_DEFUN([M4_FILE_LIST], [ lib/gl_anylinked_list1.h lib/gl_anylinked_list2.h lib/gl_anytree_oset.h + lib/gl_array_list.c + lib/gl_array_list.h + lib/gl_array_oset.c + lib/gl_array_oset.h lib/gl_avltree_oset.c lib/gl_avltree_oset.h lib/gl_linkedhash_list.c @@ -196,9 +255,21 @@ AC_DEFUN([M4_FILE_LIST], [ lib/gl_list.h lib/gl_oset.c lib/gl_oset.h + lib/intprops.h + lib/isnan.c + lib/isnan.h + lib/isnanf.c + lib/isnanf.h + lib/isnanl-nolibm.h + lib/isnanl.c lib/localcharset.c lib/localcharset.h + lib/lseek.c lib/malloc.c + lib/malloca.c + lib/malloca.h + lib/malloca.valgrind + lib/math_.h lib/mkdtemp.c lib/mkstemp-safer.c lib/mkstemp.c @@ -208,8 +279,14 @@ AC_DEFUN([M4_FILE_LIST], [ lib/pipe-safer.c lib/printf-args.c lib/printf-args.h + lib/printf-frexp.c + lib/printf-frexp.h + lib/printf-frexpl.c + lib/printf-frexpl.h lib/printf-parse.c lib/printf-parse.h + lib/progname.c + lib/progname.h lib/quotearg.c lib/quotearg.h lib/ref-add.sin @@ -220,18 +297,22 @@ AC_DEFUN([M4_FILE_LIST], [ lib/regex_internal.c lib/regex_internal.h lib/regexec.c + lib/signal_.h + lib/signbitd.c + lib/signbitf.c + lib/signbitl.c lib/sigprocmask.c - lib/sigprocmask.h lib/size_max.h - lib/stat_.h lib/stdbool_.h lib/stdint_.h lib/stdio--.h lib/stdio-safer.h + lib/stdio_.h lib/stdlib--.h lib/stdlib-safer.h lib/stdlib_.h lib/strtol.c + lib/sys_stat_.h lib/sys_time_.h lib/tempname.c lib/tempname.h @@ -244,7 +325,6 @@ AC_DEFUN([M4_FILE_LIST], [ lib/vasnprintf.c lib/vasnprintf.h lib/vasprintf.c - lib/vasprintf.h lib/verify.h lib/verror.c lib/verror.h @@ -255,18 +335,19 @@ AC_DEFUN([M4_FILE_LIST], [ lib/wctype_.h lib/xalloc-die.c lib/xalloc.h - lib/xallocsa.c - lib/xallocsa.h lib/xasprintf.c lib/xmalloc.c + lib/xmalloca.c + lib/xmalloca.h lib/xsize.h lib/xvasprintf.c lib/xvasprintf.h m4/absolute-header.m4 m4/alloca.m4 - m4/allocsa.m4 + m4/assert.m4 m4/cloexec.m4 m4/close-stream.m4 + m4/closein.m4 m4/closeout.m4 m4/codeset.m4 m4/config-h.m4 @@ -276,28 +357,49 @@ AC_DEFUN([M4_FILE_LIST], [ m4/exitfail.m4 m4/extensions.m4 m4/fatal-signal.m4 + m4/fflush.m4 + m4/float_h.m4 m4/fpending.m4 + m4/fpieee.m4 + m4/fpurge.m4 + m4/freading.m4 m4/free.m4 + m4/frexp.m4 + m4/frexpl.m4 + m4/fseeko.m4 + m4/ftello.m4 m4/getopt.m4 m4/gettimeofday.m4 m4/gl_list.m4 m4/glibc21.m4 m4/gnulib-common.m4 + m4/include_next.m4 m4/inline.m4 m4/intmax_t.m4 m4/inttypes_h.m4 + m4/isnan.m4 + m4/isnanf.m4 + m4/isnanl.m4 + m4/ldexpl.m4 m4/localcharset.m4 - m4/longdouble.m4 m4/longlong.m4 + m4/lseek.m4 + m4/malloca.m4 + m4/math_h.m4 m4/mbrtowc.m4 m4/mbstate_t.m4 m4/mkdtemp.m4 m4/mkstemp.m4 m4/pathmax.m4 + m4/printf-frexp.m4 + m4/printf-frexpl.m4 + m4/printf.m4 m4/quotearg.m4 m4/regex.m4 m4/sig_atomic_t.m4 + m4/signal_h.m4 m4/signalblocking.m4 + m4/signbit.m4 m4/size_max.m4 m4/ssize_t.m4 m4/stdarg.m4 @@ -305,6 +407,7 @@ AC_DEFUN([M4_FILE_LIST], [ m4/stdint.m4 m4/stdint_h.m4 m4/stdio-safer.m4 + m4/stdio_h.m4 m4/stdlib-safer.m4 m4/stdlib_h.m4 m4/strtol.m4 @@ -317,6 +420,7 @@ AC_DEFUN([M4_FILE_LIST], [ m4/unistd_h.m4 m4/unlocked-io.m4 m4/vasnprintf.m4 + m4/vasprintf-posix.m4 m4/vasprintf.m4 m4/wchar.m4 m4/wchar_t.m4 @@ -325,4 +429,46 @@ AC_DEFUN([M4_FILE_LIST], [ m4/xalloc.m4 m4/xsize.m4 m4/xvasprintf.m4 + tests/test-alloca-opt.c + tests/test-array_list.c + tests/test-array_oset.c + tests/test-avltree_oset.c + tests/test-binary-io.c + tests/test-binary-io.sh + tests/test-closein.c + tests/test-closein.sh + tests/test-fflush.c + tests/test-fpurge.c + tests/test-freading.c + tests/test-frexpl.c + tests/test-fseeko.c + tests/test-fseeko.sh + tests/test-ftello.c + tests/test-ftello.sh + tests/test-gettimeofday.c + tests/test-isnan.c + tests/test-isnanf.c + tests/test-isnanl-nolibm.c + tests/test-isnanl.h + tests/test-linkedhash_list.c + tests/test-lseek.c + tests/test-lseek.sh + tests/test-malloca.c + tests/test-math.c + tests/test-printf-frexp.c + tests/test-printf-frexpl.c + tests/test-signbit.c + tests/test-stdbool.c + tests/test-stdint.c + tests/test-stdio.c + tests/test-stdlib.c + tests/test-sys_stat.c + tests/test-sys_time.c + tests/test-unistd.c + tests/test-vasnprintf.c + tests/test-vasprintf-posix.c + tests/test-vasprintf.c + tests/test-wchar.c + tests/test-wctype.c + tests/test-xvasprintf.c ]) diff -ruNp m4-1.4.9/m4/include_next.m4 m4-1.4.10/m4/include_next.m4 --- m4-1.4.9/m4/include_next.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/include_next.m4 2007-07-04 22:02:41.000000000 -0600 @@ -0,0 +1,85 @@ +# include_next.m4 serial 3 +dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert and Derek Price. + +AC_DEFUN([gl_INCLUDE_NEXT], +[ + AC_LANG_PREPROC_REQUIRE() + AC_CACHE_CHECK([whether the preprocessor supports include_next], + [gl_cv_have_include_next], + [AC_PREPROC_IFELSE([#include_next ], + [gl_cv_have_include_next=yes], + [gl_cv_have_include_next=no])]) + if test $gl_cv_have_include_next = yes; then + + dnl FIXME: Remove HAVE_INCLUDE_NEXT and update everything that uses it + dnl to use @INCLUDE_NEXT@ instead. + AC_DEFINE([HAVE_INCLUDE_NEXT], 1, + [Define if your compiler supports the #include_next directive.]) + + INCLUDE_NEXT=include_next + else + INCLUDE_NEXT=include + fi + AC_SUBST([INCLUDE_NEXT]) +]) + +# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) +# ------------------------------------------ +# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be +# ''; otherwise define it to be +# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. +# That way, a header file with the following line: +# #@INCLUDE_NEXT@ @NEXT_FOO_H@ +# behaves (after sed substitution) as if it contained +# #include_next +# even if the compiler does not support include_next. +# The three "///" are to pacify Sun C 5.8, which otherwise would say +# "warning: #include of /usr/include/... may be non-portable". +# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. +AC_DEFUN([gl_CHECK_NEXT_HEADERS], +[ + AC_REQUIRE([gl_INCLUDE_NEXT]) + AC_CHECK_HEADERS_ONCE([$1]) + + AC_FOREACH([gl_HEADER_NAME], [$1], + [AS_VAR_PUSHDEF([gl_next_header], + [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME]))) + if test $gl_cv_have_include_next = yes; then + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + else + AC_CACHE_CHECK( + [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>], + m4_quote(m4_defn([gl_next_header])), + [AS_VAR_PUSHDEF([gl_header_exists], + [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME]))) + if test AS_VAR_GET(gl_header_exists) = yes; then + AC_LANG_CONFTEST( + [AC_LANG_SOURCE( + [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] + )]) + dnl eval is necessary to expand ac_cpp. + dnl Ultrix and Pyramid sh refuse to redirect output of eval, + dnl so use subshell. + AS_VAR_SET([gl_next_header], + ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{ + s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"']) + else + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + fi + AS_VAR_POPDEF([gl_header_exists])]) + fi + AC_SUBST( + AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))), + [AS_VAR_GET([gl_next_header])]) + AS_VAR_POPDEF([gl_next_header])]) +]) diff -ruNp m4-1.4.9/m4/isnan.m4 m4-1.4.10/m4/isnan.m4 --- m4-1.4.9/m4/isnan.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/isnan.m4 2007-05-30 19:30:53.000000000 -0600 @@ -0,0 +1,137 @@ +# isnan.m4 serial 2 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check how to get or define isnan() without linking with libm. + +AC_DEFUN([gl_FUNC_ISNAN_NO_LIBM], +[ + AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm], + [gl_cv_func_isnan_no_libm], + [ + AC_TRY_LINK([#include + double x;], + [return isnan (x);], + [gl_cv_func_isnan_no_libm=yes], + [gl_cv_func_isnan_no_libm=no]) + ]) + if test $gl_cv_func_isnan_no_libm = yes; then + AC_DEFINE([HAVE_ISNAN_IN_LIBC], 1, + [Define if the isnan(double) function is available in libc.]) + else + AC_LIBOBJ([isnan]) + gl_DOUBLE_EXPONENT_LOCATION + fi +]) + +AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], +[ + AC_CACHE_CHECK([where to find the exponent in a 'double'], + [gl_cv_cc_double_expbit0], + [ + AC_TRY_RUN([ +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (double x) +{ + memory_double m; + size_t i; + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + ], + [gl_cv_cc_double_expbit0=`cat conftest.out`], + [gl_cv_cc_double_expbit0="unknown"], + [ + dnl On ARM, there are two 'double' floating-point formats, used by + dnl different sets of instructions: The older FPA instructions assume + dnl that they are stored in big-endian word order, while the words + dnl (like integer types) are stored in little-endian byte order. + dnl The newer VFP instructions assume little-endian order consistenly. + AC_EGREP_CPP([mixed_endianness], [ +#if defined arm || defined __arm || defined __arm__ + mixed_endianness +#endif + ], + [gl_cv_cc_double_expbit0="unknown"], + [ + pushdef([AC_MSG_CHECKING],[:])dnl + pushdef([AC_MSG_RESULT],[:])dnl + pushdef([AC_MSG_RESULT_UNQUOTED],[:])dnl + AC_C_BIGENDIAN( + [gl_cv_cc_double_expbit0="word 0 bit 20"], + [gl_cv_cc_double_expbit0="word 1 bit 20"], + [gl_cv_cc_double_expbit0="unknown"]) + popdef([AC_MSG_RESULT_UNQUOTED])dnl + popdef([AC_MSG_RESULT])dnl + popdef([AC_MSG_CHECKING])dnl + ]) + ]) + rm -f conftest.out + ]) + case "$gl_cv_cc_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` + AC_DEFINE_UNQUOTED([DBL_EXPBIT0_WORD], [$word], + [Define as the word index where to find the exponent of 'double'.]) + AC_DEFINE_UNQUOTED([DBL_EXPBIT0_BIT], [$bit], + [Define as the bit index in the word where to find bit 0 of the exponent of 'double'.]) + ;; + esac +]) diff -ruNp m4-1.4.9/m4/isnanf.m4 m4-1.4.10/m4/isnanf.m4 --- m4-1.4.9/m4/isnanf.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/isnanf.m4 2007-05-30 19:30:53.000000000 -0600 @@ -0,0 +1,173 @@ +# isnanf.m4 serial 4 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check how to get or define isnanf() without linking with libm. + +AC_DEFUN([gl_FUNC_ISNANF_NO_LIBM], +[ + gl_HAVE_ISNANF_NO_LIBM + if test $gl_cv_func_isnanf_no_libm = yes; then + gl_ISNANF_WORKS + fi + if test $gl_cv_func_isnanf_no_libm = yes \ + && { case "$gl_cv_func_isnanf_works" in + *yes) true;; + *) false;; + esac + }; then + AC_DEFINE([HAVE_ISNANF_IN_LIBC], 1, + [Define if the isnan(float) function is available in libc.]) + else + AC_LIBOBJ([isnanf]) + gl_FLOAT_EXPONENT_LOCATION + fi +]) + +dnl Test whether isnanf() can be used without libm. +AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM], +[ + AC_CACHE_CHECK([whether isnan(float) can be used without linking with libm], + [gl_cv_func_isnanf_no_libm], + [ + AC_TRY_LINK([#include + #ifdef isnan + # undef isnanf + # define isnanf(x) isnan ((float)(x)) + #endif + float x;], + [return isnanf (x);], + [gl_cv_func_isnanf_no_libm=yes], + [gl_cv_func_isnanf_no_libm=no]) + ]) +]) + +dnl Test whether isnanf() recognizes a NaN (this fails on IRIX 6.5) and rejects +dnl Infinity (this fails on Solaris 2.5.1). +AC_DEFUN([gl_ISNANF_WORKS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether isnan(float) works], [gl_cv_func_isnanf_works], + [ + AC_TRY_RUN([ +#include +#ifdef isnan +# undef isnanf +# define isnanf(x) isnan ((float)(x)) +#endif +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static float +NaN () +{ + static float zero = 0.0f; + return zero / zero; +} +#else +# define NaN() (0.0f / 0.0f) +#endif +int main() +{ + if (!isnanf (NaN ())) + return 1; + if (isnanf (1.0f / 0.0f)) + return 1; + return 0; +}], [gl_cv_func_isnanf_works=yes], [gl_cv_func_isnanf_works=no], + [case "$host_os" in + irix* | solaris*) gl_cv_func_isnanf_works="guessing no";; + *) gl_cv_func_isnanf_works="guessing yes";; + esac + ]) + ]) +]) + +AC_DEFUN([gl_FLOAT_EXPONENT_LOCATION], +[ + AC_CACHE_CHECK([where to find the exponent in a 'float'], + [gl_cv_cc_float_expbit0], + [ + AC_TRY_RUN([ +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } memory_float; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (float x) +{ + memory_float m; + size_t i; + /* Clear it first, in case + sizeof (float) < sizeof (memory_float). */ + memset (&m, 0, sizeof (memory_float)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25f); + add_to_ored_words (0.5f); + add_to_ored_words (1.0f); + add_to_ored_words (2.0f); + add_to_ored_words (4.0f); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + ], + [gl_cv_cc_float_expbit0=`cat conftest.out`], + [gl_cv_cc_float_expbit0="unknown"], + [gl_cv_cc_float_expbit0="word 0 bit 23"]) + rm -f conftest.out + ]) + case "$gl_cv_cc_float_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` + AC_DEFINE_UNQUOTED([FLT_EXPBIT0_WORD], [$word], + [Define as the word index where to find the exponent of 'float'.]) + AC_DEFINE_UNQUOTED([FLT_EXPBIT0_BIT], [$bit], + [Define as the bit index in the word where to find bit 0 of the exponent of 'float'.]) + ;; + esac +]) diff -ruNp m4-1.4.9/m4/isnanl.m4 m4-1.4.10/m4/isnanl.m4 --- m4-1.4.9/m4/isnanl.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/isnanl.m4 2007-07-05 05:48:40.000000000 -0600 @@ -0,0 +1,308 @@ +# isnanl.m4 serial 5 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_ISNANL], +[ + ISNANL_LIBM= + gl_HAVE_ISNANL_NO_LIBM + if test $gl_cv_func_isnanl_no_libm = no; then + gl_HAVE_ISNANL_IN_LIBM + if test $gl_cv_func_isnanl_in_libm = yes; then + ISNANL_LIBM=-lm + fi + fi + if test $gl_cv_func_isnanl_no_libm = yes \ + || test $gl_cv_func_isnanl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $ISNANL_LIBM" + gl_FUNC_ISNANL_WORKS + LIBS="$save_LIBS" + case "$gl_cv_func_isnanl_works" in + *yes) gl_func_isnanl=yes ;; + *) gl_func_isnanl=no; ISNANL_LIBM= ;; + esac + else + gl_func_isnanl=no + fi + if test $gl_func_isnanl = yes; then + AC_DEFINE([HAVE_ISNANL], 1, + [Define if the isnan(long double) function is available.]) + else + AC_LIBOBJ([isnanl]) + gl_LONG_DOUBLE_EXPONENT_LOCATION + fi + AC_SUBST([ISNANL_LIBM]) +]) + +AC_DEFUN([gl_FUNC_ISNANL_NO_LIBM], +[ + gl_HAVE_ISNANL_NO_LIBM + gl_func_isnanl_no_libm=$gl_cv_func_isnanl_no_libm + if test $gl_func_isnanl_no_libm = yes; then + gl_FUNC_ISNANL_WORKS + case "$gl_cv_func_isnanl_works" in + *yes) ;; + *) gl_func_isnanl_no_libm=no ;; + esac + fi + if test $gl_func_isnanl_no_libm = yes; then + AC_DEFINE([HAVE_ISNANL_IN_LIBC], 1, + [Define if the isnan(long double) function is available in libc.]) + else + AC_LIBOBJ([isnanl]) + gl_LONG_DOUBLE_EXPONENT_LOCATION + fi +]) + +dnl Test whether isnanl() can be used without libm. +AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM], +[ + AC_CACHE_CHECK([whether isnan(long double) can be used without linking with libm], + [gl_cv_func_isnanl_no_libm], + [ + AC_TRY_LINK([#include + #ifdef isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x;], + [return isnanl (x);], + [gl_cv_func_isnanl_no_libm=yes], + [gl_cv_func_isnanl_no_libm=no]) + ]) +]) + +dnl Test whether isnanl() can be used with libm. +AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM], +[ + AC_CACHE_CHECK([whether isnan(long double) can be used with libm], + [gl_cv_func_isnanl_in_libm], + [ + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([#include + #ifdef isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x;], + [return isnanl (x);], + [gl_cv_func_isnanl_in_libm=yes], + [gl_cv_func_isnanl_in_libm=no]) + LIBS="$save_LIBS" + ]) +]) + +dnl Test whether isnanl() recognizes all numbers which are neither finite nor +dnl infinite. This test fails e.g. on NetBSD/i386 and on glibc/ia64. +AC_DEFUN([gl_FUNC_ISNANL_WORKS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_C_BIGENDIAN]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether isnanl works], [gl_cv_func_isnanl_works], + [ + AC_TRY_RUN([ +#include +#include +#include +#ifdef isnan +# undef isnanl +# define isnanl(x) isnan ((long double)(x)) +#endif +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { unsigned int word[NWORDS]; long double value; } + memory_long_double; +int main () +{ + memory_long_double m; + unsigned int i; + + /* The isnanl function should be immune against changes in the sign bit and + in the mantissa bits. The xor operation twiddles a bit that can only be + a sign bit or a mantissa bit (since the exponent never extends to + bit 31). */ + m.value = 0.0L / 0.0L; + m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); + for (i = 0; i < NWORDS; i++) + m.word[i] |= 1; + if (!isnanl (m.value)) + return 1; + +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { + /* Signalling NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in + Intel IA-64 Architecture Software Developer's Manual, Volume 1: + Application Architecture. + Table 5-2 "Floating-Point Register Encodings" + Figure 5-6 "Memory to Floating-Point Register Data Translation" + */ + { /* Pseudo-NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Infinity. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Zero. */ + static memory_long_double x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Unnormalized number. */ + static memory_long_double x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } + { /* Pseudo-Denormal. */ + static memory_long_double x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (!isnanl (x.value)) + return 1; + } +#endif + + return 0; +}], [gl_cv_func_isnanl_works=yes], [gl_cv_func_isnanl_works=no], + [case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_isnanl_works="guessing no";; + *) + case "$host_os" in + netbsd*) gl_cv_func_isnanl_works="guessing no";; + *) gl_cv_func_isnanl_works="guessing yes";; + esac + ;; + esac + ]) + ]) +]) + +AC_DEFUN([gl_LONG_DOUBLE_EXPONENT_LOCATION], +[ + AC_REQUIRE([AC_C_BIGENDIAN]) + AC_CACHE_CHECK([where to find the exponent in a 'long double'], + [gl_cv_cc_long_double_expbit0], + [ + AC_TRY_RUN([ +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { long double value; unsigned int word[NWORDS]; } + memory_long_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (long double x) +{ + memory_long_double m; + size_t i; + /* Clear it first, in case + sizeof (long double) < sizeof (memory_long_double). */ + memset (&m, 0, sizeof (memory_long_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25L); + add_to_ored_words (0.5L); + add_to_ored_words (1.0L); + add_to_ored_words (2.0L); + add_to_ored_words (4.0L); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + ], + [gl_cv_cc_long_double_expbit0=`cat conftest.out`], + [gl_cv_cc_long_double_expbit0="unknown"], + [ + dnl When cross-compiling, we don't know. It depends on the + dnl ABI and compiler version. There are too many cases. + gl_cv_cc_long_double_expbit0="unknown" + ]) + rm -f conftest.out + ]) + case "$gl_cv_cc_long_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_long_double_expbit0" | sed -e 's/word.*bit //'` + AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_WORD], [$word], + [Define as the word index where to find the exponent of 'long double'.]) + AC_DEFINE_UNQUOTED([LDBL_EXPBIT0_BIT], [$bit], + [Define as the bit index in the word where to find bit 0 of the exponent of 'long double'.]) + ;; + esac +]) diff -ruNp m4-1.4.9/m4/ldexpl.m4 m4-1.4.10/m4/ldexpl.m4 --- m4-1.4.9/m4/ldexpl.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/ldexpl.m4 2007-05-30 19:30:54.000000000 -0600 @@ -0,0 +1,85 @@ +# ldexpl.m4 serial 2 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_LDEXPL], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + LDEXPL_LIBM= + AC_CACHE_CHECK([whether ldexpl() can be used without linking with libm], + [gl_cv_func_ldexpl_no_libm], + [ + AC_TRY_LINK([#include + long double x;], + [return ldexpl (x, -1) > 0;], + [gl_cv_func_ldexpl_no_libm=yes], + [gl_cv_func_ldexpl_no_libm=no]) + ]) + if test $gl_cv_func_ldexpl_no_libm = no; then + AC_CACHE_CHECK([whether ldexpl() can be used with libm], + [gl_cv_func_ldexpl_in_libm], + [ + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([#include + long double x;], + [return ldexpl (x, -1) > 0;], + [gl_cv_func_ldexpl_in_libm=yes], + [gl_cv_func_ldexpl_in_libm=no]) + LIBS="$save_LIBS" + ]) + if test $gl_cv_func_ldexpl_in_libm = yes; then + LDEXPL_LIBM=-lm + fi + fi + if test $gl_cv_func_ldexpl_no_libm = yes \ + || test $gl_cv_func_ldexpl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $LDEXPL_LIBM" + gl_FUNC_LDEXPL_WORKS + LIBS="$save_LIBS" + case "$gl_cv_func_ldexpl_works" in + *yes) gl_func_ldexpl=yes ;; + *) gl_func_ldexpl=no; REPLACE_LDEXPL=1; LDEXPL_LIBM= ;; + esac + else + gl_func_ldexpl=no + fi + if test $gl_func_ldexpl = yes; then + AC_DEFINE([HAVE_LDEXPL], 1, + [Define if the ldexpl() function is available.]) + dnl Also check whether it's declared. + dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in . + AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include ]) + else + HAVE_DECL_LDEXPL=0 + AC_LIBOBJ([ldexpl]) + fi + AC_SUBST([LDEXPL_LIBM]) +]) + +dnl Test whether ldexpl() works on finite numbers (this fails on AIX 5.1). +AC_DEFUN([gl_FUNC_LDEXPL_WORKS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether ldexpl works], [gl_cv_func_ldexpl_works], + [ + AC_TRY_RUN([ +#include +extern long double ldexpl (long double, int); +int main() +{ + volatile long double x = 1.0; + volatile long double y = ldexpl (x, -1); + return (y != 0.5L); +}], [gl_cv_func_ldexpl_works=yes], [gl_cv_func_ldexpl_works=no], + [case "$host_os" in + aix*) gl_cv_func_ldexpl_works="guessing no";; + *) gl_cv_func_ldexpl_works="guessing yes";; + esac + ]) + ]) +]) diff -ruNp m4-1.4.9/m4/longdouble.m4 m4-1.4.10/m4/longdouble.m4 --- m4-1.4.9/m4/longdouble.m4 2007-03-23 07:14:37.000000000 -0600 +++ m4-1.4.10/m4/longdouble.m4 1969-12-31 17:00:00.000000000 -0700 @@ -1,31 +0,0 @@ -# longdouble.m4 serial 2 (gettext-0.15) -dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. -dnl Test whether the compiler supports the 'long double' type. -dnl Prerequisite: AC_PROG_CC - -dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf -dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics. - -AC_DEFUN([gt_TYPE_LONGDOUBLE], -[ - AC_CACHE_CHECK([for long double], gt_cv_c_long_double, - [if test "$GCC" = yes; then - gt_cv_c_long_double=yes - else - AC_TRY_COMPILE([ - /* The Stardent Vistra knows sizeof(long double), but does not support it. */ - long double foo = 0.0; - /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ - int array [2*(sizeof(long double) >= sizeof(double)) - 1]; - ], , - gt_cv_c_long_double=yes, gt_cv_c_long_double=no) - fi]) - if test $gt_cv_c_long_double = yes; then - AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) - fi -]) diff -ruNp m4-1.4.9/m4/lseek.m4 m4-1.4.10/m4/lseek.m4 --- m4-1.4.9/m4/lseek.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/lseek.m4 2007-07-05 05:48:41.000000000 -0600 @@ -0,0 +1,50 @@ +# lseek.m4 serial 3 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_LSEEK], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], + [if test $cross_compiling = no; then + AC_LINK_IFELSE([ +#include /* for off_t */ +#include /* for SEEK_CUR */ +#include +int main () +{ + /* Exit with success only if stdin is seekable. */ + return lseek (0, (off_t)0, SEEK_CUR) < 0; +}], + [if test -s conftest$ac_exeext \ + && ./conftest$ac_exeext < conftest.$ac_ext \ + && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then + gl_cv_func_lseek_pipe=yes + else + gl_cv_func_lseek_pipe=no + fi], + [gl_cv_func_lseek_pipe=no]) + else + AC_COMPILE_IFELSE([ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* mingw mistakenly returns 0 when trying to seek on pipes. */ + Choke me. +#endif], + [gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no]) + fi]) + if test $gl_cv_func_lseek_pipe = no; then + gl_REPLACE_LSEEK + fi +]) + +AC_DEFUN([gl_REPLACE_LSEEK], +[ + AC_LIBOBJ([lseek]) + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + REPLACE_LSEEK=1 + AC_DEFINE([LSEEK_PIPE_BROKEN], [1], + [Define to 1 if lseek does not detect pipes.]) +]) diff -ruNp m4-1.4.9/m4/malloca.m4 m4-1.4.10/m4/malloca.m4 --- m4-1.4.9/m4/malloca.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/malloca.m4 2007-07-04 22:02:41.000000000 -0600 @@ -0,0 +1,14 @@ +# malloca.m4 serial 1 +dnl Copyright (C) 2003-2004, 2006-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MALLOCA], +[ + dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables + dnl @ALLOCA@ and @LTALLOCA@. + dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. + AC_REQUIRE([gl_EEMALLOC]) + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) +]) diff -ruNp m4-1.4.9/m4/math_h.m4 m4-1.4.10/m4/math_h.m4 --- m4-1.4.9/m4/math_h.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/math_h.m4 2007-07-05 05:48:41.000000000 -0600 @@ -0,0 +1,45 @@ +# math_h.m4 serial 5 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MATH_H], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([math.h]) +]) + +AC_DEFUN([gl_MATH_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_MATH_H_DEFAULTS], +[ + GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) + GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) + GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) + GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL]) + GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) + HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) + HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) + HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) + HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) + HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) + HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) + HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) + HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) + HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) + HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) + HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) + HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) + REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) + REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) + REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) + REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) +]) diff -ruNp m4-1.4.9/m4/printf-frexp.m4 m4-1.4.10/m4/printf-frexp.m4 --- m4-1.4.9/m4/printf-frexp.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/printf-frexp.m4 2007-05-30 19:30:56.000000000 -0600 @@ -0,0 +1,45 @@ +# printf-frexp.m4 serial 2 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check how to define printf_frexp() without linking with libm. + +AC_DEFUN([gl_FUNC_PRINTF_FREXP], +[ + AC_CACHE_CHECK([whether frexp can be used without linking with libm], + [gl_cv_func_frexp_no_libm], + [ + AC_TRY_LINK([#include + double x; + int y;], + [return frexp (x, &y) < 1;], + [gl_cv_func_frexp_no_libm=yes], + [gl_cv_func_frexp_no_libm=no]) + ]) + if test $gl_cv_func_frexp_no_libm = yes; then + gl_FUNC_FREXP_WORKS + case "$gl_cv_func_frexp_works" in + *yes) + AC_DEFINE([HAVE_FREXP_IN_LIBC], 1, + [Define if the frexp function is available in libc.]) + ;; + esac + fi + + AC_CACHE_CHECK([whether ldexp can be used without linking with libm], + [gl_cv_func_ldexp_no_libm], + [ + AC_TRY_LINK([#include + double x; + int y;], + [return ldexp (x, y) < 1;], + [gl_cv_func_ldexp_no_libm=yes], + [gl_cv_func_ldexp_no_libm=no]) + ]) + if test $gl_cv_func_ldexp_no_libm = yes; then + AC_DEFINE([HAVE_LDEXP_IN_LIBC], 1, + [Define if the ldexp function is available in libc.]) + fi +]) diff -ruNp m4-1.4.9/m4/printf-frexpl.m4 m4-1.4.10/m4/printf-frexpl.m4 --- m4-1.4.9/m4/printf-frexpl.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/printf-frexpl.m4 2007-05-30 19:30:56.000000000 -0600 @@ -0,0 +1,64 @@ +# printf-frexpl.m4 serial 5 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check how to define printf_frexpl() without linking with libm. + +AC_DEFUN([gl_FUNC_PRINTF_FREXPL], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + dnl Subset of gl_FUNC_FREXPL_NO_LIBM. + AC_CACHE_CHECK([whether frexpl can be used without linking with libm], + [gl_cv_func_frexpl_no_libm], + [ + AC_TRY_LINK([#include + long double x; + int y;], + [return frexpl (x, &y) < 1;], + [gl_cv_func_frexpl_no_libm=yes], + [gl_cv_func_frexpl_no_libm=no]) + ]) + if test $gl_cv_func_frexpl_no_libm = yes; then + gl_FUNC_FREXPL_WORKS + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + dnl Set REPLACE_FREXPL here because the system may have frexpl in libm. + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then + AC_DEFINE([HAVE_FREXPL_IN_LIBC], 1, + [Define if the frexpl function is available in libc.]) + dnl Also check whether it's declared. + dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in . + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include ]) + fi + + AC_CACHE_CHECK([whether ldexpl can be used without linking with libm], + [gl_cv_func_ldexpl_no_libm], + [ + AC_TRY_LINK([#include + long double x; + int y;], + [return ldexpl (x, y) < 1;], + [gl_cv_func_ldexpl_no_libm=yes], + [gl_cv_func_ldexpl_no_libm=no]) + ]) + if test $gl_cv_func_ldexpl_no_libm = yes; then + gl_FUNC_LDEXPL_WORKS + case "$gl_cv_func_ldexpl_works" in + *yes) + AC_DEFINE([HAVE_LDEXPL_IN_LIBC], 1, + [Define if the ldexpl function is available in libc.]) + dnl Also check whether it's declared. + dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in . + AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include ]) + ;; + esac + fi +]) diff -ruNp m4-1.4.9/m4/printf.m4 m4-1.4.10/m4/printf.m4 --- m4-1.4.9/m4/printf.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/printf.m4 2007-07-05 05:48:43.000000000 -0600 @@ -0,0 +1,1077 @@ +# printf.m4 serial 15 +dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Test whether the *printf family of functions supports the 'j', 'z', 't', +dnl 'L' size specifiers. (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_printf_sizes_c99. + +AC_DEFUN([gl_PRINTF_SIZES_C99], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_AC_HEADER_STDINT_H]) + AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports size specifiers as in C99], + [gl_cv_func_printf_sizes_c99], + [ + AC_TRY_RUN([ +#include +#include +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +# include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +# include +#endif +static char buf[100]; +int main () +{ +#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX + buf[0] = '\0'; + if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + return 1; +#endif + buf[0] = '\0'; + if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 + || strcmp (buf, "12345672 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 + || strcmp (buf, "12345673 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 + || strcmp (buf, "1.5 33") != 0) + return 1; + return 0; +}], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; + darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_printf_sizes_c99="guessing no";; + openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";; + solaris*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_sizes_c99="guessing no";; + netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_sizes_c99="guessing no";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports 'long double' +dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_printf_long_double. + +AC_DEFUN([gl_PRINTF_LONG_DOUBLE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports 'long double' arguments], + [gl_cv_func_printf_long_double], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + buf[0] = '\0'; + if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000e+00 33") != 0) + return 1; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.75 33") != 0) + return 1; + return 0; +}], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], + [ +changequote(,)dnl + case "$host_os" in + beos*) gl_cv_func_printf_long_double="guessing no";; + mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; + *) gl_cv_func_printf_long_double="guessing yes";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports infinite and NaN +dnl 'double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_printf_infinite. + +AC_DEFUN([gl_PRINTF_INFINITE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports infinite 'double' arguments], + [gl_cv_func_printf_infinite], + [ + AC_TRY_RUN([ +#include +#include +static int +strisnan (const char *string, size_t start_index, size_t end_index) +{ + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static char buf[100]; +static double zero = 0.0; +int main () +{ + if (sprintf (buf, "%f", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%f", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%f", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%e", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%e", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%e", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%g", 1.0 / 0.0) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%g", -1.0 / 0.0) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%g", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + return 0; +}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; + darwin*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; + hpux*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite="guessing no";; + netbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_infinite="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_infinite="guessing no";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports infinite and NaN +dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_printf_infinite_long_double. + +AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], +[ + AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_C_BIGENDIAN]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + dnl The user can set or unset the variable gl_printf_safe to indicate + dnl that he wishes a safe handling of non-IEEE-754 'long double' values. + if test -n "$gl_printf_safe"; then + AC_DEFINE([CHECK_PRINTF_SAFE], 1, + [Define if you wish *printf() functions that have a safe handling of + non-IEEE-754 'long double' values.]) + fi + case "$gl_cv_func_printf_long_double" in + *yes) + AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments], + [gl_cv_func_printf_infinite_long_double], + [ + AC_TRY_RUN([ +#include +#include +#include +static int +strisnan (const char *string, size_t start_index, size_t end_index) +{ + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static char buf[100]; +static long double zeroL = 0.0L; +int main () +{ + if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Le", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + return 1; + if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + return 1; + if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + return 1; + } +#endif + return 0; +}], + [gl_cv_func_printf_infinite_long_double=yes], + [gl_cv_func_printf_infinite_long_double=no], + [ +changequote(,)dnl + case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; + *) + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";; + darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; + hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite_long_double="guessing no";; + netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_infinite_long_double="guessing no";; + esac + ;; + esac +changequote([,])dnl + ]) + ]) + ;; + *) + gl_cv_func_printf_infinite_long_double="irrelevant" + ;; + esac +]) + +dnl Test whether the *printf family of functions supports the 'a' and 'A' +dnl conversion specifier for hexadecimal output of floating-point numbers. +dnl (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_printf_directive_a. + +AC_DEFUN([gl_PRINTF_DIRECTIVE_A], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives], + [gl_cv_func_printf_directive_a], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.922p+1 33") != 0 + && strcmp (buf, "0x3.244p+0 33") != 0 + && strcmp (buf, "0x6.488p-1 33") != 0 + && strcmp (buf, "0xc.91p-2 33") != 0)) + return 1; + if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "-0X1.922P+1 33") != 0 + && strcmp (buf, "-0X3.244P+0 33") != 0 + && strcmp (buf, "-0X6.488P-1 33") != 0 + && strcmp (buf, "-0XC.91P-2 33") != 0)) + return 1; + /* This catches a FreeBSD 6.1 bug: it doesn't round. */ + if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.83p+0 33") != 0 + && strcmp (buf, "0x3.05p-1 33") != 0 + && strcmp (buf, "0x6.0ap-2 33") != 0 + && strcmp (buf, "0xc.14p-3 33") != 0)) + return 1; + /* This catches a FreeBSD 6.1 bug. See + */ + if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0 + || buf[0] == '0') + return 1; + /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */ + if (sprintf (buf, "%.1a", 1.999) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) + return 1; + /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a + glibc 2.4 bug . */ + if (sprintf (buf, "%.1La", 1.999L) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) + return 1; + return 0; +}], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no], + [ + case "$host_os" in + # Guess yes on glibc >= 2.5 systems. + *-gnu*) + AC_EGREP_CPP([BZ2908], [ + #include + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2) + BZ2908 + #endif + #endif + ], + [gl_cv_func_printf_directive_a="guessing yes"], + [gl_cv_func_printf_directive_a="guessing no"]) + ;; + # If we don't know, assume the worst. + *) gl_cv_func_printf_directive_a="guessing no";; + esac + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports the %F format +dnl directive. (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_printf_directive_f. + +AC_DEFUN([gl_PRINTF_DIRECTIVE_F], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the 'F' directive], + [gl_cv_func_printf_directive_f], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 + || strcmp (buf, "1234567.000000 33") != 0) + return 1; + if (sprintf (buf, "%F", 1.0 / 0.0) < 0 + || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) + return 1; + /* This catches a Cygwin 2007 bug. */ + if (sprintf (buf, "%.F", 1234.0) < 0 + || strcmp (buf, "1234") != 0) + return 1; + return 0; +}], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; + darwin*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";; + solaris*) gl_cv_func_printf_directive_f="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_directive_f="guessing no";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports the %n format +dnl directive. (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_printf_directive_n. + +AC_DEFUN([gl_PRINTF_DIRECTIVE_N], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the 'n' directive], + [gl_cv_func_printf_directive_n], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + int count = -1; + if (sprintf (buf, "%d %n", 123, &count, 33, 44, 55) < 0 + || strcmp (buf, "123 ") != 0 + || count != 4) + return 1; + return 0; +}], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no], + [ +changequote(,)dnl + case "$host_os" in + *) gl_cv_func_printf_directive_n="guessing yes";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports POSIX/XSI format +dnl strings with positions. (POSIX:2001) +dnl Result is gl_cv_func_printf_positions. + +AC_DEFUN([gl_PRINTF_POSITIONS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions], + [gl_cv_func_printf_positions], + [ + AC_TRY_RUN([ +#include +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () +{ + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); +}], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no], + [ +changequote(,)dnl + case "$host_os" in + netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) + gl_cv_func_printf_positions="guessing no";; + beos*) gl_cv_func_printf_positions="guessing no";; + mingw* | pw*) gl_cv_func_printf_positions="guessing no";; + *) gl_cv_func_printf_positions="guessing yes";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports POSIX/XSI format +dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001) +dnl Result is gl_cv_func_printf_flag_grouping. + +AC_DEFUN([gl_PRINTF_FLAG_GROUPING], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the grouping flag], + [gl_cv_func_printf_flag_grouping], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + if (sprintf (buf, "%'d %d", 1234567, 99) < 0 + || buf[strlen (buf) - 1] != '9') + return 1; + return 0; +}], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no], + [ +changequote(,)dnl + case "$host_os" in + cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; + netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; + mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; + *) gl_cv_func_printf_flag_grouping="guessing yes";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports padding of non-finite +dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See +dnl +dnl Result is gl_cv_func_printf_flag_zero. + +AC_DEFUN([gl_PRINTF_FLAG_ZERO], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the zero flag correctly], + [gl_cv_func_printf_flag_zero], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0 + || (strcmp (buf, " inf") != 0 + && strcmp (buf, " infinity") != 0)) + return 1; + return 0; +}], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_flag_zero="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_printf_flag_zero="guessing no";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001) +dnl Result is ac_cv_func_snprintf. + +AC_DEFUN([gl_SNPRINTF_PRESENCE], +[ + AC_CHECK_FUNCS_ONCE([snprintf]) +]) + +dnl Test whether the string produced by the snprintf function is always NUL +dnl terminated. (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_snprintf_truncation_c99. + +AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether snprintf truncates the result as in C99], + [gl_cv_func_snprintf_truncation_c99], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + strcpy (buf, "ABCDEF"); + snprintf (buf, 3, "%d %d", 4567, 89); + if (memcmp (buf, "45\0DEF", 6) != 0) + return 1; + return 0; +}], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; + darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_snprintf_truncation_c99="guessing no";; + openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; + hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on OSF/1 >= 5. + osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; + osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_truncation_c99="guessing no";; + netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_snprintf_truncation_c99="guessing no";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the return value of the snprintf function is the number +dnl of bytes (excluding the terminating NUL) that would have been produced +dnl if the buffer had been large enough. (ISO C99, POSIX:2001) +dnl For example, this test program fails on IRIX 6.5: +dnl --------------------------------------------------------------------- +dnl #include +dnl int main() +dnl { +dnl static char buf[8]; +dnl int retval = snprintf (buf, 3, "%d", 12345); +dnl return retval >= 0 && retval < 3; +dnl } +dnl --------------------------------------------------------------------- +dnl Result is gl_cv_func_snprintf_retval_c99. + +AC_DEFUN([gl_SNPRINTF_RETVAL_C99], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether snprintf returns a byte count as in C99], + [gl_cv_func_snprintf_retval_c99], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + strcpy (buf, "ABCDEF"); + if (snprintf (buf, 3, "%d %d", 4567, 89) != 7) + return 1; + return 0; +}], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; + darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_snprintf_retval_c99="guessing no";; + openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";; + solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; + aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_retval_c99="guessing no";; + netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_snprintf_retval_c99="guessing no";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the snprintf function supports the %n format directive +dnl also in truncated portions of the format string. (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_snprintf_directive_n. + +AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive], + [gl_cv_func_snprintf_directive_n], + [ + AC_TRY_RUN([ +#include +#include +static char buf[100]; +int main () +{ + int count = -1; + snprintf (buf, 4, "%d %n", 12345, &count, 33, 44, 55); + if (count != 6) + return 1; + return 0; +}], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; + darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";; + solaris*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; + aix*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on OSF/1 >= 5. + osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";; + osf*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_directive_n="guessing no";; + netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_directive_n="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_snprintf_directive_n="guessing no";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the vsnprintf function, when passed a zero size, produces no +dnl output. (ISO C99, POSIX:2001) +dnl For example, snprintf nevertheless writes a NUL byte in this case +dnl on OSF/1 5.1: +dnl --------------------------------------------------------------------- +dnl #include +dnl int main() +dnl { +dnl static char buf[8] = "DEADBEEF"; +dnl snprintf (buf, 0, "%d", 12345); +dnl return buf[0] != 'D'; +dnl } +dnl --------------------------------------------------------------------- +dnl And vsnprintf writes any output without bounds in this case, behaving like +dnl vsprintf, on HP-UX 11 and OSF/1 5.1: +dnl --------------------------------------------------------------------- +dnl #include +dnl #include +dnl static int my_snprintf (char *buf, int size, const char *format, ...) +dnl { +dnl va_list args; +dnl int ret; +dnl va_start (args, format); +dnl ret = vsnprintf (buf, size, format, args); +dnl va_end (args); +dnl return ret; +dnl } +dnl int main() +dnl { +dnl static char buf[8] = "DEADBEEF"; +dnl my_snprintf (buf, 0, "%d", 12345); +dnl return buf[0] != 'D'; +dnl } +dnl --------------------------------------------------------------------- +dnl Result is gl_cv_func_vsnprintf_zerosize_c99. + +AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99], + [gl_cv_func_vsnprintf_zerosize_c99], + [ + AC_TRY_RUN([ +#include +#include +static int my_snprintf (char *buf, int size, const char *format, ...) +{ + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; +} +int main() +{ + static char buf[8] = "DEADBEEF"; + my_snprintf (buf, 0, "%d", 12345); + return buf[0] != 'D'; +}], + [gl_cv_func_vsnprintf_zerosize_c99=yes], + [gl_cv_func_vsnprintf_zerosize_c99=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on MacOS X >= 10.3. + darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. + solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on mingw. + mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # If we don't know, assume the worst. + *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl The results of these tests on various platforms are: +dnl +dnl 1 = gl_PRINTF_SIZES_C99 +dnl 2 = gl_PRINTF_LONG_DOUBLE +dnl 3 = gl_PRINTF_INFINITE +dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE +dnl 5 = gl_PRINTF_DIRECTIVE_A +dnl 6 = gl_PRINTF_DIRECTIVE_F +dnl 7 = gl_PRINTF_DIRECTIVE_N +dnl 8 = gl_PRINTF_POSITIONS +dnl 9 = gl_PRINTF_FLAG_GROUPING +dnl 10 = gl_PRINTF_FLAG_ZERO +dnl 11 = gl_SNPRINTF_PRESENCE +dnl 12 = gl_SNPRINTF_TRUNCATION_C99 +dnl 13 = gl_SNPRINTF_RETVAL_C99 +dnl 14 = gl_SNPRINTF_DIRECTIVE_N +dnl 15 = gl_VSNPRINTF_ZEROSIZE_C99 +dnl +dnl 1 = checking whether printf supports size specifiers as in C99... +dnl 2 = checking whether printf supports 'long double' arguments... +dnl 3 = checking whether printf supports infinite 'double' arguments... +dnl 4 = checking whether printf supports infinite 'long double' arguments... +dnl 5 = checking whether printf supports the 'a' and 'A' directives... +dnl 6 = checking whether printf supports the 'F' directive... +dnl 7 = checking whether printf supports the 'n' directive... +dnl 8 = checking whether printf supports POSIX/XSI format strings with positions... +dnl 9 = checking whether printf supports the grouping flag... +dnl 10 = checking whether printf supports the zero flag correctly... +dnl 11 = checking for snprintf... +dnl 12 = checking whether snprintf truncates the result as in C99... +dnl 13 = checking whether snprintf returns a byte count as in C99... +dnl 14 = checking whether snprintf fully supports the 'n' directive... +dnl 15 = checking whether vsnprintf respects a zero size as in C99... +dnl +dnl . = yes, # = no. +dnl +dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +dnl glibc 2.5 . . . . . . . . . . . . . . . +dnl glibc 2.3.6 . . . . # . . . . . . . . . . +dnl FreeBSD 5.4, 6.1 . . . . # . . . . # . . . . . +dnl MacOS X 10.3.9 . . . . # . . . . # . . . . . +dnl OpenBSD 3.9, 4.0 . ? ? ? # ? . . ? ? . . . ? ? +dnl Cygwin 2007 (= Cygwin 1.5.24) . . . . # # . . . # . . . . . +dnl Cygwin 2006 (= Cygwin 1.5.19) # . . . # # . . # # . . . . . +dnl Solaris 10 . . # # # . . . . # . . . . . +dnl Solaris 2.6 ... 9 # . # # # # . . . # . . . . . +dnl Solaris 2.5.1 # . # # # # . . . # # # # # # +dnl AIX 5.2 . . # # # . . . . # . . . . . +dnl AIX 4.3.2, 5.1 # . # # # # . . . # . . . . . +dnl HP-UX 11.31 . . . . # . . . . # . . # # . +dnl HP-UX 10.20, 11.{00,11,23} # . . . # # . . . # . . # # # +dnl IRIX 6.5 # . # # # # . . . # . . # . . +dnl OSF/1 5.1 # . # # # # . . . # . . # . # +dnl OSF/1 4.0d # . # # # # . . . # # # # # # +dnl NetBSD 4.0 . ? ? ? ? ? . . ? ? . . . ? ? +dnl NetBSD 3.0 . . . . # # . # # # . . . . . +dnl BeOS # # . # # # . # . . . . . . . +dnl mingw # # # # # # . # # # . # # # . diff -ruNp m4-1.4.9/m4/regex.m4 m4-1.4.10/m4/regex.m4 --- m4-1.4.9/m4/regex.m4 2007-03-23 07:14:38.000000000 -0600 +++ m4-1.4.10/m4/regex.m4 2007-07-05 05:48:43.000000000 -0600 @@ -1,4 +1,4 @@ -#serial 46 +#serial 47 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007 Free Software Foundation, Inc. @@ -137,6 +137,17 @@ AC_DEFUN([gl_REGEX], if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) return 1; + /* Catch a bug reported by Vin Shelton in + http://lists.gnu.org/archive/html/bug-coreutils/2007-06/msg00089.html + */ + re_set_syntax (RE_SYNTAX_POSIX_BASIC + & ~RE_CONTEXT_INVALID_DUP + & ~RE_NO_EMPTY_RANGES); + memset (®ex, 0, sizeof regex); + s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); + if (s) + return 1; + /* REG_STARTEND was added to glibc on 2004-01-15. Reject older versions. */ if (! REG_STARTEND) @@ -206,6 +217,6 @@ AC_DEFUN([gl_PREREQ_REGEX], [ AC_REQUIRE([AC_GNU_SOURCE]) AC_REQUIRE([AC_C_RESTRICT]) - AC_CHECK_FUNCS_ONCE([iswctype mbrtowc wcrtomb wcscoll]) + AC_CHECK_FUNCS_ONCE([isblank iswctype mbrtowc wcrtomb wcscoll]) AC_CHECK_DECLS([isblank], [], [], [#include ]) ]) diff -ruNp m4-1.4.9/m4/signal_h.m4 m4-1.4.10/m4/signal_h.m4 --- m4-1.4.9/m4/signal_h.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/signal_h.m4 2007-07-05 05:48:44.000000000 -0600 @@ -0,0 +1,26 @@ +# signal_h.m4 serial 3 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SIGNAL_H], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([signal.h]) +]) + +AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_SIGNAL_H_DEFAULTS], +[ + GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) + HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) +]) diff -ruNp m4-1.4.9/m4/signalblocking.m4 m4-1.4.10/m4/signalblocking.m4 --- m4-1.4.9/m4/signalblocking.m4 2007-03-23 07:14:38.000000000 -0600 +++ m4-1.4.10/m4/signalblocking.m4 2007-05-30 19:30:58.000000000 -0600 @@ -1,5 +1,5 @@ -# signalblocking.m4 serial 4 -dnl Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. +# signalblocking.m4 serial 5 +dnl Copyright (C) 2001-2002, 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,30 +11,33 @@ dnl with or without modifications, as lo # For simplicity, here we check only for the POSIX signal blocking. AC_DEFUN([gl_SIGNALBLOCKING], [ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) signals_not_posix= AC_EGREP_HEADER(sigset_t, signal.h, , signals_not_posix=1) if test -z "$signals_not_posix"; then AC_CHECK_FUNC(sigprocmask, [gl_cv_func_sigprocmask=1]) fi - if test -n "$gl_cv_func_sigprocmask"; then - AC_DEFINE([HAVE_POSIX_SIGNALBLOCKING], 1, - [Define to 1 if you have the sigset_t type and the sigprocmask function.]) - else + if test -z "$gl_cv_func_sigprocmask"; then + HAVE_POSIX_SIGNALBLOCKING=0 AC_LIBOBJ([sigprocmask]) gl_PREREQ_SIGPROCMASK fi ]) -# Prerequisites of lib/sigprocmask.h and lib/sigprocmask.c. -AC_DEFUN([gl_PREREQ_SIGPROCMASK], [ +# Prerequisites of the part of lib/signal_.h and of lib/sigprocmask.c. +AC_DEFUN([gl_PREREQ_SIGPROCMASK], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_CHECK_TYPES([sigset_t], [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no], [#include /* Mingw defines sigset_t not in , but in . */ #include ]) - if test $gl_cv_type_sigset_t = yes; then - AC_DEFINE([HAVE_SIGSET_T], [1], - [Define to 1 if you lack the sigprocmask function but have the sigset_t type.]) + if test $gl_cv_type_sigset_t != yes; then + HAVE_SIGSET_T=0 fi + dnl HAVE_SIGSET_T is 1 if the system lacks the sigprocmask function but has + dnl the sigset_t type. + AC_SUBST([HAVE_SIGSET_T]) AC_CHECK_FUNCS_ONCE(raise) ]) diff -ruNp m4-1.4.9/m4/signbit.m4 m4-1.4.10/m4/signbit.m4 --- m4-1.4.9/m4/signbit.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/signbit.m4 2007-05-30 19:30:58.000000000 -0600 @@ -0,0 +1,224 @@ +# signbit.m4 serial 2 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SIGNBIT], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_CACHE_CHECK([for signbit macro], [gl_cv_func_signbit], + [ + AC_TRY_RUN([ +#include +#include +float p0f = 0.0f; +float m0f = -0.0f; +double p0d = 0.0; +double m0d = -0.0; +long double p0l = 0.0L; +long double m0l = -0.0L; +int main () +{ + { + float plus_inf = 1.0f / p0f; + float minus_inf = -1.0f / p0f; + if (!(!signbit (255.0f) + && signbit (-255.0f) + && !signbit (p0f) + && (memcmp (&m0f, &p0f, sizeof (float)) == 0 || signbit (m0f)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + { + double plus_inf = 1.0 / p0d; + double minus_inf = -1.0 / p0d; + if (!(!signbit (255.0) + && signbit (-255.0) + && !signbit (p0d) + && (memcmp (&m0d, &p0d, sizeof (double)) == 0 || signbit (m0d)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + { + long double plus_inf = 1.0L / p0l; + long double minus_inf = -1.0L / p0l; + if (!(!signbit (255.0L) + && signbit (-255.0L) + && !signbit (p0l) + && (memcmp (&m0l, &p0l, sizeof (long double)) == 0 || signbit (m0l)) + && !signbit (plus_inf) + && signbit (minus_inf))) + return 1; + } + return 0; +}], [gl_cv_func_signbit=yes], [gl_cv_func_signbit=no], + [gl_cv_func_signbit="guessing no"]) + ]) + if test "$gl_cv_func_signbit" != yes; then + REPLACE_SIGNBIT=1 + AC_LIBOBJ([signbitf]) + AC_LIBOBJ([signbitd]) + AC_LIBOBJ([signbitl]) + gl_FLOAT_SIGN_LOCATION + gl_DOUBLE_SIGN_LOCATION + gl_LONG_DOUBLE_SIGN_LOCATION + if test "$gl_cv_cc_float_signbit" = unknown; then + dnl Test whether copysignf() is declared. + AC_CHECK_DECLS([copysignf], , , [#include ]) + if test "$ac_cv_have_decl_copysignf" = yes; then + dnl Test whether copysignf() can be used without libm. + AC_CACHE_CHECK([whether copysignf can be used without linking with libm], + [gl_cv_func_copysignf_no_libm], + [ + AC_TRY_LINK([#include + float x, y;], + [return copysignf (x, y) < 0;], + [gl_cv_func_copysignf_no_libm=yes], + [gl_cv_func_copysignf_no_libm=no]) + ]) + if test $gl_cv_func_copysignf_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], 1, + [Define if the copysignf function is declared in and available in libc.]) + fi + fi + fi + if test "$gl_cv_cc_double_signbit" = unknown; then + dnl Test whether copysign() is declared. + AC_CHECK_DECLS([copysign], , , [#include ]) + if test "$ac_cv_have_decl_copysign" = yes; then + dnl Test whether copysign() can be used without libm. + AC_CACHE_CHECK([whether copysign can be used without linking with libm], + [gl_cv_func_copysign_no_libm], + [ + AC_TRY_LINK([#include + double x, y;], + [return copysign (x, y) < 0;], + [gl_cv_func_copysign_no_libm=yes], + [gl_cv_func_copysign_no_libm=no]) + ]) + if test $gl_cv_func_copysign_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], 1, + [Define if the copysign function is declared in and available in libc.]) + fi + fi + fi + if test "$gl_cv_cc_long_double_signbit" = unknown; then + dnl Test whether copysignl() is declared. + AC_CHECK_DECLS([copysignl], , , [#include ]) + if test "$ac_cv_have_decl_copysignl" = yes; then + dnl Test whether copysignl() can be used without libm. + AC_CACHE_CHECK([whether copysignl can be used without linking with libm], + [gl_cv_func_copysignl_no_libm], + [ + AC_TRY_LINK([#include + long double x, y;], + [return copysignl (x, y) < 0;], + [gl_cv_func_copysignl_no_libm=yes], + [gl_cv_func_copysignl_no_libm=no]) + ]) + if test $gl_cv_func_copysignl_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], 1, + [Define if the copysignl function is declared in and available in libc.]) + fi + fi + fi + fi +]) + +AC_DEFUN([gl_FLOAT_SIGN_LOCATION], +[ + gl_FLOATTYPE_SIGN_LOCATION([float], [gl_cv_cc_float_signbit], [f], [FLT]) +]) + +AC_DEFUN([gl_DOUBLE_SIGN_LOCATION], +[ + gl_FLOATTYPE_SIGN_LOCATION([double], [gl_cv_cc_double_signbit], [], [DBL]) +]) + +AC_DEFUN([gl_LONG_DOUBLE_SIGN_LOCATION], +[ + gl_FLOATTYPE_SIGN_LOCATION([long double], [gl_cv_cc_long_double_signbit], [L], [LDBL]) +]) + +AC_DEFUN([gl_FLOATTYPE_SIGN_LOCATION], +[ + AC_CACHE_CHECK([where to find the sign bit in a '$1'], + [$2], + [ + AC_TRY_RUN([ +#include +#include +#define NWORDS \ + ((sizeof ($1) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { $1 value; unsigned int word[NWORDS]; } + memory_float; +static memory_float plus = { 1.0$3 }; +static memory_float minus = { -1.0$3 }; +int main () +{ + size_t j, k, i; + unsigned int m; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + /* Find the different bit. */ + k = 0; m = 0; + for (j = 0; j < NWORDS; j++) + { + unsigned int x = plus.word[j] ^ minus.word[j]; + if ((x & (x - 1)) || (x && m)) + { + /* More than one bit difference. */ + fprintf (fp, "unknown"); + return 1; + } + if (x) + { + k = j; + m = x; + } + } + if (m == 0) + { + /* No difference. */ + fprintf (fp, "unknown"); + return 1; + } + /* Now m = plus.word[k] ^ ~minus.word[k]. */ + if (plus.word[k] & ~minus.word[k]) + { + /* Oh? The sign bit is set in the positive and cleared in the negative + numbers? */ + fprintf (fp, "unknown"); + return 1; + } + for (i = 0; ; i++) + if ((m >> i) & 1) + break; + fprintf (fp, "word %d bit %d", (int) k, (int) i); + return (fclose (fp) != 0); +} + ], + [$2=`cat conftest.out`], + [$2="unknown"], + [ + dnl When cross-compiling, we don't know. It depends on the + dnl ABI and compiler version. There are too many cases. + $2="unknown" + ]) + rm -f conftest.out + ]) + case "$]$2[" in + word*bit*) + word=`echo "$]$2[" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$]$2[" | sed -e 's/word.*bit //'` + AC_DEFINE_UNQUOTED([$4][_SIGNBIT_WORD], [$word], + [Define as the word index where to find the sign of '$1'.]) + AC_DEFINE_UNQUOTED([$4][_SIGNBIT_BIT], [$bit], + [Define as the bit index in the word where to find the sign of '$1'.]) + ;; + esac +]) diff -ruNp m4-1.4.9/m4/stdint.m4 m4-1.4.10/m4/stdint.m4 --- m4-1.4.9/m4/stdint.m4 2007-03-23 07:14:39.000000000 -0600 +++ m4-1.4.10/m4/stdint.m4 2007-07-05 05:48:46.000000000 -0600 @@ -1,5 +1,5 @@ -# stdint.m4 serial 22 -dnl Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc. +# stdint.m4 serial 27 +dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -45,32 +45,26 @@ AC_DEFUN([gl_STDINT_H], fi AC_SUBST([HAVE_SYS_TYPES_H]) - dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h. + gl_CHECK_NEXT_HEADERS([stdint.h]) if test $ac_cv_header_stdint_h = yes; then - gl_ABSOLUTE_HEADER([stdint.h]) - ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\" HAVE_STDINT_H=1 else - ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\" HAVE_STDINT_H=0 fi - AC_SUBST([ABSOLUTE_STDINT_H]) AC_SUBST([HAVE_STDINT_H]) - dnl Now see whether we need a substitute . Use - dnl ABSOLUTE_STDINT_H, not , so that it also works during - dnl a "config.status --recheck" if a stdint.h has been - dnl created in the build directory. + dnl Now see whether we need a substitute . if test $ac_cv_header_stdint_h = yes; then AC_CACHE_CHECK([whether stdint.h conforms to C99], [gl_cv_header_working_stdint_h], [gl_cv_header_working_stdint_h=no AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#include + AC_LANG_PROGRAM([gl_STDINT_INCLUDES + [ #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ -#include ABSOLUTE_STDINT_H +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include #ifdef INT8_MAX int8_t a1 = INT8_MAX; int8_t a1min = INT8_MIN; @@ -142,12 +136,32 @@ uintptr_t h = UINTPTR_MAX; #endif intmax_t i = INTMAX_MAX; uintmax_t j = UINTMAX_MAX; + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) struct s { - int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1; - int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1; - int check_SIZE: 0 < SIZE_MAX ? 1 : -1; - int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1; - int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1; + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ int check_UINT8_C: @@ -202,6 +216,10 @@ struct s { fi AC_SUBST([HAVE_SYS_BITYPES_H]) + dnl Check for (missing in Linux uClibc when built without wide + dnl character support). + AC_CHECK_HEADERS_ONCE([wchar.h]) + gl_STDINT_TYPE_PROPERTIES STDINT_H=stdint.h fi @@ -337,9 +355,11 @@ AC_DEFUN([gl_STDINT_INCLUDES], included before . */ #include #include - #include - #include - #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif ]]) dnl gl_STDINT_TYPE_PROPERTIES diff -ruNp m4-1.4.9/m4/stdio_h.m4 m4-1.4.10/m4/stdio_h.m4 --- m4-1.4.9/m4/stdio_h.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/stdio_h.m4 2007-07-05 05:48:47.000000000 -0600 @@ -0,0 +1,77 @@ +# stdio_h.m4 serial 7 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STDIO_H], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([stdio.h]) +]) + +AC_DEFUN([gl_STDIO_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_STDIO_H_DEFAULTS], +[ + GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) + GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) + GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) + GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) + GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) + GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) + GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) + GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) + GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) + GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) + GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) + GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) + GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) + GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) + dnl Assume proper GNU behavior unless another module says otherwise. + REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) + REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) + REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) + REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) + REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) + HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) + REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) + HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) + REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) + REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) + HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) + REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) + HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) + REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) + REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) + HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) + REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) + REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) + REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) +]) + +dnl Code shared by fseeko and ftello. Determine if large files are supported, +dnl but stdin does not start as a large file by default. +AC_DEFUN([gl_STDIN_LARGE_OFFSET], + [ + AC_CACHE_CHECK([whether stdin defaults to large file offsets], + [gl_cv_var_stdin_large_offset], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], +[#if defined __SL64 && defined __SCLE /* cygwin */ + /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making + fseeko/ftello needlessly fail. This bug was fixed at the same time + that cygwin started exporting asnprintf (cygwin 1.7.0), so we use + that as a link-time test for cross-compiles rather than building + a runtime test. */ + size_t s; + if (asnprintf (NULL, &s, "")) + return 0; +#endif])], + [gl_cv_var_stdin_large_offset=yes], + [gl_cv_var_stdin_large_offset=no])]) +]) diff -ruNp m4-1.4.9/m4/stdlib_h.m4 m4-1.4.10/m4/stdlib_h.m4 --- m4-1.4.9/m4/stdlib_h.m4 2007-03-23 07:14:40.000000000 -0600 +++ m4-1.4.10/m4/stdlib_h.m4 2007-07-05 05:48:48.000000000 -0600 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 1 +# stdlib_h.m4 serial 2 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,9 +7,7 @@ dnl with or without modifications, as lo AC_DEFUN([gl_STDLIB_H], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - gl_ABSOLUTE_HEADER([stdlib.h]) - ABSOLUTE_STDLIB_H=\"$gl_cv_absolute_stdlib_h\" - AC_SUBST([ABSOLUTE_STDLIB_H]) + gl_CHECK_NEXT_HEADERS([stdlib.h]) ]) AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], diff -ruNp m4-1.4.9/m4/sys_stat_h.m4 m4-1.4.10/m4/sys_stat_h.m4 --- m4-1.4.9/m4/sys_stat_h.m4 2007-03-23 07:14:40.000000000 -0600 +++ m4-1.4.10/m4/sys_stat_h.m4 2007-07-05 05:48:49.000000000 -0600 @@ -1,5 +1,5 @@ -# sys_stat_h.m4 serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006 Free Software Foundation, Inc. +# sys_stat_h.m4 serial 6 -*- Autoconf -*- +dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,6 +12,12 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], dnl Check for lstat. Systems that lack it (mingw) also lack symlinks, so dnl stat is a good replacement. AC_CHECK_FUNCS_ONCE([lstat]) + if test $ac_cv_func_lstat = yes; then + HAVE_LSTAT=1 + else + HAVE_LSTAT=0 + fi + AC_SUBST([HAVE_LSTAT]) dnl Check for mkdir. Mingw has _mkdir(name) in the nonstandard dnl instead. @@ -19,14 +25,24 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], [], [AC_CHECK_HEADERS([io.h])], [#include ]) + if test $ac_cv_have_decl_mkdir = yes; then + HAVE_DECL_MKDIR=1 + else + HAVE_DECL_MKDIR=0 + fi + AC_SUBST([HAVE_DECL_MKDIR]) + if test "$ac_cv_header_io_h" = yes; then + HAVE_IO_H=1 + else + HAVE_IO_H=0 + fi + AC_SUBST([HAVE_IO_H]) AC_REQUIRE([AC_C_INLINE]) dnl Check for broken stat macros. AC_REQUIRE([AC_HEADER_STAT]) - gl_ABSOLUTE_HEADER([sys/stat.h]) - ABSOLUTE_SYS_STAT_H=\"$gl_cv_absolute_sys_stat_h\" - AC_SUBST([ABSOLUTE_SYS_STAT_H]) + gl_CHECK_NEXT_HEADERS([sys/stat.h]) SYS_STAT_H='sys/stat.h' AC_SUBST([SYS_STAT_H]) ]) # gl_HEADER_SYS_STAT_H diff -ruNp m4-1.4.9/m4/sys_time_h.m4 m4-1.4.10/m4/sys_time_h.m4 --- m4-1.4.9/m4/sys_time_h.m4 2007-03-23 07:14:40.000000000 -0600 +++ m4-1.4.10/m4/sys_time_h.m4 2007-07-05 05:48:49.000000000 -0600 @@ -18,17 +18,13 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H], AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) - AC_CHECK_HEADERS_ONCE([sys/time.h]) + gl_CHECK_NEXT_HEADERS([sys/time.h]) if test $ac_cv_header_sys_time_h = yes; then - gl_ABSOLUTE_HEADER([sys/time.h]) - ABSOLUTE_SYS_TIME_H=\"$gl_cv_absolute_sys_time_h\" HAVE_SYS_TIME_H=1 else - ABSOLUTE_SYS_TIME_H=\"no/such/file/sys/time.h\" HAVE_SYS_TIME_H=0 fi - AC_SUBST([ABSOLUTE_SYS_TIME_H]) AC_SUBST([HAVE_SYS_TIME_H]) AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], diff -ruNp m4-1.4.9/m4/unistd_h.m4 m4-1.4.10/m4/unistd_h.m4 --- m4-1.4.9/m4/unistd_h.m4 2007-03-23 07:14:41.000000000 -0600 +++ m4-1.4.10/m4/unistd_h.m4 2007-07-05 05:48:50.000000000 -0600 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 5 +# unistd_h.m4 serial 9 dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,16 +12,15 @@ AC_DEFUN([gl_UNISTD_H], dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + gl_CHECK_NEXT_HEADERS([unistd.h]) + AC_CHECK_HEADERS_ONCE([unistd.h]) if test $ac_cv_header_unistd_h = yes; then HAVE_UNISTD_H=1 - gl_ABSOLUTE_HEADER([unistd.h]) - ABSOLUTE_UNISTD_H=\"$gl_cv_absolute_unistd_h\" else HAVE_UNISTD_H=0 fi AC_SUBST([HAVE_UNISTD_H]) - AC_SUBST([ABSOLUTE_UNISTD_H]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], @@ -39,13 +38,19 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) + GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) + GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) + GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) + HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) + REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) ]) diff -ruNp m4-1.4.9/m4/vasnprintf.m4 m4-1.4.10/m4/vasnprintf.m4 --- m4-1.4.9/m4/vasnprintf.m4 2007-03-23 07:14:41.000000000 -0600 +++ m4-1.4.10/m4/vasnprintf.m4 2007-07-05 05:48:50.000000000 -0600 @@ -1,4 +1,4 @@ -# vasnprintf.m4 serial 9 +# vasnprintf.m4 serial 20 dnl Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,7 +34,6 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) ]) @@ -43,7 +42,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([AC_TYPE_SIZE_T]) @@ -56,10 +54,141 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - AC_REQUIRE([gt_TYPE_LONGDOUBLE]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_CHECK_FUNCS(snprintf wcslen) + dnl Use the _snprintf function only if it is declared (because on NetBSD it + dnl is defined as a weak alias of snprintf; we prefer to use the latter). + AC_CHECK_DECLS([_snprintf], , , [#include ]) +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting 'long double' +# arguments. +AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], +[ + AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) + case "$gl_cv_func_printf_long_double" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + 'long double' arguments.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double' +# arguments. +AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE], +[ + AC_REQUIRE([gl_PRINTF_INFINITE]) + case "$gl_cv_func_printf_infinite" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + infinite 'double' arguments.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double' +# arguments. +AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE], +[ + AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) + dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if + dnl NEED_PRINTF_LONG_DOUBLE is already set. + AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE]) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1, + [Define if the vasnprintf implementation needs special code for + infinite 'long double' arguments.]) + ;; + esac + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive. +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], +[ + AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) + case "$gl_cv_func_printf_directive_a" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1, + [Define if the vasnprintf implementation needs special code for + the 'a' and 'A' directives.]) + AC_CHECK_FUNCS([nl_langinfo]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive. +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], +[ + AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) + case "$gl_cv_func_printf_directive_f" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1, + [Define if the vasnprintf implementation needs special code for + the 'F' directive.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], +[ + AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1, + [Define if the vasnprintf implementation needs special code for the + ' flag.]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], +[ + AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) + case "$gl_cv_func_printf_flag_zero" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1, + [Define if the vasnprintf implementation needs special code for the + 0 flag.]) + ;; + esac +]) + +# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. +AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], +[ + AC_REQUIRE([gl_PREREQ_VASNPRINTF]) + gl_PREREQ_VASNPRINTF_LONG_DOUBLE + gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE + gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE + gl_PREREQ_VASNPRINTF_DIRECTIVE_A + gl_PREREQ_VASNPRINTF_DIRECTIVE_F + gl_PREREQ_VASNPRINTF_FLAG_GROUPING + gl_PREREQ_VASNPRINTF_FLAG_ZERO ]) # Prerequisites of lib/asnprintf.c. diff -ruNp m4-1.4.9/m4/vasprintf-posix.m4 m4-1.4.10/m4/vasprintf-posix.m4 --- m4-1.4.9/m4/vasprintf-posix.m4 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/m4/vasprintf-posix.m4 2007-05-30 19:31:02.000000000 -0600 @@ -0,0 +1,78 @@ +# vasprintf-posix.m4 serial 8 +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_VASPRINTF_POSIX], +[ + AC_REQUIRE([gl_EOVERFLOW]) + AC_REQUIRE([gl_PRINTF_SIZES_C99]) + AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) + AC_REQUIRE([gl_PRINTF_INFINITE]) + AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) + AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) + AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) + AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) + AC_REQUIRE([gl_PRINTF_POSITIONS]) + AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) + AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) + gl_cv_func_vasprintf_posix=no + AC_CHECK_FUNCS([vasprintf]) + case "$gl_cv_func_printf_sizes_c99" in + *yes) + case "$gl_cv_func_printf_long_double" in + *yes) + case "$gl_cv_func_printf_infinite" in + *yes) + case "$gl_cv_func_printf_infinite_long_double" in + *yes) + case "$gl_cv_func_printf_directive_a" in + *yes) + case "$gl_cv_func_printf_directive_f" in + *yes) + case "$gl_cv_func_printf_directive_n" in + *yes) + case "$gl_cv_func_printf_positions" in + *yes) + case "$gl_cv_func_printf_flag_grouping" in + *yes) + case "$gl_cv_func_printf_flag_zero" in + *yes) + if test $ac_cv_func_vasprintf = yes; then + # vasprintf exists and is already + # POSIX compliant. + gl_cv_func_vasprintf_posix=yes + fi + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + if test $gl_cv_func_vasprintf_posix = no; then + gl_PREREQ_VASNPRINTF_LONG_DOUBLE + gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE + gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE + gl_PREREQ_VASNPRINTF_DIRECTIVE_A + gl_PREREQ_VASNPRINTF_DIRECTIVE_F + gl_PREREQ_VASNPRINTF_FLAG_GROUPING + gl_PREREQ_VASNPRINTF_FLAG_ZERO + gl_REPLACE_VASNPRINTF + gl_REPLACE_VASPRINTF + fi +]) diff -ruNp m4-1.4.9/m4/vasprintf.m4 m4-1.4.10/m4/vasprintf.m4 --- m4-1.4.9/m4/vasprintf.m4 2007-03-23 07:14:42.000000000 -0600 +++ m4-1.4.10/m4/vasprintf.m4 2007-05-30 19:31:02.000000000 -0600 @@ -1,4 +1,4 @@ -# vasprintf.m4 serial 3 +# vasprintf.m4 serial 5 dnl Copyright (C) 2002-2003, 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -16,16 +16,18 @@ AC_DEFUN([gl_REPLACE_VASPRINTF], [ AC_LIBOBJ([vasprintf]) AC_LIBOBJ([asprintf]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) if test $ac_cv_func_vasprintf = yes; then - AC_DEFINE([REPLACE_VASPRINTF], 1, - [Define if vasprintf exists but is overridden by gnulib.]) + REPLACE_VASPRINTF=1 + else + HAVE_VASPRINTF=0 fi gl_PREREQ_VASPRINTF_H gl_PREREQ_VASPRINTF gl_PREREQ_ASPRINTF ]) -# Prerequisites of lib/vasprintf.h. +# Prerequisites of the vasprintf portion of lib/stdio.h. AC_DEFUN([gl_PREREQ_VASPRINTF_H], [ dnl Persuade glibc to declare asprintf() and vasprintf(). diff -ruNp m4-1.4.9/m4/wchar.m4 m4-1.4.10/m4/wchar.m4 --- m4-1.4.9/m4/wchar.m4 2007-03-23 07:14:42.000000000 -0600 +++ m4-1.4.10/m4/wchar.m4 2007-07-09 21:12:42.000000000 -0600 @@ -7,23 +7,48 @@ dnl with or without modifications, as lo dnl Written by Eric Blake. -# wchar.m4 serial 1 +# wchar.m4 serial 4 AC_DEFUN([gl_WCHAR_H], [ + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_CACHE_CHECK([whether is standalone], [gl_cv_header_wchar_h_standalone], [AC_COMPILE_IFELSE([[#include wchar_t w;]], [gl_cv_header_wchar_h_standalone=yes], [gl_cv_header_wchar_h_standalone=no])]) - if test $gl_cv_header_wchar_h_standalone = yes; then - WCHAR_H= - else - gl_ABSOLUTE_HEADER([wchar.h]) - ABSOLUTE_WCHAR_H=\"$gl_cv_absolute_wchar_h\" + if test $gl_cv_header_wchar_h_standalone != yes; then WCHAR_H=wchar.h fi - AC_SUBST([ABSOLUTE_WCHAR_H]) + + dnl Prepare for creating substitute . + dnl Do it always: WCHAR_H may be empty here but can be set later. + dnl Check for (missing in Linux uClibc when built without wide + dnl character support). + AC_CHECK_HEADERS_ONCE([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) + gl_CHECK_NEXT_HEADERS([wchar.h]) +]) + +AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_WCHAR_H_DEFAULTS], +[ + GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) + REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) + WCHAR_H= AC_SUBST([WCHAR_H]) ]) diff -ruNp m4-1.4.9/m4/wctype.m4 m4-1.4.10/m4/wctype.m4 --- m4-1.4.9/m4/wctype.m4 2007-03-23 07:14:43.000000000 -0600 +++ m4-1.4.10/m4/wctype.m4 2007-07-05 05:48:51.000000000 -0600 @@ -10,6 +10,12 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_WCTYPE_H], [ AC_CHECK_FUNCS_ONCE([iswcntrl]) + if test $ac_cv_func_iswcntrl = yes; then + HAVE_ISWCNTRL=1 + else + HAVE_ISWCNTRL=0 + fi + AC_SUBST([HAVE_ISWCNTRL]) AC_CHECK_HEADERS_ONCE([wctype.h]) AC_REQUIRE([AC_C_INLINE]) @@ -23,19 +29,16 @@ AC_DEFUN([gl_WCTYPE_H], WCTYPE_H=wctype.h if test $ac_cv_header_wctype_h = yes; then - if test "$ac_cv_func_iswcntrl" = yes; then + if test $ac_cv_func_iswcntrl = yes; then WCTYPE_H= fi - dnl Compute ABSOLUTE_WCTYPE_H even if WCTYPE_H is empty, + dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, dnl for the benefit of builds from non-distclean directories. - gl_ABSOLUTE_HEADER([wctype.h]) - ABSOLUTE_WCTYPE_H=\"$gl_cv_absolute_wctype_h\" + gl_CHECK_NEXT_HEADERS([wctype.h]) HAVE_WCTYPE_H=1 else - ABSOLUTE_WCTYPE_H=\"no/such/file/wctype.h\" HAVE_WCTYPE_H=0 fi - AC_SUBST([ABSOLUTE_WCTYPE_H]) AC_SUBST([HAVE_WCTYPE_H]) AC_SUBST([WCTYPE_H]) ]) diff -ruNp m4-1.4.9/m4/wint_t.m4 m4-1.4.10/m4/wint_t.m4 --- m4-1.4.9/m4/wint_t.m4 2007-03-23 07:14:43.000000000 -0600 +++ m4-1.4.10/m4/wint_t.m4 2007-05-30 19:31:03.000000000 -0600 @@ -1,4 +1,4 @@ -# wint_t.m4 serial 2 (gettext-0.12) +# wint_t.m4 serial 2 (gettext-0.16.2) dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff -ruNp m4-1.4.9/missing m4-1.4.10/missing --- m4-1.4.9/missing 2007-03-23 06:54:08.000000000 -0600 +++ m4-1.4.10/missing 2007-07-09 21:15:36.000000000 -0600 @@ -9,7 +9,7 @@ scriptversion=2006-05-10.23 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) +# the Free Software Foundation; either version 3, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, diff -ruNp m4-1.4.9/src/Makefile.am m4-1.4.10/src/Makefile.am --- m4-1.4.9/src/Makefile.am 2006-10-17 10:13:03.000000000 -0600 +++ m4-1.4.10/src/Makefile.am 2007-07-04 21:56:05.000000000 -0600 @@ -1,10 +1,10 @@ ## This file is part of GNU M4. ## -## Copyright (C) 2006 Free Software Foundation, Inc. +## Copyright (C) 2006, 2007 Free Software Foundation, Inc. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or +## 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, diff -ruNp m4-1.4.9/src/Makefile.in m4-1.4.10/src/Makefile.in --- m4-1.4.9/src/Makefile.in 2007-03-23 07:32:35.000000000 -0600 +++ m4-1.4.10/src/Makefile.in 2007-07-09 21:15:33.000000000 -0600 @@ -37,36 +37,48 @@ bin_PROGRAMS = m4$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ - $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \ - $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/close-stream.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/closein.m4 \ $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.m4 \ $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fpending.m4 \ - $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/getopt.m4 \ - $(top_srcdir)/m4/gettimeofday.m4 $(top_srcdir)/m4/gl_list.m4 \ - $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/inline.m4 \ + $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ + $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ + $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ + $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/localcharset.m4 \ - $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \ - $(top_srcdir)/m4/mkdtemp.m4 $(top_srcdir)/m4/mkstemp.m4 \ - $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/quotearg.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sig_atomic_t.m4 \ - $(top_srcdir)/m4/signalblocking.m4 \ + $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ + $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/printf-frexp.m4 \ + $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ + $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ + $(top_srcdir)/m4/sig_atomic_t.m4 $(top_srcdir)/m4/signal_h.m4 \ + $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/signbit.m4 \ $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/vasprintf-posix.m4 \ $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ @@ -102,13 +114,6 @@ DIST_SOURCES = $(am__m4_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@ -ABSOLUTE_STDLIB_H = @ABSOLUTE_STDLIB_H@ -ABSOLUTE_SYS_STAT_H = @ABSOLUTE_SYS_STAT_H@ -ABSOLUTE_SYS_TIME_H = @ABSOLUTE_SYS_TIME_H@ -ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@ -ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@ -ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALLOCA_H = @ALLOCA_H@ @@ -136,30 +141,80 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EOVERFLOW = @EOVERFLOW@ EXEEXT = @EXEEXT@ +FLOAT_H = @FLOAT_H@ GETOPT_H = @GETOPT_H@ GLIBC21 = @GLIBC21@ GNULIB_CHOWN = @GNULIB_CHOWN@ GNULIB_DUP2 = @GNULIB_DUP2@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREXP = @GNULIB_FREXP@ +GNULIB_FREXPL = @GNULIB_FREXPL@ +GNULIB_FSEEK = @GNULIB_FSEEK@ +GNULIB_FSEEKO = @GNULIB_FSEEKO@ +GNULIB_FTELL = @GNULIB_FTELL@ +GNULIB_FTELLO = @GNULIB_FTELLO@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LDEXPL = @GNULIB_LDEXPL@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MATHL = @GNULIB_MATHL@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ +GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ +GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ +GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ +GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ +GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ GREP = @GREP@ +HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ +HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ +HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ +HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ +HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ +HAVE_DECL_SINL = @HAVE_DECL_SINL@ +HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ +HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ HAVE_DUP2 = @HAVE_DUP2@ +HAVE_FSEEKO = @HAVE_FSEEKO@ +HAVE_FTELLO = @HAVE_FTELLO@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_IO_H = @HAVE_IO_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ HAVE_READLINK = @HAVE_READLINK@ HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SIGSET_T = @HAVE_SIGSET_T@ +HAVE_SLEEP = @HAVE_SLEEP@ HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ @@ -168,24 +223,40 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_VASPRINTF = @HAVE_VASPRINTF@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ HAVE_WINT_T = @HAVE_WINT_T@ HAVE__BOOL = @HAVE__BOOL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M4_LIBOBJS = @M4_LIBOBJS@ M4_LTLIBOBJS = @M4_LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ +NEXT_FLOAT_H = @NEXT_FLOAT_H@ +NEXT_MATH_H = @NEXT_MATH_H@ +NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDIO_H = @NEXT_STDIO_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -198,9 +269,30 @@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ REPLACE_CHOWN = @REPLACE_CHOWN@ REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREXP = @REPLACE_FREXP@ +REPLACE_FREXPL = @REPLACE_FREXPL@ +REPLACE_FSEEK = @REPLACE_FSEEK@ +REPLACE_FSEEKO = @REPLACE_FSEEKO@ +REPLACE_FTELL = @REPLACE_FTELL@ +REPLACE_FTELLO = @REPLACE_FTELLO@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LSEEK = @REPLACE_LSEEK@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ +REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ +REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ +REPLACE_VPRINTF = @REPLACE_VPRINTF@ +REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ +REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ diff -ruNp m4-1.4.9/src/builtin.c m4-1.4.10/src/builtin.c --- m4-1.4.9/src/builtin.c 2007-02-28 06:48:19.000000000 -0700 +++ m4-1.4.10/src/builtin.c 2007-07-04 21:56:05.000000000 -0600 @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, diff -ruNp m4-1.4.9/src/debug.c m4-1.4.10/src/debug.c --- m4-1.4.9/src/debug.c 2006-11-01 16:29:08.000000000 -0600 +++ m4-1.4.10/src/debug.c 2007-07-04 21:56:05.000000000 -0600 @@ -1,11 +1,11 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1991, 1992, 1993, 1994, 2004, 2006 Free Software + Copyright (C) 1991, 1992, 1993, 1994, 2004, 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -179,23 +179,20 @@ debug_flush_files (void) opened on a seekable file, that the file pointer be left at the next character on exit (but places no restrictions on the file pointer location on a non-seekable file). It also requires that - fflush() followed by fseek() on an input file set the underlying - file pointer. However, fflush() on a non-seekable file can lose - buffered data, which we might otherwise want to process after - syscmd. Hence, we must check whether stdin is seekable. We must - also be tolerant of operating with stdin closed, so we don't - report any failures in this attempt. The stdio-safer module and - friends are essential, so that if stdin was closed, this lseek is - not on some other file that we have since opened. Mingw has bugs - when using fseek on text files, so we only strive for POSIX - behavior when we detect a UNIX environment. */ -#if UNIX + fflush() followed by fseeko() on an input file set the underlying + file pointer, and gnulib guarantees these semantics. However, + fflush() on a non-seekable file can lose buffered data, which we + might otherwise want to process after syscmd. Hence, we must + check whether stdin is seekable. We must also be tolerant of + operating with stdin closed, so we don't report any failures in + this attempt. The stdio-safer module and friends are essential, + so that if stdin was closed, this lseek is not on some other file + that we have since opened. */ if (lseek (STDIN_FILENO, 0, SEEK_CUR) >= 0 && fflush (stdin) == 0) { - fseek (stdin, 0, SEEK_CUR); + fseeko (stdin, 0, SEEK_CUR); } -#endif /* UNIX */ } /*-------------------------------------------------------------------------. diff -ruNp m4-1.4.9/src/eval.c m4-1.4.10/src/eval.c --- m4-1.4.9/src/eval.c 2007-01-09 09:12:43.000000000 -0700 +++ m4-1.4.10/src/eval.c 2007-07-04 21:56:05.000000000 -0600 @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -718,10 +718,10 @@ mult_term (eval_token et, int32_t *v1) if (v2 == 0) return DIVIDE_ZERO; else if (v2 == -1) - /* Avoid the x86 SIGFPE on INT_MIN / -1. */ + /* Avoid overflow, and the x86 SIGFPE on INT_MIN / -1. */ *v1 = (int32_t) -(uint32_t) *v1; else - *v1 = (int32_t) ((uint32_t) *v1 / (uint32_t) v2); + *v1 /= v2; break; case MODULO: diff -ruNp m4-1.4.9/src/format.c m4-1.4.10/src/format.c --- m4-1.4.9/src/format.c 2006-10-26 15:11:56.000000000 -0600 +++ m4-1.4.10/src/format.c 2007-07-09 21:07:04.000000000 -0600 @@ -1,11 +1,11 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006 + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -24,24 +24,17 @@ #include "m4.h" #include "xvasprintf.h" -/* Simple varargs substitute. */ +/* Simple varargs substitute. We assume int and unsigned int are the + same size; likewise for long and unsigned long. */ #define ARG_INT(argc, argv) \ ((argc == 0) ? 0 : \ (--argc, argv++, atoi (TOKEN_DATA_TEXT (argv[-1])))) -#define ARG_UINT(argc, argv) \ - ((argc == 0) ? 0 : \ - (--argc, argv++, (unsigned int) atoi (TOKEN_DATA_TEXT (argv[-1])))) - #define ARG_LONG(argc, argv) \ ((argc == 0) ? 0 : \ (--argc, argv++, atol (TOKEN_DATA_TEXT (argv[-1])))) -#define ARG_ULONG(argc, argv) \ - ((argc == 0) ? 0 : \ - (--argc, argv++, (unsigned long) atol (TOKEN_DATA_TEXT (argv[-1])))) - #define ARG_STR(argc, argv) \ ((argc == 0) ? "" : \ (--argc, argv++, TOKEN_DATA_TEXT (argv[-1]))) @@ -51,44 +44,60 @@ (--argc, argv++, atof (TOKEN_DATA_TEXT (argv[-1])))) -/*------------------------------------------------------------------------. -| The main formatting function. Output is placed on the obstack OBS, the | -| first argument in ARGV is the formatting string, and the rest is | -| arguments for the string. | -`------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| The main formatting function. Output is placed on the obstack | +| OBS, the first argument in ARGV is the formatting string, and the | +| rest is arguments for the string. Warn rather than invoke | +| unspecified behavior in the underlying printf when we do not | +| recognize a format. | +`------------------------------------------------------------------*/ void format (struct obstack *obs, int argc, token_data **argv) { - char *fmt; /* format control string */ - const char *fstart; /* beginning of current format spec */ - int c; /* a simple character */ + const char *f; /* format control string */ + const char *fmt; /* position within f */ + char fstart[] = "%'+- 0#*.*hhd"; /* current format spec */ + char *p; /* position within fstart */ + unsigned char c; /* a simple character */ /* Flags. */ - char flags; /* 1 iff treating flags */ + char flags; /* flags to use in fstart */ + enum { + THOUSANDS = 0x01, /* ' */ + PLUS = 0x02, /* + */ + MINUS = 0x04, /* - */ + SPACE = 0x08, /* */ + ZERO = 0x10, /* 0 */ + ALT = 0x20, /* # */ + DONE = 0x40 /* no more flags */ + }; /* Precision specifiers. */ int width; /* minimum field width */ int prec; /* precision */ char lflag; /* long flag */ - char hflag; /* short flag */ + + /* Specifiers we are willing to accept. ok['x'] implies %x is ok. + Various modifiers reduce the set, in order to avoid undefined + behavior in printf. */ + char ok[128]; /* Buffer and stuff. */ char *str; /* malloc'd buffer of formatted text */ - enum {INT, UINT, LONG, ULONG, DOUBLE, STR} datatype; + enum {CHAR, INT, LONG, DOUBLE, STR} datatype; - fmt = (char *) ARG_STR (argc, argv); + f = fmt = ARG_STR (argc, argv); + memset (ok, 0, sizeof ok); for (;;) { while ((c = *fmt++) != '%') { - if (c == 0) + if (c == '\0') return; obstack_1grow (obs, c); } - fstart = fmt - 1; - if (*fmt == '%') { obstack_1grow (obs, '%'); @@ -96,75 +105,144 @@ format (struct obstack *obs, int argc, t continue; } + p = fstart + 1; /* % */ + lflag = 0; + ok['a'] = ok['A'] = ok['c'] = ok['d'] = ok['e'] = ok['E'] + = ok['f'] = ok['F'] = ok['g'] = ok['G'] = ok['i'] = ok['o'] + = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 1; + /* Parse flags. */ - flags = 1; + flags = 0; do { switch (*fmt) { - case '-': /* left justification */ + case '\'': /* thousands separator */ + ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E'] + = ok['o'] = ok['s'] = ok['x'] = ok['X'] = 0; + flags |= THOUSANDS; + break; + case '+': /* mandatory sign */ + ok['c'] = ok['o'] = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 0; + flags |= PLUS; + break; + case ' ': /* space instead of positive sign */ + ok['c'] = ok['o'] = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 0; + flags |= SPACE; + break; + case '0': /* zero padding */ + ok['c'] = ok['s'] = 0; + flags |= ZERO; + break; + case '#': /* alternate output */ + ok['c'] = ok['d'] = ok['i'] = ok['s'] = ok['u'] = 0; + flags |= ALT; + break; + + case '-': /* left justification */ + flags |= MINUS; break; default: - flags = 0; + flags |= DONE; break; } } - while (flags && fmt++); - - /* Minimum field width. */ - width = -1; + while (!(flags & DONE) && fmt++); + if (flags & THOUSANDS) + *p++ = '\''; + if (flags & PLUS) + *p++ = '+'; + if (flags & MINUS) + *p++ = '-'; + if (flags & SPACE) + *p++ = ' '; + if (flags & ZERO) + *p++ = '0'; + if (flags & ALT) + *p++ = '#'; + + /* Minimum field width; an explicit 0 is the same as not giving + the width. */ + width = 0; + *p++ = '*'; if (*fmt == '*') { width = ARG_INT (argc, argv); fmt++; } - else if (isdigit (to_uchar (*fmt))) - { - do - { - fmt++; - } - while (isdigit (to_uchar (*fmt))); - } + else + while (isdigit (to_uchar (*fmt))) + { + width = 10 * width + *fmt - '0'; + fmt++; + } - /* Maximum precision. */ + /* Maximum precision; an explicit negative precision is the same + as not giving the precision. A lone '.' is a precision of 0. */ prec = -1; + *p++ = '.'; + *p++ = '*'; if (*fmt == '.') { + ok['c'] = 0; if (*(++fmt) == '*') { prec = ARG_INT (argc, argv); ++fmt; } - else if (isdigit (to_uchar (*fmt))) + else { - do + prec = 0; + while (isdigit (to_uchar (*fmt))) { + prec = 10 * prec + *fmt - '0'; fmt++; } - while (isdigit (to_uchar (*fmt))); } } - /* Length modifiers. */ - lflag = (*fmt == 'l'); - hflag = (*fmt == 'h'); - if (lflag || hflag) - fmt++; - - switch (*fmt++) + /* Length modifiers. We don't yet recognize ll, j, t, or z. */ + if (*fmt == 'l') + { + *p++ = 'l'; + lflag = 1; + fmt++; + ok['c'] = ok['s'] = 0; + } + else if (*fmt == 'h') { + *p++ = 'h'; + fmt++; + if (*fmt == 'h') + { + *p++ = 'h'; + fmt++; + } + ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E'] = ok['f'] = ok['F'] + = ok['g'] = ok['G'] = ok['s'] = 0; + } - case '\0': - return; + c = *fmt++; + if (c > sizeof ok || !ok[c]) + { + M4ERROR ((warning_status, 0, + "Warning: unrecognized specifier in `%s'", f)); + if (c == '\0') + fmt--; + continue; + } + /* Specifiers. We don't yet recognize C, S, n, or p. */ + switch (c) + { case 'c': - datatype = INT; + datatype = CHAR; + p -= 2; /* %.*c is undefined, so undo the '.*'. */ break; case 's': @@ -173,30 +251,15 @@ format (struct obstack *obs, int argc, t case 'd': case 'i': - if (lflag) - { - datatype = LONG; - } - else - { - datatype = INT; - } - break; - case 'o': case 'x': case 'X': case 'u': - if (lflag) - { - datatype = ULONG; - } - else - { - datatype = UINT; - } + datatype = lflag ? LONG : INT; break; + case 'a': + case 'A': case 'e': case 'E': case 'f': @@ -207,86 +270,37 @@ format (struct obstack *obs, int argc, t break; default: - continue; + abort (); } + *p++ = c; + *p = '\0'; - c = *fmt; - *fmt = '\0'; - - switch(datatype) + switch (datatype) { - case INT: - if (width != -1 && prec != -1) - str = xasprintf (fstart, width, prec, ARG_INT(argc, argv)); - else if (width != -1) - str = xasprintf (fstart, width, ARG_INT(argc, argv)); - else if (prec != -1) - str = xasprintf (fstart, prec, ARG_INT(argc, argv)); - else - str = xasprintf (fstart, ARG_INT(argc, argv)); + case CHAR: + str = xasprintf (fstart, width, ARG_INT(argc, argv)); break; - case UINT: - if (width != -1 && prec != -1) - str = xasprintf (fstart, width, prec, ARG_UINT(argc, argv)); - else if (width != -1) - str = xasprintf (fstart, width, ARG_UINT(argc, argv)); - else if (prec != -1) - str = xasprintf (fstart, prec, ARG_UINT(argc, argv)); - else - str = xasprintf (fstart, ARG_UINT(argc, argv)); + case INT: + str = xasprintf (fstart, width, prec, ARG_INT(argc, argv)); break; case LONG: - if (width != -1 && prec != -1) - str = xasprintf (fstart, width, prec, ARG_LONG(argc, argv)); - else if (width != -1) - str = xasprintf (fstart, width, ARG_LONG(argc, argv)); - else if (prec != -1) - str = xasprintf (fstart, prec, ARG_LONG(argc, argv)); - else - str = xasprintf (fstart, ARG_LONG(argc, argv)); - break; - - case ULONG: - if (width != -1 && prec != -1) - str = xasprintf (fstart, width, prec, ARG_ULONG(argc, argv)); - else if (width != -1) - str = xasprintf (fstart, width, ARG_ULONG(argc, argv)); - else if (prec != -1) - str = xasprintf (fstart, prec, ARG_ULONG(argc, argv)); - else - str = xasprintf (fstart, ARG_ULONG(argc, argv)); + str = xasprintf (fstart, width, prec, ARG_LONG(argc, argv)); break; case DOUBLE: - if (width != -1 && prec != -1) - str = xasprintf (fstart, width, prec, ARG_DOUBLE(argc, argv)); - else if (width != -1) - str = xasprintf (fstart, width, ARG_DOUBLE(argc, argv)); - else if (prec != -1) - str = xasprintf (fstart, prec, ARG_DOUBLE(argc, argv)); - else - str = xasprintf (fstart, ARG_DOUBLE(argc, argv)); + str = xasprintf (fstart, width, prec, ARG_DOUBLE(argc, argv)); break; case STR: - if (width != -1 && prec != -1) - str = xasprintf (fstart, width, prec, ARG_STR(argc, argv)); - else if (width != -1) - str = xasprintf (fstart, width, ARG_STR(argc, argv)); - else if (prec != -1) - str = xasprintf (fstart, prec, ARG_STR(argc, argv)); - else - str = xasprintf (fstart, ARG_STR(argc, argv)); + str = xasprintf (fstart, width, prec, ARG_STR(argc, argv)); break; default: abort(); } - *fmt = c; - /* NULL was returned on failure, such as invalid format string. For now, just silently ignore that bad specifier. */ if (str == NULL) diff -ruNp m4-1.4.9/src/freeze.c m4-1.4.10/src/freeze.c --- m4-1.4.9/src/freeze.c 2007-03-02 19:32:24.000000000 -0700 +++ m4-1.4.10/src/freeze.c 2007-07-04 21:56:05.000000000 -0600 @@ -1,11 +1,11 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006 + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -329,7 +329,7 @@ reload_frozen_state (const char *name) make_diversion (number[0]); if (number[1] > 0) - shipout_text (NULL, string[1], number[1]); + output_text (string[1], number[1]); break; case 'F': diff -ruNp m4-1.4.9/src/input.c m4-1.4.10/src/input.c --- m4-1.4.9/src/input.c 2007-02-05 06:43:36.000000000 -0700 +++ m4-1.4.10/src/input.c 2007-07-04 21:56:05.000000000 -0600 @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -808,22 +808,23 @@ set_word_regexp (const char *regexp) #endif /* ENABLE_CHANGEWORD */ -/*-------------------------------------------------------------------------. -| Parse and return a single token from the input stream. A token can | -| either be TOKEN_EOF, if the input_stack is empty; it can be TOKEN_STRING | -| for a quoted string; TOKEN_WORD for something that is a potential macro | -| name; and TOKEN_SIMPLE for any single character that is not a part of | -| any of the previous types. | -| | -| Next_token () return the token type, and passes back a pointer to the | -| token data through TD. The token text is collected on the obstack | -| token_stack, which never contains more than one token text at a time. | -| The storage pointed to by the fields in TD is therefore subject to | -| change the next time next_token () is called. | -`-------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------. +| Parse and return a single token from the input stream. A token | +| can either be TOKEN_EOF, if the input_stack is empty; it can be | +| TOKEN_STRING for a quoted string; TOKEN_WORD for something that is | +| a potential macro name; and TOKEN_SIMPLE for any single character | +| that is not a part of any of the previous types. If LINE is not | +| NULL, set *LINE to the line where the token starts. | +| | +| Next_token () return the token type, and passes back a pointer to | +| the token data through TD. The token text is collected on the | +| obstack token_stack, which never contains more than one token text | +| at a time. The storage pointed to by the fields in TD is | +| therefore subject to change the next time next_token () is called. | +`--------------------------------------------------------------------*/ token_type -next_token (token_data *td) +next_token (token_data *td, int *line) { int ch; int quote_level; @@ -833,9 +834,11 @@ next_token (token_data *td) char *orig_text = NULL; #endif const char *file; - int line; + int dummy; obstack_free (&token_stack, token_bottom); + if (!line) + line = &dummy; /* Can't consume character until after CHAR_MACRO is handled. */ ch = peek_input (); @@ -860,7 +863,7 @@ next_token (token_data *td) next_char (); /* Consume character we already peeked at. */ file = current_file; - line = current_line; + *line = current_line; if (MATCH (ch, bcomm.string, true)) { obstack_grow (&token_stack, bcomm.string, bcomm.length); @@ -872,7 +875,7 @@ next_token (token_data *td) else /* current_file changed to "" if we see CHAR_EOF, use the previous value we stored earlier. */ - M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, line, + M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, *line, "ERROR: end of file in comment")); type = TOKEN_STRING; @@ -955,7 +958,7 @@ next_token (token_data *td) if (ch == CHAR_EOF) /* current_file changed to "" if we see CHAR_EOF, use the previous value we stored earlier. */ - M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, line, + M4ERROR_AT_LINE ((EXIT_FAILURE, 0, file, *line, "ERROR: end of file in string")); if (MATCH (ch, rquote.string, true)) diff -ruNp m4-1.4.9/src/m4.c m4-1.4.10/src/m4.c --- m4-1.4.9/src/m4.c 2007-02-28 06:48:19.000000000 -0700 +++ m4-1.4.10/src/m4.c 2007-07-04 21:56:05.000000000 -0600 @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -278,10 +278,9 @@ static const struct option long_options[ /* Process a command line file NAME, and return true only if it was stdin. */ -static bool +static void process_file (const char *name) { - bool result = false; if (strcmp (name, "-") == 0) { /* If stdin is a terminal, we want to allow 'm4 - file -' @@ -289,7 +288,6 @@ process_file (const char *name) there is no point closing stdin before wrapped text, to minimize bugs in syscmd called from wrapped text. */ push_file (stdin, "stdin", false); - result = true; } else { @@ -301,13 +299,12 @@ process_file (const char *name) /* Set the status to EXIT_FAILURE, even though we continue to process files after a missing file. */ retcode = EXIT_FAILURE; - return false; + return; } push_file (fp, full_name, true); free (full_name); } expand_input (); - return result; } /* POSIX requires only -D, -U, and -s; and says that the first two @@ -330,7 +327,6 @@ main (int argc, char *const *argv, char int optchar; /* option character */ macro_definition *defines; - bool read_stdin = false; bool interactive = false; bool seen_file = false; const char *debugfile = NULL; @@ -340,7 +336,7 @@ main (int argc, char *const *argv, char program_name = argv[0]; retcode = EXIT_SUCCESS; - atexit (close_stdout); + atexit (close_stdin); include_init (); debug_init (); @@ -554,8 +550,7 @@ main (int argc, char *const *argv, char case '\1': seen_file = true; - if (process_file (defines->arg)) - read_stdin = true; + process_file (defines->arg); break; default: @@ -572,10 +567,10 @@ main (int argc, char *const *argv, char and the input read. Wrapup text is handled separately later. */ if (optind == argc && !seen_file) - read_stdin = process_file ("-"); + process_file ("-"); else for (; optind < argc; optind++) - read_stdin |= process_file (argv[optind]); + process_file (argv[optind]); /* Now handle wrapup text. */ @@ -583,14 +578,9 @@ main (int argc, char *const *argv, char expand_input (); /* Change debug stream back to stderr, to force flushing the debug - stream and detect any errors it might have encountered. Close - stdin if we read from it, to detect any errors. */ + stream and detect any errors it might have encountered. The + three standard streams are closed by close_stdin. */ debug_set_output (NULL); - if (read_stdin && close_stream (stdin) == EOF) - { - M4ERROR ((warning_status, errno, "error reading stdin")); - retcode = EXIT_FAILURE; - } if (frozen_file_to_write) produce_frozen_state (frozen_file_to_write); diff -ruNp m4-1.4.9/src/m4.h m4-1.4.10/src/m4.h --- m4-1.4.9/src/m4.h 2007-03-02 19:32:24.000000000 -0700 +++ m4-1.4.10/src/m4.h 2007-07-04 21:56:05.000000000 -0600 @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -36,7 +36,7 @@ #include "clean-temp.h" #include "cloexec.h" #include "close-stream.h" -#include "closeout.h" +#include "closein.h" #include "error.h" #include "exitfail.h" #include "obstack.h" @@ -285,7 +285,7 @@ typedef enum token_data_type token_data_ void input_init (void); token_type peek_token (void); -token_type next_token (token_data *); +token_type next_token (token_data *, int *); void skip_line (void); /* push back input */ @@ -321,7 +321,8 @@ extern int output_current_line; void output_init (void); void output_exit (void); -void shipout_text (struct obstack *, const char *, int); +void output_text (const char *, int); +void shipout_text (struct obstack *, const char *, int, int); void make_diversion (int); void insert_diversion (int); void insert_file (FILE *); diff -ruNp m4-1.4.9/src/macro.c m4-1.4.10/src/macro.c --- m4-1.4.9/src/macro.c 2006-11-01 16:29:08.000000000 -0600 +++ m4-1.4.10/src/macro.c 2007-07-04 21:56:05.000000000 -0600 @@ -1,11 +1,11 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006 Free Software - Foundation, Inc. + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2006, 2007 Free + Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -25,7 +25,7 @@ #include "m4.h" static void expand_macro (symbol *); -static void expand_token (struct obstack *, token_type, token_data *); +static void expand_token (struct obstack *, token_type, token_data *, int); /* Current recursion level in expand_macro (). */ int expansion_level = 0; @@ -59,12 +59,13 @@ expand_input (void) { token_type t; token_data td; + int line; obstack_init (&argc_stack); obstack_init (&argv_stack); - while ((t = next_token (&td)) != TOKEN_EOF) - expand_token ((struct obstack *) NULL, t, &td); + while ((t = next_token (&td, &line)) != TOKEN_EOF) + expand_token ((struct obstack *) NULL, t, &td, line); obstack_free (&argc_stack, NULL); obstack_free (&argv_stack, NULL); @@ -79,7 +80,7 @@ expand_input (void) `------------------------------------------------------------------------*/ static void -expand_token (struct obstack *obs, token_type t, token_data *td) +expand_token (struct obstack *obs, token_type t, token_data *td, int line) { symbol *sym; @@ -94,7 +95,8 @@ expand_token (struct obstack *obs, token case TOKEN_CLOSE: case TOKEN_SIMPLE: case TOKEN_STRING: - shipout_text (obs, TOKEN_DATA_TEXT (td), strlen (TOKEN_DATA_TEXT (td))); + shipout_text (obs, TOKEN_DATA_TEXT (td), strlen (TOKEN_DATA_TEXT (td)), + line); break; case TOKEN_WORD: @@ -106,10 +108,10 @@ expand_token (struct obstack *obs, token { #ifdef ENABLE_CHANGEWORD shipout_text (obs, TOKEN_DATA_ORIG_TEXT (td), - strlen (TOKEN_DATA_ORIG_TEXT (td))); + strlen (TOKEN_DATA_ORIG_TEXT (td)), line); #else shipout_text (obs, TOKEN_DATA_TEXT (td), - strlen (TOKEN_DATA_TEXT (td))); + strlen (TOKEN_DATA_TEXT (td)), line); #endif } else @@ -149,7 +151,7 @@ expand_argument (struct obstack *obs, to /* Skip leading white space. */ do { - t = next_token (&td); + t = next_token (&td, NULL); } while (t == TOKEN_SIMPLE && isspace (to_uchar (*TOKEN_DATA_TEXT (&td)))); @@ -184,7 +186,7 @@ expand_argument (struct obstack *obs, to paren_level++; else if (*text == ')') paren_level--; - expand_token (obs, t, &td); + expand_token (obs, t, &td, line); break; case TOKEN_EOF: @@ -196,7 +198,7 @@ expand_argument (struct obstack *obs, to case TOKEN_WORD: case TOKEN_STRING: - expand_token (obs, t, &td); + expand_token (obs, t, &td, line); break; case TOKEN_MACDEF: @@ -213,7 +215,7 @@ expand_argument (struct obstack *obs, to abort (); } - t = next_token (&td); + t = next_token (&td, NULL); } } @@ -239,7 +241,7 @@ collect_arguments (symbol *sym, struct o if (peek_token () == TOKEN_OPEN) { - next_token (&td); /* gobble parenthesis */ + next_token (&td, NULL); /* gobble parenthesis */ do { more_args = expand_argument (arguments, &td); @@ -325,7 +327,7 @@ expand_macro (symbol *sym) expansion_level++; if (nesting_limit > 0 && expansion_level > nesting_limit) M4ERROR ((EXIT_FAILURE, 0, - "ERROR: recursion limit of %d exceeded, use -L to change it", + "recursion limit of %d exceeded, use -L to change it", nesting_limit)); macro_call_id++; diff -ruNp m4-1.4.9/src/output.c m4-1.4.10/src/output.c --- m4-1.4.9/src/output.c 2007-03-23 06:40:03.000000000 -0600 +++ m4-1.4.10/src/output.c 2007-07-04 21:56:06.000000000 -0600 @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -215,7 +215,6 @@ m4_tmpfile (int divnum) if (output_temp_dir == NULL) { - errno = 0; output_temp_dir = create_temp_dir ("m4-", NULL, true); if (output_temp_dir == NULL) M4ERROR ((EXIT_FAILURE, errno, @@ -224,7 +223,6 @@ m4_tmpfile (int divnum) } name = m4_tmpname (divnum); register_temp_file (output_temp_dir, name); - errno = 0; file = fopen_temp (name, O_BINARY ? "wb+" : "w+"); if (file == NULL) { @@ -247,7 +245,6 @@ m4_tmpopen (int divnum) const char *name = m4_tmpname (divnum); FILE *file; - errno = 0; file = fopen_temp (name, O_BINARY ? "ab+" : "a+"); if (file == NULL) M4ERROR ((EXIT_FAILURE, errno, @@ -373,7 +370,7 @@ make_room_for (int length) if (selected_diversion) { FILE *file = selected_diversion->u.file; - selected_diversion->u.file = 0; + selected_diversion->u.file = NULL; if (m4_tmpclose (file) != 0) M4ERROR ((0, errno, "cannot close temporary file for diversion")); } @@ -422,11 +419,14 @@ output_character_helper (int character) | to a diversion file or an in-memory diversion buffer. | `------------------------------------------------------------------------*/ -static void +void output_text (const char *text, int length) { int count; + if (!output_diversion || !length) + return; + if (!output_file && length > output_unused) make_room_for (length); @@ -444,23 +444,26 @@ output_text (const char *text, int lengt } } -/*-------------------------------------------------------------------------. -| Add some text into an obstack OBS, taken from TEXT, having LENGTH | -| characters. If OBS is NULL, rather output the text to an external file | -| or an in-memory diversion buffer. If OBS is NULL, and there is no | -| output file, the text is discarded. | -| | -| If we are generating sync lines, the output have to be examined, because | -| we need to know how much output each input line generates. In general, | -| sync lines are output whenever a single input lines generates several | -| output lines, or when several input lines does not generate any output. | -`-------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------. +| Add some text into an obstack OBS, taken from TEXT, having LENGTH | +| characters. If OBS is NULL, output the text to an external file | +| or an in-memory diversion buffer instead. If OBS is NULL, and | +| there is no output file, the text is discarded. LINE is the line | +| where the token starts (not necessarily current_line, in the case | +| of multiline tokens). | +| | +| If we are generating sync lines, the output has to be examined, | +| because we need to know how much output each input line generates. | +| In general, sync lines are output whenever a single input lines | +| generates several output lines, or when several input lines do not | +| generate any output. | +`--------------------------------------------------------------------*/ void -shipout_text (struct obstack *obs, const char *text, int length) +shipout_text (struct obstack *obs, const char *text, int length, int line) { static bool start_of_output_line = true; - char line[20]; + char linebuf[20]; const char *cursor; /* If output goes to an obstack, merely add TEXT to it. */ @@ -501,43 +504,59 @@ shipout_text (struct obstack *obs, const output_text (text, length); } else - for (; length-- > 0; text++) - { - if (start_of_output_line) - { - start_of_output_line = false; - output_current_line++; - + { + /* Check for syncline only at the start of a token. Multiline + tokens, and tokens that are out of sync but in the middle of + the line, must wait until the next raw newline triggers a + syncline. */ + if (start_of_output_line) + { + start_of_output_line = false; + output_current_line++; #ifdef DEBUG_OUTPUT - printf ("DEBUG: cur %d, cur out %d\n", - current_line, output_current_line); + fprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n", + line, current_line, output_current_line); #endif - /* Output a `#line NUM' synchronization directive if needed. - If output_current_line was previously given a negative - value (invalidated), rather output `#line NUM "FILE"'. */ - - if (output_current_line != current_line) - { - sprintf (line, "#line %d", current_line); - for (cursor = line; *cursor; cursor++) - OUTPUT_CHARACTER (*cursor); - if (output_current_line < 1 && current_file[0] != '\0') - { - OUTPUT_CHARACTER (' '); - OUTPUT_CHARACTER ('"'); - for (cursor = current_file; *cursor; cursor++) - OUTPUT_CHARACTER (*cursor); - OUTPUT_CHARACTER ('"'); - } - OUTPUT_CHARACTER ('\n'); - output_current_line = current_line; - } - } - OUTPUT_CHARACTER (*text); - if (*text == '\n') - start_of_output_line = true; - } + /* Output a `#line NUM' synchronization directive if needed. + If output_current_line was previously given a negative + value (invalidated), output `#line NUM "FILE"' instead. */ + + if (output_current_line != line) + { + sprintf (linebuf, "#line %d", line); + for (cursor = linebuf; *cursor; cursor++) + OUTPUT_CHARACTER (*cursor); + if (output_current_line < 1 && current_file[0] != '\0') + { + OUTPUT_CHARACTER (' '); + OUTPUT_CHARACTER ('"'); + for (cursor = current_file; *cursor; cursor++) + OUTPUT_CHARACTER (*cursor); + OUTPUT_CHARACTER ('"'); + } + OUTPUT_CHARACTER ('\n'); + output_current_line = line; + } + } + + /* Output the token, and track embedded newlines. */ + for (; length-- > 0; text++) + { + if (start_of_output_line) + { + start_of_output_line = false; + output_current_line++; +#ifdef DEBUG_OUTPUT + fprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n", + line, current_line, output_current_line); +#endif + } + OUTPUT_CHARACTER (*text); + if (*text == '\n') + start_of_output_line = true; + } + } } /* Functions for use by diversions. */ @@ -683,13 +702,9 @@ insert_diversion_helper (m4_diversion *d output_text (diversion->u.buffer, diversion->used); else { - if (!diversion->u.file && diversion->used) + if (!diversion->u.file) diversion->u.file = m4_tmpopen (diversion->divnum); - if (diversion->u.file) - { - rewind (diversion->u.file); - insert_file (diversion->u.file); - } + insert_file (diversion->u.file); } output_current_line = -1; @@ -784,20 +799,20 @@ freeze_diversions (FILE *file) while (gl_oset_iterator_next (&iter, &elt)) { m4_diversion *diversion = (m4_diversion *) elt;; - if (diversion->size || diversion->u.file) + if (diversion->size || diversion->used) { if (diversion->size) fprintf (file, "D%d,%d\n", diversion->divnum, diversion->used); else { struct stat file_stat; - fflush (diversion->u.file); + diversion->u.file = m4_tmpopen (diversion->divnum); if (fstat (fileno (diversion->u.file), &file_stat) < 0) M4ERROR ((EXIT_FAILURE, errno, "cannot stat diversion")); if (file_stat.st_size < 0 || file_stat.st_size != (unsigned long int) file_stat.st_size) M4ERROR ((EXIT_FAILURE, 0, "diversion too large")); - fprintf (file, "D%d,%lu", diversion->divnum, + fprintf (file, "D%d,%lu\n", diversion->divnum, (unsigned long int) file_stat.st_size); } diff -ruNp m4-1.4.9/src/path.c m4-1.4.10/src/path.c --- m4-1.4.9/src/path.c 2006-11-01 07:44:54.000000000 -0600 +++ m4-1.4.10/src/path.c 2007-07-04 21:56:06.000000000 -0600 @@ -1,11 +1,11 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 2004, 2006 Free Software - Foundation, Inc. + Copyright (C) 1989, 1990, 1991, 1992, 1993, 2004, 2006, 2007 Free + Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, diff -ruNp m4-1.4.9/src/stackovf.c m4-1.4.10/src/stackovf.c --- m4-1.4.9/src/stackovf.c 2007-03-02 19:32:24.000000000 -0700 +++ m4-1.4.10/src/stackovf.c 2007-07-04 21:56:06.000000000 -0600 @@ -4,7 +4,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, diff -ruNp m4-1.4.9/src/symtab.c m4-1.4.10/src/symtab.c --- m4-1.4.9/src/symtab.c 2006-11-01 16:29:08.000000000 -0600 +++ m4-1.4.10/src/symtab.c 2007-07-04 21:56:06.000000000 -0600 @@ -1,11 +1,11 @@ /* GNU m4 -- A simple macro processor - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2003, 2006 Free + Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2003, 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, diff -ruNp m4-1.4.9/tests/Makefile.am m4-1.4.10/tests/Makefile.am --- m4-1.4.9/tests/Makefile.am 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/Makefile.am 2007-07-04 22:06:07.000000000 -0600 @@ -0,0 +1,312 @@ +## DO NOT EDIT! GENERATED AUTOMATICALLY! +## Process this file with automake to produce Makefile.in. +# Copyright (C) 2004-2007 Free Software Foundation, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. + +AUTOMAKE_OPTIONS = 1.5 foreign + +ACLOCAL_AMFLAGS = -I ../m4 + +SUBDIRS = +TESTS = +TESTS_ENVIRONMENT = +noinst_PROGRAMS = +check_PROGRAMS = +noinst_HEADERS = +EXTRA_DIST = +BUILT_SOURCES = +SUFFIXES = +MOSTLYCLEANFILES = core *.stackdump +MOSTLYCLEANDIRS = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = + +AM_CPPFLAGS = \ + -I. -I$(srcdir) \ + -I.. -I$(srcdir)/.. \ + -I../lib -I$(srcdir)/../lib + +LDADD = ../lib/libm4.a + +## begin gnulib module alloca-opt-tests + +TESTS += test-alloca-opt +check_PROGRAMS += test-alloca-opt + +## end gnulib module alloca-opt-tests + +## begin gnulib module array-list-tests + +TESTS += test-array_list +check_PROGRAMS += test-array_list +test_array_list_LDADD = $(LDADD) @LIBINTL@ + +## end gnulib module array-list-tests + +## begin gnulib module array-oset-tests + +TESTS += test-array_oset +check_PROGRAMS += test-array_oset +test_array_oset_LDADD = $(LDADD) @LIBINTL@ + +## end gnulib module array-oset-tests + +## begin gnulib module avltree-oset-tests + +TESTS += test-avltree_oset +check_PROGRAMS += test-avltree_oset +test_avltree_oset_LDADD = $(LDADD) @LIBINTL@ +## end gnulib module avltree-oset-tests + +## begin gnulib module binary-io-tests + +TESTS += test-binary-io.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' +EXTRA_DIST += test-binary-io.sh +check_PROGRAMS += test-binary-io + +## end gnulib module binary-io-tests + +## begin gnulib module closein-tests + +TESTS += test-closein.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' +check_PROGRAMS += test-closein +EXTRA_DIST += test-closein.sh +test_closein_LDADD = $(LDADD) @LIBINTL@ +## end gnulib module closein-tests + +## begin gnulib module fflush-tests + +TESTS += test-fflush +check_PROGRAMS += test-fflush +MOSTLYCLEANFILES += test-fflush.txt +## end gnulib module fflush-tests + +## begin gnulib module fpurge-tests + +TESTS += test-fpurge +check_PROGRAMS += test-fpurge +MOSTLYCLEANFILES += t-fpurge.tmp +## end gnulib module fpurge-tests + +## begin gnulib module freading-tests + +TESTS += test-freading +check_PROGRAMS += test-freading +MOSTLYCLEANFILES += t-freading.tmp +## end gnulib module freading-tests + +## begin gnulib module frexpl-nolibm-tests + +TESTS += test-frexpl +check_PROGRAMS += test-frexpl + +## end gnulib module frexpl-nolibm-tests + +## begin gnulib module fseeko-tests + +TESTS += test-fseeko.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' +check_PROGRAMS += test-fseeko +EXTRA_DIST += test-fseeko.sh +## end gnulib module fseeko-tests + +## begin gnulib module ftello-tests + +TESTS += test-ftello.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' +check_PROGRAMS += test-ftello +EXTRA_DIST += test-ftello.sh +## end gnulib module ftello-tests + +## begin gnulib module gettimeofday-tests + +TESTS += test-gettimeofday +check_PROGRAMS += test-gettimeofday + +## end gnulib module gettimeofday-tests + +## begin gnulib module isnan-nolibm-tests + +TESTS += test-isnan +check_PROGRAMS += test-isnan + +## end gnulib module isnan-nolibm-tests + +## begin gnulib module isnanf-nolibm-tests + +TESTS += test-isnanf +check_PROGRAMS += test-isnanf + +## end gnulib module isnanf-nolibm-tests + +## begin gnulib module isnanl-nolibm-tests + +TESTS += test-isnanl-nolibm +check_PROGRAMS += test-isnanl-nolibm +EXTRA_DIST += test-isnanl.h + +## end gnulib module isnanl-nolibm-tests + +## begin gnulib module linkedhash-list-tests + +TESTS += test-linkedhash_list +check_PROGRAMS += test-linkedhash_list +test_linkedhash_list_LDADD = $(LDADD) @LIBINTL@ +## end gnulib module linkedhash-list-tests + +## begin gnulib module lseek-tests + +TESTS += test-lseek.sh +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' +check_PROGRAMS += test-lseek +EXTRA_DIST += test-lseek.sh +## end gnulib module lseek-tests + +## begin gnulib module malloca-tests + +TESTS += test-malloca +check_PROGRAMS += test-malloca + +## end gnulib module malloca-tests + +## begin gnulib module math-tests + +TESTS += test-math +check_PROGRAMS += test-math + +## end gnulib module math-tests + +## begin gnulib module printf-frexp-tests + +TESTS += test-printf-frexp +check_PROGRAMS += test-printf-frexp + +## end gnulib module printf-frexp-tests + +## begin gnulib module printf-frexpl-tests + +TESTS += test-printf-frexpl +check_PROGRAMS += test-printf-frexpl + +## end gnulib module printf-frexpl-tests + +## begin gnulib module signbit-tests + +TESTS += test-signbit +check_PROGRAMS += test-signbit + +## end gnulib module signbit-tests + +## begin gnulib module stdbool-tests + +TESTS += test-stdbool +check_PROGRAMS += test-stdbool + +## end gnulib module stdbool-tests + +## begin gnulib module stdint-tests + +TESTS += test-stdint +check_PROGRAMS += test-stdint + +## end gnulib module stdint-tests + +## begin gnulib module stdio-tests + +TESTS += test-stdio +check_PROGRAMS += test-stdio + +## end gnulib module stdio-tests + +## begin gnulib module stdlib-tests + +TESTS += test-stdlib +check_PROGRAMS += test-stdlib + +## end gnulib module stdlib-tests + +## begin gnulib module sys_stat-tests + +TESTS += test-sys_stat +check_PROGRAMS += test-sys_stat + +## end gnulib module sys_stat-tests + +## begin gnulib module sys_time-tests + +TESTS += test-sys_time +check_PROGRAMS += test-sys_time + +## end gnulib module sys_time-tests + +## begin gnulib module unistd-tests + +TESTS += test-unistd +check_PROGRAMS += test-unistd + +## end gnulib module unistd-tests + +## begin gnulib module vasnprintf-tests + +TESTS += test-vasnprintf +check_PROGRAMS += test-vasnprintf + +## end gnulib module vasnprintf-tests + +## begin gnulib module vasprintf-posix-tests + +TESTS += test-vasprintf-posix +check_PROGRAMS += test-vasprintf-posix + +## end gnulib module vasprintf-posix-tests + +## begin gnulib module vasprintf-tests + +TESTS += test-vasprintf +check_PROGRAMS += test-vasprintf + +## end gnulib module vasprintf-tests + +## begin gnulib module wchar-tests + +TESTS += test-wchar +check_PROGRAMS += test-wchar + +## end gnulib module wchar-tests + +## begin gnulib module wctype-tests + +TESTS += test-wctype +check_PROGRAMS += test-wctype + +## end gnulib module wctype-tests + +## begin gnulib module xvasprintf-tests + +TESTS += test-xvasprintf +check_PROGRAMS += test-xvasprintf +test_xvasprintf_LDADD = $(LDADD) @LIBINTL@ + +## end gnulib module xvasprintf-tests + +# Clean up after Solaris cc. +clean-local: + rm -rf SunWS_cache + +mostlyclean-local: mostlyclean-generic + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done; \ + : diff -ruNp m4-1.4.9/tests/Makefile.in m4-1.4.10/tests/Makefile.in --- m4-1.4.9/tests/Makefile.in 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/Makefile.in 2007-07-09 21:15:34.000000000 -0600 @@ -0,0 +1,1173 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 2004-2007 Free Software Foundation, Inc. +# +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = test-alloca-opt$(EXEEXT) test-array_list$(EXEEXT) \ + test-array_oset$(EXEEXT) test-avltree_oset$(EXEEXT) \ + test-binary-io.sh test-closein.sh test-fflush$(EXEEXT) \ + test-fpurge$(EXEEXT) test-freading$(EXEEXT) \ + test-frexpl$(EXEEXT) test-fseeko.sh test-ftello.sh \ + test-gettimeofday$(EXEEXT) test-isnan$(EXEEXT) \ + test-isnanf$(EXEEXT) test-isnanl-nolibm$(EXEEXT) \ + test-linkedhash_list$(EXEEXT) test-lseek.sh \ + test-malloca$(EXEEXT) test-math$(EXEEXT) \ + test-printf-frexp$(EXEEXT) test-printf-frexpl$(EXEEXT) \ + test-signbit$(EXEEXT) test-stdbool$(EXEEXT) \ + test-stdint$(EXEEXT) test-stdio$(EXEEXT) test-stdlib$(EXEEXT) \ + test-sys_stat$(EXEEXT) test-sys_time$(EXEEXT) \ + test-unistd$(EXEEXT) test-vasnprintf$(EXEEXT) \ + test-vasprintf-posix$(EXEEXT) test-vasprintf$(EXEEXT) \ + test-wchar$(EXEEXT) test-wctype$(EXEEXT) \ + test-xvasprintf$(EXEEXT) +noinst_PROGRAMS = +check_PROGRAMS = test-alloca-opt$(EXEEXT) test-array_list$(EXEEXT) \ + test-array_oset$(EXEEXT) test-avltree_oset$(EXEEXT) \ + test-binary-io$(EXEEXT) test-closein$(EXEEXT) \ + test-fflush$(EXEEXT) test-fpurge$(EXEEXT) \ + test-freading$(EXEEXT) test-frexpl$(EXEEXT) \ + test-fseeko$(EXEEXT) test-ftello$(EXEEXT) \ + test-gettimeofday$(EXEEXT) test-isnan$(EXEEXT) \ + test-isnanf$(EXEEXT) test-isnanl-nolibm$(EXEEXT) \ + test-linkedhash_list$(EXEEXT) test-lseek$(EXEEXT) \ + test-malloca$(EXEEXT) test-math$(EXEEXT) \ + test-printf-frexp$(EXEEXT) test-printf-frexpl$(EXEEXT) \ + test-signbit$(EXEEXT) test-stdbool$(EXEEXT) \ + test-stdint$(EXEEXT) test-stdio$(EXEEXT) test-stdlib$(EXEEXT) \ + test-sys_stat$(EXEEXT) test-sys_time$(EXEEXT) \ + test-unistd$(EXEEXT) test-vasnprintf$(EXEEXT) \ + test-vasprintf-posix$(EXEEXT) test-vasprintf$(EXEEXT) \ + test-wchar$(EXEEXT) test-wctype$(EXEEXT) \ + test-xvasprintf$(EXEEXT) +subdir = tests +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/alloca.m4 \ + $(top_srcdir)/m4/assert.m4 $(top_srcdir)/m4/cloexec.m4 \ + $(top_srcdir)/m4/close-stream.m4 $(top_srcdir)/m4/closein.m4 \ + $(top_srcdir)/m4/closeout.m4 $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/config-h.m4 $(top_srcdir)/m4/eealloc.m4 \ + $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \ + $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \ + $(top_srcdir)/m4/fatal-signal.m4 $(top_srcdir)/m4/fflush.m4 \ + $(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fpending.m4 \ + $(top_srcdir)/m4/fpieee.m4 $(top_srcdir)/m4/fpurge.m4 \ + $(top_srcdir)/m4/freading.m4 $(top_srcdir)/m4/free.m4 \ + $(top_srcdir)/m4/frexp.m4 $(top_srcdir)/m4/frexpl.m4 \ + $(top_srcdir)/m4/fseeko.m4 $(top_srcdir)/m4/ftello.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettimeofday.m4 \ + $(top_srcdir)/m4/gl_list.m4 $(top_srcdir)/m4/glibc21.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inline.m4 \ + $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isnan.m4 $(top_srcdir)/m4/isnanf.m4 \ + $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/ldexpl.m4 \ + $(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lseek.m4 $(top_srcdir)/m4/malloca.m4 \ + $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mkdtemp.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/pathmax.m4 \ + $(top_srcdir)/m4/printf-frexp.m4 \ + $(top_srcdir)/m4/printf-frexpl.m4 $(top_srcdir)/m4/printf.m4 \ + $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/regex.m4 \ + $(top_srcdir)/m4/sig_atomic_t.m4 $(top_srcdir)/m4/signal_h.m4 \ + $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/signbit.m4 \ + $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \ + $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/stdio-safer.m4 $(top_srcdir)/m4/stdio_h.m4 \ + $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ + $(top_srcdir)/m4/sys_time_h.m4 $(top_srcdir)/m4/tempname.m4 \ + $(top_srcdir)/m4/tmpdir.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ + $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/vasprintf-posix.m4 \ + $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/wchar.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wctype.m4 \ + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \ + $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xvasprintf.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/lib/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +test_alloca_opt_SOURCES = test-alloca-opt.c +test_alloca_opt_OBJECTS = test-alloca-opt.$(OBJEXT) +test_alloca_opt_LDADD = $(LDADD) +test_alloca_opt_DEPENDENCIES = ../lib/libm4.a +test_array_list_SOURCES = test-array_list.c +test_array_list_OBJECTS = test-array_list.$(OBJEXT) +test_array_list_DEPENDENCIES = $(LDADD) +test_array_oset_SOURCES = test-array_oset.c +test_array_oset_OBJECTS = test-array_oset.$(OBJEXT) +test_array_oset_DEPENDENCIES = $(LDADD) +test_avltree_oset_SOURCES = test-avltree_oset.c +test_avltree_oset_OBJECTS = test-avltree_oset.$(OBJEXT) +test_avltree_oset_DEPENDENCIES = $(LDADD) +test_binary_io_SOURCES = test-binary-io.c +test_binary_io_OBJECTS = test-binary-io.$(OBJEXT) +test_binary_io_LDADD = $(LDADD) +test_binary_io_DEPENDENCIES = ../lib/libm4.a +test_closein_SOURCES = test-closein.c +test_closein_OBJECTS = test-closein.$(OBJEXT) +test_closein_DEPENDENCIES = $(LDADD) +test_fflush_SOURCES = test-fflush.c +test_fflush_OBJECTS = test-fflush.$(OBJEXT) +test_fflush_LDADD = $(LDADD) +test_fflush_DEPENDENCIES = ../lib/libm4.a +test_fpurge_SOURCES = test-fpurge.c +test_fpurge_OBJECTS = test-fpurge.$(OBJEXT) +test_fpurge_LDADD = $(LDADD) +test_fpurge_DEPENDENCIES = ../lib/libm4.a +test_freading_SOURCES = test-freading.c +test_freading_OBJECTS = test-freading.$(OBJEXT) +test_freading_LDADD = $(LDADD) +test_freading_DEPENDENCIES = ../lib/libm4.a +test_frexpl_SOURCES = test-frexpl.c +test_frexpl_OBJECTS = test-frexpl.$(OBJEXT) +test_frexpl_LDADD = $(LDADD) +test_frexpl_DEPENDENCIES = ../lib/libm4.a +test_fseeko_SOURCES = test-fseeko.c +test_fseeko_OBJECTS = test-fseeko.$(OBJEXT) +test_fseeko_LDADD = $(LDADD) +test_fseeko_DEPENDENCIES = ../lib/libm4.a +test_ftello_SOURCES = test-ftello.c +test_ftello_OBJECTS = test-ftello.$(OBJEXT) +test_ftello_LDADD = $(LDADD) +test_ftello_DEPENDENCIES = ../lib/libm4.a +test_gettimeofday_SOURCES = test-gettimeofday.c +test_gettimeofday_OBJECTS = test-gettimeofday.$(OBJEXT) +test_gettimeofday_LDADD = $(LDADD) +test_gettimeofday_DEPENDENCIES = ../lib/libm4.a +test_isnan_SOURCES = test-isnan.c +test_isnan_OBJECTS = test-isnan.$(OBJEXT) +test_isnan_LDADD = $(LDADD) +test_isnan_DEPENDENCIES = ../lib/libm4.a +test_isnanf_SOURCES = test-isnanf.c +test_isnanf_OBJECTS = test-isnanf.$(OBJEXT) +test_isnanf_LDADD = $(LDADD) +test_isnanf_DEPENDENCIES = ../lib/libm4.a +test_isnanl_nolibm_SOURCES = test-isnanl-nolibm.c +test_isnanl_nolibm_OBJECTS = test-isnanl-nolibm.$(OBJEXT) +test_isnanl_nolibm_LDADD = $(LDADD) +test_isnanl_nolibm_DEPENDENCIES = ../lib/libm4.a +test_linkedhash_list_SOURCES = test-linkedhash_list.c +test_linkedhash_list_OBJECTS = test-linkedhash_list.$(OBJEXT) +test_linkedhash_list_DEPENDENCIES = $(LDADD) +test_lseek_SOURCES = test-lseek.c +test_lseek_OBJECTS = test-lseek.$(OBJEXT) +test_lseek_LDADD = $(LDADD) +test_lseek_DEPENDENCIES = ../lib/libm4.a +test_malloca_SOURCES = test-malloca.c +test_malloca_OBJECTS = test-malloca.$(OBJEXT) +test_malloca_LDADD = $(LDADD) +test_malloca_DEPENDENCIES = ../lib/libm4.a +test_math_SOURCES = test-math.c +test_math_OBJECTS = test-math.$(OBJEXT) +test_math_LDADD = $(LDADD) +test_math_DEPENDENCIES = ../lib/libm4.a +test_printf_frexp_SOURCES = test-printf-frexp.c +test_printf_frexp_OBJECTS = test-printf-frexp.$(OBJEXT) +test_printf_frexp_LDADD = $(LDADD) +test_printf_frexp_DEPENDENCIES = ../lib/libm4.a +test_printf_frexpl_SOURCES = test-printf-frexpl.c +test_printf_frexpl_OBJECTS = test-printf-frexpl.$(OBJEXT) +test_printf_frexpl_LDADD = $(LDADD) +test_printf_frexpl_DEPENDENCIES = ../lib/libm4.a +test_signbit_SOURCES = test-signbit.c +test_signbit_OBJECTS = test-signbit.$(OBJEXT) +test_signbit_LDADD = $(LDADD) +test_signbit_DEPENDENCIES = ../lib/libm4.a +test_stdbool_SOURCES = test-stdbool.c +test_stdbool_OBJECTS = test-stdbool.$(OBJEXT) +test_stdbool_LDADD = $(LDADD) +test_stdbool_DEPENDENCIES = ../lib/libm4.a +test_stdint_SOURCES = test-stdint.c +test_stdint_OBJECTS = test-stdint.$(OBJEXT) +test_stdint_LDADD = $(LDADD) +test_stdint_DEPENDENCIES = ../lib/libm4.a +test_stdio_SOURCES = test-stdio.c +test_stdio_OBJECTS = test-stdio.$(OBJEXT) +test_stdio_LDADD = $(LDADD) +test_stdio_DEPENDENCIES = ../lib/libm4.a +test_stdlib_SOURCES = test-stdlib.c +test_stdlib_OBJECTS = test-stdlib.$(OBJEXT) +test_stdlib_LDADD = $(LDADD) +test_stdlib_DEPENDENCIES = ../lib/libm4.a +test_sys_stat_SOURCES = test-sys_stat.c +test_sys_stat_OBJECTS = test-sys_stat.$(OBJEXT) +test_sys_stat_LDADD = $(LDADD) +test_sys_stat_DEPENDENCIES = ../lib/libm4.a +test_sys_time_SOURCES = test-sys_time.c +test_sys_time_OBJECTS = test-sys_time.$(OBJEXT) +test_sys_time_LDADD = $(LDADD) +test_sys_time_DEPENDENCIES = ../lib/libm4.a +test_unistd_SOURCES = test-unistd.c +test_unistd_OBJECTS = test-unistd.$(OBJEXT) +test_unistd_LDADD = $(LDADD) +test_unistd_DEPENDENCIES = ../lib/libm4.a +test_vasnprintf_SOURCES = test-vasnprintf.c +test_vasnprintf_OBJECTS = test-vasnprintf.$(OBJEXT) +test_vasnprintf_LDADD = $(LDADD) +test_vasnprintf_DEPENDENCIES = ../lib/libm4.a +test_vasprintf_SOURCES = test-vasprintf.c +test_vasprintf_OBJECTS = test-vasprintf.$(OBJEXT) +test_vasprintf_LDADD = $(LDADD) +test_vasprintf_DEPENDENCIES = ../lib/libm4.a +test_vasprintf_posix_SOURCES = test-vasprintf-posix.c +test_vasprintf_posix_OBJECTS = test-vasprintf-posix.$(OBJEXT) +test_vasprintf_posix_LDADD = $(LDADD) +test_vasprintf_posix_DEPENDENCIES = ../lib/libm4.a +test_wchar_SOURCES = test-wchar.c +test_wchar_OBJECTS = test-wchar.$(OBJEXT) +test_wchar_LDADD = $(LDADD) +test_wchar_DEPENDENCIES = ../lib/libm4.a +test_wctype_SOURCES = test-wctype.c +test_wctype_OBJECTS = test-wctype.$(OBJEXT) +test_wctype_LDADD = $(LDADD) +test_wctype_DEPENDENCIES = ../lib/libm4.a +test_xvasprintf_SOURCES = test-xvasprintf.c +test_xvasprintf_OBJECTS = test-xvasprintf.$(OBJEXT) +test_xvasprintf_DEPENDENCIES = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(top_builddir)/lib@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = test-alloca-opt.c test-array_list.c test-array_oset.c \ + test-avltree_oset.c test-binary-io.c test-closein.c \ + test-fflush.c test-fpurge.c test-freading.c test-frexpl.c \ + test-fseeko.c test-ftello.c test-gettimeofday.c test-isnan.c \ + test-isnanf.c test-isnanl-nolibm.c test-linkedhash_list.c \ + test-lseek.c test-malloca.c test-math.c test-printf-frexp.c \ + test-printf-frexpl.c test-signbit.c test-stdbool.c \ + test-stdint.c test-stdio.c test-stdlib.c test-sys_stat.c \ + test-sys_time.c test-unistd.c test-vasnprintf.c \ + test-vasprintf.c test-vasprintf-posix.c test-wchar.c \ + test-wctype.c test-xvasprintf.c +DIST_SOURCES = test-alloca-opt.c test-array_list.c test-array_oset.c \ + test-avltree_oset.c test-binary-io.c test-closein.c \ + test-fflush.c test-fpurge.c test-freading.c test-frexpl.c \ + test-fseeko.c test-ftello.c test-gettimeofday.c test-isnan.c \ + test-isnanf.c test-isnanl-nolibm.c test-linkedhash_list.c \ + test-lseek.c test-malloca.c test-math.c test-printf-frexp.c \ + test-printf-frexpl.c test-signbit.c test-stdbool.c \ + test-stdint.c test-stdio.c test-stdlib.c test-sys_stat.c \ + test-sys_time.c test-unistd.c test-vasnprintf.c \ + test-vasprintf.c test-vasprintf-posix.c test-wchar.c \ + test-wctype.c test-xvasprintf.c +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALLOCA_H = @ALLOCA_H@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EOVERFLOW = @EOVERFLOW@ +EXEEXT = @EXEEXT@ +FLOAT_H = @FLOAT_H@ +GETOPT_H = @GETOPT_H@ +GLIBC21 = @GLIBC21@ +GNULIB_CHOWN = @GNULIB_CHOWN@ +GNULIB_DUP2 = @GNULIB_DUP2@ +GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FFLUSH = @GNULIB_FFLUSH@ +GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@ +GNULIB_FREXP = @GNULIB_FREXP@ +GNULIB_FREXPL = @GNULIB_FREXPL@ +GNULIB_FSEEK = @GNULIB_FSEEK@ +GNULIB_FSEEKO = @GNULIB_FSEEKO@ +GNULIB_FTELL = @GNULIB_FTELL@ +GNULIB_FTELLO = @GNULIB_FTELLO@ +GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_GETCWD = @GNULIB_GETCWD@ +GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ +GNULIB_LCHOWN = @GNULIB_LCHOWN@ +GNULIB_LDEXPL = @GNULIB_LDEXPL@ +GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_MATHL = @GNULIB_MATHL@ +GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ +GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@ +GNULIB_READLINK = @GNULIB_READLINK@ +GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ +GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@ +GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_SNPRINTF = @GNULIB_SNPRINTF@ +GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@ +GNULIB_VASPRINTF = @GNULIB_VASPRINTF@ +GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@ +GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@ +GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@ +GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@ +GNULIB_WCWIDTH = @GNULIB_WCWIDTH@ +GREP = @GREP@ +HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@ +HAVE_DECL_ASINL = @HAVE_DECL_ASINL@ +HAVE_DECL_ATANL = @HAVE_DECL_ATANL@ +HAVE_DECL_CEILL = @HAVE_DECL_CEILL@ +HAVE_DECL_COSL = @HAVE_DECL_COSL@ +HAVE_DECL_EXPL = @HAVE_DECL_EXPL@ +HAVE_DECL_FLOORL = @HAVE_DECL_FLOORL@ +HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ +HAVE_DECL_LOGL = @HAVE_DECL_LOGL@ +HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@ +HAVE_DECL_SINL = @HAVE_DECL_SINL@ +HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ +HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@ +HAVE_DECL_TANL = @HAVE_DECL_TANL@ +HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ +HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@ +HAVE_DUP2 = @HAVE_DUP2@ +HAVE_FSEEKO = @HAVE_FSEEKO@ +HAVE_FTELLO = @HAVE_FTELLO@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_IO_H = @HAVE_IO_H@ +HAVE_ISWCNTRL = @HAVE_ISWCNTRL@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SIGSET_T = @HAVE_SIGSET_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ +HAVE_VASPRINTF = @HAVE_VASPRINTF@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCTYPE_H = @HAVE_WCTYPE_H@ +HAVE_WINT_T = @HAVE_WINT_T@ +HAVE__BOOL = @HAVE__BOOL@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ +LIBM4_LIBDEPS = @LIBM4_LIBDEPS@ +LIBM4_LTLIBDEPS = @LIBM4_LTLIBDEPS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +M4_LIBOBJS = @M4_LIBOBJS@ +M4_LTLIBOBJS = @M4_LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NEXT_FLOAT_H = @NEXT_FLOAT_H@ +NEXT_MATH_H = @NEXT_MATH_H@ +NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDIO_H = @NEXT_STDIO_H@ +NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ +NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NEXT_WCHAR_H = @NEXT_WCHAR_H@ +NEXT_WCTYPE_H = @NEXT_WCTYPE_H@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_FCHDIR = @REPLACE_FCHDIR@ +REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FREXP = @REPLACE_FREXP@ +REPLACE_FREXPL = @REPLACE_FREXPL@ +REPLACE_FSEEK = @REPLACE_FSEEK@ +REPLACE_FSEEKO = @REPLACE_FSEEKO@ +REPLACE_FTELL = @REPLACE_FTELL@ +REPLACE_FTELLO = @REPLACE_FTELLO@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LDEXPL = @REPLACE_LDEXPL@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ +REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ +REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ +REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ +REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ +REPLACE_VPRINTF = @REPLACE_VPRINTF@ +REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ +REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ +REPLACE_WCWIDTH = @REPLACE_WCWIDTH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDINT_H = @STDINT_H@ +STRIP = @STRIP@ +SYS_STAT_H = @SYS_STAT_H@ +SYS_TIME_H = @SYS_TIME_H@ +VERSION = @VERSION@ +WCHAR_H = @WCHAR_H@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WCTYPE_H = @WCTYPE_H@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = 1.5 foreign +ACLOCAL_AMFLAGS = -I ../m4 +SUBDIRS = +TESTS_ENVIRONMENT = EXEEXT='@EXEEXT@' EXEEXT='@EXEEXT@' \ + EXEEXT='@EXEEXT@' srcdir='$(srcdir)' EXEEXT='@EXEEXT@' \ + srcdir='$(srcdir)' EXEEXT='@EXEEXT@' srcdir='$(srcdir)' +noinst_HEADERS = +EXTRA_DIST = test-binary-io.sh test-closein.sh test-fseeko.sh \ + test-ftello.sh test-isnanl.h test-lseek.sh +BUILT_SOURCES = +SUFFIXES = +MOSTLYCLEANFILES = core *.stackdump test-fflush.txt t-fpurge.tmp \ + t-freading.tmp +MOSTLYCLEANDIRS = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = +AM_CPPFLAGS = \ + -I. -I$(srcdir) \ + -I.. -I$(srcdir)/.. \ + -I../lib -I$(srcdir)/../lib + +LDADD = ../lib/libm4.a +test_array_list_LDADD = $(LDADD) @LIBINTL@ +test_array_oset_LDADD = $(LDADD) @LIBINTL@ +test_avltree_oset_LDADD = $(LDADD) @LIBINTL@ +test_closein_LDADD = $(LDADD) @LIBINTL@ +test_linkedhash_list_LDADD = $(LDADD) @LIBINTL@ +test_xvasprintf_LDADD = $(LDADD) @LIBINTL@ +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +test-alloca-opt$(EXEEXT): $(test_alloca_opt_OBJECTS) $(test_alloca_opt_DEPENDENCIES) + @rm -f test-alloca-opt$(EXEEXT) + $(LINK) $(test_alloca_opt_OBJECTS) $(test_alloca_opt_LDADD) $(LIBS) +test-array_list$(EXEEXT): $(test_array_list_OBJECTS) $(test_array_list_DEPENDENCIES) + @rm -f test-array_list$(EXEEXT) + $(LINK) $(test_array_list_OBJECTS) $(test_array_list_LDADD) $(LIBS) +test-array_oset$(EXEEXT): $(test_array_oset_OBJECTS) $(test_array_oset_DEPENDENCIES) + @rm -f test-array_oset$(EXEEXT) + $(LINK) $(test_array_oset_OBJECTS) $(test_array_oset_LDADD) $(LIBS) +test-avltree_oset$(EXEEXT): $(test_avltree_oset_OBJECTS) $(test_avltree_oset_DEPENDENCIES) + @rm -f test-avltree_oset$(EXEEXT) + $(LINK) $(test_avltree_oset_OBJECTS) $(test_avltree_oset_LDADD) $(LIBS) +test-binary-io$(EXEEXT): $(test_binary_io_OBJECTS) $(test_binary_io_DEPENDENCIES) + @rm -f test-binary-io$(EXEEXT) + $(LINK) $(test_binary_io_OBJECTS) $(test_binary_io_LDADD) $(LIBS) +test-closein$(EXEEXT): $(test_closein_OBJECTS) $(test_closein_DEPENDENCIES) + @rm -f test-closein$(EXEEXT) + $(LINK) $(test_closein_OBJECTS) $(test_closein_LDADD) $(LIBS) +test-fflush$(EXEEXT): $(test_fflush_OBJECTS) $(test_fflush_DEPENDENCIES) + @rm -f test-fflush$(EXEEXT) + $(LINK) $(test_fflush_OBJECTS) $(test_fflush_LDADD) $(LIBS) +test-fpurge$(EXEEXT): $(test_fpurge_OBJECTS) $(test_fpurge_DEPENDENCIES) + @rm -f test-fpurge$(EXEEXT) + $(LINK) $(test_fpurge_OBJECTS) $(test_fpurge_LDADD) $(LIBS) +test-freading$(EXEEXT): $(test_freading_OBJECTS) $(test_freading_DEPENDENCIES) + @rm -f test-freading$(EXEEXT) + $(LINK) $(test_freading_OBJECTS) $(test_freading_LDADD) $(LIBS) +test-frexpl$(EXEEXT): $(test_frexpl_OBJECTS) $(test_frexpl_DEPENDENCIES) + @rm -f test-frexpl$(EXEEXT) + $(LINK) $(test_frexpl_OBJECTS) $(test_frexpl_LDADD) $(LIBS) +test-fseeko$(EXEEXT): $(test_fseeko_OBJECTS) $(test_fseeko_DEPENDENCIES) + @rm -f test-fseeko$(EXEEXT) + $(LINK) $(test_fseeko_OBJECTS) $(test_fseeko_LDADD) $(LIBS) +test-ftello$(EXEEXT): $(test_ftello_OBJECTS) $(test_ftello_DEPENDENCIES) + @rm -f test-ftello$(EXEEXT) + $(LINK) $(test_ftello_OBJECTS) $(test_ftello_LDADD) $(LIBS) +test-gettimeofday$(EXEEXT): $(test_gettimeofday_OBJECTS) $(test_gettimeofday_DEPENDENCIES) + @rm -f test-gettimeofday$(EXEEXT) + $(LINK) $(test_gettimeofday_OBJECTS) $(test_gettimeofday_LDADD) $(LIBS) +test-isnan$(EXEEXT): $(test_isnan_OBJECTS) $(test_isnan_DEPENDENCIES) + @rm -f test-isnan$(EXEEXT) + $(LINK) $(test_isnan_OBJECTS) $(test_isnan_LDADD) $(LIBS) +test-isnanf$(EXEEXT): $(test_isnanf_OBJECTS) $(test_isnanf_DEPENDENCIES) + @rm -f test-isnanf$(EXEEXT) + $(LINK) $(test_isnanf_OBJECTS) $(test_isnanf_LDADD) $(LIBS) +test-isnanl-nolibm$(EXEEXT): $(test_isnanl_nolibm_OBJECTS) $(test_isnanl_nolibm_DEPENDENCIES) + @rm -f test-isnanl-nolibm$(EXEEXT) + $(LINK) $(test_isnanl_nolibm_OBJECTS) $(test_isnanl_nolibm_LDADD) $(LIBS) +test-linkedhash_list$(EXEEXT): $(test_linkedhash_list_OBJECTS) $(test_linkedhash_list_DEPENDENCIES) + @rm -f test-linkedhash_list$(EXEEXT) + $(LINK) $(test_linkedhash_list_OBJECTS) $(test_linkedhash_list_LDADD) $(LIBS) +test-lseek$(EXEEXT): $(test_lseek_OBJECTS) $(test_lseek_DEPENDENCIES) + @rm -f test-lseek$(EXEEXT) + $(LINK) $(test_lseek_OBJECTS) $(test_lseek_LDADD) $(LIBS) +test-malloca$(EXEEXT): $(test_malloca_OBJECTS) $(test_malloca_DEPENDENCIES) + @rm -f test-malloca$(EXEEXT) + $(LINK) $(test_malloca_OBJECTS) $(test_malloca_LDADD) $(LIBS) +test-math$(EXEEXT): $(test_math_OBJECTS) $(test_math_DEPENDENCIES) + @rm -f test-math$(EXEEXT) + $(LINK) $(test_math_OBJECTS) $(test_math_LDADD) $(LIBS) +test-printf-frexp$(EXEEXT): $(test_printf_frexp_OBJECTS) $(test_printf_frexp_DEPENDENCIES) + @rm -f test-printf-frexp$(EXEEXT) + $(LINK) $(test_printf_frexp_OBJECTS) $(test_printf_frexp_LDADD) $(LIBS) +test-printf-frexpl$(EXEEXT): $(test_printf_frexpl_OBJECTS) $(test_printf_frexpl_DEPENDENCIES) + @rm -f test-printf-frexpl$(EXEEXT) + $(LINK) $(test_printf_frexpl_OBJECTS) $(test_printf_frexpl_LDADD) $(LIBS) +test-signbit$(EXEEXT): $(test_signbit_OBJECTS) $(test_signbit_DEPENDENCIES) + @rm -f test-signbit$(EXEEXT) + $(LINK) $(test_signbit_OBJECTS) $(test_signbit_LDADD) $(LIBS) +test-stdbool$(EXEEXT): $(test_stdbool_OBJECTS) $(test_stdbool_DEPENDENCIES) + @rm -f test-stdbool$(EXEEXT) + $(LINK) $(test_stdbool_OBJECTS) $(test_stdbool_LDADD) $(LIBS) +test-stdint$(EXEEXT): $(test_stdint_OBJECTS) $(test_stdint_DEPENDENCIES) + @rm -f test-stdint$(EXEEXT) + $(LINK) $(test_stdint_OBJECTS) $(test_stdint_LDADD) $(LIBS) +test-stdio$(EXEEXT): $(test_stdio_OBJECTS) $(test_stdio_DEPENDENCIES) + @rm -f test-stdio$(EXEEXT) + $(LINK) $(test_stdio_OBJECTS) $(test_stdio_LDADD) $(LIBS) +test-stdlib$(EXEEXT): $(test_stdlib_OBJECTS) $(test_stdlib_DEPENDENCIES) + @rm -f test-stdlib$(EXEEXT) + $(LINK) $(test_stdlib_OBJECTS) $(test_stdlib_LDADD) $(LIBS) +test-sys_stat$(EXEEXT): $(test_sys_stat_OBJECTS) $(test_sys_stat_DEPENDENCIES) + @rm -f test-sys_stat$(EXEEXT) + $(LINK) $(test_sys_stat_OBJECTS) $(test_sys_stat_LDADD) $(LIBS) +test-sys_time$(EXEEXT): $(test_sys_time_OBJECTS) $(test_sys_time_DEPENDENCIES) + @rm -f test-sys_time$(EXEEXT) + $(LINK) $(test_sys_time_OBJECTS) $(test_sys_time_LDADD) $(LIBS) +test-unistd$(EXEEXT): $(test_unistd_OBJECTS) $(test_unistd_DEPENDENCIES) + @rm -f test-unistd$(EXEEXT) + $(LINK) $(test_unistd_OBJECTS) $(test_unistd_LDADD) $(LIBS) +test-vasnprintf$(EXEEXT): $(test_vasnprintf_OBJECTS) $(test_vasnprintf_DEPENDENCIES) + @rm -f test-vasnprintf$(EXEEXT) + $(LINK) $(test_vasnprintf_OBJECTS) $(test_vasnprintf_LDADD) $(LIBS) +test-vasprintf$(EXEEXT): $(test_vasprintf_OBJECTS) $(test_vasprintf_DEPENDENCIES) + @rm -f test-vasprintf$(EXEEXT) + $(LINK) $(test_vasprintf_OBJECTS) $(test_vasprintf_LDADD) $(LIBS) +test-vasprintf-posix$(EXEEXT): $(test_vasprintf_posix_OBJECTS) $(test_vasprintf_posix_DEPENDENCIES) + @rm -f test-vasprintf-posix$(EXEEXT) + $(LINK) $(test_vasprintf_posix_OBJECTS) $(test_vasprintf_posix_LDADD) $(LIBS) +test-wchar$(EXEEXT): $(test_wchar_OBJECTS) $(test_wchar_DEPENDENCIES) + @rm -f test-wchar$(EXEEXT) + $(LINK) $(test_wchar_OBJECTS) $(test_wchar_LDADD) $(LIBS) +test-wctype$(EXEEXT): $(test_wctype_OBJECTS) $(test_wctype_DEPENDENCIES) + @rm -f test-wctype$(EXEEXT) + $(LINK) $(test_wctype_OBJECTS) $(test_wctype_LDADD) $(LIBS) +test-xvasprintf$(EXEEXT): $(test_xvasprintf_OBJECTS) $(test_xvasprintf_DEPENDENCIES) + @rm -f test-xvasprintf$(EXEEXT) + $(LINK) $(test_xvasprintf_OBJECTS) $(test_xvasprintf_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-alloca-opt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-array_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-array_oset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-avltree_oset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-binary-io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-closein.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fflush.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fpurge.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-freading.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-frexpl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fseeko.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-ftello.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-gettimeofday.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnan.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnanf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-isnanl-nolibm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-linkedhash_list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-lseek.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-malloca.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-math.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-printf-frexp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-printf-frexpl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-signbit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdbool.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdint.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-stdlib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_stat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_time.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-unistd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-vasnprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-vasprintf-posix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-vasprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wchar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-wctype.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-xvasprintf.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(PROGRAMS) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-checkPROGRAMS clean-generic clean-local \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-local + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-local \ + clean-noinstPROGRAMS ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-local pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + + +# Clean up after Solaris cc. +clean-local: + rm -rf SunWS_cache + +mostlyclean-local: mostlyclean-generic + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done; \ + : +# 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 -ruNp m4-1.4.9/tests/test-alloca-opt.c m4-1.4.10/tests/test-alloca-opt.c --- m4-1.4.9/tests/test-alloca-opt.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-alloca-opt.c 2007-05-30 19:31:04.000000000 -0600 @@ -0,0 +1,63 @@ +/* Test of optional automatic memory allocation. + Copyright (C) 2005, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#if HAVE_ALLOCA + +static void +do_allocation (int n) +{ + void *ptr = alloca (n); + (void) ptr; +} + +void (*func) (int) = do_allocation; + +#endif + +int +main () +{ +#if HAVE_ALLOCA + int i; + + /* Repeat a lot of times, to make sure there's no memory leak. */ + for (i = 0; i < 100000; i++) + { + /* Try various values. + n = 0 gave a crash on Alpha with gcc-2.5.8. + Some versions of MacOS X have a stack size limit of 512 KB. */ + func (34); + func (134); + func (399); + func (510823); + func (129321); + func (0); + func (4070); + func (4095); + func (1); + func (16582); + } +#endif + + return 0; +} diff -ruNp m4-1.4.9/tests/test-array_list.c m4-1.4.10/tests/test-array_list.c --- m4-1.4.9/tests/test-array_list.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-array_list.c 2007-05-30 19:31:05.000000000 -0600 @@ -0,0 +1,325 @@ +/* Test of sequential list data type implementation. + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2007. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#include "gl_array_list.h" + +#include +#include + +#include "progname.h" + +static const char *objects[15] = + { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o" + }; + +#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) +#define RANDOM(n) (rand () % (n)) +#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] + +static void +check_equals (gl_list_t list1, gl_list_t list2) +{ + size_t n, i; + + n = gl_list_size (list1); + ASSERT (n == gl_list_size (list2)); + for (i = 0; i < n; i++) + { + ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i)); + } +} + +int +main (int argc, char *argv[]) +{ + gl_list_t list1, list2; + + set_program_name (argv[0]); + + /* Allow the user to provide a non-default random seed on the command line. */ + if (argc > 1) + srand (atoi (argv[1])); + + { + size_t initial_size = RANDOM (50); + const void **contents = + (const void **) malloc (initial_size * sizeof (const void *)); + size_t i; + unsigned int repeat; + + for (i = 0; i < initial_size; i++) + contents[i] = RANDOM_OBJECT (); + + /* Create list1. */ + list1 = gl_list_create (GL_ARRAY_LIST, NULL, NULL, NULL, true, + initial_size, contents); + /* Create list2. */ + list2 = gl_list_create_empty (GL_ARRAY_LIST, NULL, NULL, NULL, true); + for (i = 0; i < initial_size; i++) + gl_list_add_last (list2, contents[i]); + + check_equals (list1, list2); + + for (repeat = 0; repeat < 10000; repeat++) + { + unsigned int operation = RANDOM (16); + switch (operation) + { + case 0: + if (gl_list_size (list1) > 0) + { + size_t index = RANDOM (gl_list_size (list1)); + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2; + + node1 = gl_list_set_at (list1, index, obj); + ASSERT (gl_list_get_at (list1, index) == obj); + ASSERT (gl_list_node_value (list1, node1) == obj); + + node2 = gl_list_set_at (list2, index, obj); + ASSERT (gl_list_get_at (list2, index) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + + if (index > 0) + { + ASSERT (gl_list_node_value (list1, gl_list_previous_node (list1, node1)) + == gl_list_get_at (list1, index - 1)); + } + if (index + 1 < gl_list_size (list1)) + { + ASSERT (gl_list_node_value (list1, gl_list_next_node (list1, node1)) + == gl_list_get_at (list1, index + 1)); + } + } + break; + case 1: + { + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2; + node1 = gl_list_search (list1, obj); + node2 = gl_list_search (list2, obj); + if (node1 == NULL) + { + ASSERT (node2 == NULL); + } + else + { + ASSERT (node2 != NULL); + ASSERT (gl_list_node_value (list1, node1) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + } + } + break; + case 2: + { + const char *obj = RANDOM_OBJECT (); + size_t index1, index2; + index1 = gl_list_indexof (list1, obj); + index2 = gl_list_indexof (list2, obj); + if (index1 == (size_t)(-1)) + { + ASSERT (index2 == (size_t)(-1)); + } + else + { + ASSERT (index2 != (size_t)(-1)); + ASSERT (gl_list_get_at (list1, index1) == obj); + ASSERT (gl_list_get_at (list2, index2) == obj); + ASSERT (index2 == index1); + } + } + break; + case 3: /* add 1 element */ + { + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2; + node1 = gl_list_add_first (list1, obj); + node2 = gl_list_add_first (list2, obj); + ASSERT (gl_list_node_value (list1, node1) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + ASSERT (gl_list_get_at (list1, 0) == obj); + ASSERT (gl_list_get_at (list2, 0) == obj); + } + break; + case 4: /* add 1 element */ + { + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2; + node1 = gl_list_add_last (list1, obj); + node2 = gl_list_add_last (list2, obj); + ASSERT (gl_list_node_value (list1, node1) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + ASSERT (gl_list_get_at (list1, gl_list_size (list1) - 1) == obj); + ASSERT (gl_list_get_at (list2, gl_list_size (list2) - 1) == obj); + } + break; + case 5: /* add 3 elements */ + { + const char *obj0 = RANDOM_OBJECT (); + const char *obj1 = RANDOM_OBJECT (); + const char *obj2 = RANDOM_OBJECT (); + gl_list_node_t node1, node2; + node1 = gl_list_add_first (list1, obj2); + node1 = gl_list_add_before (list1, node1, obj0); + node1 = gl_list_add_after (list1, node1, obj1); + node2 = gl_list_add_first (list2, obj2); + node2 = gl_list_add_before (list2, node2, obj0); + node2 = gl_list_add_after (list2, node2, obj1); + ASSERT (gl_list_node_value (list1, node1) == obj1); + ASSERT (gl_list_node_value (list2, node2) == obj1); + ASSERT (gl_list_get_at (list1, 0) == obj0); + ASSERT (gl_list_get_at (list1, 1) == obj1); + ASSERT (gl_list_get_at (list1, 2) == obj2); + ASSERT (gl_list_get_at (list2, 0) == obj0); + ASSERT (gl_list_get_at (list2, 1) == obj1); + ASSERT (gl_list_get_at (list2, 2) == obj2); + } + break; + case 6: /* add 1 element */ + { + size_t index = RANDOM (gl_list_size (list1) + 1); + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2; + node1 = gl_list_add_at (list1, index, obj); + node2 = gl_list_add_at (list2, index, obj); + ASSERT (gl_list_get_at (list1, index) == obj); + ASSERT (gl_list_node_value (list1, node1) == obj); + ASSERT (gl_list_get_at (list2, index) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + if (index > 0) + { + ASSERT (gl_list_node_value (list1, gl_list_previous_node (list1, node1)) + == gl_list_get_at (list1, index - 1)); + } + if (index + 1 < gl_list_size (list1)) + { + ASSERT (gl_list_node_value (list1, gl_list_next_node (list1, node1)) + == gl_list_get_at (list1, index + 1)); + } + } + break; + case 7: case 8: /* remove 1 element */ + if (gl_list_size (list1) > 0) + { + size_t n = gl_list_size (list1); + const char *obj = gl_list_get_at (list1, RANDOM (n)); + gl_list_node_t node1, node2; + node1 = gl_list_search (list1, obj); + node2 = gl_list_search (list2, obj); + ASSERT (node1 != NULL); + ASSERT (node2 != NULL); + ASSERT (gl_list_remove_node (list1, node1)); + ASSERT (gl_list_remove_node (list2, node2)); + ASSERT (gl_list_size (list1) == n - 1); + } + break; + case 9: case 10: /* remove 1 element */ + if (gl_list_size (list1) > 0) + { + size_t n = gl_list_size (list1); + size_t index = RANDOM (n); + ASSERT (gl_list_remove_at (list1, index)); + ASSERT (gl_list_remove_at (list2, index)); + ASSERT (gl_list_size (list1) == n - 1); + } + break; + case 11: case 12: /* remove 1 element */ + if (gl_list_size (list1) > 0) + { + size_t n = gl_list_size (list1); + const char *obj = gl_list_get_at (list1, RANDOM (n)); + ASSERT (gl_list_remove (list1, obj)); + ASSERT (gl_list_remove (list2, obj)); + ASSERT (gl_list_size (list1) == n - 1); + } + break; + case 13: + if (gl_list_size (list1) > 0) + { + size_t n = gl_list_size (list1); + const char *obj = "xyzzy"; + ASSERT (!gl_list_remove (list1, obj)); + ASSERT (!gl_list_remove (list2, obj)); + ASSERT (gl_list_size (list1) == n); + } + break; + case 14: + { + size_t n = gl_list_size (list1); + gl_list_iterator_t iter1, iter2; + const void *elt; + iter1 = gl_list_iterator (list1); + iter2 = gl_list_iterator (list2); + for (i = 0; i < n; i++) + { + ASSERT (gl_list_iterator_next (&iter1, &elt, NULL)); + ASSERT (gl_list_get_at (list1, i) == elt); + ASSERT (gl_list_iterator_next (&iter2, &elt, NULL)); + ASSERT (gl_list_get_at (list2, i) == elt); + } + ASSERT (!gl_list_iterator_next (&iter1, &elt, NULL)); + ASSERT (!gl_list_iterator_next (&iter2, &elt, NULL)); + gl_list_iterator_free (&iter1); + gl_list_iterator_free (&iter2); + } + break; + case 15: + { + size_t end = RANDOM (gl_list_size (list1) + 1); + size_t start = RANDOM (end + 1); + gl_list_iterator_t iter1, iter2; + const void *elt; + iter1 = gl_list_iterator_from_to (list1, start, end); + iter2 = gl_list_iterator_from_to (list2, start, end); + for (i = start; i < end; i++) + { + ASSERT (gl_list_iterator_next (&iter1, &elt, NULL)); + ASSERT (gl_list_get_at (list1, i) == elt); + ASSERT (gl_list_iterator_next (&iter2, &elt, NULL)); + ASSERT (gl_list_get_at (list2, i) == elt); + } + ASSERT (!gl_list_iterator_next (&iter1, &elt, NULL)); + ASSERT (!gl_list_iterator_next (&iter2, &elt, NULL)); + gl_list_iterator_free (&iter1); + gl_list_iterator_free (&iter2); + } + break; + } + check_equals (list1, list2); + } + + gl_list_free (list1); + gl_list_free (list2); + free (contents); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-array_oset.c m4-1.4.10/tests/test-array_oset.c --- m4-1.4.9/tests/test-array_oset.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-array_oset.c 2007-05-30 19:31:05.000000000 -0600 @@ -0,0 +1,154 @@ +/* Test of ordered set data type implementation. + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2007. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#include "gl_array_oset.h" + +#include +#include +#include + +#include "gl_array_list.h" +#include "progname.h" + +static const char *objects[30] = + { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", + "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "<", ">", "[", "]" + }; + +#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) +#define RANDOM(n) (rand () % (n)) +#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] + +static void +check_equals (gl_oset_t set1, gl_list_t set2) +{ + size_t n = gl_oset_size (set1); + gl_oset_iterator_t iter1; + gl_list_iterator_t iter2; + const void *elt1; + const void *elt2; + gl_list_node_t node2; + size_t i; + + iter1 = gl_oset_iterator (set1); + iter2 = gl_list_iterator (set2); + for (i = 0; i < n; i++) + { + ASSERT (gl_oset_iterator_next (&iter1, &elt1)); + ASSERT (gl_list_iterator_next (&iter2, &elt2, &node2)); + ASSERT (elt1 == elt2); + } + ASSERT (!gl_oset_iterator_next (&iter1, &elt1)); + ASSERT (!gl_list_iterator_next (&iter2, &elt2, &node2)); + gl_oset_iterator_free (&iter1); + gl_list_iterator_free (&iter2); +} + +static void +check_all (gl_oset_t set1, gl_list_t set2) +{ + check_equals (set1, set2); +} + +int +main (int argc, char *argv[]) +{ + gl_oset_t set1; + gl_list_t set2; + + set_program_name (argv[0]); + + /* Allow the user to provide a non-default random seed on the command line. */ + if (argc > 1) + srand (atoi (argv[1])); + + { + size_t initial_size = RANDOM (20); + size_t i; + unsigned int repeat; + + /* Create set1. */ + set1 = gl_oset_create_empty (GL_ARRAY_OSET, (gl_setelement_compar_fn) strcmp, NULL); + + /* Create set2. */ + set2 = gl_list_create_empty (GL_ARRAY_LIST, NULL, NULL, NULL, false); + + check_all (set1, set2); + + /* Initialize them. */ + for (i = 0; i < initial_size; i++) + { + const char *obj = RANDOM_OBJECT (); + ASSERT (gl_oset_add (set1, obj) + == (gl_sortedlist_search (set2, (gl_listelement_compar_fn)strcmp, obj) != NULL + ? false + : (gl_sortedlist_add (set2, (gl_listelement_compar_fn)strcmp, obj), true))); + check_all (set1, set2); + } + + for (repeat = 0; repeat < 100000; repeat++) + { + unsigned int operation = RANDOM (3); + switch (operation) + { + case 0: + { + const char *obj = RANDOM_OBJECT (); + ASSERT (gl_oset_search (set1, obj) + == (gl_sortedlist_search (set2, (gl_listelement_compar_fn)strcmp, obj) != NULL)); + } + break; + case 1: + { + const char *obj = RANDOM_OBJECT (); + ASSERT (gl_oset_add (set1, obj) + == (gl_sortedlist_search (set2, (gl_listelement_compar_fn)strcmp, obj) != NULL + ? false + : (gl_sortedlist_add (set2, (gl_listelement_compar_fn)strcmp, obj), true))); + } + break; + case 2: + { + const char *obj = RANDOM_OBJECT (); + ASSERT (gl_oset_remove (set1, obj) + == gl_sortedlist_remove (set2, (gl_listelement_compar_fn)strcmp, obj)); + } + break; + } + check_all (set1, set2); + } + + gl_oset_free (set1); + gl_list_free (set2); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-avltree_oset.c m4-1.4.10/tests/test-avltree_oset.c --- m4-1.4.9/tests/test-avltree_oset.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-avltree_oset.c 2007-05-30 19:31:05.000000000 -0600 @@ -0,0 +1,144 @@ +/* Test of ordered set data type implementation. + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#include "gl_avltree_oset.h" + +#include +#include +#include + +#include "gl_array_oset.h" +#include "progname.h" + +extern void gl_avltree_oset_check_invariants (gl_oset_t set); + +static const char *objects[30] = + { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", + "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "<", ">", "[", "]" + }; + +#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) +#define RANDOM(n) (rand () % (n)) +#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] + +static void +check_equals (gl_oset_t set1, gl_oset_t set2) +{ + size_t n = gl_oset_size (set1); + gl_oset_iterator_t iter1, iter2; + const void *elt1; + const void *elt2; + size_t i; + + iter1 = gl_oset_iterator (set1); + iter2 = gl_oset_iterator (set2); + for (i = 0; i < n; i++) + { + ASSERT (gl_oset_iterator_next (&iter1, &elt1)); + ASSERT (gl_oset_iterator_next (&iter2, &elt2)); + ASSERT (elt1 == elt2); + } + ASSERT (!gl_oset_iterator_next (&iter1, &elt1)); + ASSERT (!gl_oset_iterator_next (&iter2, &elt2)); + gl_oset_iterator_free (&iter1); + gl_oset_iterator_free (&iter2); +} + +static void +check_all (gl_oset_t set1, gl_oset_t set2) +{ + gl_avltree_oset_check_invariants (set2); + check_equals (set1, set2); +} + +int +main (int argc, char *argv[]) +{ + gl_oset_t set1, set2; + + /* Allow the user to provide a non-default random seed on the command line. */ + if (argc > 1) + srand (atoi (argv[1])); + + { + size_t initial_size = RANDOM (20); + size_t i; + unsigned int repeat; + + /* Create set1. */ + set1 = gl_oset_create_empty (GL_ARRAY_OSET, (gl_setelement_compar_fn) strcmp, NULL); + + /* Create set2. */ + set2 = gl_oset_create_empty (GL_AVLTREE_OSET, (gl_setelement_compar_fn) strcmp, NULL); + + check_all (set1, set2); + + /* Initialize them. */ + for (i = 0; i < initial_size; i++) + { + const char *obj = RANDOM_OBJECT (); + ASSERT (gl_oset_add (set1, obj) == gl_oset_add (set2, obj)); + check_all (set1, set2); + } + + for (repeat = 0; repeat < 100000; repeat++) + { + unsigned int operation = RANDOM (3); + switch (operation) + { + case 0: + { + const char *obj = RANDOM_OBJECT (); + ASSERT (gl_oset_search (set1, obj) == gl_oset_search (set2, obj)); + } + break; + case 1: + { + const char *obj = RANDOM_OBJECT (); + ASSERT (gl_oset_add (set1, obj) == gl_oset_add (set2, obj)); + } + break; + case 2: + { + const char *obj = RANDOM_OBJECT (); + ASSERT (gl_oset_remove (set1, obj) == gl_oset_remove (set2, obj)); + } + break; + } + check_all (set1, set2); + } + + gl_oset_free (set1); + gl_oset_free (set2); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-binary-io.c m4-1.4.10/tests/test-binary-io.c --- m4-1.4.9/tests/test-binary-io.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-binary-io.c 2007-07-05 05:48:53.000000000 -0600 @@ -0,0 +1,74 @@ +/* Test of binary mode I/O. + Copyright (C) 2005, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2005. */ + +#include + +#include "binary-io.h" + +#include +#include +#include +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main () +{ + /* Test the O_BINARY macro. */ + { + int fd = + open ("t-bin-out2.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600); + if (write (fd, "Hello\n", 6) < 0) + exit (1); + close (fd); + } + { + struct stat statbuf; + if (stat ("t-bin-out2.tmp", &statbuf) < 0) + exit (1); + ASSERT (statbuf.st_size == 6); + } + unlink ("t-bin-out2.tmp"); + + /* Test the SET_BINARY macro. */ + SET_BINARY (1); + fputs ("Hello\n", stdout); + fclose (stdout); + fclose (stderr); + { + struct stat statbuf; + if (stat ("t-bin-out1.tmp", &statbuf) < 0) + exit (1); + ASSERT (statbuf.st_size == 6); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-binary-io.sh m4-1.4.10/tests/test-binary-io.sh --- m4-1.4.9/tests/test-binary-io.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-binary-io.sh 2007-05-30 19:31:05.000000000 -0600 @@ -0,0 +1,11 @@ +#!/bin/sh + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles t-bin-out1.tmp t-bin-out2.tmp" +./test-binary-io${EXEEXT} > t-bin-out1.tmp || exit 1 + +rm -fr $tmpfiles + +exit 0 diff -ruNp m4-1.4.9/tests/test-closein.c m4-1.4.10/tests/test-closein.c --- m4-1.4.9/tests/test-closein.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-closein.c 2007-05-30 19:31:05.000000000 -0600 @@ -0,0 +1,49 @@ +/* Test of closein module. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake. */ + +#include + +#include "closein.h" + +#include +#include + +#include "binary-io.h" + +char *program_name; + +/* With no arguments, do nothing. With arguments, attempt to consume + first 6 bytes of stdin. In either case, let exit() take care of + closing std streams and changing exit status if ferror(stdin). */ +int +main (int argc, char **argv) +{ + char buf[7]; + int i = -1; + atexit(close_stdin); + program_name = argv[0]; + + /* close_stdin currently relies on ftell, but mingw ftell is + unreliable on text mode input. */ + SET_BINARY (0); + + if (argc > 1) + i = fread (buf, 1, 6, stdin); + return 0; +} diff -ruNp m4-1.4.9/tests/test-closein.sh m4-1.4.10/tests/test-closein.sh --- m4-1.4.9/tests/test-closein.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-closein.sh 2007-05-30 19:31:06.000000000 -0600 @@ -0,0 +1,38 @@ +#!/bin/sh + +tmpfiles= +trap 'rm -fr $tmpfiles' 1 2 3 15 + +p=t-closein- +tmpfiles="${p}in.tmp ${p}xout.tmp ${p}out1.tmp ${p}out2.tmp" + +echo Hello world > ${p}in.tmp +echo world > ${p}xout.tmp + +# Test with seekable stdin; followon process must see remaining data +(./test-closein${EXEEXT}; cat) < ${p}in.tmp > ${p}out1.tmp || exit 1 +cmp ${p}out1.tmp ${p}in.tmp || exit 1 + +(./test-closein${EXEEXT} consume; cat) < ${p}in.tmp > ${p}out2.tmp || exit 1 +cmp ${p}out2.tmp ${p}xout.tmp || exit 1 + +# Test for lack of error on pipe +cat ${p}in.tmp | ./test-closein${EXEEXT} || exit 1 + +cat ${p}in.tmp | ./test-closein${EXEEXT} consume || exit 1 + +# Test for lack of error when nothing is read +./test-closein${EXEEXT} /dev/null && exit 1 + +# Cleanup +rm -fr $tmpfiles + +exit 0 diff -ruNp m4-1.4.9/tests/test-fflush.c m4-1.4.10/tests/test-fflush.c --- m4-1.4.9/tests/test-fflush.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-fflush.c 2007-07-05 05:48:54.000000000 -0600 @@ -0,0 +1,139 @@ +/* Test of POSIX compatible fflush() function. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake, 2007. */ + +#include + +#include +#include + +int +main (int argc, char *argv[]) +{ + FILE *f; + char buffer[10]; + int fd; + + /* Create test file. */ + f = fopen ("test-fflush.txt", "w"); + if (!f || fwrite ("1234567890ABCDEFG", 1, 17, f) != 17 || fclose (f) != 0) + { + fputs ("Failed to create sample file.\n", stderr); + unlink ("test-fflush.txt"); + return 1; + } + + /* Test fflush. */ + f = fopen ("test-fflush.txt", "r"); + fd = fileno (f); + if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5) + { + fputs ("Failed initial read of sample file.\n", stderr); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + /* For deterministic results, ensure f read a bigger buffer. + This is not the case on BeOS, nor on uClibc. */ +#if !(defined __BEOS__ || defined __UCLIBC__) + if (lseek (fd, 0, SEEK_CUR) == 5) + { + fputs ("Sample file was not buffered after fread.\n", stderr); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } +#endif + /* POSIX requires fflush-fseek to set file offset of fd. */ + if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0) + { + fputs ("Failed to flush-fseek sample file.\n", stderr); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + /* Check that offset is correct. */ + if (lseek (fd, 0, SEEK_CUR) != 5) + { + fprintf (stderr, "File offset is wrong after fseek: %ld.\n", + (long) lseek (fd, 0, SEEK_CUR)); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + if (ftell (f) != 5) + { + fprintf (stderr, "ftell result is wrong after fseek: %ld.\n", + (long) ftell (f)); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + /* Check that file reading resumes at correct location. */ + if (fgetc (f) != '6') + { + fputs ("Failed to read next byte after fseek.\n", stderr); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + /* For deterministic results, ensure f read a bigger buffer. */ + if (lseek (fd, 0, SEEK_CUR) == 6) + { + fputs ("Sample file was not buffered after fgetc.\n", stderr); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + /* POSIX requires fflush-fseeko to set file offset of fd. */ + if (fflush (f) != 0 || fseeko (f, 0, SEEK_CUR) != 0) + { + fputs ("Failed to flush-fseeko sample file.\n", stderr); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + /* Check that offset is correct. */ + if (lseek (fd, 0, SEEK_CUR) != 6) + { + fprintf (stderr, "File offset is wrong after fseeko: %ld.\n", + (long) lseek (fd, 0, SEEK_CUR)); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + if (ftell (f) != 6) + { + fprintf (stderr, "ftell result is wrong after fseeko: %ld.\n", + (long) ftell (f)); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + /* Check that file reading resumes at correct location. */ + if (fgetc (f) != '7') + { + fputs ("Failed to read next byte after fseeko.\n", stderr); + fclose (f); + unlink ("test-fflush.txt"); + return 1; + } + fclose (f); + unlink ("test-fflush.txt"); + return 0; +} diff -ruNp m4-1.4.9/tests/test-fpurge.c m4-1.4.10/tests/test-fpurge.c --- m4-1.4.9/tests/test-fpurge.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-fpurge.c 2007-05-30 19:31:06.000000000 -0600 @@ -0,0 +1,88 @@ +/* Test of fpurge() function. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "fpurge.h" + +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +#define TESTFILE "t-fpurge.tmp" + +int +main () +{ + FILE *fp; + + /* Create a file with some contents. */ + fp = fopen (TESTFILE, "w"); + if (fp == NULL) + goto skip; + if (fwrite ("foobarsh", 1, 8, fp) < 8) + goto skip; + if (fclose (fp)) + goto skip; + + /* Open it in read-write mode. */ + fp = fopen (TESTFILE, "r+"); + if (fp == NULL) + goto skip; + if (fseek (fp, 3, SEEK_CUR)) + goto skip; + if (fwrite ("g", 1, 1, fp) < 1) + goto skip; + if (fflush (fp)) + goto skip; + if (fwrite ("az", 1, 2, fp) < 2) + goto skip; + ASSERT (fpurge (fp) == 0); + ASSERT (fclose (fp) == 0); + + /* Open it in read-only mode. */ + fp = fopen (TESTFILE, "r"); + if (fp == NULL) + goto skip; + { + char buf[8]; + if (fread (buf, 1, 8, fp) < 8) + goto skip; + ASSERT (memcmp (buf, "foogarsh", 8) == 0); + } + ASSERT (fpurge (fp) == 0); + ASSERT (fclose (fp) == 0); + + return 0; + + skip: + fprintf (stderr, "Skipping test: file operations failed.\n"); + return 77; +} diff -ruNp m4-1.4.9/tests/test-freading.c m4-1.4.10/tests/test-freading.c --- m4-1.4.9/tests/test-freading.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-freading.c 2007-05-30 19:31:06.000000000 -0600 @@ -0,0 +1,172 @@ +/* Test of freading() function. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "freading.h" + +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +#define TESTFILE "t-freading.tmp" + +int +main () +{ + FILE *fp; + + /* Create a file with some contents. Write-only file is never reading. */ + fp = fopen (TESTFILE, "w"); + if (fp == NULL) + goto skip; + ASSERT (!freading (fp)); + if (fwrite ("foobarsh", 1, 8, fp) < 8) + goto skip; + ASSERT (!freading (fp)); + if (fclose (fp)) + goto skip; + + /* Open it in read-only mode. Read-only file is always reading. */ + fp = fopen (TESTFILE, "r"); + if (fp == NULL) + goto skip; + ASSERT (freading (fp)); + if (fgetc (fp) != 'f') + goto skip; + ASSERT (freading (fp)); + if (fseek (fp, 2, SEEK_CUR)) + goto skip; + ASSERT (freading (fp)); + if (fgetc (fp) != 'b') + goto skip; + ASSERT (freading (fp)); + fflush (fp); + ASSERT (freading (fp)); + if (fgetc (fp) != 'a') + goto skip; + ASSERT (freading (fp)); + if (fseek (fp, 0, SEEK_END)) + goto skip; + ASSERT (freading (fp)); + if (fclose (fp)) + goto skip; + + /* Open it in read-write mode. POSIX requires a reposition (fseek, + fsetpos, rewind) or EOF when transitioning from read to write; + freading is only deterministic after input or output, but this + test case should be portable even on open, after reposition, and + at EOF. */ + /* First a scenario with only fgetc, fseek, fputc. */ + fp = fopen (TESTFILE, "r+"); + if (fp == NULL) + goto skip; + ASSERT (!freading (fp)); + if (fgetc (fp) != 'f') + goto skip; + ASSERT (freading (fp)); + if (fseek (fp, 2, SEEK_CUR)) + goto skip; + /* freading (fp) is undefined here, but fwriting (fp) is false. */ + if (fgetc (fp) != 'b') + goto skip; + ASSERT (freading (fp)); + /* This fseek call is necessary when switching from reading to writing. + See the description of fopen(), ISO C 99 7.19.5.3.(6). */ + if (fseek (fp, 0, SEEK_CUR) != 0) + goto skip; + /* freading (fp) is undefined here, but fwriting (fp) is false. */ + if (fputc ('x', fp) != 'x') + goto skip; + ASSERT (!freading (fp)); + if (fseek (fp, 0, SEEK_END)) + goto skip; + /* freading (fp) is undefined here, because on some implementations (e.g. + glibc) fseek causes a buffer to be read. + fwriting (fp) is undefined as well. */ + if (fclose (fp)) + goto skip; + + /* Open it in read-write mode. POSIX requires a reposition (fseek, + fsetpos, rewind) or EOF when transitioning from read to write; + freading is only deterministic after input or output, but this + test case should be portable even on open, after reposition, and + at EOF. */ + /* Here a scenario that includes fflush. */ + fp = fopen (TESTFILE, "r+"); + if (fp == NULL) + goto skip; + ASSERT (!freading (fp)); + if (fgetc (fp) != 'f') + goto skip; + ASSERT (freading (fp)); + if (fseek (fp, 2, SEEK_CUR)) + goto skip; + /* freading (fp) is undefined here, but fwriting (fp) is false. */ + if (fgetc (fp) != 'b') + goto skip; + ASSERT (freading (fp)); + fflush (fp); + /* freading (fp) is undefined here, but fwriting (fp) is false. */ + if (fgetc (fp) != 'x') + goto skip; + ASSERT (freading (fp)); + /* This fseek call is necessary when switching from reading to writing. + See the description of fopen(), ISO C 99 7.19.5.3.(6). */ + if (fseek (fp, 0, SEEK_CUR) != 0) + goto skip; + /* freading (fp) is undefined here, but fwriting (fp) is false. */ + if (fputc ('z', fp) != 'z') + goto skip; + ASSERT (!freading (fp)); + if (fseek (fp, 0, SEEK_END)) + goto skip; + /* freading (fp) is undefined here, because on some implementations (e.g. + glibc) fseek causes a buffer to be read. + fwriting (fp) is undefined as well. */ + if (fclose (fp)) + goto skip; + + /* Open it in append mode. Write-only file is never reading. */ + fp = fopen (TESTFILE, "a"); + if (fp == NULL) + goto skip; + ASSERT (!freading (fp)); + if (fwrite ("bla", 1, 3, fp) < 3) + goto skip; + ASSERT (!freading (fp)); + if (fclose (fp)) + goto skip; + + return 0; + + skip: + fprintf (stderr, "Skipping test: file operations failed.\n"); + return 77; +} diff -ruNp m4-1.4.9/tests/test-frexpl.c m4-1.4.10/tests/test-frexpl.c --- m4-1.4.9/tests/test-frexpl.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-frexpl.c 2007-07-05 05:48:55.000000000 -0600 @@ -0,0 +1,211 @@ +/* Test of splitting a 'long double' into fraction and mantissa. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#include +#include +#include + +#include "fpucw.h" +#include "isnanl-nolibm.h" + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +/* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable + exponent for 'long double' is -964. Similarly, on PowerPC machines, + LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' + is -968. For exponents below that, the precision may be truncated to the + precision used for 'double'. */ +#ifdef __sgi +# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 57) +#elif defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__ +# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53) +#else +# define MIN_NORMAL_EXP LDBL_MIN_EXP +#endif + +static long double +my_ldexp (long double x, int d) +{ + for (; d > 0; d--) + x *= 2.0L; + for (; d < 0; d++) + x *= 0.5L; + return x; +} + +int +main () +{ + int i; + long double x; + DECL_LONG_DOUBLE_ROUNDING + + BEGIN_LONG_DOUBLE_ROUNDING (); + + { /* NaN. */ + int exp = -9999; + long double mantissa; + x = 0.0L / 0.0L; + mantissa = frexpl (x, &exp); + ASSERT (isnanl (mantissa)); + } + + { /* Positive infinity. */ + int exp = -9999; + long double mantissa; + x = 1.0L / 0.0L; + mantissa = frexpl (x, &exp); + ASSERT (mantissa == x); + } + + { /* Negative infinity. */ + int exp = -9999; + long double mantissa; + x = -1.0L / 0.0L; + mantissa = frexpl (x, &exp); + ASSERT (mantissa == x); + } + + { /* Positive zero. */ + int exp = -9999; + long double mantissa; + x = 0.0L; + mantissa = frexpl (x, &exp); + ASSERT (exp == 0); + ASSERT (mantissa == x); + ASSERT (!signbit (mantissa)); + } + + { /* Negative zero. */ + int exp = -9999; + long double mantissa; + x = -0.0L; + mantissa = frexpl (x, &exp); + ASSERT (exp == 0); + ASSERT (mantissa == x); + ASSERT (signbit (mantissa)); + } + + for (i = 1, x = 1.0L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.5L); + } + for (i = 1, x = 1.0L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.5L); + } + for (; i >= LDBL_MIN_EXP - 100 && x > 0.0L; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.5L); + } + + for (i = 1, x = -1.0L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == -0.5L); + } + for (i = 1, x = -1.0L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == -0.5L); + } + for (; i >= LDBL_MIN_EXP - 100 && x < 0.0L; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == -0.5L); + } + + for (i = 1, x = 1.01L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.505L); + } + for (i = 1, x = 1.01L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.505L); + } + for (; i >= LDBL_MIN_EXP - 100 && x > 0.0L; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa >= 0.5L); + ASSERT (mantissa < 1.0L); + ASSERT (mantissa == my_ldexp (x, - exp)); + } + + for (i = 1, x = 1.73205L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.866025L); + } + for (i = 1, x = 1.73205L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i); + ASSERT (mantissa == 0.866025L); + } + for (; i >= LDBL_MIN_EXP - 100 && x > 0.0L; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = frexpl (x, &exp); + ASSERT (exp == i || exp == i + 1); + ASSERT (mantissa >= 0.5L); + ASSERT (mantissa < 1.0L); + ASSERT (mantissa == my_ldexp (x, - exp)); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-fseeko.c m4-1.4.10/tests/test-fseeko.c --- m4-1.4.9/tests/test-fseeko.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-fseeko.c 2007-05-30 19:31:07.000000000 -0600 @@ -0,0 +1,36 @@ +/* Test of fseeko() function. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +/* Get off_t. */ +#include + +int +main (int argc, char **argv) +{ + /* Assume stdin is seekable iff argc > 1. */ + int expected = argc > 1 ? 0 : -1; + /* Exit with success only if fseek/fseeko agree. */ + int r1 = fseeko (stdin, (off_t)0, SEEK_CUR); + int r2 = fseek (stdin, (long)0, SEEK_CUR); + return ! (r1 == r2 && r1 == expected); +} diff -ruNp m4-1.4.9/tests/test-fseeko.sh m4-1.4.10/tests/test-fseeko.sh --- m4-1.4.9/tests/test-fseeko.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-fseeko.sh 2007-05-30 19:31:07.000000000 -0600 @@ -0,0 +1,5 @@ +#!/bin/sh + +./test-fseeko${EXEEXT} 1 < "$srcdir/test-fseeko.sh" || exit 1 +echo hi | ./test-fseeko${EXEEXT} || exit 1 +exit 0 diff -ruNp m4-1.4.9/tests/test-ftello.c m4-1.4.10/tests/test-ftello.c --- m4-1.4.9/tests/test-ftello.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-ftello.c 2007-05-30 19:31:07.000000000 -0600 @@ -0,0 +1,36 @@ +/* Test of ftello() function. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +/* Get off_t. */ +#include + +int +main (int argc, char **argv) +{ + /* Assume stdin is seekable iff argc > 1. */ + int expected = argc > 1 ? 0 : -1; + /* Exit with success only if ftell/ftello agree. */ + off_t pos1 = ftello (stdin); + long pos2 = ftell (stdin); + return ! (pos1 == pos2 && pos1 == expected); +} diff -ruNp m4-1.4.9/tests/test-ftello.sh m4-1.4.10/tests/test-ftello.sh --- m4-1.4.9/tests/test-ftello.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-ftello.sh 2007-05-30 19:31:07.000000000 -0600 @@ -0,0 +1,5 @@ +#!/bin/sh + +./test-ftello${EXEEXT} 1 < "$srcdir/test-ftello.sh" || exit 1 +echo hi | ./test-ftello${EXEEXT} || exit 1 +exit 0 diff -ruNp m4-1.4.9/tests/test-gettimeofday.c m4-1.4.10/tests/test-gettimeofday.c --- m4-1.4.9/tests/test-gettimeofday.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-gettimeofday.c 2007-05-30 19:31:08.000000000 -0600 @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2005, 2007 Free Software Foundation + * Written by Jim Meyering. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ + +#include + +#include +#include + +#include +#include + +int +main (int argc, char *argv[]) +{ + time_t t = 0; + struct tm *lt; + struct tm saved_lt; + struct timeval tv; + lt = localtime (&t); + saved_lt = *lt; + gettimeofday (&tv, NULL); + if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0) + { + fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n"); + return 1; + } + else + { + return 0; + } +} diff -ruNp m4-1.4.9/tests/test-isnan.c m4-1.4.10/tests/test-isnan.c --- m4-1.4.9/tests/test-isnan.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-isnan.c 2007-05-30 19:31:08.000000000 -0600 @@ -0,0 +1,86 @@ +/* Test of isnan() substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "isnan.h" + +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static double +NaN () +{ + static double zero = 0.0; + return zero / zero; +} +#else +# define NaN() (0.0 / 0.0) +#endif + +int +main () +{ + /* Finite values. */ + ASSERT (!isnan (3.141)); + ASSERT (!isnan (3.141e30)); + ASSERT (!isnan (3.141e-30)); + ASSERT (!isnan (-2.718)); + ASSERT (!isnan (-2.718e30)); + ASSERT (!isnan (-2.718e-30)); + /* Infinite values. */ + ASSERT (!isnan (1.0 / 0.0)); + ASSERT (!isnan (-1.0 / 0.0)); + /* Quiet NaN. */ + ASSERT (isnan (NaN ())); +#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT + /* Signalling NaN. */ + { + #define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + typedef union { double value; unsigned int word[NWORDS]; } memory_double; + memory_double m; + m.value = NaN (); +# if DBL_EXPBIT0_BIT > 0 + m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1); +# else + m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); +# endif + m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + |= (unsigned int) 1 << DBL_EXPBIT0_BIT; + ASSERT (isnan (m.value)); + } +#endif + return 0; +} diff -ruNp m4-1.4.9/tests/test-isnanf.c m4-1.4.10/tests/test-isnanf.c --- m4-1.4.9/tests/test-isnanf.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-isnanf.c 2007-05-30 19:31:08.000000000 -0600 @@ -0,0 +1,88 @@ +/* Test of isnanf() substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "isnanf.h" + +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static float +NaN () +{ + static float zero = 0.0f; + return zero / zero; +} +#else +# define NaN() (0.0f / 0.0f) +#endif + +int +main () +{ + /* Finite values. */ + ASSERT (!isnanf (3.141f)); + ASSERT (!isnanf (3.141e30f)); + ASSERT (!isnanf (3.141e-30f)); + ASSERT (!isnanf (-2.718f)); + ASSERT (!isnanf (-2.718e30f)); + ASSERT (!isnanf (-2.718e-30f)); + /* Infinite values. */ + ASSERT (!isnanf (1.0f / 0.0f)); + ASSERT (!isnanf (-1.0f / 0.0f)); + /* Quiet NaN. */ + ASSERT (isnanf (NaN ())); +#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT + /* Signalling NaN. */ + { + #define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + typedef union { float value; unsigned int word[NWORDS]; } memory_float; + memory_float m; + m.value = NaN (); +# if FLT_EXPBIT0_BIT > 0 + m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1); +# else + m.word[FLT_EXPBIT0_WORD + (FLT_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); +# endif + if (FLT_EXPBIT0_WORD < NWORDS / 2) + m.word[FLT_EXPBIT0_WORD + 1] |= (unsigned int) 1 << FLT_EXPBIT0_BIT; + else + m.word[0] |= (unsigned int) 1; + ASSERT (isnanf (m.value)); + } +#endif + return 0; +} diff -ruNp m4-1.4.9/tests/test-isnanl-nolibm.c m4-1.4.10/tests/test-isnanl-nolibm.c --- m4-1.4.9/tests/test-isnanl-nolibm.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-isnanl-nolibm.c 2007-05-30 19:31:08.000000000 -0600 @@ -0,0 +1,24 @@ +/* Test of isnanl() substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "isnanl-nolibm.h" + +#include "test-isnanl.h" diff -ruNp m4-1.4.9/tests/test-isnanl.h m4-1.4.10/tests/test-isnanl.h --- m4-1.4.9/tests/test-isnanl.h 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-isnanl.h 2007-07-05 05:48:56.000000000 -0600 @@ -0,0 +1,134 @@ +/* Test of isnanl() substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main () +{ + #define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + typedef union { unsigned int word[NWORDS]; long double value; } + memory_long_double; + + /* Finite values. */ + ASSERT (!isnanl (3.141L)); + ASSERT (!isnanl (3.141e30L)); + ASSERT (!isnanl (3.141e-30L)); + ASSERT (!isnanl (-2.718L)); + ASSERT (!isnanl (-2.718e30L)); + ASSERT (!isnanl (-2.718e-30L)); + /* Infinite values. */ + ASSERT (!isnanl (1.0L / 0.0L)); + ASSERT (!isnanl (-1.0L / 0.0L)); + /* Quiet NaN. */ + ASSERT (isnanl (0.0L / 0.0L)); + +#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT + /* A bit pattern that is different from a Quiet NaN. With a bit of luck, + it's a Signalling NaN. */ + { + memory_long_double m; + m.value = 0.0L / 0.0L; +# if LDBL_EXPBIT0_BIT > 0 + m.word[LDBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (LDBL_EXPBIT0_BIT - 1); +# else + m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); +# endif + m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + |= (unsigned int) 1 << LDBL_EXPBIT0_BIT; + ASSERT (isnanl (m.value)); + } +#endif + +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + ASSERT (isnanl (x.value)); + } + { + /* Signalling NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + ASSERT (isnanl (x.value)); + } + /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in + Intel IA-64 Architecture Software Developer's Manual, Volume 1: + Application Architecture. + Table 5-2 "Floating-Point Register Encodings" + Figure 5-6 "Memory to Floating-Point Register Data Translation" + */ + { /* Pseudo-NaN. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + ASSERT (isnanl (x.value)); + } + { /* Pseudo-Infinity. */ + static memory_long_double x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + ASSERT (isnanl (x.value)); + } + { /* Pseudo-Zero. */ + static memory_long_double x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + ASSERT (isnanl (x.value)); + } + { /* Unnormalized number. */ + static memory_long_double x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + ASSERT (isnanl (x.value)); + } + { /* Pseudo-Denormal. */ + static memory_long_double x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + ASSERT (isnanl (x.value)); + } +#endif + + return 0; +} diff -ruNp m4-1.4.9/tests/test-linkedhash_list.c m4-1.4.10/tests/test-linkedhash_list.c --- m4-1.4.9/tests/test-linkedhash_list.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-linkedhash_list.c 2007-05-30 19:31:09.000000000 -0600 @@ -0,0 +1,429 @@ +/* Test of sequential list data type implementation. + Copyright (C) 2006-2007 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +#include "gl_linkedhash_list.h" + +#include +#include +#include +#include + +#include "gl_array_list.h" +#include "progname.h" + +static const char *objects[15] = + { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o" + }; + +#define SIZE_BITS (sizeof (size_t) * CHAR_BIT) + +static bool +string_equals (const void *x1, const void *x2) +{ + const char *s1 = x1; + const char *s2 = x2; + return strcmp (s1, s2) == 0; +} + +/* A hash function for NUL-terminated char* strings using + the method described by Bruno Haible. + See http://www.haible.de/bruno/hashfunc.html. */ +static size_t +string_hash (const void *x) +{ + const char *s = x; + size_t h = 0; + + for (; *s; s++) + h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); + + return h; +} + +#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) +#define RANDOM(n) (rand () % (n)) +#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] + +static void +check_equals (gl_list_t list1, gl_list_t list2) +{ + size_t n, i; + + n = gl_list_size (list1); + ASSERT (n == gl_list_size (list2)); + for (i = 0; i < n; i++) + { + ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i)); + } +} + +static void +check_all (gl_list_t list1, gl_list_t list2, gl_list_t list3) +{ + check_equals (list1, list2); + check_equals (list1, list3); +} + +int +main (int argc, char *argv[]) +{ + gl_list_t list1, list2, list3; + + set_program_name (argv[0]); + + /* Allow the user to provide a non-default random seed on the command line. */ + if (argc > 1) + srand (atoi (argv[1])); + + { + size_t initial_size = RANDOM (50); + const void **contents = + (const void **) malloc (initial_size * sizeof (const void *)); + size_t i; + unsigned int repeat; + + for (i = 0; i < initial_size; i++) + contents[i] = RANDOM_OBJECT (); + + /* Create list1. */ + list1 = gl_list_create (GL_ARRAY_LIST, + string_equals, string_hash, NULL, true, + initial_size, contents); + /* Create list2. */ + list2 = gl_list_create_empty (GL_LINKEDHASH_LIST, + string_equals, string_hash, NULL, true); + for (i = 0; i < initial_size; i++) + gl_list_add_last (list2, contents[i]); + + /* Create list3. */ + list3 = gl_list_create (GL_LINKEDHASH_LIST, + string_equals, string_hash, NULL, true, + initial_size, contents); + + check_all (list1, list2, list3); + + for (repeat = 0; repeat < 10000; repeat++) + { + unsigned int operation = RANDOM (16); + switch (operation) + { + case 0: + if (gl_list_size (list1) > 0) + { + size_t index = RANDOM (gl_list_size (list1)); + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2, node3; + + node1 = gl_list_set_at (list1, index, obj); + ASSERT (gl_list_get_at (list1, index) == obj); + ASSERT (gl_list_node_value (list1, node1) == obj); + + node2 = gl_list_set_at (list2, index, obj); + ASSERT (gl_list_get_at (list2, index) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + + node3 = gl_list_set_at (list3, index, obj); + ASSERT (gl_list_get_at (list3, index) == obj); + ASSERT (gl_list_node_value (list3, node3) == obj); + + if (index > 0) + { + ASSERT (gl_list_node_value (list1, gl_list_previous_node (list1, node1)) + == gl_list_get_at (list1, index - 1)); + ASSERT (gl_list_node_value (list2, gl_list_previous_node (list3, node3)) + == gl_list_get_at (list2, index - 1)); + ASSERT (gl_list_node_value (list3, gl_list_previous_node (list3, node3)) + == gl_list_get_at (list2, index - 1)); + } + if (index + 1 < gl_list_size (list1)) + { + ASSERT (gl_list_node_value (list1, gl_list_next_node (list1, node1)) + == gl_list_get_at (list1, index + 1)); + ASSERT (gl_list_node_value (list2, gl_list_next_node (list3, node3)) + == gl_list_get_at (list2, index + 1)); + ASSERT (gl_list_node_value (list3, gl_list_next_node (list3, node3)) + == gl_list_get_at (list2, index + 1)); + } + } + break; + case 1: + { + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2, node3; + node1 = gl_list_search (list1, obj); + node2 = gl_list_search (list2, obj); + node3 = gl_list_search (list3, obj); + if (node1 == NULL) + { + ASSERT (node2 == NULL); + ASSERT (node3 == NULL); + } + else + { + ASSERT (node2 != NULL); + ASSERT (node3 != NULL); + ASSERT (gl_list_node_value (list1, node1) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + ASSERT (gl_list_node_value (list3, node3) == obj); + } + } + break; + case 2: + { + const char *obj = RANDOM_OBJECT (); + size_t index1, index2, index3; + index1 = gl_list_indexof (list1, obj); + index2 = gl_list_indexof (list2, obj); + index3 = gl_list_indexof (list3, obj); + if (index1 == (size_t)(-1)) + { + ASSERT (index2 == (size_t)(-1)); + ASSERT (index3 == (size_t)(-1)); + } + else + { + ASSERT (index2 != (size_t)(-1)); + ASSERT (index3 != (size_t)(-1)); + ASSERT (gl_list_get_at (list1, index1) == obj); + ASSERT (gl_list_get_at (list2, index2) == obj); + ASSERT (gl_list_get_at (list3, index3) == obj); + ASSERT (index2 == index1); + ASSERT (index3 == index1); + } + } + break; + case 3: /* add 1 element */ + { + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2, node3; + node1 = gl_list_add_first (list1, obj); + node2 = gl_list_add_first (list2, obj); + node3 = gl_list_add_first (list3, obj); + ASSERT (gl_list_node_value (list1, node1) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + ASSERT (gl_list_node_value (list3, node3) == obj); + ASSERT (gl_list_get_at (list1, 0) == obj); + ASSERT (gl_list_get_at (list2, 0) == obj); + ASSERT (gl_list_get_at (list3, 0) == obj); + } + break; + case 4: /* add 1 element */ + { + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2, node3; + node1 = gl_list_add_last (list1, obj); + node2 = gl_list_add_last (list2, obj); + node3 = gl_list_add_last (list3, obj); + ASSERT (gl_list_node_value (list1, node1) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + ASSERT (gl_list_node_value (list3, node3) == obj); + ASSERT (gl_list_get_at (list1, gl_list_size (list1) - 1) == obj); + ASSERT (gl_list_get_at (list2, gl_list_size (list2) - 1) == obj); + ASSERT (gl_list_get_at (list3, gl_list_size (list3) - 1) == obj); + } + break; + case 5: /* add 3 elements */ + { + const char *obj0 = RANDOM_OBJECT (); + const char *obj1 = RANDOM_OBJECT (); + const char *obj2 = RANDOM_OBJECT (); + gl_list_node_t node1, node2, node3; + node1 = gl_list_add_first (list1, obj2); + node1 = gl_list_add_before (list1, node1, obj0); + node1 = gl_list_add_after (list1, node1, obj1); + node2 = gl_list_add_first (list2, obj2); + node2 = gl_list_add_before (list2, node2, obj0); + node2 = gl_list_add_after (list2, node2, obj1); + node3 = gl_list_add_first (list3, obj2); + node3 = gl_list_add_before (list3, node3, obj0); + node3 = gl_list_add_after (list3, node3, obj1); + ASSERT (gl_list_node_value (list1, node1) == obj1); + ASSERT (gl_list_node_value (list2, node2) == obj1); + ASSERT (gl_list_node_value (list3, node3) == obj1); + ASSERT (gl_list_get_at (list1, 0) == obj0); + ASSERT (gl_list_get_at (list1, 1) == obj1); + ASSERT (gl_list_get_at (list1, 2) == obj2); + ASSERT (gl_list_get_at (list2, 0) == obj0); + ASSERT (gl_list_get_at (list2, 1) == obj1); + ASSERT (gl_list_get_at (list2, 2) == obj2); + ASSERT (gl_list_get_at (list3, 0) == obj0); + ASSERT (gl_list_get_at (list3, 1) == obj1); + ASSERT (gl_list_get_at (list3, 2) == obj2); + } + break; + case 6: /* add 1 element */ + { + size_t index = RANDOM (gl_list_size (list1) + 1); + const char *obj = RANDOM_OBJECT (); + gl_list_node_t node1, node2, node3; + node1 = gl_list_add_at (list1, index, obj); + node2 = gl_list_add_at (list2, index, obj); + node3 = gl_list_add_at (list3, index, obj); + ASSERT (gl_list_get_at (list1, index) == obj); + ASSERT (gl_list_node_value (list1, node1) == obj); + ASSERT (gl_list_get_at (list2, index) == obj); + ASSERT (gl_list_node_value (list2, node2) == obj); + ASSERT (gl_list_get_at (list3, index) == obj); + ASSERT (gl_list_node_value (list3, node3) == obj); + if (index > 0) + { + ASSERT (gl_list_node_value (list1, gl_list_previous_node (list1, node1)) + == gl_list_get_at (list1, index - 1)); + ASSERT (gl_list_node_value (list2, gl_list_previous_node (list3, node3)) + == gl_list_get_at (list2, index - 1)); + ASSERT (gl_list_node_value (list3, gl_list_previous_node (list3, node3)) + == gl_list_get_at (list2, index - 1)); + } + if (index + 1 < gl_list_size (list1)) + { + ASSERT (gl_list_node_value (list1, gl_list_next_node (list1, node1)) + == gl_list_get_at (list1, index + 1)); + ASSERT (gl_list_node_value (list2, gl_list_next_node (list3, node3)) + == gl_list_get_at (list2, index + 1)); + ASSERT (gl_list_node_value (list3, gl_list_next_node (list3, node3)) + == gl_list_get_at (list2, index + 1)); + } + } + break; + case 7: case 8: /* remove 1 element */ + if (gl_list_size (list1) > 0) + { + size_t n = gl_list_size (list1); + const char *obj = gl_list_get_at (list1, RANDOM (n)); + gl_list_node_t node1, node2, node3; + node1 = gl_list_search (list1, obj); + node2 = gl_list_search (list2, obj); + node3 = gl_list_search (list3, obj); + ASSERT (node1 != NULL); + ASSERT (node2 != NULL); + ASSERT (node3 != NULL); + ASSERT (gl_list_remove_node (list1, node1)); + ASSERT (gl_list_remove_node (list2, node2)); + ASSERT (gl_list_remove_node (list3, node3)); + ASSERT (gl_list_size (list1) == n - 1); + } + break; + case 9: case 10: /* remove 1 element */ + if (gl_list_size (list1) > 0) + { + size_t n = gl_list_size (list1); + size_t index = RANDOM (n); + ASSERT (gl_list_remove_at (list1, index)); + ASSERT (gl_list_remove_at (list2, index)); + ASSERT (gl_list_remove_at (list3, index)); + ASSERT (gl_list_size (list1) == n - 1); + } + break; + case 11: case 12: /* remove 1 element */ + if (gl_list_size (list1) > 0) + { + size_t n = gl_list_size (list1); + const char *obj = gl_list_get_at (list1, RANDOM (n)); + ASSERT (gl_list_remove (list1, obj)); + ASSERT (gl_list_remove (list2, obj)); + ASSERT (gl_list_remove (list3, obj)); + ASSERT (gl_list_size (list1) == n - 1); + } + break; + case 13: + if (gl_list_size (list1) > 0) + { + size_t n = gl_list_size (list1); + const char *obj = "xyzzy"; + ASSERT (!gl_list_remove (list1, obj)); + ASSERT (!gl_list_remove (list2, obj)); + ASSERT (!gl_list_remove (list3, obj)); + ASSERT (gl_list_size (list1) == n); + } + break; + case 14: + { + size_t n = gl_list_size (list1); + gl_list_iterator_t iter1, iter2, iter3; + const void *elt; + iter1 = gl_list_iterator (list1); + iter2 = gl_list_iterator (list2); + iter3 = gl_list_iterator (list3); + for (i = 0; i < n; i++) + { + ASSERT (gl_list_iterator_next (&iter1, &elt, NULL)); + ASSERT (gl_list_get_at (list1, i) == elt); + ASSERT (gl_list_iterator_next (&iter2, &elt, NULL)); + ASSERT (gl_list_get_at (list2, i) == elt); + ASSERT (gl_list_iterator_next (&iter3, &elt, NULL)); + ASSERT (gl_list_get_at (list3, i) == elt); + } + ASSERT (!gl_list_iterator_next (&iter1, &elt, NULL)); + ASSERT (!gl_list_iterator_next (&iter2, &elt, NULL)); + ASSERT (!gl_list_iterator_next (&iter3, &elt, NULL)); + gl_list_iterator_free (&iter1); + gl_list_iterator_free (&iter2); + gl_list_iterator_free (&iter3); + } + break; + case 15: + { + size_t end = RANDOM (gl_list_size (list1) + 1); + size_t start = RANDOM (end + 1); + gl_list_iterator_t iter1, iter2, iter3; + const void *elt; + iter1 = gl_list_iterator_from_to (list1, start, end); + iter2 = gl_list_iterator_from_to (list2, start, end); + iter3 = gl_list_iterator_from_to (list3, start, end); + for (i = start; i < end; i++) + { + ASSERT (gl_list_iterator_next (&iter1, &elt, NULL)); + ASSERT (gl_list_get_at (list1, i) == elt); + ASSERT (gl_list_iterator_next (&iter2, &elt, NULL)); + ASSERT (gl_list_get_at (list2, i) == elt); + ASSERT (gl_list_iterator_next (&iter3, &elt, NULL)); + ASSERT (gl_list_get_at (list3, i) == elt); + } + ASSERT (!gl_list_iterator_next (&iter1, &elt, NULL)); + ASSERT (!gl_list_iterator_next (&iter2, &elt, NULL)); + ASSERT (!gl_list_iterator_next (&iter3, &elt, NULL)); + gl_list_iterator_free (&iter1); + gl_list_iterator_free (&iter2); + gl_list_iterator_free (&iter3); + } + break; + } + check_all (list1, list2, list3); + } + + gl_list_free (list1); + gl_list_free (list2); + gl_list_free (list3); + free (contents); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-lseek.c m4-1.4.10/tests/test-lseek.c --- m4-1.4.9/tests/test-lseek.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-lseek.c 2007-07-05 05:48:57.000000000 -0600 @@ -0,0 +1,95 @@ +/* Test of lseek() function. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake, 2007. */ + +#include + +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +/* ARGC must be 2; *ARGV[1] is '0' if stdin and stdout are files, '1' + if they are pipes, and '2' if they are closed. Check for proper + semantics of lseek. */ +int +main (int argc, char **argv) +{ + if (argc != 2) + return 2; + switch (*argv[1]) + { + case '0': /* regular files */ + ASSERT (lseek (0, (off_t)2, SEEK_SET) == 2); + ASSERT (lseek (0, (off_t)-4, SEEK_CUR) == -1); + ASSERT (errno == EINVAL); + errno = 0; + ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2); +#if 0 /* leads to SIGSYS on IRIX 6.5 */ + ASSERT (lseek (0, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); + ASSERT (errno == EINVAL); +#endif + ASSERT (lseek (1, (off_t)2, SEEK_SET) == 2); + errno = 0; + ASSERT (lseek (1, (off_t)-4, SEEK_CUR) == -1); + ASSERT (errno == EINVAL); + errno = 0; + ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2); +#if 0 /* leads to SIGSYS on IRIX 6.5 */ + ASSERT (lseek (1, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); + ASSERT (errno == EINVAL); +#endif + break; + + case '1': /* pipes */ + errno = 0; + ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1); + ASSERT (errno == ESPIPE); + errno = 0; + ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1); + ASSERT (errno == ESPIPE); + break; + + case '2': /* closed */ + /* Explicitly close file descriptors 0 and 1. The <&- and >&- in the + invoking shell are not enough on HP-UX. */ + close (0); + close (1); + errno = 0; + ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1); + ASSERT (errno == EBADF); + errno = 0; + ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1); + ASSERT (errno == EBADF); + break; + + default: + return 1; + } + return 0; +} diff -ruNp m4-1.4.9/tests/test-lseek.sh m4-1.4.10/tests/test-lseek.sh --- m4-1.4.9/tests/test-lseek.sh 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-lseek.sh 2007-05-30 19:31:09.000000000 -0600 @@ -0,0 +1,17 @@ +#!/bin/sh + +tmpfiles= +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles=t-lseek.tmp +# seekable files +./test-lseek${EXEEXT} 0 < "$srcdir/test-lseek.sh" > t-lseek.tmp || exit 1 + +# pipes +echo hi | ./test-lseek${EXEEXT} 1 | cat || exit 1 + +# closed descriptors +./test-lseek${EXEEXT} 2 <&- >&- || exit 1 + +rm -rf $tmpfiles +exit 0 diff -ruNp m4-1.4.9/tests/test-malloca.c m4-1.4.10/tests/test-malloca.c --- m4-1.4.9/tests/test-malloca.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-malloca.c 2007-07-04 22:02:42.000000000 -0600 @@ -0,0 +1,60 @@ +/* Test of safe automatic memory allocation. + Copyright (C) 2005, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2005. */ + +#include + +#include "malloca.h" + +#include + +static void +do_allocation (int n) +{ + void *ptr = malloca (n); + freea (ptr); + ptr = safe_alloca (n); +} + +void (*func) (int) = do_allocation; + +int +main () +{ + int i; + + /* Repeat a lot of times, to make sure there's no memory leak. */ + for (i = 0; i < 50000; i++) + { + /* Try various values. + n = 0 gave a crash on Alpha with gcc-2.5.8. + Some versions of MacOS X have a stack size limit of 512 KB. */ + func (34); + func (134); + func (399); + func (510823); + func (129321); + func (0); + func (4070); + func (4095); + func (1); + func (16582); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-math.c m4-1.4.10/tests/test-math.c --- m4-1.4.9/tests/test-math.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-math.c 2007-05-30 19:31:09.000000000 -0600 @@ -0,0 +1,28 @@ +/* Test of substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.9/tests/test-printf-frexp.c m4-1.4.10/tests/test-printf-frexp.c --- m4-1.4.9/tests/test-printf-frexp.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-printf-frexp.c 2007-05-30 19:31:09.000000000 -0600 @@ -0,0 +1,131 @@ +/* Test of splitting a double into fraction and mantissa. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "printf-frexp.h" + +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +static double +my_ldexp (double x, int d) +{ + for (; d > 0; d--) + x *= 2.0; + for (; d < 0; d++) + x *= 0.5; + return x; +} + +int +main () +{ + int i; + /* The use of 'volatile' guarantees that excess precision bits are dropped + when dealing with denormalized numbers. It is necessary on x86 systems + where double-floats are not IEEE compliant by default, to avoid that the + results become platform and compiler option dependent. 'volatile' is a + portable alternative to gcc's -ffloat-store option. */ + volatile double x; + + for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.0); + } + for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.0); + } + for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == DBL_MIN_EXP - 1); + ASSERT (mantissa == my_ldexp (1.0, i - DBL_MIN_EXP)); + } + + for (i = 1, x = 1.01; i <= DBL_MAX_EXP; i++, x *= 2.0) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.01); + } + for (i = 1, x = 1.01; i >= DBL_MIN_EXP; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.01); + } + for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == DBL_MIN_EXP - 1); + ASSERT (mantissa >= my_ldexp (1.0, i - DBL_MIN_EXP)); + ASSERT (mantissa <= my_ldexp (2.0, i - DBL_MIN_EXP)); + ASSERT (mantissa == my_ldexp (x, - exp)); + } + + for (i = 1, x = 1.73205; i <= DBL_MAX_EXP; i++, x *= 2.0) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.73205); + } + for (i = 1, x = 1.73205; i >= DBL_MIN_EXP; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.73205); + } + for (; i >= DBL_MIN_EXP - 100 && x > 0.0; i--, x *= 0.5) + { + int exp = -9999; + double mantissa = printf_frexp (x, &exp); + ASSERT (exp == DBL_MIN_EXP - 1); + ASSERT (mantissa >= my_ldexp (1.0, i - DBL_MIN_EXP)); + ASSERT (mantissa <= my_ldexp (2.0, i - DBL_MIN_EXP)); + ASSERT (mantissa == my_ldexp (x, - exp)); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-printf-frexpl.c m4-1.4.10/tests/test-printf-frexpl.c --- m4-1.4.9/tests/test-printf-frexpl.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-printf-frexpl.c 2007-07-05 05:48:58.000000000 -0600 @@ -0,0 +1,147 @@ +/* Test of splitting a 'long double' into fraction and mantissa. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "printf-frexpl.h" + +#include +#include +#include + +#include "fpucw.h" + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +/* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable + exponent for 'long double' is -964. Similarly, on PowerPC machines, + LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' + is -968. For exponents below that, the precision may be truncated to the + precision used for 'double'. */ +#ifdef __sgi +# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 57) +# define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP +#elif defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__ +# define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53) +# define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP +#else +# define MIN_NORMAL_EXP LDBL_MIN_EXP +# define MIN_SUBNORMAL_EXP (LDBL_MIN_EXP - 100) +#endif + +static long double +my_ldexp (long double x, int d) +{ + for (; d > 0; d--) + x *= 2.0L; + for (; d < 0; d++) + x *= 0.5L; + return x; +} + +int +main () +{ + int i; + long double x; + DECL_LONG_DOUBLE_ROUNDING + + BEGIN_LONG_DOUBLE_ROUNDING (); + + for (i = 1, x = 1.0L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.0L); + } + for (i = 1, x = 1.0L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.0L); + } + for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == LDBL_MIN_EXP - 1); + ASSERT (mantissa == my_ldexp (1.0L, i - LDBL_MIN_EXP)); + } + + for (i = 1, x = 1.01L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.01L); + } + for (i = 1, x = 1.01L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.01L); + } + for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == LDBL_MIN_EXP - 1); + ASSERT (mantissa >= my_ldexp (1.0L, i - LDBL_MIN_EXP)); + ASSERT (mantissa <= my_ldexp (2.0L, i - LDBL_MIN_EXP)); + ASSERT (mantissa == my_ldexp (x, - exp)); + } + + for (i = 1, x = 1.73205L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.73205L); + } + for (i = 1, x = 1.73205L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == i - 1); + ASSERT (mantissa == 1.73205L); + } + for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L) + { + int exp = -9999; + long double mantissa = printf_frexpl (x, &exp); + ASSERT (exp == LDBL_MIN_EXP - 1); + ASSERT (mantissa >= my_ldexp (1.0L, i - LDBL_MIN_EXP)); + ASSERT (mantissa <= my_ldexp (2.0L, i - LDBL_MIN_EXP)); + ASSERT (mantissa == my_ldexp (x, - exp)); + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-signbit.c m4-1.4.10/tests/test-signbit.c --- m4-1.4.9/tests/test-signbit.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-signbit.c 2007-05-30 19:31:10.000000000 -0600 @@ -0,0 +1,163 @@ +/* Test of signbit() substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +float zerof = 0.0f; +double zerod = 0.0; +long double zerol = 0.0L; + +static void +test_signbitf () +{ + /* Finite values. */ + ASSERT (!signbit (3.141f)); + ASSERT (!signbit (3.141e30f)); + ASSERT (!signbit (3.141e-30f)); + ASSERT (signbit (-2.718f)); + ASSERT (signbit (-2.718e30f)); + ASSERT (signbit (-2.718e-30f)); + /* Infinite values. */ + ASSERT (!signbit (1.0f / 0.0f)); + ASSERT (signbit (-1.0f / 0.0f)); + /* Quiet NaN. */ + (void) signbit (zerof / zerof); +#if defined FLT_EXPBIT0_WORD && defined FLT_EXPBIT0_BIT + /* Signalling NaN. */ + { + #define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + typedef union { float value; unsigned int word[NWORDS]; } memory_float; + memory_float m; + m.value = zerof / zerof; +# if FLT_EXPBIT0_BIT > 0 + m.word[FLT_EXPBIT0_WORD] ^= (unsigned int) 1 << (FLT_EXPBIT0_BIT - 1); +# else + m.word[FLT_EXPBIT0_WORD + (FLT_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); +# endif + if (FLT_EXPBIT0_WORD < NWORDS / 2) + m.word[FLT_EXPBIT0_WORD + 1] |= (unsigned int) 1 << FLT_EXPBIT0_BIT; + else + m.word[0] |= (unsigned int) 1; + (void) signbit (m.value); + #undef NWORDS + } +#endif +} + +static void +test_signbitd () +{ + /* Finite values. */ + ASSERT (!signbit (3.141)); + ASSERT (!signbit (3.141e30)); + ASSERT (!signbit (3.141e-30)); + ASSERT (signbit (-2.718)); + ASSERT (signbit (-2.718e30)); + ASSERT (signbit (-2.718e-30)); + /* Infinite values. */ + ASSERT (!signbit (1.0 / 0.0)); + ASSERT (signbit (-1.0 / 0.0)); + /* Quiet NaN. */ + (void) signbit (zerod / zerod); +#if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT + /* Signalling NaN. */ + { + #define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + typedef union { double value; unsigned int word[NWORDS]; } memory_double; + memory_double m; + m.value = zerod / zerod; +# if DBL_EXPBIT0_BIT > 0 + m.word[DBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (DBL_EXPBIT0_BIT - 1); +# else + m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); +# endif + m.word[DBL_EXPBIT0_WORD + (DBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + |= (unsigned int) 1 << DBL_EXPBIT0_BIT; + (void) signbit (m.value); + #undef NWORDS + } +#endif +} + +static void +test_signbitl () +{ + /* Finite values. */ + ASSERT (!signbit (3.141L)); + ASSERT (!signbit (3.141e30L)); + ASSERT (!signbit (3.141e-30L)); + ASSERT (signbit (-2.718L)); + ASSERT (signbit (-2.718e30L)); + ASSERT (signbit (-2.718e-30L)); + /* Infinite values. */ + ASSERT (!signbit (1.0L / 0.0L)); + ASSERT (signbit (-1.0L / 0.0L)); + /* Quiet NaN. */ + (void) signbit (zerol / zerol); +#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT + /* Signalling NaN. */ + { + #define NWORDS \ + ((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) + typedef union { long double value; unsigned int word[NWORDS]; } memory_long_double; + memory_long_double m; + m.value = zerol / zerol; +# if LDBL_EXPBIT0_BIT > 0 + m.word[LDBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (LDBL_EXPBIT0_BIT - 1); +# else + m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1); +# endif + m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < NWORDS / 2 ? 1 : - 1)] + |= (unsigned int) 1 << LDBL_EXPBIT0_BIT; + (void) signbit (m.value); + #undef NWORDS + } +#endif +} + +int +main () +{ + test_signbitf (); + test_signbitd (); + test_signbitl (); + return 0; +} diff -ruNp m4-1.4.9/tests/test-stdbool.c m4-1.4.10/tests/test-stdbool.c --- m4-1.4.9/tests/test-stdbool.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-stdbool.c 2007-05-30 19:31:10.000000000 -0600 @@ -0,0 +1,96 @@ +/* Test of substitute. + Copyright (C) 2002-2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#ifndef bool + "error: bool is not defined" +#endif +#ifndef false + "error: false is not defined" +#endif +#if false + "error: false is not 0" +#endif +#ifndef true + "error: true is not defined" +#endif +#if true != 1 + "error: true is not 1" +#endif +#ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" +#endif + +#if 0 /* Cannot be guaranteed with gnulib's . */ +struct s { _Bool s: 1; _Bool t; } s; +#endif + +char a[true == 1 ? 1 : -1]; +char b[false == 0 ? 1 : -1]; +char c[__bool_true_false_are_defined == 1 ? 1 : -1]; +#if 0 /* Cannot be guaranteed with gnulib's . */ +char d[(bool) 0.5 == true ? 1 : -1]; +bool e = &s; +#endif +char f[(_Bool) 0.0 == false ? 1 : -1]; +char g[true]; +char h[sizeof (_Bool)]; +#if 0 /* See above. */ +char i[sizeof s.t]; +#endif +enum { j = false, k = true, l = false * true, m = true * 256 }; +_Bool n[m]; +char o[sizeof n == m * sizeof n[0] ? 1 : -1]; +char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; +#if 0 /* Cannot be guaranteed with gnulib's . */ +#if defined __xlc__ || defined __GNUC__ + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 + reported by James Lemley on 2005-10-05; see + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html + This test is not quite right, since xlc is allowed to + reject this program, as the initializer for xlcbug is + not one of the forms that C requires support for. + However, doing the test right would require a run-time + test, and that would make cross-compilation harder. + Let us hope that IBM fixes the xlc bug, and also adds + support for this kind of constant expression. In the + meantime, this test will reject xlc, which is OK, since + our stdbool.h substitute should suffice. We also test + this with GCC, where it should work, to detect more + quickly whether someone messes up the test in the + future. */ + char digs[] = "0123456789"; + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); +#endif +#endif +/* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ +_Bool q = true; +_Bool *pq = &q; + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.9/tests/test-stdint.c m4-1.4.10/tests/test-stdint.c --- m4-1.4.9/tests/test-stdint.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-stdint.c 2007-05-30 19:31:10.000000000 -0600 @@ -0,0 +1,357 @@ +/* Test of substitute. + Copyright (C) 2006, 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2006. */ + +#include + +/* Whether to enable pedantic checks. */ +#define DO_PEDANTIC 0 + +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#include + +#include "verify.h" +#include "intprops.h" + +#if __GNUC__ >= 2 && DO_PEDANTIC +# define verify_same_types(expr1,expr2) \ + extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \ + extern void _verify_func(__LINE__) (__typeof__ (expr2) *); +# define _verify_func(line) _verify_func2(line) +# define _verify_func2(line) verify_func_ ## line +#else +# define verify_same_types(expr1,expr2) extern void verify_func (int) +#endif + +/* 7.18.1.1. Exact-width integer types */ +/* 7.18.2.1. Limits of exact-width integer types */ + +int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX }; +verify (TYPE_MINIMUM (int8_t) == INT8_MIN); +verify (TYPE_MAXIMUM (int8_t) == INT8_MAX); +verify_same_types (INT8_MIN, (int8_t) 0 + 0); +verify_same_types (INT8_MAX, (int8_t) 0 + 0); + +int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX }; +verify (TYPE_MINIMUM (int16_t) == INT16_MIN); +verify (TYPE_MAXIMUM (int16_t) == INT16_MAX); +verify_same_types (INT16_MIN, (int16_t) 0 + 0); +verify_same_types (INT16_MAX, (int16_t) 0 + 0); + +int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX }; +verify (TYPE_MINIMUM (int32_t) == INT32_MIN); +verify (TYPE_MAXIMUM (int32_t) == INT32_MAX); +verify_same_types (INT32_MIN, (int32_t) 0 + 0); +verify_same_types (INT32_MAX, (int32_t) 0 + 0); + +#ifdef INT64_MAX +int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX }; +verify (TYPE_MINIMUM (int64_t) == INT64_MIN); +verify (TYPE_MAXIMUM (int64_t) == INT64_MAX); +verify_same_types (INT64_MIN, (int64_t) 0 + 0); +verify_same_types (INT64_MAX, (int64_t) 0 + 0); +#endif + +uint8_t b1[2] = { UINT8_C (17), UINT8_MAX }; +verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX); +verify_same_types (UINT8_MAX, (uint8_t) 0 + 0); + +uint16_t b2[2] = { UINT16_C (17), UINT16_MAX }; +verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX); +verify_same_types (UINT16_MAX, (uint16_t) 0 + 0); + +uint32_t b3[2] = { UINT32_C (17), UINT32_MAX }; +verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX); +verify_same_types (UINT32_MAX, (uint32_t) 0 + 0); + +#ifdef UINT64_MAX +uint64_t b4[2] = { UINT64_C (17), UINT64_MAX }; +verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX); +verify_same_types (UINT64_MAX, (uint64_t) 0 + 0); +#endif + +#if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX +/* ok */ +#else +err or; +#endif + +#if UINT8_MAX && UINT16_MAX && UINT32_MAX +/* ok */ +#else +err or; +#endif + +/* 7.18.1.2. Minimum-width integer types */ +/* 7.18.2.2. Limits of minimum-width integer types */ + +int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX }; +verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN); +verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX); +verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0); +verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0); + +int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX }; +verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN); +verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX); +verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0); +verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0); + +int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX }; +verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN); +verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX); +verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0); +verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0); + +#ifdef INT_LEAST64_MAX +int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX }; +verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN); +verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX); +verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0); +verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0); +#endif + +uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX }; +verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX); +verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0); + +uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX }; +verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX); +verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0); + +uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX }; +verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX); +verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0); + +#ifdef UINT_LEAST64_MAX +uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX }; +verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX); +verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0); +#endif + +#if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX +/* ok */ +#else +err or; +#endif + +#if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX +/* ok */ +#else +err or; +#endif + +/* 7.18.1.3. Fastest minimum-width integer types */ +/* 7.18.2.3. Limits of fastest minimum-width integer types */ + +int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX }; +verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN); +verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX); +verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0); +verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0); + +int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX }; +verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN); +verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX); +verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0); +verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0); + +int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX }; +verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN); +verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX); +verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0); +verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0); + +#ifdef INT_FAST64_MAX +int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX }; +verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN); +verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX); +verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0); +verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0); +#endif + +uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX }; +verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX); +verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0); + +uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX }; +verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX); +verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0); + +uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX }; +verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX); +verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0); + +#ifdef UINT_FAST64_MAX +uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX }; +verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX); +verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0); +#endif + +#if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX +/* ok */ +#else +err or; +#endif + +#if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX +/* ok */ +#else +err or; +#endif + +/* 7.18.1.4. Integer types capable of holding object pointers */ +/* 7.18.2.4. Limits of integer types capable of holding object pointers */ + +intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX }; +verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN); +verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX); +verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0); +verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0); + +uintptr_t h[2] = { 17, UINTPTR_MAX }; +verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX); +verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0); + +#if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX +/* ok */ +#else +err or; +#endif + +/* 7.18.1.5. Greatest-width integer types */ +/* 7.18.2.5. Limits of greatest-width integer types */ + +intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX }; +verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); +verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); +verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0); +verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0); + +uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX }; +verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); +verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0); + +#if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX +/* ok */ +#else +err or; +#endif + +/* 7.18.3. Limits of other integer types */ + +#include + +verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN); +verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX); +verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0); +verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0); + +#if PTRDIFF_MIN && PTRDIFF_MAX +/* ok */ +#else +err or; +#endif + +#include + +verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN); +verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX); +verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0); +verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0); + +#if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX +/* ok */ +#else +err or; +#endif + +verify (TYPE_MAXIMUM (size_t) == SIZE_MAX); +verify_same_types (SIZE_MAX, (size_t) 0 + 0); + +#if SIZE_MAX +/* ok */ +#else +err or; +#endif + +#if HAVE_WCHAR_T +verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN); +verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX); +verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0); +verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0); + +# if WCHAR_MIN != 17 && WCHAR_MAX +/* ok */ +# else +err or; +# endif +#endif + +#if HAVE_WINT_T +# include + +verify (TYPE_MINIMUM (wint_t) == WINT_MIN); +verify (TYPE_MAXIMUM (wint_t) == WINT_MAX); +verify_same_types (WINT_MIN, (wint_t) 0 + 0); +verify_same_types (WINT_MAX, (wint_t) 0 + 0); + +# if WINT_MIN != 17 && WINT_MAX +/* ok */ +# else +err or; +# endif +#endif + +/* 7.18.4. Macros for integer constants */ + +verify (INT8_C (17) == 17); +verify_same_types (INT8_C (17), (int_least8_t)0 + 0); +verify (UINT8_C (17) == 17); +verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0); + +verify (INT16_C (17) == 17); +verify_same_types (INT16_C (17), (int_least16_t)0 + 0); +verify (UINT16_C (17) == 17); +verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0); + +verify (INT32_C (17) == 17); +verify_same_types (INT32_C (17), (int_least32_t)0 + 0); +verify (UINT32_C (17) == 17); +verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0); + +#ifdef INT64_C +verify (INT64_C (17) == 17); +verify_same_types (INT64_C (17), (int_least64_t)0 + 0); +#endif +#ifdef UINT64_C +verify (UINT64_C (17) == 17); +verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0); +#endif + +verify (INTMAX_C (17) == 17); +verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); +verify (UINTMAX_C (17) == 17); +verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); + + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.9/tests/test-stdio.c m4-1.4.10/tests/test-stdio.c --- m4-1.4.9/tests/test-stdio.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-stdio.c 2007-05-30 19:31:11.000000000 -0600 @@ -0,0 +1,31 @@ +/* Test of substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +/* Check that the various SEEK_* macros are defined. */ +int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.9/tests/test-stdlib.c m4-1.4.10/tests/test-stdlib.c --- m4-1.4.9/tests/test-stdlib.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-stdlib.c 2007-05-30 19:31:11.000000000 -0600 @@ -0,0 +1,38 @@ +/* Test of substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +int exitcode; + +int +main () +{ + /* Check that some macros are defined and different integer constants. */ + switch (exitcode) + { + case EXIT_SUCCESS: + case EXIT_FAILURE: + break; + } + + return 0; +} diff -ruNp m4-1.4.9/tests/test-sys_stat.c m4-1.4.10/tests/test-sys_stat.c --- m4-1.4.9/tests/test-sys_stat.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-sys_stat.c 2007-05-30 19:31:11.000000000 -0600 @@ -0,0 +1,261 @@ +/* Test of substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#include "verify.h" + +/* Check the existence of some macros. */ +int a[] = + { + S_IFMT, + S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFREG, +#ifdef S_IFLNK /* missing on mingw and djgpp */ + S_IFLNK, +#endif +#ifdef S_IFSOCK /* missing on mingw and djgpp */ + S_IFSOCK, +#endif + S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR, + S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP, + S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH, + S_ISUID, S_ISGID, S_ISVTX, + S_ISBLK (S_IFREG), + S_ISCHR (S_IFREG), + S_ISDIR (S_IFREG), + S_ISFIFO (S_IFREG), + S_ISREG (S_IFREG), + S_ISLNK (S_IFREG), + S_ISSOCK (S_IFREG), + S_ISDOOR (S_IFREG), + S_ISMPB (S_IFREG), + S_ISNAM (S_IFREG), + S_ISNWK (S_IFREG), + S_ISPORT (S_IFREG), + S_ISCTG (S_IFREG), + S_ISOFD (S_IFREG), + S_ISOFL (S_IFREG), + S_ISWHT (S_IFREG) + }; + +/* Sanity checks. */ + +verify (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR)); +verify (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP)); +verify (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH)); + +verify (S_ISBLK (S_IFBLK)); +verify (!S_ISBLK (S_IFCHR)); +verify (!S_ISBLK (S_IFDIR)); +verify (!S_ISBLK (S_IFIFO)); +verify (!S_ISBLK (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISBLK (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISBLK (S_IFSOCK)); +#endif + +verify (!S_ISCHR (S_IFBLK)); +verify (S_ISCHR (S_IFCHR)); +verify (!S_ISCHR (S_IFDIR)); +verify (!S_ISCHR (S_IFIFO)); +verify (!S_ISCHR (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISCHR (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISCHR (S_IFSOCK)); +#endif + +verify (!S_ISDIR (S_IFBLK)); +verify (!S_ISDIR (S_IFCHR)); +verify (S_ISDIR (S_IFDIR)); +verify (!S_ISDIR (S_IFIFO)); +verify (!S_ISDIR (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISDIR (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISDIR (S_IFSOCK)); +#endif + +verify (!S_ISFIFO (S_IFBLK)); +verify (!S_ISFIFO (S_IFCHR)); +verify (!S_ISFIFO (S_IFDIR)); +verify (S_ISFIFO (S_IFIFO)); +verify (!S_ISFIFO (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISFIFO (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISFIFO (S_IFSOCK)); +#endif + +verify (!S_ISREG (S_IFBLK)); +verify (!S_ISREG (S_IFCHR)); +verify (!S_ISREG (S_IFDIR)); +verify (!S_ISREG (S_IFIFO)); +verify (S_ISREG (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISREG (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISREG (S_IFSOCK)); +#endif + +verify (!S_ISLNK (S_IFBLK)); +verify (!S_ISLNK (S_IFCHR)); +verify (!S_ISLNK (S_IFDIR)); +verify (!S_ISLNK (S_IFIFO)); +verify (!S_ISLNK (S_IFREG)); +#ifdef S_IFLNK +verify (S_ISLNK (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISLNK (S_IFSOCK)); +#endif + +verify (!S_ISSOCK (S_IFBLK)); +verify (!S_ISSOCK (S_IFCHR)); +verify (!S_ISSOCK (S_IFDIR)); +verify (!S_ISSOCK (S_IFIFO)); +verify (!S_ISSOCK (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISSOCK (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (S_ISSOCK (S_IFSOCK)); +#endif + +verify (!S_ISDOOR (S_IFBLK)); +verify (!S_ISDOOR (S_IFCHR)); +verify (!S_ISDOOR (S_IFDIR)); +verify (!S_ISDOOR (S_IFIFO)); +verify (!S_ISDOOR (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISDOOR (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISDOOR (S_IFSOCK)); +#endif + +verify (!S_ISMPB (S_IFBLK)); +verify (!S_ISMPB (S_IFCHR)); +verify (!S_ISMPB (S_IFDIR)); +verify (!S_ISMPB (S_IFIFO)); +verify (!S_ISMPB (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISMPB (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISMPB (S_IFSOCK)); +#endif + +verify (!S_ISNAM (S_IFBLK)); +verify (!S_ISNAM (S_IFCHR)); +verify (!S_ISNAM (S_IFDIR)); +verify (!S_ISNAM (S_IFIFO)); +verify (!S_ISNAM (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISNAM (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISNAM (S_IFSOCK)); +#endif + +verify (!S_ISNWK (S_IFBLK)); +verify (!S_ISNWK (S_IFCHR)); +verify (!S_ISNWK (S_IFDIR)); +verify (!S_ISNWK (S_IFIFO)); +verify (!S_ISNWK (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISNWK (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISNWK (S_IFSOCK)); +#endif + +verify (!S_ISPORT (S_IFBLK)); +verify (!S_ISPORT (S_IFCHR)); +verify (!S_ISPORT (S_IFDIR)); +verify (!S_ISPORT (S_IFIFO)); +verify (!S_ISPORT (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISPORT (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISPORT (S_IFSOCK)); +#endif + +verify (!S_ISCTG (S_IFBLK)); +verify (!S_ISCTG (S_IFCHR)); +verify (!S_ISCTG (S_IFDIR)); +verify (!S_ISCTG (S_IFIFO)); +verify (!S_ISCTG (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISCTG (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISCTG (S_IFSOCK)); +#endif + +verify (!S_ISOFD (S_IFBLK)); +verify (!S_ISOFD (S_IFCHR)); +verify (!S_ISOFD (S_IFDIR)); +verify (!S_ISOFD (S_IFIFO)); +verify (!S_ISOFD (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISOFD (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISOFD (S_IFSOCK)); +#endif + +verify (!S_ISOFL (S_IFBLK)); +verify (!S_ISOFL (S_IFCHR)); +verify (!S_ISOFL (S_IFDIR)); +verify (!S_ISOFL (S_IFIFO)); +verify (!S_ISOFL (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISOFL (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISOFL (S_IFSOCK)); +#endif + +verify (!S_ISWHT (S_IFBLK)); +verify (!S_ISWHT (S_IFCHR)); +verify (!S_ISWHT (S_IFDIR)); +verify (!S_ISWHT (S_IFIFO)); +verify (!S_ISWHT (S_IFREG)); +#ifdef S_IFLNK +verify (!S_ISWHT (S_IFLNK)); +#endif +#ifdef S_IFSOCK +verify (!S_ISWHT (S_IFSOCK)); +#endif + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.9/tests/test-sys_time.c m4-1.4.10/tests/test-sys_time.c --- m4-1.4.9/tests/test-sys_time.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-sys_time.c 2007-05-30 19:31:11.000000000 -0600 @@ -0,0 +1,30 @@ +/* Test of substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +struct timeval a; + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.9/tests/test-unistd.c m4-1.4.10/tests/test-unistd.c --- m4-1.4.9/tests/test-unistd.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-unistd.c 2007-07-05 05:48:59.000000000 -0600 @@ -0,0 +1,45 @@ +/* Test of substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +/* Check that the various SEEK_* macros are defined. */ +int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; + +/* Check that the types are all defined. */ +size_t t1; +ssize_t t2; +#ifdef TODO /* Not implemented in gnulib yet */ +uid_t t3; +gid_t t4; +#endif +off_t t5; +pid_t t6; +#ifdef TODO +useconds_t t7; +intptr_t t8; +#endif + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.9/tests/test-vasnprintf.c m4-1.4.10/tests/test-vasnprintf.c --- m4-1.4.9/tests/test-vasnprintf.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-vasnprintf.c 2007-05-30 19:31:12.000000000 -0600 @@ -0,0 +1,128 @@ +/* Test of vasnprintf() and asnprintf() functions. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "vasnprintf.h" + +#include +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +static char * +my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) +{ + va_list args; + char *ret; + + va_start (args, format); + ret = vasnprintf (resultbuf, lengthp, format, args); + va_end (args); + return ret; +} + +static void +test_vasnprintf () +{ + char buf[8]; + int size; + + for (size = 0; size <= 8; size++) + { + size_t length = size; + char *result = my_asnprintf (NULL, &length, "%d", 12345); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + ASSERT (length == 5); + free (result); + } + + for (size = 0; size <= 8; size++) + { + size_t length; + char *result; + + memcpy (buf, "DEADBEEF", 8); + length = size; + result = my_asnprintf (buf, &length, "%d", 12345); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + ASSERT (length == 5); + if (size < 6) + ASSERT (result != buf); + ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); + if (result != buf) + free (result); + } +} + +static void +test_asnprintf () +{ + char buf[8]; + int size; + + for (size = 0; size <= 8; size++) + { + size_t length = size; + char *result = asnprintf (NULL, &length, "%d", 12345); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + ASSERT (length == 5); + free (result); + } + + for (size = 0; size <= 8; size++) + { + size_t length; + char *result; + + memcpy (buf, "DEADBEEF", 8); + length = size; + result = asnprintf (buf, &length, "%d", 12345); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + ASSERT (length == 5); + if (size < 6) + ASSERT (result != buf); + ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); + if (result != buf) + free (result); + } +} + +int +main (int argc, char *argv[]) +{ + test_vasnprintf (); + test_asnprintf (); + return 0; +} diff -ruNp m4-1.4.9/tests/test-vasprintf-posix.c m4-1.4.10/tests/test-vasprintf-posix.c --- m4-1.4.9/tests/test-vasprintf-posix.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-vasprintf-posix.c 2007-07-05 05:49:00.000000000 -0600 @@ -0,0 +1,3269 @@ +/* Test of POSIX compatible vasprintf() and asprintf() functions. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static double +NaN () +{ + static double zero = 0.0; + return zero / zero; +} +#else +# define NaN() (0.0 / 0.0) +#endif + +/* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */ +static int +have_minus_zero () +{ + static double plus_zero = 0.0; + static double minus_zero = -0.0; + return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; +} + +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +#ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +#else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +#endif + +static int +strmatch (const char *pattern, const char *string) +{ + if (strlen (pattern) != strlen (string)) + return 0; + for (; *pattern != '\0'; pattern++, string++) + if (*pattern != '*' && *string != *pattern) + return 0; + return 1; +} + +/* Test whether string[start_index..end_index-1] is a valid textual + representation of NaN. */ +static int +strisnan (const char *string, size_t start_index, size_t end_index, int uppercase) +{ + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} + +static void +test_function (int (*my_asprintf) (char **, const char *, ...)) +{ + int repeat; + + /* Test return value convention. */ + + for (repeat = 0; repeat <= 8; repeat++) + { + char *result; + int retval = asprintf (&result, "%d", 12345); + ASSERT (retval == 5); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + free (result); + } + + /* Test support of size specifiers as in C99. */ + + { + char *result; + int retval = + my_asprintf (&result, "%ju %d", (uintmax_t) 12345671, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345671 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "%zu %d", (size_t) 12345672, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345672 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345673 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { + char *result; + int retval = + my_asprintf (&result, "%Lg %d", (long double) 1.5, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.5 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + /* Test the support of the 'a' and 'A' conversion specifier for hexadecimal + output of floating-point numbers. */ + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%a %d", 3.1416015625, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.922p+1 33") == 0 + || strcmp (result, "0x3.244p+0 33") == 0 + || strcmp (result, "0x6.488p-1 33") == 0 + || strcmp (result, "0xc.91p-2 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%A %d", -3.1416015625, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-0X1.922P+1 33") == 0 + || strcmp (result, "-0X3.244P+0 33") == 0 + || strcmp (result, "-0X6.488P-1 33") == 0 + || strcmp (result, "-0XC.91P-2 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%a %d", 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x0p+0 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%a %d", -0.0, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0x0p+0 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%a %d", 1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "inf 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%a %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-inf 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + char *result; + int retval = + my_asprintf (&result, "%a %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding near the decimal point. */ + char *result; + int retval = + my_asprintf (&result, "%.0a %d", 1.5, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x2p+0 33") == 0 + || strcmp (result, "0x3p-1 33") == 0 + || strcmp (result, "0x6p-2 33") == 0 + || strcmp (result, "0xcp-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding with precision 0. */ + char *result; + int retval = + my_asprintf (&result, "%.0a %d", 1.51, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x2p+0 33") == 0 + || strcmp (result, "0x3p-1 33") == 0 + || strcmp (result, "0x6p-2 33") == 0 + || strcmp (result, "0xcp-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding with precision 1. */ + char *result; + int retval = + my_asprintf (&result, "%.1a %d", 1.51, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.8p+0 33") == 0 + || strcmp (result, "0x3.0p-1 33") == 0 + || strcmp (result, "0x6.1p-2 33") == 0 + || strcmp (result, "0xc.1p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding with precision 2. */ + char *result; + int retval = + my_asprintf (&result, "%.2a %d", 1.51, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.83p+0 33") == 0 + || strcmp (result, "0x3.05p-1 33") == 0 + || strcmp (result, "0x6.0ap-2 33") == 0 + || strcmp (result, "0xc.14p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding with precision 3. */ + char *result; + int retval = + my_asprintf (&result, "%.3a %d", 1.51, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.829p+0 33") == 0 + || strcmp (result, "0x3.052p-1 33") == 0 + || strcmp (result, "0x6.0a4p-2 33") == 0 + || strcmp (result, "0xc.148p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding can turn a ...FFF into a ...000. */ + char *result; + int retval = + my_asprintf (&result, "%.3a %d", 1.49999, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.800p+0 33") == 0 + || strcmp (result, "0x3.000p-1 33") == 0 + || strcmp (result, "0x6.000p-2 33") == 0 + || strcmp (result, "0xc.000p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding can turn a ...FFF into a ...000. + This shows a MacOS X 10.3.9 (Darwin 7.9) bug. */ + char *result; + int retval = + my_asprintf (&result, "%.1a %d", 1.999, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.0p+1 33") == 0 + || strcmp (result, "0x2.0p+0 33") == 0 + || strcmp (result, "0x4.0p-1 33") == 0 + || strcmp (result, "0x8.0p-2 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Width. */ + char *result; + int retval = + my_asprintf (&result, "%10a %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Small precision. */ + char *result; + int retval = + my_asprintf (&result, "%.10a %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0 + || strcmp (result, "0x3.8000000000p-1 33") == 0 + || strcmp (result, "0x7.0000000000p-2 33") == 0 + || strcmp (result, "0xe.0000000000p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Large precision. */ + char *result; + int retval = + my_asprintf (&result, "%.50a %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0 + || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 + || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 + || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_LEFT. */ + char *result; + int retval = + my_asprintf (&result, "%-10a %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.cp+0 33") == 0 + || strcmp (result, "0x3.8p-1 33") == 0 + || strcmp (result, "0x7p-2 33") == 0 + || strcmp (result, "0xep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SHOWSIGN. */ + char *result; + int retval = + my_asprintf (&result, "%+a %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "+0x1.cp+0 33") == 0 + || strcmp (result, "+0x3.8p-1 33") == 0 + || strcmp (result, "+0x7p-2 33") == 0 + || strcmp (result, "+0xep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SPACE. */ + char *result; + int retval = + my_asprintf (&result, "% a %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#a %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.cp+0 33") == 0 + || strcmp (result, "0x3.8p-1 33") == 0 + || strcmp (result, "0x7.p-2 33") == 0 + || strcmp (result, "0xe.p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#a %d", 1.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.p+0 33") == 0 + || strcmp (result, "0x2.p-1 33") == 0 + || strcmp (result, "0x4.p-2 33") == 0 + || strcmp (result, "0x8.p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with finite number. */ + char *result; + int retval = + my_asprintf (&result, "%010a %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x001.cp+0 33") == 0 + || strcmp (result, "0x003.8p-1 33") == 0 + || strcmp (result, "0x00007p-2 33") == 0 + || strcmp (result, "0x0000ep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%010a %d", 1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + /* "0000000inf 33" is not a valid result; see + */ + ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with NaN. */ + char *result; + int retval = + my_asprintf (&result, "%050a %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + /* "0000000nan 33" is not a valid result; see + */ + ASSERT (strlen (result) == 50 + 3 + && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%La %d", 3.1416015625L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.922p+1 33") == 0 + || strcmp (result, "0x3.244p+0 33") == 0 + || strcmp (result, "0x6.488p-1 33") == 0 + || strcmp (result, "0xc.91p-2 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%LA %d", -3.1416015625L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-0X1.922P+1 33") == 0 + || strcmp (result, "-0X3.244P+0 33") == 0 + || strcmp (result, "-0X6.488P-1 33") == 0 + || strcmp (result, "-0XC.91P-2 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%La %d", 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x0p+0 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%La %d", -0.0L, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0x0p+0 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%La %d", 1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "inf 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%La %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-inf 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + char *result; + int retval = + my_asprintf (&result, "%La %d", 0.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%La %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%La %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in + Intel IA-64 Architecture Software Developer's Manual, Volume 1: + Application Architecture. + Table 5-2 "Floating-Point Register Encodings" + Figure 5-6 "Memory to Floating-Point Register Data Translation" + */ + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%La %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%La %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%La %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%La %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%La %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } +#endif + + { /* Rounding near the decimal point. */ + char *result; + int retval = + my_asprintf (&result, "%.0La %d", 1.5L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x2p+0 33") == 0 + || strcmp (result, "0x3p-1 33") == 0 + || strcmp (result, "0x6p-2 33") == 0 + || strcmp (result, "0xcp-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding with precision 0. */ + char *result; + int retval = + my_asprintf (&result, "%.0La %d", 1.51L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x2p+0 33") == 0 + || strcmp (result, "0x3p-1 33") == 0 + || strcmp (result, "0x6p-2 33") == 0 + || strcmp (result, "0xcp-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding with precision 1. */ + char *result; + int retval = + my_asprintf (&result, "%.1La %d", 1.51L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.8p+0 33") == 0 + || strcmp (result, "0x3.0p-1 33") == 0 + || strcmp (result, "0x6.1p-2 33") == 0 + || strcmp (result, "0xc.1p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding with precision 2. */ + char *result; + int retval = + my_asprintf (&result, "%.2La %d", 1.51L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.83p+0 33") == 0 + || strcmp (result, "0x3.05p-1 33") == 0 + || strcmp (result, "0x6.0ap-2 33") == 0 + || strcmp (result, "0xc.14p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding with precision 3. */ + char *result; + int retval = + my_asprintf (&result, "%.3La %d", 1.51L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.829p+0 33") == 0 + || strcmp (result, "0x3.052p-1 33") == 0 + || strcmp (result, "0x6.0a4p-2 33") == 0 + || strcmp (result, "0xc.148p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding can turn a ...FFF into a ...000. */ + char *result; + int retval = + my_asprintf (&result, "%.3La %d", 1.49999L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.800p+0 33") == 0 + || strcmp (result, "0x3.000p-1 33") == 0 + || strcmp (result, "0x6.000p-2 33") == 0 + || strcmp (result, "0xc.000p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Rounding can turn a ...FFF into a ...000. + This shows a MacOS X 10.3.9 (Darwin 7.9) bug and a + glibc 2.4 bug . */ + char *result; + int retval = + my_asprintf (&result, "%.1La %d", 1.999L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.0p+1 33") == 0 + || strcmp (result, "0x2.0p+0 33") == 0 + || strcmp (result, "0x4.0p-1 33") == 0 + || strcmp (result, "0x8.0p-2 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Width. */ + char *result; + int retval = + my_asprintf (&result, "%10La %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Small precision. */ + char *result; + int retval = + my_asprintf (&result, "%.10La %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0 + || strcmp (result, "0x3.8000000000p-1 33") == 0 + || strcmp (result, "0x7.0000000000p-2 33") == 0 + || strcmp (result, "0xe.0000000000p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Large precision. */ + char *result; + int retval = + my_asprintf (&result, "%.50La %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0 + || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 + || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 + || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_LEFT. */ + char *result; + int retval = + my_asprintf (&result, "%-10La %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.cp+0 33") == 0 + || strcmp (result, "0x3.8p-1 33") == 0 + || strcmp (result, "0x7p-2 33") == 0 + || strcmp (result, "0xep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SHOWSIGN. */ + char *result; + int retval = + my_asprintf (&result, "%+La %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "+0x1.cp+0 33") == 0 + || strcmp (result, "+0x3.8p-1 33") == 0 + || strcmp (result, "+0x7p-2 33") == 0 + || strcmp (result, "+0xep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SPACE. */ + char *result; + int retval = + my_asprintf (&result, "% La %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#La %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.cp+0 33") == 0 + || strcmp (result, "0x3.8p-1 33") == 0 + || strcmp (result, "0x7.p-2 33") == 0 + || strcmp (result, "0xe.p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#La %d", 1.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x1.p+0 33") == 0 + || strcmp (result, "0x2.p-1 33") == 0 + || strcmp (result, "0x4.p-2 33") == 0 + || strcmp (result, "0x8.p-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with finite number. */ + char *result; + int retval = + my_asprintf (&result, "%010La %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0x001.cp+0 33") == 0 + || strcmp (result, "0x003.8p-1 33") == 0 + || strcmp (result, "0x00007p-2 33") == 0 + || strcmp (result, "0x0000ep-3 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%010La %d", 1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + /* "0000000inf 33" is not a valid result; see + */ + ASSERT (strcmp (result, " inf 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with NaN. */ + char *result; + int retval = + my_asprintf (&result, "%050La %d", 0.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + /* "0000000nan 33" is not a valid result; see + */ + ASSERT (strlen (result) == 50 + 3 + && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + /* Test the support of the %f format directive. */ + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%f %d", 12.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A larger positive number. */ + char *result; + int retval = + my_asprintf (&result, "%f %d", 1234567.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1234567.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Small and large positive numbers. */ + static struct { double value; const char *string; } data[] = + { + { 1.234321234321234e-37, "0.000000" }, + { 1.234321234321234e-36, "0.000000" }, + { 1.234321234321234e-35, "0.000000" }, + { 1.234321234321234e-34, "0.000000" }, + { 1.234321234321234e-33, "0.000000" }, + { 1.234321234321234e-32, "0.000000" }, + { 1.234321234321234e-31, "0.000000" }, + { 1.234321234321234e-30, "0.000000" }, + { 1.234321234321234e-29, "0.000000" }, + { 1.234321234321234e-28, "0.000000" }, + { 1.234321234321234e-27, "0.000000" }, + { 1.234321234321234e-26, "0.000000" }, + { 1.234321234321234e-25, "0.000000" }, + { 1.234321234321234e-24, "0.000000" }, + { 1.234321234321234e-23, "0.000000" }, + { 1.234321234321234e-22, "0.000000" }, + { 1.234321234321234e-21, "0.000000" }, + { 1.234321234321234e-20, "0.000000" }, + { 1.234321234321234e-19, "0.000000" }, + { 1.234321234321234e-18, "0.000000" }, + { 1.234321234321234e-17, "0.000000" }, + { 1.234321234321234e-16, "0.000000" }, + { 1.234321234321234e-15, "0.000000" }, + { 1.234321234321234e-14, "0.000000" }, + { 1.234321234321234e-13, "0.000000" }, + { 1.234321234321234e-12, "0.000000" }, + { 1.234321234321234e-11, "0.000000" }, + { 1.234321234321234e-10, "0.000000" }, + { 1.234321234321234e-9, "0.000000" }, + { 1.234321234321234e-8, "0.000000" }, + { 1.234321234321234e-7, "0.000000" }, + { 1.234321234321234e-6, "0.000001" }, + { 1.234321234321234e-5, "0.000012" }, + { 1.234321234321234e-4, "0.000123" }, + { 1.234321234321234e-3, "0.001234" }, + { 1.234321234321234e-2, "0.012343" }, + { 1.234321234321234e-1, "0.123432" }, + { 1.234321234321234, "1.234321" }, + { 1.234321234321234e1, "12.343212" }, + { 1.234321234321234e2, "123.432123" }, + { 1.234321234321234e3, "1234.321234" }, + { 1.234321234321234e4, "12343.212343" }, + { 1.234321234321234e5, "123432.123432" }, + { 1.234321234321234e6, "1234321.234321" }, + { 1.234321234321234e7, "12343212.343212" }, + { 1.234321234321234e8, "123432123.432123" }, + { 1.234321234321234e9, "1234321234.321234" }, + { 1.234321234321234e10, "12343212343.2123**" }, + { 1.234321234321234e11, "123432123432.123***" }, + { 1.234321234321234e12, "1234321234321.23****" }, + { 1.234321234321234e13, "12343212343212.3*****" }, + { 1.234321234321234e14, "123432123432123.******" }, + { 1.234321234321234e15, "1234321234321234.000000" }, + { 1.234321234321234e16, "123432123432123**.000000" }, + { 1.234321234321234e17, "123432123432123***.000000" }, + { 1.234321234321234e18, "123432123432123****.000000" }, + { 1.234321234321234e19, "123432123432123*****.000000" }, + { 1.234321234321234e20, "123432123432123******.000000" }, + { 1.234321234321234e21, "123432123432123*******.000000" }, + { 1.234321234321234e22, "123432123432123********.000000" }, + { 1.234321234321234e23, "123432123432123*********.000000" }, + { 1.234321234321234e24, "123432123432123**********.000000" }, + { 1.234321234321234e25, "123432123432123***********.000000" }, + { 1.234321234321234e26, "123432123432123************.000000" }, + { 1.234321234321234e27, "123432123432123*************.000000" }, + { 1.234321234321234e28, "123432123432123**************.000000" }, + { 1.234321234321234e29, "123432123432123***************.000000" }, + { 1.234321234321234e30, "123432123432123****************.000000" }, + { 1.234321234321234e31, "123432123432123*****************.000000" }, + { 1.234321234321234e32, "123432123432123******************.000000" }, + { 1.234321234321234e33, "123432123432123*******************.000000" }, + { 1.234321234321234e34, "123432123432123********************.000000" }, + { 1.234321234321234e35, "123432123432123*********************.000000" }, + { 1.234321234321234e36, "123432123432123**********************.000000" } + }; + size_t k; + for (k = 0; k < SIZEOF (data); k++) + { + char *result; + int retval = + my_asprintf (&result, "%f", data[k].value); + ASSERT (result != NULL); + ASSERT (strmatch (data[k].string, result)); + ASSERT (retval == strlen (result)); + free (result); + } + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%f %d", -0.03125, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-0.031250 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%f %d", 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%f %d", -0.0, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%f %d", 1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "inf 33") == 0 + || strcmp (result, "infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%f %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-inf 33") == 0 + || strcmp (result, "-infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + char *result; + int retval = + my_asprintf (&result, "%f %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Width. */ + char *result; + int retval = + my_asprintf (&result, "%10f %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_LEFT. */ + char *result; + int retval = + my_asprintf (&result, "%-10f %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SHOWSIGN. */ + char *result; + int retval = + my_asprintf (&result, "%+f %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "+1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SPACE. */ + char *result; + int retval = + my_asprintf (&result, "% f %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#f %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.f %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "2. 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with finite number. */ + char *result; + int retval = + my_asprintf (&result, "%015f %d", 1234.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "00001234.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%015f %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " -inf 33") == 0 + || strcmp (result, " -infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with NaN. */ + char *result; + int retval = + my_asprintf (&result, "%050f %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) == 50 + 3 + && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Precision. */ + char *result; + int retval = + my_asprintf (&result, "%.f %d", 1234.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1234 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%Lf %d", 12.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A larger positive number. */ + char *result; + int retval = + my_asprintf (&result, "%Lf %d", 1234567.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1234567.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Small and large positive numbers. */ + static struct { long double value; const char *string; } data[] = + { + { 1.234321234321234e-37L, "0.000000" }, + { 1.234321234321234e-36L, "0.000000" }, + { 1.234321234321234e-35L, "0.000000" }, + { 1.234321234321234e-34L, "0.000000" }, + { 1.234321234321234e-33L, "0.000000" }, + { 1.234321234321234e-32L, "0.000000" }, + { 1.234321234321234e-31L, "0.000000" }, + { 1.234321234321234e-30L, "0.000000" }, + { 1.234321234321234e-29L, "0.000000" }, + { 1.234321234321234e-28L, "0.000000" }, + { 1.234321234321234e-27L, "0.000000" }, + { 1.234321234321234e-26L, "0.000000" }, + { 1.234321234321234e-25L, "0.000000" }, + { 1.234321234321234e-24L, "0.000000" }, + { 1.234321234321234e-23L, "0.000000" }, + { 1.234321234321234e-22L, "0.000000" }, + { 1.234321234321234e-21L, "0.000000" }, + { 1.234321234321234e-20L, "0.000000" }, + { 1.234321234321234e-19L, "0.000000" }, + { 1.234321234321234e-18L, "0.000000" }, + { 1.234321234321234e-17L, "0.000000" }, + { 1.234321234321234e-16L, "0.000000" }, + { 1.234321234321234e-15L, "0.000000" }, + { 1.234321234321234e-14L, "0.000000" }, + { 1.234321234321234e-13L, "0.000000" }, + { 1.234321234321234e-12L, "0.000000" }, + { 1.234321234321234e-11L, "0.000000" }, + { 1.234321234321234e-10L, "0.000000" }, + { 1.234321234321234e-9L, "0.000000" }, + { 1.234321234321234e-8L, "0.000000" }, + { 1.234321234321234e-7L, "0.000000" }, + { 1.234321234321234e-6L, "0.000001" }, + { 1.234321234321234e-5L, "0.000012" }, + { 1.234321234321234e-4L, "0.000123" }, + { 1.234321234321234e-3L, "0.001234" }, + { 1.234321234321234e-2L, "0.012343" }, + { 1.234321234321234e-1L, "0.123432" }, + { 1.234321234321234L, "1.234321" }, + { 1.234321234321234e1L, "12.343212" }, + { 1.234321234321234e2L, "123.432123" }, + { 1.234321234321234e3L, "1234.321234" }, + { 1.234321234321234e4L, "12343.212343" }, + { 1.234321234321234e5L, "123432.123432" }, + { 1.234321234321234e6L, "1234321.234321" }, + { 1.234321234321234e7L, "12343212.343212" }, + { 1.234321234321234e8L, "123432123.432123" }, + { 1.234321234321234e9L, "1234321234.321234" }, + { 1.234321234321234e10L, "12343212343.2123**" }, + { 1.234321234321234e11L, "123432123432.123***" }, + { 1.234321234321234e12L, "1234321234321.23****" }, + { 1.234321234321234e13L, "12343212343212.3*****" }, + { 1.234321234321234e14L, "123432123432123.******" }, + { 1.234321234321234e15L, "1234321234321234.000000" }, + { 1.234321234321234e16L, "123432123432123**.000000" }, + { 1.234321234321234e17L, "123432123432123***.000000" }, + { 1.234321234321234e18L, "123432123432123****.000000" }, + { 1.234321234321234e19L, "123432123432123*****.000000" }, + { 1.234321234321234e20L, "123432123432123******.000000" }, + { 1.234321234321234e21L, "123432123432123*******.000000" }, + { 1.234321234321234e22L, "123432123432123********.000000" }, + { 1.234321234321234e23L, "123432123432123*********.000000" }, + { 1.234321234321234e24L, "123432123432123**********.000000" }, + { 1.234321234321234e25L, "123432123432123***********.000000" }, + { 1.234321234321234e26L, "123432123432123************.000000" }, + { 1.234321234321234e27L, "123432123432123*************.000000" }, + { 1.234321234321234e28L, "123432123432123**************.000000" }, + { 1.234321234321234e29L, "123432123432123***************.000000" }, + { 1.234321234321234e30L, "123432123432123****************.000000" }, + { 1.234321234321234e31L, "123432123432123*****************.000000" }, + { 1.234321234321234e32L, "123432123432123******************.000000" }, + { 1.234321234321234e33L, "123432123432123*******************.000000" }, + { 1.234321234321234e34L, "123432123432123********************.000000" }, + { 1.234321234321234e35L, "123432123432123*********************.000000" }, + { 1.234321234321234e36L, "123432123432123**********************.000000" } + }; + size_t k; + for (k = 0; k < SIZEOF (data); k++) + { + char *result; + int retval = + my_asprintf (&result, "%Lf", data[k].value); + ASSERT (result != NULL); + ASSERT (strmatch (data[k].string, result)); + ASSERT (retval == strlen (result)); + free (result); + } + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%Lf %d", -0.03125L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-0.031250 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%Lf %d", 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%Lf %d", -0.0L, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%Lf %d", 1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "inf 33") == 0 + || strcmp (result, "infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%Lf %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-inf 33") == 0 + || strcmp (result, "-infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + static long double zero = 0.0L; + char *result; + int retval = + my_asprintf (&result, "%Lf %d", zero / zero, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in + Intel IA-64 Architecture Software Developer's Manual, Volume 1: + Application Architecture. + Table 5-2 "Floating-Point Register Encodings" + Figure 5-6 "Memory to Floating-Point Register Data Translation" + */ + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lf %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } +#endif + + { /* Width. */ + char *result; + int retval = + my_asprintf (&result, "%10Lf %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_LEFT. */ + char *result; + int retval = + my_asprintf (&result, "%-10Lf %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SHOWSIGN. */ + char *result; + int retval = + my_asprintf (&result, "%+Lf %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "+1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SPACE. */ + char *result; + int retval = + my_asprintf (&result, "% Lf %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#Lf %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.Lf %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "2. 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with finite number. */ + char *result; + int retval = + my_asprintf (&result, "%015Lf %d", 1234.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "00001234.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%015Lf %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " -inf 33") == 0 + || strcmp (result, " -infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with NaN. */ + static long double zero = 0.0L; + char *result; + int retval = + my_asprintf (&result, "%050Lf %d", zero / zero, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) == 50 + 3 + && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Precision. */ + char *result; + int retval = + my_asprintf (&result, "%.Lf %d", 1234.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1234 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + /* Test the support of the %F format directive. */ + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%F %d", 12.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A larger positive number. */ + char *result; + int retval = + my_asprintf (&result, "%F %d", 1234567.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1234567.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%F %d", -0.03125, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-0.031250 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%F %d", 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%F %d", -0.0, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%F %d", 1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "INF 33") == 0 + || strcmp (result, "INFINITY 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%F %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-INF 33") == 0 + || strcmp (result, "-INFINITY 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + char *result; + int retval = + my_asprintf (&result, "%F %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 1) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO. */ + char *result; + int retval = + my_asprintf (&result, "%015F %d", 1234.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "00001234.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%015F %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " -INF 33") == 0 + || strcmp (result, " -INFINITY 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Precision. */ + char *result; + int retval = + my_asprintf (&result, "%.F %d", 1234.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1234 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%LF %d", 12.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12.750000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A larger positive number. */ + char *result; + int retval = + my_asprintf (&result, "%LF %d", 1234567.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1234567.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%LF %d", -0.03125L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-0.031250 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%LF %d", 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%LF %d", -0.0L, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%LF %d", 1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "INF 33") == 0 + || strcmp (result, "INFINITY 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%LF %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-INF 33") == 0 + || strcmp (result, "-INFINITY 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + static long double zero = 0.0L; + char *result; + int retval = + my_asprintf (&result, "%LF %d", zero / zero, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 1) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO. */ + char *result; + int retval = + my_asprintf (&result, "%015LF %d", 1234.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "00001234.000000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%015LF %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " -INF 33") == 0 + || strcmp (result, " -INFINITY 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Precision. */ + char *result; + int retval = + my_asprintf (&result, "%.LF %d", 1234.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1234 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + /* Test the support of the %e format directive. */ + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%e %d", 12.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.275000e+01 33") == 0 + || strcmp (result, "1.275000e+001 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A larger positive number. */ + char *result; + int retval = + my_asprintf (&result, "%e %d", 1234567.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.234567e+06 33") == 0 + || strcmp (result, "1.234567e+006 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Small and large positive numbers. */ + static struct { double value; const char *string; } data[] = + { + { 1.234321234321234e-37, "1.234321e-37" }, + { 1.234321234321234e-36, "1.234321e-36" }, + { 1.234321234321234e-35, "1.234321e-35" }, + { 1.234321234321234e-34, "1.234321e-34" }, + { 1.234321234321234e-33, "1.234321e-33" }, + { 1.234321234321234e-32, "1.234321e-32" }, + { 1.234321234321234e-31, "1.234321e-31" }, + { 1.234321234321234e-30, "1.234321e-30" }, + { 1.234321234321234e-29, "1.234321e-29" }, + { 1.234321234321234e-28, "1.234321e-28" }, + { 1.234321234321234e-27, "1.234321e-27" }, + { 1.234321234321234e-26, "1.234321e-26" }, + { 1.234321234321234e-25, "1.234321e-25" }, + { 1.234321234321234e-24, "1.234321e-24" }, + { 1.234321234321234e-23, "1.234321e-23" }, + { 1.234321234321234e-22, "1.234321e-22" }, + { 1.234321234321234e-21, "1.234321e-21" }, + { 1.234321234321234e-20, "1.234321e-20" }, + { 1.234321234321234e-19, "1.234321e-19" }, + { 1.234321234321234e-18, "1.234321e-18" }, + { 1.234321234321234e-17, "1.234321e-17" }, + { 1.234321234321234e-16, "1.234321e-16" }, + { 1.234321234321234e-15, "1.234321e-15" }, + { 1.234321234321234e-14, "1.234321e-14" }, + { 1.234321234321234e-13, "1.234321e-13" }, + { 1.234321234321234e-12, "1.234321e-12" }, + { 1.234321234321234e-11, "1.234321e-11" }, + { 1.234321234321234e-10, "1.234321e-10" }, + { 1.234321234321234e-9, "1.234321e-09" }, + { 1.234321234321234e-8, "1.234321e-08" }, + { 1.234321234321234e-7, "1.234321e-07" }, + { 1.234321234321234e-6, "1.234321e-06" }, + { 1.234321234321234e-5, "1.234321e-05" }, + { 1.234321234321234e-4, "1.234321e-04" }, + { 1.234321234321234e-3, "1.234321e-03" }, + { 1.234321234321234e-2, "1.234321e-02" }, + { 1.234321234321234e-1, "1.234321e-01" }, + { 1.234321234321234, "1.234321e+00" }, + { 1.234321234321234e1, "1.234321e+01" }, + { 1.234321234321234e2, "1.234321e+02" }, + { 1.234321234321234e3, "1.234321e+03" }, + { 1.234321234321234e4, "1.234321e+04" }, + { 1.234321234321234e5, "1.234321e+05" }, + { 1.234321234321234e6, "1.234321e+06" }, + { 1.234321234321234e7, "1.234321e+07" }, + { 1.234321234321234e8, "1.234321e+08" }, + { 1.234321234321234e9, "1.234321e+09" }, + { 1.234321234321234e10, "1.234321e+10" }, + { 1.234321234321234e11, "1.234321e+11" }, + { 1.234321234321234e12, "1.234321e+12" }, + { 1.234321234321234e13, "1.234321e+13" }, + { 1.234321234321234e14, "1.234321e+14" }, + { 1.234321234321234e15, "1.234321e+15" }, + { 1.234321234321234e16, "1.234321e+16" }, + { 1.234321234321234e17, "1.234321e+17" }, + { 1.234321234321234e18, "1.234321e+18" }, + { 1.234321234321234e19, "1.234321e+19" }, + { 1.234321234321234e20, "1.234321e+20" }, + { 1.234321234321234e21, "1.234321e+21" }, + { 1.234321234321234e22, "1.234321e+22" }, + { 1.234321234321234e23, "1.234321e+23" }, + { 1.234321234321234e24, "1.234321e+24" }, + { 1.234321234321234e25, "1.234321e+25" }, + { 1.234321234321234e26, "1.234321e+26" }, + { 1.234321234321234e27, "1.234321e+27" }, + { 1.234321234321234e28, "1.234321e+28" }, + { 1.234321234321234e29, "1.234321e+29" }, + { 1.234321234321234e30, "1.234321e+30" }, + { 1.234321234321234e31, "1.234321e+31" }, + { 1.234321234321234e32, "1.234321e+32" }, + { 1.234321234321234e33, "1.234321e+33" }, + { 1.234321234321234e34, "1.234321e+34" }, + { 1.234321234321234e35, "1.234321e+35" }, + { 1.234321234321234e36, "1.234321e+36" } + }; + size_t k; + for (k = 0; k < SIZEOF (data); k++) + { + char *result; + int retval = + my_asprintf (&result, "%e", data[k].value); + const char *expected = data[k].string; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0 + /* Some implementations produce exponents with 3 digits. */ + || (strlen (result) == strlen (expected) + 1 + && memcmp (result, expected, strlen (expected) - 2) == 0 + && result[strlen (expected) - 2] == '0' + && strcmp (result + strlen (expected) - 1, + expected + strlen (expected) - 2) + == 0)); + ASSERT (retval == strlen (result)); + free (result); + } + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%e %d", -0.03125, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-3.125000e-02 33") == 0 + || strcmp (result, "-3.125000e-002 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%e %d", 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0.000000e+00 33") == 0 + || strcmp (result, "0.000000e+000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%e %d", -0.0, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0.000000e+00 33") == 0 + || strcmp (result, "-0.000000e+000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%e %d", 1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "inf 33") == 0 + || strcmp (result, "infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%e %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-inf 33") == 0 + || strcmp (result, "-infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + char *result; + int retval = + my_asprintf (&result, "%e %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Width. */ + char *result; + int retval = + my_asprintf (&result, "%15e %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.750000e+00 33") == 0 + || strcmp (result, " 1.750000e+000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_LEFT. */ + char *result; + int retval = + my_asprintf (&result, "%-15e %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.750000e+00 33") == 0 + || strcmp (result, "1.750000e+000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SHOWSIGN. */ + char *result; + int retval = + my_asprintf (&result, "%+e %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "+1.750000e+00 33") == 0 + || strcmp (result, "+1.750000e+000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SPACE. */ + char *result; + int retval = + my_asprintf (&result, "% e %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.750000e+00 33") == 0 + || strcmp (result, " 1.750000e+000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#e %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.750000e+00 33") == 0 + || strcmp (result, "1.750000e+000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.e %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "2.e+00 33") == 0 + || strcmp (result, "2.e+000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.e %d", 9.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.e+01 33") == 0 + || strcmp (result, "1.e+001 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with finite number. */ + char *result; + int retval = + my_asprintf (&result, "%015e %d", 1234.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0001.234000e+03 33") == 0 + || strcmp (result, "001.234000e+003 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%015e %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " -inf 33") == 0 + || strcmp (result, " -infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with NaN. */ + char *result; + int retval = + my_asprintf (&result, "%050e %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) == 50 + 3 + && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Precision. */ + char *result; + int retval = + my_asprintf (&result, "%.e %d", 1234.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1e+03 33") == 0 + || strcmp (result, "1e+003 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%Le %d", 12.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.275000e+01 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A larger positive number. */ + char *result; + int retval = + my_asprintf (&result, "%Le %d", 1234567.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.234567e+06 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Small and large positive numbers. */ + static struct { long double value; const char *string; } data[] = + { + { 1.234321234321234e-37L, "1.234321e-37" }, + { 1.234321234321234e-36L, "1.234321e-36" }, + { 1.234321234321234e-35L, "1.234321e-35" }, + { 1.234321234321234e-34L, "1.234321e-34" }, + { 1.234321234321234e-33L, "1.234321e-33" }, + { 1.234321234321234e-32L, "1.234321e-32" }, + { 1.234321234321234e-31L, "1.234321e-31" }, + { 1.234321234321234e-30L, "1.234321e-30" }, + { 1.234321234321234e-29L, "1.234321e-29" }, + { 1.234321234321234e-28L, "1.234321e-28" }, + { 1.234321234321234e-27L, "1.234321e-27" }, + { 1.234321234321234e-26L, "1.234321e-26" }, + { 1.234321234321234e-25L, "1.234321e-25" }, + { 1.234321234321234e-24L, "1.234321e-24" }, + { 1.234321234321234e-23L, "1.234321e-23" }, + { 1.234321234321234e-22L, "1.234321e-22" }, + { 1.234321234321234e-21L, "1.234321e-21" }, + { 1.234321234321234e-20L, "1.234321e-20" }, + { 1.234321234321234e-19L, "1.234321e-19" }, + { 1.234321234321234e-18L, "1.234321e-18" }, + { 1.234321234321234e-17L, "1.234321e-17" }, + { 1.234321234321234e-16L, "1.234321e-16" }, + { 1.234321234321234e-15L, "1.234321e-15" }, + { 1.234321234321234e-14L, "1.234321e-14" }, + { 1.234321234321234e-13L, "1.234321e-13" }, + { 1.234321234321234e-12L, "1.234321e-12" }, + { 1.234321234321234e-11L, "1.234321e-11" }, + { 1.234321234321234e-10L, "1.234321e-10" }, + { 1.234321234321234e-9L, "1.234321e-09" }, + { 1.234321234321234e-8L, "1.234321e-08" }, + { 1.234321234321234e-7L, "1.234321e-07" }, + { 1.234321234321234e-6L, "1.234321e-06" }, + { 1.234321234321234e-5L, "1.234321e-05" }, + { 1.234321234321234e-4L, "1.234321e-04" }, + { 1.234321234321234e-3L, "1.234321e-03" }, + { 1.234321234321234e-2L, "1.234321e-02" }, + { 1.234321234321234e-1L, "1.234321e-01" }, + { 1.234321234321234L, "1.234321e+00" }, + { 1.234321234321234e1L, "1.234321e+01" }, + { 1.234321234321234e2L, "1.234321e+02" }, + { 1.234321234321234e3L, "1.234321e+03" }, + { 1.234321234321234e4L, "1.234321e+04" }, + { 1.234321234321234e5L, "1.234321e+05" }, + { 1.234321234321234e6L, "1.234321e+06" }, + { 1.234321234321234e7L, "1.234321e+07" }, + { 1.234321234321234e8L, "1.234321e+08" }, + { 1.234321234321234e9L, "1.234321e+09" }, + { 1.234321234321234e10L, "1.234321e+10" }, + { 1.234321234321234e11L, "1.234321e+11" }, + { 1.234321234321234e12L, "1.234321e+12" }, + { 1.234321234321234e13L, "1.234321e+13" }, + { 1.234321234321234e14L, "1.234321e+14" }, + { 1.234321234321234e15L, "1.234321e+15" }, + { 1.234321234321234e16L, "1.234321e+16" }, + { 1.234321234321234e17L, "1.234321e+17" }, + { 1.234321234321234e18L, "1.234321e+18" }, + { 1.234321234321234e19L, "1.234321e+19" }, + { 1.234321234321234e20L, "1.234321e+20" }, + { 1.234321234321234e21L, "1.234321e+21" }, + { 1.234321234321234e22L, "1.234321e+22" }, + { 1.234321234321234e23L, "1.234321e+23" }, + { 1.234321234321234e24L, "1.234321e+24" }, + { 1.234321234321234e25L, "1.234321e+25" }, + { 1.234321234321234e26L, "1.234321e+26" }, + { 1.234321234321234e27L, "1.234321e+27" }, + { 1.234321234321234e28L, "1.234321e+28" }, + { 1.234321234321234e29L, "1.234321e+29" }, + { 1.234321234321234e30L, "1.234321e+30" }, + { 1.234321234321234e31L, "1.234321e+31" }, + { 1.234321234321234e32L, "1.234321e+32" }, + { 1.234321234321234e33L, "1.234321e+33" }, + { 1.234321234321234e34L, "1.234321e+34" }, + { 1.234321234321234e35L, "1.234321e+35" }, + { 1.234321234321234e36L, "1.234321e+36" } + }; + size_t k; + for (k = 0; k < SIZEOF (data); k++) + { + char *result; + int retval = + my_asprintf (&result, "%Le", data[k].value); + ASSERT (result != NULL); + ASSERT (strcmp (result, data[k].string) == 0); + ASSERT (retval == strlen (result)); + free (result); + } + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%Le %d", -0.03125L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-3.125000e-02 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%Le %d", 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0.000000e+00 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%Le %d", -0.0L, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0.000000e+00 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%Le %d", 1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "inf 33") == 0 + || strcmp (result, "infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%Le %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-inf 33") == 0 + || strcmp (result, "-infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + static long double zero = 0.0L; + char *result; + int retval = + my_asprintf (&result, "%Le %d", zero / zero, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Le %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Le %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in + Intel IA-64 Architecture Software Developer's Manual, Volume 1: + Application Architecture. + Table 5-2 "Floating-Point Register Encodings" + Figure 5-6 "Memory to Floating-Point Register Data Translation" + */ + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Le %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Le %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Le %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Le %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Le %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } +#endif + + { /* Width. */ + char *result; + int retval = + my_asprintf (&result, "%15Le %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.750000e+00 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_LEFT. */ + char *result; + int retval = + my_asprintf (&result, "%-15Le %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.750000e+00 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SHOWSIGN. */ + char *result; + int retval = + my_asprintf (&result, "%+Le %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "+1.750000e+00 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SPACE. */ + char *result; + int retval = + my_asprintf (&result, "% Le %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.750000e+00 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#Le %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.750000e+00 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.Le %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "2.e+00 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.Le %d", 9.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.e+01 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with finite number. */ + char *result; + int retval = + my_asprintf (&result, "%015Le %d", 1234.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0001.234000e+03 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%015Le %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " -inf 33") == 0 + || strcmp (result, " -infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with NaN. */ + static long double zero = 0.0L; + char *result; + int retval = + my_asprintf (&result, "%050Le %d", zero / zero, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) == 50 + 3 + && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Precision. */ + char *result; + int retval = + my_asprintf (&result, "%.Le %d", 1234.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1e+03 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + /* Test the support of the %g format directive. */ + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%g %d", 12.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A larger positive number. */ + char *result; + int retval = + my_asprintf (&result, "%g %d", 1234567.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.23457e+06 33") == 0 + || strcmp (result, "1.23457e+006 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Small and large positive numbers. */ + static struct { double value; const char *string; } data[] = + { + { 1.234321234321234e-37, "1.23432e-37" }, + { 1.234321234321234e-36, "1.23432e-36" }, + { 1.234321234321234e-35, "1.23432e-35" }, + { 1.234321234321234e-34, "1.23432e-34" }, + { 1.234321234321234e-33, "1.23432e-33" }, + { 1.234321234321234e-32, "1.23432e-32" }, + { 1.234321234321234e-31, "1.23432e-31" }, + { 1.234321234321234e-30, "1.23432e-30" }, + { 1.234321234321234e-29, "1.23432e-29" }, + { 1.234321234321234e-28, "1.23432e-28" }, + { 1.234321234321234e-27, "1.23432e-27" }, + { 1.234321234321234e-26, "1.23432e-26" }, + { 1.234321234321234e-25, "1.23432e-25" }, + { 1.234321234321234e-24, "1.23432e-24" }, + { 1.234321234321234e-23, "1.23432e-23" }, + { 1.234321234321234e-22, "1.23432e-22" }, + { 1.234321234321234e-21, "1.23432e-21" }, + { 1.234321234321234e-20, "1.23432e-20" }, + { 1.234321234321234e-19, "1.23432e-19" }, + { 1.234321234321234e-18, "1.23432e-18" }, + { 1.234321234321234e-17, "1.23432e-17" }, + { 1.234321234321234e-16, "1.23432e-16" }, + { 1.234321234321234e-15, "1.23432e-15" }, + { 1.234321234321234e-14, "1.23432e-14" }, + { 1.234321234321234e-13, "1.23432e-13" }, + { 1.234321234321234e-12, "1.23432e-12" }, + { 1.234321234321234e-11, "1.23432e-11" }, + { 1.234321234321234e-10, "1.23432e-10" }, + { 1.234321234321234e-9, "1.23432e-09" }, + { 1.234321234321234e-8, "1.23432e-08" }, + { 1.234321234321234e-7, "1.23432e-07" }, + { 1.234321234321234e-6, "1.23432e-06" }, + { 1.234321234321234e-5, "1.23432e-05" }, + { 1.234321234321234e-4, "0.000123432" }, + { 1.234321234321234e-3, "0.00123432" }, + { 1.234321234321234e-2, "0.0123432" }, + { 1.234321234321234e-1, "0.123432" }, + { 1.234321234321234, "1.23432" }, + { 1.234321234321234e1, "12.3432" }, + { 1.234321234321234e2, "123.432" }, + { 1.234321234321234e3, "1234.32" }, + { 1.234321234321234e4, "12343.2" }, + { 1.234321234321234e5, "123432" }, + { 1.234321234321234e6, "1.23432e+06" }, + { 1.234321234321234e7, "1.23432e+07" }, + { 1.234321234321234e8, "1.23432e+08" }, + { 1.234321234321234e9, "1.23432e+09" }, + { 1.234321234321234e10, "1.23432e+10" }, + { 1.234321234321234e11, "1.23432e+11" }, + { 1.234321234321234e12, "1.23432e+12" }, + { 1.234321234321234e13, "1.23432e+13" }, + { 1.234321234321234e14, "1.23432e+14" }, + { 1.234321234321234e15, "1.23432e+15" }, + { 1.234321234321234e16, "1.23432e+16" }, + { 1.234321234321234e17, "1.23432e+17" }, + { 1.234321234321234e18, "1.23432e+18" }, + { 1.234321234321234e19, "1.23432e+19" }, + { 1.234321234321234e20, "1.23432e+20" }, + { 1.234321234321234e21, "1.23432e+21" }, + { 1.234321234321234e22, "1.23432e+22" }, + { 1.234321234321234e23, "1.23432e+23" }, + { 1.234321234321234e24, "1.23432e+24" }, + { 1.234321234321234e25, "1.23432e+25" }, + { 1.234321234321234e26, "1.23432e+26" }, + { 1.234321234321234e27, "1.23432e+27" }, + { 1.234321234321234e28, "1.23432e+28" }, + { 1.234321234321234e29, "1.23432e+29" }, + { 1.234321234321234e30, "1.23432e+30" }, + { 1.234321234321234e31, "1.23432e+31" }, + { 1.234321234321234e32, "1.23432e+32" }, + { 1.234321234321234e33, "1.23432e+33" }, + { 1.234321234321234e34, "1.23432e+34" }, + { 1.234321234321234e35, "1.23432e+35" }, + { 1.234321234321234e36, "1.23432e+36" } + }; + size_t k; + for (k = 0; k < SIZEOF (data); k++) + { + char *result; + int retval = + my_asprintf (&result, "%g", data[k].value); + const char *expected = data[k].string; + ASSERT (result != NULL); + ASSERT (strcmp (result, expected) == 0 + /* Some implementations produce exponents with 3 digits. */ + || (expected[strlen (expected) - 4] == 'e' + && strlen (result) == strlen (expected) + 1 + && memcmp (result, expected, strlen (expected) - 2) == 0 + && result[strlen (expected) - 2] == '0' + && strcmp (result + strlen (expected) - 1, + expected + strlen (expected) - 2) + == 0)); + ASSERT (retval == strlen (result)); + free (result); + } + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%g %d", -0.03125, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-0.03125 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%g %d", 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%g %d", -0.0, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%g %d", 1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "inf 33") == 0 + || strcmp (result, "infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%g %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-inf 33") == 0 + || strcmp (result, "-infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + char *result; + int retval = + my_asprintf (&result, "%g %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Width. */ + char *result; + int retval = + my_asprintf (&result, "%10g %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_LEFT. */ + char *result; + int retval = + my_asprintf (&result, "%-10g %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SHOWSIGN. */ + char *result; + int retval = + my_asprintf (&result, "%+g %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "+1.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SPACE. */ + char *result; + int retval = + my_asprintf (&result, "% g %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#g %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.75000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.g %d", 1.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "2. 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.g %d", 9.75, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.e+01 33") == 0 + || strcmp (result, "1.e+001 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with finite number. */ + char *result; + int retval = + my_asprintf (&result, "%010g %d", 1234.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0000001234 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%015g %d", -1.0 / 0.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " -inf 33") == 0 + || strcmp (result, " -infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with NaN. */ + char *result; + int retval = + my_asprintf (&result, "%050g %d", NaN (), 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) == 50 + 3 + && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Precision. */ + char *result; + int retval = + my_asprintf (&result, "%.g %d", 1234.0, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1e+03 33") == 0 + || strcmp (result, "1e+003 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A positive number. */ + char *result; + int retval = + my_asprintf (&result, "%Lg %d", 12.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* A larger positive number. */ + char *result; + int retval = + my_asprintf (&result, "%Lg %d", 1234567.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.23457e+06 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Small and large positive numbers. */ + static struct { long double value; const char *string; } data[] = + { + { 1.234321234321234e-37L, "1.23432e-37" }, + { 1.234321234321234e-36L, "1.23432e-36" }, + { 1.234321234321234e-35L, "1.23432e-35" }, + { 1.234321234321234e-34L, "1.23432e-34" }, + { 1.234321234321234e-33L, "1.23432e-33" }, + { 1.234321234321234e-32L, "1.23432e-32" }, + { 1.234321234321234e-31L, "1.23432e-31" }, + { 1.234321234321234e-30L, "1.23432e-30" }, + { 1.234321234321234e-29L, "1.23432e-29" }, + { 1.234321234321234e-28L, "1.23432e-28" }, + { 1.234321234321234e-27L, "1.23432e-27" }, + { 1.234321234321234e-26L, "1.23432e-26" }, + { 1.234321234321234e-25L, "1.23432e-25" }, + { 1.234321234321234e-24L, "1.23432e-24" }, + { 1.234321234321234e-23L, "1.23432e-23" }, + { 1.234321234321234e-22L, "1.23432e-22" }, + { 1.234321234321234e-21L, "1.23432e-21" }, + { 1.234321234321234e-20L, "1.23432e-20" }, + { 1.234321234321234e-19L, "1.23432e-19" }, + { 1.234321234321234e-18L, "1.23432e-18" }, + { 1.234321234321234e-17L, "1.23432e-17" }, + { 1.234321234321234e-16L, "1.23432e-16" }, + { 1.234321234321234e-15L, "1.23432e-15" }, + { 1.234321234321234e-14L, "1.23432e-14" }, + { 1.234321234321234e-13L, "1.23432e-13" }, + { 1.234321234321234e-12L, "1.23432e-12" }, + { 1.234321234321234e-11L, "1.23432e-11" }, + { 1.234321234321234e-10L, "1.23432e-10" }, + { 1.234321234321234e-9L, "1.23432e-09" }, + { 1.234321234321234e-8L, "1.23432e-08" }, + { 1.234321234321234e-7L, "1.23432e-07" }, + { 1.234321234321234e-6L, "1.23432e-06" }, + { 1.234321234321234e-5L, "1.23432e-05" }, + { 1.234321234321234e-4L, "0.000123432" }, + { 1.234321234321234e-3L, "0.00123432" }, + { 1.234321234321234e-2L, "0.0123432" }, + { 1.234321234321234e-1L, "0.123432" }, + { 1.234321234321234L, "1.23432" }, + { 1.234321234321234e1L, "12.3432" }, + { 1.234321234321234e2L, "123.432" }, + { 1.234321234321234e3L, "1234.32" }, + { 1.234321234321234e4L, "12343.2" }, + { 1.234321234321234e5L, "123432" }, + { 1.234321234321234e6L, "1.23432e+06" }, + { 1.234321234321234e7L, "1.23432e+07" }, + { 1.234321234321234e8L, "1.23432e+08" }, + { 1.234321234321234e9L, "1.23432e+09" }, + { 1.234321234321234e10L, "1.23432e+10" }, + { 1.234321234321234e11L, "1.23432e+11" }, + { 1.234321234321234e12L, "1.23432e+12" }, + { 1.234321234321234e13L, "1.23432e+13" }, + { 1.234321234321234e14L, "1.23432e+14" }, + { 1.234321234321234e15L, "1.23432e+15" }, + { 1.234321234321234e16L, "1.23432e+16" }, + { 1.234321234321234e17L, "1.23432e+17" }, + { 1.234321234321234e18L, "1.23432e+18" }, + { 1.234321234321234e19L, "1.23432e+19" }, + { 1.234321234321234e20L, "1.23432e+20" }, + { 1.234321234321234e21L, "1.23432e+21" }, + { 1.234321234321234e22L, "1.23432e+22" }, + { 1.234321234321234e23L, "1.23432e+23" }, + { 1.234321234321234e24L, "1.23432e+24" }, + { 1.234321234321234e25L, "1.23432e+25" }, + { 1.234321234321234e26L, "1.23432e+26" }, + { 1.234321234321234e27L, "1.23432e+27" }, + { 1.234321234321234e28L, "1.23432e+28" }, + { 1.234321234321234e29L, "1.23432e+29" }, + { 1.234321234321234e30L, "1.23432e+30" }, + { 1.234321234321234e31L, "1.23432e+31" }, + { 1.234321234321234e32L, "1.23432e+32" }, + { 1.234321234321234e33L, "1.23432e+33" }, + { 1.234321234321234e34L, "1.23432e+34" }, + { 1.234321234321234e35L, "1.23432e+35" }, + { 1.234321234321234e36L, "1.23432e+36" } + }; + size_t k; + for (k = 0; k < SIZEOF (data); k++) + { + char *result; + int retval = + my_asprintf (&result, "%Lg", data[k].value); + ASSERT (result != NULL); + ASSERT (strcmp (result, data[k].string) == 0); + ASSERT (retval == strlen (result)); + free (result); + } + } + + { /* A negative number. */ + char *result; + int retval = + my_asprintf (&result, "%Lg %d", -0.03125L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-0.03125 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive zero. */ + char *result; + int retval = + my_asprintf (&result, "%Lg %d", 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative zero. */ + char *result; + int retval = + my_asprintf (&result, "%Lg %d", -0.0L, 33, 44, 55); + ASSERT (result != NULL); + if (have_minus_zero ()) + ASSERT (strcmp (result, "-0 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Positive infinity. */ + char *result; + int retval = + my_asprintf (&result, "%Lg %d", 1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "inf 33") == 0 + || strcmp (result, "infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Negative infinity. */ + char *result; + int retval = + my_asprintf (&result, "%Lg %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "-inf 33") == 0 + || strcmp (result, "-infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* NaN. */ + static long double zero = 0.0L; + char *result; + int retval = + my_asprintf (&result, "%Lg %d", zero / zero, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + /* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities, + Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in + Intel IA-64 Architecture Software Developer's Manual, Volume 1: + Application Architecture. + Table 5-2 "Floating-Point Register Encodings" + Figure 5-6 "Memory to Floating-Point Register Data Translation" + */ + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + char *result; + int retval = + my_asprintf (&result, "%Lg %d", x.value, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) >= 3 + 3 + && strisnan (result, 0, strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } +#endif + + { /* Width. */ + char *result; + int retval = + my_asprintf (&result, "%10Lg %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_LEFT. */ + char *result; + int retval = + my_asprintf (&result, "%-10Lg %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SHOWSIGN. */ + char *result; + int retval = + my_asprintf (&result, "%+Lg %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "+1.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_SPACE. */ + char *result; + int retval = + my_asprintf (&result, "% Lg %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " 1.75 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#Lg %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.75000 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.Lg %d", 1.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "2. 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ALT. */ + char *result; + int retval = + my_asprintf (&result, "%#.Lg %d", 9.75L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1.e+01 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with finite number. */ + char *result; + int retval = + my_asprintf (&result, "%010Lg %d", 1234.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "0000001234 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with infinite number. */ + char *result; + int retval = + my_asprintf (&result, "%015Lg %d", -1.0L / 0.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, " -inf 33") == 0 + || strcmp (result, " -infinity 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* FLAG_ZERO with NaN. */ + static long double zero = 0.0L; + char *result; + int retval = + my_asprintf (&result, "%050Lg %d", zero / zero, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strlen (result) == 50 + 3 + && strisnan (result, strspn (result, " "), strlen (result) - 3, 0) + && strcmp (result + strlen (result) - 3, " 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + { /* Precision. */ + char *result; + int retval = + my_asprintf (&result, "%.Lg %d", 1234.0L, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "1e+03 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + /* Test the support of the %n format directive. */ + + { + int count = -1; + char *result; + int retval = + my_asprintf (&result, "%d %n", 123, &count, 33, 44, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "123 ") == 0); + ASSERT (retval == strlen (result)); + ASSERT (count == 4); + free (result); + } + + /* Test the support of the POSIX/XSI format strings with positions. */ + + { + char *result; + int retval = + my_asprintf (&result, "%2$d %1$d", 33, 55); + ASSERT (result != NULL); + ASSERT (strcmp (result, "55 33") == 0); + ASSERT (retval == strlen (result)); + free (result); + } + + /* Test the support of the grouping flag. */ + + { + char *result; + int retval = + my_asprintf (&result, "%'d %d", 1234567, 99); + ASSERT (result != NULL); + ASSERT (result[strlen (result) - 1] == '9'); + ASSERT (retval == strlen (result)); + free (result); + } +} + +static int +my_asprintf (char **result, const char *format, ...) +{ + va_list args; + int ret; + + va_start (args, format); + ret = vasprintf (result, format, args); + va_end (args); + return ret; +} + +static void +test_vasprintf () +{ + test_function (my_asprintf); +} + +static void +test_asprintf () +{ + test_function (asprintf); +} + +int +main (int argc, char *argv[]) +{ + test_vasprintf (); + test_asprintf (); + return 0; +} diff -ruNp m4-1.4.9/tests/test-vasprintf.c m4-1.4.10/tests/test-vasprintf.c --- m4-1.4.9/tests/test-vasprintf.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-vasprintf.c 2007-05-30 19:31:12.000000000 -0600 @@ -0,0 +1,89 @@ +/* Test of vasprintf() and asprintf() functions. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#include +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +static int +my_asprintf (char **result, const char *format, ...) +{ + va_list args; + int ret; + + va_start (args, format); + ret = vasprintf (result, format, args); + va_end (args); + return ret; +} + +static void +test_vasprintf () +{ + int repeat; + + for (repeat = 0; repeat <= 8; repeat++) + { + char *result; + int retval = my_asprintf (&result, "%d", 12345); + ASSERT (retval == 5); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + free (result); + } +} + +static void +test_asprintf () +{ + int repeat; + + for (repeat = 0; repeat <= 8; repeat++) + { + char *result; + int retval = asprintf (&result, "%d", 12345); + ASSERT (retval == 5); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + free (result); + } +} + +int +main (int argc, char *argv[]) +{ + test_vasprintf (); + test_asprintf (); + return 0; +} diff -ruNp m4-1.4.9/tests/test-wchar.c m4-1.4.10/tests/test-wchar.c --- m4-1.4.9/tests/test-wchar.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-wchar.c 2007-05-30 19:31:12.000000000 -0600 @@ -0,0 +1,28 @@ +/* Test of substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +int +main () +{ + return 0; +} diff -ruNp m4-1.4.9/tests/test-wctype.c m4-1.4.10/tests/test-wctype.c --- m4-1.4.9/tests/test-wctype.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-wctype.c 2007-05-30 19:31:13.000000000 -0600 @@ -0,0 +1,44 @@ +/* Test of substitute. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +int +main () +{ + /* Check that the isw* functions exist as functions or as macros. */ + iswalnum (0); + iswalpha (0); +#if 0 /* not portable: missing on mingw */ + iswblank (0); +#endif + iswcntrl (0); + iswdigit (0); + iswgraph (0); + iswlower (0); + iswprint (0); + iswpunct (0); + iswspace (0); + iswupper (0); + iswxdigit (0); + + return 0; +} diff -ruNp m4-1.4.9/tests/test-xvasprintf.c m4-1.4.10/tests/test-xvasprintf.c --- m4-1.4.9/tests/test-xvasprintf.c 1969-12-31 17:00:00.000000000 -0700 +++ m4-1.4.10/tests/test-xvasprintf.c 2007-05-30 19:31:13.000000000 -0600 @@ -0,0 +1,91 @@ +/* Test of xvasprintf() and xasprintf() functions. + Copyright (C) 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include "xvasprintf.h" + +#include +#include +#include +#include + +#include "progname.h" + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +static char * +my_xasprintf (const char *format, ...) +{ + va_list args; + char *ret; + + va_start (args, format); + ret = xvasprintf (format, args); + va_end (args); + return ret; +} + +static void +test_xvasprintf () +{ + int repeat; + + for (repeat = 0; repeat <= 8; repeat++) + { + char *result = my_xasprintf ("%d", 12345); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + free (result); + } +} + +static void +test_xasprintf () +{ + int repeat; + + for (repeat = 0; repeat <= 8; repeat++) + { + char *result = xasprintf ("%d", 12345); + ASSERT (result != NULL); + ASSERT (strcmp (result, "12345") == 0); + free (result); + } +} + +int +main (int argc, char *argv[]) +{ + set_program_name (argv[0]); + + test_xvasprintf (); + test_xasprintf (); + + return 0; +}