pax_global_header00006660000000000000000000000064126251327200014512gustar00rootroot0000000000000052 comment=a634470cda3e73f8becbd49cebb4a54effd7ddd4 procenv-0.43/000077500000000000000000000000001262513272000131145ustar00rootroot00000000000000procenv-0.43/.travis.yml000066400000000000000000000027451262513272000152350ustar00rootroot00000000000000dist: trusty branches: only: - master language: c compiler: - gcc - clang before_install: - sudo apt-get update -qq - sudo apt-get install -y autopoint automake expat libnuma-dev libcap-dev check script: autoreconf -fi && ./configure && make -j4 && make check notifications: email: recipients: - jamesodhunt@ubuntu.com env: global: # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created # via the "travis encrypt" command using the project repo's public key - secure: "ywIKOpIjRkWL+8KTvJwt2AInz1cgUVU56yo6KIyOv+SRTzCneHXlylQ/F7rxnWYLBZHzOF2GdrWRsUekLDYqIIMdMeYZ50gNT+ZjN4JIVqnlK8X2BJrdpzoxBA4jSJS0gx836GuAX7q0oiI7ZrJikAyFkQJr98n8klR6aFKGiE/0kyxambETqqlOmPnq3/sdsnmeA4HFswflGIX/34s+7RUpmB/O2ix1CTgSt+I8WKo3vvAksVxqo1utx4IwVLlmmvfBfqJXTPK5ZkdcdfieqRSGmSl3hyn9ZgyG8NnR8qFQx2KyGIsgdJAyW4MpxC9lpHq+kWCOz19xjeGVGrWGAPJMWSi/qKFATJXajPVbpKxoPFDmDjd+sUi4rQLyiOb0KI4z2GYXZ3d1let06OTyC9cIe1fwdDJ+7tdLsQpX0uMLHwYL/LrA6O6W3YARSxTVHgi34WQqyQ7P2A1NZHcj6wG2krFLpVEyP/+sxuMi6OFKzZLiUH/oPWjlBBCGPxUXkjV4QV3j1+1XYJS5Xai8WczFB6aWbJD8khMz3l1yICQ/WernY+ro4M4Aw0uBC9wL2Tqj1fu4OW4ws9YyjGA/ok8s918BufOTw9kbA7s96Saw6ZezZLlxwV5fI0AJYrNvbn57dXehS0vfDSQEYQCAEsAczCbpuW4ils/gnnd/uS4=" addons: coverity_scan: project: name: "jamesodhunt/procenv" description: "Build submitted via Travis CI" notification_email: jamesodhunt@gmail.com build_command_prepend: "autoreconf -fi && ./configure; make clean" build_command: "make -j 4" branch_pattern: master procenv-0.43/AUTHORS000066400000000000000000000001671262513272000141700ustar00rootroot00000000000000James Hunt Kees Cook Dave Love Mike Miller procenv-0.43/Android.mk000066400000000000000000000004601262513272000150250ustar00rootroot00000000000000LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := procenv LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_SRC_FILES:= procenv.c LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_STATIC_LIBRARIES := libc libdl LOCAL_SHARED_LIBRARIES := libcutils include $(BUILD_EXECUTABLE) procenv-0.43/COPYING000066400000000000000000001045131262513272000141530ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 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 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. Copyright (C) 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 . 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: 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, 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 . procenv-0.43/ChangeLog000066400000000000000000001064511262513272000146750ustar00rootroot000000000000002015-10-19 James Hunt * man/procenv.1: Replace hard-coded utf character with unicode escape equivalent to suppress warning on Fedora. * src/tests/check_all_args.in: Replace heuristics to remove troff escapes with a safer approach. * src/procenv.c: show_uname(): Fix incorrect check on domainname, identified by Coverity. 2015-09-28 James Hunt * src/procenv.c: - Correct output order for 'libc:' and 'misc:'. * src/procenv.h: - Bump PROCENV_FORMAT_VERSION. * src/tests/check_all_args.in: - Ensure output sections are sorted and not duplicated. 2015-09-27 James Hunt * src/Makefile.am: - Pass path to man page to tests. * src/tests/check_all_args.in: - Set LC_ALL to the lang value under test. - Actually save the original LANG value. - 'set -e' fix. - Add test to compare options documented by 'procenv --help' with those in the man page to ensure no discrepancies. 2015-09-25 James Hunt * src/procenv.c: - show_libc(): New function for new '--libc'/'-B' option. - show_compiler(): Added following features: - _DEFAULT_SOURCE - _LARGEFILE_SUPPORT - __STDC_VERSION__ * configure.ac: Add '--enable-reproducible-build' option which suppresses the display of values that will change between builds: - __DATE__ - __TIME__ - __TIMESTAMP__ 2015-08-24 James Hunt * src/tests/check_all_args.in: Actually disable tests if non-existent locale found. 2015-08-23 James Hunt * src/procenv.c: Coverity fixes: - get_mtu(): Drop useless goto and explicit zero return on error. - get_canonical(): safer string termination. - Allow '--indent-char' to be UTF-8. * src/tests/check_all_args.in: - New single-character tests for: - '--indent-char'. - '--separator'. - New multi-character tests for: - '--indent-char'. - '--separator'. - '--crumb-separator'. - Check default locale is valid before attempting to use it. 2015-08-22 James Hunt * src/procenv.h: Use __func__ rather than __FUNCTION__ to appease gcc 5.2. 2015-08-21 James Hunt * src/procenv.c: save_locale(): Specify 2nd arg to setlocale() as "" since the original NULL was not only incorrect, it caused a UTF-8 '--separator' or '--crumb-separator' to cause a crash. * src/tests/check_all_args.in: - New tests for UTF-8 '--separator' and '--crumb-separator'. - Show language test being run with. - Ensure full command-line shown on failure. 2015-07-11 James Hunt * src/procenv.c: show_security_module_context_linux(): Don't free @mode returned by aa_gettaskcon(2) since it forms part of the allocation returned in @context. 2015-07-08 James Hunt * src/procenv.c: - Update copyright. - show_mounts_linux(): Don't truncate fsid. - show_mounts_bsd(): Don't truncate fsid. 2014-09-19 James Hunt * src/procenv.c: show_security_module_linux(): check HAVE_APPARMOR, not HAVE_SYS_APPARMOR_H to allow building on Ubuntu Lucid (which does not provide aa_is_enabled()). 2014-09-18 James Hunt * man/procenv.1: - Bump date. - Highlight non-display options. * src/procenv.c: - show_capabilities_linux(): Added CAP_AUDIT_READ. - main(): Allow '--exec' to come at the end of the command-line (the only non-display option this is valid for). * src/procenv.h: die(): Output to stderr, not stdout. * src/tests/check_all_args.in: - New test to ensure procenv can exec itself. - Enable tests to ensure procenv detects illegal placement of non-display options after any display option. - Fixed check on unknown capabilities. - Test to ensure a non-display option is disallowed after a display option is now more comprehensive. - src/tests/check_all_args.in: Ensure an empty environment is tolerated. 2014-08-19 James Hunt * src/procenv.c: Restore Coverity 0.0 defect density: - translate(): Cleanup on error path. - pstring_create(): Cleanup on error path. * src/tests/check_all_args.in: Warn if more capabilities found than procenv is unaware of. 2014-08-14 James Hunt * man/procenv.1: More examples. * configure.ac: Add profiling for debug mode. 2014-07-04 James Hunt * src/procenv.c: Correct guard used around procenv_getcpu() and split_fields(). 2014-07-03 James Hunt * src/pr_list.c: - New functions: - pr_list_append_str() - pr_list_appendn_str() - pr_list_prependn_str() * src/procenv.c: - procenv_getcpu(): A {RHEL,Centos} 5-pecific hack to fully resolve LP: #1333194 by working around fact that glibc on that platform does not provide sched_getcpu(3). 2014-06-26 James Hunt * TODO: Updates. * src/procenv.c: - More fixes for LP: #1333194: - show_capabilities_linux(): Guard PR_CAPBSET_READ. - cap_get_bound(): Guard PR_CAPBSET_READ. * src/procenv.h: Define CAP_LAST_CAP when using old versions of libcap. 2014-06-26 James Hunt * src/procenv.c: - show_numa_memory(): - Fix for systems using old numa libraries (RHEL5). This should really fix LP: #1333194. - show_security_module(): - Corrected SELinux checking code. - Added MLS detail. - show_shared_mem_linux(): - Compiler appeasement. - Added 'swap_attempts' and 'swap_successes' (apparently now unused, but displayed for completeness). - show_msg_queues_linux(): Compiler appeasement. * src/procenv.h: - PROCENV_FORMAT_VERSION: Bumped to v8. - Added PROCENV_NUMA_BITMASK_ISSET() macro to handle both old and new libnuma API's. 2014-06-25 James Hunt * src/procenv.c: - get_mtu(): Ensure unsigned long used for ioctl(2) request parameter (caught by FreeBSD's "WARNING ioctl sign-extension ioctl" console message). - get_mac_address(): As above. - show_uname(): Handle unset uts.domainname without an assertion to cope on OpenSuSE 13.1 systems. 2014-06-24 James Hunt * configure.ac: Add header checks for selinux and apparmor (LP: #1333182). * procenv.spec.in: Added 'libselinux-devel' to BuildRequires. * src/Makefile.am: Use $(top_builddir) and $(subdir) rather than $(abs_builddir) since the RHEL5 / Centos 5 version of automake don't define the latter. * src/procenv.c: - Fix building on RHEL5 / Centos 5 by guarding undefined personality symbols (LP: #1333194). - Guard code based on CPU_ALLOC(3) availability. - Guard capabilities, SELinux and AppArmor code. - show_numa_memory(): Use entry() rather than show(), the latter of which could have cause invalid formatted output if the NUMA policy could not be queried. - show_sizeof(): Add missing typedefs from stdint.h. * src/procenv.h: SELinux and capability guards. * src/tests/check_all_args.in: - Don't die if JSON or XML checker are unavailable - just run what tests are possible. - Test using C locale and current (if different). 2014-06-09 James Hunt * procenv.spec.in: Fix for spec file on RHEL - thanks Dave Love (LP: #1327594). 2014-06-07 James Hunt * src/procenv.c: sysconf and confstr cleanups. * src/procenv.h: - Removed now unecessary macros. - Bumped PROCENV_FORMAT_VERSION. 2014-06-04 James Hunt * src/procenv.c: - show_pathconfs(): Guard all defines. - show_confstrs(): Guard all defines. * src/procenv.h: Added _show_confstr() macro to allow name to be specified. 2014-06-03 James Hunt * src/procenv.c: - Guard extended interfaces flags (IFF_*) since as of kernel 3.15 they have been removed (LP: #1324256). - show_all_groups(): Fixed possible memory leak - thanks Coverity. - show_uname(): Added asserts. * src/tests/check_all_args.in: Temporary work-around for lp:1325494. 2014-03-27 James Hunt * TODO: Update. * src/procenv.c: - get_arch(): Update for Sparc 64-bit (V9). - show_capabilities_linux(): Move CAP_LAST_CAP out of the list and use it as a count to avoid it being confused for an actual capability. 2014-03-20 James Hunt * man/procenv.1: Add reference to personality(2). * src/procenv.c: --misc: Add Linux personality type and flags. * src/procenv.h: Bump PROCENV_FORMAT_VERSION to 6 for format change. 2014-03-17 James Hunt * man/procenv.1: Add reference to libcap(3). * procenv.spec.in: Buid-depend on libcap-devel. * README: Update. 2014-03-14 James Hunt * src/procenv.c: - show_mounts_linux(): Don't quote unknown canonical name. - get_canonical(): Return value denoting if name was known. - show_capabilities_linux(): - Use cap_get_bound() rather than prctl(). - Memory leak fix. * src/procenv.h: _show_capability(): - Use cap_get_bound() rather than prctl(). - Add "supported". 2014-03-13 James Hunt * NEWS: Corrected formatting. * TODO: Updates. * configure.ac: Link to libcap if available. * src/procenv.c: - get_capability_by_flag(): New function to query a capability value for a specified capability type. - show_capabilities_linux(): - Make use of libcap calls. - Add missing CAP_BLOCK_SUSPEND. - Show "unknown" capabilities if detected (capabilities that the running kernel supports which procenv doesn't know about). * src/procenv.h: - PROCENV_FORMAT_VERSION: bumped to version 5 for capabilities output format change. - show_capability(): Now calls _show_capability(). - _show_capability(): Reworking of show_capability() macro that uses libcap calls and works for unknowns too. 2014-01-31 James Hunt * configure.ac: Build procenv.spec from .in file to auto-update version number. * procenv.spec.in: Renamed from procenv.spec. * src/procenv.c: show_capabilities_bsd(): Fixes to allow building on FreeBSD 9. 2014-01-27 James Hunt * configure.ac: Check for FreeBSD Capsicum support. * man/procenv.1: - --fds: Update for FreeBSD to mention Capsicum capabilities. - --capabilities: Explain this option is for Linux capabilities only (a different beast to Capsicum). - SEE ALSO: Further references. - Corrected BSD comment for --semaphores, --message-queues and --shared-memory. * src/procenv.c: - mntopt_map: Journaled Soft Updates fix for FreeBSD 8 and older. - usage(): - Typo fix. - show_fds_generic(): Added FreeBSD Capsicum capabilities for systems which support it (FreeBSD 9+, assuming kernel is appropriately configured). - show_env(): Copy environ before sorting since modification is disallowed. - show_capabilities_bsd(): New function to query Capsicum capabilities. - show_shared_mem_linux(): Fixed bug that incorrectly showed the current process name rather than the last. * src/procenv.h: - Bumped PROCENV_FORMAT_VERSION (format-version) to 3 for FreeBSD capabilities. - Capsicum macro. - Replaced bool typedef with stdbool.h. 2014-01-23 James Hunt * procenv.spec: Added RPM specfile courtesy of Dave Love and updated for 0.30 (LP: #1100967). * Makefile.am: Distribute spec file. 2014-01-22 James Hunt * src/procenv.c: show_cpu_affinities(): Initialise variable to pacify clang on FreeBSD 10. 2014-01-14 James Hunt * src/procenv.c: - get_tty_locked_status(): Assume unlocked if unable to query status (for example on Sparc64 running 2.6.32-5 kernel). - show_semaphores(): Calling semctl(SEM_INFO) without semun union was causing subsequent call to semctl(SEM_STAT) to SIGSEGV on Sparc and PPC architectures (Closes: #728684). 2014-01-13 James Hunt * configure.ac: Check for numa.h. * src/procenv.c: Allow building on Linux systems whose architectures are not NUMA-capable. 2014-01-10 James Hunt * man/procenv.1: Updated dates. * src/pr_list.c: Added header. * src/pr_list.h: Added header. * src/procenv.c: - Update date. - show_cpu_affinities(): Fix for FreeBSD which does not provide dynamic cpu sets (CPU_ALLOC(3) et al). - get_arch(): Added PPCspe and PPC64LE. * src/procenv.h: Added header. 2014-01-08 James Hunt * src/procenv.c: - show_cpu_affinities(): Fix for hyper-threaded systems (LP: #1251209) - thanks Dave Love. - show_numa_memory(): Fix memory leak (calling free(3) rather than numa_free_nodemask()). - show_sizeof(): - Added lots of missing standard types (as documented in types.h(P)). - Sorted list. - show_cgroups_linux(): Fixed memory leak caused by misuse of strsep(3). 2013-12-06 James Hunt * configure.ac: AM_INIT_AUTOMAKE: Ensure automake v1.13 is passed 'serial-tests'. 2013-12-04 James Hunt * src/tests/check_all_args.in: Fix to sections regex to avoid matching the TERMCAP variable (which contains various nasty characters). 2013-12-03 James Hunt * configure.ac: - Put AC_COPYRIGHT onto one line for older automakes. - Removed unused AC_TYPE_* checks. - "Fix" to handle the automake 1.13 "serial-tests" fiasco and always display test verbose test output. - Conditionally use format-security compiler flag. * src/procenv.c: show_numa_memory(): Tell libnuma not to call exit(3). * src/tests/check_all_args.in: - Add debug handling. - Use python rather than json_pp since the latter is not available on older perl installations. 2013-12-02 James Hunt * src/procenv.c: - show_mounts_linux(): Always initialise locals. - show_compiler(): Guard __TIMESTAMP__ which isn't available on old compilers. 2013-11-30 James Hunt * src/tests/check_all_args.in: Don't run XML tests if control characters found in the environment (for example in $TERMCAP when running under GNU Screen) since XMl validation will fail (which is only partly reasonable given that such charactes cannot be reliably encoded in XML anyway). 2013-11-29 Dave Love * Fix for building on RHEL 5 (LP: #1256415). 2013-11-29 James Hunt * src/procenv.c: - Use PROCENV_GNU_BSD rather than PROCENV_LINUX_BSD_KERNEL. - Make use of generic stubs where appropriate. - encode_string(): Handle non-printables for JSON and XML. Note that they cannot be fully handled in XML as it disallows encoding control characters so a validating parser will choke on the output in that case. * src/tests/check_all_args.in: - Explicit test for json_pp. - Generate more details on error. - Protect against silent failure when setting section. 2013-11-28 James Hunt * src/procenv.c: - Use PROCENV_LINUX_BSD_KERNEL rather than raw define value for kFreeBSD systems. - Tweaks to hide NUMA from BSD systems. - usage(): Added missing entry for --memory (as caught by new test). - Made os-specific function names saner. - Make Linux-specific functions still display a heading by using stubs. This fixes the tests, makes the code slightly clearer (hopefully not at the expense of the user). * src/procenv.h: - Added PROCENV_LINUX_BSD_KERNEL for kFreeBSD systems. * src/tests/check_all_args.in: - New test to ensure that all sections generated by default output have a corresponding command-line option. 2013-11-27 James Hunt * configure.ac: Check for libnuma. * man/procenv.1: - Updated date. - Add -Y/--memory. * src/procenv.c: - show_misc(): Memory page size moved to show_memory(). - show_memory(): New function. - dump(): - Added missing call to show_cpu(). - Added call to show_memory(). - show_numa_memory(): New function to display NUMA details (LP: #1251209). * src/procenv.h: Bumped PROCENV_FORMAT_VERSION. * src/tests/check_all_args.in: - Check explicitly for xmlwf. - Added test to ensure all options produce output in default output mode too. 2013-11-22 James Hunt * src/procenv.c: show_cpu_affinities(): New function that displays basic CPU affinity details. * man/procenv.1: Correct and add additional references for '--cpu'. 2013-11-13 James Hunt * src/procenv.c: - Fixes for unimplemented FreeBSD output: - show_shared_mem_bsd() - show_semaphores_bsd() - show_msg_queues_bsd() * src/tests/check_all_args.in: - Use mktemp(1) instead of Debian/Ubuntu-specific tempfile(1). - Remove rogue xmlwf call in '--format=text' test. - Fix for the unhelpful xmlwf: unlike every other Unix utility, xmlwf returns 0, even on failure (!) so we have to check if output is produced... 2013-11-07 James Hunt * src/procenv.c: get_arch(): Added PPC64. 2013-11-01 James Hunt * man/procenv.1: - NOTES: Escape dash in indent-char. - EXAMPLES: Fixed display of indent-char value. * src/procenv.c: get_arch(): Added missing "SuperH". 2013-10-30 James Hunt * src/procenv.c: - show_signals(): Check return from get_signal_name() in case a platform doesn't provide the signal in question. - get_kernel_bits(): Return error value rather than calling die(). - show_bsd_mounts(): Removed unused variables. - Added a few extra asserts to ensure section_open() is passed a valid name. * src/procenv.h: Need to define 'semun' on Hurd too. 2013-10-25 James Hunt * TODO: Stuff. * src/procenv.c: get_arch(): Fix for AARCH64 which seemingly isn't considered to be "ARM" by gcc. 2013-10-15 James Hunt * man/procenv.1: - Fix for lintian bug: spelling-error-in-binary. * src/procenv.c: - Fixes for lintian bugs: spelling-error-in-manpage, hyphen-used-as-minus-sign. 2013-10-14 James Hunt * configure.ac: Add '--debug' option. * man/procenv.1: - General tidy-up. - OPTIONS: Added '--crumb-separator'. - EXAMPLES: Added a few more. - LIMITATIONS: Updated. * src/pr_list.c: Undo erroneous "fix" to pr_list_append() and pr_list_prepend(). * src/procenv.c: - Remove "(linux)" suffix from capabilities, cgroups and oom output: they are not displayed on other platforms, so the information is redundant. - Added '--crumb-separator'. - show_network_if(): Put flags in containeris rather than dumping as a comma-separated list. 2013-10-13 James Hunt * TODO: Update. * man/procenv.1: ENVIRONMENT VARIABLES: - Added PROCENV_INDENT, PROCENV_INDENT_CHAR and PROCENV_SEPARATOR. * src/pr_list.c: - Fix issue in pr_list_append() and pr_list_prepend(). - Added PR_LIST_FOREACH_STR() and PR_LIST_FOREACH_REV_STR() from pr_list.h. - pr_list_visitor_str(): New. * src/procenv.c: - appendf(): Simplified and plugged a memory leak. - appendva(): Simplified and plugged a memory leak. - show_fds_linux(): Fixed memory leak. - show_semaphores_linux(): Fixed memory leak. - Comments. - cleanup(): Check crumb_list before clearing it. - check_envvars(): Added PROCENV_INDENT_ENV, PROCENV_INDENT_CHAR_ENV and PROCENV_SEPARATOR_ENV. 2013-10-12 James Hunt * configure.ac: Add ability to disable optimisation for debugging. * man/procenv.1: - SYNOPSIS: Added '--format=crumb' - ENVIRONMENT VARIABLES: Added 'PROCENV_FORMAT'. - NOTES: More details. - EXAMPLES: Two examples showing how to use '--format'. * src/Makefile.am: - Remove hard-coded optimisation flag. - Add pr_list.[ch] sources. * src/procenv.c: - Added 'crumb' format and supporting functions. - Removed horrid object-handling hacks since object_open() and object_close() are now sensible. - Added calls to object_open() and object_close() in various places for json array handling. - usage(): - Fixed '--messages-queues' and '--shared-memory' to add missing intra-word dash. - Updated notes. - show_meta(): Use get_output_format_name() instead of hard-coded list. - show_stat(): Removed double header(). - check_env_vars(): Update to handle 'PROCENV_FORMAT'. * src/tests/check_all_args.in: - Test both short and long options. - Test 'crumb' format. 2013-10-03 James Hunt * src/procenv.c: - show_proc(): Improved grouping by adding more sections. - show_meta(): Show output format. - show_compiler(): Add "feature test macros" section. 2013-10-02 James Hunt * man/procenv.1: - Added new options: - -C/--cpu. - --format. - --indent. - --indent-char. - --separator. - Removed bracketed partial option names since getopt_long(3) allows any unique partially named option. * src/Makefile.am: - Added check_all_args test. - CFLAGS: Check for unused variables. * src/procenv.c: - Added ability to produce output in either highly-structured text (default), JSON, or XML using the --format= option. 2013-09-13 James Hunt * src/tests/check_all_args.in: Added missing test. * src/procenv.c: - usage(): - Clarify option usage. - Ensure no wrapping on 80-column devices. - show_rlimits(): - Enable RLIMIT_RTTIME on Linux. - Check kernel version and defines for newer limits. * src/procenv.h: Cleanup. 2013-09-12 James Hunt * src/Makefile.am: Updated for new check_all_args test. * src/procenv.c: - dump(): Ensure correct output ordering. - Added "not implemented" stubs for FreeBSD IPC functions. * src/tests/show_compiler_details: Don't hard-code 'gcc' - use 'cc' for maximum portability. 2013-09-11 James Hunt * man/procenv.1: - Added -E/--semaphores option. - Added -M/--message-queues option. - Added -S/--shared-memory option. - Added ref to ipcs(1). * src/procenv.c: - Added support for displaying IPC resources (shared memory, semaphores and message queues) under Linux only at this stage. - New utility functions: format_time(), format_perms() and pid_to_name(). 2013-08-30 James Hunt * src/procenv.c: - show_stat(): Make resilient to failures. - show_linux_mounts(): Show if unable to query major+minor number. - show_bsd_mounts(): Show if unable to query major+minor number. - get_major_minor(): Return a value rather than simply warning on error. 2013-08-28 James Hunt * src/procenv.c: - show_network(): Handle bionics lack of getifaddrs(). - get_arch(): Don't identify MIPSEL as MIPS. 2013-08-23 James Hunt * TODO: * man/procenv.1: - Added -A/--arguments option. - Updated --mount to include reference to statfs. - Added -N/--network option. - Updated SEE ALSO section. * src/procenv.c: - Added support for BSD/Hurd signals: SIGEMT, SIGINFO, SIGLOST. - usage(): Use colon to separate output types from description for consistency. - is_console(): Enable for FreeBSD/kFreeBSD. - append(): Allocate space if str points to NULL. - appendf(): Allocate space if str points to NULL. - appendva(): Allocate space if str points to NULL. - dump(): - Call show_network(). - Call show_locale() *after* show_rlimits() for correct ordering. - show_linux_mounts(): Add block and inode details (LP: #1212728). - show_bsd_mounts(): Add block and inode details (LP: #1212728). - show_compiler(): - Added __FILE__, __BASE_FILE__ and __TIMESTAMP__. - main(): - Updates for -N/--network. - New functions: - show_arguments(). - get_network_address(). - decode_if_flags(). - get_ipv6_scope_name() (unused). - get_mtu(). - get_mac_address(). - decode_extended_if_flags(). - get_net_family_name(). - show_network_if(). - show_network(). 2013-07-19 James Hunt * src/man/procenv.1: Updated date and year. * src/procenv.c: - show_bsd_proc_branch(): Fix to work in BSD jails: these entities are bizarre in that they have no init process, and a processes parent may actually be a process running *outside* of the jail... and as a result, all you can know about it is its PID. - Various hacks to work in the decidedly un-bionic Android environment. * Android.mk: Makefile for Android. 2013-07-04 James Hunt * man/procenv.1: Add a new --exec example. 2013-06-28 James Hunt * configure.ac: Force old serial test behaviour (specifically for automake-1.13 and above) to ensure test output is visible in build logs. 2013-05-31 James Hunt * src/procenv.c: - dump_misc(): Don't quote value if it's UNKNOWN_STR (for easier parsing). - show_stat(): Change "mode" to "permissions" since not only is the latter more familiar to some, the tags should be as unique as possible (and we have another "mode" for privileged execution). - show_linux_mounts(): Display UNKNOWN_STR rather than aborting if /proc not mounted. - show_linux_proc_branch: As per show_linux_mounts(). - get_os(): Fixed regression where kFreeBSD was not being detected (seemingly because __linux__ is no longer defined on such systems :-) - get_arch(): Added missing detection for "SystemZ". - show_linux_cgroups(): As per show_linux_mounts(). - dump_linux_proc_fds(): As per show_linux_mounts(). - show_oom(): As per show_linux_mounts(). - get_root(): As per show_linux_mounts(). 2013-05-17 James Hunt * man/procenv.1: Added -P/--platform option. * src/procenv.c: - usage(): Added -P/--platform option. - dump_misc(): Move platforms bits to dump_platform(). - dump_platform(): New function: - dump(): Call dump_platform(). - show executable bits. - Call show_data_model(). - Call get_os() and get_arch(). - get_platform(): Removed. - get_os(): New function. - get_arch(): New function (includes support for x32). - show_data_model(): New function. - main(): Added -P/--platform option. 2013-04-07 James Hunt * src/procenv.c: show_tty_attrs(): - Clear lock status for all non-linux platforms. - Update calls to show_const_tty() and show_cc_tty() passing lock_status as a parameter. * src/procenv.h: - show_cc_tty(): Pass lock status as a parameter. Comment header. - show_const_tty(): Pass lock status as a parameter. Comment header. 2013-04-04 James Hunt * src/procenv.c: - Changed __linux__ to PROCENV_LINUX. - header(): Fix possible buffer overflow. - dump_meta(): Added a "mode" value showing if running privileged or non-privileged (the former showing potentially more information). - show_tty_attrs(): - Now shows individual locked tty attributes when running in privileged mode. - Added winsize attributes. - get_tty_locked_status(): New function. * man/procenv.1: Update for --tty. 2013-03-27 James Hunt * Merge of lp:~mtmiller/procenv/portability-bug-fixes. 2013-01-10 James Hunt * TODO: Updated. * src/procenv.c: - locale_map: Protect LC_NAME for FreeBSD. - show_env() and show_all_groups(): sort environment using strcoll(3) rather than strcmp(3) to make output locale-aware. 2012-12-15 James Hunt * src/procenv.c: get_priorities(): Do not assert priorities since they may be legitimate values. We could check errno, but little point when only querying. 2012-12-10 James Hunt * TODO: Updated with an idea from Dmitrijs Ledkovs. 2012-12-06 James Hunt * TODO: Updated with a couple of ideas. * man/procenv.1: Formatting of "SEE ALSO" section. * src/procenv.c: show_linux_prctl(): Handle all possible return scenarios to avoid random output. Thanks Dave Love (LP: #1086771). [ Dave Love ] * src/procenv.c: - locale_map: - Guard non-POSIX locale categories for portability. - Remove LC_ALL. - show_locale(): Special-case handling for LC_ALL. [ Mike Miller ] * src/procenv.c: - show_linux_security_module_context(): Check that Apparmor and SELinux are enabled before querying contexts (LP: #1086768). 2012-12-02 James Hunt * src/procenv.c: - locale_map: Add LC_ADDRESS, LC_IDENTIFICATION, LC_MEASUREMENT, LC_NAME, LC_PAPER and LC_TELEPHONE (LP: #1081628). - show_env(): Sort environment variables (LP: #1081629). - show_locale(): Added LANG and LANGUAGE for parity with locale(1). * man/procenv.1: - Add ref to locale(7). - Add ref to locale(1). 2012-11-29 James Hunt * General tidy-up (removing unused variables, etc). [ Dave Love ] * Makefile.am: Add man page to man1_MANS for RHEL package build. * src/procenv.c: - show_locale(): Load locale from the environment prior to querying, and revert at end. - show_linux_cpu(): Guard sched_getcpu(). * src/procenv.h: show_capability(): Make NOP if PR_CAPBSET_READ not available. * configure.ac: Add sched_getcpu to list of AC_CHECK_FUNCS. 2012-11-28 James Hunt * man/procenv.1: Update for --threads and set date. * src/procenv.c: get_platform(): Correction for detecting ARMHF. 2012-11-28 James Hunt * src/procenv.c: - get_thread_scheduler_name(): Make visible to non-Linux platforms. - get_platform(): Fix for Hurd. - show_clocks(): Fix for Hurd. * src/procenv.h: - Fix to gross Hurd hack. - Make visible to non-Linux platforms. - show_clock_res(): Make resilient to failure. 2012-11-26 James Hunt * TODO: Update. * configure.ac: Add pthread. * man/procenv.1: Formatting. * src/procenv.c: - usage(): Added -T and --threads option. - get_misc(): Minor Hurd tweak. - get_user_info(): Added check around prctl. - init(): Call gte_uname() as early as possible to allow LINUX_KERNEL_*() macros to work. - dump(): Add show_threads(). - show_capabilities(): Put kernel version guard around PR_GET_KEEPCAPS. - get_thread_scheduler_name(): New function. - show_linux_scheduler(): Disallow failure. - show_linux_cpu(): Disallow failure. - show_threads(): New function. - main(): - Added --threads option. - Call get_uname() for '-i'. * src/procenv.h: Added pthread.h and minor tweak for Hurd. 2012-11-22 James Hunt * src/tests/show_compiler_details: New test to dump out useful info as an aid to debugging build failures and for general interest. * src/Makefile.am: Call show_compiler_details test before running main binary such that we can use the new tests output to diagnose failures with the main binary. * src/procenv.h: - Added explicit define for GNU/Hurd to ensure that platform defines procenv_user.proc_name. 2012-11-21 James Hunt * TODO: Update. * src/procenv.c: - dump_misc(): Added kernel headers version. - linux_kernel_version(): - Rewrite as original logic was flawed - we now use the same technique as KERNEL_VERSION()/LINUX_VERSION_CODE. - Drop the @patch parameter: we're not using it and it is problematic if it contains alphabetics. - show_linux_prctl(): Don't allow prctl to fail, even for environments, such as chroots, where the libc defines the symbols, but the kernel outside the chroot does not implement the features. - get_platform(): Added alpha and m68k. - main(): Call get_user_info() if dumping misc details to ensure uname values available. * src/procenv.h: - Removed LINUX_KERNEL_MMRP() as unused. - Removed pdie() macro now that we handle prctl failures gracefully. 2012-11-20 James Hunt * man/procenv.1: - Added new locale options. - Updated datestamp. * src/procenv.c: - usage(): Added locale options. - dump_misc(): - Now shows 'platform' and 'kernel bits' (moved from dump_meta()). - Added 'endianness'. - is_big_endian(): New function. - show_stat(): Fixed 1 byte memory leak. - dump(): Call show_locale(). - show_locale(): New function to dump locale details. - get_platform(): - Added comment header. - Added in ia64, sparc64, sparc, mips, armhf, armel, s390x, SuperH, Hurd. - Changed 'Linux (Intel)' to 'Linux (i386)'. - Return UNKNOWN_STR as last resort. - show_capabilities(): Only query certain capabilities if they are known to be theoretically available by comparing running kernel version with kernel version specified in capabilities(7) that introduced it. - main(): Updated for new locale options. * src/procenv.h: show_capability(): - Added comment header. - Now handles failure less brutally. 2012-11-19 James Hunt * man/procenv.1: Show calls made by '--proc' and '--misc'. * src/procenv.c: - Various platform-specific fixes identified by recent Debian upload. - Formatting. - linux_kernel_version(): Replacement for inadequate KERNEL_VERSION() macro. - New macros that make use of linux_kernel_version(): - LINUX_KERNEL_M() - LINUX_KERNEL_MM() - LINUX_KERNEL_MMR() - LINUX_KERNEL_MMRP() - Horrid hack for Hurd, which doesn't define PATH_MAX. 2012-11-16 James Hunt * man/procenv.1: - Remove duplicate entry for --proc. - Add references to system and library call man pages for each option. - Add note that options are processed in order. - Correct order of options in syslog example. - Added rusage options. * TODO: Updated. * src/procenv.c: - Added rusage. - Moved show_capability() to header file. - main(): Added missing 'u' to getopt_long() call. - show_sizeof(): Added types uintmax_t, imaxdiv_t, rlim_t, fenv_t, fexcept_t. 2012-11-05 James Hunt * Split show_uname() into get_uname() and dump_uname(). * init(): Call get_uname(). * show_linux_prctl(): - Check for x86 before quering PR_GET_TSC. - Check for kernel v3.5 before querying PR_GET_NO_NEW_PRIVS. - Check for kernel v3.4 before querying PR_GET_CHILD_SUBREAPER. * New macros: - PROCENV_ARCH_X86. - KERNEL_VERSION(). 2012-11-04 James Hunt * AUTHORS: Corrected email address. * man/procenv.1: Credit Kees in copyright and add in standard "warranty". 2012-11-01 James Hunt * Hide show_oom() for non-Linux platforms. 2012-10-27 James Hunt * src/procenv.c: - get_path(): New function to return path of specified program. - show_stat(): Ensure we can resolve argv[0] to a full path by using get_path(). - check_envvars(): Made strsep() usage safe. 2012-10-26 James Hunt * Set EXTRA_DIST to ensure man page included in distribution. * man/procenv.1: Typos and hyphen fixes. 2012-10-25 James Hunt * Initial import. procenv-0.43/INSTALL000066400000000000000000000366101262513272000141530ustar00rootroot00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command `./configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. procenv-0.43/Makefile.am000066400000000000000000000002121262513272000151430ustar00rootroot00000000000000AUTOMAKE_OPTIONS = SUBDIRS = src ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = m4/ChangeLog man/procenv.1 procenv.spec man1_MANS = man/procenv.1 procenv-0.43/Makefile.in000066400000000000000000000663571262513272000152020ustar00rootroot00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = procenv.spec CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man1_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/procenv.spec.in $(top_srcdir)/config/compile \ $(top_srcdir)/config/install-sh $(top_srcdir)/config/missing \ AUTHORS COPYING ChangeLog INSTALL NEWS README TODO \ config/compile config/depcomp config/install-sh config/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ 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@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROCENV_VERSION = @PROCENV_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = SUBDIRS = src ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = m4/ChangeLog man/procenv.1 procenv.spec man1_MANS = man/procenv.1 all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 procenv.spec: $(top_builddir)/config.status $(srcdir)/procenv.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-man1: $(man1_MANS) @$(NORMAL_INSTALL) @list1='$(man1_MANS)'; \ list2=''; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(MANS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man1 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-man uninstall-man1 .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: procenv-0.43/NEWS000066400000000000000000000160621262513272000136200ustar00rootroot000000000000000.43 2015-11-24 * Namespace fix for non-Linux platforms. 0.42 2015-11-05 * Documentation improvements. * Removed reliance on autoreconf (required due to limitations in github release process). * Improved '--namespaces' output by removing indexes. 0.41 2015-10-23 * Further test improvements. * Correct output order (libc before misc). * Run compiler test before building procenv to aide remote debugging should the build fail. * Code tidy-ups and Coverity tweaks. * Added '--namespaces'/'-F' option. 0.40 2015-09-27 * Updated email address. * New --libc'/'-B' option. * --enable-reproducible-build * '--compiler': Added _DEFAULT_SOURCE, _LARGEFILE_SUPPORT and __STDC_VERSION__. * locale fixes. 0.39 2015-08-25 * Fixed tests harder :) 0.38 2015-08-24 * Fixed tests for non-UTF-8 locales. 0.37 2015-08-23 * Improved error handling. * Added CAP_AUDIT_READ capability. * Improved build-time tests. * Tolerate a completely empty environment. * Fixed bug where fsid in '--mounts' output was displaying truncated output on Linux. * Fix crasher bug triggered by specifying a UTF-8 character to '--separator' or '--crumb-separator'. * Allow '--indent-char' to be UTF-8. 0.36 2014-08-16 * RHEL/Centos spec file - thanks Dave Love (LP: #1327594). * Improved checks for SELinux/Apparmor (LP: #1333182). * Added missing types from stdint.h to '--sizeof'. * Fixed building on systems with old NUMA libraries, such as Centos/RHEL 5 (LP: #1333194). However, bug is not yet fully resolved since cpu details seem to be reported incorrectly on these old systems. * Corrected SELinux detection code and added MLS detection. * Added missing conf calls such that '--sysconf', '--pathconf' and '--confstr' combined are now on par with getconf(1). * More man page examples. * Major internal rewrite to handle all data as wchar_t to avoid failing in locales using UTF-8 characters (LP: #1325494). 0.35 2014-06-03 * Update to handle Linux 3.15 kernel which has dropped ability to query extended network interfaces flags (LP: #1324256). 0.34 2014-03-25 * Enable builds for systems with old versions of libcap. * Add Linux binary personality (with flags) to '--misc' output. * Fix for rpm spec file. * Updated man page. 0.33 2014-03-14 * Improved RPM spec file to include check phase and Conditional architecture dependency logic. * Updated for OpenRISC. * --ranges now also shows the symbolic names (such as "LONG_MAX"). * Reworked capabilities support to show effective, inheritable and permitted value for each capability in addition to the existing bounding set value. Will also display "unknown" capabilities if run on a system whose running kernel has more capabilities than the system procenv was built on. 0.32 2014-01-31 * Generate .spec file to ensure version stays in sync with configure.ac. 0.31 2014-01-31 * FEATURE: Added RPM specfile courtesy of Dave Love. * FEATURE: --capabilities now displays Capsicum capabilities if available (FreeBSD 9/10+). * FIX: Environment display could cause a crash. * FIX: Last attacher process in shared memory display on Linux incorrectly showed the current process name rather than the last. 0.30 2014-01-18 * FIX: Semaphore fix for PPC and Sparc platforms. 0.29 2014-01-13 * FIX: Allow building on Linux systems whose architectures are not NUMA-capable. 0.28 2014-01-10 * FIX: Process ancestry now displayed on kFreeBSD by default. * FIX: Fixes to identify AARCH64, SuperH and PPC64. * FEATURE: Added ability to identify PPCspe and PPC64LE architectures. * FEATURE: '--cpu' now displays processor affinity details (LP: #1251209). * FEATURE: --memory/-Y added to display NUMA memory details. * FEATURE: Lots of test improvements. 0.27 2013-10-14 * Added IPC options '--shared-memory', '--semaphores' and '--message-queues'. * Added rudimentary "make check" tests. * Made default text output highly structured. * Added ability to produce output in XML, JSON and "breadcrumb" (including CSV) formats. * Added ability to specify indent amount, indent character and separators (via command-line or environment variable). 0.26 2013-08-27 * Check to determine if running on a console now works for FreeBSD/kFreeBSD too. * Added ability to show all arguments (-A/--arguments) (useful when using --exec). * Added ability to display network details (-N/--network). * Added BSD/Hurd-specific signals. * Corrected output sort order. * Mount details now include block, inode and fsck details. 0.25 2013-07-19 * Fixed bug where procenv would hang in a FreeBSD jail. * Port to Android. 0.24 2013-06-28 * Packaging update for automake-1.13 to ensure procenv output available in build logs. 0.23 2013-05-31 * Tolerate Linux environments where /proc is not mounted. * Fix kFreeBSD detection and add support for IBM SystemZ environments. 0.22 2013-05-17 * Added --platform option which contains some information that was formally in --misc output, but also now includes the number of "architecture bits" (executable bits) and the programming model for the platform (such as LP32/ILP64). 0.21 2013-04-07 * Various improvements from Mike Miller including umask restoration fix. * Display terminal attribute locked status (Linux only). 0.20 2013-01-15 * Sort environment variables and groups in locale-aware fashion. * FreeBSD fix for LC_NAME. 0.19 2012-12-17 * Fixed an assertion failure if running with nice -1. 0.18 2012-12-06 * Improvements to Apparmor+SELinux handling (Mike Miller). * prctl fixes (thanks Dave Love). 0.17 2012-12-06 * Further locale improvements from Dave Love. * Cosmetic man-page improvements. 0.16 2012-12-02 * Add support for RHEL builds (thanks Dave Love). * Locale improvements. * Correction for detecting ARMHF. * Environment variables are now sorted to make diffing easier. * ChangeLog now reflects bzr branch history. 0.15 2012-11-28 * Fixes for Hurd. 0.14 2012-11-28 * Scheduler and non-Linux platform fixes for --threads. 0.13 2012-11-26 * Added --threads option. * Additional resilience to running in unusual environments. 0.12 2012-11-22 * Added show_compiler_details test. * Fix for GNU/Hurd. 0.11 2012-11-21 * Don't allow prctl to fail, even for environments such as chroots where libc defines the symbols, but the kernel outside the chroot does not implement the features. 0.10 2012-11-20 * Further platform fixes identified by building on Debian-supported buildd's. * Added locale output. 0.9 2012-11-19 * Platform fixes identified by building on Debian-supported platforms. * Improved man page. 0.8 2012-11-16 * Man page updates. * Added resource usage. * Added more types for --sizeof. 0.7 2012-11-05 * Fixes for non-x86 kernels and specific kernel versions. 0.6 2012-10-27 * AppArmor, capabilities and prctl(2) contributions from Kees Cook. 0.5 2012-10-27 * Fluff removal. 0.4 2012-10-27 * Path resolution fixes and strsep() safety. 0.3 2012-10-26 * Man page fixes. 0.2 2012-10-26 * Include man page in distribution. 0.1 2012-10-25 * Initial public release. procenv-0.43/README000077700000000000000000000000001262513272000154562README.rstustar00rootroot00000000000000procenv-0.43/README.rst000066400000000000000000000107051262513272000146060ustar00rootroot00000000000000.. image:: https://img.shields.io/badge/license-GPL-3.0.svg .. image:: https://travis-ci.org/jamesodhunt/procenv.svg?branch=master :target: https://travis-ci.org/jamesodhunt/procenv .. image:: https://scan.coverity.com/projects/jamesodhunt-procenv/badge.svg :target: https://scan.coverity.com/projects/jamesodhunt-procenv :alt: Coverity Scan Build Status .. image:: https://img.shields.io/badge/donate-flattr-red.svg :alt: Donate via flattr :target: https://flattr.com/profile/jamesodhunt ======= procenv ======= .. contents:: .. sectnum:: Overview -------- ``procenv`` is a simple command-line utility, written in C and licensed under the GPL, that dumps all attributes of the environment [#]_ in which it runs, in well-structured plain ASCII, JSON (YAML), XML or CSV. It is useful as a test tool, to understand what environment a process runs in and for system comparison. ``procenv`` runs on Linux, FreeBSD, kFreeBSD, GNU Hurd and Android. It unashamedly emulates a number of existing system utilities as it is attempting to be all-encompassing: I wrote it with the aim of being able to dump "everything" that a process may care about by simply running a single program (by default). Also, the line of demarcation between "process", "program" and "system" is slightly blurry in some aspects. For example ``sysconf(3)`` variables could arguably be considered system attributes, but procenv shows these too since they are obviously meant to be queryable by applications. .. [#] If you find anything missing, please either raise a bug or send a patch :) Results ------- ``procenv`` is extremely useful for learning about the environment software builds in. Often, such systems disallow login, but do allow access to log files. Handily, ``procenv`` runs a battery of tests on build including running itself so that the build environment gets captured in the builds logs themselves. Select a link below and drill down to the build log to see the ``procenv`` output: Travis-CI ~~~~~~~~~ * https://travis-ci.org/jamesodhunt/procenv Open Build Service (OBS) ~~~~~~~~~~~~~~~~~~~~~~~~ * https://build.opensuse.org/package/show/home:jamesodhunt:procenv/procenv If you distro does not yet provide a ``procenv`` package, binary packages for RHEL, Fedora, Centos, SLES, and Arch Linux are available from here: * https://software.opensuse.org/download.html?project=home%3Ajamesodhunt%3Aprocenv&package=procenv Click on your icon for your distro and follow the instructions. Note that these packages are "bleeding edge" (generated directly from the github repository). Ubuntu ~~~~~~ build environment ................. Click the "twisty" triangle to the left of the release number under a release name, then click one of the build links (like "``amd64``)": * https://launchpad.net/ubuntu/+source/procenv PPA environment ............... https://code.launchpad.net/~jamesodhunt/+recipe/procenv-daily Ubuntu Autopkgtest (DEP-8) environment ...................................... * https://jenkins.qa.ubuntu.com/view/Wily/view/AutoPkgTest/job/wily-adt-procenv/ * https://jenkins.qa.ubuntu.com/view/Vivid/view/AutoPkgTest/job/vivid-adt-procenv/ * https://jenkins.qa.ubuntu.com/view/Utopic/view/AutoPkgTest/job/utopic-adt-procenv/ * https://jenkins.qa.ubuntu.com/view/Trusty/view/AutoPkgTest/job/trusty-adt-procenv/ The ``sbuild`` tool environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``procenv`` gets run from within sbuild via a DEP-8 test: * https://jenkins.qa.ubuntu.com/view/Wily/view/AutoPkgTest/job/wily-adt-sbuild/ The ``pbuilder`` tool environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``procenv`` gets run from within pbuilder via a DEP-8 test: * https://jenkins.qa.ubuntu.com/view/Wily/view/AutoPkgTest/job/wily-adt-pbuilder/ Debian ~~~~~~ buildd (and ports buildd) environment ..................................... * https://buildd.debian.org/status/package.php?p=procenv&suite=sid Debian autopkgtest (DEP-8) environment ...................................... * http://ci.debian.net/#package/procenv FreeBSD ~~~~~~~ Logs used to be available, but sadly it appears pointyhat.freebsd.com has been taken offline (any replacement?) Porting ------- Can you help port ``procenv`` to other platforms (AIX, HP-UX, Solaris, ...)? If so, please get in contact. References ---------- See http://ifdeflinux.blogspot.com/2012/10/procenv-and-process-environment.html Author ------ ``procenv`` was written by James Hunt . Home Page --------- * https://github.com/jamesodhunt/procenv procenv-0.43/TODO000066400000000000000000000051731262513272000136120ustar00rootroot00000000000000# TODO - pstring tests. - add /proc/cmdline? - could create a kernel category?: kernel: version: headers version: 3.19.8 bits: 64 cmdline: ... - XXX: Sort *all* output values. - sort network interfaces. - Sort output of show_mounts(). - add tests to ensure they remain sorted. - "--path" ? which shows: path: _POSIX_PATH_MAX: 256 (absolute) PATH_MAX: 4096 (relative) MAXPATHLEN: 4096 - LSM - add details for SMACK and TOMOYO (available in Centos 7). - move into a new --security section? - --memory: show physical RAM: bytes = (_SC_PHYS_PAGES * _SC_PAGESIZE) - FreeBSD: - MAC: mac_get_file(3), mac(3,4) - --stat: - move current stat details into a stat/self section. - add stat details for stat/root. - --cpu: - change 'number' to 'index' and make it zero-based for consistency with affinity list - XXX: bump 'format-version' !! - Add YAML output format? - Introduce "value()" that can take a bare value. This will allow for example mount options to be displayed in an output container. - Non-root queryable hdd attributes? - Hurd: - establish how to determine process ancestry. - Create a versioned XML schema. - Restructure code into separate files. - Use weak symbols/VPATH to avoid ifdefs! - Display numeric values for all symbols?: - limits (RLIMIT_AS) - clocks (CLOCK_REALTIME) - pathconf (_PC_LINK_MAX) - sysconf (ARG_MAX) XXX: must be consistent with existing signals (SIGHUP, etc)!! - BUG: all numbers are displayed as strings in json output. - Add in ability to specify a platform restriction for certain details by modifying section_open() and container_open() to accept string pairs like: container_open (const char *name, int count, ...); | V container_open (const char *name, 2, "restriction", "linux"); - Networking details - IPv6 scope_id. - gateway. - add to show_sizeof(): - intN_t group - I18N (gettext) - Don't hide any option that a particular O/S / arch doesn't have: show the option with a value of `UNKNOWN_STR'. - Rework output code to use a cleaner stack-based approach. - Uptime (using utmp)? - Text/data/bss/stack details (end(3), sbrk(2)) - mincore(2)? - Add process arguments to show_proc_branch()? - Use CPUID instruction to detect XEN environments? (http://libcpuid.sourceforge.net/, http://www.etallen.com/cpuid.html) - Use dlopen to probe for apparmor/selinux. This avoids having to depend on the existence of the appropriate libs, but still allows security context information to be queried on systems that provide them. - Add in permissions for /dev/tty and fds 0-2 if they refer to devices. - ELF details. procenv-0.43/aclocal.m4000066400000000000000000001414251262513272000147630ustar00rootroot00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # PKG_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable pkgconfigdir as the location where a module # should install pkg-config .pc files. By default the directory is # $libdir/pkgconfig, but the default can be changed by passing # DIRECTORY. The user can override through the --with-pkgconfigdir # parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_INSTALLDIR # PKG_NOARCH_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable noarch_pkgconfigdir as the location where a # module should install arch-independent pkg-config .pc files. By # default the directory is $datadir/pkgconfig, but the default can be # changed by passing DIRECTORY. The user can override through the # --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_NOARCH_INSTALLDIR # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------- # Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])# PKG_CHECK_VAR # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR procenv-0.43/config.h.in000066400000000000000000000073561262513272000151520ustar00rootroot00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_SECUREBITS_H /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_NUMA_H /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the `sched_getcpu' function. */ #undef HAVE_SCHED_GETCPU /* Define to 1 if you have the header file. */ #undef HAVE_SELINUX_SELINUX_H /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the header file. */ #undef HAVE_SYS_APPARMOR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_CAPABILITY_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Generate a reproducible build */ #undef PROCENV_REPRODUCIBLE_BUILD /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE procenv-0.43/config/000077500000000000000000000000001262513272000143615ustar00rootroot00000000000000procenv-0.43/config/compile000077500000000000000000000162451262513272000157470ustar00rootroot00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: procenv-0.43/config/depcomp000077500000000000000000000560161262513272000157460ustar00rootroot00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: procenv-0.43/config/install-sh000077500000000000000000000345231262513272000163740ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2013-12-25.23; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: procenv-0.43/config/missing000077500000000000000000000153301262513272000157620ustar00rootroot00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: procenv-0.43/configure000077500000000000000000006613771262513272000150470ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for procenv 0.43. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # Copyright (C) 2012-2015 James Hunt and Kees Cook ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: jamesodhunt@ubuntu.com about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='procenv' PACKAGE_TARNAME='procenv' PACKAGE_VERSION='0.43' PACKAGE_STRING='procenv 0.43' PACKAGE_BUGREPORT='jamesodhunt@ubuntu.com' PACKAGE_URL='https://github.com/jamesodhunt/procenv' ac_unique_file="src/procenv.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS AM_CFLAGS AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc PACKAGE_URL_FALSE PACKAGE_URL_TRUE HAVE_CHECK_FALSE HAVE_CHECK_TRUE ENABLE_TESTS_FALSE ENABLE_TESTS_TRUE HAVE_APPARMOR_FALSE HAVE_APPARMOR_TRUE HAVE_SELINUX_FALSE HAVE_SELINUX_TRUE CHECK_LIBS CHECK_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC PROCENV_VERSION target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_largefile enable_tests enable_dependency_tracking enable_silent_rules enable_compiler_optimisations enable_linker_optimisations enable_debug enable_reproducible_build ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR CHECK_CFLAGS CHECK_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures procenv 0.43 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/procenv] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of procenv 0.43:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-largefile omit support for large files --disable-tests Disable unit tests --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --disable-compiler-optimisations Disable compiler optimisations --disable-linker-optimisations Disable linker optimisations --enable-debug enable developer build --enable-reproducible-build Disable display of build-time values that are guaranteed to differ between builds Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path CHECK_CFLAGS C compiler flags for CHECK, overriding pkg-config CHECK_LIBS linker flags for CHECK, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . procenv home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF procenv configure 0.43 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright (C) 2012-2015 James Hunt and Kees Cook _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------------- ## ## Report this to jamesodhunt@ubuntu.com ## ## ------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func 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 procenv $as_me 0.43, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. PROCENV_VERSION=0.43 # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi #--------------------------------------------------------------------- # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi # Look for C unit test framework (http://check.sourceforge.net/). pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CHECK" >&5 $as_echo_n "checking for CHECK... " >&6; } if test -n "$CHECK_CFLAGS"; then pkg_cv_CHECK_CFLAGS="$CHECK_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check\""; } >&5 ($PKG_CONFIG --exists --print-errors "check") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CHECK_CFLAGS=`$PKG_CONFIG --cflags "check" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$CHECK_LIBS"; then pkg_cv_CHECK_LIBS="$CHECK_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check\""; } >&5 ($PKG_CONFIG --exists --print-errors "check") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CHECK_LIBS=`$PKG_CONFIG --libs "check" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then CHECK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "check" 2>&1` else CHECK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "check" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CHECK_PKG_ERRORS" >&5 HAVE_CHECK=no elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } HAVE_CHECK=no else CHECK_CFLAGS=$pkg_cv_CHECK_CFLAGS CHECK_LIBS=$pkg_cv_CHECK_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } HAVE_CHECK=yes fi #--------------------------------------------------------------------- # Checks for header files. # this header is not available on older distributions (such as Ubuntu # Lucid) for ac_header in linux/securebits.h do : ac_fn_c_check_header_mongrel "$LINENO" "linux/securebits.h" "ac_cv_header_linux_securebits_h" "$ac_includes_default" if test "x$ac_cv_header_linux_securebits_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_SECUREBITS_H 1 _ACEOF fi done for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_H 1 _ACEOF else as_fn_error $? "pthread.h required" "$LINENO" 5 fi done #--------------------------------------------------------------------- # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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 struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _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]; /* 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 () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi # Checks for library functions. for ac_func in clock_gettime getcwd localtime_r strcasecmp strchr strstr sched_getcpu do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # BSD process inspection library { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing kvm_openfiles" >&5 $as_echo_n "checking for library containing kvm_openfiles... " >&6; } if ${ac_cv_search_kvm_openfiles+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char kvm_openfiles (); int main () { return kvm_openfiles (); ; return 0; } _ACEOF for ac_lib in '' kvm; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_kvm_openfiles=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_kvm_openfiles+:} false; then : break fi done if ${ac_cv_search_kvm_openfiles+:} false; then : else ac_cv_search_kvm_openfiles=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_kvm_openfiles" >&5 $as_echo "$ac_cv_search_kvm_openfiles" >&6; } ac_res=$ac_cv_search_kvm_openfiles if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" HAVE_KVM=yes else HAVE_KVM=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing numa_available" >&5 $as_echo_n "checking for library containing numa_available... " >&6; } if ${ac_cv_search_numa_available+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char numa_available (); int main () { return numa_available (); ; return 0; } _ACEOF for ac_lib in '' numa; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_numa_available=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_numa_available+:} false; then : break fi done if ${ac_cv_search_numa_available+:} false; then : else ac_cv_search_numa_available=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_numa_available" >&5 $as_echo "$ac_cv_search_numa_available" >&6; } ac_res=$ac_cv_search_numa_available if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" HAVE_NUMA=yes else HAVE_NUMA=no fi for ac_header in numa.h do : ac_fn_c_check_header_mongrel "$LINENO" "numa.h" "ac_cv_header_numa_h" "$ac_includes_default" if test "x$ac_cv_header_numa_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NUMA_H 1 _ACEOF fi done # FreeBSD 9+ with appropriately configured kernel # (enabled by default in FreeBSD 10) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing cap_getmode" >&5 $as_echo_n "checking for library containing cap_getmode... " >&6; } if ${ac_cv_search_cap_getmode+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cap_getmode (); int main () { return cap_getmode (); ; return 0; } _ACEOF for ac_lib in '' c; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_cap_getmode=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_cap_getmode+:} false; then : break fi done if ${ac_cv_search_cap_getmode+:} false; then : else ac_cv_search_cap_getmode=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_cap_getmode" >&5 $as_echo "$ac_cv_search_cap_getmode" >&6; } ac_res=$ac_cv_search_cap_getmode if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi for ac_header in sys/capability.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/capability.h" "ac_cv_header_sys_capability_h" "$ac_includes_default" if test "x$ac_cv_header_sys_capability_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_CAPABILITY_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing cap_init" >&5 $as_echo_n "checking for library containing cap_init... " >&6; } if ${ac_cv_search_cap_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cap_init (); int main () { return cap_init (); ; return 0; } _ACEOF for ac_lib in '' cap; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_cap_init=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_cap_init+:} false; then : break fi done if ${ac_cv_search_cap_init+:} false; then : else ac_cv_search_cap_init=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_cap_init" >&5 $as_echo "$ac_cv_search_cap_init" >&6; } ac_res=$ac_cv_search_cap_init if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" HAVE_LIBCAP=yes else HAVE_LIBCAP=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5 $as_echo_n "checking for library containing pthread_create... " >&6; } if ${ac_cv_search_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF for ac_lib in '' pthread; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_pthread_create=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_pthread_create+:} false; then : break fi done if ${ac_cv_search_pthread_create+:} false; then : else ac_cv_search_pthread_create=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_create" >&5 $as_echo "$ac_cv_search_pthread_create" >&6; } ac_res=$ac_cv_search_pthread_create if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" HAVE_PTHREAD=yes else HAVE_PTHREAD=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getpidcon" >&5 $as_echo_n "checking for library containing getpidcon... " >&6; } if ${ac_cv_search_getpidcon+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getpidcon (); int main () { return getpidcon (); ; return 0; } _ACEOF for ac_lib in '' selinux; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_getpidcon=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_getpidcon+:} false; then : break fi done if ${ac_cv_search_getpidcon+:} false; then : else ac_cv_search_getpidcon=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getpidcon" >&5 $as_echo "$ac_cv_search_getpidcon" >&6; } ac_res=$ac_cv_search_getpidcon if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" HAVE_SELINUX=yes else HAVE_SELINUX=no fi if test x$HAVE_SELINUX = xtrue; then HAVE_SELINUX_TRUE= HAVE_SELINUX_FALSE='#' else HAVE_SELINUX_TRUE='#' HAVE_SELINUX_FALSE= fi for ac_header in selinux/selinux.h do : ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" if test "x$ac_cv_header_selinux_selinux_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SELINUX_SELINUX_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing aa_gettaskcon" >&5 $as_echo_n "checking for library containing aa_gettaskcon... " >&6; } if ${ac_cv_search_aa_gettaskcon+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char aa_gettaskcon (); int main () { return aa_gettaskcon (); ; return 0; } _ACEOF for ac_lib in '' apparmor; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_aa_gettaskcon=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_aa_gettaskcon+:} false; then : break fi done if ${ac_cv_search_aa_gettaskcon+:} false; then : else ac_cv_search_aa_gettaskcon=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_aa_gettaskcon" >&5 $as_echo "$ac_cv_search_aa_gettaskcon" >&6; } ac_res=$ac_cv_search_aa_gettaskcon if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" HAVE_APPARMOR=yes else HAVE_APPARMOR=no fi if test x$HAVE_APPARMOR = xtrue; then HAVE_APPARMOR_TRUE= HAVE_APPARMOR_FALSE='#' else HAVE_APPARMOR_TRUE='#' HAVE_APPARMOR_FALSE= fi for ac_header in sys/apparmor.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/apparmor.h" "ac_cv_header_sys_apparmor_h" "$ac_includes_default" if test "x$ac_cv_header_sys_apparmor_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_APPARMOR_H 1 _ACEOF fi done # Check whether --enable-tests was given. if test "${enable_tests+set}" = set; then : enableval=$enable_tests; enable_tests=no else enable_tests=yes fi if test "$enable_tests" = yes; then ENABLE_TESTS_TRUE= ENABLE_TESTS_FALSE='#' else ENABLE_TESTS_TRUE='#' ENABLE_TESTS_FALSE= fi if test "$HAVE_CHECK" = yes; then HAVE_CHECK_TRUE= HAVE_CHECK_FALSE='#' else HAVE_CHECK_TRUE='#' HAVE_CHECK_FALSE= fi if "$PACKAGE_URL"; then PACKAGE_URL_TRUE= PACKAGE_URL_FALSE='#' else PACKAGE_URL_TRUE='#' PACKAGE_URL_FALSE= fi #--------------------------------------------------------------------- # Other checks # automake-1.13 defaults to running tests in parallel. As a consequence, # it also disables verbose output meaning that procenv output is not # visible in build logs. Therefore, force old behaviour by passing # 'serial-tests', but only for version of automake >= 1.13 since older # versions don't recognise that option. am__api_version='1.15' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='procenv' VERSION='0.43' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi original_cflags="$CFLAGS" CFLAGS=-Werror=format-security { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether CC supports -Werror=format-security" >&5 $as_echo_n "checking whether CC supports -Werror=format-security... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } AM_CFLAGS=-Werror=format-security else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$original_cflags" # Check whether --enable-compiler-optimisations was given. if test "${enable_compiler_optimisations+set}" = set; then : enableval=$enable_compiler_optimisations; if test "x$enable_compiler_optimisations" = "xno"; then : CFLAGS=`echo "$CFLAGS" | sed -e "s/ -O[1-9s]*\b/ -O0/g"` CXXFLAGS=`echo "$CXXFLAGS" | sed -e "s/ -O[1-9s]*\b/ -O0/g"` fi fi # Check whether --enable-linker-optimisations was given. if test "${enable_linker_optimisations+set}" = set; then : enableval=$enable_linker_optimisations; if test "x$enable_linker_optimisations" = "xno"; then : LDFLAGS=`echo "$LDFLAGS" | sed -e "s/ -Wl,-O0-9*\b//g"` else LDFLAGS="$LDFLAGS -Wl,-O1" fi fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; if test "x$enable_debug" = "xyes"; then : CFLAGS=`echo "$CFLAGS -DDEBUG -pg"` CXXFLAGS=`echo "$CXXFLAGS -DDEBUG -pg"` DEBUG_BUILD=yes fi else DEBUG_BUILD=no fi # Check whether --enable-reproducible_build was given. if test "${enable_reproducible_build+set}" = set; then : enableval=$enable_reproducible_build; reproducible_build=yes else reproducible_build=no fi if test "$reproducible_build" = yes; then $as_echo "#define PROCENV_REPRODUCIBLE_BUILD 1" >>confdefs.h fi #--------------------------------------------------------------------- # XXX: Dump details of the preprocess/compiler/linker *NOW* so that if # procenv fails to build later, the build logs will show details of the # environment that should aid remote debugging. # # This may be bad form, but trying to do this at the automake stage # seems(?) to be impossible. t=${srcdir}/src/tests/show_compiler_details msg=$(cat <confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${HAVE_SELINUX_TRUE}" && test -z "${HAVE_SELINUX_FALSE}"; then as_fn_error $? "conditional \"HAVE_SELINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_APPARMOR_TRUE}" && test -z "${HAVE_APPARMOR_FALSE}"; then as_fn_error $? "conditional \"HAVE_APPARMOR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_TESTS_TRUE}" && test -z "${ENABLE_TESTS_FALSE}"; then as_fn_error $? "conditional \"ENABLE_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_CHECK_TRUE}" && test -z "${HAVE_CHECK_FALSE}"; then as_fn_error $? "conditional \"HAVE_CHECK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PACKAGE_URL_TRUE}" && test -z "${PACKAGE_URL_FALSE}"; then as_fn_error $? "conditional \"PACKAGE_URL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by procenv $as_me 0.43, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to . procenv home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ procenv config.status 0.43 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "procenv.spec") CONFIG_FILES="$CONFIG_FILES procenv.spec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Configure settings for $PACKAGE_NAME version $VERSION Reproducible build : ${reproducible_build} Debug build : ${DEBUG_BUILD} Check Unit Test Framework : ${HAVE_CHECK} libapparmor : ${HAVE_APPARMOR} libselinux : ${HAVE_SELINUX} libcap : ${HAVE_LIBCAP} libnuma : ${HAVE_NUMA} libpthread : ${HAVE_PTHREAD} libkvm : ${HAVE_KVM} " >&5 $as_echo " Configure settings for $PACKAGE_NAME version $VERSION Reproducible build : ${reproducible_build} Debug build : ${DEBUG_BUILD} Check Unit Test Framework : ${HAVE_CHECK} libapparmor : ${HAVE_APPARMOR} libselinux : ${HAVE_SELINUX} libcap : ${HAVE_LIBCAP} libnuma : ${HAVE_NUMA} libpthread : ${HAVE_PTHREAD} libkvm : ${HAVE_KVM} " >&6; } procenv-0.43/configure.ac000066400000000000000000000142221262513272000154030ustar00rootroot00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. m4_define([procenv_version], 0.43) AC_INIT(procenv, [procenv_version], [jamesodhunt@ubuntu.com], , https://github.com/jamesodhunt/procenv) AC_COPYRIGHT([Copyright (C) 2012-2015 James Hunt and Kees Cook ]) AC_CONFIG_SRCDIR([src/procenv.c]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([config]) AC_SUBST(PROCENV_VERSION, procenv_version) AC_GNU_SOURCE AC_SYS_LARGEFILE #--------------------------------------------------------------------- # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AM_PROG_CC_C_O PKG_PROG_PKG_CONFIG # Look for C unit test framework (http://check.sourceforge.net/). PKG_CHECK_MODULES([CHECK], [check], [HAVE_CHECK=yes], [HAVE_CHECK=no]) #--------------------------------------------------------------------- # Checks for header files. # this header is not available on older distributions (such as Ubuntu # Lucid) AC_CHECK_HEADERS([linux/securebits.h]) AC_CHECK_HEADERS(pthread.h,, [AC_MSG_ERROR([pthread.h required])]) #--------------------------------------------------------------------- # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL # Checks for library functions. AC_CHECK_FUNCS([clock_gettime getcwd localtime_r strcasecmp strchr strstr sched_getcpu]) # BSD process inspection library AC_SEARCH_LIBS([kvm_openfiles], [kvm], [HAVE_KVM=yes], [HAVE_KVM=no]) AC_SEARCH_LIBS([numa_available], [numa], [HAVE_NUMA=yes], [HAVE_NUMA=no]) AC_CHECK_HEADERS([numa.h]) # FreeBSD 9+ with appropriately configured kernel # (enabled by default in FreeBSD 10) AC_SEARCH_LIBS([cap_getmode], [c]) AC_CHECK_HEADERS([sys/capability.h]) AC_SEARCH_LIBS([cap_init], [cap], [HAVE_LIBCAP=yes], [HAVE_LIBCAP=no]) AC_SEARCH_LIBS([pthread_create], [pthread], [HAVE_PTHREAD=yes], [HAVE_PTHREAD=no]) AC_SEARCH_LIBS([getpidcon], [selinux], [HAVE_SELINUX=yes], [HAVE_SELINUX=no]) AM_CONDITIONAL([HAVE_SELINUX], [test x$HAVE_SELINUX = xtrue]) AC_CHECK_HEADERS([selinux/selinux.h]) AC_SEARCH_LIBS([aa_gettaskcon], [apparmor], [HAVE_APPARMOR=yes], [HAVE_APPARMOR=no]) AM_CONDITIONAL([HAVE_APPARMOR], [test x$HAVE_APPARMOR = xtrue]) AC_CHECK_HEADERS([sys/apparmor.h]) AC_ARG_ENABLE([tests], AS_HELP_STRING([--disable-tests], [Disable unit tests]), [enable_tests=no], [enable_tests=yes]) AM_CONDITIONAL([ENABLE_TESTS], test "$enable_tests" = yes) AM_CONDITIONAL([HAVE_CHECK], test "$HAVE_CHECK" = yes) AM_CONDITIONAL([PACKAGE_URL], "$PACKAGE_URL") #--------------------------------------------------------------------- # Other checks # automake-1.13 defaults to running tests in parallel. As a consequence, # it also disables verbose output meaning that procenv output is not # visible in build logs. Therefore, force old behaviour by passing # 'serial-tests', but only for version of automake >= 1.13 since older # versions don't recognise that option. AM_INIT_AUTOMAKE(m4_esyscmd([ version=`automake --version|head -n 1|grep -o "[0-9][0-9]*\.[0-9][0-9]*"` major=`echo $version|cut -d\. -f1` minor=`echo $version|cut -d\. -f2` if [ "$major" = 1 -a "$minor" -ge 13 ]; then echo serial-tests elif [ "$major" -gt 1 ]; then echo serial-tests fi ])) original_cflags="$CFLAGS" CFLAGS=-Werror=format-security AC_MSG_CHECKING([whether CC supports -Werror=format-security]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [AC_MSG_RESULT([yes])] [AM_CFLAGS=-Werror=format-security], [AC_MSG_RESULT([no])]) CFLAGS="$original_cflags" AC_SUBST([AM_CFLAGS]) AC_ARG_ENABLE([compiler-optimisations], AS_HELP_STRING([--disable-compiler-optimisations], [Disable compiler optimisations]), [AS_IF([test "x$enable_compiler_optimisations" = "xno"], [[CFLAGS=`echo "$CFLAGS" | sed -e "s/ -O[1-9s]*\b/ -O0/g"` CXXFLAGS=`echo "$CXXFLAGS" | sed -e "s/ -O[1-9s]*\b/ -O0/g"`]])]) AC_ARG_ENABLE([linker-optimisations], AS_HELP_STRING([--disable-linker-optimisations], [Disable linker optimisations]), [AS_IF([test "x$enable_linker_optimisations" = "xno"], [LDFLAGS=`echo "$LDFLAGS" | sed -e "s/ -Wl,-O[0-9]*\b//g"`], [LDFLAGS="$LDFLAGS -Wl,-O1"])]) AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [enable developer build]), [AS_IF([test "x$enable_debug" = "xyes"], [[CFLAGS=`echo "$CFLAGS -DDEBUG -pg"` CXXFLAGS=`echo "$CXXFLAGS -DDEBUG -pg"` DEBUG_BUILD=yes]])], [DEBUG_BUILD=no]) AC_ARG_ENABLE([reproducible_build], AS_HELP_STRING([--enable-reproducible-build], [Disable display of build-time values that are guaranteed to differ between builds]), [reproducible_build=yes], [reproducible_build=no]) if test "$reproducible_build" = yes; then AC_DEFINE([PROCENV_REPRODUCIBLE_BUILD], [1], [Generate a reproducible build]) fi #--------------------------------------------------------------------- # XXX: Dump details of the preprocess/compiler/linker *NOW* so that if # procenv fails to build later, the build logs will show details of the # environment that should aid remote debugging. # # This may be bad form, but trying to do this at the automake stage # seems(?) to be impossible. t=${srcdir}/src/tests/show_compiler_details msg=$(cat < and Kees Cook .RB < kees@ubuntu.com > "" "." .\" .SH COPYRIGHT Copyright \(co 2012-2014 James Hunt .RB < jamesodhunt@ubuntu.com > and Kees Cook .RB < kees@ubuntu.com > "" "." .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .\" .SH LICENSE 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. .\" .SH SEE ALSO .BR capabilities (7) "" " (Linux), " .BR capsicum (4) "" " (BSD)" "" ", " .BR cc (1) "" , .BR credentials (7) "" , .BR date (1) "" , .BR env (1) "" , .BR exec (P) "" , .BR getconf (1) "" , .BR groups (1) "" , .BR ifconfig (8) "" , .BR ip (9) "" , .BR ipcs (1) "" , .BR kill (1) "" , .BR ldd (1) "" , .BR locale (1) "" , .BR ls (1) "" , .BR mount (1) "" , .BR proc (5) "" , .BR ps (1) "" , .BR rights (4) "" (BSD), .BR sh (1) "" , .BR stat (1) "" , .BR stty (1) "" , .BR umask (P) "" , .BR uname (1) procenv-0.43/procenv.spec000066400000000000000000000036651262513272000154560ustar00rootroot00000000000000Name: procenv Version: 0.43 Release: 1%{?dist} Summary: Utility to show process environment Group: Applications/System License: GPLv3+ URL: https://github.com/jamesodhunt/procenv Source0: https://github.com/jamesodhunt/procenv/archive/0.43.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # fixme: should be autoconf >= 2.68, but Fedora packages or alien'ed dpkg # need a later m4 too BuildRequires: gcc, make, binutils, autoconf, automake, pkgconfig, expat, libcap-devel, libselinux-devel # Only used in testing, not in EPEL. %if 0%{?fedora} BuildRequires: perl-JSON-PP %endif %ifnarch %{arm} s390 s390x BuildRequires: numactl-devel %endif %description This package contains a command-line tool that displays as much detail about itself and its environment as possible. It can be used as a test tool, to understand the type of environment a process runs in, and for comparing system environments. %prep %setup -q %build %configure make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT %check %if 0%{?fedora} make check %endif %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %{_bindir}/procenv %{_mandir}/man1/procenv.1.gz %doc NEWS ChangeLog TODO %changelog * Thu Jun 5 2014 Dave Love - 0.35-2 - Only BR perl-JSON-PP and run tests on fedora * Fri Jan 31 2014 James Hunt - 0.32-1 - Update to 0.31. * Thu Jan 23 2014 James Hunt - 0.30-1 - Update to 0.30. * Thu Nov 14 2013 Dave Love - 0.27-1 - Update to 0.27, fix Source0 * Sun Dec 9 2012 Dave Love - 0.18-1 - Update to 0.18 * Tue Dec 4 2012 Dave Love - 0.16-2 - Re-fix locale-reporting. * Mon Dec 3 2012 Dave Love - 0.16-1 - Update to 0.16 * Thu Nov 22 2012 Dave Love - 0.12-1 - Initial packaging procenv-0.43/procenv.spec.in000066400000000000000000000037211262513272000160540ustar00rootroot00000000000000Name: @PACKAGE@ Version: @PROCENV_VERSION@ Release: 1%{?dist} Summary: Utility to show process environment Group: Applications/System License: GPLv3+ URL: https://github.com/jamesodhunt/procenv Source0: https://github.com/jamesodhunt/procenv/archive/@PROCENV_VERSION@.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # fixme: should be autoconf >= 2.68, but Fedora packages or alien'ed dpkg # need a later m4 too BuildRequires: gcc, make, binutils, autoconf, automake, pkgconfig, expat, libcap-devel, libselinux-devel # Only used in testing, not in EPEL. %if 0%{?fedora} BuildRequires: perl-JSON-PP %endif %ifnarch %{arm} s390 s390x BuildRequires: numactl-devel %endif %description This package contains a command-line tool that displays as much detail about itself and its environment as possible. It can be used as a test tool, to understand the type of environment a process runs in, and for comparing system environments. %prep %setup -q %build %configure make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT %check %if 0%{?fedora} make check %endif %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %{_bindir}/procenv %{_mandir}/man1/procenv.1.gz %doc NEWS ChangeLog TODO %changelog * Thu Jun 5 2014 Dave Love - 0.35-2 - Only BR perl-JSON-PP and run tests on fedora * Fri Jan 31 2014 James Hunt - 0.32-1 - Update to 0.31. * Thu Jan 23 2014 James Hunt - 0.30-1 - Update to 0.30. * Thu Nov 14 2013 Dave Love - 0.27-1 - Update to 0.27, fix Source0 * Sun Dec 9 2012 Dave Love - 0.18-1 - Update to 0.18 * Tue Dec 4 2012 Dave Love - 0.16-2 - Re-fix locale-reporting. * Mon Dec 3 2012 Dave Love - 0.16-1 - Update to 0.16 * Thu Nov 22 2012 Dave Love - 0.12-1 - Initial packaging procenv-0.43/reconf000077500000000000000000000001411262513272000143120ustar00rootroot00000000000000#!/bin/sh mkdir -p config rm -f config.cache aclocal -I m4 autoconf autoheader automake -a exit procenv-0.43/src/000077500000000000000000000000001262513272000137035ustar00rootroot00000000000000procenv-0.43/src/Makefile.am000066400000000000000000000021321262513272000157350ustar00rootroot00000000000000AUTOMAKE_OPTIONS = subdir-objects AM_CFLAGS = \ -pedantic \ -std=gnu99 \ -Wall -Wunused \ -fstack-protector \ -Wformat bin_PROGRAMS = procenv procenv_SOURCES = \ procenv.c procenv.h \ pr_list.c pr_list.h procenv_LDADD = -lrt procenv_CPPFLAGS = if HAVE_SELINUX procenv_CPPFLAGS += -DHAVE_SELINUX endif if HAVE_APPARMOR procenv_CPPFLAGS += -DHAVE_APPARMOR endif if ENABLE_TESTS TESTS = CLEANFILES = check_all_args: tests/check_all_args.in sed -e 's|[@]builddir[@]|$(top_builddir)/$(subdir)|g' \ -e 's|[@]man_path[@]|$(top_srcdir)/man/procenv.1|g' \ -e 's|[@]package_url[@]|$(PACKAGE_URL)|g' \ $< > $@ chmod +x $@ if HAVE_CHECK TESTS += check_pr_list check_PROGRAMS = check_pr_list check_pr_list_SOURCES = tests/check_pr_list.c check_pr_list_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/src check_pr_list_LDADD = @CHECK_LIBS@ pr_list.o endif # Run built binary to ensure we can display all values TESTS += procenv TESTS += check_all_args CLEANFILES += check_all_args endif EXTRA_DIST = \ tests/show_compiler_details \ tests/check_all_args.in \ tests/check_pr_list.c procenv-0.43/src/Makefile.in000066400000000000000000000722421262513272000157570ustar00rootroot00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = procenv$(EXEEXT) @HAVE_SELINUX_TRUE@am__append_1 = -DHAVE_SELINUX @HAVE_APPARMOR_TRUE@am__append_2 = -DHAVE_APPARMOR @ENABLE_TESTS_TRUE@TESTS = $(am__EXEEXT_1) procenv$(EXEEXT) \ @ENABLE_TESTS_TRUE@ check_all_args @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@am__append_3 = check_pr_list @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@check_PROGRAMS = \ @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@ check_pr_list$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__check_pr_list_SOURCES_DIST = tests/check_pr_list.c am__dirstamp = $(am__leading_dot)dirstamp @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@am_check_pr_list_OBJECTS = tests/check_pr_list-check_pr_list.$(OBJEXT) check_pr_list_OBJECTS = $(am_check_pr_list_OBJECTS) @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@check_pr_list_DEPENDENCIES = \ @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@ pr_list.o check_pr_list_LINK = $(CCLD) $(check_pr_list_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_procenv_OBJECTS = procenv-procenv.$(OBJEXT) \ procenv-pr_list.$(OBJEXT) procenv_OBJECTS = $(am_procenv_OBJECTS) procenv_DEPENDENCIES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(check_pr_list_SOURCES) $(procenv_SOURCES) DIST_SOURCES = $(am__check_pr_list_SOURCES_DIST) $(procenv_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@am__EXEEXT_1 = \ @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@ check_pr_list$(EXEEXT) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CFLAGS = \ -pedantic \ -std=gnu99 \ -Wall -Wunused \ -fstack-protector \ -Wformat AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ 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@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROCENV_VERSION = @PROCENV_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = subdir-objects procenv_SOURCES = \ procenv.c procenv.h \ pr_list.c pr_list.h procenv_LDADD = -lrt procenv_CPPFLAGS = $(am__append_1) $(am__append_2) @ENABLE_TESTS_TRUE@CLEANFILES = check_all_args @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@check_pr_list_SOURCES = tests/check_pr_list.c @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@check_pr_list_CFLAGS = @CHECK_CFLAGS@ -I$(top_srcdir)/src @ENABLE_TESTS_TRUE@@HAVE_CHECK_TRUE@check_pr_list_LDADD = @CHECK_LIBS@ pr_list.o EXTRA_DIST = \ tests/show_compiler_details \ tests/check_all_args.in \ tests/check_pr_list.c all: all-am .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 ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) tests/$(am__dirstamp): @$(MKDIR_P) tests @: > tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) tests/$(DEPDIR) @: > tests/$(DEPDIR)/$(am__dirstamp) tests/check_pr_list-check_pr_list.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) check_pr_list$(EXEEXT): $(check_pr_list_OBJECTS) $(check_pr_list_DEPENDENCIES) $(EXTRA_check_pr_list_DEPENDENCIES) @rm -f check_pr_list$(EXEEXT) $(AM_V_CCLD)$(check_pr_list_LINK) $(check_pr_list_OBJECTS) $(check_pr_list_LDADD) $(LIBS) procenv$(EXEEXT): $(procenv_OBJECTS) $(procenv_DEPENDENCIES) $(EXTRA_procenv_DEPENDENCIES) @rm -f procenv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(procenv_OBJECTS) $(procenv_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f tests/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procenv-pr_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procenv-procenv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/check_pr_list-check_pr_list.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` tests/check_pr_list-check_pr_list.o: tests/check_pr_list.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_pr_list_CFLAGS) $(CFLAGS) -MT tests/check_pr_list-check_pr_list.o -MD -MP -MF tests/$(DEPDIR)/check_pr_list-check_pr_list.Tpo -c -o tests/check_pr_list-check_pr_list.o `test -f 'tests/check_pr_list.c' || echo '$(srcdir)/'`tests/check_pr_list.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/check_pr_list-check_pr_list.Tpo tests/$(DEPDIR)/check_pr_list-check_pr_list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/check_pr_list.c' object='tests/check_pr_list-check_pr_list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_pr_list_CFLAGS) $(CFLAGS) -c -o tests/check_pr_list-check_pr_list.o `test -f 'tests/check_pr_list.c' || echo '$(srcdir)/'`tests/check_pr_list.c tests/check_pr_list-check_pr_list.obj: tests/check_pr_list.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_pr_list_CFLAGS) $(CFLAGS) -MT tests/check_pr_list-check_pr_list.obj -MD -MP -MF tests/$(DEPDIR)/check_pr_list-check_pr_list.Tpo -c -o tests/check_pr_list-check_pr_list.obj `if test -f 'tests/check_pr_list.c'; then $(CYGPATH_W) 'tests/check_pr_list.c'; else $(CYGPATH_W) '$(srcdir)/tests/check_pr_list.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/check_pr_list-check_pr_list.Tpo tests/$(DEPDIR)/check_pr_list-check_pr_list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/check_pr_list.c' object='tests/check_pr_list-check_pr_list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_pr_list_CFLAGS) $(CFLAGS) -c -o tests/check_pr_list-check_pr_list.obj `if test -f 'tests/check_pr_list.c'; then $(CYGPATH_W) 'tests/check_pr_list.c'; else $(CYGPATH_W) '$(srcdir)/tests/check_pr_list.c'; fi` procenv-procenv.o: procenv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(procenv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT procenv-procenv.o -MD -MP -MF $(DEPDIR)/procenv-procenv.Tpo -c -o procenv-procenv.o `test -f 'procenv.c' || echo '$(srcdir)/'`procenv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/procenv-procenv.Tpo $(DEPDIR)/procenv-procenv.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='procenv.c' object='procenv-procenv.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(procenv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o procenv-procenv.o `test -f 'procenv.c' || echo '$(srcdir)/'`procenv.c procenv-procenv.obj: procenv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(procenv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT procenv-procenv.obj -MD -MP -MF $(DEPDIR)/procenv-procenv.Tpo -c -o procenv-procenv.obj `if test -f 'procenv.c'; then $(CYGPATH_W) 'procenv.c'; else $(CYGPATH_W) '$(srcdir)/procenv.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/procenv-procenv.Tpo $(DEPDIR)/procenv-procenv.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='procenv.c' object='procenv-procenv.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(procenv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o procenv-procenv.obj `if test -f 'procenv.c'; then $(CYGPATH_W) 'procenv.c'; else $(CYGPATH_W) '$(srcdir)/procenv.c'; fi` procenv-pr_list.o: pr_list.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(procenv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT procenv-pr_list.o -MD -MP -MF $(DEPDIR)/procenv-pr_list.Tpo -c -o procenv-pr_list.o `test -f 'pr_list.c' || echo '$(srcdir)/'`pr_list.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/procenv-pr_list.Tpo $(DEPDIR)/procenv-pr_list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pr_list.c' object='procenv-pr_list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(procenv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o procenv-pr_list.o `test -f 'pr_list.c' || echo '$(srcdir)/'`pr_list.c procenv-pr_list.obj: pr_list.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(procenv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT procenv-pr_list.obj -MD -MP -MF $(DEPDIR)/procenv-pr_list.Tpo -c -o procenv-pr_list.obj `if test -f 'pr_list.c'; then $(CYGPATH_W) 'pr_list.c'; else $(CYGPATH_W) '$(srcdir)/pr_list.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/procenv-pr_list.Tpo $(DEPDIR)/procenv-pr_list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='pr_list.c' object='procenv-pr_list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(procenv_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o procenv-pr_list.obj `if test -f 'pr_list.c'; then $(CYGPATH_W) 'pr_list.c'; else $(CYGPATH_W) '$(srcdir)/pr_list.c'; fi` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ 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 $(AM_TESTS_FD_REDIRECT); then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ 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 \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ 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`; \ if test "$$failed" -eq 0; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$${col}$$dashes$${std}"; \ echo "$${col}$$banner$${std}"; \ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ test -z "$$report" || echo "$${col}$$report$${std}"; \ echo "$${col}$$dashes$${std}"; \ 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 "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f tests/$(DEPDIR)/$(am__dirstamp) -rm -f tests/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) tests/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) tests/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile @ENABLE_TESTS_TRUE@check_all_args: tests/check_all_args.in @ENABLE_TESTS_TRUE@ sed -e 's|[@]builddir[@]|$(top_builddir)/$(subdir)|g' \ @ENABLE_TESTS_TRUE@ -e 's|[@]man_path[@]|$(top_srcdir)/man/procenv.1|g' \ @ENABLE_TESTS_TRUE@ -e 's|[@]package_url[@]|$(PACKAGE_URL)|g' \ @ENABLE_TESTS_TRUE@ $< > $@ @ENABLE_TESTS_TRUE@ chmod +x $@ # 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: procenv-0.43/src/pr_list.c000066400000000000000000000162061262513272000155300ustar00rootroot00000000000000/*-------------------------------------------------------------------- * procenv - generic list handling routines. * * Copyright © 2012-2015 James Hunt . * * 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 . *-------------------------------------------------------------------- */ #include #include #include /** * pr_list_new: * * @data: data pointer to store in node. * * Create a new list entry. * * Returns: New PRList or NULL on error. **/ PRList * pr_list_new (void *data) { PRList *list; list = (PRList *)calloc (1, sizeof (PRList)); if (! list) return NULL; list->next = list->prev = list; list->data = data; return list; } inline int pr_list_empty(PRList *list) { assert (list); return list->next == list && list->prev == list; } /** * pr_list_append: * * @list: list to operate on, * @entry: new PRList to add. * * Add @entry after @list entry. * * Returns: Newly-added entry. **/ PRList * pr_list_append (PRList *list, PRList *entry) { assert (list); assert (entry); entry->next = list->next; entry->prev = list; list->next->prev = entry; list->next = entry; return entry; } /** * pr_list_append_str: * * @list: list to operate on, * @str: string value to add to new entry. * * Create entry containing @str and add it after @list. * * Returns: New entry. **/ PRList * pr_list_append_str (PRList *list, const char *str) { size_t len; assert (list); assert (str); len = strlen (str); return pr_list_appendn_str (list, str, len); } /** * pr_list_appendn_str: * * @list: list to operate on, * @str: string value to add to new entry, * @len: length of @str to add to entry. * * Create entry containing @str and add it after @list. * * Returns: New entry. **/ PRList * pr_list_appendn_str (PRList *list, const char *str, size_t len) { char *s; PRList *entry; assert (list); assert (str); s = strndup (str, 1+len); assert (s); entry = pr_list_new (s); assert (entry); pr_list_append (list, entry); return entry; } /** * pr_list_prepend: * * @list: list to operate on, * @entry: new PRList to add. * * Add @entry before @list entry. * * Returns: Newly-added entry. **/ PRList * pr_list_prepend (PRList *list, PRList *entry) { assert (list); assert (entry); entry->next = list; entry->prev = list->prev; list->prev->next = entry; list->prev = entry; return entry; } /** * pr_list_prepend_str: * * @list: list to operate on, * @str: string value to add to new entry. * * Create entry containing @str and add it before @list. * * Returns: New entry. **/ PRList * pr_list_prepend_str (PRList *list, const char *str) { size_t len; assert (list); assert (str); len = strlen (str); return pr_list_prependn_str (list, str, len); } /** * pr_list_prependn_str: * * @list: list to operate on, * @str: string value to add to new entry, * @len: length of @str to add to entry. * * Create entry containing @str and add it before @list. * * Returns: New entry. **/ PRList * pr_list_prependn_str (PRList *list, const char *str, size_t len) { char *s; PRList *entry; assert (list); assert (str); s = strndup (str, 1+len); assert (s); entry = pr_list_new (s); assert (entry); pr_list_prepend (list, entry); return entry; } int pr_list_cmp_str(PRList *la, PRList *lb) { const char *a, *b; assert (la); assert (lb); a = (const char *)la->data; b = (const char *)lb->data; if (!a && !b) { return 0; } else if (!a && b) { return -1; } else if (a && !b) { return 1; } else { int ret = strcmp(a, b); return ret; } } #define pr_list_next(list, direction) \ direction > 0 ? (list)->next : (list)->prev static PRList * pr_list_add_sorted_internal(PRList *list, PRList *entry, PRListCmp cmp, int prepend) { PRList *p; PRList *start; int direction; assert (list); assert (entry); assert (cmp); PRList *(*handler)(PRList *list, PRList *entry); handler = prepend ? pr_list_prepend : pr_list_append; /* 1 being forwards, -1 backwards */ direction = prepend ? 1 : -1; if (direction > 0) { p = start = list->next; } else { p = start = list->prev; } for (p = start; p != list; p = pr_list_next(p, direction)) { if (cmp (entry, p) < 0) return handler(p, entry); } return handler(list, entry); } PRList * pr_list_prepend_sorted(PRList *list, PRList *entry, PRListCmp cmp) { return pr_list_add_sorted_internal (list, entry, cmp, 1); } PRList * pr_list_append_sorted(PRList *list, PRList *entry, PRListCmp cmp) { return pr_list_add_sorted_internal (list, entry, cmp, 0); } PRList * pr_list_prepend_str_sorted(PRList *list, PRList *entry) { return pr_list_prepend_sorted(list, entry, pr_list_cmp_str); } PRList * pr_list_append_str_sorted(PRList *list, PRList *entry) { return pr_list_append_sorted(list, entry, pr_list_cmp_str); } /** * pr_list_remove: * * @list: list to operate on. * * Remove @entry from its containing list. * * Returns: Removed entry. **/ PRList * pr_list_remove (PRList *entry) { assert (entry); entry->prev->next = entry->next; entry->next->prev = entry->prev; /* No longer attached to list */ entry->next = entry->prev = entry; return entry; } /** * pr_list_foreach_visit: * * @list: list to operate on, * @visitor: function to run on every element on @list. * * Visit every entry in @list passing them to @visitor. **/ void pr_list_foreach_visit (PRList *list, PRListVisitor visitor) { PRList *p; assert (list); p = list; do { if (visitor) visitor (p); p = p->next; } while (p != list); } /** * pr_list_foreach_rev_visit: * * @list: list to operate on, * @visitor: function to run on every element on @list. * * Visit every entry in @list in reverse passing them to @visitor. **/ void pr_list_foreach_rev_visit (PRList *list, PRListVisitor visitor) { PRList *p; assert (list); p = list->prev; do { if (visitor) visitor (p); p = p->prev; } while (p != list->prev); } /** * pr_list_visitor_str: * * @entry: list entry to operate on. * * Display data in @entry as a string. **/ void pr_list_visitor_str (PRList *entry) { assert (entry); printf ("entry: addr=%p, prev=%p, next=%p, data=%p ('%s')\n", (void *)entry, (void *)entry->prev, (void *)entry->next, (void *)entry->data, entry->data ? (char *)entry->data : ""); fflush (NULL); } procenv-0.43/src/pr_list.h000066400000000000000000000055271262513272000155410ustar00rootroot00000000000000/*-------------------------------------------------------------------- * procenv - generic list handling header. * * Copyright 2012-2015 James Hunt . * * 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 . *-------------------------------------------------------------------- */ #ifndef _PROCENV_LIST #define _PROCENV_LIST #ifdef HAVE_CONFIG_H # include #endif /* HAVE_CONFIG_H */ #include #include /* Double-linked list structure with no terminal node - a list of a * single item has next and prev pointers pointing "back round" to * itself. */ typedef struct list { void *data; struct list *next; struct list *prev; } PRList; typedef void (*PRListVisitor) (PRList *entry); typedef int (*PRListCmp) (PRList *a, PRList *b); PRList *pr_list_new (void *data); PRList *pr_list_append (PRList *list, PRList *entry); PRList *pr_list_append_str (PRList *list, const char *str); PRList *pr_list_appendn_str (PRList *list, const char *str, size_t len); PRList *pr_list_prepend (PRList *list, PRList *entry); PRList *pr_list_prepend_str (PRList *list, const char *str); PRList *pr_list_prependn_str (PRList *list, const char *str, size_t len); PRList *pr_list_prepend_str_sorted(PRList *list, PRList *entry); PRList *pr_list_prepend_sorted(PRList *list, PRList *entry, PRListCmp cmp); PRList *pr_list_append_str_sorted(PRList *list, PRList *entry); PRList *pr_list_append_sorted(PRList *list, PRList *entry, PRListCmp cmp); PRList *pr_list_remove (PRList *entry); void pr_list_foreach_visit (PRList *list, PRListVisitor visitor); void pr_list_foreach_rev_visit (PRList *list, PRListVisitor visitor); void pr_list_visitor_str (PRList *entry); #define PR_LIST_FOREACH(list, iter) \ for (PRList *iter = (list)->next; iter != (list); iter = iter->next) #define PR_LIST_FOREACH_SAFE(list, iter) \ for (PRList *iter = (list)->next, *tmp = iter->next; \ iter != (list); \ iter = tmp, tmp = iter->next) #define PR_LIST_FOREACH_REV(list, iter) \ for (PRList *iter = (list)->prev; iter != (list); iter = iter->prev) #define PR_LIST_FOREACH_STR(list) \ pr_list_foreach_visit (list, pr_list_visitor_str) #define PR_LIST_FOREACH_REV_STR(list) \ pr_list_foreach_rev_visit (list, pr_list_visitor_str) #endif /* _PROCENV_LIST */ procenv-0.43/src/procenv.c000066400000000000000000006560031262513272000155350ustar00rootroot00000000000000/*-------------------------------------------------------------------- * Description: Simple program to display information on process * environment. * * Date: 24 October 2012. * * Author: James Hunt . * * Licence: GPLv3. See below... *-------------------------------------------------------------------- * * Copyright © 2012-2015 James Hunt . * * 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 . *-------------------------------------------------------------------- */ #include /** * doc: * * The output document in wide-character format. **/ pstring *doc = NULL; /** * output: * * Where to send output. **/ Output output = OUTPUT_STDOUT; /** * output_format: * * Format output will be displayed in. **/ OutputFormat output_format = OUTPUT_FORMAT_TEXT; /** * output_file: * * Name or output file to send output to if not NULL. **/ const char *output_file = NULL; /** * text_separator: * * Separator used for text output format to separate a name from a * value. **/ const char *text_separator = PROCENV_DEFAULT_TEXT_SEPARATOR; /** * crumb_separator: * * Separator used for text output format to separate a name from a * value. **/ const char *crumb_separator = PROCENV_DEFAULT_CRUMB_SEPARATOR; /** * output_fd: * * File descriptor associated with output_file. **/ int output_fd = -1; /** * reexec: * * TRUE if we should re-exec at the end. **/ int reexec = FALSE; /** * selected_option: * * A non-zero value denotes user has requested a subset of the available * information with the value representing the short command-line * option. **/ int selected_option = 0; /** * indent: * * Current output indent value. **/ int indent = 0; /** * indent_amount: * * Number of INDENT_CHARs to emit for an indent. **/ int indent_amount = DEFAULT_INDENT_AMOUNT; /** * indent_char, wide_indent_char: * * Character to use for indenting and wide-char equivalent. **/ const char *indent_char = DEFAULT_INDENT_CHAR; wchar_t wide_indent_char; /** * program_name: * * Name of program. **/ const char *program_name; /** * exec_args: * * Arguments used for re-exec'ing ourselves. **/ char **exec_args = NULL; /** * Copy of argv and argc used by show_arguments(). **/ char **argvp = NULL; int argvc = 0; /** * Locale in effect at program startup. **/ char *saved_locale = NULL; /** * last_element: Type of previous element handled. **/ ElementType last_element = ELEMENT_TYPE_NONE; /** * current_element: Type of element currently being handled. **/ ElementType current_element = ELEMENT_TYPE_NONE; /** * crumb_list: * * List used to store breadcrumbs when OUTPUT_FORMAT_CRUMB being used. **/ static PRList *crumb_list = NULL; struct procenv_user user; struct procenv_misc misc; struct procenv_priority priority; struct utsname uts; #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) struct mntopt_map { uint64_t flag; char *name; } mntopt_map[] = { { MNT_ACLS , "acls" }, { MNT_ASYNC , "asynchronous" }, { MNT_EXPORTED , "NFS-exported" }, { MNT_GJOURNAL , "gjournal" }, { MNT_LOCAL , "local" }, { MNT_MULTILABEL , "multilabel" }, #ifndef PROCENV_GNU_BSD { MNT_NFS4ACLS , "nfsv4acls" }, #endif { MNT_NOATIME , "noatime" }, { MNT_NOCLUSTERR , "noclusterr" }, { MNT_NOCLUSTERW , "noclusterw" }, { MNT_NOEXEC , "noexec" }, { MNT_NOSUID , "nosuid" }, { MNT_NOSYMFOLLOW , "nosymfollow" }, { MNT_QUOTA , "with quotas" }, { MNT_RDONLY , "read-only" }, { MNT_SOFTDEP , "soft-updates" }, { MNT_SUIDDIR , "suiddir" }, #if ! defined (PROCENV_GNU_BSD) && defined (MNT_SUJ) { MNT_SUJ , "journaled soft-updates" }, #endif { MNT_SYNCHRONOUS , "synchronous" }, { MNT_UNION , "union" }, { 0, NULL } }; #endif struct procenv_map output_map[] = { { OUTPUT_FILE , "file" }, { OUTPUT_STDERR , "stderr" }, { OUTPUT_STDOUT , "stdout" }, { OUTPUT_SYSLOG , "syslog" }, { OUTPUT_TERM , "terminal" }, { 0, NULL } }; struct procenv_map output_format_map[] = { { OUTPUT_FORMAT_TEXT, "text" }, { OUTPUT_FORMAT_CRUMB, "crumb" }, { OUTPUT_FORMAT_JSON, "json" }, { OUTPUT_FORMAT_XML, "xml" }, { 0, NULL } }; struct baud_speed baud_speeds[] = { SPEED (B0), SPEED (B50), SPEED (B75), SPEED (B110), SPEED (B134), SPEED (B150), SPEED (B200), SPEED (B300), SPEED (B600), SPEED (B1200), SPEED (B1800), SPEED (B2400), SPEED (B4800), SPEED (B9600), SPEED (B19200), SPEED (B38400), SPEED (B57600), SPEED (B115200), SPEED (B230400), /* terminator */ { 0, NULL } }; struct if_flag_map { unsigned int flag; char *name; } if_flag_map[] = { mk_map_entry (IFF_UP), mk_map_entry (IFF_BROADCAST), mk_map_entry (IFF_DEBUG), mk_map_entry (IFF_LOOPBACK), mk_map_entry (IFF_POINTOPOINT), mk_map_entry (IFF_RUNNING), mk_map_entry (IFF_NOARP), mk_map_entry (IFF_PROMISC), #if defined (PROCENV_LINUX) mk_map_entry (IFF_NOTRAILERS), #endif mk_map_entry (IFF_ALLMULTI), #if defined (PROCENV_LINUX) mk_map_entry (IFF_MASTER), mk_map_entry (IFF_SLAVE), #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) mk_map_entry (IFF_SIMPLEX), #endif mk_map_entry (IFF_MULTICAST), #if defined (PROCENV_LINUX) mk_map_entry (IFF_PORTSEL), mk_map_entry (IFF_AUTOMEDIA), mk_map_entry (IFF_DYNAMIC), mk_map_entry (IFF_LOWER_UP), mk_map_entry (IFF_DORMANT), # ifdef IFF_ECHO mk_map_entry (IFF_ECHO), # endif #endif { 0, NULL } }; /* * Note the gross hack to avoid need for flexible arrays. */ TranslateTable translate_table[] = { { OUTPUT_FORMAT_XML, { { L'\'', L"'" }, { L'"', L""" }, { L'&', L"&" }, { L'<', L"<" }, { L'>', L">" }, /* terminator */ { L'\0', NULL } } }, { OUTPUT_FORMAT_JSON, { { L'"', L"\\\"" }, { L'\\', L"\\\\" }, /* hack! */ { L'\0', NULL }, { L'\0', NULL }, { L'\0', NULL }, /* terminator */ { L'\0', NULL } } }, }; #if defined (PROCENV_LINUX) struct if_extended_flag_map { unsigned int flag; char *name; } if_extended_flag_map[] = { #if defined (IFF_802_1Q_VLAN) mk_map_entry (IFF_802_1Q_VLAN), #endif #if defined (IFF_EBRIDGE) mk_map_entry (IFF_EBRIDGE), #endif #if defined (IFF_SLAVE_INACTIVE) mk_map_entry (IFF_SLAVE_INACTIVE), #endif #if defined (IFF_MASTER_8023AD) mk_map_entry (IFF_MASTER_8023AD), #endif #if defined (IFF_MASTER_ALB) mk_map_entry (IFF_MASTER_ALB), #endif #if defined (IFF_BONDING) mk_map_entry (IFF_BONDING), #endif #if defined (IFF_SLAVE_NEEDARP) mk_map_entry (IFF_SLAVE_NEEDARP), #endif #if defined (IFF_ISATAP) mk_map_entry (IFF_ISATAP), #endif { 0, NULL } }; struct personality_map { unsigned int personality; char *name; } personality_map[] = { mk_map_entry (PER_LINUX), mk_map_entry (PER_LINUX_32BIT), mk_map_entry (PER_SVR4), mk_map_entry (PER_SVR3), mk_map_entry (PER_SCOSVR3), mk_map_entry (PER_OSR5), mk_map_entry (PER_WYSEV386), mk_map_entry (PER_ISCR4), mk_map_entry (PER_BSD), mk_map_entry (PER_SUNOS), mk_map_entry (PER_XENIX), #if defined (PER_LINUX32) mk_map_entry (PER_LINUX32), #endif #if defined (PER_LINUX32_3GB) mk_map_entry (PER_LINUX32_3GB), #endif mk_map_entry (PER_IRIX32), mk_map_entry (PER_IRIXN32), mk_map_entry (PER_IRIX64), mk_map_entry (PER_RISCOS), mk_map_entry (PER_SOLARIS), mk_map_entry (PER_UW7), mk_map_entry (PER_OSF4), mk_map_entry (PER_HPUX), { 0, NULL } }; struct personality_flag_map { unsigned int flag; char *name; } personality_flag_map[] = { #if defined (ADDR_COMPAT_LAYOUT) mk_map_entry (ADDR_COMPAT_LAYOUT), #endif #if defined (ADDR_LIMIT_32BIT) mk_map_entry (ADDR_LIMIT_32BIT), #endif #if defined (ADDR_LIMIT_3GB) mk_map_entry (ADDR_LIMIT_3GB), #endif #if defined (ADDR_NO_RANDOMIZE) mk_map_entry (ADDR_NO_RANDOMIZE), #endif #if defined (MMAP_PAGE_ZERO) mk_map_entry (MMAP_PAGE_ZERO), #endif #if defined (READ_IMPLIES_EXEC) mk_map_entry (READ_IMPLIES_EXEC), #endif #if defined (SHORT_INODE) mk_map_entry (SHORT_INODE), #endif #if defined (STICKY_TIMEOUTS) mk_map_entry (STICKY_TIMEOUTS), #endif #if defined (WHOLE_SECONDS) mk_map_entry (WHOLE_SECONDS), #endif { 0, NULL } }; #endif /* Really, every single sysconf variable should be ifdef'ed since it * may not exist on a particular system, but that makes the code look * untidy. * * The ifdefs we have below seem sufficient for modern systems * (Ubuntu Lucid and newer). If only we could use ifdef in macros. * sigh... */ struct procenv_map sysconf_map[] = { #if defined (_SC_2_C_BIND) mk_sysconf_map_entry (_SC_2_C_BIND), #endif #if defined (_SC_2_C_DEV) mk_sysconf_map_entry (_SC_2_C_DEV), #endif #if defined (_SC_2_CHAR_TERM) mk_sysconf_map_entry (_SC_2_CHAR_TERM), #endif #if defined (_SC_2_C_VERSION) mk_sysconf_map_entry (_SC_2_C_VERSION), #endif #if defined (_SC_2_FORT_DEV) mk_sysconf_map_entry (_SC_2_FORT_DEV), #endif #if defined (_SC_2_FORT_RUN) mk_sysconf_map_entry (_SC_2_FORT_RUN), #endif #if defined (_SC_2_LOCALEDEF) mk_sysconf_map_entry (_SC_2_LOCALEDEF), #endif #if defined (_SC_2_PBS) mk_sysconf_map_entry (_SC_2_PBS), #endif #if defined (_SC_2_PBS_ACCOUNTING) mk_sysconf_map_entry (_SC_2_PBS_ACCOUNTING), #endif #if defined (_SC_2_PBS_LOCATE) mk_sysconf_map_entry (_SC_2_PBS_LOCATE), #endif #if defined (_SC_2_PBS_MESSAGE) mk_sysconf_map_entry (_SC_2_PBS_MESSAGE), #endif #if defined (_SC_2_PBS_TRACK) mk_sysconf_map_entry (_SC_2_PBS_TRACK), #endif #if defined (_SC_2_SW_DEV) mk_sysconf_map_entry (_SC_2_SW_DEV), #endif #if defined (_SC_2_UPE) mk_sysconf_map_entry (_SC_2_UPE), #endif #if defined (_SC_2_VERSION) mk_sysconf_map_entry (_SC_2_VERSION), #endif #if defined (_SC_ADVISORY_INFO) mk_sysconf_map_entry (_SC_ADVISORY_INFO), #endif #if defined (_SC_AIO_LISTIO_MAX) mk_sysconf_map_entry (_SC_AIO_LISTIO_MAX), #endif #if defined (_SC_AIO_MAX) mk_sysconf_map_entry (_SC_AIO_MAX), #endif #if defined (_SC_AIO_PRIO_DELTA_MAX) mk_sysconf_map_entry (_SC_AIO_PRIO_DELTA_MAX), #endif #if defined (_SC_ARG_MAX) mk_sysconf_map_entry (_SC_ARG_MAX), #endif #if defined (_SC_ASYNCHRONOUS_IO) mk_sysconf_map_entry (_SC_ASYNCHRONOUS_IO), #endif #if defined (_SC_ATEXIT_MAX) mk_sysconf_map_entry (_SC_ATEXIT_MAX), #endif #if defined (_SC_AVPHYS_PAGES) mk_sysconf_map_entry (_SC_AVPHYS_PAGES), #endif #if defined (_SC_BARRIERS) mk_sysconf_map_entry (_SC_BARRIERS), #endif #if defined (_SC_BASE) mk_sysconf_map_entry (_SC_BASE), #endif #if defined (_SC_BC_BASE_MAX) mk_sysconf_map_entry (_SC_BC_BASE_MAX), #endif #if defined (_SC_BC_DIM_MAX) mk_sysconf_map_entry (_SC_BC_DIM_MAX), #endif #if defined (_SC_BC_SCALE_MAX) mk_sysconf_map_entry (_SC_BC_SCALE_MAX), #endif #if defined (_SC_BC_STRING_MAX) mk_sysconf_map_entry (_SC_BC_STRING_MAX), #endif #if defined (_SC_CHAR_BIT) mk_sysconf_map_entry (_SC_CHAR_BIT), #endif #if defined (_SC_CHARCLASS_NAME_MAX) mk_sysconf_map_entry (_SC_CHARCLASS_NAME_MAX), #endif #if defined (_SC_CHAR_MAX) mk_sysconf_map_entry (_SC_CHAR_MAX), #endif #if defined (_SC_CHAR_MIN) mk_sysconf_map_entry (_SC_CHAR_MIN), #endif #if defined (_SC_CHILD_MAX) mk_sysconf_map_entry (_SC_CHILD_MAX), #endif #if defined (_SC_C_LANG_SUPPORT) mk_sysconf_map_entry (_SC_C_LANG_SUPPORT), #endif #if defined (_SC_C_LANG_SUPPORT_R) mk_sysconf_map_entry (_SC_C_LANG_SUPPORT_R), #endif #if defined (_SC_CLK_TCK) mk_sysconf_map_entry (_SC_CLK_TCK), #endif #if defined (_SC_CLOCK_SELECTION) mk_sysconf_map_entry (_SC_CLOCK_SELECTION), #endif #if defined (_SC_COLL_WEIGHTS_MAX) mk_sysconf_map_entry (_SC_COLL_WEIGHTS_MAX), #endif #if defined (_SC_CPUTIME) mk_sysconf_map_entry (_SC_CPUTIME), #endif #if defined (_SC_DELAYTIMER_MAX) mk_sysconf_map_entry (_SC_DELAYTIMER_MAX), #endif #if defined (_SC_DEVICE_IO) mk_sysconf_map_entry (_SC_DEVICE_IO), #endif #if defined (_SC_DEVICE_SPECIFIC) mk_sysconf_map_entry (_SC_DEVICE_SPECIFIC), #endif #if defined (_SC_DEVICE_SPECIFIC_R) mk_sysconf_map_entry (_SC_DEVICE_SPECIFIC_R), #endif #if defined (_SC_EQUIV_CLASS_MAX) mk_sysconf_map_entry (_SC_EQUIV_CLASS_MAX), #endif #if defined (_SC_EXPR_NEST_MAX) mk_sysconf_map_entry (_SC_EXPR_NEST_MAX), #endif #if defined (_SC_FD_MGMT) mk_sysconf_map_entry (_SC_FD_MGMT), #endif #if defined (_SC_FIFO) mk_sysconf_map_entry (_SC_FIFO), #endif #if defined (_SC_FILE_ATTRIBUTES) mk_sysconf_map_entry (_SC_FILE_ATTRIBUTES), #endif #if defined (_SC_FILE_LOCKING) mk_sysconf_map_entry (_SC_FILE_LOCKING), #endif #if defined (_SC_FILE_SYSTEM) mk_sysconf_map_entry (_SC_FILE_SYSTEM), #endif #if defined (_SC_FSYNC) mk_sysconf_map_entry (_SC_FSYNC), #endif #if defined (_SC_GETGR_R_SIZE_MAX) mk_sysconf_map_entry (_SC_GETGR_R_SIZE_MAX), #endif #if defined (_SC_GETPW_R_SIZE_MAX) mk_sysconf_map_entry (_SC_GETPW_R_SIZE_MAX), #endif #if defined (_SC_HOST_NAME_MAX) mk_sysconf_map_entry (_SC_HOST_NAME_MAX), #endif #if defined (_SC_INT_MAX) mk_sysconf_map_entry (_SC_INT_MAX), #endif #if defined (_SC_INT_MIN) mk_sysconf_map_entry (_SC_INT_MIN), #endif #if defined (_SC_IOV_MAX) mk_sysconf_map_entry (_SC_IOV_MAX), #endif #if defined (_SC_IPV6) mk_sysconf_map_entry (_SC_IPV6), #endif #if defined (_SC_JOB_CONTROL) mk_sysconf_map_entry (_SC_JOB_CONTROL), #endif #if defined (_SC_LEVEL1_DCACHE_ASSOC) mk_sysconf_map_entry (_SC_LEVEL1_DCACHE_ASSOC), #endif #if defined (_SC_LEVEL1_DCACHE_LINESIZE) mk_sysconf_map_entry (_SC_LEVEL1_DCACHE_LINESIZE), #endif #if defined (_SC_LEVEL1_DCACHE_SIZE) mk_sysconf_map_entry (_SC_LEVEL1_DCACHE_SIZE), #endif #if defined (_SC_LEVEL1_ICACHE_ASSOC) mk_sysconf_map_entry (_SC_LEVEL1_ICACHE_ASSOC), #endif #if defined (_SC_LEVEL1_ICACHE_LINESIZE) mk_sysconf_map_entry (_SC_LEVEL1_ICACHE_LINESIZE), #endif #if defined (_SC_LEVEL1_ICACHE_SIZE) mk_sysconf_map_entry (_SC_LEVEL1_ICACHE_SIZE), #endif #if defined (_SC_LEVEL2_CACHE_ASSOC) mk_sysconf_map_entry (_SC_LEVEL2_CACHE_ASSOC), #endif #if defined (_SC_LEVEL2_CACHE_LINESIZE) mk_sysconf_map_entry (_SC_LEVEL2_CACHE_LINESIZE), #endif #if defined (_SC_LEVEL2_CACHE_SIZE) mk_sysconf_map_entry (_SC_LEVEL2_CACHE_SIZE), #endif #if defined (_SC_LEVEL3_CACHE_ASSOC) mk_sysconf_map_entry (_SC_LEVEL3_CACHE_ASSOC), #endif #if defined (_SC_LEVEL3_CACHE_LINESIZE) mk_sysconf_map_entry (_SC_LEVEL3_CACHE_LINESIZE), #endif #if defined (_SC_LEVEL3_CACHE_SIZE) mk_sysconf_map_entry (_SC_LEVEL3_CACHE_SIZE), #endif #if defined (_SC_LEVEL4_CACHE_ASSOC) mk_sysconf_map_entry (_SC_LEVEL4_CACHE_ASSOC), #endif #if defined (_SC_LEVEL4_CACHE_LINESIZE) mk_sysconf_map_entry (_SC_LEVEL4_CACHE_LINESIZE), #endif #if defined (_SC_LEVEL4_CACHE_SIZE) mk_sysconf_map_entry (_SC_LEVEL4_CACHE_SIZE), #endif #if defined (_SC_LINE_MAX) mk_sysconf_map_entry (_SC_LINE_MAX), #endif #if defined (_SC_LOGIN_NAME_MAX) mk_sysconf_map_entry (_SC_LOGIN_NAME_MAX), #endif #if defined (_SC_LONG_BIT) mk_sysconf_map_entry (_SC_LONG_BIT), #endif #if defined (_SC_MAPPED_FILES) mk_sysconf_map_entry (_SC_MAPPED_FILES), #endif #if defined (_SC_MB_LEN_MAX) mk_sysconf_map_entry (_SC_MB_LEN_MAX), #endif #if defined (_SC_MEMLOCK) mk_sysconf_map_entry (_SC_MEMLOCK), #endif #if defined (_SC_MEMLOCK_RANGE) mk_sysconf_map_entry (_SC_MEMLOCK_RANGE), #endif #if defined (_SC_MEMORY_PROTECTION) mk_sysconf_map_entry (_SC_MEMORY_PROTECTION), #endif #if defined (_SC_MESSAGE_PASSING) mk_sysconf_map_entry (_SC_MESSAGE_PASSING), #endif #if defined (_SC_MONOTONIC_CLOCK) mk_sysconf_map_entry (_SC_MONOTONIC_CLOCK), #endif #if defined (_SC_MQ_OPEN_MAX) mk_sysconf_map_entry (_SC_MQ_OPEN_MAX), #endif #if defined (_SC_MQ_PRIO_MAX) mk_sysconf_map_entry (_SC_MQ_PRIO_MAX), #endif #ifdef _SC_MULTI_PROCESS mk_sysconf_map_entry (_SC_MULTI_PROCESS), #endif #if defined (_SC_NETWORKING) mk_sysconf_map_entry (_SC_NETWORKING), #endif #if defined (_SC_NGROUPS_MAX) mk_sysconf_map_entry (_SC_NGROUPS_MAX), #endif #if defined (_SC_NL_ARGMAX) mk_sysconf_map_entry (_SC_NL_ARGMAX), #endif #if defined (_SC_NL_LANGMAX) mk_sysconf_map_entry (_SC_NL_LANGMAX), #endif #if defined (_SC_NL_MSGMAX) mk_sysconf_map_entry (_SC_NL_MSGMAX), #endif #if defined (_SC_NL_NMAX) mk_sysconf_map_entry (_SC_NL_NMAX), #endif #if defined (_SC_NL_SETMAX) mk_sysconf_map_entry (_SC_NL_SETMAX), #endif #if defined (_SC_NL_TEXTMAX) mk_sysconf_map_entry (_SC_NL_TEXTMAX), #endif #if defined (_SC_NPROCESSORS_CONF) mk_sysconf_map_entry (_SC_NPROCESSORS_CONF), #endif #if defined (_SC_NPROCESSORS_ONLN) mk_sysconf_map_entry (_SC_NPROCESSORS_ONLN), #endif #if defined (_SC_NZERO) mk_sysconf_map_entry (_SC_NZERO), #endif #if defined (_SC_OPEN_MAX) mk_sysconf_map_entry (_SC_OPEN_MAX), #endif #if defined (_SC_PAGESIZE) mk_sysconf_map_entry (_SC_PAGESIZE), #endif #if defined (_SC_PAGE_SIZE) mk_sysconf_map_entry (_SC_PAGE_SIZE), #endif #if defined (_SC_PASS_MAX) mk_sysconf_map_entry (_SC_PASS_MAX), #endif #if defined (_SC_PHYS_PAGES) mk_sysconf_map_entry (_SC_PHYS_PAGES), #endif #if defined (_SC_PII) mk_sysconf_map_entry (_SC_PII), #endif #if defined (_SC_PII_INTERNET) mk_sysconf_map_entry (_SC_PII_INTERNET), #endif #if defined (_SC_PII_INTERNET_DGRAM) mk_sysconf_map_entry (_SC_PII_INTERNET_DGRAM), #endif #if defined (_SC_PII_INTERNET_STREAM) mk_sysconf_map_entry (_SC_PII_INTERNET_STREAM), #endif #if defined (_SC_PII_OSI) mk_sysconf_map_entry (_SC_PII_OSI), #endif #if defined (_SC_PII_OSI_CLTS) mk_sysconf_map_entry (_SC_PII_OSI_CLTS), #endif #if defined (_SC_PII_OSI_COTS) mk_sysconf_map_entry (_SC_PII_OSI_COTS), #endif #if defined (_SC_PII_OSI_M) mk_sysconf_map_entry (_SC_PII_OSI_M), #endif #if defined (_SC_PII_SOCKET) mk_sysconf_map_entry (_SC_PII_SOCKET), #endif #if defined (_SC_PII_XTI) mk_sysconf_map_entry (_SC_PII_XTI), #endif #if defined (_SC_PIPE) mk_sysconf_map_entry (_SC_PIPE), #endif #if defined (_SC_POLL) mk_sysconf_map_entry (_SC_POLL), #endif #if defined (_SC_SINGLE_PROCESS) mk_sysconf_map_entry (_SC_SINGLE_PROCESS), #endif #if defined (_SC_SYSTEM_DATABASE) mk_sysconf_map_entry (_SC_SYSTEM_DATABASE), #endif #if defined (_SC_SYSTEM_DATABASE_R) mk_sysconf_map_entry (_SC_SYSTEM_DATABASE_R), #endif #if defined (_SC_THREAD_KEYS_MAX) mk_sysconf_map_entry (_SC_THREAD_KEYS_MAX), #endif #if defined (_SC_THREAD_DESTRUCTOR_ITERATIONS) mk_sysconf_map_entry (_SC_THREAD_DESTRUCTOR_ITERATIONS), #endif #if defined (_SC_THREAD_THREADS_MAX) mk_sysconf_map_entry (_SC_THREAD_THREADS_MAX), #endif #if defined (_SC_STREAM_MAX) mk_sysconf_map_entry (_SC_STREAM_MAX), #endif #if defined (_SC_SYMLOOP_MAX) mk_sysconf_map_entry (_SC_SYMLOOP_MAX), #endif #if defined (_SC_TTY_NAME_MAX) mk_sysconf_map_entry (_SC_TTY_NAME_MAX), #endif #if defined (_SC_TZNAME_MAX) mk_sysconf_map_entry (_SC_TZNAME_MAX), #endif #if defined (_SC_TYPED_MEMORY_OBJECTS) mk_sysconf_map_entry (_SC_TYPED_MEMORY_OBJECTS), #endif #if defined (_SC_USER_GROUPS) mk_sysconf_map_entry (_SC_USER_GROUPS), #endif #if defined (_SC_USER_GROUPS_R) mk_sysconf_map_entry (_SC_USER_GROUPS_R), #endif #if defined (_SC_VERSION) mk_sysconf_map_entry (_SC_VERSION), #endif #if defined (_SC_POSIX2_C_DEV) mk_sysconf_map_entry (_SC_POSIX2_C_DEV), #endif #if defined (_SC_SIGQUEUE_MAX) mk_sysconf_map_entry (_SC_SIGQUEUE_MAX), #endif #if defined (_SC_T_IOV_MAX) mk_sysconf_map_entry (_SC_T_IOV_MAX), #endif #if defined (_SC_THREAD_STACK_MIN) mk_sysconf_map_entry (_SC_THREAD_STACK_MIN), #endif #if defined (_SC_SSIZE_MAX) mk_sysconf_map_entry (_SC_SSIZE_MAX), #endif #if defined (_SC_TIMER_MAX) mk_sysconf_map_entry (_SC_TIMER_MAX), #endif #if defined (_SC_UCHAR_MAX) mk_sysconf_map_entry (_SC_UCHAR_MAX), #endif #if defined (_SC_UINT_MAX) mk_sysconf_map_entry (_SC_UINT_MAX), #endif #if defined (_SC_UIO_MAXIOV) mk_sysconf_map_entry (_SC_UIO_MAXIOV), #endif #if defined (_SC_ULONG_MAX) mk_sysconf_map_entry (_SC_ULONG_MAX), #endif #if defined (_SC_USHRT_MAX) mk_sysconf_map_entry (_SC_USHRT_MAX), #endif #if defined (_SC_V6_LPBIG_OFFBIG) mk_sysconf_map_entry (_SC_V6_LPBIG_OFFBIG), #endif #if defined (_SC_WORD_BIT) mk_sysconf_map_entry (_SC_WORD_BIT), #endif #if defined (_SC_EXPR_NEST_MAX) mk_sysconf_map_entry (_SC_EXPR_NEST_MAX), #endif #if defined (_SC_V6_ILP32_OFF32) mk_sysconf_map_entry (_SC_V6_ILP32_OFF32), #endif #if defined (_SC_V6_ILP32_OFFBIG) mk_sysconf_map_entry (_SC_V6_ILP32_OFFBIG), #endif #if defined (_SC_V6_LP64_OFF64) mk_sysconf_map_entry (_SC_V6_LP64_OFF64), #endif #if defined (_SC_V7_ILP32_OFF32) mk_sysconf_map_entry (_SC_V7_ILP32_OFF32), #endif #if defined (_SC_V7_ILP32_OFFBIG) mk_sysconf_map_entry (_SC_V7_ILP32_OFFBIG), #endif #if defined (_SC_V7_LPBIG_OFFBIG) mk_sysconf_map_entry (_SC_V7_LPBIG_OFFBIG), #endif #if defined (_SC_V7_LP64_OFF64) mk_sysconf_map_entry (_SC_V7_LP64_OFF64), #endif #if defined (_SC_PRIORITIZED_IO) mk_sysconf_map_entry (_SC_PRIORITIZED_IO), #endif #if defined (_SC_PRIORITY_SCHEDULING) mk_sysconf_map_entry (_SC_PRIORITY_SCHEDULING), #endif #if defined (_SC_RAW_SOCKETS) mk_sysconf_map_entry (_SC_RAW_SOCKETS), #endif #if defined (_SC_READER_WRITER_LOCKS) mk_sysconf_map_entry (_SC_READER_WRITER_LOCKS), #endif #if defined (_SC_REALTIME_SIGNALS) mk_sysconf_map_entry (_SC_REALTIME_SIGNALS), #endif #if defined (_SC_RE_DUP_MAX) mk_sysconf_map_entry (_SC_RE_DUP_MAX), #endif #if defined (_SC_REGEXP) mk_sysconf_map_entry (_SC_REGEXP), #endif #if defined (_SC_REGEX_VERSION) mk_sysconf_map_entry (_SC_REGEX_VERSION), #endif #if defined (_SC_RTSIG_MAX) mk_sysconf_map_entry (_SC_RTSIG_MAX), #endif #if defined (_SC_SAVED_IDS) mk_sysconf_map_entry (_SC_SAVED_IDS), #endif #if defined (_SC_SCHAR_MAX) mk_sysconf_map_entry (_SC_SCHAR_MAX), #endif #if defined (_SC_SCHAR_MIN) mk_sysconf_map_entry (_SC_SCHAR_MIN), #endif #if defined (_SC_SELECT) mk_sysconf_map_entry (_SC_SELECT), #endif #if defined (_SC_SEMAPHORES) mk_sysconf_map_entry (_SC_SEMAPHORES), #endif #if defined (_SC_SEM_NSEMS_MAX) mk_sysconf_map_entry (_SC_SEM_NSEMS_MAX), #endif #if defined (_SC_SEM_VALUE_MAX) mk_sysconf_map_entry (_SC_SEM_VALUE_MAX), #endif #if defined (_SC_SHARED_MEMORY_OBJECTS) mk_sysconf_map_entry (_SC_SHARED_MEMORY_OBJECTS), #endif #if defined (_SC_SHELL) mk_sysconf_map_entry (_SC_SHELL), #endif #if defined (_SC_SHRT_MAX) mk_sysconf_map_entry (_SC_SHRT_MAX), #endif #if defined (_SC_SHRT_MIN) mk_sysconf_map_entry (_SC_SHRT_MIN), #endif #if defined (_SC_SIGNALS) mk_sysconf_map_entry (_SC_SIGNALS), #endif #if defined (_SC_SPAWN) mk_sysconf_map_entry (_SC_SPAWN), #endif #if defined (_SC_SPIN_LOCKS) mk_sysconf_map_entry (_SC_SPIN_LOCKS), #endif #if defined (_SC_SPORADIC_SERVER) mk_sysconf_map_entry (_SC_SPORADIC_SERVER), #endif #if defined (_SC_SYNCHRONIZED_IO) mk_sysconf_map_entry (_SC_SYNCHRONIZED_IO), #endif #if defined (_SC_THREAD_ATTR_STACKADDR) mk_sysconf_map_entry (_SC_THREAD_ATTR_STACKADDR), #endif #if defined (_SC_THREAD_ATTR_STACKSIZE) mk_sysconf_map_entry (_SC_THREAD_ATTR_STACKSIZE), #endif #if defined (_SC_THREAD_CPUTIME) mk_sysconf_map_entry (_SC_THREAD_CPUTIME), #endif #if defined (_SC_THREAD_PRIO_INHERIT) mk_sysconf_map_entry (_SC_THREAD_PRIO_INHERIT), #endif #if defined (_SC_THREAD_PRIO_PROTECT) mk_sysconf_map_entry (_SC_THREAD_PRIO_PROTECT), #endif #if defined (_SC_THREAD_PRIORITY_SCHEDULING) mk_sysconf_map_entry (_SC_THREAD_PRIORITY_SCHEDULING), #endif #if defined (_SC_THREAD_PROCESS_SHARED) mk_sysconf_map_entry (_SC_THREAD_PROCESS_SHARED), #endif #if defined (_SC_THREAD_ROBUST_PRIO_INHERIT) mk_sysconf_map_entry (_SC_THREAD_ROBUST_PRIO_INHERIT), #endif #if defined (_SC_THREAD_ROBUST_PRIO_PROTECT) mk_sysconf_map_entry (_SC_THREAD_ROBUST_PRIO_PROTECT), #endif #if defined (_SC_THREAD_SAFE_FUNCTIONS) mk_sysconf_map_entry (_SC_THREAD_SAFE_FUNCTIONS), #endif #if defined (_SC_THREAD_SPORADIC_SERVER) mk_sysconf_map_entry (_SC_THREAD_SPORADIC_SERVER), #endif #if defined (_SC_THREADS) mk_sysconf_map_entry (_SC_THREADS), #endif #if defined (_SC_TIMEOUTS) mk_sysconf_map_entry (_SC_TIMEOUTS), #endif #if defined (_SC_TIMERS) mk_sysconf_map_entry (_SC_TIMERS), #endif #if defined (_SC_TRACE) mk_sysconf_map_entry (_SC_TRACE), #endif #if defined (_SC_TRACE_EVENT_FILTER) mk_sysconf_map_entry (_SC_TRACE_EVENT_FILTER), #endif #if defined (_SC_TRACE_INHERIT) mk_sysconf_map_entry (_SC_TRACE_INHERIT), #endif #if defined (_SC_TRACE_LOG) mk_sysconf_map_entry (_SC_TRACE_LOG), #endif #if defined (_SC_TYPED_MEMORY_OBJECT) mk_sysconf_map_entry (_SC_TYPED_MEMORY_OBJECT), #endif #if defined (_SC_XBS5_ILP32_OFF32) mk_sysconf_map_entry (_SC_XBS5_ILP32_OFF32), #endif #if defined (_SC_XBS5_ILP32_OFFBIG) mk_sysconf_map_entry (_SC_XBS5_ILP32_OFFBIG), #endif #if defined (_SC_XBS5_LP64_OFF64) mk_sysconf_map_entry (_SC_XBS5_LP64_OFF64), #endif #if defined (_SC_XBS5_LPBIG_OFFBIG) mk_sysconf_map_entry (_SC_XBS5_LPBIG_OFFBIG), #endif #if defined (_SC_XOPEN_CRYPT) mk_sysconf_map_entry (_SC_XOPEN_CRYPT), #endif #if defined (_SC_XOPEN_ENH_I18N) mk_sysconf_map_entry (_SC_XOPEN_ENH_I18N), #endif #if defined (_SC_XOPEN_LEGACY) mk_sysconf_map_entry (_SC_XOPEN_LEGACY), #endif #if defined (_SC_XOPEN_REALTIME) mk_sysconf_map_entry (_SC_XOPEN_REALTIME), #endif #if defined (_SC_XOPEN_REALTIME_THREADS) mk_sysconf_map_entry (_SC_XOPEN_REALTIME_THREADS), #endif #if defined (_SC_XOPEN_SHM) mk_sysconf_map_entry (_SC_XOPEN_SHM), #endif #if defined (_SC_XOPEN_UNIX) mk_sysconf_map_entry (_SC_XOPEN_UNIX), #endif #if defined (_SC_XOPEN_XPG2) mk_sysconf_map_entry (_SC_XOPEN_XPG2), #endif #if defined (_SC_XOPEN_XPG3) mk_sysconf_map_entry (_SC_XOPEN_XPG3), #endif #if defined (_SC_XOPEN_XPG4) mk_sysconf_map_entry (_SC_XOPEN_XPG4), #endif #if defined (_SC_XOPEN_VERSION) mk_sysconf_map_entry (_SC_XOPEN_VERSION), #endif #if defined (_SC_XOPEN_XCU_VERSION) mk_sysconf_map_entry (_SC_XOPEN_XCU_VERSION), #endif { 0, NULL } }; /* Signal numbers are different per architecture. * * This lookup table allows use to ignore the numbers and display nice * symbolic names and also to order by signal number (which values * change on different architectures). */ struct procenv_map signal_map[] = { mk_map_entry (SIGABRT), mk_map_entry (SIGALRM), mk_map_entry (SIGBUS), { SIGCHLD, "SIGCHLD|SIGCLD" }, mk_map_entry (SIGCONT), mk_map_entry (SIGFPE), mk_map_entry (SIGHUP), mk_map_entry (SIGILL), mk_map_entry (SIGINT), mk_map_entry (SIGKILL), mk_map_entry (SIGPIPE), mk_map_entry (SIGQUIT), mk_map_entry (SIGSEGV), mk_map_entry (SIGSTOP), mk_map_entry (SIGTERM), mk_map_entry (SIGTRAP), mk_map_entry (SIGTSTP), mk_map_entry (SIGTTIN), mk_map_entry (SIGTTOU), mk_map_entry (SIGUSR1), mk_map_entry (SIGUSR2), mk_map_entry (SIGIO), #if defined (PROCENV_LINUX) mk_map_entry (SIGIOT), #endif #if defined (PROCENV_LINUX) {SIGPOLL, "SIGPOLL|SIGIO" }, #endif mk_map_entry (SIGPROF), #if defined (PROCENV_LINUX) mk_map_entry (SIGPWR), #ifdef SIGSTKFLT mk_map_entry (SIGSTKFLT), #endif #endif mk_map_entry (SIGSYS), #if defined (PROCENV_LINUX) #ifdef SIGUNUSED mk_map_entry (SIGUNUSED), #endif #endif mk_map_entry (SIGURG), mk_map_entry (SIGVTALRM), mk_map_entry (SIGWINCH), mk_map_entry (SIGXCPU), mk_map_entry (SIGXFSZ), #if defined (PROCENV_BSD) || defined (PROCENV_HURD) mk_map_entry (SIGEMT), mk_map_entry (SIGINFO), #endif #if defined (PROCENV_HURD) mk_map_entry (SIGLOST), #endif { 0, NULL }, }; struct procenv_map locale_map[] = { /* The non-conditional ones are POSIX. */ #ifdef LC_ADDRESS mk_map_entry (LC_ADDRESS), #endif mk_map_entry (LC_COLLATE), mk_map_entry (LC_CTYPE), #ifdef LC_IDENTIFICATION mk_map_entry (LC_IDENTIFICATION), #endif #ifdef LC_MEASUREMENT mk_map_entry (LC_MEASUREMENT), #endif mk_map_entry (LC_MESSAGES), mk_map_entry (LC_MONETARY), #ifdef LC_NAME mk_map_entry (LC_NAME), #endif mk_map_entry (LC_NUMERIC), #ifdef LC_PAPER mk_map_entry (LC_PAPER), #endif #ifdef LC_TELEPHONE mk_map_entry (LC_TELEPHONE), #endif mk_map_entry (LC_TIME), { 0, NULL } }; struct procenv_map scheduler_map[] = { mk_map_entry (SCHED_OTHER), mk_map_entry (SCHED_FIFO), mk_map_entry (SCHED_RR), #if defined (PROCENV_LINUX) && ! defined (PROCENV_ANDROID) mk_map_entry (SCHED_BATCH), #ifdef SCHED_IDLE mk_map_entry (SCHED_IDLE), #endif #endif { 0, NULL } }; struct procenv_map thread_sched_policy_map[] = { mk_map_entry (SCHED_OTHER), mk_map_entry (SCHED_FIFO), mk_map_entry (SCHED_RR) }; #if defined (PROCENV_LINUX) && defined (HAVE_NUMA_H) struct procenv_map numa_mempolicy_map[] = { mk_map_entry (MPOL_DEFAULT), mk_map_entry (MPOL_PREFERRED), mk_map_entry (MPOL_BIND), mk_map_entry (MPOL_INTERLEAVE), }; #endif void usage (void) { show ("Usage: %s [option]", PACKAGE_STRING); show (""); show ("Description: Display process environment."); show (""); show ("Options:"); show (""); show (" -a, --meta : Display meta details."); show (" -A, --arguments : Display program arguments."); show (" -b, --libs : Display details of linked libraries."); show (" -B, --libc : Display standard library details."); show (" -c, --cgroups : Display cgroup details (Linux only)."); show (" -C, --cpu : Display CPU and scheduler details."); show (" --crumb-separator= : Specify string '' as alternate delimiter"); show (" for crumb format output (default='%s').", PROCENV_DEFAULT_CRUMB_SEPARATOR); show (" -d, --compiler : Display compiler details."); show (" -e, --environment : Display environment variables."); show (" -E, --semaphores : Display semaphore details."); show (" --exec : Treat non-option arguments as program to execute."); show (" -f, --fds : Display file descriptor details."); show (" -F, --namespaces : Display namespace details."); show (" --file= : Send output to (implies --output=file)."); show (" --format= : Specify output format. can be one of:"); show (""); show (" crumb : ASCII 'breadcrumbs'"); show (" json : JSON output."); show (" text : ASCII output (default)."); show (" xml : XML output."); show (""); show (" -g, --sizeof : Display sizes of data types in bytes."); show (" -h, --help : This help text."); show (" -i, --misc : Display miscellaneous details."); show (" --indent : Number of indent characters to use for each indent"); show (" (default=%d).", DEFAULT_INDENT_AMOUNT); show (" --indent-char= : Use character '' for indenting"); show (" (default='%s').", DEFAULT_INDENT_CHAR); show (" -j, --uname : Display uname details."); show (" -k, --clocks : Display clock details."); show (" -l, --limits : Display limits."); show (" -L, --locale : Display locale details."); show (" -m, --mounts : Display mount details."); show (" -M, --message-queues : Display message queue details."); show (" -n, --confstr : Display confstr details."); show (" -N, --network : Display network details."); show (" -o, --oom : Display out-of-memory manager details (Linux only)"); show (" --output= : Send output to alternative location."); show (" can be one of:"); show (""); show (" file : Send output to a file."); show (" stderr : Write to standard error."); show (" stdout : Write to standard output (default)."); show (" syslog : Write to the system log file."); show (" terminal : Write to terminal."); show (""); show (" -p, --process : Display process details."); show (" -P, --platform : Display platform details."); show (" -q, --time : Display time details."); show (" -r, --ranges : Display range of data types."); show (" --separator= : Specify string '' as alternate delimiter"); show (" for text format output (default='%s').", PROCENV_DEFAULT_TEXT_SEPARATOR); show (" -s, --signals : Display signal details."); show (" -S, --shared-memory : Display shared memory details."); show (" -t, --tty : Display terminal details."); show (" -T, --threads : Display thread details."); show (" -u, --stat : Display stat details."); show (" -U, --rusage : Display rusage details."); show (" -v, --version : Display version details."); show (" -w, --capabilities : Display capability details (Linux only)."); show (" -x, --pathconf : Display pathconf details."); show (" -y, --sysconf : Display sysconf details."); show (" -Y, --memory : Display memory details."); show (" -z, --timezone : Display timezone details."); show (""); show ("Notes:"); show (""); show (" - Options are considered in order, so '--output' should"); show (" precede any other option."); show (" - If no display option is specified, all details are displayed."); show (" - Only one display option may be specified."); show (" - All values for '--indent-char' are literal except '\\t' which can be"); show (" used to specify a tab character. The same is true for '--separator'"); show (" and '--crumb-separator' but only if it is the first character specified."); show (" - Specifying a visible indent-char is only (vaguely) meaningful"); show (" for text output."); show (" - Any long option name may be shortened as long as it remains unique."); show (" - The 'crumb' output format is designed for easy parsing: it displays"); show (" the data in a flattened format with each value on a separate line"); show (" preceded by all appropriate headings which are separated by the"); show (" current separator."); show (""); } void show_pathconfs (ShowMountType what, const char *dir) { assert (dir); if (what == SHOW_PATHCONF) { header (dir); } else { header ("pathconf"); } #if defined (_PC_ALLOC_SIZE_MIN) show_pathconf (what, dir, _PC_ALLOC_SIZE_MIN); #endif #if defined (_PC_ASYNC_IO) show_pathconf (what, dir, _PC_ASYNC_IO); #endif #if defined (_PC_CHOWN_RESTRICTED) show_pathconf (what, dir, _PC_CHOWN_RESTRICTED); #endif #if defined (_PC_FILESIZEBITS) show_pathconf (what, dir, _PC_FILESIZEBITS); #endif #if defined (_PC_LINK_MAX) show_pathconf (what, dir, _PC_LINK_MAX); #endif #if defined (_PC_MAX_CANON) show_pathconf (what, dir, _PC_MAX_CANON); #endif #if defined (_PC_MAX_INPUT) show_pathconf (what, dir, _PC_MAX_INPUT); #endif #if defined (_PC_NAME_MAX) show_pathconf (what, dir, _PC_NAME_MAX); #endif #if defined (_PC_NO_TRUNC) show_pathconf (what, dir, _PC_NO_TRUNC); #endif #if defined (_PC_PATH_MAX) show_pathconf (what, dir, _PC_PATH_MAX); #endif #if defined (_PC_PIPE_BUF) show_pathconf (what, dir, _PC_PIPE_BUF); #endif #if defined (_PC_PRIO_IO) show_pathconf (what, dir, _PC_PRIO_IO); #endif #if defined (_PC_REC_INCR_XFER_SIZE) show_pathconf (what, dir, _PC_REC_INCR_XFER_SIZE); #endif #if defined (_PC_REC_MAX_XFER_SIZE) show_pathconf (what, dir, _PC_REC_MAX_XFER_SIZE); #endif #if defined (_PC_REC_MIN_XFER_SIZE) show_pathconf (what, dir, _PC_REC_MIN_XFER_SIZE); #endif #if defined (_PC_REC_XFER_ALIGN) show_pathconf (what, dir, _PC_REC_XFER_ALIGN); #endif #if defined (_PC_SOCK_MAXBUF) show_pathconf (what, dir, _PC_SOCK_MAXBUF); #endif #if defined (_PC_SYMLINK_MAX) show_pathconf (what, dir, _PC_SYMLINK_MAX); #endif #if defined (_PC_2_SYMLINKS) show_pathconf (what, dir, _PC_2_SYMLINKS); #endif #if defined (_PC_SYNC_IO) show_pathconf (what, dir, _PC_SYNC_IO); #endif #if defined (_PC_VDISABLE) show_pathconf (what, dir, _PC_VDISABLE); #endif footer (); } const char * get_speed (speed_t speed) { struct baud_speed *s; for (s = baud_speeds; s && s->name; s++) { if (speed == s->speed) return s->name; } return NULL; } /** * _show: * * @prefix: string prefix to write, * @indent: number of spaces to indent output to, * @fmt: printf-style format with associated arguments that comprises * the value part. * * Write output to @string, indented by @indent spaces. A trailing newline * will be added. * * Note that error scenarios cannot call die() as by definition output * may not be possible. **/ void _show (const char *prefix, int indent, const char *fmt, ...) { va_list ap; char *buffer = NULL; assert (fmt); if (indent) appendf (&buffer, "%*s", indent, indent_char); if (prefix && *prefix) appendf (&buffer, "%s: ", prefix); va_start (ap, fmt); appendva (&buffer, fmt, ap); va_end (ap); append (&buffer, "\n"); _show_output (buffer); free (buffer); } /** * entry: * * @name: name of thing to display, * @fmt: printf-style format with associated arguments that comprises * the value part. * * Add name/value pair represented by @name and value comprising * printf-format string to the @doc global. The value added will be * indented appropriately. **/ void entry (const char *name, const char *fmt, ...) { va_list ap; pstring *encoded_name = NULL; pstring *encoded_value = NULL; assert (name); assert (fmt); common_assert (); change_element (ELEMENT_TYPE_ENTRY); encoded_name = char_to_pstring (name); if (! encoded_name) die ("failed to encode name"); /* annoyingly, we must encode here; we cannot simply call * encode_string() once just prior to showing the output * document since if the output format is XML, we'd end * up encoding the XML tags themselves, not just the values * within! */ if (encode_string (&encoded_name) < 0) die ("failed to encode name"); /* expand format */ va_start (ap, fmt); wmappendva (&encoded_value, fmt, ap); va_end (ap); if (encode_string (&encoded_value) < 0) die ("failed to encode value"); switch (output_format) { case OUTPUT_FORMAT_CRUMB: assert (crumb_list); /* Add the bread crumbs */ PR_LIST_FOREACH (crumb_list, iter) { char *crumb = (char *)iter->data; wappendf (&doc, L"%s%s", crumb, crumb_separator); } wappendf (&doc, L"%ls%s%ls\n", encoded_name->buf, text_separator, encoded_value->buf); break; case OUTPUT_FORMAT_TEXT: wappendf (&doc, L"%ls%s%ls", encoded_name->buf, text_separator, encoded_value->buf); break; case OUTPUT_FORMAT_JSON: wappendf (&doc, L"\"%ls\" : \"%ls\"", encoded_name->buf, encoded_value->buf); break; case OUTPUT_FORMAT_XML: wappendf (&doc, L"%ls", encoded_name->buf, encoded_value->buf); break; default: assert_not_reached (); break; } pstring_free (encoded_name); pstring_free (encoded_value); } /** * _show_output: * * @string: String to display. * * Write output @string to appropriate location based on Output * destination. **/ void _show_output_pstring (const pstring *pstr) { char *str; assert (pstr); str = pstring_to_char (pstr); _show_output (str); free (str); } void _show_output (const char *str) { int ret; assert (str); switch (output) { case OUTPUT_SYSLOG: syslog (LOG_INFO, "%s", str); ret = 0; break; case OUTPUT_STDOUT: ret = fputs (str, stdout); break; case OUTPUT_STDERR: ret = fputs (str, stderr); break; case OUTPUT_TERM: assert (user.tty_fd != -1); ret = write (user.tty_fd, str, strlen (str)); if (ret < 0) { fprintf (stderr, "ERROR: failed to write to terminal\n"); exit (EXIT_FAILURE); } break; case OUTPUT_FILE: assert (output_file); if (output_fd < 0) { output_fd = open (output_file, (O_WRONLY|O_CREAT), (S_IRWXU|S_IRGRP|S_IROTH)); if (output_fd < 0) { fprintf (stderr, "ERROR: failed to open file '%s'\n", output_file); exit (EXIT_FAILURE); } } ret = write (output_fd, str, strlen (str)); if (ret < 0) { fprintf (stderr, "ERROR: failed to write to file '%s'\n", output_file); exit (EXIT_FAILURE); } break; default: fprintf (stderr, "ERROR: invalid output type: %d\n", output); exit (EXIT_FAILURE); break; } if (ret < 0) { fprintf (stderr, "ERROR: failed to output message\n"); exit (EXIT_FAILURE); } } /** * inc_indent: * * Increase indent. **/ void inc_indent (void) { assert (indent >= 0); indent += indent_amount; } /** * dec_indent: * * Decrease indent. **/ void dec_indent (void) { assert (indent >= 0); indent -= indent_amount; assert (indent >= 0); } /** * add_indent: * * Insert the current indent to the output document. **/ void add_indent (pstring **doc) { common_assert (); if (! indent) return; if (! strcmp (indent_char, DEFAULT_INDENT_CHAR)) { wappendf (doc, L"%*s", indent, indent_char); } else { pstring *buffer = NULL; // Expand the buffer to the appropriate // length by filling it with spaces and a random // character. wappendf (&buffer, L"%*lc", indent, wide_indent_char); /* Now, replace the spaces and the random character with * the chosen character. This convoluted approach is * necessary as printf-type functions don't allow the * padding character to be specified. */ wmemset (buffer->buf, wide_indent_char, wcslen (buffer->buf)); pappend (doc, buffer); pstring_free (buffer); } } /** * master_header: * * @doc: document to write footer to. * * Main header which is displayed once. **/ void master_header (pstring **doc) { common_assert (); switch (output_format) { case OUTPUT_FORMAT_CRUMB: /* FALL */ case OUTPUT_FORMAT_TEXT: /* NOP */ break; case OUTPUT_FORMAT_JSON: object_open (FALSE); break; case OUTPUT_FORMAT_XML: wappend (doc, L"\n"); wappendf (doc, L"<%s version=\"%s\" package_string=\"%s\" " "mode=\"%s%s\" format_version=\"%d\">\n", PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_STRING, user.euid ? _(NON_STR) "-" : "", PRIVILEGED_STR, PROCENV_FORMAT_VERSION); inc_indent (); break; default: assert_not_reached (); break; } } /** * master_footer: * * @doc: document to write footer to. * * Main footer which is displayed once. **/ void master_footer (pstring **doc) { common_assert (); switch (output_format) { case OUTPUT_FORMAT_CRUMB: /* FALL */ case OUTPUT_FORMAT_TEXT: /* Tweak */ wappend (doc, L"\n"); break; case OUTPUT_FORMAT_JSON: object_close (FALSE); /* Tweak */ wappend (doc, L"\n"); break; case OUTPUT_FORMAT_XML: /* Tweak */ wappend (doc, L"\n"); dec_indent (); wappendf (doc, L"\n", PACKAGE_NAME); break; default: assert_not_reached (); break; } } /** * object_open: * * @retain: if TRUE, do not disrupt the current element such that the * opening of the object will be invisible to the state machine, but * will still produce the required output. * * Note: @retain is only meaningful for OUTPUT_FORMAT_JSON. * * Handle opening an object. **/ void object_open (int retain) { common_assert (); if (output_format == OUTPUT_FORMAT_JSON) { if (retain) { format_element (); } else { change_element (ELEMENT_TYPE_OBJECT_OPEN); } } else { /* Objects are only required for handling JSON. In * fact, they cause problems for other output formats * that do not have visible "objects" in that they cause * the state table to lose track of the previous element * since it is actually the previous-previous element * (as the pointless object is the previous element). * * As such, ignore them. */ } switch (output_format) { case OUTPUT_FORMAT_CRUMB: /* FALL */ case OUTPUT_FORMAT_TEXT: /* NOP */ break; case OUTPUT_FORMAT_JSON: wappend (&doc, L"{"); break; case OUTPUT_FORMAT_XML: /* NOP */ break; default: assert_not_reached (); break; } } /** * object_close: * * @retain: if TRUE, do not disrupt the current element such that the * object closure will be invisible to the state machine, but will still * produce @retain: if TRUE, do not disrupt the current element. * * Note: @retain is only meaningful for OUTPUT_FORMAT_JSON. * * Handle closing an object. **/ void object_close (int retain) { common_assert (); if (output_format == OUTPUT_FORMAT_JSON) { if (retain) { format_element (); } else { change_element (ELEMENT_TYPE_OBJECT_CLOSE); } } else { /* Objects are only required for handling JSON. In * fact, they cause problems for other output formats * that do not have visible "objects" in that they cause * the state table to lose track of the previous element * since it is actually the previous-previous element * (as the pointless object is the previous element). * * As such, ignore them. */ } switch (output_format) { case OUTPUT_FORMAT_CRUMB: /* FALL */ case OUTPUT_FORMAT_TEXT: /* NOP */ break; case OUTPUT_FORMAT_JSON: wappend (&doc, L"}"); break; case OUTPUT_FORMAT_XML: /* NOP */ break; default: assert_not_reached (); break; } } /** * section_open: * * @name: name of section. * * Start a new section which will contain >0 entry() calls. **/ void section_open (const char *name) { assert (name); common_assert (); change_element (ELEMENT_TYPE_SECTION_OPEN); switch (output_format) { case OUTPUT_FORMAT_TEXT: wappendf (&doc, L"%s:", name); break; case OUTPUT_FORMAT_CRUMB: add_breadcrumb (name); break; case OUTPUT_FORMAT_JSON: wappendf (&doc, L"\"%s\" : {", name); break; case OUTPUT_FORMAT_XML: wappendf (&doc, L"
", name); break; default: assert_not_reached (); break; } } void section_close (void) { common_assert (); change_element (ELEMENT_TYPE_SECTION_CLOSE); switch (output_format) { case OUTPUT_FORMAT_TEXT: /* NOP */ break; case OUTPUT_FORMAT_CRUMB: remove_breadcrumb (); break; case OUTPUT_FORMAT_JSON: wappend (&doc, L"}"); break; case OUTPUT_FORMAT_XML: wappend (&doc, L"
"); break; default: assert_not_reached (); break; } } /** * container_open: * * @name: name of container. * * Start a new container which will contain >0 entry() calls. * * This is primarily to handle JSON arrays. **/ void container_open (const char *name) { assert (name); common_assert (); change_element (ELEMENT_TYPE_CONTAINER_OPEN); switch (output_format) { case OUTPUT_FORMAT_TEXT: wappendf (&doc, L"%s:", name); break; case OUTPUT_FORMAT_CRUMB: add_breadcrumb (name); break; case OUTPUT_FORMAT_JSON: wappendf (&doc, L"\"%s\" : [", name); break; case OUTPUT_FORMAT_XML: wappendf (&doc, L"", name); break; default: assert_not_reached (); break; } } /** * container_close: * * Finish with a container. **/ void container_close (void) { common_assert (); change_element (ELEMENT_TYPE_CONTAINER_CLOSE); switch (output_format) { case OUTPUT_FORMAT_TEXT: /* NOP */ break; case OUTPUT_FORMAT_CRUMB: remove_breadcrumb (); break; case OUTPUT_FORMAT_JSON: wappend (&doc, L"]"); break; case OUTPUT_FORMAT_XML: wappend (&doc, L""); break; default: assert_not_reached (); break; } } void header (const char *name) { assert (name); common_assert (); section_open (name); } void footer (void) { common_assert (); section_close (); } /** * fd_valid: * @fd: file descriptor. * * Return 1 if @fd is valid, else 0. **/ int fd_valid (int fd) { int flags = 0; if (fd < 0) return 0; errno = 0; flags = fcntl (fd, F_GETFL); if (flags < 0) return 0; /* redundant really */ if (errno == EBADF) return 0; return 1; } /** * show_signals: * * Display signal dispositions. * * Note that to traditionalists, it might _appear_ pointless to * display whether a signal is ignored, but on Linux that is not * necessarily so... * * Under "Classical Unix": * * - across a fork(), a child inherits the parents * signal mask *AND* dispositions. * * - across an exec*(3), a process inherits the original processes * signal mask *ONLY*. * * Under Linux: * * In additional to the classical semantics, by careful use of clone(2), * it is possible for a child to inherit its parents dispositions * (using clone's CLONE_SIGHAND+CLONE_VM flags). This is possible since * the child then shares the parents signal handlers, which inherantly * therefore provide access to the dispositions). **/ void show_signals (void) { int i; int rc; int blocked; int ignored; sigset_t old_sigset; struct sigaction act; container_open ("signals"); /* Query blocked signals. * * How should be 0, but valgrind complains. */ if (sigprocmask (SIG_BLOCK, NULL, &old_sigset) < 0) die ("failed to query signal mask"); for (i = 1; i <= NUM_SIGNALS; i++) { const char *signal_name; const char *signal_desc; blocked = 0; ignored = 0; rc = sigismember (&old_sigset, i); /* there is no signal with this value: there are gaps in * the list. */ if (sigaction (i, NULL, &act) < 0) continue; if (act.sa_handler == SIG_IGN) ignored = 1; if (rc < 0) continue; else if (rc) blocked = 1; signal_name = get_signal_name (i); if (! signal_name) continue; signal_desc = strsignal (i); object_open (FALSE); section_open (signal_name); entry ("number", "%d", i); entry ("description", "'%s'", signal_desc ? signal_desc : UNKNOWN_STR); entry ("blocked", "%s", blocked ? YES_STR : NO_STR); entry ("ignored", "%s", ignored ? YES_STR : NO_STR); section_close (); object_close (FALSE); } container_close (); } void show_rlimits (void) { header ("limits"); show_limit (RLIMIT_AS); show_limit (RLIMIT_CORE); show_limit (RLIMIT_CPU); show_limit (RLIMIT_DATA); show_limit (RLIMIT_FSIZE); #if defined (PROCENV_LINUX) if (LINUX_KERNEL_MMR (2, 6, 25)) { #if defined (RLIMIT_RTTIME) show_limit (RLIMIT_RTTIME); #endif } show_limit (RLIMIT_LOCKS); #endif show_limit (RLIMIT_MEMLOCK); #if defined (PROCENV_LINUX) if (LINUX_KERNEL_MMR (2, 6, 8)) { #if defined (RLIMIT_MSGQUEUE) show_limit (RLIMIT_MSGQUEUE); #endif } if (LINUX_KERNEL_MMR (2, 6, 12)) { #if defined RLIMIT_NICE show_limit (RLIMIT_NICE); #endif } #endif show_limit (RLIMIT_NOFILE); show_limit (RLIMIT_NPROC); show_limit (RLIMIT_RSS); #if defined (PROCENV_LINUX) show_limit (RLIMIT_RTPRIO); #endif #if defined (PROCENV_LINUX) if (LINUX_KERNEL_MMR (2, 6, 8)) { #if defined (RLIMIT_SIGPENDING) show_limit (RLIMIT_SIGPENDING); #endif } #endif show_limit (RLIMIT_STACK); footer (); } void show_rusage (void) { struct rusage usage; if (getrusage (RUSAGE_SELF, &usage) < 0) die ("unable to query rusage"); header ("rusage"); show_usage (usage, ru_maxrss); show_usage (usage, ru_ixrss); show_usage (usage, ru_idrss); show_usage (usage, ru_isrss); show_usage (usage, ru_minflt); show_usage (usage, ru_majflt); show_usage (usage, ru_nswap); show_usage (usage, ru_inblock); show_usage (usage, ru_oublock); show_usage (usage, ru_msgsnd); show_usage (usage, ru_msgrcv); show_usage (usage, ru_nsignals); show_usage (usage, ru_nvcsw); show_usage (usage, ru_nivcsw); footer (); } void show_sysconf (void) { struct procenv_map *p; long value; header ("sysconf"); for (p = sysconf_map; p && p->name; p++) { value = get_sysconf (p->num); if (value == -1) entry (p->name, "%s", NA_STR); else entry (p->name, "%ld", value); } footer (); } #ifndef PROCENV_ANDROID void show_confstrs (void) { header ("confstr"); #if defined (_CS_GNU_LIBC_VERSION) show_confstr (_CS_GNU_LIBC_VERSION); #endif #if defined (_CS_GNU_LIBPTHREAD_VERSION) show_confstr (_CS_GNU_LIBPTHREAD_VERSION); #endif #if defined (_CS_LFS64_CFLAGS) show_confstr (_CS_LFS64_CFLAGS); #endif #if defined (_CS_LFS64_LDFLAGS) show_confstr (_CS_LFS64_LDFLAGS); #endif #if defined (_CS_LFS64_LIBS) show_confstr (_CS_LFS64_LIBS); #endif #if defined (_CS_LFS64_LINTFLAGS) show_confstr (_CS_LFS64_LINTFLAGS); #endif #if defined (_CS_LFS_CFLAGS) show_confstr (_CS_LFS_CFLAGS); #endif #if defined (_CS_LFS_LDFLAGS) show_confstr (_CS_LFS_LDFLAGS); #endif #if defined (_CS_LFS_LIBS) show_confstr (_CS_LFS_LIBS); #endif #if defined (_CS_LFS_LINTFLAGS) show_confstr (_CS_LFS_LINTFLAGS); #endif #if defined (_CS_PATH) show_confstr (_CS_PATH); #endif #if defined (_CS_POSIX_V6_ILP32_OFF32) show_confstr (_CS_POSIX_V6_ILP32_OFF32); #endif #if defined (_CS_POSIX_V6_ILP32_OFF32_CFLAGS) show_confstr (_CS_POSIX_V6_ILP32_OFF32_CFLAGS); #endif #if defined (_CS_POSIX_V6_ILP32_OFF32_LDFLAGS) show_confstr (_CS_POSIX_V6_ILP32_OFF32_LDFLAGS); #endif #if defined (_CS_POSIX_V6_ILP32_OFF32_LIBS) show_confstr (_CS_POSIX_V6_ILP32_OFF32_LIBS); #endif #if defined (_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS) show_confstr (_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS); #endif #if defined (_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS) show_confstr (_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS); #endif #if defined (_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS) show_confstr (_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS); #endif #if defined (_CS_POSIX_V6_ILP32_OFFBIG_LIBS) show_confstr (_CS_POSIX_V6_ILP32_OFFBIG_LIBS); #endif #if defined (_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS) show_confstr (_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS); #endif #if defined (_CS_POSIX_V6_LP64_OFF64_CFLAGS) show_confstr (_CS_POSIX_V6_LP64_OFF64_CFLAGS); #endif #if defined (_CS_POSIX_V6_LP64_OFF64_LDFLAGS) show_confstr (_CS_POSIX_V6_LP64_OFF64_LDFLAGS); #endif #if defined (_CS_POSIX_V6_LP64_OFF64_LIBS) show_confstr (_CS_POSIX_V6_LP64_OFF64_LIBS); #endif #if defined (_CS_POSIX_V6_LP64_OFF64_LINTFLAGS) show_confstr (_CS_POSIX_V6_LP64_OFF64_LINTFLAGS); #endif #if defined (_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS) show_confstr (_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS); #endif #if defined (_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS) show_confstr (_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS); #endif #if defined (_CS_POSIX_V6_LPBIG_OFFBIG_LIBS) show_confstr (_CS_POSIX_V6_LPBIG_OFFBIG_LIBS); #endif #if defined (_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS) show_confstr (_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS); #endif #if defined (_CS_POSIX_V7_ILP32_OFF32_CFLAGS) show_confstr (_CS_POSIX_V7_ILP32_OFF32_CFLAGS); #endif #if defined (_CS_POSIX_V7_ILP32_OFF32_LDFLAGS) show_confstr (_CS_POSIX_V7_ILP32_OFF32_LDFLAGS); #endif #if defined (_CS_POSIX_V7_ILP32_OFF32_LIBS) show_confstr (_CS_POSIX_V7_ILP32_OFF32_LIBS); #endif #if defined (_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS) show_confstr (_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS); #endif #if defined (_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS) show_confstr (_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS); #endif #if defined (_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS) show_confstr (_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS); #endif #if defined (_CS_POSIX_V7_ILP32_OFFBIG_LIBS) show_confstr (_CS_POSIX_V7_ILP32_OFFBIG_LIBS); #endif #if defined (_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS) show_confstr (_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS); #endif #if defined (_CS_POSIX_V7_LP64_OFF64_CFLAGS) show_confstr (_CS_POSIX_V7_LP64_OFF64_CFLAGS); #endif #if defined (_CS_POSIX_V7_LP64_OFF64_LDFLAGS) show_confstr (_CS_POSIX_V7_LP64_OFF64_LDFLAGS); #endif #if defined (_CS_POSIX_V7_LP64_OFF64_LIBS) show_confstr (_CS_POSIX_V7_LP64_OFF64_LIBS); #endif #if defined (_CS_POSIX_V7_LP64_OFF64_LINTFLAGS) show_confstr (_CS_POSIX_V7_LP64_OFF64_LINTFLAGS); #endif #if defined (_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS) show_confstr (_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS); #endif #if defined (_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS) show_confstr (_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS); #endif #if defined (_CS_POSIX_V7_LPBIG_OFFBIG_LIBS) show_confstr (_CS_POSIX_V7_LPBIG_OFFBIG_LIBS); #endif #if defined (_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS) show_confstr (_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS); #endif #if defined (_CS_V5_WIDTH_RESTRICTED_ENVS) show_confstr (_CS_V5_WIDTH_RESTRICTED_ENVS); #endif #if defined (_CS_V5_WIDTH_RESTRICTED_ENVS) _show_confstr (_CS_V5_WIDTH_RESTRICTED_ENVS, "_XBS5_WIDTH_RESTRICTED_ENVS"); #endif #if defined (_CS_V5_WIDTH_RESTRICTED_ENVS) _show_confstr (_CS_V5_WIDTH_RESTRICTED_ENVS, "XBS5_WIDTH_RESTRICTED_ENVS"); #endif #if defined (_CS_V6_WIDTH_RESTRICTED_ENVS) show_confstr (_CS_V6_WIDTH_RESTRICTED_ENVS); #endif #if defined (_CS_V6_WIDTH_RESTRICTED_ENVS) _show_confstr (_CS_V6_WIDTH_RESTRICTED_ENVS, "POSIX_V6_WIDTH_RESTRICTED_ENVS,_POSIX_V6_WIDTH_RESTRICTED_ENVS"); #endif #if defined (_CS_V7_WIDTH_RESTRICTED_ENVS) show_confstr (_CS_V7_WIDTH_RESTRICTED_ENVS); #endif #if defined (_CS_XBS5_ILP32_OFF32_CFLAGS) show_confstr (_CS_XBS5_ILP32_OFF32_CFLAGS); #endif #if defined (_CS_XBS5_ILP32_OFF32_LDFLAGS) show_confstr (_CS_XBS5_ILP32_OFF32_LDFLAGS); #endif #if defined (_CS_XBS5_ILP32_OFF32_LIBS) show_confstr (_CS_XBS5_ILP32_OFF32_LIBS); #endif #if defined (_CS_XBS5_ILP32_OFF32_LINTFLAGS) show_confstr (_CS_XBS5_ILP32_OFF32_LINTFLAGS); #endif #if defined (_CS_XBS5_ILP32_OFFBIG_CFLAGS) show_confstr (_CS_XBS5_ILP32_OFFBIG_CFLAGS); #endif #if defined (_CS_XBS5_ILP32_OFFBIG_LDFLAGS) show_confstr (_CS_XBS5_ILP32_OFFBIG_LDFLAGS); #endif #if defined (_CS_XBS5_ILP32_OFFBIG_LIBS) show_confstr (_CS_XBS5_ILP32_OFFBIG_LIBS); #endif #if defined (_CS_XBS5_ILP32_OFFBIG_LINTFLAGS) show_confstr (_CS_XBS5_ILP32_OFFBIG_LINTFLAGS); #endif #if defined (_CS_XBS5_LP64_OFF64_CFLAGS) show_confstr (_CS_XBS5_LP64_OFF64_CFLAGS); #endif #if defined (_CS_XBS5_LP64_OFF64_LDFLAGS) show_confstr (_CS_XBS5_LP64_OFF64_LDFLAGS); #endif #if defined (_CS_XBS5_LP64_OFF64_LIBS) show_confstr (_CS_XBS5_LP64_OFF64_LIBS); #endif #if defined (_CS_XBS5_LP64_OFF64_LINTFLAGS) show_confstr (_CS_XBS5_LP64_OFF64_LINTFLAGS); #endif #if defined (_CS_XBS5_LPBIG_OFFBIG_CFLAGS) show_confstr (_CS_XBS5_LPBIG_OFFBIG_CFLAGS); #endif #if defined (_CS_XBS5_LPBIG_OFFBIG_LDFLAGS) show_confstr (_CS_XBS5_LPBIG_OFFBIG_LDFLAGS); #endif #if defined (_CS_XBS5_LPBIG_OFFBIG_LIBS) show_confstr (_CS_XBS5_LPBIG_OFFBIG_LIBS); #endif #if defined (_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS) show_confstr (_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS); #endif footer (); } #endif void get_misc (void) { misc.umask_value = umask (S_IWGRP|S_IWOTH); (void)umask (misc.umask_value); assert (getcwd (misc.cwd, sizeof (misc.cwd))); #if defined (PROCENV_LINUX) get_canonical (ROOT_PATH, misc.root, sizeof (misc.root)); #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) get_misc_bsd (); #endif } #if !defined (PROCENV_HURD) /** * is_console: * @fd: open file descriptor. * * Check if specified file descriptor is attached to a _console_ * device (physical or virtual). * * Notes: * - ptys are NOT consoles :) * - running inside screen/tmux will report not running on console. * * Returns: TRUE if @fd is attached to a console, else FALSE. **/ int is_console (int fd) { struct vt_mode vt; int ret; ret = ioctl (fd, VT_GETMODE, &vt); return !ret; } #endif void show_proc (void) { header ("process"); entry ("process id (pid)", "%d", user.pid); entry ("parent process id (ppid)", "%d", user.ppid); entry ("session id (sid)", "%d (leader=%s)", user.sid, is_session_leader () ? YES_STR : NO_STR); entry ("name", "'%s'", user.proc_name); show_proc_branch (); entry ("process group id", "%d (leader=%s)", user.pgroup, is_process_group_leader () ? YES_STR : NO_STR); entry ("foreground process group", "%d", user.fg_pgroup); entry ("terminal", "'%s'", user.ctrl_terminal); entry ("has controlling terminal", "%s", has_ctty () ? YES_STR : NO_STR); #if defined (PROCENV_HURD) entry ("on console", "%s", UNKNOWN_STR); #else entry ("on console", "%s", is_console (user.tty_fd) ? YES_STR : NO_STR); #endif section_open ("user"); entry ("real user id (uid)", "%d ('%s')", user.uid, get_user_name (user.uid)); entry ("effective user id (euid)", "%d ('%s')", user.euid, get_user_name (user.euid)); entry ("saved set-user-id (suid)", "%d ('%s')", user.suid, get_user_name (user.suid)); section_close (); section_open ("group"); entry ("real group id (gid)", "%d ('%s')", user.gid, get_group_name (user.gid)); entry ("effective group id (egid)", "%d ('%s')", user.egid, get_group_name (user.egid)); entry ("saved set-group-id (sgid)", "%d ('%s')", user.sgid, get_group_name (user.sgid)); section_close (); entry ("login name", "'%s'", user.login ? user.login : ""); section_open ("passwd"); entry ("name", "'%s'", user.passwd.pw_name); #if ! defined (PROCENV_ANDROID) /* No gecos on Android. In fact it doesn't actually use the * passwd database, but meh. */ entry ("gecos", "'%s'", user.passwd.pw_gecos); #endif entry ("dir", "'%s'", user.passwd.pw_dir); entry ("shell", "'%s'", user.passwd.pw_shell); section_close (); show_all_groups (); footer (); } void show_priorities (void) { #if defined (PROCENV_LINUX) int sched; sched = sched_getscheduler (0); #endif section_open ("scheduler"); #if defined (PROCENV_LINUX) entry ("type", "%s", sched < 0 ? UNKNOWN_STR : get_scheduler_name (sched)); #endif section_open ("priority"); entry ("process", "%d", priority.process); entry ("process group", "%d", priority.pgrp); entry ("user", "%d", priority.user); section_close (); section_close (); } void show_misc (void) { #if defined (PROCENV_LINUX) int domain = 0x0; /* magic value - see personality(2) */ unsigned int persona = 0xFFFFFFFF; unsigned int mask = PER_MASK; const char *personality_name = NULL; char *personality_flags = NULL; #endif header ("misc"); entry ("umask", "%4.4o", misc.umask_value); entry ("current directory (cwd)", "'%s'", misc.cwd); #if defined (PROCENV_LINUX) entry ("root", "%s%s%s", strcmp (misc.root, UNKNOWN_STR) ? "'" : "", misc.root, strcmp (misc.root, UNKNOWN_STR) ? "'" : ""); #endif entry ("chroot", "%s", in_chroot () ? YES_STR : NO_STR); entry ("container", "%s", container_type ()); #if defined (PROCENV_LINUX) show_prctl_linux (); section_open ("linux security module"); show_security_module_linux (); show_security_module_context_linux (); section_close (); #endif #if defined (PROCENV_LINUX) #ifdef LINUX_VERSION_CODE entry ("kernel headers version", "%u.%u.%u", (LINUX_VERSION_CODE >> 16), ((LINUX_VERSION_CODE >> 8) & 0xFF), (LINUX_VERSION_CODE & 0xFF)); #endif domain = personality (persona); personality_name = get_personality_name (domain & mask); section_open ("personality"); entry ("type", "%s", personality_name ? personality_name : UNKNOWN_STR); personality_flags = get_personality_flags (domain & (-1 ^ mask)); entry ("flags", "%s", personality_flags ? personality_flags : ""); section_close (); if (personality_flags) free (personality_flags); #endif footer (); } void show_platform (void) { long kernel_bits; long executable_bits; header ("platform"); entry ("operating system", "%s", get_os ()); entry ("architecture", "%s", get_arch ()); kernel_bits = get_kernel_bits (); executable_bits = sizeof (void *) * CHAR_BIT * sizeof (char); if (kernel_bits == -1) entry ("kernel bits", "%s", UNKNOWN_STR); else entry ("kernel bits", "%lu", kernel_bits); entry ("executable bits", "%lu", executable_bits); entry ("code endian", "%s", is_big_endian () ? BIG_STR : LITTLE_STR); show_data_model (); footer (); } void show_cpu (void) { header ("cpu"); #if defined (PROCENV_LINUX) show_cpu_linux (); #endif #if defined (PROCENV_BSD) show_cpu_bsd (); #endif show_cpu_affinities (); show_priorities (); footer (); } void show_memory (void) { header ("memory"); entry ("page size", "%d bytes", getpagesize ()); #if defined (PROCENV_LINUX) show_numa_memory (); #endif /* PROCENV_LINUX */ footer (); } /* Display cpu affinities in the same compressed but reasonably * human-readable fashion as /proc/self/status:Cpus_allowed_list under Linux. */ void show_cpu_affinities (void) { int ret = 0; long max; size_t size; #if defined (PROCENV_BSD) || ! defined (CPU_ALLOC) PROCENV_CPU_SET_TYPE cpu_set_real; #endif PROCENV_CPU_SET_TYPE *cpu_set; long cpu; char *cpu_list = NULL; /* TRUE if any enabled cpus have been displayed yet */ int displayed = FALSE; /* Number of cpu's in *current* range */ size_t count = 0; /* Only valid to read these when count is >0 */ size_t last = 0; size_t first = 0; max = get_sysconf (_SC_NPROCESSORS_ONLN); if (max < 0) die ("failed to query cpu count"); #if defined (PROCENV_LINUX) || defined (PROCENV_GNU_BSD) || defined (PROCENV_HURD) #if defined (CPU_ALLOC) cpu_set = CPU_ALLOC (max); assert (cpu_set); size = CPU_ALLOC_SIZE (max); CPU_ZERO_S (size, cpu_set); #else /* ! CPU_ALLOC */ /* RHEL 5 */ cpu_set = &cpu_set_real; size = sizeof (PROCENV_CPU_SET_TYPE); #endif /* CPU_ALLOC */ #elif defined (PROCENV_BSD) || ! defined (CPU_ALLOC) cpu_set = &cpu_set_real; size = sizeof (PROCENV_CPU_SET_TYPE); #endif /* PROCENV_LINUX || PROCENV_GNU_BSD || PROCENV_HURD */ /* We could use sched_getaffinity(2) rather than * sched_getaffinity() on Linux (2.5.8+) but * pthread_getaffinity_np() provides the same information... * Except it is missing on kFreeBSD systems (!) so we have to * use sched_getaffinity() there. :( */ #if (defined (PROCENV_GNU_BSD) || defined (PROCENV_HURD)) || (defined (PROCENV_LINUX) && ! defined (CPU_ALLOC)) ret = sched_getaffinity (0, size, cpu_set); #else #if defined (PROCENV_LINUX) && defined (CPU_ALLOC) /* On a hyperthreaded system, "size" as above may not actually be big enough, and we get EINVAL. (hwloc has a similar workaround.) */ { int mult = 0; while ((ret = pthread_getaffinity_np (pthread_self (), size, cpu_set)) == EINVAL) { CPU_FREE (cpu_set); /* Bail out at an arbitrary value. */ if (mult > 128) break; mult += 2; cpu_set = CPU_ALLOC (mult * max); size = CPU_ALLOC_SIZE (mult * max); CPU_ZERO_S (size, cpu_set); } } #endif /* PROCENV_LINUX && CPU_ALLOC */ #endif if (ret) goto out; for (cpu = 0; cpu < max; cpu++) { if (CPU_ISSET (cpu, cpu_set)) { /* Record first entry in the range */ if (! count) first = cpu; last = cpu; count++; } else { if (count) { if (first == last) { appendf (&cpu_list, "%s%d", displayed ? "," : "", first); } else { appendf (&cpu_list, "%s%d-%d", displayed ? "," : "", first, last); } displayed = TRUE; } /* Reset */ count = 0; } } if (count) { if (first == last) { appendf (&cpu_list, "%s%d", displayed ? "," : "", first); } else { appendf (&cpu_list, "%s%d-%d", displayed ? "," : "", first, last); } } out: entry ("affinity list", "%s", cpu_list ? cpu_list : "-1"); #if defined (PROCENV_LINUX) || defined (PROCENV_GNU_BSD) || defined (PROCENV_HURD) #if defined (CPU_ALLOC) CPU_FREE (cpu_set); #endif #endif free (cpu_list); } void show_fds (void) { #if defined (PROCENV_LINUX) show_fds_linux (); #else show_fds_generic (); #endif } void show_namespaces (void) { #if defined (PROCENV_LINUX) show_namespaces_linux (); #else show_namespaces_stub (); #endif } void show_fds_generic (void) { int fd; int max; container_open ("file descriptors"); max = get_sysconf (_SC_OPEN_MAX); for (fd = 0; fd < max; fd++) { int is_tty = isatty (fd); char *name = NULL; char *num = NULL; if (! fd_valid (fd)) continue; #if ! defined (PROCENV_ANDROID) name = ttyname (fd); #endif appendf (&num, "%d", fd); object_open (FALSE); section_open (num); entry ("terminal", "%s", is_tty ? YES_STR : NO_STR); entry ("valid", "%s", fd_valid (fd) ? YES_STR : NO_STR); entry ("device", "%s", name ? name : NA_STR); section_open ("capabilities"); #if defined (PROCENV_BSD) && defined (HAVE_SYS_CAPABILITY_H) show_capabilities_bsd (fd); #endif section_close (); section_close (); object_close (FALSE); free (num); } container_close (); } void show_env (void) { char **env = environ; char **copy; char *name; char *value; size_t i; size_t max; header ("environment"); /* Calculate size of environment array */ for (max=0; env[max]; max++) ; copy = calloc (1+max, sizeof (char *)); if (! copy) die ("failed to alloate storage"); /* Copy the environ array since modification is not allowed */ for (i=0; i < max; i++) { copy[i] = calloc (1, 1+strlen (env[i])); if (! copy[i]) die ("failed to alloate storage"); strcpy (copy[i], env[i]); } /* Terminate */ copy[max] = NULL; /* Sort */ env = copy; qsort (env, i, sizeof (env[0]), qsort_compar); /* Display */ env = copy; while (env && *env) { name = *env; value = strchr (name, '='); assert (value); *value = '\0'; value++; entry (name, "%s", value); env++; } /* Tidy up */ for (i = 0; i < max; i++) free (copy[i]); free (copy); footer (); } int qsort_compar (const void *a, const void *b) { return strcoll (*(char * const *)a, *(char * const *)b); } void get_user_info (void) { struct passwd *pw; void *p; int ret; user.pid = getpid (); user.ppid = getppid (); #if defined (PROCENV_LINUX) if (LINUX_KERNEL_MMR (2, 6, 11)) { if (prctl (PR_GET_NAME, user.proc_name, 0, 0, 0) < 0) strcpy (user.proc_name, UNKNOWN_STR); } #endif #ifdef _GNU_SOURCE ret = getresuid (&user.uid, &user.euid, &user.suid); assert (! ret); getresgid (&user.gid, &user.egid, &user.sgid); assert (! ret); #else /* NB: no saved uid+gid */ user.uid = getuid (); user.euid = geteuid (); user.gid = getgid (); user.egid = getegid (); #endif user.sid = getsid ((pid_t)0); errno = 0; /* * XXX: This will be NULL if auditd isn't running (for example * on Ubuntu Desktop systems). * * See Question 8 here: * * http://people.redhat.com/sgrubb/audit/audit-faq.txt */ user.login = getlogin (); user.pgroup = getpgrp (); #if defined (PROCENV_ANDROID) sprintf (user.ctrl_terminal, "/dev/tty"); #else ctermid (user.ctrl_terminal); #endif /* Get a reference to the controlling terminal * in case all standard fds are redirected. * * If run from a process superviser such as Upstart, setsid() * will already have been called which means it is impossible to * regain a controlling terminal. Thus, if the open fails, * attempt to use STDIN_FILENO (however, this will probably fail * too as it will be redirected to /dev/null. */ /* open r/w for OUTPUT_TERM's benefit */ user.tty_fd = open (user.ctrl_terminal, O_RDWR); if (user.tty_fd < 0) user.tty_fd = STDIN_FILENO; user.fg_pgroup = tcgetpgrp (user.tty_fd); user.pgid_sid = tcgetsid (user.tty_fd); errno = 0; pw = getpwuid (user.uid); if (!pw && errno == 0) die ("uid %d no longer exists", user.uid); p = memcpy (&user.passwd, pw, sizeof (struct passwd)); assert (p == (void *)&user.passwd); } /* append @src to @dest */ void append (char **dest, const char *src) { size_t len; assert (dest); assert (src); len = strlen (src); appendn (dest, src, len); } /* Version of append() that operates on a wide string @dest and @src */ void wappend (pstring **dest, const wchar_t *src) { size_t len; assert (dest); assert (src); len = wcslen (src); wappendn (dest, src, len); } /* Version of append() that operates on a wide string @dest * and multi-byte @src. */ void wmappend (pstring **dest, const char *src) { wchar_t *wide_src = NULL; assert (dest); assert (src); wide_src = char_to_wchar (src); if (! wide_src) die ("failed to allocate space for wide string"); wappend (dest, wide_src); free (wide_src); } /** * appendn: * * @dest: [output] string to append to, * @src: string to append to @dest, * @len: length of @new. * * Append first @len bytes of @new to @str, * ensuring result is nul-terminated. **/ void appendn (char **dest, const char *src, size_t len) { size_t total; assert (dest); assert (src); if (! len) return; if (! *dest) *dest = strdup (""); if (! *dest) die ("failed to allocate space for string"); /* +1 for terminating nul */ total = strlen (*dest) + 1; total += len; *dest = realloc (*dest, total); assert (*dest); if (! *dest) { /* string is empty, so initialise the memory to avoid * surprises with strncat() being unable to find the * terminator! */ memset (*dest, '\0', total); } strncat (*dest, src, len); assert ((*dest)[total-1] == '\0'); } /* Version of appendn() that operates on a wide string @dest and @src */ void wappendn (pstring **dest, const wchar_t *src, size_t len) { wchar_t *p; size_t total; size_t bytes; assert (dest); assert (src); if (! len) return; if (! *dest) *dest = pstring_new (); if (! *dest) die ("failed to allocate space for pstring"); total = (*dest)->len + len; /* +1 for terminating nul */ bytes = (1 + total) * sizeof (wchar_t); p = realloc ((*dest)->buf, bytes); /* FIXME: turn into die() [all occurences!] */ assert (p); (*dest)->buf = p; if (! (*dest)->len) { /* pstring is empty, so initialise the memory to avoid * surprises with wcsncat() being unable to find the * terminator! */ memset ((*dest)->buf, 0, bytes); } /* Used to check for overrun */ (*dest)->buf[total] = L'\0'; wcsncat ((*dest)->buf + (*dest)->len, src, len); /* update */ (*dest)->len = total; (*dest)->size = bytes; /* check for overrun */ assert ((*dest)->buf[total] == L'\0'); } /* Version of appendn() that operates on a wide string @dest and * multi-byte @src. */ void wmappendn (pstring **dest, const char *src, size_t len) { wchar_t *wide_src = NULL; assert (dest); assert (src); if (! len) return; wide_src = char_to_wchar (src); if (! wide_src) die ("failed to allocate space for wide string"); wappendn (dest, wide_src, wcslen (wide_src)); free (wide_src); } /* append @fmt and args to @dest */ void appendf (char **dest, const char *fmt, ...) { va_list ap; assert (dest); assert (fmt); va_start (ap, fmt); appendva (dest, fmt, ap); va_end (ap); } /* Version of appendf() that operates on a wide string @dest * and @fmt. */ void wappendf (pstring **dest, const wchar_t *fmt, ...) { va_list ap; assert (dest); assert (fmt); va_start (ap, fmt); wappendva (dest, fmt, ap); va_end (ap); } /* Version of appendf() that operates on a wide string @dest * and multi-byte @fmt. */ void wmappendf (pstring **dest, const char *fmt, ...) { wchar_t *wide_fmt = NULL; va_list ap; assert (dest); assert (fmt); wide_fmt = char_to_wchar (fmt); if (! wide_fmt) die ("failed to allocate memory for wide format"); va_start (ap, fmt); wappendva (dest, wide_fmt, ap); va_end (ap); free (wide_fmt); } /* append @fmt and args to @dest */ void appendva (char **dest, const char *fmt, va_list ap) { int ret; char *new = NULL; char *p; size_t bytes; /* Start with a guess for how big we think the buffer needs to * be. */ size_t len = DEFAULT_ALLOC_GUESS_SIZE; assert (dest); assert (fmt); bytes = (1 + len) * sizeof (char); /* we could use vasprintf(3), but that's GNU-specific and hence * not available everywhere we need it. */ new = malloc (bytes); if (! new) die ("failed to allocate space for string"); memset (new, '\0', bytes); /* keep on increasing size of buffer until the translation * succeeds. */ while (TRUE) { va_list ap_copy; va_copy (ap_copy, ap); ret = vsnprintf (new, len, fmt, ap_copy); va_end (ap_copy); if (ret < 0) die ("failed to format string"); if ((size_t)ret < len) { /* now we have sufficient space */ break; } /* Bump to allow one char to be written */ len++; /* recalculate number of bytes */ bytes = (1 + len) * sizeof (char); p = realloc (new, bytes); if (! p) die ("failed to allocate space for string"); new = p; } if (*dest) { append (dest, new); free (new); } else { *dest = new; } } /* Version of appendva() that operates on a wide string @dest * and @fmt. */ void wappendva (pstring **dest, const wchar_t *fmt, va_list ap) { int ret; wchar_t *new = NULL; wchar_t *p; size_t bytes; va_list ap_copy; /* Start with a guess for how big we think the buffer needs to * be. */ size_t len = DEFAULT_ALLOC_GUESS_SIZE; assert (dest); assert (fmt); bytes = (1 + len) * sizeof (wchar_t); new = malloc (bytes); if (! new) die ("failed to allocate space for wide string"); memset (new, '\0', bytes); /* keep on increasing size of buffer until the translation * succeeds. */ while (TRUE) { va_copy (ap_copy, ap); ret = vswprintf (new, len, fmt, ap_copy); va_end (ap_copy); if ((size_t)ret < len) { /* now we have sufficient space, so update for * actual number of bytes used (including the * terminator!) * * Note that, conveniently, if the string is * zero-characters long (ie ""), ret will be -1 * which we correct to 0. */ len = ret + 1; break; } /* Bump to allow one more wide-char to be written */ len++; /* recalculate number of bytes */ bytes = (1 + len) * sizeof (wchar_t); p = realloc (new, bytes); if (! p) die ("failed to allocate space for string"); new = p; memset (new, '\0', bytes); } if (*dest) { wappend (dest, new); free (new); } else { wchar_t *n; /* recalculate number of bytes */ bytes = (1 + len) * sizeof (wchar_t); /* compress */ n = realloc (new, bytes); if (! n) die ("failed to reallocate space"); new = n; (*dest) = pstring_new (); assert (*dest); (*dest)->buf = new; (*dest)->len = len; (*dest)->size = bytes; } } /* Version of appendva() that operates on a wide string @dest * and multi-byte @fmt. */ void wmappendva (pstring **dest, const char *fmt, va_list ap) { wchar_t *wide_fmt = NULL; va_list ap_copy; assert (dest); assert (fmt); wide_fmt = char_to_wchar (fmt); if (! wide_fmt) die ("failed to allocate memory for wide format"); va_copy (ap_copy, ap); wappendva (dest, wide_fmt, ap_copy); va_end (ap_copy); free (wide_fmt); } /* * Append @src onto the end of @dest. */ void pappend (pstring **dest, const pstring *src) { size_t total; size_t bytes; wchar_t *p; assert (dest); assert (src); if (! src->len) return; if (! *dest) *dest = pstring_new (); if (! *dest) die ("failed to allocate space for pstring"); total = (*dest)->len + src->len; /* adjust since we only store _one_ of the string terminators * from @dest and @src. */ total--; /* +1 for terminating nul */ bytes = (1 + total) * sizeof (wchar_t); p = realloc ((*dest)->buf, bytes); /* FIXME: turn into die() [all occurences!] */ assert (p); (*dest)->buf = p; wcsncat ((*dest)->buf + (*dest)->len, src->buf, src->len); /* update */ (*dest)->len = total; (*dest)->size = bytes; /* Used to check for overrun */ (*dest)->buf[total] = L'\0'; } void show_all_groups (void) { int i; int ret; char *str = NULL; /* Initial number of groups we'll try to read. If this isn't * enough, we increase it to make rooom for all available * groups. So don't worry :) */ int size = 32; gid_t *groups = NULL; gid_t *g; char **group_names = NULL; size_t bytes; bytes = size * sizeof (gid_t); groups = malloc (bytes); if (! groups) goto error; memset (groups, '\0', bytes); while (TRUE) { ret = getgroups (size, groups); if (ret >= 0) break; size++; g = realloc (groups, (size * sizeof (gid_t))); if (! g) { free (groups); goto error; } groups = g; } size = ret; if (size == 0) { char *group; free (groups); group = get_group_name (user.passwd.pw_gid); if (! group) { entry ("groups", "%s", UNKNOWN_STR); return; } appendf (&str, " '%s' (%d)", group, user.passwd.pw_gid); entry ("groups", "%s", str); free (str); return; } group_names = calloc (size, sizeof (char *)); if (! group_names) die ("failed to allocate space for group array"); /* spacer */ appendf (&str, " "); for (i = 0; i < size; i++) { appendf (&group_names[i], "'%s' (%d)", get_group_name (groups[i]), groups[i]); } qsort (group_names, size, sizeof (char *), qsort_compar); for (i = 0; i < size; i++) { if (i+1 == size) appendf (&str, "%s", group_names[i]); else appendf (&str, "%s, ", group_names[i]); free (group_names[i]); } free (group_names); free (groups); entry ("groups", "%s", str); free (str); return; error: die ("failed to allocate space for groups"); } void save_locale (void) { char *value; assert (! saved_locale); /* save the existing value, but crucially also load the correct * locale from the environment to enable UTF-8 functionality. */ value = setlocale (LC_ALL, ""); if (! value) { /* Can't determine locale, so ignore */ return; } saved_locale = strdup (value); if (! saved_locale) die ("failed to allocate space for locale"); if (atexit (restore_locale)) die ("failed to register exit handler"); } void restore_locale (void) { if (! saved_locale) { /* Nothing to do */ return; } (void)setlocale (LC_ALL, saved_locale); free (saved_locale); } void handle_indent_char (void) { size_t len; const char *new = indent_char; len = mbsrtowcs (NULL, &new, 0, NULL); if (len != 1) die ("invalid indent character"); if (mbsrtowcs (&wide_indent_char, &new, len, NULL) != len) die ("failed to convert indent character"); } void init (void) { save_locale (); handle_indent_char (); /* required to allow for more graceful handling of prctl(2) * options that were introduced in kernel version 'x.y'. */ get_uname (); get_user_info (); get_misc (); get_priorities (); } void cleanup (void) { common_assert (); assert (doc); close (user.tty_fd); if (output_fd != -1) close (output_fd); if (output == OUTPUT_SYSLOG) closelog (); if (output_format == OUTPUT_FORMAT_CRUMB && crumb_list) { clear_breadcrumbs (); free (crumb_list); } pstring_free (doc); } /** * is_big_endian: * * Returns: TRUE if system is big-endian, else FALSE. **/ bool is_big_endian (void) { int x = 1; if (*(char *)&x == 1) return FALSE; return TRUE; } void show_meta (void) { const char *build_type; #if defined (PROCENV_REPRODUCIBLE_BUILD) build_type = BUILD_TYPE_REPRODUCIBLE_STR; #else build_type = BUILD_TYPE_STD_STR; #endif header ("meta"); entry ("version", "%s", PACKAGE_VERSION); entry ("package", "%s", PACKAGE_STRING); entry ("mode", "%s%s", user.euid ? _(NON_STR) "-" : "", PRIVILEGED_STR); entry ("build-type", "%s", build_type); entry ("format-type", "%s", get_output_format_name ()); entry ("format-version", "%d", PROCENV_FORMAT_VERSION); footer (); } void show_arguments (void) { int i; header ("arguments"); entry ("count", "%u", argvc); container_open ("list"); for (i = 0; i < argvc; i++) { char *buffer = NULL; appendf (&buffer, "argv[%d]", i); object_open (FALSE); entry (buffer, "%s", argvp[i]); object_close (FALSE); free (buffer); } container_close (); footer (); } void show_stat (void) { struct stat st; char real_path[PATH_MAX]; char formatted_atime[32]; char formatted_ctime[32]; char formatted_mtime[32]; char *modestr; mode_t perms; char *tmp = NULL; assert (program_name); assert (misc.cwd); tmp = get_path (program_name); assert (tmp); if (! realpath (tmp, real_path)) die ("unable to resolve path"); free (tmp); if (stat (real_path, &st) < 0) die ("unable to stat path: '%s'", real_path); header ("stat"); entry ("argv[0]", "'%s'", program_name); entry ("real path", "'%s'", real_path); section_open ("device"); entry ("major", "%u", major (st.st_dev)); entry ("minor", "%u", minor (st.st_dev)); section_close (); entry ("inode", "%lu", (unsigned long int)st.st_ino); modestr = format_perms (st.st_mode); if (! modestr) die ("failed to allocate space for permissions string"); perms = (st.st_mode &= ~S_IFMT); if (perms & S_ISUID) modestr[3] = 's'; if (perms & S_ISGID) modestr[6] = 's'; if (perms & S_ISVTX) modestr[9] = 't'; section_open ("permissions"); entry ("octal", "%4.4o", perms); entry ("symbolic", "%s", modestr); free (modestr); section_close (); entry ("hard links", "%u", st.st_nlink); entry ("user id (uid)", "%d ('%s')", st.st_uid, get_user_name (st.st_uid)); entry ("group id (gid)", "%d ('%s')", st.st_gid, get_group_name (st.st_uid)); entry ("size", "%lu bytes (%lu 512-byte blocks)", st.st_size, st.st_blocks); /*****************************************/ section_open ("times"); if (! ctime_r ((time_t *)&st.st_atime, formatted_atime)) die ("failed to format atime"); formatted_atime[ strlen (formatted_atime)-1] = '\0'; entry ("atime (access)", "%lu (%s)", st.st_atime, formatted_atime); if (! ctime_r ((time_t *)&st.st_mtime, formatted_mtime)) die ("failed to format mtime"); formatted_mtime[ strlen (formatted_mtime)-1] = '\0'; entry ("mtime (modification)", "%lu (%s)", st.st_mtime, formatted_mtime); if (! ctime_r ((time_t *)&st.st_ctime, formatted_ctime)) die ("failed to format ctime"); formatted_ctime[ strlen (formatted_ctime)-1] = '\0'; entry ("ctime (status change)", "%lu (%s)", st.st_ctime, formatted_ctime); section_close (); /*****************************************/ footer (); } long get_kernel_bits (void) { #if defined (PROCENV_LINUX) && ! defined (PROCENV_ANDROID) long value; errno = 0; value = get_sysconf (_SC_LONG_BIT); if (value == -1 && errno != 0) return -1; return value; #endif return -1; } /* Dump out data in alphabetical fashion */ void dump (void) { master_header (&doc); show_meta (); show_arguments (); show_capabilities (); show_cgroups (); show_clocks (); show_compiler (); #ifndef PROCENV_ANDROID show_confstrs (); #endif show_cpu (); show_env (); show_fds (); show_libc (); #ifndef PROCENV_ANDROID show_libs (); #endif show_rlimits (); show_locale (); show_memory (); show_msg_queues (); show_misc (); show_mounts (SHOW_ALL); show_namespaces (); show_network (); show_oom (); show_platform (); show_proc (); show_ranges (); /* We should really call this last, to make figures as reliable * as possible. */ show_rusage (); show_semaphores (); show_shared_mem (); show_signals (); show_sizeof (); show_stat (); show_sysconf (); show_threads (); show_time (); show_timezone (); show_tty_attrs (); show_uname (); master_footer (&doc); } void get_network_address (const struct sockaddr *address, int family, char *name) { int ret; assert (address); assert (name); memset (name, '\0', NI_MAXHOST); if (family == AF_INET || family == AF_INET6) { ret = getnameinfo (address, (family == AF_INET) ? sizeof (struct sockaddr_in) : sizeof (struct sockaddr_in6), (char *)name, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); if (ret) { switch (ret) { case EAI_NONAME: case EAI_FAMILY: sprintf ((char *)name, "%s", NA_STR); break; default: sprintf ((char *)name, "%s", UNKNOWN_STR); break; } } } else { sprintf ((char *)name, "%s", NA_STR); } assert (name[NI_MAXHOST-1] == '\0'); } void decode_if_flags (unsigned int flags) { struct if_flag_map *p; for (p = if_flag_map; p && p->name; p++) { if (flags & p->flag) { object_open (FALSE); entry (p->name, "0x%x", p->flag); object_close (FALSE); } } } const char * get_ipv6_scope_name (uint32_t scope) { switch (scope) { case 0x0: case 0xf: return "reserved"; break; case 0x1: return "interface-local"; break; case 0x2: return "link-local"; break; case 0x4: return "admin-local"; break; case 0x5: return "site-local"; break; case 0x8: return "organization-local"; break; case 0xe: return "global"; break; } return UNKNOWN_STR; } int get_mtu (const struct ifaddrs *ifaddr) { int sock; struct ifreq ifr; unsigned long request = SIOCGIFMTU; assert (ifaddr); /* We need to create a socket to query an interfaces mac * address. Don't ask me why... */ sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_IP); if (sock < 0) return -1; memset (&ifr, 0, sizeof (struct ifreq)); strncpy (ifr.ifr_name, ifaddr->ifa_name, IFNAMSIZ-1); if (ioctl (sock, request, &ifr) < 0) ifr.ifr_mtu = 0; close (sock); return ifr.ifr_mtu; } /* * * Returns: IEEE-802 format MAC address, or NULL on error. */ char * get_mac_address (const struct ifaddrs *ifaddr) { char *data = NULL; char *mac_address = NULL; int i; int valid = FALSE; #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) struct sockaddr_dl *link_layer; #else struct ifreq ifr; int sock = -1; #endif #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) unsigned long request = SIOCGIFHWADDR; #endif assert (ifaddr); #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) link_layer = (struct sockaddr_dl *)ifaddr->ifa_addr; #else /* We need to create a socket to query an interfaces mac * address. Don't ask me why... */ sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_IP); if (sock < 0) return NULL; memset (&ifr, 0, sizeof (struct ifreq)); strncpy (ifr.ifr_name, ifaddr->ifa_name, IFNAMSIZ-1); if (ioctl (sock, request, &ifr) < 0) goto out; #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) data = LLADDR (link_layer); #else data = (char *)ifr.ifr_hwaddr.sa_data; #endif if (data) { for (i = 0; i < 6; i++) { if (data[i]) { valid = TRUE; break; } } } /* MAC comprised of all zeros cannot be valid */ if (! valid) goto out; /* An IEEE-802 formatted MAC address comprises 6x 2-byte groups, * separated by 5 colons with an additional byte for the string * terminator. */ mac_address = calloc ((6*2) + 5 + 1, sizeof (char)); if (! mac_address) goto out; sprintf (mac_address, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", (unsigned char)data[0], (unsigned char)data[1], (unsigned char)data[2], (unsigned char)data[3], (unsigned char)data[4], (unsigned char)data[5]); out: #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) /* NOP */ #else close (sock); #endif return mac_address; } #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) void show_mounts_linux (ShowMountType what) { FILE *mtab; struct mntent *mnt; struct statvfs fs; unsigned int major = 0; unsigned int minor = 0; int have_stats; #if defined (PROCENV_LINUX) char canonical[PATH_MAX]; #endif common_assert (); mtab = fopen (MOUNTS, "r"); if (! mtab) return; while ((mnt = getmntent (mtab))) { have_stats = TRUE; if (what == SHOW_ALL || what == SHOW_MOUNTS) { unsigned multiplier = 0; fsblkcnt_t blocks = 0; fsblkcnt_t bfree = 0; fsblkcnt_t bavail = 0; fsblkcnt_t used_blocks = 0; fsblkcnt_t used_files = 0; #if defined (PROCENV_LINUX) int ret; #endif if (statvfs (mnt->mnt_dir, &fs) < 0) { have_stats = FALSE; } else { multiplier = fs.f_bsize / DF_BLOCK_SIZE; blocks = fs.f_blocks * multiplier; bfree = fs.f_bfree * multiplier; bavail = fs.f_bavail * multiplier; used_blocks = blocks - bfree; used_files = fs.f_files - fs.f_ffree; } (void)get_major_minor (mnt->mnt_dir, &major, &minor); assert (mnt->mnt_dir); section_open (mnt->mnt_dir); entry ("filesystem", "'%s'", mnt->mnt_fsname); #if defined (PROCENV_LINUX) ret = get_canonical (mnt->mnt_fsname, canonical, sizeof (canonical)); entry ("canonical", "%s%s%s", ret ? "'" : "", canonical, ret ? "'" : ""); #endif entry ("type", "'%s'", mnt->mnt_type); entry ("options", "'%s'", mnt->mnt_opts); show_pathconfs (what, mnt->mnt_dir); section_open ("device"); entry ("major", "%u", major); entry ("minor", "%u", minor); section_close (); entry ("dump frequency", "%d", mnt->mnt_freq); entry ("fsck pass number", "%d", mnt->mnt_passno); if (have_stats) { union fsid_u { unsigned long int fsid; unsigned int val[2]; } fsid_val; fsid_val.fsid = fs.f_fsid; entry ("fsid", "%.*x%.*x", 2 * sizeof (fsid_val.val[0]), fsid_val.val[0], 2 * sizeof (fsid_val.val[1]), fsid_val.val[1]); entry ("optimal block size", "%lu", fs.f_bsize); section_open ("blocks"); entry ("size", "%lu bytes", DF_BLOCK_SIZE); entry ("total", "%lu", blocks); entry ("used", "%lu", used_blocks); entry ("free", "%lu", bfree); entry ("available", "%lu", bavail); section_close (); section_open ("files/inodes"); entry ("total", "%lu", fs.f_files); entry ("used", "%lu", used_files); entry ("free", "%lu", fs.f_ffree); section_close (); } else { entry ("fsid", "%s", UNKNOWN_STR); entry ("optimal block size", "%s", UNKNOWN_STR); section_open ("blocks"); entry ("size", "%lu bytes", DF_BLOCK_SIZE); entry ("total", "%s", UNKNOWN_STR); entry ("used", "%s", UNKNOWN_STR); entry ("free", "%s", UNKNOWN_STR); entry ("available", "%s", UNKNOWN_STR); section_close (); section_open ("files/inodes"); entry ("total", "%s", UNKNOWN_STR); entry ("used", "%s", UNKNOWN_STR); entry ("free", "%s", UNKNOWN_STR); section_close (); } section_close (); } else { show_pathconfs (what, mnt->mnt_dir); } } fclose (mtab); } #endif #if defined (PROCENV_LINUX) void decode_extended_if_flags (const char *interface, unsigned short *flags) { int sock; struct ifreq ifr; struct if_extended_flag_map *p; assert (interface); assert (flags); /* We need to create a socket to query an interfaces mac * address. Don't ask me why... */ sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_IP); if (sock < 0) return; memset (&ifr, 0, sizeof (struct ifreq)); strncpy (ifr.ifr_name, interface, IFNAMSIZ-1); if (ioctl (sock, SIOCGIFPFLAGS, &ifr) < 0) goto out; *flags = ifr.ifr_flags; for (p = if_extended_flag_map; p && p->name; p++) { if (*flags & p->flag) { object_open (FALSE); entry (p->name, "0x%x", p->flag); object_close (FALSE); } } out: close (sock); } /** * linux_kernel_version: * * @major: major kernel version number, * @minor: minor kernel version number, * @revision: kernel revision version, * * @minor and @revision may be -1 to denote that those version * elements are not important to the caller. Once a parameter * has been specified as -1, subsequent parameters are ignored * (treated as -1 too). * * Returns: TRUE if running Linux kernel is atleast at version * specified by (@major, @minor, @revision), else FALSE. **/ bool linux_kernel_version (int major, int minor, int revision) { int actual_version = 0x000000; int requested_version = 0x000000; int actual_major = -1; int actual_minor = -1; int actual_revision = -1; int ret; assert (uts.release); assert (sizeof (int) >= 4); /* We need something to work with */ assert (major > 0); ret = sscanf (uts.release, "%d.%d.%d", &actual_major, &actual_minor, &actual_revision); /* We need something to compare against */ assert (ret && actual_major != -1); requested_version |= (0xFF0000 & (major << 16)); if (minor != -1) { requested_version |= (0x00FF00 & (minor << 8)); if (revision != -1) requested_version |= (0x0000FF & revision); } if (actual_revision != -1) { actual_version |= (0x0000FF & actual_revision); } if (actual_minor != -1) actual_version |= (0x00FF00 & (actual_minor << 8)); if (actual_major != -1) actual_version |= (0xFF0000 & (actual_major << 16)); if (actual_version >= requested_version) return TRUE; return FALSE; } void show_numa_memory (void) { #if defined (HAVE_NUMA_H) int policy; const char *policy_name; char *allowed_list = NULL; int ret; unsigned long node; unsigned long allowed_size; #if defined (HAVE_NUMA_H) #if LIBNUMA_API_VERSION == 2 struct bitmask *allowed; #else nodemask_t allowed; #endif #endif /* part of the libnuma public API - stop the library calling * exit(3) on error. */ numa_exit_on_error = 0; /* TRUE if any numa nodes have been displayed yet */ int displayed = FALSE; /* Number of numa nodes in *current* range */ size_t count = 0; /* Only valid to read these when count is >0 */ size_t last = 0; size_t first = 0; #endif /* HAVE_NUMA_H */ header ("numa"); #if defined (HAVE_NUMA_H) if (numa_available () < 0) /* NUMA not supported on this system */ goto out; #if LIBNUMA_API_VERSION == 2 entry ("api version", "%d", 2); #else entry ("api version", "%d", 1); #endif ret = get_mempolicy (&policy, NULL, 0, 0, 0); if (ret < 0) { entry ("policy", "%s", UNKNOWN_STR); goto out; } policy_name = get_numa_policy (policy); entry ("policy", "%s", policy_name ? policy_name : UNKNOWN_STR); #if LIBNUMA_API_VERSION == 2 entry ("maximum nodes", "%d", numa_num_possible_nodes ()); entry ("configured nodes", "%d", numa_num_configured_nodes ()); allowed = numa_get_mems_allowed (); if (! allowed) die ("failed to query NUMA allowed list"); allowed_size = allowed->size; #else entry ("maximum nodes", "%s", UNKNOWN_STR); entry ("configured nodes", "%d", numa_max_node ()); allowed = numa_get_run_node_mask (); allowed_size = NUMA_NUM_NODES; #endif for (node = 0; node < allowed_size; node++) { if (PROCENV_NUMA_BITMASK_ISSET (allowed, node)) { /* Record first entry in the range */ if (! count) first = node; last = node; count++; } else { if (count) { if (first == last) { appendf (&allowed_list, "%s%d", displayed ? "," : "", first); } else { appendf (&allowed_list, "%s%d-%d", displayed ? "," : "", first, last); } displayed = TRUE; } /* Reset */ count = 0; } } if (count) { if (first == last) { appendf (&allowed_list, "%s%d", displayed ? "," : "", first); } else { appendf (&allowed_list, "%s%d-%d", displayed ? "," : "", first, last); } } entry ("allowed list", "%s", allowed_list); #if LIBNUMA_API_VERSION == 2 numa_free_nodemask (allowed); #endif free (allowed_list); out: #endif /* HAVE_NUMA_H */ footer (); } #if defined (HAVE_NUMA_H) const char * get_numa_policy (int policy) { struct procenv_map *p; for (p = numa_mempolicy_map; p && p->name; p++) { if (p->num == policy) return p->name; } return NULL; } #endif /* HAVE_NUMA_H */ const char * get_personality_name (unsigned int domain) { struct personality_map *m; for (m = personality_map; m && m->name; m++) { if (m->personality == (domain & PER_MASK)) return m->name; } return NULL; } char * get_personality_flags (unsigned int flags) { struct personality_flag_map *m; char *list = NULL; int first = TRUE; for (m = personality_flag_map; m && m->name; m++) { if (flags & m->flag) { appendf (&list, "%s%s", first ? "" : ", ", m->name); first = FALSE; } } return list; } #endif /* PROCENV_LINUX */ void show_mounts (ShowMountType what) { common_assert (); header (what == SHOW_PATHCONF ? "pathconf" : "mounts"); #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) show_mounts_linux (what); #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) show_mounts_bsd (what); #endif footer (); } const char * get_net_family_name (sa_family_t family) { switch (family) { #if defined (PROCENV_LINUX) case AF_PACKET: return "AF_PACKET"; break; #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) case AF_LINK: return "AF_LINK"; break; #endif case AF_INET: return "AF_INET"; break; case AF_INET6: return "AF_INET6"; break; } return UNKNOWN_STR; } void show_network_if (const struct ifaddrs *ifa, const char *mac_address) { unsigned short ext_flags = 0; sa_family_t family; char address[NI_MAXHOST]; int mtu = 0; common_assert (); assert (ifa); family = ifa->ifa_addr->sa_family; assert (ifa->ifa_name); section_open (ifa->ifa_name); entry ("family", "%s (0x%x)", get_net_family_name (family), family); /*******************************/ section_open ("flags"); entry ("value", "0x%x", ifa->ifa_flags); container_open ("fields"); decode_if_flags (ifa->ifa_flags); container_close (); section_close (); /*******************************/ section_open ("extended flags"); entry ("value", "0x%x", ext_flags); container_open ("fields"); #if defined (PROCENV_LINUX) decode_extended_if_flags (ifa->ifa_name, &ext_flags); #endif container_close (); section_close (); /*******************************/ mtu = get_mtu (ifa); #if defined (PROCENV_HURD) /* No AF_LINK/AF_PACKET on Hurd atm */ entry ("mac", "%s", UNKNOWN_STR); #else entry ("mac", "%s", mac_address ? mac_address : NA_STR); #endif if (mtu > 0) { entry ("mtu", "%d", mtu); } else { entry ("mtu", "%s", UNKNOWN_STR); } get_network_address (ifa->ifa_addr, family, address); entry ("address", "%s", address); if (ifa->ifa_netmask) get_network_address (ifa->ifa_netmask, family, address); entry ("netmask", "%s", ifa->ifa_netmask ? address : NA_STR); #if !defined (PROCENV_HURD) if (family != PROCENV_LINK_LEVEL_FAMILY) { if ((ifa->ifa_flags & IFF_BROADCAST) && ifa->ifa_broadaddr) { get_network_address (ifa->ifa_broadaddr, family, address); entry ("broadcast", "%s", ifa->ifa_broadaddr ? address : NA_STR); } } else { #endif entry ("broadcast", "%s", NA_STR); #if !defined (PROCENV_HURD) } #endif if (ifa->ifa_flags & IFF_POINTOPOINT && ifa->ifa_dstaddr) { get_network_address (ifa->ifa_dstaddr, family, address); entry ("point-to-point", "%s", address); } section_close (); } /* * BSD returns an additional AF_LINK ifaddrs containing the * actual link-layer MAC address for each interface. * * Linux does the same but with one additional AF_PACKET family / interface. * * This is somewhat noisome since for BSD we need to cache the MAC addresses * such that they can be retrieved when the _next_ ifaddrs structure * appears for the *same* interface, but we only want to * display the non-AF_LINK elements *unless* they refer * to an interface with no associated address. * * The situation for Linux is similar but we only care * about AF_PACKET entries for interfaces that have no * associated address since we can extract the MAC * address using an ioctl (rather than considering the * AF_PACKET element). * * The strategy therefore is to: * * 1) Cache all AF_LINK/AF_PACKET elements. * 2) Once an element arrives that matches an interface * name found in the cache, use that as necessary (extra * the MAC for BSD, NOP for Linux), then free that cache * element. * 3) Having processed all entries, if any entries are * left in the cache, they must refer to interfaces that * have no address, so display them. * * XXX: Note the implicit assumption that the AF_LINK/AF_PACKET entries * will appear _before_ the corresponding entry containing address * details for the interface in the output of getifaddrs(): observations * suggests this _seems_ to be the case, but is not documented as being * guaranteed. */ #ifdef PROCENV_ANDROID void show_network (void) { /* Bionic isn't actually that bionic at all :( */ header ("network"); footer (); } #else void show_network (void) { struct ifaddrs *if_addrs; struct ifaddrs *ifa; char *mac_address = NULL; struct network_map *head = NULL; struct network_map *node = NULL; struct network_map *tmp = NULL; common_assert (); header ("network"); /* Query all network interfaces */ if (getifaddrs (&if_addrs) < 0) return; /* Construct an initial node for the cache */ head = calloc (1, sizeof (struct network_map)); assert (head); /* Iterate over all network interfaces */ for (ifa = if_addrs; ifa; ifa = ifa->ifa_next) { #if !defined (PROCENV_HURD) int family; #endif if (! ifa->ifa_addr) continue; #if !defined (PROCENV_HURD) family = ifa->ifa_addr->sa_family; if (family == PROCENV_LINK_LEVEL_FAMILY) { /* Add link level interface details to the cache */ mac_address = get_mac_address (ifa); node = calloc (1, sizeof (struct network_map)); assert (node); /* Conveniently, an ifaddrs contains a bunch of * pointers and some flags. * * Since all those pointers are valid until we * call freeifaddrs(), all we need to do is copy * the flags since the memcpy will copy the * pointers addresses for us :) */ memcpy (&node->ifaddr, ifa, sizeof (struct ifaddrs)); node->ifaddr.ifa_flags = ifa->ifa_flags; /* Since we've already formatted the MAC * address, we'll cache that too. */ node->mac_address = mac_address; mac_address = NULL; /* prepend */ node->next = head->next; if (head->next) head->next->prev = node; node->prev = head; head->next = node; continue; } #endif /* From now on, we're only looking at interfaces with an * address. */ /* Search for an entry corresponding to the interface in the cache */ for (node = head->next; node && node->ifaddr.ifa_name; node = node->next) { if (! strcmp (node->ifaddr.ifa_name, ifa->ifa_name)) { /* Save */ mac_address = node->mac_address ? strdup (node->mac_address) : NULL; /* Unlink existing node as it has now served its purpose */ node->prev->next = node->next; if (node->next) node->next->prev = node->prev; /* Destroy */ if (node->mac_address) free (node->mac_address); free (node); break; } } /* Display the interface (which must have an associated address) */ show_network_if (ifa, mac_address); if (mac_address) { free (mac_address); mac_address = NULL; } } /* Destroy the cache, displaying any interfaces not previously displayed. * These by definition cannot have addresses assigned to them. */ for (node = head->next; node && node->ifaddr.ifa_name; node = tmp) { tmp = node->next; show_network_if (&node->ifaddr, node->mac_address); /* Destroy */ if (node->mac_address) free (node->mac_address); free (node); } free (head); freeifaddrs (if_addrs); footer (); } #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) char * get_mount_opts_bsd (uint64_t flags) { struct mntopt_map *opt; char *str = NULL; size_t len = 0; size_t total = 0; int count = 0; if (! flags) return strdup (""); /* Calculate how much space we need to allocate by iterating * array for the first time. */ for (opt = mntopt_map; opt && opt->name; opt++) { if (flags & opt->flag) { count++; len += strlen (opt->name); } } if (count > 1) { /* we need space for the option value themselves, plus a * ", " separator between each option (except the first), * and finally space for the nul terminator */ total = len + (count-1) + 1; } else { total = len + 1; } str = calloc (total, sizeof (char)); if (! str) die ("failed to allocate space for mount options"); /* Re-iterate to construct the string. This is still going to be * a lot quicker than calling malloc a stack of times. */ for (opt = mntopt_map; opt && opt->name; opt++) { if (flags & opt->flag) { strcat (str, opt->name); if (count > 1) strcat (str, ","); count--; } } return str; } void show_mounts_bsd (ShowMountType what) { int count; struct statfs *mounts; struct statfs *mnt; unsigned int major = 0; unsigned int minor = 0; int i; unsigned multiplier = 0; statfs_int_type blocks; statfs_int_type bfree; statfs_int_type bavail; statfs_int_type used; common_assert (); /* Note that returned memory cannot be freed (by us) */ count = getmntinfo (&mounts, MNT_WAIT); if (! count) die ("unable to query mount info"); mnt = mounts; for (i = 0; i < count; i++) { char *opts = NULL; opts = get_mount_opts_bsd (mnt->f_flags); if (! opts) die ("cannot determine FS flags for mountpoint '%s'", mnt->f_mntonname); if (what == SHOW_ALL || what == SHOW_MOUNTS) { (void)get_major_minor (mnt->f_mntonname, &major, &minor); multiplier = mnt->f_bsize / DF_BLOCK_SIZE; blocks = mnt->f_blocks * multiplier; bfree = mnt->f_bfree * multiplier; bavail = mnt->f_bavail * multiplier; used = blocks - bfree; assert (mnt->f_mntfromname); section_open (mnt->f_mntfromname); entry ("dir", "'%s'", mnt->f_mntonname); entry ("type", "%s", mnt->f_fstypename); entry ("options", "'%s'", opts); section_open ("device"); entry ("major", "%u", major); entry ("minor", "%u", minor); section_close (); entry ("fsid", "%.*x%.*x", /* Always zero on BSD? */ 2 * sizeof (mnt->f_fsid.val[0]), mnt->f_fsid.val[0], 2 * sizeof (mnt->f_fsid.val[1]), mnt->f_fsid.val[1]); entry ("optimal block size", "%" statfs_int_fmt, mnt->f_bsize); section_open ("blocks"); entry ("size", "%lu bytes", DF_BLOCK_SIZE); entry ("total", "%" statfs_int_fmt, blocks); entry ("used", "%"statfs_int_fmt, used); entry ("free", "%" statfs_int_fmt, bfree); entry ("available", "%" statfs_int_fmt, bavail); section_close (); section_open ("files/inodes"); entry ("total", "%" statfs_int_fmt, mnt->f_files); entry ("used", "%" statfs_int_fmt, mnt->f_files - mnt->f_ffree); entry ("free", "%" statfs_int_fmt, mnt->f_ffree); section_close (); section_close (); } if (what == SHOW_ALL || what == SHOW_PATHCONF) show_pathconfs (what, mnt->f_mntonname); mnt++; free (opts); } } #endif #if defined (PROCENV_BSD) && defined (HAVE_SYS_CAPABILITY_H) void show_capabilities_bsd (int fd) { int ret; u_int mode; cap_rights_t rights; ret = cap_getmode (&mode); if (ret < 0) { /* No Capsicum support */ goto out; } ret = cap_rights_get (fd, &rights); if (ret < 0) { /* Cannot query capabilities */ goto out; } show_capsicum_cap (rights, CAP_ACCEPT); show_capsicum_cap (rights, CAP_ACL_CHECK); show_capsicum_cap (rights, CAP_ACL_DELETE); show_capsicum_cap (rights, CAP_ACL_GET); show_capsicum_cap (rights, CAP_ACL_SET); show_capsicum_cap (rights, CAP_BIND); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_BINDAT); show_capsicum_cap (rights, CAP_CHFLAGSAT); #endif show_capsicum_cap (rights, CAP_CONNECT); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_CONNECTAT); #endif show_capsicum_cap (rights, CAP_CREATE); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_EVENT); #endif show_capsicum_cap (rights, CAP_EXTATTR_DELETE); show_capsicum_cap (rights, CAP_EXTATTR_GET); show_capsicum_cap (rights, CAP_EXTATTR_LIST); show_capsicum_cap (rights, CAP_EXTATTR_SET); show_capsicum_cap (rights, CAP_FCHDIR); show_capsicum_cap (rights, CAP_FCHFLAGS); show_capsicum_cap (rights, CAP_FCHMOD); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_FCHMODAT); #endif show_capsicum_cap (rights, CAP_FCHOWN); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_FCHOWNAT); #endif show_capsicum_cap (rights, CAP_FCNTL); show_capsicum_cap (rights, CAP_FEXECVE); show_capsicum_cap (rights, CAP_FLOCK); show_capsicum_cap (rights, CAP_FPATHCONF); show_capsicum_cap (rights, CAP_FSCK); show_capsicum_cap (rights, CAP_FSTAT); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_FSTATAT); #endif show_capsicum_cap (rights, CAP_FSTATFS); show_capsicum_cap (rights, CAP_FSYNC); show_capsicum_cap (rights, CAP_FTRUNCATE); show_capsicum_cap (rights, CAP_FUTIMES); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_FUTIMESAT); #endif show_capsicum_cap (rights, CAP_GETPEERNAME); show_capsicum_cap (rights, CAP_GETSOCKNAME); show_capsicum_cap (rights, CAP_GETSOCKOPT); show_capsicum_cap (rights, CAP_IOCTL); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_KQUEUE); show_capsicum_cap (rights, CAP_KQUEUE_CHANGE); show_capsicum_cap (rights, CAP_KQUEUE_EVENT); show_capsicum_cap (rights, CAP_LINKAT); #endif show_capsicum_cap (rights, CAP_LISTEN); show_capsicum_cap (rights, CAP_LOOKUP); show_capsicum_cap (rights, CAP_MAC_GET); show_capsicum_cap (rights, CAP_MAC_SET); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_MKDIRAT); show_capsicum_cap (rights, CAP_MKFIFOAT); show_capsicum_cap (rights, CAP_MKNODAT); show_capsicum_cap (rights, CAP_MMAP); show_capsicum_cap (rights, CAP_MMAP_R); show_capsicum_cap (rights, CAP_MMAP_RW); show_capsicum_cap (rights, CAP_MMAP_RWX); show_capsicum_cap (rights, CAP_MMAP_RX); show_capsicum_cap (rights, CAP_MMAP_W); show_capsicum_cap (rights, CAP_MMAP_WX); show_capsicum_cap (rights, CAP_MMAP_X); #endif show_capsicum_cap (rights, CAP_PDGETPID); show_capsicum_cap (rights, CAP_PDKILL); show_capsicum_cap (rights, CAP_PDWAIT); show_capsicum_cap (rights, CAP_PEELOFF); show_capsicum_cap (rights, CAP_POLL_EVENT); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_PREAD); show_capsicum_cap (rights, CAP_PWRITE); #endif show_capsicum_cap (rights, CAP_READ); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_RECV); show_capsicum_cap (rights, CAP_RENAMEAT); #endif show_capsicum_cap (rights, CAP_SEEK); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_SEEK_TELL); #endif show_capsicum_cap (rights, CAP_SEM_GETVALUE); show_capsicum_cap (rights, CAP_SEM_POST); show_capsicum_cap (rights, CAP_SEM_WAIT); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_SEND); #endif show_capsicum_cap (rights, CAP_SETSOCKOPT); show_capsicum_cap (rights, CAP_SHUTDOWN); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_SOCK_CLIENT); show_capsicum_cap (rights, CAP_SOCK_SERVER); show_capsicum_cap (rights, CAP_SYMLINKAT); #endif show_capsicum_cap (rights, CAP_TTYHOOK); #if __FreeBSD__ > 9 show_capsicum_cap (rights, CAP_UNLINKAT); #endif show_capsicum_cap (rights, CAP_WRITE); out: /* clang requires this */ return; } #endif /* (PROCENV_BSD) && defined (HAVE_SYS_CAPABILITY_H) */ void get_priorities (void) { priority.process = getpriority (PRIO_PROCESS, 0); priority.pgrp = getpriority (PRIO_PGRP , 0); priority.user = getpriority (PRIO_USER , 0); } bool uid_match (uid_t uid) { return uid == getuid (); } /** * in_container: * * Determine if running inside a container. * * Returns: Name of container type, or NO_STR. **/ const char * container_type (void) { struct stat statbuf; char buffer[1024]; FILE *f; #if defined (PROCENV_LINUX) dev_t expected; expected = makedev (5, 1); #endif if (stat ("/dev/console", &statbuf) < 0) goto out; #if defined (PROCENV_BSD) if (misc.in_jail) return "jail"; #endif /* LXC's /dev/console is actually a pty */ #if defined (PROCENV_LINUX) if (major (statbuf.st_rdev) != major (expected) || (minor (statbuf.st_rdev)) != minor (expected)) return "lxc"; #endif if (! stat ("/proc/vz", &statbuf) && stat ("/proc/bc", &statbuf) < 0) return "openvz"; f = fopen ("/proc/self/status", "r"); if (! f) goto out; while (fgets (buffer, sizeof (buffer), f)) { size_t len = strlen (buffer); buffer[len-1] = '\0'; if (strstr (buffer, "VxID") == buffer) { fclose (f); return "vserver"; } } fclose (f); out: return NO_STR; } /** * in_chroot: * * Determine if running inside a chroot environment. * * Failures are fatal. * * Returns TRUE if within a chroot, else FALSE. **/ bool in_chroot (void) { struct stat st; int i; int root_inode, self_inode; char root[] = "/"; char self[] = "/proc/self/root"; char bsd_self[] = "/proc/curproc"; char *dir = NULL; i = stat (root, &st); if (i != 0) { dir = root; goto error; } root_inode = st.st_ino; /* * Inode 2 is the root inode for most filesystems. However, XFS * uses 128 for root. */ if (root_inode != 2 && root_inode != 128) return TRUE; i = stat (bsd_self, &st); if (i == 0) { /* Give up here if running on BSD */ return FALSE; } i = stat (self, &st); if (i != 0) return FALSE; self_inode = st.st_ino; if (root_inode == self_inode) return FALSE; return TRUE; error: die ("cannot stat '%s'", dir); /* compiler appeasement */ return FALSE; } /* detect if setsid(2) has been called */ bool is_session_leader (void) { return user.sid == user.pid; } /* detect if setpgrp(2)/setpgid(2) (or setsid(2)) has been called */ bool is_process_group_leader (void) { return user.pgroup == user.pid; } void show_proc_branch (void) { common_assert (); #if defined (PROCENV_LINUX) || defined (PROCENV_GNU_BSD) show_proc_branch_linux (); #endif #if defined (PROCENV_HURD) /* FIXME: how can this be queried in Hurd?? */ #endif #if defined (PROCENV_BSD) show_proc_branch_bsd (); #endif } #if defined (PROCENV_BSD) /* Who would have thought handling PIDs was so tricky? */ void show_proc_branch_bsd (void) { int count = 0; int i; char errors[_POSIX2_LINE_MAX]; kvm_t *kvm; struct kinfo_proc *procs; struct kinfo_proc *p; pid_t self, current; int done = FALSE; char *str = NULL; pid_t ultimate_parent = 0; common_assert (); self = current = getpid (); kvm = kvm_openfiles (NULL, _PATH_DEVNULL, NULL, O_RDONLY, errors); if (! kvm) die ("unable to open kvm"); procs = kvm_getprocs (kvm, KERN_PROC_PROC, 0, &count); if (! procs) die ("failed to get process info"); /* Calculate the lowest PID number which gives us the ultimate * parent of all processes. * * On BSD sytems, normally PID 0 ('[kernel]') is the ultimate * parent rather than PID 1 ('init'). * * However, this doesn't work in a BSD jail since in that * environment: * * - there is no init process visible. * - there is no kernel thread visible. * - the ultimate parent PID will either by 1 (the "invisible" * init process) or 'n' where 'n' is a PID>1 which is also * "invisible" (since it lives outside the jail in the host * environment). * * Confused yet? */ p = &procs[0]; ultimate_parent = p->ki_pid; for (i = 1; i < count; i++) { p = &procs[i]; if (p->ki_pid < ultimate_parent) ultimate_parent = p->ki_pid; } while (! done) { for (i = 0; i < count && !done; i++) { p = &procs[i]; if (p->ki_pid == current) { if (misc.in_jail) { struct kinfo_proc *p2; int ppid_found = FALSE; int j; /* Determine if the parent PID * actually exists within the * jail. */ for (j = 0; j < count; j++) { p2 = &procs[j]; if (p2->ki_pid == p->ki_ppid) { ppid_found = TRUE; break; } } if (p->ki_ppid == 1 || (p->ki_ppid && ! ppid_found)) { /* Found the "last" PID (whose parent is either * the "invisible init" or which exists outside the jail) * so record it and hop out. */ appendf (&str, "%d ('%s') %d (%s)", (int)current, p->ki_comm, p->ki_ppid, UNKNOWN_STR); done = TRUE; break; } else { /* Found a valid parent pid */ appendf (&str, "%d ('%s'), ", (int)current, p->ki_comm); } } else if (! ultimate_parent && current == ultimate_parent) { /* Found the "last" PID so record it and hop out */ appendf (&str, "%d ('%s')", (int)current, p->ki_comm); done = TRUE; break; } else { /* Found a valid parent pid */ appendf (&str, "%d ('%s'), ", (int)current, p->ki_comm); } /* Move on */ current = p->ki_ppid; } } } if (kvm_close (kvm) < 0) die ("failed to close kvm"); entry ("ancestry", "%s", str); free (str); } #endif #if defined (PROCENV_LINUX) void show_prctl_linux (void) { int rc; int arg2; char name[17] = { 0 }; common_assert (); section_open ("prctl"); #ifdef PR_GET_ENDIAN if (LINUX_KERNEL_MMR (2, 6, 18)) { const char *value; rc = prctl (PR_GET_ENDIAN, &arg2, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (arg2) { case PR_ENDIAN_BIG: value = BIG_STR; break; case PR_ENDIAN_LITTLE: value = LITTLE_STR; break; case PR_ENDIAN_PPC_LITTLE: value = "PowerPC pseudo little endian"; break; default: value = UNKNOWN_STR; break; } } entry ("process endian", "%s", value); } #endif #ifdef PR_GET_DUMPABLE if (LINUX_KERNEL_MMR (2, 3, 20)) { const char *value; rc = prctl (PR_GET_DUMPABLE, 0, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (rc) { case 0: value = NO_STR; break; case 1: value = YES_STR; break; case 2: value = "root-only"; break; default: value = UNKNOWN_STR; break; } } entry ("dumpable", "%s", value); } #endif #ifdef PR_GET_FPEMU /* Use the earliest version where this option was introduced * (for some architectures). */ if (LINUX_KERNEL_MMR (2, 4, 18)) { const char *value; rc = prctl (PR_GET_FPEMU, &arg2, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (arg2) { case PR_FPEMU_NOPRINT: value = YES_STR; break; case PR_FPEMU_SIGFPE: value = "send SIGFPE"; break; default: value = UNKNOWN_STR; break; } } entry ("floating point emulation", "%s", value); } #endif #ifdef PR_GET_FPEXC /* Use the earliest version where this option was introduced * (for some architectures). */ if (LINUX_KERNEL_MMR (2, 4, 21)) { const char *value; rc = prctl (PR_GET_FPEXC, &arg2, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (arg2) { case PR_FP_EXC_SW_ENABLE: value = "software"; break; case PR_FP_EXC_DISABLED: value = "disabled"; break; case PR_FP_EXC_NONRECOV: value = "non-recoverable"; break; case PR_FP_EXC_ASYNC: value = "asynchronous"; break; case PR_FP_EXC_PRECISE: value = "precise"; break; default: value = UNKNOWN_STR; break; } } entry ("floating point exceptions", "%s", value); } #endif #ifdef PR_GET_NAME if (LINUX_KERNEL_MMR (2, 6, 11)) { rc = prctl (PR_GET_NAME, name, 0, 0, 0); if (rc < 0) entry ("process name", "%s", UNKNOWN_STR); else entry ("process name", "%s", name); } #endif #ifdef PR_GET_PDEATHSIG if (LINUX_KERNEL_MMR (2, 3, 15)) { rc = prctl (PR_GET_PDEATHSIG, &arg2, 0, 0, 0); if (rc < 0) entry ("parent death signal", "%s", UNKNOWN_STR); else if (rc == 0) entry ("parent death signal", "disabled"); else entry ("parent death signal", "%d", arg2); } #endif #ifdef PR_GET_SECCOMP if (LINUX_KERNEL_MMR (2, 6, 23)) { const char *value; rc = prctl (PR_GET_SECCOMP, 0, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (rc) { case 0: value = "disabled"; break; case 1: value = "read/write/exit (mode 1)"; break; case 2: value = "BPF (mode 2)"; break; default: value = UNKNOWN_STR; break; } } entry ("secure computing", "%s", value); } #endif #ifdef PR_GET_TIMING /* Not 100% accurate - this option was actually * introduced in 2.6.0-test4 */ if (LINUX_KERNEL_MMR (2, 6, 1)) { const char *value; rc = prctl (PR_GET_TIMING, 0, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (rc) { case PR_TIMING_STATISTICAL: value = "statistical"; break; case PR_TIMING_TIMESTAMP: value = "time-stamp"; break; default: value = UNKNOWN_STR; break; } } entry ("process timing", "%s", value); } #endif #if defined (PR_GET_TSC) && defined (PROCENV_ARCH_X86) if (LINUX_KERNEL_MMR (2, 6, 26)) { const char *value; rc = prctl (PR_GET_TSC, &arg2, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (arg2) { case PR_TSC_ENABLE: value = "enabled"; break; case PR_TSC_SIGSEGV: value = "segmentation fault"; break; default: value = UNKNOWN_STR; break; } } entry ("timestamp counter read", "%s", value); } #endif #ifdef PR_GET_UNALIGNED if (LINUX_KERNEL_MMR (2, 3, 48)) { const char *value; rc = prctl (PR_GET_UNALIGNED, &arg2, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (arg2) { case PR_UNALIGN_NOPRINT: value = "fix-up"; break; case PR_UNALIGN_SIGBUS: value = "send SIGBUS"; break; default: value = UNKNOWN_STR; break; } } entry ("unaligned access", "%s", value); } #endif #ifdef PR_MCE_KILL_GET if (LINUX_KERNEL_MMR (2, 6, 32)) { const char *value; rc = prctl (PR_MCE_KILL_GET, 0, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (rc) { case PR_MCE_KILL_DEFAULT: value = "system default"; break; case PR_MCE_KILL_EARLY: value = "early kill"; break; case PR_MCE_KILL_LATE: value = "late kill"; break; default: value = UNKNOWN_STR; break; } } entry ("machine-check exception", "%s", value); } #endif #ifdef PR_GET_NO_NEW_PRIVS if (LINUX_KERNEL_MM (3, 5)) { const char *value; rc = prctl (PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0); if (rc < 0) value = UNKNOWN_STR; else { switch (rc) { case 0: value = "normal execve"; break; case 1: value = "enabled"; break; default: value = UNKNOWN_STR; break; } } entry ("no new privileges", "%s", value); } #endif #ifdef PR_GET_TIMERSLACK if (LINUX_KERNEL_MMR (2, 6, 28)) { rc = prctl (PR_GET_TIMERSLACK, 0, 0, 0, 0); if (rc < 0) entry ("timer slack", "%s", UNKNOWN_STR); else entry ("timer slack", "%dns", rc); } #endif #ifdef PR_GET_CHILD_SUBREAPER if (LINUX_KERNEL_MM (3, 4)) { rc = prctl (PR_GET_CHILD_SUBREAPER, &arg2, 0, 0, 0); if (rc < 0) entry ("child subreaper", "%s", UNKNOWN_STR); else entry ("child subreaper", "%s", arg2 ? YES_STR : NO_STR); } #endif #ifdef PR_GET_TID_ADDRESS rc = prctl (PR_GET_TID_ADDRESS, &arg2, 0, 0, 0); if (rc < 0) entry ("clear child tid address", "%s", UNKNOWN_STR); else entry ("clear child tid address", "%p", arg2); #endif section_close (); } #endif #if defined (PROCENV_LINUX) || defined (PROCENV_GNU_BSD) void show_proc_branch_linux (void) { char buffer[1024]; char path[PATH_MAX]; char name[16]; char pid[16]; char ppid[16]; size_t len; char *p; FILE *f; char *str = NULL; common_assert (); sprintf (pid, "%d", (int)getpid ()); /* This is one God-awful interface */ while (TRUE) { sprintf (path, "/proc/%s/status", pid); f = fopen (path, "r"); if (! f) { appendf (&str, "%s", UNKNOWN_STR); goto out; } while (fgets (buffer, sizeof (buffer), f)) { len = strlen (buffer); buffer[len-1] = '\0'; if ((p=strstr (buffer, "Name:")) == buffer) { p += 1+strlen ("Name:"); /* jump over tab char */ sprintf (name, "%s", p); } if ((p=strstr (buffer, "PPid:")) == buffer) { p += 1+strlen ("PPid:"); /* jump over tab char */ sprintf (ppid, "%s", p); /* got all we need now */ break; } } fclose (f); /* ultimate parent == PID 1 == '/sbin/init' */ if (! strcmp (pid, "1")) { appendf (&str, "%s ('%s')", pid, name); break; } else { appendf (&str, "%s ('%s'), ", pid, name); } /* parent is now the pid to search for */ sprintf (pid, "%s", ppid); } out: entry ("ancestry", "%s", str); free (str); } #endif /* More verbose version of stty(1). * * Tries to obtain a tty fd by considering the standard streams if the * default fails. **/ void show_tty_attrs (void) { struct termios tty; struct termios lock_status; struct winsize size; int ret; int fds[4] = { -1, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO }; size_t i; common_assert (); fds[0] = user.tty_fd; /* For non-Linux platforms, this will force the lock * status to be unlocked. */ memset (&lock_status, '\0', sizeof (lock_status)); header ("tty"); for (i = 0; i < sizeof (fds) / sizeof (fds[0]); i++) { if (! isatty (fds[i])) continue; else { ret = tcgetattr (fds[i], &tty); if (! ret) goto work; } } /* cannot query attributes */ footer (); return; work: user.tty_fd = fds[i]; #ifdef PROCENV_LINUX get_tty_locked_status (&lock_status); #endif /*****************************************/ section_open ("c_iflag (input)"); entry ("value", "0x%x", tty.c_iflag); show_const_tty (tty, c_iflag, IGNBRK, lock_status); show_const_tty (tty, c_iflag, BRKINT, lock_status); show_const_tty (tty, c_iflag, IGNPAR, lock_status); show_const_tty (tty, c_iflag, PARMRK, lock_status); show_const_tty (tty, c_iflag, INPCK, lock_status); show_const_tty (tty, c_iflag, ISTRIP, lock_status); show_const_tty (tty, c_iflag, INLCR, lock_status); show_const_tty (tty, c_iflag, IGNCR, lock_status); show_const_tty (tty, c_iflag, ICRNL, lock_status); #if defined (PROCENV_LINUX) show_const_tty (tty, c_iflag, IUCLC, lock_status); #endif show_const_tty (tty, c_iflag, IXON, lock_status); show_const_tty (tty, c_iflag, IXANY, lock_status); show_const_tty (tty, c_iflag, IXOFF, lock_status); show_const_tty (tty, c_iflag, IMAXBEL, lock_status); #if defined (PROCENV_LINUX) show_const_tty (tty, c_iflag, IUTF8, lock_status); #endif section_close (); /*****************************************/ section_open ("c_oflag (output)"); entry ("c_oflag", "0x%x", tty.c_oflag); show_const_tty (tty, c_oflag, OPOST, lock_status); #if defined (PROCENV_LINUX) show_const_tty (tty, c_oflag, OLCUC, lock_status); #endif show_const_tty (tty, c_oflag, ONLCR, lock_status); show_const_tty (tty, c_oflag, OCRNL, lock_status); show_const_tty (tty, c_oflag, ONOCR, lock_status); show_const_tty (tty, c_oflag, ONLRET, lock_status); #if defined (PROCENV_LINUX) show_const_tty (tty, c_oflag, OFILL, lock_status); show_const_tty (tty, c_oflag, OFDEL, lock_status); show_const_tty (tty, c_oflag, NLDLY, lock_status); show_const_tty (tty, c_oflag, CRDLY, lock_status); #endif show_const_tty (tty, c_oflag, TABDLY, lock_status); #if defined (PROCENV_LINUX) show_const_tty (tty, c_oflag, BSDLY, lock_status); show_const_tty (tty, c_oflag, VTDLY, lock_status); show_const_tty (tty, c_oflag, FFDLY, lock_status); #endif section_close (); /*****************************************/ section_open ("c_cflag (control)"); entry ("value", "0x%x", tty.c_cflag); #if defined (PROCENV_LINUX) show_const_tty (tty, c_cflag, CBAUDEX, lock_status); #endif show_const_tty (tty, c_cflag, CSIZE, lock_status); show_const_tty (tty, c_cflag, CSTOPB, lock_status); show_const_tty (tty, c_cflag, CREAD, lock_status); show_const_tty (tty, c_cflag, PARENB, lock_status); show_const_tty (tty, c_cflag, PARODD, lock_status); show_const_tty (tty, c_cflag, HUPCL, lock_status); show_const_tty (tty, c_cflag, CLOCAL, lock_status); #if defined (PROCENV_LINUX) #ifdef CIBAUD show_const_tty (tty, c_cflag, CIBAUD, lock_status); #endif #ifdef CMSPAR show_const_tty (tty, c_cflag, CMSPAR, lock_status); #endif #endif show_const_tty (tty, c_cflag, CRTSCTS, lock_status); section_close (); /*****************************************/ section_open ("c_lflag (local)"); entry ("value", "0x%x", tty.c_lflag); show_const_tty (tty, c_lflag, ISIG, lock_status); #if defined (PROCENV_LINUX) show_const_tty (tty, c_lflag, XCASE, lock_status); #endif show_const_tty (tty, c_lflag, ICANON, lock_status); show_const_tty (tty, c_lflag, ECHO, lock_status); show_const_tty (tty, c_lflag, ECHOE, lock_status); show_const_tty (tty, c_lflag, ECHOK, lock_status); show_const_tty (tty, c_lflag, ECHONL, lock_status); show_const_tty (tty, c_lflag, ECHOCTL, lock_status); show_const_tty (tty, c_lflag, ECHOPRT, lock_status); show_const_tty (tty, c_lflag, ECHOKE, lock_status); show_const_tty (tty, c_lflag, FLUSHO, lock_status); show_const_tty (tty, c_lflag, NOFLSH, lock_status); show_const_tty (tty, c_lflag, TOSTOP, lock_status); show_const_tty (tty, c_lflag, PENDIN, lock_status); show_const_tty (tty, c_lflag, IEXTEN, lock_status); section_close (); /*****************************************/ section_open ("c_cc (special)"); show_cc_tty (tty, VINTR, lock_status); show_cc_tty (tty, VQUIT, lock_status); show_cc_tty (tty, VERASE, lock_status); show_cc_tty (tty, VKILL, lock_status); show_cc_tty (tty, VEOF, lock_status); show_cc_tty (tty, VTIME, lock_status); show_cc_tty (tty, VMIN, lock_status); #if defined (PROCENV_LINUX) show_cc_tty (tty, VSWTC, lock_status); #endif show_cc_tty (tty, VSTART, lock_status); show_cc_tty (tty, VSTOP, lock_status); show_cc_tty (tty, VSUSP, lock_status); show_cc_tty (tty, VEOL, lock_status); show_cc_tty (tty, VREPRINT, lock_status); show_cc_tty (tty, VDISCARD, lock_status); show_cc_tty (tty, VWERASE, lock_status); show_cc_tty (tty, VLNEXT, lock_status); show_cc_tty (tty, VEOL2, lock_status); section_close (); if (ioctl (user.tty_fd, TIOCGWINSZ, &size) < 0) die ("failed to determine terminal dimensions"); /*****************************************/ section_open ("speed"); entry ("input (baud)", "%s", get_speed (cfgetispeed (&tty))); entry ("output (baud)", "%s", get_speed (cfgetospeed (&tty))); section_close (); /*****************************************/ section_open ("winsize"); entry ("ws_row", "%u", size.ws_row); entry ("ws_col", "%u", size.ws_col); entry ("ws_xpixel", "%u", size.ws_xpixel); entry ("ws_ypixel", "%u", size.ws_ypixel); section_close (); /*****************************************/ footer (); } void show_locale (void) { struct procenv_map *p; char *value; char *v; char *saved = NULL; common_assert (); header ("locale"); v = getenv ("LANG"); entry ("LANG", "%s", v ? v : ""); v = getenv ("LANGUAGE"); entry ("LANGUAGE", "%s", v ? v : ""); value = setlocale (LC_ALL, ""); if (value) { saved = strdup (value); if (! saved) die ("failed to allocate space for locale"); } for (p = locale_map; p && p->name; p++) { value = setlocale (p->num, NULL); entry (p->name, "%s", value ? value : UNKNOWN_STR); } v = getenv ("LC_ALL"); entry ("LC_ALL", "%s", v ? v : ""); if (saved) { (void)setlocale (LC_ALL, saved); free (saved); } footer (); } const char * get_signal_name (int signum) { assert (signum); struct procenv_map *p; for (p = signal_map; p && p->name; p++) { if (signum == p->num) return p->name; } return NULL; } /** * get_os: * * Returns: static string representing best guess * at operating system. **/ char * get_os (void) { #ifdef _AIX return "AIX"; #endif #ifdef __ANDROID__ return "Android"; #endif #ifdef __FreeBSD__ return "FreeBSD"; #endif #if defined (__MACH__) || defined (__GNU__) || defined (__gnu_hurd__) return "GNU (Hurd)"; #endif #if defined (__hpux) || defined (hpux) || defined (_hpux) return "HP-UX"; #endif #if defined (OS400) || defined (__OS400__) return "iSeries (OS/400)"; #endif #if defined (PROCENV_GNU_BSD) && defined (__GNUC__) return "GNU/kFreeBSD"; #endif #ifdef PROCENV_LINUX #ifdef __s390x__ return "Linux (zSeries)"; #endif #ifdef __s390__ return "Linux (S/390)"; #endif #ifdef __sh__ return "Linux (SuperH)"; #endif return "Linux"; #endif #ifdef _NetBSD__ return "NetBSD"; #endif #ifdef _OpenBSD__ return "OpenBSD"; #endif #ifdef VMS return "OpenVMS"; #endif #if defined (sun) || defined (__sun) return "Solaris"; #endif #ifdef __osf__ return "Tru64"; #endif #ifdef WINDOWS return "Windows"; #endif #ifdef __MVS__ return "z/OS (MVS)"; #endif #ifndef __COVERITY__ return UNKNOWN_STR; #endif } /** * get_arch: * * Returns: static string representing best guess * at architecture. **/ char * get_arch (void) { #ifdef __arm__ #ifdef __ARM_PCS_VFP return "ARMhf"; #endif #ifdef __ARMEL__ return "ARMEL"; #endif return "ARM"; #endif /* not arm apparently! :) */ #ifdef __aarch64__ return "ARM64/AARCH64"; #endif #if defined (__OR1K__) || defined (__or1k__) return "OpenRISC"; #endif #ifdef __hppa__ return "HP/PA RISC"; #endif #ifdef __i386__ return "i386"; #endif #ifdef __ia64__ return "IA64"; #endif #ifdef __MIPSEL__ return "MIPSEL"; #endif #ifdef __mips__ return "MIPS"; #endif #if defined (__powerpc64__) || defined (__ppc64__) #if defined (_LITTLE_ENDIAN) return "PPC64LE"; #endif return "PPC64/PowerPC64"; #endif #ifdef __powerpc__ #if defined (__SPE__) && __SIZEOF_POINTER__ == 4 return "PPCspe"; #endif return "PowerPC"; #endif #if defined (__sparc64__) || defined (__sparc_v9__) return "Sparc64"; #endif #ifdef __sparc__ return "Sparc"; #endif #ifdef __alpha__ return "Alpha"; #endif #ifdef __m68k__ return "m68k"; #endif #ifdef __ILP32__ if (sizeof (void *) == 4) return "x32"; #endif #ifdef __sh__ return "SuperH"; #endif #if defined (__s390__) || defined (__zarch__) || defined (__SYSC_ZARCH__) || defined (__THW_370__) return "SystemZ"; #endif #if defined (__x86_64__) || defined (__x86_64) || defined (__amd64) return "x64/AMD64"; #endif return UNKNOWN_STR; } #ifndef PROCENV_ANDROID int libs_callback (struct dl_phdr_info *info, size_t size, void *data) { const char *name; const char *path; assert (info); if (! info->dlpi_name || ! *info->dlpi_name) return 0; path = info->dlpi_name; assert (path); name = strrchr (path, '/'); if (name) { /* Jump over slash */ name++; } else { /* BSD libraries don't show the path */ name = path; } object_open (FALSE); section_open (name); entry ("path", "%s", path); entry ("address", "%p", (void *)info->dlpi_addr); section_close (); object_close (FALSE); return 0; } void show_libs (void) { common_assert (); container_open ("libraries"); dl_iterate_phdr (libs_callback, NULL); container_close (); } #endif void show_clocks (void) { header ("clocks"); show_clock_res (CLOCK_REALTIME); #if defined (__FreeBSD__) show_clock_res (CLOCK_REALTIME_PRECISE); show_clock_res (CLOCK_REALTIME_FAST); #endif show_clock_res (CLOCK_MONOTONIC); #if defined (__FreeBSD__) || defined (PROCENV_GNU_BSD) show_clock_res (CLOCK_MONOTONIC_PRECISE); show_clock_res (CLOCK_MONOTONIC_FAST); show_clock_res (CLOCK_UPTIME); show_clock_res (CLOCK_UPTIME_PRECISE); show_clock_res (CLOCK_UPTIME_FAST); show_clock_res (CLOCK_VIRTUAL); #endif #if defined (__FreeBSD__) show_clock_res (CLOCK_PROF); #endif #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) #ifdef CLOCK_MONOTONIC_RAW show_clock_res (CLOCK_MONOTONIC_RAW); #endif show_clock_res (CLOCK_PROCESS_CPUTIME_ID); show_clock_res (CLOCK_THREAD_CPUTIME_ID); #endif footer (); } void show_timezone (void) { #if defined (PROCENV_LINUX) show_timezone_linux (); #else show_timezone_stub (); #endif } void show_sizeof (void) { header ("sizeof"); entry ("bits/byte (CHAR_BIT)", "%d", CHAR_BIT); show_sizeof_type (blkcnt_t); show_sizeof_type (blksize_t); show_sizeof_type (char); show_sizeof_type (clockid_t); show_sizeof_type (clock_t); show_sizeof_type (dev_t); show_sizeof_type (div_t); show_sizeof_type (double); show_sizeof_type (fenv_t); show_sizeof_type (fexcept_t); show_sizeof_type (float); show_sizeof_type (fpos_t); show_sizeof_type (fsblkcnt_t); show_sizeof_type (fsfilcnt_t); show_sizeof_type (gid_t); show_sizeof_type (id_t); show_sizeof_type (imaxdiv_t); show_sizeof_type (ino_t); show_sizeof_type (int); show_sizeof_type (int16_t); show_sizeof_type (int32_t); show_sizeof_type (int64_t); show_sizeof_type (int8_t); show_sizeof_type (int_fast16_t); show_sizeof_type (int_fast32_t); show_sizeof_type (int_fast64_t); show_sizeof_type (int_fast8_t); show_sizeof_type (int_least16_t); show_sizeof_type (int_least32_t); show_sizeof_type (int_least64_t); show_sizeof_type (int_least8_t); show_sizeof_type (intmax_t); show_sizeof_type (intptr_t); show_sizeof_type (key_t); show_sizeof_type (ldiv_t); show_sizeof_type (lldiv_t); show_sizeof_type (long double); show_sizeof_type (long int); show_sizeof_type (long long int); show_sizeof_type (mbstate_t); show_sizeof_type (mode_t); show_sizeof_type (mode_t); show_sizeof_type (nlink_t); show_sizeof_type (off_t); show_sizeof_type (pid_t); show_sizeof_type (pthread_attr_t); show_sizeof_type (pthread_barrierattr_t); show_sizeof_type (pthread_barrier_t); show_sizeof_type (pthread_condattr_t); show_sizeof_type (pthread_cond_t); show_sizeof_type (pthread_key_t); show_sizeof_type (pthread_mutexattr_t); show_sizeof_type (pthread_mutex_t); show_sizeof_type (pthread_once_t); show_sizeof_type (pthread_rwlockattr_t); show_sizeof_type (pthread_rwlock_t); show_sizeof_type (pthread_spinlock_t); show_sizeof_type (pthread_t); show_sizeof_type (ptrdiff_t); show_sizeof_type (rlim_t); show_sizeof_type (short int); show_sizeof_type (sig_atomic_t); show_sizeof_type (size_t); show_sizeof_type (ssize_t); show_sizeof_type (suseconds_t); show_sizeof_type (timer_t); show_sizeof_type (time_t); show_sizeof_type (uid_t); show_sizeof_type (uint16_t); show_sizeof_type (uint32_t); show_sizeof_type (uint64_t); show_sizeof_type (uint8_t); show_sizeof_type (uint_fast16_t); show_sizeof_type (uint_fast32_t); show_sizeof_type (uint_fast64_t); show_sizeof_type (uint_fast8_t); show_sizeof_type (uint_least16_t); show_sizeof_type (uint_least32_t); show_sizeof_type (uint_least64_t); show_sizeof_type (uint_least8_t); show_sizeof_type (uintmax_t); show_sizeof_type (uintptr_t); show_sizeof_type (useconds_t); show_sizeof_type (void *); show_sizeof_type (wchar_t); show_sizeof_type (wint_t); footer (); } void show_ranges (void) { header ("ranges"); /******************************/ section_open ("char"); show_size (char); section_open ("unsigned"); entry ("decimal", "%u to %u", 0, UCHAR_MAX); entry ("symbolic", "%u to %s", 0, "UCHAR_MAX"); entry ("scientific", "%e to %e", (double)0, (double)UCHAR_MAX); entry ("hex", "0x%.*x to 0x%.*x", type_hex_width (char), 0, type_hex_width (char), UCHAR_MAX); section_close (); section_open ("signed"); entry ("decimal", "%d to %d", SCHAR_MIN, SCHAR_MAX); entry ("symbolic", "%s to %s", "SCHAR_MIN", "SCHAR_MAX"); section_close (); section_close (); /******************************/ section_open ("short int"); show_size (short int); section_open ("unsigned"); entry ("decimal", "%u to %u", 0, USHRT_MAX); entry ("symbolic", "%u to %s", 0, "USHRT_MAX"); entry ("scientific", "%e to %e", (double)0, (double)USHRT_MAX); entry ("hex", "0x%.*x to 0x%.*x", type_hex_width (short int), 0, type_hex_width (short int), USHRT_MAX); section_close (); section_open ("signed"); entry ("decimal", "%d to %d", SHRT_MIN, SHRT_MAX); entry ("symbolic", "%s to %s", "SHRT_MIN", "SHRT_MAX"); section_close (); section_close (); /******************************/ section_open ("int"); show_size (int); section_open ("unsigned"); entry ("decimal", "%u to %u", 0, UINT_MAX); entry ("symbolic", "%u to %s", 0, "UINT_MAX"); entry ("scientific", "%e to %e", (double)0, (double)UINT_MAX); entry ("hex", "0x%.*x to 0x%.*x", type_hex_width (int), 0, type_hex_width (int), UINT_MAX); section_close (); section_open ("signed"); entry ("decimal", "%d to %d", INT_MIN, INT_MAX); entry ("symbolic", "%s to %s", "INT_MIN", "INT_MAX"); section_close (); section_close (); /******************************/ section_open ("long int"); show_size (long int); section_open ("unsigned"); entry ("decimal", "%u to %u", 0, ULONG_MAX); entry ("symbolic", "%u to %s", 0, "ULONG_MAX"); entry ("scientific", "%e to %e", (double)0, (double)ULONG_MAX); entry ("hex", "0x%.*x to 0x%.*x", type_hex_width (long int), 0L, type_hex_width (long int), ULONG_MAX); section_close (); section_open ("signed"); entry ("decimal", "%ld to %ld", LONG_MIN, LONG_MAX); entry ("symbolic", "%s to %s", "LONG_MIN", "LONG_MAX"); section_close (); section_close (); /******************************/ section_open ("long long int"); show_size (long long int); section_open ("unsigned"); entry ("decimal", "%llu to %llu", 0, ULLONG_MAX); entry ("symbolic", "%u to %s", 0, "ULLONG_MAX"); entry ("scientific", "%e to %e", (double)0, (double)ULLONG_MAX); entry ("hex", "0x%.*llx to 0x%.*llx", type_hex_width (long long int), 0LL, type_hex_width (long long int), ULLONG_MAX); section_close (); section_open ("signed"); entry ("decimal", "%lld to %lld", LLONG_MIN, LLONG_MAX); entry ("symbolic", "%s to %s", "LLONG_MIN", "LLONG_MAX"); section_close (); section_close (); /******************************/ section_open ("float"); show_size (float); entry ("signed", "%e to %e", FLT_MIN, FLT_MAX); entry ("symbolic", "%s to %s", "FLT_MIN", "FLT_MAX"); section_close (); /******************************/ section_open ("double"); show_size (double); entry ("signed", "%le to %le", DBL_MIN, DBL_MAX); entry ("symbolic", "%s to %s", "DBL_MIN", "DBL_MAX"); section_close (); /******************************/ section_open ("long double"); show_size (long double); entry ("signed", "%Le to %Le", LDBL_MIN, LDBL_MAX); entry ("symbolic", "%s to %s", "LDBL_MIN", "LDBL_MAX"); section_close (); /******************************/ footer (); } void show_compiler (void) { char *name = NULL; char *version = NULL; #if defined (__INTEL_COMPILER) name = "Intel"; version = __ICC; #elif defined (__clang__) name = "Clang/LLVM"; version = __clang_version__; #elif defined (__GNUC__) name = "GCC"; version = __VERSION__; #endif header ("compiler"); entry ("name", "%s", name ? name : UNKNOWN_STR); entry ("version", "%s", version ? version : UNKNOWN_STR); #if defined (PROCENV_REPRODUCIBLE_BUILD) entry ("compile date (__DATE__)", "%s", SUPPRESSED_STR); entry ("compile time (__TIME__)", "%s", SUPPRESSED_STR); #ifdef __TIMESTAMP__ entry ("timestamp (__TIMESTAMP__)", "%s", SUPPRESSED_STR); #endif #else entry ("compile date (__DATE__)", "%s", __DATE__); entry ("compile time (__TIME__)", "%s", __TIME__); #ifdef __TIMESTAMP__ entry ("timestamp (__TIMESTAMP__)", "%s", __TIMESTAMP__); #endif #endif entry ("translation unit (__FILE__)", "%s", __FILE__); entry ("base file (__BASE_FILE__)", "%s", __BASE_FILE__); section_open ("feature test macros"); #ifdef __STDC_VERSION__ entry ("__STDC_VERSION__", "%lu", __STDC_VERSION__); #else entry ("__STDC_VERSION__", "%s", NOT_DEFINED_STR); #endif #ifdef __STRICT_ANSI__ entry ("__STRICT_ANSI__", "%s", DEFINED_STR); #else entry ("__STRICT_ANSI__", "%s", NOT_DEFINED_STR); #endif #ifdef _POSIX_C_SOURCE entry ("_POSIX_C_SOURCE", "%lu", _POSIX_C_SOURCE); #else entry ("_POSIX_C_SOURCE", "%s", NOT_DEFINED_STR); #endif #if defined (_POSIX_RAW_SOCKETS) entry ("_POSIX_RAW_SOCKETS", "%s", DEFINED_STR), #else entry ("_POSIX_RAW_SOCKETS", "%s", NOT_DEFINED_STR), #endif #ifdef _POSIX_SOURCE entry ("_POSIX_SOURCE", "%s", DEFINED_STR); #else entry ("_POSIX_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _XOPEN_SOURCE entry ("_XOPEN_SOURCE", "%lu", _XOPEN_SOURCE); #else entry ("_XOPEN_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _XOPEN_SOURCE_EXTENDED entry ("_XOPEN_SOURCE_EXTENDED", "%s", DEFINED_STR); #else entry ("_XOPEN_SOURCE_EXTENDED", "%s", NOT_DEFINED_STR); #endif #ifdef _ISOC95_SOURCE entry ("_ISOC95_SOURCE", "%s", DEFINED_STR); #else entry ("_ISOC95_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _ISOC99_SOURCE entry ("_ISOC99_SOURCE", "%s", DEFINED_STR); #else entry ("_ISOC99_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _ISOC11_SOURCE entry ("_ISOC11_SOURCE", "%s", DEFINED_STR); #else entry ("_ISOC11_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _LARGEFILE_SOURCE entry ("_LARGEFILE_SOURCE", "%s", DEFINED_STR); #else entry ("_LARGEFILE_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _LARGEFILE64_SOURCE entry ("_LARGEFILE64_SOURCE", "%s", DEFINED_STR); #else entry ("_LARGEFILE64_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _FILE_OFFSET_BITS entry ("_FILE_OFFSET_BITS", "%lu", _FILE_OFFSET_BITS); #else entry ("_FILE_OFFSET_BITS", "%s", NOT_DEFINED_STR); #endif #ifdef _BSD_SOURCE entry ("_BSD_SOURCE", "%s", DEFINED_STR); #else entry ("_BSD_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _SVID_SOURCE entry ("_SVID_SOURCE", "%s", DEFINED_STR); #else entry ("_SVID_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _ATFILE_SOURCE entry ("_ATFILE_SOURCE", "%s", DEFINED_STR); #else entry ("_ATFILE_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _GNU_SOURCE entry ("_GNU_SOURCE", "%s", DEFINED_STR); #else entry ("_GNU_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _REENTRANT entry ("_REENTRANT", "%s", DEFINED_STR); #else entry ("_REENTRANT", "%s", NOT_DEFINED_STR); #endif #ifdef _THREAD_SAFE entry ("_THREAD_SAFE", "%s", DEFINED_STR); #else entry ("_THREAD_SAFE", "%s", NOT_DEFINED_STR); #endif #ifdef _FORTIFY_SOURCE entry ("_FORTIFY_SOURCE", "%s", DEFINED_STR); #else entry ("_FORTIFY_SOURCE", "%s", NOT_DEFINED_STR); #endif #ifdef _DEFAULT_SOURCE entry ("_DEFAULT_SOURCE", "%s", DEFINED_STR); #else entry ("_DEFAULT_SOURCE", "%s", NOT_DEFINED_STR); #endif section_close (); footer (); } void show_libc (void) { char *name = NULL; long version = -1; long minor = -1; #if defined (__GLIBC__) name = "GNU libc (glibc)"; version = __GLIBC__; #ifdef __GLIBC_MINOR__ minor = __GLIBC_MINOR__; #endif #endif #if defined (__UCLIBC__) name = "uClibc"; #ifdef __UCLIBC_MAJOR__ version = __UCLIBC_MAJOR__; #endif #ifdef __UCLIBC_MINOR__ minor = __UCLIBC_MINOR__; #endif #endif #if defined (__KLIBC__) name = "klibc"; version = __KLIBC__; #ifdef __KLIBC_MINOR__ minor = __KLIBC_MINOR__; #endif #endif #if defined (__dietlibc__) name = "dietlibc"; #endif #if defined (__BIONIC__) name = "bionic"; #endif header ("libc"); entry ("name", "%s", name ? name : UNKNOWN_STR); if (version >= 0) { entry ("version", "%lu", version); } else { entry ("version", "%s", UNKNOWN_STR); } if (minor >= 0) { entry ("minor", "%lu", minor); } else { entry ("minor", "%s", UNKNOWN_STR); } footer (); } void show_time (void) { char formatted_time[CTIME_BUFFER]; struct timespec ts; struct tm *tm; if (clock_gettime (CLOCK_REALTIME, &ts) < 0) die ("failed to determine time"); tm = localtime (&ts.tv_sec); if (! tm) die ("failed to determine localtime"); if (! asctime_r (tm, formatted_time)) die ("failed to determine formatted time"); /* overwrite trailing '\n' */ formatted_time[strlen (formatted_time)-1] = '\0'; header ("time"); entry ("raw", "%u.%lu", (unsigned int)ts.tv_sec, ts.tv_nsec); entry ("local", "%s", formatted_time); entry ("ISO", "%4.4d-%2.2d-%2.2dT%2.2d:%2.2d", 1900+tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min); footer (); } void get_uname (void) { if (uname (&uts) < 0) die ("failed to query uname"); } void show_uname (void) { header ("uname"); entry ("sysname", "%s", uts.sysname); entry ("nodename", "%s", uts.nodename); entry ("release", "%s", uts.release); entry ("version", "%s", uts.version); entry ("machine", "%s", uts.machine); #if defined (_GNU_SOURCE) && defined (PROCENV_LINUX) entry ("domainname", "%s", uts.domainname[0] ? uts.domainname : UNKNOWN_STR); #endif footer (); } void show_cgroups (void) { #if defined (PROCENV_LINUX) show_cgroups_linux (); #else show_cgroups_stub (); #endif } void show_oom (void) { #if defined (PROCENV_LINUX) show_oom_linux (); #else show_oom_stub (); #endif } void show_capabilities (void) { #if defined (PROCENV_LINUX) show_capabilities_linux (); #else show_capabilities_stub (); #endif } #if defined (PROCENV_LINUX) #if defined (HAVE_SYS_CAPABILITY_H) int get_capability_by_flag_type (cap_t cap_p, cap_flag_t type, cap_value_t cap) { int ret; cap_flag_value_t result; assert (cap_p); ret = cap_get_flag (cap_p, cap, type, &result); return ret < 0 ? ret : result; } #endif /* HAVE_SYS_CAPABILITY_H */ void show_capabilities_linux (void) { #if defined (HAVE_SYS_CAPABILITY_H) int last_known; cap_t caps; /* Most recently-added capability that procenv knew about at * compile time. */ last_known = CAP_LAST_CAP; #endif header ("capabilities"); #if defined (HAVE_SYS_CAPABILITY_H) caps = cap_get_proc (); entry ("count (CAP_LAST_CAP+1)", "%d", CAP_LAST_CAP+1); if (! caps) goto out; section_open ("known"); show_capability (caps, CAP_CHOWN); show_capability (caps, CAP_DAC_OVERRIDE); show_capability (caps, CAP_DAC_READ_SEARCH); show_capability (caps, CAP_FOWNER); show_capability (caps, CAP_FSETID); show_capability (caps, CAP_KILL); show_capability (caps, CAP_SETGID); show_capability (caps, CAP_SETUID); show_capability (caps, CAP_SETPCAP); show_capability (caps, CAP_LINUX_IMMUTABLE); show_capability (caps, CAP_NET_BIND_SERVICE); show_capability (caps, CAP_NET_BROADCAST); show_capability (caps, CAP_NET_ADMIN); show_capability (caps, CAP_NET_RAW); show_capability (caps, CAP_IPC_LOCK); show_capability (caps, CAP_IPC_OWNER); show_capability (caps, CAP_SYS_MODULE); show_capability (caps, CAP_SYS_RAWIO); show_capability (caps, CAP_SYS_CHROOT); show_capability (caps, CAP_SYS_PTRACE); show_capability (caps, CAP_SYS_PACCT); show_capability (caps, CAP_SYS_ADMIN); show_capability (caps, CAP_SYS_BOOT); show_capability (caps, CAP_SYS_NICE); show_capability (caps, CAP_SYS_RESOURCE); show_capability (caps, CAP_SYS_TIME); show_capability (caps, CAP_SYS_TTY_CONFIG); if (LINUX_KERNEL_MM (2, 4)) { show_capability (caps, CAP_MKNOD); show_capability (caps, CAP_LEASE); } if (LINUX_KERNEL_MMR (2, 6, 11)) { show_capability (caps, CAP_AUDIT_WRITE); show_capability (caps, CAP_AUDIT_CONTROL); } if (LINUX_KERNEL_MMR (2, 6, 24)) show_capability (caps, CAP_SETFCAP); if (LINUX_KERNEL_MMR (2, 6, 25)) { show_capability (caps, CAP_MAC_OVERRIDE); show_capability (caps, CAP_MAC_ADMIN); } #ifdef CAP_SYSLOG if (LINUX_KERNEL_MMR (2, 6, 37)) show_capability (caps, CAP_SYSLOG); #endif #ifdef CAP_WAKE_ALARM if (LINUX_KERNEL_MM (3, 0)) show_capability (caps, CAP_WAKE_ALARM); #endif #ifdef CAP_BLOCK_SUSPEND if (LINUX_KERNEL_MM (3, 5)) show_capability (caps, CAP_BLOCK_SUSPEND); #endif #ifdef CAP_AUDIT_READ if (LINUX_KERNEL_MM (3, 16)) { show_capability (caps, CAP_AUDIT_READ); } #endif section_close (); /* It's possible that procenv is running on a system which has * more capabilities that the system it was built on (for * example, it might be running in a chroot with a newer kernel * than the chroot environment). So display any unknown * capabilities. We don't have their names, but it's useful to * see that there are additional capabilities in available in * the environment. */ section_open ("unknown"); #if defined (PR_CAPBSET_READ) for (int i = 1+last_known; ; i++) { int ret; char *name = NULL; ret = cap_get_bound (i); if (ret < 0) break; /* Found an "unknown" */ appendf (&name, "CAP_LAST_CAP+%d", i); _show_capability (caps, i, name); free (name); } #endif cap_free (caps); section_close (); #ifdef PR_GET_KEEPCAPS if (LINUX_KERNEL_MMR (2, 2, 18)) { int ret; ret = prctl (PR_GET_KEEPCAPS, 0, 0, 0, 0); if (ret < 0) entry ("keep", "%s", UNKNOWN_STR); else entry ("keep", "%s", ret ? YES_STR : NO_STR); } #endif #if defined (PR_GET_SECUREBITS) && defined (HAVE_LINUX_SECUREBITS_H) if (LINUX_KERNEL_MMR (2, 6, 26)) { int ret; ret = prctl (PR_GET_SECUREBITS, 0, 0, 0, 0); if (ret < 0) entry ("securebits", "%s", UNKNOWN_STR); else { struct securebits_t { unsigned int securebits; } flags; flags.securebits = (unsigned int)ret; section_open ("securebits"); entry ("value", "0x%x", flags.securebits); container_open ("fields"); show_const (flags, securebits, SECBIT_KEEP_CAPS); show_const (flags, securebits, SECBIT_NO_SETUID_FIXUP); show_const (flags, securebits, SECBIT_NOROOT); container_close (); section_close (); } } #endif out: #endif /* HAVE_SYS_CAPABILITY_H */ footer (); } #if defined (HAVE_SYS_CAPABILITY_H) #ifdef PROCENV_NEED_LOCAL_CAP_GET_BOUND int cap_get_bound (cap_value_t cap) { #if defined (PR_CAPBSET_READ) return prctl (PR_CAPBSET_READ, cap); #else return -1; #endif } #endif /* PROCENV_NEED_LOCAL_CAP_GET_BOUND */ #endif /* HAVE_SYS_CAPABILITY_H */ void show_timezone_linux (void) { tzset (); header ("timezone"); entry ("tzname[0]", "'%s'", tzname[0]); entry ("tzname[1]", "'%s'", tzname[1]); entry ("timezone", "%ld", timezone); entry ("daylight", "%d", daylight); footer (); } void show_security_module_linux (void) { char *lsm = UNKNOWN_STR; #if defined (HAVE_APPARMOR) if (aa_is_enabled ()) lsm = "AppArmor"; #endif #if defined (HAVE_SELINUX_SELINUX_H) if (is_selinux_enabled () == 1) { if (is_selinux_mls_enabled () == 1) lsm = "SELinux (MLS)"; else lsm = "SELinux"; } #endif entry ("name", "%s", lsm); } void show_security_module_context_linux (void) { char *context = NULL; char *mode = NULL; #if defined (HAVE_APPARMOR) if (aa_is_enabled ()) { /* XXX: The mode string is *NOT* be freed since it forms * part of the allocation returned in context. * * See aa_gettaskcon(2) for details. */ if (aa_gettaskcon (user.pid, &context, &mode) < 0) die ("failed to query AppArmor context"); } #endif #if defined (HAVE_SELINUX_SELINUX_H) if (is_selinux_enabled ()) { if (getpidcon (user.pid, &context) < 0) die ("failed to query SELinux context"); } #endif if (context) { if (mode) { entry ("context", "%s (%s)", context, mode); } else { entry ("context", "%s", context); } } else { entry ("context", "%s", UNKNOWN_STR); } free (context); } void show_cgroups_linux (void) { const char *delim = ":"; char *file = "/proc/self/cgroup"; FILE *f; char buffer[1024]; size_t len; header ("cgroups"); f = fopen (file, "r"); if (! f) goto out; while (fgets (buffer, sizeof (buffer), f)) { char *buf, *b; char *hierarchy; char *subsystems; char *path; len = strlen (buffer); /* Remove NL */ buffer[len-1] = '\0'; buf = b = strdup (buffer); if (! buf) die ("failed to alloate storage"); hierarchy = strsep (&b, delim); if (! hierarchy) goto next; subsystems = strsep (&b, delim); if (! subsystems) goto next; path = strsep (&b, delim); if (! path) goto next; /* FIXME: should sort by hierarchy */ container_open (hierarchy); object_open (FALSE); /* FIXME: should split this on comma */ entry ("subsystems", "%s", subsystems); entry ("path", "%s", path); object_close (FALSE); container_close (); next: free (buf); } fclose (f); out: footer (); } void show_fds_linux (void) { DIR *dir; struct dirent *ent; char *prefix_path = "/proc/self/fd"; struct stat st; char path[MAXPATHLEN]; char link[MAXPATHLEN]; ssize_t len; container_open ("file descriptors"); dir = opendir (prefix_path); if (! dir) return; while ((ent=readdir (dir)) != NULL) { int fd; char *num = NULL; if (! strcmp (ent->d_name, ".") || ! strcmp (ent->d_name, "..")) continue; sprintf (path, "%s/%s", prefix_path, ent->d_name); fd = atoi (ent->d_name); len = readlink (path, link, sizeof (link)-1); if (len < 0) /* ignore errors */ continue; appendf (&num, "%d", fd); assert (len); link[len] = '\0'; if (link[0] == '/') { if (stat (link, &st) < 0) { free (num); continue; } /* Ignore the last (invalid) entry */ if (S_ISDIR (st.st_mode)) { free (num); continue; } } object_open (FALSE); section_open (num); free (num); entry ("terminal", "%s", isatty (fd) ? YES_STR : NO_STR); entry ("valid", "%s", fd_valid (fd) ? YES_STR : NO_STR); entry ("device", "%s", link); section_close (); object_close (FALSE); } closedir (dir); container_close (); } void show_namespaces_linux (void) { DIR *dir; struct dirent *ent; char *prefix_path = "/proc/self/ns"; char path[MAXPATHLEN]; char link[MAXPATHLEN]; ssize_t len; PRList *list = NULL; container_open ("namespaces"); dir = opendir (prefix_path); if (! dir) goto end; list = pr_list_new (NULL); assert (list); while ((ent=readdir (dir)) != NULL) { PRList *entry; if (! strcmp (ent->d_name, ".") || ! strcmp (ent->d_name, "..")) continue; sprintf (path, "%s/%s", prefix_path, ent->d_name); len = readlink (path, link, sizeof (link)-1); if (len < 0) /* ignore errors */ continue; assert (len); link[len] = '\0'; entry = pr_list_new (strdup (link)); assert (entry); assert (pr_list_prepend_str_sorted (list, entry)); } closedir (dir); PR_LIST_FOREACH_SAFE (list, iter) { char *tmp; char *name; char *value; pr_list_remove (iter); tmp = iter->data; name = strsep (&tmp, ":"); if (! name) goto give_up; value = strsep (&tmp, "]"); if (! value) goto give_up; if (*value == '[' && value+1 && *(value+1)) { value++; } object_open (FALSE); entry (name, "%s", value); object_close (FALSE); give_up: free ((char *)iter->data); free(iter); } free_if_set (list); end: container_close (); } void show_oom_linux (void) { char *dir = "/proc/self"; char *files[] = { "oom_score", "oom_adj", "oom_score_adj", NULL }; char **file; FILE *f; char buffer[PROCENV_BUFFER]; char path[PATH_MAX]; size_t len; int ret; int seen = FALSE; header ("oom"); for (file = files; file && *file; file++) { ret = sprintf (path, "%s/%s", dir, *file); if (ret < 0) continue; f = fopen (path, "r"); if (! f) continue; seen = TRUE; while (fgets (buffer, sizeof (buffer), f)) { len = strlen (buffer); buffer[len-1] = '\0'; entry (*file, "%s", buffer); } fclose (f); } if (! seen) entry ("%s", UNKNOWN_STR); footer (); } char * get_scheduler_name (int sched) { struct procenv_map *p; for (p = scheduler_map; p && p->name; p++) { if (p->num == sched) return p->name; } return NULL; } void show_cpu_linux (void) { int cpu = -1; long max; max = get_sysconf (_SC_NPROCESSORS_ONLN); #if HAVE_SCHED_GETCPU cpu = sched_getcpu (); if (cpu < 0) goto unknown_sched_cpu; #else cpu = procenv_getcpu (); if (cpu < 0) goto unknown_sched_cpu; #endif /* adjust to make 1-based */ cpu++; entry ("number", "%u of %ld", cpu, max); return; unknown_sched_cpu: entry ("number", "%s of %ld", UNKNOWN_STR, max); } #if ! defined (HAVE_SCHED_GETCPU) /* Crutch function for RHEL 5 */ int procenv_getcpu (void) { int cpu = -1; FILE *f; char **fields; const char *field; char buffer[1024]; size_t len; size_t count; f = fopen ("/proc/self/stat", "r"); if (! f) goto out; if (! fgets (buffer, sizeof (buffer), f)) goto out; fclose (f); len = strlen (buffer); buffer[len-1] = '\0'; count = split_fields (buffer, ' ', TRUE, &fields); if (! count) return -1; if (count != 42) goto cleanup; field = fields[41]; assert (field); cpu = atoi (field); cleanup: for (len = 0; len < count; len++) free (fields[len]); free (fields); out: return cpu; } #endif /** * get_canonical: * * @path: path to convert to canonical form, * @canonical [out]: canonical version of @path, * @len: Size of @canonical (should be atleast PATH_MAX). * * FIXME: this should fully resolve not just sym links but replace all * occurences of '../' by the appropriate direcotry! **/ int get_canonical (const char *path, char *canonical, size_t len) { ssize_t bytes; int ret = TRUE; assert (path); assert (canonical); assert (len); bytes = readlink (path, canonical, len); if (bytes < 0) { sprintf (canonical, UNKNOWN_STR); ret = FALSE; } else { canonical[bytes <= len ? bytes : len] = '\0'; } return ret; } void get_tty_locked_status (struct termios *lock_status) { assert (lock_status); assert (user.tty_fd != -1); if (ioctl (user.tty_fd, TIOCGLCKTRMIOS, lock_status) < 0) { /* Set to unlocked */ memset (lock_status, '\0', sizeof (struct termios)); } } #else void show_namespaces_stub (void) { header ("namespaces"); footer (); } void show_cgroups_stub (void) { header ("cgroups"); footer (); } void show_oom_stub (void) { header ("oom"); footer (); } void show_timezone_stub (void) { header ("timezone"); footer (); } void show_capabilities_stub (void) { header ("capabilities"); footer (); } void show_shared_mem_stub (void) { header ("shared memory"); footer (); } void show_semaphores_stub (void) { header ("semaphores"); footer (); } void show_msg_queues_stub (void) { header ("message queues"); footer (); } #endif /* PROCENV_LINUX */ bool has_ctty (void) { int fd; fd = open ("/dev/tty", O_RDONLY | O_NOCTTY); if (fd < 0) return FALSE; close (fd); return TRUE; } #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) void show_cpu_bsd (void) { long max; kvm_t *kvm; struct kinfo_proc *proc; int ignored; int cpu; char errors[_POSIX2_LINE_MAX]; assert (user.pid > 0); max = get_sysconf (_SC_NPROCESSORS_ONLN); kvm = kvm_openfiles (NULL, _PATH_DEVNULL, NULL, O_RDONLY, errors); if (! kvm) die ("unable to open kvm"); proc = kvm_getprocs (kvm, KERN_PROC_PID, user.pid, &ignored); if (! proc) die ("failed to get process info"); /* cpu values are zero-based */ cpu = 1 + proc->ki_oncpu; if (kvm_close (kvm) < 0) die ("failed to close kvm"); entry ("number", "%u of %lu", cpu, max); } void get_misc_bsd (void) { char errors[_POSIX2_LINE_MAX]; kvm_t *kvm; struct kinfo_proc *proc; int ignored; kvm = kvm_openfiles (NULL, _PATH_DEVNULL, NULL, O_RDONLY, errors); if (! kvm) die ("unable to open kvm"); proc = kvm_getprocs (kvm, KERN_PROC_PID, user.pid, &ignored); if (! proc) die ("failed to get process info"); misc.in_jail = (proc->ki_flag & P_JAILED) ? TRUE : FALSE; strcpy (user.proc_name, proc->ki_comm); if (kvm_close (kvm) < 0) die ("failed to close kvm"); } #endif int get_output_value (const char *name) { struct procenv_map *p; assert (name); for (p = output_map; p && p->name; p++) { if (! strcmp (name, p->name)) { return p->num; } } die ("invalid output value: '%s'", name); /* compiler appeasement */ return -1; } int get_output_format (const char *name) { struct procenv_map *p; assert (name); for (p = output_format_map; p && p->name; p++) { if (! strcmp (name, p->name)) { return p->num; } } die ("invalid output format value: '%s'", name); /* compiler appeasement */ return -1; } const char * get_output_format_name (void) { struct procenv_map *p; for (p = output_format_map; p && p->name; p++) { if (output_format == p->num) return p->name; } bug ("invalid output format: %d", output_format); /* compiler appeasement */ return NULL; } void check_envvars (void) { char *e; char *token; char *string; size_t count = 0; size_t i; e = getenv (PROCENV_OUTPUT_ENV); if (e && *e) { output = get_output_value (e); } e = getenv (PROCENV_FILE_ENV); if (e && *e) { output_file = e; output = OUTPUT_FILE; } e = getenv (PROCENV_FORMAT_ENV); if (e && *e) { output_format = get_output_format (e); } e = getenv (PROCENV_INDENT_ENV); if (e && *e) { indent_amount = atoi (e); } e = getenv (PROCENV_INDENT_CHAR_ENV); if (e && *e) { /* Special character handling */ if (! strcmp (e, "\\t")) indent_char = "\t"; else indent_char = e; } e = getenv (PROCENV_SEPARATOR_ENV); if (e && *e) { text_separator = e; } e = getenv (PROCENV_CRUMB_SEPARATOR_ENV); if (e && *e) { if (! strcmp (e, "\\t")) crumb_separator = "\t"; else crumb_separator = e; } e = getenv (PROCENV_EXEC_ENV); if (e && *e) { char *tmp; string = strdup (e); if (! string) die ("failed to copy environment string"); /* establish number of fields */ for (tmp = string; tmp && *tmp; ) { tmp = index (tmp, ' '); if (tmp) { /* jump over matched char */ tmp++; count++; } } /* allocate space for arguments. * +1 for terminator. */ exec_args = calloc (count + 1, sizeof (char *)); if (! exec_args) die ("failed to allocate space for args copy"); /* build the argument array */ tmp = string; for (token = strsep (&tmp, " "), i=0; token; token = strsep (&tmp, " "), i++) { exec_args[i] = strdup (token); if (! exec_args[i]) die ("failed to allocate space for exec arg"); } free (string); } } int get_major_minor (const char *path, unsigned int *_major, unsigned int *_minor) { struct stat st; assert (path); assert (_major); assert (_minor); if (stat (path, &st) < 0) { /* Don't fail as this query may be for a mount which the * user does not have permission to check. */ *_major = *_minor = 0; return FALSE; } *_major = major (st.st_dev); *_minor = minor (st.st_dev); return TRUE; } /** * Find full path to @argv0. * * Returns: newly-allocated path to @argv0, or NULL on error. * * Note that returned path will not necessarily be the canonical path, * so it should be passed to readlink(2). **/ char * get_path (const char *argv0) { char *slash; char *path; char *prog_path = NULL; char *tmp; char *element; char possible[PATH_MAX]; struct stat statbuf; assert (argv0); slash = strchr (argv0, '/'); if (slash == argv0) { /* absolute path */ return strdup (argv0); } else if (slash) { char cwd[PATH_MAX]; size_t bytes; size_t len; memset (cwd, '\0', sizeof (cwd)); bytes = sizeof (cwd); /* relative path */ assert (getcwd (cwd, bytes)); len = strlen (cwd); bytes -= len; strncat (cwd, "/", bytes); bytes -= strlen ("/"); strncat (cwd, argv0, bytes); cwd[sizeof (cwd) - 1] = '\0'; if (! stat (cwd, &statbuf)) return strdup (cwd); return NULL; } /* path search required */ tmp = getenv ("PATH"); path = strdup (tmp ? tmp : _PATH_STDPATH); assert (path); tmp = path; for (element = strsep (&tmp, ":"); element; element = strsep (&tmp, ":")) { sprintf (possible, "%s%s%s", element, element [strlen (element)-1] == '/' ? "" : "/", argv0); if (! stat (possible, &statbuf)) { prog_path = strdup (possible); break; } } free (path); return prog_path; } void show_threads (void) { size_t stack_size = 0; size_t guard_size = 0; pthread_attr_t attr; int scope; int sched; int inherit_sched; int ret; struct sched_param param; header ("threads"); /* cannot fail */ (void) pthread_attr_init (&attr); (void) pthread_attr_getstacksize (&attr, &stack_size); entry ("stack size", "%lu bytes", (unsigned long int)stack_size); #if defined (PROCENV_ANDROID) ret = 0; scope = pthread_attr_getscope (&attr); #else ret = pthread_attr_getscope (&attr, &scope); #endif entry ("scope", "%s", ret != 0 ? UNKNOWN_STR : scope == PTHREAD_SCOPE_SYSTEM ? "PTHREAD_SCOPE_SYSTEM" : "PTHREAD_SCOPE_PROCESS"); ret = pthread_attr_getguardsize (&attr, &guard_size); if (ret == 0) { entry ("guard size", "%lu bytes", (unsigned long int)guard_size); } else { entry ("guard size", "%s", UNKNOWN_STR); } ret = pthread_getschedparam (pthread_self (), &sched, ¶m); section_open ("scheduler"); entry ("type", "%s", ret != 0 ? UNKNOWN_STR : get_thread_scheduler_name (sched)); if (ret != 0) entry ("priority", "%s", UNKNOWN_STR); else entry ("priority", "%d", param.sched_priority); #ifdef PROCENV_ANDROID section_close (); #else ret = pthread_attr_getinheritsched (&attr, &inherit_sched); entry ("inherit-scheduler attribute", "%s", ret != 0 ? UNKNOWN_STR : inherit_sched == PTHREAD_INHERIT_SCHED ? "PTHREAD_INHERIT_SCHED" : "PTHREAD_EXPLICIT_SCHED"); section_close (); entry ("concurrency", "%d", pthread_getconcurrency ()); #endif footer (); } const char * get_thread_scheduler_name (int sched) { struct procenv_map *p; for (p = thread_sched_policy_map; p && p->name; p++) { if (p->num == sched) return p->name; } return NULL; } #define DATA_MODEL(array, i, l, p) \ (array[0] == i && array[1] == l && array[2] == p) void show_data_model (void) { int ilp[3]; char data_model[16]; size_t pointer_size; ilp[0] = sizeof (int); ilp[1] = sizeof (long); ilp[2] = sizeof (void *); pointer_size = ilp[2]; if (DATA_MODEL (ilp, 2, 4, 4)) sprintf (data_model, "LP32"); else if (DATA_MODEL (ilp, 4, 4, 4)) sprintf (data_model, "ILP32"); else if (DATA_MODEL (ilp, 4, 4, 8) && sizeof (long long) == pointer_size) sprintf (data_model, "LLP64"); else if (DATA_MODEL (ilp, 4, 8, 8)) sprintf (data_model, "LP64"); else if (DATA_MODEL (ilp, 8, 8, 8)) sprintf (data_model, "ILP64"); else sprintf (data_model, UNKNOWN_STR); if (pointer_size > 8) die ("%d-byte pointers not supported", (int)pointer_size); entry ("data model", "%s (%d/%d/%d)", data_model, ilp[0], ilp[1], ilp[2]); } #undef DATA_MODEL int main (int argc, char *argv[]) { int option; int long_index; int done = FALSE; struct option long_options[] = { {"meta" , no_argument, NULL, 'a'}, {"arguments" , no_argument, NULL, 'A'}, {"libs" , no_argument, NULL, 'b'}, {"libc" , no_argument, NULL, 'B'}, {"cgroups" , no_argument, NULL, 'c'}, {"cpu" , no_argument, NULL, 'C'}, {"compiler" , no_argument, NULL, 'd'}, {"crumb-separator" , required_argument, NULL, 0}, {"environment" , no_argument, NULL, 'e'}, {"semaphores" , no_argument, NULL, 'E'}, {"fds" , no_argument, NULL, 'f'}, {"namespaces" , no_argument, NULL, 'F'}, {"sizeof" , no_argument, NULL, 'g'}, {"help" , no_argument, NULL, 'h'}, {"misc" , no_argument, NULL, 'i'}, {"uname" , no_argument, NULL, 'j'}, {"clocks" , no_argument, NULL, 'k'}, {"limits" , no_argument, NULL, 'l'}, {"locale" , no_argument, NULL, 'L'}, {"mounts" , no_argument, NULL, 'm'}, {"message-queues" , no_argument, NULL, 'M'}, {"confstr" , no_argument, NULL, 'n'}, {"network" , no_argument, NULL, 'N'}, {"oom" , no_argument, NULL, 'o'}, {"process" , no_argument, NULL, 'p'}, {"platform" , no_argument, NULL, 'P'}, {"time" , no_argument, NULL, 'q'}, {"ranges" , no_argument, NULL, 'r'}, {"signals" , no_argument, NULL, 's'}, {"shared-memory" , no_argument, NULL, 'S'}, {"tty" , no_argument, NULL, 't'}, {"threads" , no_argument, NULL, 'T'}, {"stat" , no_argument, NULL, 'u'}, {"rusage" , no_argument, NULL, 'U'}, {"version" , no_argument, NULL, 'v'}, {"capabilities" , no_argument, NULL, 'w'}, {"pathconf" , no_argument, NULL, 'x'}, {"sysconf" , no_argument, NULL, 'y'}, {"memory" , no_argument, NULL, 'Y'}, {"timezone" , no_argument, NULL, 'z'}, {"exec" , no_argument , NULL, 0}, {"file" , required_argument, NULL, 0}, {"format" , required_argument, NULL, 0}, {"indent" , required_argument, NULL, 0}, {"indent-char" , required_argument, NULL, 0}, {"output" , required_argument, NULL, 0}, {"separator" , required_argument, NULL, 0}, /* terminator */ {NULL , no_argument , NULL, 0} }; doc = pstring_new (); if (! doc) die ("failed to allocate string"); program_name = argv[0]; argvp = argv; argvc = argc; /* Check before command-line options, since the latter * must take priority. */ check_envvars (); init (); while (TRUE) { option = getopt_long (argc, argv, "aAbBcCdeEfFghijklLmMnNopPqrsStTuUvwxyYz", long_options, &long_index); if (option == -1) break; /* If the user has specified a display option, only * display that particular group (but crucially don't * count non-display options). */ if (option) { done = TRUE; master_header (&doc); } selected_option = option; switch (option) { case 0: /* The exception is '--exec' */ if (done && strcmp ("exec", long_options[long_index].name)) die ("Must specify non-display options before display options"); if (! strcmp ("output", long_options[long_index].name)) { output = get_output_value (optarg); } else if (! strcmp ("file", long_options[long_index].name)) { output = OUTPUT_FILE; output_file = optarg; } else if (! strcmp ("exec", long_options[long_index].name)) { reexec = TRUE; } else if (! strcmp ("format", long_options[long_index].name)) { output_format = get_output_format (optarg); } else if (! strcmp ("indent", long_options[long_index].name)) { indent_amount = atoi (optarg); if (indent_amount <= 0) die ("cannot specify indent <= 0"); } else if (! strcmp ("indent-char", long_options[long_index].name)) { /* Special character handling */ if (! strcmp (optarg, "\\t")) { indent_char = "\t"; } else { indent_char = optarg; } if (! indent_char) die ("cannot use nul indent character"); /* call again */ handle_indent_char (); } else if (! strcmp ("separator", long_options[long_index].name)) { if (! strcmp (optarg, "\\t")) { text_separator = "\t"; } else { text_separator = optarg; } } else if (! strcmp ("crumb-separator", long_options[long_index].name)) { if (! strcmp (optarg, "\\t")) { crumb_separator = "\t"; } else { crumb_separator = optarg; } } /* reset */ selected_option = 0; indent = 0; break; case 'a': show_meta (); break; case 'A': show_arguments (); break; case 'b': #ifndef PROCENV_ANDROID show_libs (); #endif break; case 'B': show_libc (); break; case 'c': show_cgroups (); break; case 'C': show_cpu (); break; case 'd': show_compiler (); break; case 'e': show_env (); break; case 'E': show_semaphores (); break; case 'f': show_fds (); break; case 'F': show_namespaces (); break; case 'g': show_sizeof (); break; case 'h': usage (); break; case 'i': get_uname (); get_user_info (); get_misc (); show_misc (); break; case 'j': show_uname (); break; case 'k': show_clocks (); break; case 'l': show_rlimits (); break; case 'L': show_locale (); break; case 'm': show_mounts (SHOW_MOUNTS); break; case 'M': show_msg_queues (); break; case 'n': #ifndef PROCENV_ANDROID show_confstrs (); #endif break; case 'N': show_network (); break; case 'o': show_oom (); break; case 'p': get_misc (); show_proc (); break; case 'P': show_platform (); break; case 'q': show_time (); break; case 'r': show_ranges (); break; case 's': show_signals (); break; case 'S': show_shared_mem (); break; case 't': show_tty_attrs (); break; case 'T': show_threads (); break; case 'u': show_stat (); break; case 'U': show_rusage (); break; case 'v': show_version (); break; case 'w': show_capabilities (); break; case 'x': show_mounts (SHOW_PATHCONF); break; case 'y': show_sysconf (); break; case 'Y': show_memory (); break; case 'z': show_timezone (); break; case '?': die ("invalid option '%c' specified", option); break; } } if (done) { common_assert (); master_footer (&doc); chomp (doc); if (output_format != OUTPUT_FORMAT_XML && output_format != OUTPUT_FORMAT_JSON) { compress (&doc, wide_indent_char); } goto finish; } if (output == OUTPUT_SYSLOG) openlog (PACKAGE_NAME, LOG_CONS | LOG_PID, LOG_USER); if (reexec && ! exec_args && optind >= argc) die ("must specify atleast one argument with '--exec'"); /* Prepare for re-exec */ if (reexec) { if (! exec_args) { argv += optind; exec_args = argv; } } dump (); chomp (doc); compress (&doc, wide_indent_char); finish: _show_output_pstring (doc); cleanup (); /* Perform re-exec */ if (reexec) { execvp (exec_args[0], exec_args); die ("failed to re-exec %s", exec_args[0]); } exit (EXIT_SUCCESS); } char * get_user_name (uid_t uid) { struct passwd *p; p = getpwuid (uid); return p ? p->pw_name : NULL; } char * get_group_name (gid_t gid) { struct group *g; g = getgrgid (gid); return g ? g->gr_name : NULL; } /** * encode_string: * * @str: string to encode. * * Returns: 0 on success, -1 on failure. * * Convert the specified string to its encoded form. If no encoding is * necessary, the string will not be modified. * * Notes: * * - By encoding, we mean replacing literals with their * format-langage-specific encodings. For example for XML output, * '<' is converted to '<'. * * - It is the callers responsibility to free @str iff this function * is successful. any previous value of @str will be freed by * encode_string(). * * BUGS: this is just horribly, horribly gross :( **/ int encode_string (pstring **pstr) { int ret = 0; pstring *new = NULL; wchar_t *p, *q; size_t non_printables; size_t len = 0; size_t bytes; assert (pstr); assert (*pstr); if ((*pstr)->len <= 1) { /* Nothing to do */ return 0; } switch (output_format) { case OUTPUT_FORMAT_CRUMB: /* FALL */ case OUTPUT_FORMAT_TEXT: /* Nothing to do */ ret = 0; break; case OUTPUT_FORMAT_JSON: /* FALL THROUGH */ case OUTPUT_FORMAT_XML: new = translate (*pstr); if (new) { pstring_free (*pstr); *pstr = new; new = NULL; } else { ret = -1; } break; default: assert_not_reached (); break; } if (ret < 0) return ret; /* Now, search for evil non-printable characters and encode those * appropriately. */ for (p = (*pstr)->buf, non_printables = 0; p && *p; p++) { if (! iswprint (*p)) non_printables++; } if (non_printables && (output_format == OUTPUT_FORMAT_XML || output_format == OUTPUT_FORMAT_JSON)) { size_t new_size = 0; wchar_t *json_format = L"\\u%4.4x"; /* XXX: * * Although this format spec _may_ produce valid XML, * the rules are arcane and some(?) control characters * cannot be used within an XML document, hence the * "may". * * Aside from simply discarding non-printable characters * (thus distorting the output), we are left with * attempting to produce some sort of encoded * representation which may well choke a validating * parser. * * Realistically, the problem is confined to handling * control characters set in environment variables when * attempting to output XML. This may occur if you run * GNU Screen since it sets $TERMCAP which includes * binary characters. * * FIXME: * * If you hit this issue, raise a bug so we can consider * simply discarding all non-printables when attempting * XML output. */ wchar_t *xml_format = L"&#x%2.2x;"; len = (*pstr)->len; /* Calculate expanded size of string by removing * count of non-printable byte and adding back the * number of bytes required to encode them in expanded * form. */ switch (output_format) { case OUTPUT_FORMAT_XML: new_size = (len - non_printables) + (non_printables * wcslen (L"&#x..;")); break; case OUTPUT_FORMAT_JSON: new_size = (len - non_printables) + (non_printables * wcslen (L"\\u....")); break; default: break; } new = pstring_new (); if (! new) return -1; bytes = (1 + new_size) * sizeof (wchar_t); new->buf = malloc (bytes); if (! new->buf) { free (new); return -1; } new->size = bytes; memset (new->buf, '\0', bytes); for (p = (*pstr)->buf, q = new->buf; p && *p; p++) { if (iswprint (*p)) { *q = *p; q++; new->len++; } else { ret = swprintf (q, new_size, output_format == OUTPUT_FORMAT_JSON ? json_format : xml_format, *p); q += ret; } } /* include terminator */ new->len = wcslen (new->buf) + 1; pstring_free (*pstr); *pstr = new; } return ret; } /* Performs simple substitution on the input */ pstring * translate (const pstring *pstr) { pstring *result = NULL; const wchar_t *start; const wchar_t *p; TranslateTable *table; size_t i; size_t len; size_t extra; size_t bytes; size_t amount; wchar_t from; assert (pstr); assert (output_format != OUTPUT_FORMAT_TEXT); assert (output_format != OUTPUT_FORMAT_CRUMB); /* Find the correct translation table for the chosen output format */ for (i = 0; i < sizeof (translate_table) / sizeof (translate_table[0]); i++) { table = &translate_table[i]; if (table && table->output_format == output_format) break; } if (! table) return NULL; len = pstr->len; start = pstr->buf; /* First, calculate the amount of space needed for the expanded * buffer. */ extra = 0; while (start && *start) { for (i = 0; i < TRANSLATE_MAP_ENTRIES; i++) { from = table->map[i].from; if (*start == from) { /* Subtract one to take account of the * pre-existing character we're going to * replace. */ extra += (wcslen (table->map[i].to) - 1); } } start++; } if (! extra) { /* No translation required. * * FIXME: this is inefficient - we should really have * the function accept a 'pstring **' to avoid * re-copying. */ return pstring_create (pstr->buf); } len += extra; result = pstring_new (); if (! result) return NULL; /* Note that this includes the space for the terminator * (since a pstring's len includes the terminator) */ bytes = len * sizeof (wchar_t); result->buf = malloc (bytes); if (! result->buf) { pstring_free (result); return NULL; } /* We're using wcsncat() so we'd better make sure there is a * nul for it to find! * * Note: we could have used calloc to do this for us, but * the code is clearer using the @bytes idiom. */ memset (result->buf, '\0', bytes); result->size = bytes; /* Sanity check for upcoming overrun check */ assert (result->buf[len-1] == L'\0'); /* Now, iterate the string again, performing the actual * replacements. */ p = start = pstr->buf; while (p && *p) { for (i = 0; i < TRANSLATE_MAP_ENTRIES; i++) { wchar_t *to; size_t len; from = table->map[i].from; if (*p != from) continue; to = table->map[i].to; amount = p - start; /* Copy from start to match */ wcsncat (result->buf + result->len, start, amount); result->len += amount; /* Copy replacement text */ len = wcslen (to); wcsncat (result->buf + result->len, to, len); result->len += len; /* Jump over the matching character */ start = p + 1; break; } p++; } /* Copy remaining non-matching chars */ amount = p - start; wcsncat (result->buf + result->len, start, amount); result->len += amount; /* Account for terminator */ result->len += 1; /* check for buffer overrun */ assert (result->buf[len-1] == L'\0'); return result; } /** * change_element: * * Handle changing to a new element type. Depending on the output * format, this may require separators and newlines to be emitted to * produce well-formatted output. **/ void change_element (ElementType new) { common_assert (); last_element = current_element; current_element = new; format_element (); } void format_element (void) { switch (output_format) { case OUTPUT_FORMAT_TEXT: format_text_element (); break; case OUTPUT_FORMAT_CRUMB: /* NOP */ break; case OUTPUT_FORMAT_JSON: format_json_element (); break; case OUTPUT_FORMAT_XML: format_xml_element (); break; default: assert_not_reached (); break; } } void format_text_element (void) { common_assert (); switch (last_element) { case ELEMENT_TYPE_ENTRY: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); add_indent (&doc); break; case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ case ELEMENT_TYPE_SECTION_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_SECTION_OPEN: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_CLOSE: /* NOP */ break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_SECTION_CLOSE: { switch (current_element) { case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: wappend (&doc, L"\n"); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_CONTAINER_OPEN: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: /* FALL */ wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_CONTAINER_CLOSE: /* NOP */ break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_CONTAINER_CLOSE: { switch (current_element) { case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_NONE: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_OPEN: /* FALL */ case ELEMENT_TYPE_OBJECT_CLOSE: break; default: assert_not_reached (); break; } } break; default: assert_not_reached (); break; } } void format_json_element (void) { common_assert (); switch (last_element) { case ELEMENT_TYPE_ENTRY: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L",\n"); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ case ELEMENT_TYPE_OBJECT_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_SECTION_OPEN: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_CLOSE: case ELEMENT_TYPE_OBJECT_OPEN: /* NOP */ break; case ELEMENT_TYPE_CONTAINER_CLOSE: assert_not_reached (); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_SECTION_CLOSE: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L",\n"); add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_OPEN: /* NOP */ break; case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_CONTAINER_OPEN: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_OBJECT_OPEN: wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_CLOSE: case ELEMENT_TYPE_SECTION_CLOSE: assert_not_reached (); break; case ELEMENT_TYPE_CONTAINER_CLOSE: /* NOP */ break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_CONTAINER_CLOSE: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_OBJECT_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L",\n"); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ case ELEMENT_TYPE_OBJECT_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_OBJECT_OPEN: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_CLOSE: /* NOP */ break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_OBJECT_CLOSE: { switch (current_element) { case ELEMENT_TYPE_CONTAINER_CLOSE: case ELEMENT_TYPE_SECTION_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_OPEN: case ELEMENT_TYPE_SECTION_OPEN: wappend (&doc, L",\n"); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_NONE: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ case ELEMENT_TYPE_OBJECT_OPEN: /* FALL */ case ELEMENT_TYPE_OBJECT_CLOSE: add_indent (&doc); break; default: assert_not_reached (); break; } } break; default: assert_not_reached (); break; } } void format_xml_element (void) { common_assert (); switch (last_element) { case ELEMENT_TYPE_ENTRY: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_OBJECT_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ case ELEMENT_TYPE_OBJECT_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_SECTION_OPEN: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_CLOSE: wappend (&doc, L"\n"); add_indent (&doc); break; case ELEMENT_TYPE_CONTAINER_CLOSE: assert_not_reached (); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_SECTION_CLOSE: { switch (current_element) { case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_CLOSE: wappend (&doc, L"\n"); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_CONTAINER_OPEN: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_SECTION_CLOSE: assert_not_reached (); break; case ELEMENT_TYPE_CONTAINER_CLOSE: wappend (&doc, L"\n"); add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_OPEN: add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_CONTAINER_CLOSE: { switch (current_element) { case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ case ELEMENT_TYPE_OBJECT_CLOSE: wappend (&doc, L"\n"); dec_indent (); add_indent (&doc); break; case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); add_indent (&doc); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_OBJECT_OPEN: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_CONTAINER_OPEN: wappend (&doc, L"\n"); inc_indent (); add_indent (&doc); break; case ELEMENT_TYPE_OBJECT_CLOSE: /* NOP */ break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_OBJECT_CLOSE: { switch (current_element) { case ELEMENT_TYPE_OBJECT_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_CLOSE: /* NOP */ break; case ELEMENT_TYPE_CONTAINER_CLOSE: case ELEMENT_TYPE_ENTRY: wappend (&doc, L"\n"); dec_indent (); break; default: assert_not_reached (); break; } } break; case ELEMENT_TYPE_NONE: { switch (current_element) { case ELEMENT_TYPE_ENTRY: /* FALL */ case ELEMENT_TYPE_CONTAINER_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_OPEN: /* FALL */ case ELEMENT_TYPE_SECTION_CLOSE: /* FALL */ case ELEMENT_TYPE_CONTAINER_CLOSE: /* FALL */ case ELEMENT_TYPE_OBJECT_OPEN: /* FALL */ case ELEMENT_TYPE_OBJECT_CLOSE: add_indent (&doc); break; default: assert_not_reached (); break; } } break; default: assert_not_reached (); break; } } /** * compress: * * Remove lines composed entirely of whitespace from @str. * * This is required specifically for '--output=text' which in some * scenarios generates lines comprising pure whitespace. This is * unecessary and results from the fact that when an * ELEMENT_TYPE_OBJECT_* is encountered, formatting is applied for the * previously seen element, but sometimes such "objects" should be * invisible. **/ void compress (pstring **wstr, wchar_t remove_char) { wchar_t *from; wchar_t *to; wchar_t *p; wchar_t *start; size_t count = 0; size_t blanks = 0; size_t new_len; size_t bytes; assert (wstr); to = from = (*wstr)->buf; while (to && *to) { again: while (*to == L'\n' && *(to+1) == L'\n') { /* skip over blank lines */ to++; blanks++; } start = to; while (*to == remove_char) { /* skip runs of contiguous characters */ to++; count++; } if (to != start) { /* Only start consuming NLs at the end of a * contiguous run *iff* there was more than a * single removed char. This is a heuristic to * avoid removing valid entries for example env * vars that are set to nul are shown as: * * 'var: ' * * Shudder. */ if (*to == L'\n' && to != start+1) { while (*to == L'\n') { /* consume the NL at the end of the contiguous run */ to++; } /* check to ensure that we haven't entered a new line * containing another block of chars to remove. */ if (*to == remove_char) goto again; blanks++; } else { /* not a full line so backtrack */ to = start; count = 0; } } *from++ = *to++; } /* terminate */ *from = L'\0'; if (blanks || count) { new_len = (*wstr)->len - (blanks + count); bytes = new_len * sizeof (wchar_t); p = realloc ((*wstr)->buf, bytes); assert (p); (*wstr)->buf = p; (*wstr)->buf[new_len-1] = L'\0'; (*wstr)->len = new_len; (*wstr)->size = bytes; } } /** * chomp: * * Remove trailing extraneous newlines and indent_chars from @str. **/ void chomp (pstring *str) { size_t len; int removable = 0; wchar_t *p; assert (str); /* Unable to add '\n' in this scenario */ if (str->len < 2) return; for (p = str->buf+str->len-1; *p == L'\n' || *p == wide_indent_char; p--, removable++) ; /* Chop string at the appropriate place after first adding a new * newline. */ if (removable > 1) { len = str->len - (removable-1); str->buf[len-1] = L'\n'; str->buf[len] = L'\0'; str->len = len; } } void show_version (void) { common_assert (); header ("version"); entry (_("name"), "%s", PACKAGE_NAME); entry (_("version"), "%s", PACKAGE_VERSION); entry (_("author"), "%s", PROGRAM_AUTHORS); footer (); } void show_shared_mem (void) { #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) show_shared_mem_linux (); #else show_shared_mem_stub (); #endif } void show_semaphores (void) { #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) show_semaphores_linux (); #else show_semaphores_stub (); #endif } void show_msg_queues (void) { #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) show_msg_queues_linux (); #else show_msg_queues_stub (); #endif } #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) void show_shared_mem_linux (void) { int i; int id; int max; struct shm_info info; struct shmid_ds shmid_ds; struct ipc_perm *perm; char formatted_atime[CTIME_BUFFER]; char formatted_ctime[CTIME_BUFFER]; char formatted_dtime[CTIME_BUFFER]; char *modestr = NULL; int locked = -1; int destroy = -1; char *cpid = NULL; char *lpid = NULL; header ("shared memory"); max = shmctl (0, SHM_INFO, (void *)&info); if (max < 0) goto out; /* Display summary details */ section_open ("info"); entry ("segments", "%u", info.used_ids); entry ("pages", "%lu", info.shm_tot); entry ("shm_rss", "%lu", info.shm_rss); entry ("shm_swp", "%lu", info.shm_swp); /* Apparently unused */ entry ("swap_attempts", "%lu", info.swap_attempts); entry ("swap_successes", "%lu", info.swap_successes); section_close (); container_open ("segments"); object_open (FALSE); for (i = 0; i <= max; i++) { char *id_str = NULL; id = shmctl (i, SHM_STAT, &shmid_ds); if (id < 0) { /* found an unused slot, so ignore it */ continue; } perm = &shmid_ds.shm_perm; modestr = format_perms (perm->mode); if (! modestr) die ("failed to allocate space for permissions string"); #ifdef PROCENV_LINUX locked = (perm->mode & SHM_LOCKED); destroy = (perm->mode & SHM_DEST); #endif format_time (&shmid_ds.shm_atime, formatted_atime, sizeof (formatted_atime)); format_time (&shmid_ds.shm_ctime, formatted_ctime, sizeof (formatted_ctime)); format_time (&shmid_ds.shm_dtime, formatted_dtime, sizeof (formatted_dtime)); cpid = pid_to_name (shmid_ds.shm_cpid); lpid = pid_to_name (shmid_ds.shm_lpid); appendf (&id_str, "%d", id); container_open (id_str); free (id_str); object_open (FALSE); /* pad out to max pointer size represented in hex. */ entry ("key", "0x%.*x", POINTER_SIZE * 2, perm->__key); entry ("sequence", "%u", perm->__seq); section_open ("permissions"); entry ("octal", "%4.4o", perm->mode); entry ("symbolic", "%s", modestr); section_close (); section_open ("pids"); entry ("create", "%d (%s)", shmid_ds.shm_cpid, cpid ? cpid : UNKNOWN_STR); entry ("last", "%d (%s)", shmid_ds.shm_lpid, lpid ? lpid : UNKNOWN_STR); section_close (); entry ("attachers", "%lu", shmid_ds.shm_nattch); section_open ("creator"); entry ("euid", "%u ('%s')", perm->cuid, get_user_name (perm->cuid)); entry ("egid", "%u ('%s')", perm->cgid, get_group_name (perm->cgid)); section_close (); section_open ("owner"); entry ("uid", "%u ('%s')", perm->uid, get_user_name (perm->uid)); entry ("gid", "%u ('%s')", perm->gid, get_group_name (perm->gid)); section_close (); entry ("segment size", "%lu", shmid_ds.shm_segsz); section_open ("times"); entry ("last attach (atime)", "%lu (%s)", shmid_ds.shm_atime, formatted_atime); entry ("last detach (dtime)", "%lu (%s)", shmid_ds.shm_dtime, formatted_dtime); entry ("last change (ctime)", "%lu (%s)", shmid_ds.shm_ctime, formatted_ctime); section_close (); entry ("locked", "%s", locked == 0 ? NO_STR : locked > 0 ? YES_STR : NA_STR); entry ("destroy", "%s", destroy == 0 ? NO_STR : destroy > 0 ? YES_STR : NA_STR); object_close (FALSE); container_close (); free (modestr); if (cpid) free (cpid); if (lpid) free (lpid); } object_close (FALSE); container_close (); out: footer (); } void show_semaphores_linux (void) { int i; int id; int max; struct semid_ds semid_ds; struct seminfo info; struct ipc_perm *perm; char formatted_otime[CTIME_BUFFER]; char formatted_ctime[CTIME_BUFFER]; char *modestr = NULL; union semun arg; header ("semaphores"); arg.array = (unsigned short int *)(void *)&info; max = semctl (0, 0, SEM_INFO, arg); if (max < 0) goto out; section_open ("info"); entry ("semmap", "%d", info.semmap); entry ("semmni", "%d", info.semmni); entry ("semmns", "%d", info.semmns); entry ("semmnu", "%d", info.semmnu); entry ("semmsl", "%d", info.semmsl); entry ("semopm", "%d", info.semopm); entry ("semume", "%d", info.semume); entry ("semusz", "%d", info.semusz); entry ("semvmx", "%d", info.semvmx); entry ("semaem", "%d", info.semaem); section_close (); container_open ("set"); object_open (FALSE); for (i = 0; i <= max; i++) { char *id_str = NULL; /* see semctl(2) */ arg.buf = (struct semid_ds *)&semid_ds; id = semctl (i, 0, SEM_STAT, arg); if (id < 0) { /* found an unused slot, so ignore it */ continue; } perm = &semid_ds.sem_perm; modestr = format_perms (perm->mode); if (! modestr) die ("failed to allocate space for permissions string"); /* May not have been set */ if (semid_ds.sem_otime) format_time (&semid_ds.sem_otime, formatted_otime, sizeof (formatted_otime)); else sprintf (formatted_otime, "%s", NA_STR); format_time (&semid_ds.sem_ctime, formatted_ctime, sizeof (formatted_ctime)); appendf (&id_str, "%d", id); container_open (id_str); free (id_str); object_open (FALSE); /* pad out to max pointer size represented in hex. */ entry ("key", "0x%.*x", POINTER_SIZE * 2, perm->__key); entry ("sequence", "%u", perm->__seq); entry ("number in set", "%lu", semid_ds.sem_nsems); section_open ("permissions"); entry ("octal", "%4.4o", perm->mode); entry ("symbolic", "%s", modestr); free (modestr); section_close (); section_open ("creator"); entry ("euid", "%u ('%s')", perm->cuid, get_user_name (perm->cuid)); entry ("egid", "%u ('%s')", perm->cgid, get_group_name (perm->cgid)); section_close (); section_open ("owner"); entry ("uid", "%u ('%s')", perm->uid, get_user_name (perm->uid)); entry ("gid", "%u ('%s')", perm->gid, get_group_name (perm->gid)); section_close (); section_open ("times"); entry ("last semop (otime)", "%lu (%s)", semid_ds.sem_otime, formatted_otime); entry ("last change (ctime)", "%lu (%s)", semid_ds.sem_ctime, formatted_ctime); section_close (); object_close (FALSE); container_close (); } object_close (FALSE); container_close (); out: footer (); } void show_msg_queues_linux (void) { int i; int id; int max; struct msginfo info; struct msqid_ds msqid_ds; struct ipc_perm *perm; char formatted_stime[CTIME_BUFFER]; char formatted_rtime[CTIME_BUFFER]; char formatted_ctime[CTIME_BUFFER]; char *modestr = NULL; char *lspid = NULL; char *lrpid = NULL; header ("message queues"); max = msgctl (0, MSG_INFO, (void *)&info); if (max < 0) goto out; section_open ("info"); entry ("msgpool", "%d", info.msgpool); entry ("msgmap", "%d", info.msgmap); entry ("msgmax", "%d", info.msgmax); entry ("msgmnb", "%d", info.msgmnb); entry ("msgmni", "%d", info.msgmni); entry ("msgssz", "%d", info.msgssz); entry ("msgtql", "%d", info.msgtql); entry ("msgseg", "%d", info.msgseg); section_close (); container_open ("sets"); object_open (FALSE); for (i = 0; i <= max; i++) { char *id_str = NULL; id = msgctl (i, MSG_STAT, &msqid_ds); if (id < 0) { /* found an unused slot, so ignore it */ continue; } perm = &msqid_ds.msg_perm; modestr = format_perms (perm->mode); if (! modestr) die ("failed to allocate space for permissions string"); /* May not have been set */ if (msqid_ds.msg_stime) format_time (&msqid_ds.msg_stime, formatted_stime, sizeof (formatted_stime)); else sprintf (formatted_stime, "%s", NA_STR); /* May not have been set */ if (msqid_ds.msg_rtime) format_time (&msqid_ds.msg_rtime, formatted_rtime, sizeof (formatted_rtime)); else sprintf (formatted_rtime, "%s", NA_STR); /* May not have been set */ if (msqid_ds.msg_ctime) format_time (&msqid_ds.msg_ctime, formatted_ctime, sizeof (formatted_ctime)); else sprintf (formatted_ctime, "%s", NA_STR); lspid = pid_to_name (msqid_ds.msg_lspid); lrpid = pid_to_name (msqid_ds.msg_lrpid); appendf (&id_str, "%d", id); container_open (id_str); free (id_str); object_open (FALSE); /* pad out to max pointer size represented in hex */ entry ("key", "0x%.*x", POINTER_SIZE * 2, perm->__key); entry ("sequence", "%u", perm->__seq); section_open ("permissions"); entry ("octal", "%4.4o", perm->mode); entry ("symbolic", "%s", modestr); section_close (); section_open ("creator"); entry ("euid", "%u ('%s')", perm->cuid, get_user_name (perm->cuid)); entry ("egid", "%u ('%s')", perm->cgid, get_group_name (perm->cgid)); section_close (); section_open ("owner"); entry ("uid", "%u ('%s')", perm->uid, get_user_name (perm->uid)); entry ("gid", "%u ('%s')", perm->gid, get_group_name (perm->gid)); section_close (); section_open ("times"); entry ("last send (stime)", "%lu (%s)", msqid_ds.msg_stime, formatted_stime); entry ("last receive (rtime)", "%lu (%s)", msqid_ds.msg_rtime, formatted_rtime); entry ("last change (ctime)", "%lu (%s)", msqid_ds.msg_ctime, formatted_ctime); section_close (); entry ("queue_bytes", "%lu", msqid_ds.__msg_cbytes); entry ("msg_qnum", "%lu", msqid_ds.msg_qnum); entry ("msg_qbytes", "%lu", msqid_ds.msg_qbytes); entry ("last msgsnd pid", "%d (%s)", msqid_ds.msg_lspid, lspid ? lspid : UNKNOWN_STR); entry ("last msgrcv pid", "%d (%s)", msqid_ds.msg_lrpid, lrpid ? lrpid : UNKNOWN_STR); object_close (FALSE); container_close (); free (modestr); if (lspid) free (lspid); if (lrpid) free (lrpid); } object_close (FALSE); container_close (); out: footer (); } #endif /* PROCENV_LINUX || PROCENV_HURD */ void format_time (const time_t *t, char *buffer, size_t len) { char *str = NULL; size_t l; assert (t); assert (buffer); str = ctime (t); if (! str) die ("failed to format time"); l = strlen (str); if (len < l) bug ("buffer too small"); /* Ensure nul byte copied */ strncpy (buffer, str, l+1); /* Overwrite NL */ buffer[strlen (buffer)-1] = '\0'; } char * format_perms (mode_t mode) { char *modestr = NULL; mode_t perms; int i = 0; /* * "-rwxrwxrwx" = 10+1 bytes. */ modestr = calloc ((1+3+3+3)+1, sizeof (char)); if (! modestr) return NULL; modestr[i++] = (S_ISLNK (mode & S_IFMT)) ? 'l' : '-'; perms = (mode & S_IRWXU); modestr[i++] = (perms & S_IRUSR) ? 'r' : '-'; modestr[i++] = (perms & S_IWUSR) ? 'w' : '-'; modestr[i++] = (perms & S_IXUSR) ? 'x' : '-'; perms = (mode & S_IRWXG); modestr[i++] = (perms & S_IRGRP) ? 'r' : '-'; modestr[i++] = (perms & S_IWGRP) ? 'w' : '-'; modestr[i++] = (perms & S_IXGRP) ? 'x' : '-'; perms = (mode & S_IRWXO); modestr[i++] = (perms & S_IROTH) ? 'r' : '-'; modestr[i++] = (perms & S_IWOTH) ? 'w' : '-'; modestr[i++] = (perms & S_IXOTH) ? 'x' : '-'; perms = (mode &= ~S_IFMT); if (perms & S_ISUID) modestr[3] = 's'; if (perms & S_ISGID) modestr[6] = 's'; if (perms & S_ISVTX) modestr[9] = 't'; return modestr; } char * pid_to_name (pid_t pid) { char path[PATH_MAX]; char *name = NULL; FILE *f = NULL; sprintf (path, "/proc/%d/cmdline", (int)pid); f = fopen (path, "r"); if (! f) goto out; /* Reuse buffer */ if (! fgets (path, sizeof (path), f)) goto out; /* Nul delimiting within /proc file will ensure we only get the * program name. */ append (&name, path); out: if (f) fclose (f); return name; } void add_breadcrumb (const char *name) { assert (name); if (! crumb_list) crumb_list = pr_list_new (NULL); assert (crumb_list); pr_list_prepend_str (crumb_list, name); } void remove_breadcrumb (void) { PRList *entry; assert (crumb_list); entry = pr_list_remove (crumb_list->prev); assert (entry); free ((char *)entry->data); free (entry); } void clear_breadcrumbs (void) { assert (crumb_list); while (crumb_list->prev != crumb_list) remove_breadcrumb (); } wchar_t * char_to_wchar (const char *str) { const char *p; wchar_t *wstr = NULL; size_t len; size_t bytes; assert (str); len = mbsrtowcs (NULL, &str, 0, NULL); if (len <= 0) return NULL; /* include space for terminator */ bytes = (1 + len) * sizeof (wchar_t); wstr = malloc (bytes); if (! wstr) return NULL; p = str; if (mbsrtowcs (wstr, &p, len, NULL) != len) goto error; /* ensure it's terminated */ wstr[len] = L'\0'; return wstr; error: free (wstr); return NULL; } pstring * pstring_new (void) { pstring *pstr = NULL; pstr = calloc (1, sizeof (pstring)); if (! pstr) return NULL; pstr->len = 0; pstr->size = 0; pstr->buf = NULL; return pstr; } pstring * pstring_create (const wchar_t *str) { pstring *pstr = NULL; assert (str); pstr = pstring_new (); if (! pstr) return NULL; pstr->buf = wcsdup (str); if (! pstr->buf) { pstring_free (pstr); return NULL; } /* include the L'\0' terminator */ pstr->len = 1 + wcslen (pstr->buf); pstr->size = pstr->len * sizeof (wchar_t); return pstr; } void pstring_free (pstring *str) { assert (str); if (str->buf) free (str->buf); free (str); } pstring * char_to_pstring (const char *str) { pstring *pstr = NULL; wchar_t *s; assert (str); s = char_to_wchar (str); if (! s) return NULL; pstr = pstring_create (s); free (s); return pstr; } char * pstring_to_char (const pstring *str) { assert (str); return wchar_to_char (str->buf); } char * wchar_to_char (const wchar_t *wstr) { char *str = NULL; size_t len; size_t bytes; size_t ret; assert (wstr); len = wcslen (wstr); /* determine number of MBS (char) bytes requires to hold the * wchar_t string. */ bytes = wcstombs (NULL, wstr, len); if (! bytes) return NULL; str = calloc (bytes + 1, sizeof (char)); if (! str) return NULL; /* actually perform the conversion */ ret = wcstombs (str, wstr, bytes); if (! ret) goto error; return str; error: free (str); return NULL; } #if ! defined (HAVE_SCHED_GETCPU) /** * @string: input, * @delimiter: field delimiter, * @compress: if TRUE, ignore repeated contiguous delimiter characters, * @array: [output] array of fields, which this function will allocate. * * Notes: it is the callers responsibility to free @array * if the returned value is >0. * * Returns: number of fields in @string. **/ size_t split_fields (const char *string, char delimiter, int compress, char ***array) { const char *p = NULL; const char *start = NULL; size_t count = 0; char *elem; char **new; assert (string); assert (delimiter); assert (array); *array = NULL; new = realloc ((*array), sizeof (char *) * (1+count)); assert (new); new[0] = NULL; *array = new; p = string; while (p && *p) { /* skip leading prefix */ while (compress && p && *p == delimiter) p++; if (! *p) break; /* found a field */ count++; if (! compress) p++; /* skip over the field */ start = p; while (p && *p && *p != delimiter) p++; elem = strndup (start, p-start); assert (elem); new = realloc ((*array), sizeof (char *) * (1+count)); assert (new); new[count-1] = elem; *array = new; } return count; } #endif procenv-0.43/src/procenv.h000066400000000000000000000650061262513272000155370ustar00rootroot00000000000000/*-------------------------------------------------------------------- * Copyright © 2012-2015 James Hunt . * * 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 . *-------------------------------------------------------------------- */ #ifndef PROCENV_H #define PROCENV_H /* for dl_iterate_phdr(3) */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #ifdef HAVE_CONFIG_H # include #endif /* HAVE_CONFIG_H */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* FIXME: Android testing */ #if 1 #ifndef PACKAGE_NAME #define PACKAGE_NAME "procenv" #endif /* FIXME: ugh */ #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "0.28" #endif #ifndef PACKAGE_STRING #define PACKAGE_STRING PACKAGE_NAME #endif #endif /* FIXME */ /** * PROCENV_FORMAT_VERSION: * * Version of output format. * * XXX: must be updated for every change. * * VERSION 1: * - Original format (up to procenv 0.27). * VERSION 2: * - Added --memory. * - Expanded --cpu. * - Added missing --cpu to default output. * - Moved memory page size from --misc to --memory. * VERSION 3: * - --fds: Added Capsicum capabilities for FreeBSD (alas this version * is a NOP for non-BSD platforms). * VERSION 4: * - Added "symbolic" values to --range output. * VERSION 5: * - Capabilities output changed on linux to show not just the * bounding set, but also permitted, inheritable and enabled values * along with the numeric value of the define. * VERSION 6: * - --misc: Added personality. * VERSION 7: * - --confstr and pathconf values in --mount now show * NA_STR rather than UNKNOWN_STR. --sysconf now shows NA_STR rather * than -1. * VERSION 8: * - --memory: Added NUMA API version. * - --shared-memory: Added swap_attempts and swap_successes. * VERSION 9: * - --meta now includes a 'build-type' field. * VERSION 10: * - Output is now sorted correctly (again - previously show_misc() * and show_libc() were being called in the wrong order). * VERSION 11: * - Added --namespaces. * VERSION 12: * - Change format of --namespaces output. **/ #define PROCENV_FORMAT_VERSION 12 #define PROCENV_DEFAULT_TEXT_SEPARATOR ": " #define PROCENV_DEFAULT_CRUMB_SEPARATOR ":" #if defined (__FreeBSD__) \ || defined (__NetBSD__) \ || defined (__OpenBSD__) #define PROCENV_BSD #endif #ifdef __linux__ #define PROCENV_LINUX #endif #if defined (PROCENV_LINUX) && defined (__BIONIC__) #define PROCENV_ANDROID #endif #if defined (__FreeBSD_kernel__) && defined (__GNUC__) /* Debian kFreeBSD (GNU userland + BSD kernel) */ #define PROCENV_GNU_BSD #endif #ifdef __GNU__ #define PROCENV_HURD #endif #if defined (__i386__) || defined (__x86_64__) #define PROCENV_ARCH_X86 #endif #if defined PROCENV_ANDROID #ifndef PACKAGE_NAME #define PACKAGE_NAME "procenv" #endif #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "0.24" #endif #ifndef PACKAGE_STRING #define PACKAGE_STRING PACKAGE_NAME #endif /* major(3) / minor(3) */ #include #endif #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) #include #include #include #endif #if defined (PROCENV_LINUX) #include #include #include #include #include #include #if defined (HAVE_NUMA_H) #include #include #if LIBNUMA_API_VERSION == 2 #define PROCENV_NUMA_BITMASK_ISSET(mask, node) numa_bitmask_isbitset ((mask), (node)) #else #define PROCENV_NUMA_BITMASK_ISSET(mask, node) nodemask_isset (&(mask), (node)) int procenv_getcpu (void); #endif #endif /* HAVE_NUMA_H */ #if ! defined(HAVE_SCHED_GETCPU) size_t split_fields (const char *string, char delimiter, int compress, char ***array); #endif /* Lucid provides prctl.h, but not securebits.h */ #if defined (PR_GET_SECUREBITS) && defined (HAVE_LINUX_SECUREBITS_H) #include #endif #include #include #if defined (HAVE_SYS_APPARMOR_H) #include #endif #if defined (HAVE_SELINUX_SELINUX_H) #include #endif /** * show_capability: * @caps: cap_t, * @cap: capability. * * Display specified capability, or NOT_DEFINED_STR if value is * unknown. **/ #ifdef PR_CAPBSET_READ #define show_capability(caps, cap) \ _show_capability (caps, cap, #cap) #define _show_capability(caps, cap, name) \ { \ int bound; \ int effective; \ int inheritable; \ int permitted; \ \ bound = cap_get_bound (cap); \ \ effective = get_capability_by_flag_type (caps, CAP_EFFECTIVE, cap); \ inheritable = get_capability_by_flag_type (caps, CAP_INHERITABLE, cap); \ permitted = get_capability_by_flag_type (caps, CAP_PERMITTED, cap); \ \ section_open (name); \ \ entry ("number", "%d", cap); \ \ entry ("supported", "%s", \ CAP_IS_SUPPORTED (cap) \ ? YES_STR : NO_STR); \ \ entry ("in bounding set", "%s", \ bound < 0 \ ? UNKNOWN_STR \ : bound \ ? YES_STR \ : NO_STR); \ \ entry ("effective", "%s", \ effective < 0 \ ? NOT_DEFINED_STR \ : effective == CAP_SET \ ? YES_STR \ : NO_STR); \ \ entry ("inheritable", "%s", \ inheritable < 0 \ ? NOT_DEFINED_STR \ : inheritable == CAP_SET \ ? YES_STR \ : NO_STR); \ \ entry ("permitted", "%s", \ permitted < 0 \ ? NOT_DEFINED_STR \ : permitted == CAP_SET \ ? YES_STR \ : NO_STR); \ \ section_close (); \ } #else #define show_capability(caps, cap) #endif /** * LINUX_KERNEL_M: * @major: Linux major kernel version number. * * Returns: TRUE if running Linux kernel is atleast at version * specified by @major else FALSE. **/ #define LINUX_KERNEL_M(major) \ (linux_kernel_version (major, -1, -1)) /** * LINUX_KERNEL_MM: * @major: Linux major kernel version number, * @minor: Linux minor kernel version number. * * Returns: TRUE if running Linux kernel is atleast at version * specified by (@major, @minor) else FALSE. **/ #define LINUX_KERNEL_MM(major, minor) \ (linux_kernel_version (major, minor, -1)) /** * LINUX_KERNEL_MMR: * @major: Linux major kernel version number, * @minor: Linux minor kernel version number, * @revision: kernel revision version. * * Returns: TRUE if running Linux kernel is atleast at version * specified by (@major, @minor, @revision) else FALSE. **/ #define LINUX_KERNEL_MMR(major, minor, revision) \ (linux_kernel_version (major, minor, revision)) #endif #include #include #include #include #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) #include #include #include #include #include #include #include #include #endif #if defined (PROCENV_HURD) #include #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) #include #endif #if defined (PROCENV_BSD) #define PROCENV_CPU_SET_TYPE cpuset_t #include #if defined (HAVE_SYS_CAPABILITY_H) #include #if defined (PROCENV_BSD) && __FreeBSD__ == 9 /* FreeBSD 9 introduced optional capabilities. FreeBSD enabled them by * default, changing some of the system calls in the process, so handle * the name changes. */ #define cap_rights_get(fd, rightsp) cap_getrights (fd, (rightsp)) #define cap_rights_is_set(rightsp, cap) ((*rightsp) & (cap)) #endif /* PROCENV_BSD && __FreeBSD__ == 9 */ #define show_capsicum_cap(rights, cap) \ entry (#cap, "%s", cap_rights_is_set ((&rights), cap) ? YES_STR : NO_STR) #endif /* HAVE_SYS_CAPABILITY_H */ #elif defined (PROCENV_LINUX) || defined (PROCENV_GNU_BSD) || defined (PROCENV_HURD) #if defined (HAVE_SYS_CAPABILITY_H) #include #endif #if ! defined (_LINUX_CAPABILITY_VERSION_3) && ! defined (CAP_LAST_CAP) /* Ugh */ #define CAP_LAST_CAP 30 #endif #define PROCENV_CPU_SET_TYPE cpu_set_t #endif /* PROCENV_LINUX || PROCENV_GNU_BSD || PROCENV_HURD */ #if defined (PROCENV_LINUX) #if defined (HAVE_SYS_CAPABILITY_H) #ifndef CAP_IS_SUPPORTED int cap_get_bound (cap_value_t cap); #define CAP_IS_SUPPORTED(cap) (cap_get_bound (cap) >= 0) #define PROCENV_NEED_LOCAL_CAP_GET_BOUND #endif #endif #endif /* Horrid hack for Hurd... :-( */ #ifndef PATH_MAX #define PATH_MAX 4096 #endif /* Environment Variables */ #define PROCENV_OUTPUT_ENV "PROCENV_OUTPUT" #define PROCENV_FORMAT_ENV "PROCENV_FORMAT" #define PROCENV_FILE_ENV "PROCENV_FILE" #define PROCENV_EXEC_ENV "PROCENV_EXEC" #define PROCENV_INDENT_ENV "PROCENV_INDENT" #define PROCENV_INDENT_CHAR_ENV "PROCENV_INDENT_CHAR" #define PROCENV_SEPARATOR_ENV "PROCENV_SEPARATOR" #define PROCENV_CRUMB_SEPARATOR_ENV "PROCENV_CRUMB_SEPARATOR" #define CTIME_BUFFER 32 #define PROCENV_BUFFER 1024 #define DEFAULT_ALLOC_GUESS_SIZE 8 #define MOUNTS "/proc/mounts" #define ROOT_PATH "/proc/self/root" #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE (!TRUE) #endif /* Network family for entries containing link-level interface * details. These entries will be cached to allow MAC addresses * to be extracted from them when displaying the corresponding * higher-level network family entries for the interface in * question. */ #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) #define PROCENV_LINK_LEVEL_FAMILY AF_LINK #elif defined (PROCENV_LINUX) #define PROCENV_LINK_LEVEL_FAMILY AF_PACKET #endif #if defined (PROCENV_BSD) #define statfs_int_type uint64_t #define statfs_int_fmt PRIu64 #elif defined (PROCENV_GNU_BSD) #define statfs_int_type uint64_t #define statfs_int_fmt "lu" #endif /* FIXME: gettext */ #define _(str) str #define YES_STR _("yes") #define NO_STR _("no") #define NON_STR _("non") #define NA_STR _("n/a") #define UNKNOWN_STR _("unknown") #define MAX_STR _(" (max)") #define DEFINED_STR _("defined") #define NOT_DEFINED_STR _("not defined") #define NOT_IMPLEMENTED_STR _("[not implemented]") #define BIG_STR _("big") #define LITTLE_STR _("little") #define PRIVILEGED_STR _("privileged") #define SUPPRESSED_STR _("[suppressed]") #define BUILD_TYPE_STD_STR _("standard") #define BUILD_TYPE_REPRODUCIBLE_STR _("reproducible") #if defined (PROCENV_BSD) /* SIGTHL is hidden by default */ #define NUM_SIGNALS 31 #else #define NUM_SIGNALS 32 #endif /* Size of blocks we will show the user (as df(1) does) */ #define DF_BLOCK_SIZE 1024 /* Default character to use for indent */ #define DEFAULT_INDENT_CHAR " " /* If an indent is required, use this many INDENT_CHARs by default */ #define DEFAULT_INDENT_AMOUNT 2 #define PROGRAM_AUTHORS "James Hunt " #define show(...) _show ("", indent, __VA_ARGS__) /** * showi: * * @_indent: additional indent amount, * @fmt: printf-style format and optional arguments. * * Write indented message to appropriate output location. **/ #define showi(_indent, ...) _show ("", indent+_indent, __VA_ARGS__) /** * _message: * @prefix: Fixed message prefix, * @fmt: printf-style format and optional arguments. * * Write unindented message to appropriate output location. **/ #define _message(prefix, ...) _show (prefix, 0, __VA_ARGS__) #define warn(...) \ { \ _message ("WARNING", __VA_ARGS__); \ } #ifdef DEBUG /* for when running under GDB */ #define die_finalise() raise (SIGUSR1) #else #define die_finalise() exit (EXIT_FAILURE) #endif #define bug(...) \ { \ _show ("BUG", 0, __VA_ARGS__); \ exit (EXIT_FAILURE); \ } #define POINTER_SIZE (sizeof (void *)) #define die(...) \ { \ output = OUTPUT_STDERR; \ _message ("ERROR", __VA_ARGS__); \ cleanup (); \ die_finalise (); \ } #define common_assert() \ assert (doc); \ assert (indent >= 0) #define assert_not_reached() \ do { \ die ("%s:%d: Not reached assertion failed in %s", \ __FILE__, __LINE__, __func__); \ } while (0) #define type_hex_width(type) \ (sizeof (type) * 2) #define show_clock_res(clock) \ { \ struct timespec res; \ section_open (#clock); \ if (clock_getres (clock, &res) < 0) \ entry ("resolution", "%s", UNKNOWN_STR); \ else \ entry ("resolution", "%ld.%09lds", res.tv_sec, res.tv_nsec); \ section_close (); \ } #define show_const(t, flag, constant) \ object_open (FALSE); \ entry (#constant, "%d", !!(t.flag & constant)); \ object_close (FALSE) /** * Show a terminal special characters attribute. * * t: struct termios, * elem: element of c_cc array, * lock_status: struct termios representing lock status of @t. **/ #define show_cc_tty(t, elem, lock_status) \ entry (#elem, "0x%x%s", \ t.c_cc[elem], \ lock_status.c_cc[elem] ? " (locked)" : ""); /** * Show a terminal attribute constant value. * * t: struct termios, * flag: name of attribute, * constant: value of @flag, * lock_status: struct termios representing lock status of @t. **/ #define show_const_tty(t, flag, constant, lock_status) \ entry (#constant, \ "%d%s", \ !!(t.flag & constant), \ !!(lock_status.flag) ? " (locked)" : "") #define show_pathconf(what, path, name) \ { \ long conf; \ errno = 0; \ conf = pathconf (path, name); \ if (conf == -1 && errno == 0) { \ entry (#name, "%s", NA_STR); \ } else { \ entry (#name, "%d", conf); \ } \ } #define SPEED(s) \ {s, #s } #define mk_map_entry(s) \ {s, #s } #define show_confstr(s) \ { \ _show_confstr (s, #s); \ } #define _show_confstr(s, name) \ { \ size_t len; \ char *buffer; \ \ errno = 0; \ len = confstr(s, NULL, 0); \ assert (len && errno == 0); \ \ buffer = calloc (1, len); \ if (! buffer) { \ die ("failed to allocate space for confstr"); \ } \ \ assert (confstr (s, buffer, len) == len); \ \ /* Convert multi-line values to multi-field */ \ for (size_t i = 0; i < len; i++) { \ if (buffer[i] == '\n') buffer[i] = ' '; \ } \ \ entry (name, "%s%s%s", \ buffer && buffer[0] ? "'" : "", \ buffer && buffer[0] ? buffer : NA_STR, \ buffer && buffer[0] ? "'" : ""); \ \ free (buffer); \ } /* Note: param is ignored */ #define limit_max(l) \ ((unsigned long int)-1) #define show_limit(limit) \ { \ struct rlimit tmp; \ \ if (getrlimit (limit, &tmp) < 0) { \ die ("failed to query rlimit '%s'", #limit); \ } \ \ section_open (#limit); \ \ section_open ("soft"); \ entry ("current", "%lu", (unsigned long int)tmp.rlim_cur); \ entry ("max", "%lu", limit_max (limit)); \ section_close (); \ \ section_open ("hard"); \ entry ("current", "%lu", (unsigned long int)tmp.rlim_max); \ entry ("max", "%lu", limit_max (limit)); \ section_close (); \ \ section_close (); \ } #define show_usage(rusage, name) \ entry (#name, "%lu", rusage.name) #define get_sysconf(s) \ sysconf (s) #define mk_sysconf_map_entry(name) \ {name, #name } #define show_sizeof_type(type) \ entry (#type, "%lu byte%s", \ (unsigned long int)sizeof (type), \ sizeof (type) == 1 ? "" : "s") #define show_size(type) \ entry ("size", "%lu byte%s", \ (unsigned long int)sizeof (type), \ sizeof (type) == 1 ? "" : "s") /** * @buf: string, * @len: number of _characters_ (*NOT* bytes!) in @buf, * @size: allocated size of @buf in bytes. **/ typedef struct procenv_string { wchar_t *buf; size_t len; size_t size; } pstring; typedef enum { SHOW_ALL, SHOW_MOUNTS, SHOW_PATHCONF } ShowMountType; typedef enum { OUTPUT_FORMAT_TEXT, OUTPUT_FORMAT_CRUMB, OUTPUT_FORMAT_JSON, OUTPUT_FORMAT_XML } OutputFormat; typedef struct translate_map_entry { wchar_t from; wchar_t *to; } TranslateMapEntry; typedef enum element_type { ELEMENT_TYPE_ENTRY, ELEMENT_TYPE_SECTION_OPEN, ELEMENT_TYPE_SECTION_CLOSE, ELEMENT_TYPE_CONTAINER_OPEN, ELEMENT_TYPE_CONTAINER_CLOSE, ELEMENT_TYPE_OBJECT_OPEN, ELEMENT_TYPE_OBJECT_CLOSE, ELEMENT_TYPE_NONE = -1 } ElementType; typedef struct element { ElementType type; char *name; char *value; /* Optional array of name/value pairs associated with @name */ char **attributes; } Element; /* * XXX: Gross magic number must equal the maximum number of entries in * any particular OutputFormats translation table. * * This must be updated to reflect the maximum values in any * TranslateMapEntry, plus 1. */ #define TRANSLATE_MAP_ENTRIES (5+1) #define free_if_set(ptr) \ if (ptr) free (ptr) typedef struct translate_table { OutputFormat output_format; TranslateMapEntry map[TRANSLATE_MAP_ENTRIES]; } TranslateTable; struct procenv_map { int num; char *name; }; typedef enum procenv_output { OUTPUT_FILE, OUTPUT_STDERR, OUTPUT_STDOUT, OUTPUT_SYSLOG, OUTPUT_TERM } Output; struct baud_speed { speed_t speed; char *name; }; struct procenv_user { pid_t pid; pid_t ppid; pid_t sid; #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) char proc_name[16]; #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) char proc_name[COMMLEN+1]; #endif pid_t pgroup; pid_t fg_pgroup; pid_t pgid_sid; char ctrl_terminal[L_ctermid]; int tty_fd; uid_t uid; uid_t euid; uid_t suid; char *login; gid_t gid; gid_t egid; gid_t sgid; struct passwd passwd; }; struct procenv_misc { char cwd[PATH_MAX]; char root[PATH_MAX]; mode_t umask_value; int cpu; #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) int in_jail; #endif }; struct procenv_priority { int process; int pgrp; int user; }; struct network_map { struct ifaddrs ifaddr; char *mac_address; struct network_map *next; struct network_map *prev; }; pstring *pstring_new (void); pstring *pstring_create (const wchar_t *str); void pstring_free (pstring *str); pstring *char_to_pstring (const char *str); wchar_t *char_to_wchar (const char *str); char *wchar_to_char (const wchar_t *wstr); char *pstring_to_char (const pstring *str); void master_header (pstring **doc); void master_footer (pstring **doc); void header (const char *name); void footer (void); void object_open (int retain); void object_close (int retain); void section_open (const char *name); void section_close (void); void container_open (const char *name); void container_close (void); void entry (const char *name, const char *fmt, ...); void _show (const char *prefix, int indent, const char *fmt, ...); void _show_output (const char *str); void _show_output_pstring (const pstring *pstr); /* operate on multi-bytes */ void append (char **dest, const char *src); void appendn (char **dest, const char *src, size_t len); void appendf (char **dest, const char *fmt, ...); void appendva (char **dest, const char *fmt, va_list ap); /* operate on pure wide-characters */ void wappend (pstring **dest, const wchar_t *src); void wappendn (pstring **dest, const wchar_t *src, size_t len); void wappendf (pstring **dest, const wchar_t *fmt, ...); void wappendva (pstring **dest, const wchar_t *fmt, va_list ap); /* operate on wide-characters, but using multi-byte formats */ void wmappend (pstring **dest, const char *src); void wmappendn (pstring **dest, const char *src, size_t len); void wmappendf (pstring **dest, const char *fmt, ...); void wmappendva (pstring **dest, const char *fmt, va_list ap); void pappend (pstring **dest, const pstring *src); int get_indent (void); void inc_indent (void); void dec_indent (void); void add_indent (pstring **doc); void change_element (ElementType new); void format_element (void); void format_text_element (void); void format_json_element (void); void format_xml_element (void); int encode_string (pstring **pstr); pstring *translate (const pstring *pstr); void compress (pstring **wstr, wchar_t remove_char); void chomp (pstring *str); void show_version (void); void save_locale (void); void restore_locale (void); void handle_indent_char (void); void init (void); void cleanup (void); bool in_chroot (void); const char *container_type (void); bool is_process_group_leader (void); bool is_session_leader (void); void assert_cwd (void); void assert_chroot (void); void assert_user (void); void dump_options (void); void show_proc (void); void show_misc (void); void show_env (void); void show_rlimits (void); void show_rusage (void); void show_sysconf (void); char *get_user_name (gid_t gid); char *get_group_name (gid_t gid); char *pid_to_name (pid_t pid); #ifndef PROCENV_ANDROID void show_confstrs (void); #endif void show_priorities (void); void show_shared_mem (void); void show_semaphores (void); void show_msg_queues (void); void dump_priorities (void); void show_mounts (ShowMountType what); void get_user_info (void); void get_priorities (void); void format_time (const time_t *t, char *buffer, size_t len); char *format_perms (mode_t mode); void get_config (void); void get_config_from_env (void); void check_config (void); void show_proc_branch (void); void show_tty_attrs (void); const char *get_speed (speed_t speed); const char *get_signal_name (int signum); void show_arguments (void); void show_meta (void); char *get_os (void); char *get_arch (void); void show_platform (void); #ifndef PROCENV_ANDROID int libs_callback (struct dl_phdr_info *info, size_t size, void *data); void show_libs (void); #endif void show_clocks (void); void show_timezone (void); void show_time (void); void show_signals (void); void show_pathconfs (ShowMountType what, const char *dir); void show_sizeof (void); void show_ranges (void); void show_compiler (void); void show_libc (void); void get_uname (void); void show_uname (void); void show_all_groups (void); void show_fds (void); void show_namespaces (void); void show_fds_generic (void); #if !defined (PROCENV_HURD) int is_console (int fd); #endif long get_kernel_bits (void); bool has_ctty (void); void show_cpu (void); void show_cpu_affinities (void); void show_memory (void); void show_threads (void); void check_envvars (void); int get_output_value (const char *name); int get_output_format (const char *name); const char *get_output_format_name (void); void show_stat (void); void show_locale (void); int get_major_minor (const char *path, unsigned int *_major, unsigned int *_minor); bool uid_match (uid_t uid); char *get_path (const char *argv0); bool is_big_endian (void); const char *get_thread_scheduler_name (int sched); int qsort_compar (const void *a, const void *b); void show_data_model (void); const char *get_net_family_name (sa_family_t family); void show_network (void); void show_network_if (const struct ifaddrs *ifa, const char *mac_address); void get_network_name (const struct sockaddr *address, int family, char *name); const char *get_ipv6_scope_name (uint32_t scope); char *get_mac_address (const struct ifaddrs *ifaddr); int get_mtu (const struct ifaddrs *ifaddr); void set_breadcrumb (const char *name); void add_breadcrumb (const char *name); void remove_breadcrumb (void); void clear_breadcrumbs (void); void show_cgroups (void); void show_oom (void); void show_capabilities (void); #if defined (PROCENV_LINUX) void decode_if_flags (unsigned int flags); void decode_extended_if_flags (const char *interface, unsigned short *flags); int get_canonical (const char *path, char *canonical, size_t len); void get_tty_locked_status (struct termios *lock_status); void show_fds_linux (void); void show_namespaces_linux (void); void show_cgroups_linux (void); void show_oom_linux (void); void show_timezone_linux (void); #if defined (HAVE_SYS_CAPABILITY_H) int get_capability_by_flag_type (cap_t cap_p, cap_flag_t type, cap_value_t cap); #endif /* HAVE_SYS_CAPABILITY_H */ void show_capabilities_linux (void); void show_security_module_linux (void); void show_security_module_context_linux (void); void show_prctl_linux (void); void show_cpu_linux (void); char *get_scheduler_name (int sched); bool linux_kernel_version (int major, int minor, int revision); void show_numa_memory (void); #if defined (HAVE_NUMA_H) const char *get_numa_policy (int policy); #endif /* HAVE_NUMA_H */ const char *get_personality_name (unsigned int domain); char *get_personality_flags (unsigned int flags); #else /* ! PROCENV_LINUX */ void show_cgroups_stub (void); void show_oom_stub (void); void show_capabilities_stub (void); void show_timezone_stub (void); void show_shared_mem_stub (void); void show_semaphores_stub (); void show_msg_queues_stub (void); void show_namespaces_stub (void); #endif /* PROCENV_LINUX */ #if defined (PROCENV_LINUX) || defined (PROCENV_GNU_BSD) void show_proc_branch_linux (void); #endif /* PROCENV_LINUX || PROCENV_GNU_BSD */ #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) void show_shared_mem_linux (void); void show_semaphores_linux (void); void show_msg_queues_linux (void); #endif /* PROCENV_LINUX || PROCENV_HURD */ #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) void show_mounts_linux (ShowMountType what); #endif #if defined (PROCENV_BSD) || defined (PROCENV_GNU_BSD) char *get_mount_opts_bsd (uint64_t flags); void show_mounts_bsd (ShowMountType what); void show_network_bsd (void); void get_misc_bsd (void); void show_proc_branch_bsd (void); void show_cpu_bsd (void); #endif /* PROCENV_BSD + PROCENV_GNU_BSD */ #if defined (PROCENV_BSD) && defined (HAVE_SYS_CAPABILITY_H) void show_capabilities_bsd (int fd); #endif /* (PROCENV_BSD) && defined (HAVE_SYS_CAPABILITY_H) */ #if defined (PROCENV_LINUX) || defined (PROCENV_HURD) /* semctl(2) on Linux tells us _we_ must define this */ union semun { int val; struct semid_ds *buf; unsigned short int *array; struct seminfo *__buf; }; #endif extern char **environ; #endif /* PROCENV_H */ procenv-0.43/src/tests/000077500000000000000000000000001262513272000150455ustar00rootroot00000000000000procenv-0.43/src/tests/check_all_args.in000077500000000000000000000440221262513272000203230ustar00rootroot00000000000000#!/bin/sh -e #--------------------------------------------------------------------- # run procenv with every argument #--------------------------------------------------------------------- script_name=${0##*/} # Use full path to build binary procenv="@builddir@/procenv" man_path="@man_path@" template="/tmp/${script_name}.XXXXXXXXXX" json_tests=0 xml_tests=0 xml_checker=xmlwf json_checker=json_pp # XML disallows reliable encoding of control characters. Since the only # anticipated possible source of such literal control characters is # environment variables, such tests will be skipped if this variable has # the value 1. control_chars_in_env=0 # with random values non_display_options=" --crumb-separator=. --file=/tmp/foo --format=crumb --indent=7 --indent-char=X --separator=X " lang_list= die () { local str="$*" echo "ERROR: $str" >&2 [ -n "$cmd" ] && echo "ERROR: (cmd='$cmd')" >&2 [ -e "$stdout" ] && echo "ERROR: stdout:\n$(cat $stdout)" >&2 [ -e "$stderr" ] && echo "ERROR: stderr:\n$(cat $stderr)" >&2 exit 1 } warn () { local str="$*" echo "WARNING: $str" } debug () { local str="$*" [ -n "$PROCENV_TEST_DEBUG" ] && echo "DEBUG: $str" || : } msg () { local str="$*" echo "INFO:LANG=$LANG:LC_ALL=$LC_ALL: $str" } run_command() { _run_command success "$1" "$2" "$3" } run_command_expect_fail() { _run_command failure "$1" "$2" "$3" } is_utf8() { local locale="$1" echo "$locale"|grep -qi "utf.*8" && echo yes || echo no } _run_command() { local expected_outcome="$1" local cmdline="$2" local stdout="$3" local stderr="$4" local failed=0 [ -z "$cmdline" ] && die "need command" debug "Running: '$cmdline'" { eval "$cmdline"; ret=$?; } || : if [ "$expected_outcome" = success ] then [ "$ret" -ne 0 ] && failed=1 else [ "$ret" -eq 0 ] && failed=1 fi [ "$failed" -eq 1 ] && \ die "Command '$cmdline' returned $ret but expected $expected_outcome" return 0 } get_procenv_options() { $procenv --help | grep -- '-[a-zA-Z0-9], --[a-zA-Z][a-zA-Z0-9]*' |\ cut -d: -f1 | tr ',' '\n' | tr -d ' ' | egrep -v -- '(-h|--help)' } get_man_options() { groff -a -man -Tascii "$man_path" |\ grep -- '^ *<->[a-zA-Z0-9], <-><->[a-zA-Z0-9][a-zA-Z0-9]' |\ tr -d '[<>]' |\ sed 's/^ *//g' |\ tr ',' '\n' |\ tr -d ' ' |\ egrep -v -- '(-h|--help)' } init() { [ -n "$PROCENV_TEST_DISABLE" ] && msg "Tests disabled" && exit 0 [ -f "$procenv" ] || die "cannot find binary: $procenv" command -v "$json_checker" >/dev/null 2>&1 && \ json_tests=1 || warn "no $json_checker - JSON tests disabled" command -v "$xml_checker" >/dev/null 2>&1 && \ xml_tests=1 || warn "no $xml_checker - XML tests disabled" env | grep -q "[[:cntrl:]]" && control_chars_in_env=1 # Always test the default locales lang_list="C C.UTF-8 POSIX" if [ -n "$LANG" ] && [ "$LANG" != "C" ] && [ "$LANG" != "C.UTF-8" ] then lang_list="$lang_list $LANG" fi msg "language list: '$lang_list'" } run_tests() { utf8=$(is_utf8 "$LANG") procenv_version=$($procenv --version|grep "version: [0-9]"|awk '{print $2}') [ -n "$procenv_version" ] || die "failed to query procenv version" #--------------------------------------------------------------------- msg "Running tests for language '$LANG'" #--------------------------------------------------------------------- msg "Ensure $procenv runs with no errors" stdout=$(mktemp "$template") stderr=$(mktemp "$template") $procenv 1>"$stdout" 2>"$stderr" rm -f "$stdout" "$stderr" # Save all sections that are displayed by default for later checks sections=$($procenv|grep "^[a-z0-9][a-z0-9 ]*:$") msg "Ensuring output is sorted by section" main_sections=$(mktemp "$template") sorted_sections=$(mktemp "$template") unique_sections=$(mktemp "$template") # ignore meta which always comes first echo "$sections"|grep -v meta: > "$main_sections" echo "$sections"|grep -v meta:|sort > "$sorted_sections" echo "$sections"|grep -v meta:|sort -u > "$unique_sections" diff=$(diff "$main_sections" "$sorted_sections" || :) [ -n "$diff" ] && die "sections are not sorted - diff: $diff" diff=$(diff "$sorted_sections" "$unique_sections" || :) [ -n "$diff" ] && die "sections are not unique - diff: $diff" rm -f "$main_sections" "$sorted_sections" "$unique_sections" remaining_file=$(mktemp "$template") echo "$sections" > "$remaining_file" # pathconf cannot be handled below as it is indented under the mount # output, so just check we can find some evidence of it being displayed. $procenv|egrep -q "\:" || die "Failed to find pathconf" #--------------------------------------------------------------------- msg "Ensure --file= works" out=$(mktemp "$template") stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv --file=\"$out\" 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] && die "Unexpected stdout output: $stdout" [ -s "$stderr" ] && die "Unexpected stderr output: $stderr" [ -s "$out" ] || die "Expected output in file $out" rm "$out" rm -f "$stdout" "$stderr" #--------------------------------------------------------------------- msg "Ensure --output=stdout works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv --output=stdout 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output: $stderr" # ensure internal compression is working grep -q '^$' "$stdout" && die "Found blank lines in output" rm -f "$stdout" "$stderr" #--------------------------------------------------------------------- msg "Ensure --output=stderr works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv --output=stderr 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stderr" ] || die "Expected stderr output in file $stderr" [ -s "$stdout" ] && die "Unexpected stdout output: $stdout" rm -f "$stdout" "$stderr" #--------------------------------------------------------------------- msg "Ensure --exec works" str="hello world" out=$(mktemp "$template") stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv --output=file --file=\"$out\" \ --exec echo \"$str\" 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$out" ] || die "Expected $procenv output in file $out" [ -s "$stderr" ] && die "Unexpected stderr output in file $stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" result=$(cat "$stdout") [ "$result" != "$str" ] && die \ "Expected file $stdout to contain '$str', found '$result'" rm -f "$stdout" "$stderr" "$out" #--------------------------------------------------------------------- msg "Ensure --exec can exec $procenv" out=$(mktemp "$template") out2=$(mktemp "$template") stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv --output=file --file=\"$out\" \ --exec -- $procenv --file=\"$out2\" \ 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$out" ] || die "Expected $procenv output in file $out" [ -s "$out2" ] || die "Expected $procenv output in file $out2" [ -s "$stdout" ] && die "Unexpected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output in file $stderr" rm -f "$stdout" "$stderr" "$out" "$out2" #--------------------------------------------------------------------- arg='--format=text' msg "Ensure '$arg' works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv $arg 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output in file $stdout" rm -f "$stdout" "$stderr" #--------------------------------------------------------------------- arg='--format=crumb' msg "Ensure '$arg' works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv $arg 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output in file $stdout" rm -f "$stdout" "$stderr" #--------------------------------------------------------------------- arg='--indent-char' seps=". ;" [ "$utf8" = yes ] && seps="$seps → ❤" for sep in $seps do opt="${arg}=${sep}" msg "Ensure '$opt' works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv \"$opt\" \ --version 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output in file $stdout" grep -q "^${sep}${sep}version: ${procenv_version}$" "$stdout" ||\ die "Did not find expected output for arg '$arg'" rm -f "$stdout" "$stderr" done # --indent-char *must* be a single character, so ensure multi-char # values are flagged as incorrect. seps="12 123 1234" [ "$utf8" = yes ] && seps="$seps →❤ →❤→ ❤→❤❤" for sep in $seps do opt="${arg}=${sep}" msg "Ensure '$opt' works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv \"$opt\" \ --version 1>\"$stdout\" 2>\"$stderr\"" run_command_expect_fail "$cmd" [ -s "$stdout" ] && die "Unexpected stdout output in file $stdout" [ -s "$stderr" ] || die "Expected stderr output in file $stdout" rm -f "$stdout" "$stderr" done #--------------------------------------------------------------------- arg='--separator' # Choose a few common ones, a few UTF-8 ones and a few # multi-character ones. seps=". ; 12 123 1234" [ "$utf8" = yes ] && sep="$seps → ❤ →❤ →❤→ ❤→❤❤" for sep in $seps do opt="${arg}=${sep}" msg "Ensure '$opt' works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv \"$opt\" \ --version 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output in file $stdout" grep -q "^ version${sep}${procenv_version}$" "$stdout" ||\ die "Did not find expected output for arg '$arg'" rm -f "$stdout" "$stderr" done #--------------------------------------------------------------------- arg='--crumb-separator' # Choose a few common ones, a few UTF-8 ones and a few # multi-character ones. seps=". ; 12 123 1234" [ "$utf8" = yes ] && seps="$seps → ❤ →❤ →❤→ ❤→❤❤" for sep in $seps do opt="${arg}=${sep}" msg "Ensure '$opt' works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv --format=crumb \"$opt\" \ --separator=\"$sep\" \ --version 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output in file $stdout" grep -q "^version${sep}version${sep}${procenv_version}$" "$stdout" ||\ die "Did not find expected output for arg '$arg'" rm -f "$stdout" "$stderr" done #--------------------------------------------------------------------- if [ "$xml_tests" -eq 1 ] then arg='--format=xml' if [ "$control_chars_in_env" -eq 1 ] then warn "Skipping '$arg' test as control characters found in environment" else msg "Ensure '$arg' works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv $arg 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output in file $stdout" [ -z "$($xml_checker "$stdout")" ] || die "XML output not well-formed" rm -f "$stdout" "$stderr" fi fi #--------------------------------------------------------------------- if [ "$json_tests" -eq 1 ] then arg='--format=json' msg "Ensure '$arg' works" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv $arg 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -s "$stdout" ] || die "Expected stdout output in file $stdout" [ -s "$stderr" ] && die "Unexpected stderr output in file $stdout" $json_checker < "$stdout" >/dev/null rm -f "$stdout" "$stderr" fi #--------------------------------------------------------------------- msg "Ensure all documented options produce output" procenv_options=$(get_procenv_options) echo "$procenv_options" | while read arg do stdout=$(mktemp "$template") stderr=$(mktemp "$template") # No format option cmd="$procenv $arg 1>\"$stdout\" 2>\"$stderr\"" msg "Running '$cmd'" run_command "$cmd" "$stdout" "$stderr" [ -z "$stdout" ] && die "No stdout output running '$cmd'" [ -s "$stderr" ] && die "Unexpected stderr output running '$cmd' ($stderr)" # Establish the name of the section section=$(head -1 "$stdout"|grep "^[^ ].*:$" || :) [ -z "$section" ] && die "No section title found running '$cmd'" if [ "$section" != "version:" ] then # XXX: pathconf has already been handled above. if [ "$section" != "pathconf:" ] then # Check that that same section appears in the # default output. If not, we forgot to update # dump(). echo "$sections"|grep -q "^${section}$" || \ die "Failed to find section '$section' in default $procenv output" fi fi # Remove this section as it's now been handled remaining=$(cat "$remaining_file"|grep -v "^${section}$" || :) echo "$remaining"> "$remaining_file" rm -f "$stdout" "$stderr" # Text format cmd="$procenv --format=text $arg 1>\"$stdout\" 2>\"$stderr\"" msg "Running '$cmd'" run_command "$cmd" "$stdout" "$stderr" [ -z "$stdout" ] && die "No stdout output running '$cmd'" [ -s "$stderr" ] && die "Unexpected stderr output running '$cmd' ($stderr)" if [ "$section" = "capabilities:" ] then tmp=$(grep 'CAP_LAST_CAP+1' "$stdout"|cut -d: -f2|tr -d ' ' || :) # take care to only perform this test on # platforms the _have_ capabilities :) if [ -n "$tmp" ] then last=$(expr "$tmp" - 1) [ -n "$last" ] || die "unable to establish last capability" { grep -q "number: $last" "$stdout"; ret=$?; } || : if [ $ret -ne 0 ] then warn "" warn "" warn "Found extra capability procenv is not aware of (number $last)" warn "" warn "Note that this warning will appear if procenv is built on a" warn "system which is running a newer kernel than the" warn "development environment assumes (for example if built in a" warn "chroot for a back-level release of ubuntu)" warn "" warn "Please check for a newer version of procenv, " warn "build on a newer system, or raise a bug at:" warn "" warn " @package_url@" warn "" warn "" fi fi fi rm -f "$stdout" "$stderr" # JSON format if [ "$json_tests" -eq 1 ] then cmd="$procenv --format=json $arg 1>\"$stdout\" 2>\"$stderr\"" msg "Running '$cmd'" run_command "$cmd" "$stdout" "$stderr" [ -z "$stdout" ] && die "No stdout output running '$cmd'" [ -s "$stderr" ] && die "Unexpected stderr output running '$cmd' ($stderr)" run_command "$json_checker < \"$stdout\" >/dev/null" "" "" rm -f "$stdout" "$stderr" fi # XML format if [ "$xml_tests" -eq 1 ] then cmd="$procenv --format=xml $arg" if [ "$section" = "environment:" -a "$control_chars_in_env" -eq 1 ] then warn "Skipping '$cmd' as control characters found in environment" else msg "Running '$cmd'" cmd="$cmd 1>\"$stdout\" 2>\"$stderr\"" run_command "$cmd" "$stdout" "$stderr" [ -z "$stdout" ] && die "No stdout output running '$cmd'" [ -s "$stderr" ] && die "Unexpected stderr output running '$cmd' ($stderr)" [ -z "$($xml_checker "$stdout")" ] || die "XML output not well-formed" fi rm -f "$stdout" "$stderr" fi done for arg in $non_display_options do # XXX: specifying a non-display option _after_ # specifing a display option used to be a NOP, but # is now disallowed as it is non-sensical and # the result could be surprising to the user. # # We select '--meta' as a random display option. msg "Ensure non-display option ('$arg') disallowed after display option ('--meta')" stdout=$(mktemp "$template") stderr=$(mktemp "$template") cmd="$procenv --meta $arg 1>'$stdout' 2>'$stderr'" run_command_expect_fail "$cmd" [ -s "$stdout" ] && die "Unexpected stdout output in file $stdout" [ -s "$stderr" ] || die "Expected stderr output in file $stdout" rm -f "$stdout" "$stderr" done # If there are any remaining sections that were produced by default # output but which have not been handed by command-line options, we # forgot to update usage(). msg "Checking for missing arguments" remaining=$(cat "$remaining_file") [ -n "$remaining" ] && \ die "No command-line option found for the following section(s): '$remaining'" rm -f "$remaining_file" msg "Ensure an empty environment is tolerated" if command -v env >/dev/null 2>&1 then cmd="env -i $procenv --environment >/dev/null 2>&1" run_command "$cmd" "" "" fi } run_final_tests() { # check options specified in man page exactly correlate with # those documented by procenv (and vice versa) procenv_options=$(get_procenv_options) man_options=$(get_man_options) for opt in $procenv_options do echo "$man_options"|grep -q "^${opt}$" ||\ die "failed to find option '$opt' in man page: $man_path" done for opt in $man_options do echo "$procenv_options"|grep -q "^${opt}$" ||\ die "failed to find option '$opt' in procenv help output" done } #--------------------------------------------------------------------- # allow this useful function to be called independent of the tests. case "$1" in options) get_procenv_options exit 0 esac init saved_lang=$LANG for lang in $lang_list do if ! locale -a|grep -q "^${lang}$" then msg "Not testing with locale language $lang" continue fi export LANG="$lang" LC_ALL="$lang" run_tests done run_final_tests [ -n "$saved_lang" ] && export LANG="$saved_lang" LC_ALL="$saved_lang" exit 0 #--------------------------------------------------------------------- procenv-0.43/src/tests/check_pr_list.c000066400000000000000000001233671262513272000200360ustar00rootroot00000000000000/*-------------------------------------------------------------------- * procenv - check(*) tests for generic list handing routines. * * (*) - check unit test program (see http://check.sourceforge.net/). * * Copyright © 2015 James Hunt . * * 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 . *-------------------------------------------------------------------- */ #include #include #include #include #define PROCENV_PR_LIST_TESTS #include #include /* tolerate old check versions */ #ifndef ck_assert_ptr_eq #define ck_assert_ptr_eq(a, b) \ assert ((a) == (b)) #endif #ifndef ck_assert_ptr_ne #define ck_assert_ptr_ne(a, b) \ assert ((a) != (b)) #endif #ifndef ck_assert_str_eq #define ck_assert_str_eq(a, b) \ assert (!strcmp (a, b)) #endif #ifndef ck_assert_uint_eq #define ck_assert_uint_eq(a, b) \ assert ((uint)a == (uint)b) #endif /********************************************************************/ char buffer[8]; static int count = 0; static void pr_list_visit_save_data(PRList *entry) { assert (entry); if (! entry->data) return; buffer[count] = *(const char *)entry->data; count++; } /********************************************************************/ START_TEST(test_pr_list_new) { char *s = "foo bar"; PRList *list; list = pr_list_new (s); ck_assert_ptr_ne (list, NULL); ck_assert_ptr_eq (list->next, list); ck_assert_ptr_eq (list->prev, list); free (list); } END_TEST /********************************************************************/ START_TEST(test_pr_list_append) { PRList *list, *p; PRList *entry1, *entry2, *entry3, *entry4, *entry5; /**********************************/ /* create a list */ list = pr_list_new (NULL); ck_assert_ptr_ne (list, NULL); ck_assert_ptr_eq (list->data, NULL); /**********************************/ /* create some list entries */ entry1 = pr_list_new ((void *)10); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); entry2 = pr_list_new ((void *)20); ck_assert_ptr_ne (entry2, NULL); ck_assert_uint_eq ((size_t)entry2->data, 20); entry3 = pr_list_new ((void *)30); ck_assert_ptr_ne (entry3, NULL); ck_assert_uint_eq ((size_t)entry3->data, 30); entry4 = pr_list_new ((void *)40); ck_assert_ptr_ne (entry4, NULL); ck_assert_uint_eq ((size_t)entry4->data, 40); entry5 = pr_list_new ((void *)50); ck_assert_ptr_ne (entry5, NULL); ck_assert_uint_eq ((size_t)entry5->data, 50); /**********************************/ /* add 1st entry */ p = pr_list_append (list, entry1); ck_assert_ptr_eq (p, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry1); /**********************************/ /* remove 1st entry */ p = pr_list_remove(entry1); ck_assert_ptr_eq (p, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, list); ck_assert_ptr_eq (list->prev, list); /**********************************/ /* re-add 1st entry */ p = pr_list_append (list, entry1); ck_assert_ptr_eq (p, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry1); /**********************************/ /* add 2nd entry */ p = pr_list_append (list, entry2); ck_assert_ptr_eq (p, entry2); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry1); ck_assert_ptr_eq (entry2->prev, list); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, entry2); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry1); /**********************************/ /* add 3rd entry */ p = pr_list_append (list, entry3); ck_assert_ptr_eq (p, entry3); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, list); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry1); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, entry2); ck_assert_ptr_eq (list->next, entry3); ck_assert_ptr_eq (list->prev, entry1); /**********************************/ /* add 4th entry */ p = pr_list_append (list, entry4); ck_assert_ptr_eq (p, entry4); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry3); ck_assert_ptr_eq (entry4->prev, list); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, entry4); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry1); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, entry2); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry1); /**********************************/ /* add 5th entry */ p = pr_list_append (list, entry5); ck_assert_ptr_eq (p, entry5); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry4); ck_assert_ptr_eq (entry5->prev, list); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry3); ck_assert_ptr_eq (entry4->prev, entry5); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, entry4); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry1); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, entry2); ck_assert_ptr_eq (list->next, entry5); ck_assert_ptr_eq (list->prev, entry1); /**********************************/ /* remove 1st entry */ p = pr_list_remove(entry1); ck_assert_ptr_eq (p, entry1); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry4); ck_assert_ptr_eq (entry5->prev, list); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry3); ck_assert_ptr_eq (entry4->prev, entry5); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, entry4); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry5); ck_assert_ptr_eq (list->prev, entry2); /**********************************/ /* remove last entry */ p = pr_list_remove(entry5); ck_assert_ptr_eq (p, entry5); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry3); ck_assert_ptr_eq (entry4->prev, list); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, entry4); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry2); /**********************************/ /* remove middle entry */ p = pr_list_remove(entry3); ck_assert_ptr_eq (p, entry3); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry2); ck_assert_ptr_eq (entry4->prev, list); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, entry4); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry2); /**********************************/ /* remove entry 2 */ p = pr_list_remove(entry2); ck_assert_ptr_eq (p, entry2); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, list); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry2); ck_assert_ptr_eq (entry2->prev, entry2); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry4); /**********************************/ /* re-add entry 2 */ p = pr_list_append (list, entry2); ck_assert_ptr_eq (p, entry2); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, entry2); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry4); ck_assert_ptr_eq (entry2->prev, list); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry4); /**********************************/ /* re-remove entry 2 (it's now in a different position) */ p = pr_list_remove(entry2); ck_assert_ptr_eq (p, entry2); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, list); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry2); ck_assert_ptr_eq (entry2->prev, entry2); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry4); /**********************************/ /* remove entry 4 */ p = pr_list_remove(entry4); ck_assert_ptr_eq (p, entry4); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry4); ck_assert_ptr_eq (entry4->prev, entry4); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry2); ck_assert_ptr_eq (entry2->prev, entry2); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, list); ck_assert_ptr_eq (list->prev, list); free (entry1); free (entry2); free (entry3); free (entry4); free (entry5); free (list); } END_TEST /********************************************************************/ START_TEST(test_pr_list_prepend) { PRList *list, *p; PRList *entry1, *entry2, *entry3, *entry4, *entry5; /**********************************/ /* create a list */ list = pr_list_new (NULL); ck_assert_ptr_ne (list, NULL); ck_assert_ptr_eq (list->data, NULL); /**********************************/ /* create some list entries */ entry1 = pr_list_new ((void *)10); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); entry2 = pr_list_new ((void *)20); ck_assert_ptr_ne (entry2, NULL); ck_assert_uint_eq ((size_t)entry2->data, 20); entry3 = pr_list_new ((void *)30); ck_assert_ptr_ne (entry3, NULL); ck_assert_uint_eq ((size_t)entry3->data, 30); entry4 = pr_list_new ((void *)40); ck_assert_ptr_ne (entry4, NULL); ck_assert_uint_eq ((size_t)entry4->data, 40); entry5 = pr_list_new ((void *)50); ck_assert_ptr_ne (entry5, NULL); ck_assert_uint_eq ((size_t)entry5->data, 50); /**********************************/ /* add 1st entry */ p = pr_list_prepend (list, entry1); ck_assert_ptr_eq (p, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry1); /**********************************/ /* remove 1st entry */ p = pr_list_remove(entry1); ck_assert_ptr_eq (p, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, list); ck_assert_ptr_eq (list->prev, list); /**********************************/ /* re-add 1st entry */ p = pr_list_prepend (list, entry1); ck_assert_ptr_eq (p, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry1); /**********************************/ /* add 2nd entry */ p = pr_list_prepend (list, entry2); ck_assert_ptr_eq (p, entry2); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry2); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry2); /**********************************/ /* add 3rd entry */ p = pr_list_prepend (list, entry3); ck_assert_ptr_eq (p, entry3); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, list); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry2); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry3); /**********************************/ /* add 4th entry */ p = pr_list_prepend (list, entry4); ck_assert_ptr_eq (p, entry4); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, entry3); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry4); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry2); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry4); /**********************************/ /* add 5th entry */ p = pr_list_prepend (list, entry5); ck_assert_ptr_eq (p, entry5); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, list); ck_assert_ptr_eq (entry5->prev, entry4); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry5); ck_assert_ptr_eq (entry4->prev, entry3); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry4); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, entry1); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry2); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry5); /**********************************/ /* remove 1st entry */ p = pr_list_remove(entry1); ck_assert_ptr_eq (p, entry1); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, list); ck_assert_ptr_eq (entry5->prev, entry4); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry5); ck_assert_ptr_eq (entry4->prev, entry3); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry4); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, list); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry5); /**********************************/ /* remove last entry */ p = pr_list_remove(entry5); ck_assert_ptr_eq (p, entry5); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, entry3); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry4); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, list); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry4); /**********************************/ /* remove middle entry */ p = pr_list_remove(entry3); ck_assert_ptr_eq (p, entry3); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, entry2); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry4); ck_assert_ptr_eq (entry2->prev, list); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry4); /**********************************/ /* remove entry 2 */ p = pr_list_remove(entry2); ck_assert_ptr_eq (p, entry2); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, list); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry2); ck_assert_ptr_eq (entry2->prev, entry2); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry4); /**********************************/ /* re-add entry 2 */ p = pr_list_prepend (list, entry2); ck_assert_ptr_eq (p, entry2); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry2); ck_assert_ptr_eq (entry4->prev, list); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, entry4); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry2); /**********************************/ /* re-remove entry 2 (it's now in a different position) */ p = pr_list_remove(entry2); ck_assert_ptr_eq (p, entry2); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, list); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry2); ck_assert_ptr_eq (entry2->prev, entry2); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry4); /**********************************/ /* remove entry 4 */ p = pr_list_remove(entry4); ck_assert_ptr_eq (p, entry4); ck_assert_uint_eq ((size_t)entry5->data, 50); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); ck_assert_uint_eq ((size_t)entry4->data, 40); ck_assert_ptr_eq (entry4->next, entry4); ck_assert_ptr_eq (entry4->prev, entry4); ck_assert_uint_eq ((size_t)entry3->data, 30); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); ck_assert_uint_eq ((size_t)entry2->data, 20); ck_assert_ptr_eq (entry2->next, entry2); ck_assert_ptr_eq (entry2->prev, entry2); ck_assert_ptr_ne (entry1, NULL); ck_assert_uint_eq ((size_t)entry1->data, 10); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); ck_assert_ptr_eq (list->next, list); ck_assert_ptr_eq (list->prev, list); free (entry1); free (entry2); free (entry3); free (entry4); free (entry5); free (list); } END_TEST /********************************************************************/ START_TEST(test_pr_list_append_str) { char *s[] = { "a", "b", "c"}; PRList *list; PRList *entry1, *entry2, *entry3; list = pr_list_new (s[0]); ck_assert_ptr_ne (list, NULL); /* 1st entry */ entry1 = pr_list_append_str (list, (void *)s[0]); ck_assert_ptr_ne (entry1, NULL); ck_assert_str_eq ((const char *)entry1->data, s[0]); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry1); /* 2nd entry */ entry2 = pr_list_append_str (list, (void *)s[1]); ck_assert_ptr_ne (entry2, NULL); ck_assert_str_eq ((const char *)entry2->data, s[1]); ck_assert_ptr_eq (entry2->next, entry1); ck_assert_ptr_eq (entry2->prev, list); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, entry2); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry1); /* 3rd entry */ entry3 = pr_list_append_str (list, (void *)s[2]); ck_assert_ptr_ne (entry3, NULL); ck_assert_str_eq ((const char *)entry3->data, s[2]); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, list); ck_assert_ptr_eq (entry2->next, entry1); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, entry2); ck_assert_ptr_eq (list->next, entry3); ck_assert_ptr_eq (list->prev, entry1); free((char *)entry1->data); free(entry1); free((char *)entry2->data); free(entry2); free((char *)entry3->data); free(entry3); free (list); } END_TEST /********************************************************************/ START_TEST(test_pr_list_prepend_str) { char *s[] = { "a", "b", "c"}; PRList *list; PRList *entry1, *entry2, *entry3; list = pr_list_new (s[0]); ck_assert_ptr_ne (list, NULL); /* 1st entry */ entry1 = pr_list_prepend_str (list, (void *)s[0]); ck_assert_ptr_ne (entry1, NULL); ck_assert_str_eq ((const char *)entry1->data, s[0]); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry1); /* 2nd entry */ entry2 = pr_list_prepend_str (list, (void *)s[1]); ck_assert_ptr_ne (entry2, NULL); ck_assert_str_eq ((const char *)entry2->data, s[1]); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, entry1); ck_assert_ptr_eq (entry1->next, entry2); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry2); /* 3rd entry */ entry3 = pr_list_prepend_str (list, (void *)s[2]); ck_assert_ptr_ne (entry3, NULL); ck_assert_str_eq ((const char *)entry3->data, s[2]); ck_assert_ptr_eq (entry3->next, list); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, entry1); ck_assert_ptr_eq (entry1->next, entry2); ck_assert_ptr_eq (entry1->prev, list); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry3); free((char *)entry1->data); free(entry1); free((char *)entry2->data); free(entry2); free((char *)entry3->data); free(entry3); free (list); } END_TEST /********************************************************************/ START_TEST(test_pr_list_prepend_str_sorted) { PRList *list, *p; PRList *entry1, *entry2, *entry3, *entry4, *entry5; /**********************************/ /* create a list */ list = pr_list_new (NULL); ck_assert_ptr_ne (list, NULL); ck_assert_ptr_eq (list->data, NULL); /**********************************/ /* create some list entries */ entry1 = pr_list_new (strdup("a")); ck_assert_ptr_ne (entry1, NULL); ck_assert_str_eq ((char *)entry1->data, "a"); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); entry2 = pr_list_new (strdup("b")); ck_assert_ptr_ne (entry2, NULL); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, entry2); ck_assert_ptr_eq (entry2->prev, entry2); entry3 = pr_list_new (strdup("c")); ck_assert_ptr_ne (entry3, NULL); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); entry4 = pr_list_new (strdup("d")); ck_assert_ptr_ne (entry4, NULL); ck_assert_str_eq ((char *)entry4->data, "d"); ck_assert_ptr_eq (entry4->next, entry4); ck_assert_ptr_eq (entry4->prev, entry4); entry5 = pr_list_new (strdup("e")); ck_assert_ptr_ne (entry5, NULL); ck_assert_str_eq ((char *)entry5->data, "e"); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); /**********************************/ /* add an entry */ p = pr_list_prepend_str_sorted(list, entry2); ck_assert_ptr_eq (p, entry2); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, list); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry2); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "b"); /**********************************/ /* add another entry */ p = pr_list_prepend_str_sorted(list, entry3); ck_assert_ptr_eq (p, entry3); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, list); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, list); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry3); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "bc"); /**********************************/ /* add yet another entry */ p = pr_list_prepend_str_sorted(list, entry4); ck_assert_ptr_eq (p, entry4); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, list); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry4); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_str_eq ((char *)entry4->data, "d"); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, entry3); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry4); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "bcd"); /**********************************/ /* add the first entry */ p = pr_list_prepend_str_sorted(list, entry1); ck_assert_ptr_eq (p, entry1); ck_assert_str_eq ((char *)entry1->data, "a"); ck_assert_ptr_eq (entry1->next, entry2); ck_assert_ptr_eq (entry1->prev, list); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, entry1); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry4); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_str_eq ((char *)entry4->data, "d"); ck_assert_ptr_eq (entry4->next, list); ck_assert_ptr_eq (entry4->prev, entry3); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry4); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "abcd"); /**********************************/ /* add the last entry */ p = pr_list_prepend_str_sorted(list, entry5); ck_assert_ptr_eq (p, entry5); ck_assert_str_eq ((char *)entry1->data, "a"); ck_assert_ptr_eq (entry1->next, entry2); ck_assert_ptr_eq (entry1->prev, list); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, entry3); ck_assert_ptr_eq (entry2->prev, entry1); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry4); ck_assert_ptr_eq (entry3->prev, entry2); ck_assert_str_eq ((char *)entry4->data, "d"); ck_assert_ptr_eq (entry4->next, entry5); ck_assert_ptr_eq (entry4->prev, entry3); ck_assert_str_eq ((char *)entry5->data, "e"); ck_assert_ptr_eq (entry5->next, list); ck_assert_ptr_eq (entry5->prev, entry4); ck_assert_ptr_eq (list->next, entry1); ck_assert_ptr_eq (list->prev, entry5); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "abcde"); /**********************************/ free ((char *)entry1->data); free (entry1); free ((char *)entry2->data); free (entry2); free ((char *)entry3->data); free (entry3); free ((char *)entry4->data); free (entry4); free ((char *)entry5->data); free (entry5); free (list); } END_TEST /********************************************************************/ START_TEST(test_pr_list_append_str_sorted) { PRList *list, *p; PRList *entry1, *entry2, *entry3, *entry4, *entry5; /**********************************/ /* create a list */ list = pr_list_new (NULL); ck_assert_ptr_ne (list, NULL); ck_assert_ptr_eq (list->data, NULL); /**********************************/ /* create some list entries */ entry1 = pr_list_new (strdup("a")); ck_assert_ptr_ne (entry1, NULL); ck_assert_str_eq ((char *)entry1->data, "a"); ck_assert_ptr_eq (entry1->next, entry1); ck_assert_ptr_eq (entry1->prev, entry1); entry2 = pr_list_new (strdup("b")); ck_assert_ptr_ne (entry2, NULL); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, entry2); ck_assert_ptr_eq (entry2->prev, entry2); entry3 = pr_list_new (strdup("c")); ck_assert_ptr_ne (entry3, NULL); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry3); ck_assert_ptr_eq (entry3->prev, entry3); entry4 = pr_list_new (strdup("d")); ck_assert_ptr_ne (entry4, NULL); ck_assert_str_eq ((char *)entry4->data, "d"); ck_assert_ptr_eq (entry4->next, entry4); ck_assert_ptr_eq (entry4->prev, entry4); entry5 = pr_list_new (strdup("e")); ck_assert_ptr_ne (entry5, NULL); ck_assert_str_eq ((char *)entry5->data, "e"); ck_assert_ptr_eq (entry5->next, entry5); ck_assert_ptr_eq (entry5->prev, entry5); /**********************************/ /* add an entry */ p = pr_list_append_str_sorted(list, entry2); ck_assert_ptr_eq (p, entry2); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, list); ck_assert_ptr_eq (list->next, entry2); ck_assert_ptr_eq (list->prev, entry2); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "b"); /**********************************/ /* add another entry */ p = pr_list_append_str_sorted(list, entry3); ck_assert_ptr_eq (p, entry3); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, list); ck_assert_ptr_eq (list->next, entry3); ck_assert_ptr_eq (list->prev, entry2); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "cb"); /**********************************/ /* add yet another entry */ p = pr_list_append_str_sorted(list, entry4); ck_assert_ptr_eq (p, entry4); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, list); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, entry4); ck_assert_str_eq ((char *)entry4->data, "d"); ck_assert_ptr_eq (entry4->next, entry3); ck_assert_ptr_eq (entry4->prev, list); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry2); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "dcb"); /**********************************/ /* add the first entry */ p = pr_list_append_str_sorted(list, entry1); ck_assert_ptr_eq (p, entry1); ck_assert_str_eq ((char *)entry1->data, "a"); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, entry2); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, entry1); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, entry4); ck_assert_str_eq ((char *)entry4->data, "d"); ck_assert_ptr_eq (entry4->next, entry3); ck_assert_ptr_eq (entry4->prev, list); ck_assert_ptr_eq (list->next, entry4); ck_assert_ptr_eq (list->prev, entry1); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "dcba"); /**********************************/ /* add the last entry */ p = pr_list_append_str_sorted(list, entry5); ck_assert_ptr_eq (p, entry5); ck_assert_str_eq ((char *)entry1->data, "a"); ck_assert_ptr_eq (entry1->next, list); ck_assert_ptr_eq (entry1->prev, entry2); ck_assert_str_eq ((char *)entry2->data, "b"); ck_assert_ptr_eq (entry2->next, entry1); ck_assert_ptr_eq (entry2->prev, entry3); ck_assert_str_eq ((char *)entry3->data, "c"); ck_assert_ptr_eq (entry3->next, entry2); ck_assert_ptr_eq (entry3->prev, entry4); ck_assert_str_eq ((char *)entry4->data, "d"); ck_assert_ptr_eq (entry4->next, entry3); ck_assert_ptr_eq (entry4->prev, entry5); ck_assert_str_eq ((char *)entry5->data, "e"); ck_assert_ptr_eq (entry5->next, entry4); ck_assert_ptr_eq (entry5->prev, list); ck_assert_ptr_eq (list->next, entry5); ck_assert_ptr_eq (list->prev, entry1); /* reset */ memset (buffer, '\0', sizeof(buffer)); count = 0; pr_list_foreach_visit (list, pr_list_visit_save_data); ck_assert_str_eq (buffer, "edcba"); /**********************************/ free ((char *)entry1->data); free (entry1); free ((char *)entry2->data); free (entry2); free ((char *)entry3->data); free (entry3); free ((char *)entry4->data); free (entry4); free ((char *)entry5->data); free (entry5); free (list); } END_TEST /********************************************************************/ Suite * pr_list_suite (void) { Suite *s; TCase *tc_core; s = suite_create ("procenv pr_list"); assert (s); tc_core = tcase_create ("core"); /*******************************/ /* Add each test */ tcase_add_test (tc_core, test_pr_list_new); tcase_add_test (tc_core, test_pr_list_append); tcase_add_test (tc_core, test_pr_list_append_str); tcase_add_test (tc_core, test_pr_list_prepend); tcase_add_test (tc_core, test_pr_list_prepend_str); tcase_add_test (tc_core, test_pr_list_prepend_str_sorted); tcase_add_test (tc_core, test_pr_list_append_str_sorted); /*******************************/ suite_add_tcase(s, tc_core); return s; } /********************************************************************/ int main (int argc, char *argv[]) { Suite *s; SRunner *sr; int number_failed; s = pr_list_suite (); sr = srunner_create (s); srunner_run_all (sr, CK_NORMAL); number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (! number_failed) ? EXIT_SUCCESS : EXIT_FAILURE; } procenv-0.43/src/tests/show_compiler_details000077500000000000000000000025541262513272000213600ustar00rootroot00000000000000#!/bin/sh #--------------------------------------------------------------------- # Description: Script to dump preprocessor/compiler/linker details. # Notes: Tested with gcc and clang. #--------------------------------------------------------------------- CC=${CC:-cc} CPP=${CPP:-cpp} LD=${LD:-ld} echo "XXX:--------------------------------------------------" echo "XXX: $0: preprocessor ('$CPP') version" echo $CPP --version &1 echo echo "XXX:--------------------------------------------------" echo "XXX: $0: preprocessor ('$CPP') pre-defined symbols" echo $CPP -dM < /dev/null 2>&1 echo echo "XXX:--------------------------------------------------" echo "XXX: $0: compiler ('$CC') features" echo $CC -v -E &1 echo echo "XXX:--------------------------------------------------" echo "XXX: $0: compiler ('$CC') search paths" echo $CC -print-search-dirs &1 echo echo "XXX:--------------------------------------------------"