parallel-3.0.3/0002755000175000017500000000000012614416044011741 5ustar olafolafparallel-3.0.3/COPYING0000644000175000017500000011114512614416033012773 0ustar olafolafAppendix G GNU GENERAL PUBLIC LICENSE ************************************* Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/' Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS ==================== 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a. The work must carry prominent notices stating that you modified it, and giving a relevant date. b. The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c. You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d. If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a. Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b. Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c. Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d. Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e. Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a. Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b. Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c. Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d. Limiting the use for publicity purposes of names of licensors or authors of the material; or e. Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f. Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS =========================== How to Apply These Terms to Your New Programs ============================================= If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. Copyright (C) YEAR NAME OF AUTHOR This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see `http://www.gnu.org/licenses/'. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: PROGRAM Copyright (C) YEAR NAME OF AUTHOR This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see `http://www.gnu.org/licenses/'. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read `http://www.gnu.org/philosophy/why-not-lgpl.html'. parallel-3.0.3/INDEX0000644000175000017500000000041012614416033012522 0ustar olafolafparallel >> Parallel Computing Single Machine parcellfun pararrayfun Clusters psend precv reval pserver pconnect sclose select_sockets parallel_generate_srp_data network_get_info network_set rfeval install_vars netcellfun netarrayfun General select parallel-3.0.3/NEWS0000644000175000017500000000613512614416033012441 0ustar olafolafparallel 3.0.3 -------------- ** Fix bug in package building if SRP is not provided by gnutls. ** Documentation spelling and typo fixes. parallel 3.0.2 -------------- ** Functions 'send()' and 'recv()' have been renamed to 'psend()' and 'precv()', respectively, since previous names are used by the sockets package. parallel 3.0.1 -------------- ** Fix some issues in package building, e.g. in building if libgnutls is not present. Note that a libgnutls library (including its "development package" on some systems) which supports the SRP protocol is needed to build the 'parallel' package with TLS-based connections enabled. parallel 3.0.0 -------------- ** 'parcellfun' and 'pararrayfun' accept an option "CumFunc" for cumulative results. ** Fix handling of option "UniformOutput" with option "Vectorized" in 'pararrayfun'. ** Function 'connect()' has been renamed to 'pconnect()' since the previous name is used by the control package. ** New functions 'netcellfun' and 'netarrayfun' for remote parallel execution. ** New convenience function 'rfeval' for single remote function execution. ** New function 'install_vars' to distribute named variables over the parallel cluster. ** Better documentation of cluster functions. Start with the function documentation of 'pconnect()' and 'pserver()', and go on with the documentation of the functions referenced therein. The README.parallel file has been removed. ** The value returned by pconnect and the variable 'sockets' held by pserver, holding the network connections, are now opaque. Indexing the connections in this value should work as with the matrix used before. ** Connections can be based on TLS-SRP, which is now the default. New function parallel_generate_srp_data generates authorization data. ** Parallel cluster commands hanging in system calls (e.g. trying to read data that was not sent) can be interrupted with Ctrl-C (invalidating the network connections in most cases, so that information within server memory will be lost). ** New functions 'network_get_info' and 'network_set'. ** Within a particular parallel network, servers are supposed to be unique now. But a server can be a part of several parallel networks, and successful connection attempts of such overlapping networks should now be possible even if initiated from different client machines or client processes at the same time. ** Removed deprecated bw_... group of functions. parallel 2.2.1 -------------- ** The bw_... group of functions has been deprecated and will be removed in the future. ** Made compatible with Octave 4.0. ** Made parcellfun/pararrayfun a bit more stable. parallel 2.2.0 -------------- ** Included functions parcellfun and pararrayfun from package general. parallel 2.1.1 -------------- ** Bugfix for installation on Windows. parallel 2.1.0, summary of user-visible changes: ------------------------------------------------ ** Connections with equal hostnames are now allowed. ** Fix: avoids zombie processes in server if connection is closed. parallel-3.0.3/DESCRIPTION0000644000175000017500000000053112614416033013442 0ustar olafolafName: Parallel Version: 3.0.3 Date: 2015-10-29 Author: Hayato Fujiwara, Jaroslav Hajek, Olaf Till Maintainer: Olaf Till Title: Parallel Computing. Description: Parallel execution package. See also package mpi, maintained by Carlo de Falco. Depends: octave (>= 3.8.0) Autoload: no License: GPLv3+ Url: http://octave.sf.net parallel-3.0.3/doc/0002755000175000017500000000000012614416033012504 5ustar olafolafparallel-3.0.3/doc/README0000644000175000017500000000113612614416033013363 0ustar olafolafThis package contains the following sets of functions: -- Functions for initialization of a cluster and execution of arbitrary commands on chosen remote machines. Please see e.g. the documentation of "pconnect()", "pserver()", and of the functions referenced therein. -- Higher level functions, based on the lower level parallel cluster functions ("rfeval", "install_vars"). -- Functions for parallel execution on a single multiprocessor machine: "parcellfun" and "pararrayfun" (by Jaroslav Hajek, originally in package "general"). See also package mpi, maintained by Carlo de Falco. parallel-3.0.3/src/0002755000175000017500000000000012614416053012530 5ustar olafolafparallel-3.0.3/src/network_set.cc0000644000175000017500000000743512614416033015410 0ustar olafolaf/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2015 Olaf Till 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, see . */ // PKG_ADD: autoload ("network_set", "parallel_interface.oct"); // PKG_DEL: autoload ("network_set", "parallel_interface.oct", "remove"); #include #include "defun-dld.h" #include "dirfns.h" #include "error.h" #include "help.h" #include "oct-map.h" // #include "systime.h" #include "ov.h" #include "oct-obj.h" #include "utils.h" #include "oct-env.h" #include "parallel-gnutls.h" #include #include #include #include #include #include #include #include #include DEFUN_DLD (network_set, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} network_set (@var{connections}, @var{key}, @var{val})\n\ Set the property named by @var{key} to the value @var{val} for each machine specified by @var{connections}.\n\ \n\ This function can only be successfully called at the client\n\ machine. See @code{pconnect} for a description of the\n\ @var{connections} variable. @var{connections} can contain all\n\ connections of the network, a subset of them, or a single\n\ connection.\n\ \n\ Possible values of @var{key}: @code{'nlocaljobs'}: configured number\n\ of local processes on the machine (usable by functions for parallel\n\ execution); needs a non-negative integer in @var{val}, @code{0} means\n\ not specified.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("network_set"); octave_value retval; if (args.length () != 3 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } if (conns->is_server ()) { error ("%s: 'network_set' can't be called at the server side", fname.c_str ()); return retval; } std::string key = args(1).string_value (); if (error_state) { error ("%s: second argument must be a string", fname.c_str ()); return retval; } for (int i = 0; i < nconns; i++) { if (! key.compare ("nlocaljobs")) { int arg = args(2).int_value (); if (error_state || arg < 0) { error ("%s: argument for key 'nlocaljobs' could not be converted to a non-negative integer", fname.c_str ()); return retval; } conns->get_connections ()(i)->set_nlocaljobs (arg); } else { error ("%s: key '%s' not recognized", fname.c_str (), key.c_str ()); return retval; } } return retval; } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.0.3/src/select_sockets.cc0000644000175000017500000001524312614416033016052 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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, see . */ // PKG_ADD: autoload ("select_sockets", "parallel_interface.oct"); // PKG_DEL: autoload ("select_sockets", "parallel_interface.oct", "remove"); #include #include "defun-dld.h" #include "dirfns.h" #include "error.h" #include "help.h" #include "oct-map.h" #include "ov.h" #include "oct-obj.h" #include "utils.h" #include "oct-env.h" #include "parallel-gnutls.h" #include #include #include #include #include #include DEFUN_DLD (select_sockets, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} select_sockets (@var{connections}, @var{timeout})\n\ @deftypefnx {Loadable Function} {} select_sockets (@var{connections}, @var{timeout}, @var{nfds})\n\ Calls Unix @code{select} for data connections in a parallel cluster.\n\ \n\ This function is for advanced usage (and therefore has minimal\n\ documentation), typically the programming of schedulers. It can be\n\ called at the client or at a server.\n\ \n\ @var{connections}: valid connections object (see @code{pconnect} and\n\ @code{pserver}, possibly indexed).\n\ \n\ @var{timeout}: seconds, negative for infinite.\n\ \n\ @var{nfds}: Passed to Unix @code{select} as first argument, see\n\ documentation of Uix @code{select}. Default: @code{FD_SETSIZE}\n\ (platform specific).\n\ \n\ An error is returned if nfds or a watched filedescriptor plus one\n\ exceeds FD_SETSIZE.\n\ \n\ Returns an index vector to @var{connections} indicating connections\n\ with pending input, readable with @code{precv}.\n\ \n\ If called at the client, the command connections are included into the\n\ UNIX @code{select} call and checked for error flags, and\n\ @code{select_sockets} returns an error if a flag for a remote error is\n\ received.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data}\n\ @end deftypefn") { std::string fname ("select_sockets"); octave_value retval; if (args.length () < 2 || args.length () > 3 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } double atimeout = args(1).double_value (); int nfds = FD_SETSIZE; if (args.length () == 3) nfds = args(2).int_value (); if (error_state) { print_usage (); return retval; } if (nfds <= 0) { error ("%s: 'nfds' must be a positive integer", fname.c_str ()); return retval; } if (nfds > FD_SETSIZE) { error ("%s: 'nfds' exceeds systems maximum given by FD_SETSIZE", fname.c_str ()); return retval; } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } if (nconns < conns->get_all_connections ().numel ()) // it's a subnet for (int i = 0; i < nconns; i++) if (conns->get_connections ()(i)->is_pseudo_connection ()) { error ("%s: using a subnet and local machine was given as one of the connections (index %i)", fname.c_str (), i + 1); return retval; } timeval tout; timeval *timeout = &tout; if (atimeout < 0) timeout = NULL; else { double ipart, fpart; fpart = modf (atimeout, &ipart); tout.tv_sec = lrint (ipart); tout.tv_usec = lrint (fpart * 1000); } fd_set rfds, wfds, efds; FD_ZERO (&rfds); FD_ZERO (&wfds); FD_ZERO (&efds); inthandler_dont_restart_syscalls __inthandler_guard__; for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; int fid = conns->get_connections ()(i)->get_data_stream ()-> get_strbuf ()->get_fid (); if (fid >= nfds) { error ("%s: file descriptor >= nfds or FD_SETSIZE", fname.c_str ()); return retval; } FD_SET (fid, &rfds); if (! conns->is_server ()) { fid = conns->get_connections ()(i)->get_cmd_stream ()-> get_strbuf ()->get_fid (); if (fid >= nfds) { error ("%s: file descriptor >= nfds or FD_SETSIZE", fname.c_str ()); return retval; } FD_SET (fid, &rfds); } } // don't restart interrupted select() int n = select (nfds, &rfds, &wfds, &efds, timeout); if (n == -1) { error ("%s: select system call returned an error", fname.c_str ()); return retval; } bool command_errors = false; RowVector ridx (n); double *fvec; int i; for (i = 0, fvec = ridx.fortran_vec (); i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; if (FD_ISSET (conns->get_connections ()(i)->get_data_stream ()-> get_strbuf ()->get_fid (), &rfds)) { *fvec = double (i + 1); fvec++; } if (! conns->is_server ()) { if (FD_ISSET (conns->get_connections ()(i)->get_cmd_stream ()-> get_strbuf ()->get_fid (), &rfds)) { int err; if ((err = conns->get_connections ()(i)->poll_for_errors ()) < 0) { error ("%s: communication error with server with index %i", fname.c_str (), i + 1); conns->close (); return retval; } else if (err > 0) { error ("%s: a previous command at server with index %i caused an error", fname.c_str (), i + 1); command_errors = true; } } } } if (command_errors) return retval; return octave_value (ridx); } parallel-3.0.3/src/psend.cc0000644000175000017500000001227412614416033014152 0ustar olafolaf// Copyright (C) 2002 Hayato Fujiwara // Copyright (C) 2010-2015 Olaf Till // 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 . // PKG_ADD: autoload ("psend", "parallel_interface.oct"); // PKG_DEL: autoload ("psend", "parallel_interface.oct", "remove"); #include #include #include #include #include "parallel-gnutls.h" #include #include #include #include #if HAVE_UNISTD_H #include #endif DEFUN_DLD (psend, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} psend (@var{value}, @var{connections})\n\ Send the value in variable @var{value} to all parallel cluster machines specified by @var{connections}.\n\ \n\ This function can be called both at the client machine and (with\n\ @code{reval}) at a server machine. See @code{pconnect} for a\n\ description of the @var{connections} variable, and @code{pserver} for\n\ a description of this variable (named @code{sockets}) at the server\n\ side. @var{connections} can contain all connections of the network, a\n\ subset of them, or a single connection. The machine at which\n\ @code{psend} was called (client or server), if contained in the\n\ @var{connections} variable, is ignored.\n\ \n\ The value sent with @code{psend} must be received with @code{precv} at\n\ the target machine. Note that values can be sent to each machine, even\n\ from a server machine to a different server machine.\n\ \n\ If @code{psend} is called at the client machine, a corresponding\n\ @code{precv} should have been called before at the target machine,\n\ otherwise the client will hang if @var{value} contains large data\n\ (which can not be held by the operating systems socket buffers).\n\ \n\ @seealso{pconnect, pserver, reval, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("psend"); octave_value retval; if (args.length () != 2 || args(1).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } const octave_base_value &rep = args(1).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } inthandler_dont_restart_syscalls __inthandler_guard__; // check each connection before a command is sent over any if (nconns < conns->get_all_connections ().numel ()) // it's a subnet for (int i = 0; i < nconns; i++) if (conns->get_connections ()(i)->is_pseudo_connection ()) { error ("%s: using a subnet and own node was given as one of the receivers (index %i)", fname.c_str (), i + 1); return retval; } if (! conns->is_server ()) { bool command_errors = false, stream_errors = false; int err; for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; if ((err = conns->get_connections ()(i)->poll_for_errors ())) { if (err > 0) { error ("%s: a previous command at server with index %i caused an error", fname.c_str (), i + 1); command_errors = true; } else // err < 0 { error ("%s: communication error with server with index %i", fname.c_str (), i + 1); stream_errors = true; } } } if (stream_errors) conns->close (); if (stream_errors || command_errors) return retval; } double sid; for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; // FIXME: some code duplication would probably be better than // calling this convenience function save_binary_data (conns->get_connections ()(i)-> get_data_stream ()->get_ostream (), args(0), "a", "", false, false); if (error_state || ! conns->get_connections ()(i)-> get_data_stream ()->good ()) { error ("%s: communication error", fname.c_str ()); conns->close (); return retval; } } return retval; } parallel-3.0.3/src/select.cc0000644000175000017500000002123012614416033014310 0ustar olafolaf// Copyright (C) 2007-2013 Olaf Till // 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 #ifdef POSIX #include #else #include #include #include #endif #include #include DEFUN_DLD (select, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{n}, @var{ridx}, @var{widx}, @var{eidx}] =} select (@var{read_fids}, @var{write_fids}, @var{except_fids}, @var{timeout}[, @var{nfds}])\n\ Calls Unix @code{select}, see the respective manual.\n\ \n\ The following interface was chosen:\n\ @var{read_fids}, @var{write_fids}, @var{except_fids}: vectors of stream-ids.\n\ @var{timeout}: seconds, negative for infinite.\n\ @var{nfds}: optional, default is Unix' FD_SETSIZE (platform specific).\n\ An error is returned if nfds or a filedescriptor belonging to a stream-id\n\ plus one exceeds FD_SETSIZE.\n\ Return values are:\n\ @var{n}: number of ready streams.\n\ @var{ridx}, @var{widx}, @var{eidx}: index vectors of ready streams in\n\ @var{read_fids}, @var{write_fids}, and @var{except_fids}, respectively.\n\ @end deftypefn") { /* This routine assumes that Octaves stream-id and the corresponding filedescriptor of the system are the same number. This should be the case in Octave >= 3.0.0. */ octave_value_list retval; int nargin = args.length (); int i, fd, fid, nfds, n, act, argc; double argtout, *fvec; timeval tout; timeval *timeout = &tout; ColumnVector read_fids, write_fids, except_fids; if (nargin == 4) nfds = FD_SETSIZE; else if (nargin == 5) { if (! args(4).is_real_scalar ()) { error ("select: 'nfds' must be a real scalar.\n"); return retval; } nfds = args(4).int_value (); if (nfds <= 0) { error ("select: 'nfds' should be greater than zero.\n"); return retval; } if (nfds > FD_SETSIZE) { error ("select: 'nfds' exceeds systems maximum given by FD_SETSIZE.\n"); return retval; } } else { error ("select: four or five arguments required.\n"); return retval; } if (! args(3).is_real_scalar ()) { error ("select: 'timeout' must be a real scalar.\n"); return retval; } if ((argtout = args(3).double_value ()) < 0) timeout = NULL; else { double ipart, fpart; fpart = modf (argtout, &ipart); tout.tv_sec = lrint (ipart); tout.tv_usec = lrint (fpart * 1000); } for (argc = 0; argc < 3; argc++) { if (! args(argc).is_empty ()) { if (! args(argc).is_real_type ()) { error ("select: first three arguments must be real vectors.\n"); return retval; } if (args(argc).rows () != 1 && args(argc).columns () != 1) { error ("select: first three arguments must be real vectors.\n"); return retval; } switch (argc) { case 0: read_fids = ColumnVector (args(argc).vector_value ()); break; case 1: write_fids = ColumnVector (args(argc).vector_value ()); break; case 2: except_fids = ColumnVector (args(argc).vector_value ()); break; } } } fd_set rfds, wfds, efds; FD_ZERO (&rfds); FD_ZERO (&wfds); FD_ZERO (&efds); for (i = 0; i < read_fids.numel (); i++) { fid = lrint (read_fids(i)); fd = octave_stream_list::lookup (fid, "select") . file_number (); if (error_state || fd < 0) { error ("select: invalid file-id"); return retval; } if (fid >= FD_SETSIZE) { error ("select: filedescriptor >= FD_SETSIZE"); return retval; } FD_SET (fid, &rfds); } for (i = 0; i < write_fids.numel (); i++) { fid = lrint (write_fids(i)); fd = octave_stream_list::lookup (fid, "select") . file_number (); if (error_state || fd < 0) { error ("select: invalid file-id"); return retval; } if (fid >= FD_SETSIZE) { error ("select: filedescriptor >= FD_SETSIZE"); return retval; } FD_SET (fid, &wfds); } for (i = 0; i < except_fids.numel (); i++) { fid = lrint (except_fids(i)); fd = octave_stream_list::lookup (fid, "select") . file_number (); if (error_state || fd < 0) { error ("select: invalid file-id"); return retval; } if (fid >= FD_SETSIZE) { error ("select: filedescriptor >= FD_SETSIZE"); return retval; } FD_SET (fid, &efds); } if ((n = select (nfds, &rfds, &wfds, &efds, timeout)) == -1) { std::string err; switch (errno) { case EBADF: err = "EBADF"; break; case EINTR: err = "EINTR"; break; case EINVAL: err = "EINVAL"; break; default: err = "unknown error"; } error ("select: unix select returned error: %s\n", err.c_str ()); return retval; } if (nargout > 3) { for (i = 0, act = 0; i < except_fids.numel (); i++) if (FD_ISSET (lrint (except_fids(i)), &efds)) act++; RowVector eidx = RowVector (act); for (i = 0, fvec = eidx.fortran_vec (); i < except_fids.numel (); i++) if (FD_ISSET (lrint (except_fids(i)), &efds)) { *fvec = double (i + 1); fvec++; } retval(3) = eidx; } if (nargout > 2) { for (i = 0, act = 0; i < write_fids.numel (); i++) if (FD_ISSET (lrint (write_fids(i)), &wfds)) act++; RowVector widx = RowVector (act); for (i = 0, fvec = widx.fortran_vec (); i < write_fids.numel (); i++) if (FD_ISSET (lrint (write_fids(i)), &wfds)) { *fvec = double (i + 1); fvec++; } retval(2) = widx; } if (nargout > 1) { for (i = 0, act = 0; i < read_fids.numel (); i++) if (FD_ISSET (lrint (read_fids(i)), &rfds)) act++; RowVector ridx = RowVector (act); for (i = 0, fvec = ridx.fortran_vec (); i < read_fids.numel (); i++) if (FD_ISSET (lrint (read_fids(i)), &rfds)) { *fvec = double (i + 1); fvec++; } retval(1) = ridx; } retval(0) = n; return retval; } parallel-3.0.3/src/config.h.in0000644000175000017500000000056012614416033014550 0ustar olafolaf/* Define as 1 if gnutls library is present. */ #undef HAVE_LIBGNUTLS /* Define as 1 if gnutls library is present. */ #undef HAVE_LIBGNUTLS_EXTRA /* Define as 1 if getpass function is present. */ #undef HAVE_GETPASS /* Define as 1 if malloc.h is present. */ #undef HAVE_MALLOC_H /* Define as 1 if sys/malloc.h is present. */ #undef HAVE_SYS_MALLOC_H parallel-3.0.3/src/p-streams.cc0000644000175000017500000000605612614416033014755 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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 "parallel-gnutls.h" #define BUFLEN 2048 #ifdef HAVE_LIBGNUTLS // Username was given as argument to 'connect'. appasswd is optional. octave_parallel_gnutls_srp_client_credentials:: octave_parallel_gnutls_srp_client_credentials (const char *user, char *apasswd) : password (apasswd), pw_allocated (false) { if (! password) password = getpass ("password: "); if (! strlen (password)) { error ("password is empty"); return; } if (! gnutls_srp_allocate_client_credentials ((gnutls_srp_client_credentials_t *) &cred)) if (gnutls_srp_set_client_credentials ((gnutls_srp_client_credentials_t) cred, user, password)) { free_credentials (); cred = NULL; } } // no username was given as argument to 'connect' octave_parallel_gnutls_srp_client_credentials:: octave_parallel_gnutls_srp_client_credentials (std::string passwd_file) : password (NULL), pw_allocated (false) { struct __bufguard { char *__b; __bufguard (char *__ib) : __b (__ib) { } ~__bufguard (void) { memset ((void *) __b, '\0', BUFLEN); delete[] __b; } char *__get (void) { return __b; } } __bg (new char[BUFLEN]); char *line = __bg.__get (); line[0] = '\0'; octave_parallel_stream cpi (new octave_parallel_file_streambuf (passwd_file.c_str (), O_RDONLY, 0)); if (! cpi.good ()) { error ("could not open password file"); return; } cpi.get_istream ().getline (line, BUFLEN); int len = strlen (line); if (cpi.get_istream ().fail () && len == BUFLEN - 1) { error ("line in password file too long"); return; } char *p; if (! (p = strchr (line, ' '))) { error ("invalid line in password file"); return; } *p = '\0'; if (! strlen (line)) { error ("no username in password file"); return; } if (++p - line >= len) { error ("no password in password file"); return; } if (! gnutls_srp_allocate_client_credentials ((gnutls_srp_client_credentials_t *) &cred)) if (gnutls_srp_set_client_credentials ((gnutls_srp_client_credentials_t) cred, line, p)) { free_credentials (); cred = NULL; } else { password = new char[strlen (p) + 1]; pw_allocated = true; strcpy (password, p); } } #endif // HAVE_LIBGNUTLS parallel-3.0.3/src/p-sighandler.h0000644000175000017500000000373212614416033015257 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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, see . */ #ifndef __OCT_PARALLEL_SIGHANDLER__ #define __OCT_PARALLEL_SIGHANDLER__ #include #include class inthandler_dont_restart_syscalls { public: inthandler_dont_restart_syscalls (void) : restore_int (false), restore_break (false) { #ifdef SIGINT if (sigaction (SIGINT, NULL, &oldintaction)) return; restore_int = true; memcpy (&newintaction, &oldintaction, sizeof (struct sigaction)); newintaction.sa_flags &= ~ SA_RESTART; sigaction (SIGINT, &newintaction, NULL); #endif #ifdef SIGBREAK if (sigaction (SIGBREAK, NULL, &oldbreakaction)) return; restore_break = true; memcpy (&newbreakaction, &oldbreakaction, sizeof (struct sigaction)); newbreakaction.sa_flags &= ~ SA_RESTART; sigaction (SIGBREAK, &newbreakaction, NULL); #endif } ~inthandler_dont_restart_syscalls (void) { #ifdef SIGINT if (restore_int) sigaction (SIGINT, &oldintaction, NULL); #endif #ifdef SIGBREAK if (restore_break) sigaction (SIGBREAK, &oldbreakaction, NULL); #endif } private: bool restore_int; bool restore_break; #ifdef SIGINT struct sigaction newintaction; struct sigaction oldintaction; #endif #ifdef SIGBREAK struct sigaction newbreakaction; struct sigaction oldbreakaction; #endif }; #endif // __OCT_PARALLEL_SIGHANDLER__ parallel-3.0.3/src/bootstrap0000755000175000017500000000002512614416033014464 0ustar olafolaf#! /bin/sh autoconf parallel-3.0.3/src/gnutls-callbacks.cc0000644000175000017500000001403412614416033016266 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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 "parallel-gnutls.h" #ifdef HAVE_LIBGNUTLS_EXTRA // The condition in #ifdef is probably only roughly equivalent to what // is to be tested, but I doubt it's worth to work out a better test // (we would have to test for being present and being deprecated; if // deprecated, the function is only a stub). Use // gnutls_global_set_mem_functions() in gnutls versions still // implementing it. BTW the later versions currently don't yet seem to // care for SRP password zeroizing themselves. extern "C" void zero_free (void *p); void zero_free (void *p) { if (p) memset (p, 0, malloc_usable_size (p)); free (p); } extern "C" void *zero_realloc (void *p, size_t s); void *zero_realloc (void *p, size_t s) { if (! p) return malloc (s); void *np = malloc (s); if (! np && s > 0) return np; int os = malloc_usable_size (p); if (np) memcpy (np, p, os < s ? os : s); memset (p, 0, os); free (p); return np; } void parallel_gnutls_set_mem_functions (void) { gnutls_global_set_mem_functions (malloc, malloc, NULL, zero_realloc, zero_free); } #endif // HAVE_LIBGNUTLS_EXTRA static int parse_tpasswd_line (char *line, int nread, const char *username, gnutls_datum_t *salt, gnutls_datum_t *verifier) { int pos; char *p; gnutls_datum_t b64entry; if (! (p = strchr (line, ':'))) { error ("invalid line in password file"); return -1; } pos = p - line; if (! (strncmp (line, username, pos))) { // get verifier if (++pos >= nread) { error ("invalid line in password file"); return -1; } if (! (p = strchr (line = p + 1, ':'))) { error ("invalid line in password file"); return -1; } // base64decode verifier b64entry.data = (unsigned char *) line; pos += (b64entry.size = p - line) + 1; if (gnutls_srp_base64_decode_alloc (&b64entry, verifier)) { error ("could not base64-decode verifier"); return -1; } // get salt if (pos >= nread) { error ("invalid line in password file"); return -1; } if (! (p = strchr (line = p + 1, ':'))) { error ("invalid line in password file"); return -1; } // base64decode salt b64entry.data = (unsigned char *) line; pos += (b64entry.size = p - line) + 1; if (gnutls_srp_base64_decode_alloc (&b64entry, salt)) { error ("could not base64-decode salt"); return -1; } // check index if (pos >= nread) { error ("invalid line in password file"); return -1; } if (atoi (p + 1) != 1) { error ("invalid index in password file"); return -1; } return 1; } // if (! (strncmp (line, username, pos))) else return 0; } #define BUFLEN 2048 int octave_parallel_server_credentials_callback (gnutls_session_t session, const char *username, gnutls_datum_t *salt, gnutls_datum_t *verifier, gnutls_datum_t *g, gnutls_datum_t *n) { /* In an initializing call with session == NULL, which is performed before setting the function as a callback, the pointer to the tpasswd filename is set. */ static const char *passwd = NULL; if (! session) { passwd = username; return 0; } /* We have been called as a callback. */ if (! passwd) { error ("no password file initialized"); return -1; } struct __bufguard { char *__b; __bufguard (char *__ib) : __b (__ib) { } ~__bufguard (void) { memset ((void *) __b, '\0', BUFLEN); delete[] __b; } char *__get (void) { return __b; } } __bg (new char[BUFLEN]); char *line = __bg.__get (); if (! line) { error ("could not allocate memory to read lines of password file"); return -1; } line[0] = '\0'; octave_parallel_stream spi (new octave_parallel_file_streambuf (passwd, O_RDONLY, 0)); if (! spi.good ()) { error ("could not open password file"); return -1; } salt->data = verifier->data = g->data = n->data = NULL; salt->size = verifier->size = g->size = n->size = 0; int nread, parse_res; bool valid_user = false; while (true) { spi.get_istream ().getline (line, BUFLEN); nread = strlen (line); if (spi.get_istream ().fail ()) { if (nread == BUFLEN - 1) error ("line in password file too long"); break; } if (nread == 0) { error ("empty line in password file"); break; } if ((parse_res = parse_tpasswd_line (line, nread, username, salt, verifier))) { if (parse_res == 1) valid_user = true; break; } } n->data = gnutls_srp_2048_group_prime.data; n->size = gnutls_srp_2048_group_prime.size; g->data = gnutls_srp_2048_group_generator.data; g->size = gnutls_srp_2048_group_generator.size; if (valid_user) return 0; else { if (verifier->data) { gnutls_free (verifier->data); verifier->size = 0; } if (salt->data) { gnutls_free (salt->data); salt->size = 0; } return 1; } } parallel-3.0.3/src/p-connection.cc0000644000175000017500000001013612614416033015430 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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 "parallel-gnutls.h" #include #include NO_INSTANTIATE_ARRAY_SORT (octave_parallel_connection *); INSTANTIATE_ARRAY (octave_parallel_connection *, OCTAVE_API); // at 'p' 37 bytes must be available int oct_parallel_store_unique_identifier (char *p) { std::ifstream ifs ("/proc/sys/kernel/random/uuid"); p[0] = '\0'; ifs.getline (p, 37); ifs.close (); if (ifs.bad () || strlen (p) != 36) { error ("could not read uuid"); return -1; } else return 0; } int octave_parallel_connection::wait_for_errors_or_data (void) { if (! cmd_stream) { error ("can't poll since no command stream present"); return -1; } if (! data_stream) { error ("can't poll since no data stream present"); return -1; } if (! cmd_stream->get_strbuf ()->good ()) { error ("can't poll since command stream not good"); return -1; } if (! data_stream->get_strbuf ()->good ()) { error ("can't poll since data stream not good"); return -1; } struct pollfd pfd[2]; pfd[0].fd = cmd_stream->get_strbuf ()->get_fid (); pfd[0].events = POLLIN; pfd[0].revents = 0; pfd[1].fd = data_stream->get_strbuf ()->get_fid (); pfd[1].events = POLLIN; pfd[1].revents = 0; int ret = 0; // block until something is readable if (poll (pfd, 2, -1) == -1) { error ("error in poll()"); return (-1); } if (pfd[0].revents) ret = poll_for_errors (); return ret; } DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_parallel_connections, "parallel cluster connections", "pconnections") octave_value octave_parallel_connections::do_index_op (const octave_value_list& idx, bool resize_ok) { octave_idx_type n_idx = idx.length (); switch (n_idx) { case 0: // but actually this seems to be handled before, directly, by Octave return octave_value (this, true); case 2: { idx_vector i = idx(1).index_vector (); if (error_state || ! i.is_colon ()) { error ("only colon allowed as second index"); return octave_value_list (); } } case 1: { idx_vector i = idx(0).index_vector (); if (error_state) { error ("invalid index"); return octave_value_list (); } if (i.is_colon ()) return octave_value (this, true); if (! i.length ()) return octave_value (new octave_parallel_connections ()); octave_idx_type n = rep->subnet.numel (); if (i.extent (n) != n) { error ("index out of range"); return octave_value_list (); } octave_idx_type len = i.length (); if (i.is_vector ()) { if (i.sorted (true).length () < len) { error ("index not unique"); return octave_value_list (); } } octave_parallel_network::connarray nsubnet (dim_vector (len, 1)); i.index (rep->subnet.data (), n, nsubnet.fortran_vec ()); return octave_value (new octave_parallel_connections (rep->network, rep->uuid.c_str (), rep->server, nsubnet)); } default: error ("no more than 2 indices possible for this type"); return octave_value_list (); } } parallel-3.0.3/src/precv.cc0000644000175000017500000001044312614416033014154 0ustar olafolaf// Copyright (C) 2002 Hayato Fujiwara // Copyright (C) 2010-2015 Olaf Till // 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 . // PKG_ADD: autoload ("precv", "parallel_interface.oct"); // PKG_DEL: autoload ("precv", "parallel_interface.oct", "remove"); #include #include #include #include #include #include "parallel-gnutls.h" #if HAVE_UNISTD_H #include #endif DEFUN_DLD (precv, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} precv (@var{single_connection})\n\ Receive a data value from the parallel cluster machine specified by @var{single_connection}.\n\ \n\ This function can be called both at the client machine and (with\n\ @code{reval}) at a server machine. @var{single_connection} must be a\n\ single connection obtained by indexing the @var{connections}\n\ variable. Please see @code{pconnect} for a description of the\n\ @var{connections} variable, and @code{pserver} for a description of\n\ this variable (named @code{sockets}) at the server side. If\n\ @var{single_connection} corresponds to the machine at which\n\ @code{precv} was called, an error is thrown.\n\ \n\ The value received with @code{precv} must be sent with @code{psend}\n\ from another machine of the cluster. Note that data can be transferred\n\ this way between each pair of machines, even sent by a server and\n\ received by a different server.\n\ \n\ If @code{precv} is called at the client machine, a corresponding\n\ @code{psend} should have been called before at the source machine,\n\ otherwise the client will hang.\n\ \n\ @seealso{pconnect, pserver, reval, psend, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("precv"); octave_value retval; if (args.length () != 1 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } if (nconns == 0) return retval; if (nconns > 1) { error ("%s: data can only be read from a single connection", fname.c_str ()); return retval; } octave_parallel_connection *conn = conns->get_connections ()(0); if (conn->is_pseudo_connection ()) { error ("%s: the own node was specified to read data from", fname.c_str ()); return retval; } inthandler_dont_restart_syscalls __inthandler_guard__; if (! conns->is_server ()) { int err; if ((err = conn->wait_for_errors_or_data ())) { if (err > 0) error ("%s: a previous command at the server caused an error", fname.c_str ()); else // err < 0 { error ("%s: communication error", fname.c_str ()); conns->close (); } return retval; } } octave_value tc; conn->connection_read_data (tc); if (error_state || ! conn->get_data_stream ()->good ()) { error ("%s: error in reading variable data\n", fname.c_str ()); conns->close (); return retval; } if (! tc.is_defined ()) { // What means this? error ("%s: error in reading variable\n", fname.c_str ()); conns->close (); return retval; } return retval = tc; } parallel-3.0.3/src/network_get_info.cc0000644000175000017500000001146012614416033016400 0ustar olafolaf/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2015 Olaf Till 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, see . */ // PKG_ADD: autoload ("network_get_info", "parallel_interface.oct"); // PKG_DEL: autoload ("network_get_info", "parallel_interface.oct", "remove"); #include #include "defun-dld.h" #include "dirfns.h" #include "error.h" #include "help.h" #include "oct-map.h" // #include "systime.h" #include "ov.h" #include "oct-obj.h" #include "utils.h" #include "oct-env.h" #include "parallel-gnutls.h" #include #include #include #include #include #include #include #include #include DEFUN_DLD (network_get_info, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} network_get_info (@var{connections})\n\ Return an informational structure-array with one entry for each machine specified by @var{connections}.\n\ \n\ This function can only be successfully called at the client\n\ machine. See @code{pconnect} for a description of the\n\ @var{connections} variable. @var{connections} can contain all\n\ connections of the network, a subset of them, or a single\n\ connection. For the local machine (client), if contained in\n\ @var{connections}, some fields of the returned structure may be\n\ empty.\n\ \n\ The fields of the returned structure are @code{local_machine}: true\n\ for the connection representing the local machine, @code{nproc}:\n\ number of usable processors of the machine, @code{nlocaljobs}:\n\ configured number of local processes on the machine, @code{peername}:\n\ name of the machine (empty for local machine), @code{open}: true if\n\ the connection is open, @code{network_id}: uuid of the network,\n\ @code{real_node_id}: internal id assigned to node, @code{0} for\n\ client, servers starting with @code{1}.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("network_get_info"); if (args.length () != 1 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return octave_value_list (); } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return octave_value_list (); } if (conns->is_server ()) { error ("%s: 'network_get_info' can't be called at the server side", fname.c_str ()); return octave_value_list (); } const char *fieldnames[] = {"local_machine", "nproc", "nlocaljobs", "peername", "open", "network_id", "real_node_id", NULL}; octave_fields fields (fieldnames); octave_map retval (dim_vector (nconns, 1), fields); octave_scalar_map node_info (fields); for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) node_info.setfield ("local_machine", true); else node_info.setfield ("local_machine", false); node_info.setfield ("nproc", conns->get_connections ()(i)->get_nproc ()); node_info.setfield ("nlocaljobs", conns->get_connections ()(i)->get_nlocaljobs ()); node_info.setfield ("peername", conns->get_connections ()(i)->get_peer_name ()); node_info.setfield ("open", conns->get_connections ()(i)->is_open ()); node_info.setfield ("network_id", conns->get_connections ()(i)->get_uuid ()); node_info.setfield ("real_node_id", conns->get_connections ()(i)->peer_node_n); retval.assign (i, node_info); } return octave_value (retval); } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.0.3/src/fsave.cc0000644000175000017500000000372712614416033014150 0ustar olafolaf// Copyright (C) 2009 VZLU Prague // // 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 . // Author: Jaroslav Hajek #include #include #include #include DEFUN_DLD (fsave, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} fsave (@var{fid}, @var{var})\n\ Save a single variable to a binary stream, to be subsequently loaded with\n\ fload. Returns true if successful.\n\ Not suitable for data transfer between machines of different type.\n\ @end deftypefn") { octave_value retval; int nargin = args.length (); if (nargin == 2) { int fid = octave_stream_list::get_file_number (args(0)); octave_stream octs = octave_stream_list::lookup (fid, "fsave"); std::ostream *os = octs.output_stream (); octave_value val = args(1); if (os) { // FIXME: these are dummies. It would be nice to get rid of them and call // a more low-level interface, but there doesn't seem to be a more suitable // one in Octave, that still does the automatic type lookup. std::string doc, name; bool floats = false, global = false; save_binary_data (*os, val, name, doc, global, floats); } else error ("fsave: stream not opened for writing."); } else print_usage (); return retval; } parallel-3.0.3/src/configure0000755000175000017500000051152212614416050014440 0ustar olafolaf#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for parallel 3.0.3. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and i7tiol@t-online.de $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: 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='parallel' PACKAGE_TARNAME='parallel' PACKAGE_VERSION='3.0.3' PACKAGE_STRING='parallel 3.0.3' PACKAGE_BUGREPORT='i7tiol@t-online.de' PACKAGE_URL='' ac_unique_file="pconnect.cc" # 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='LTLIBOBJS HAVE_GETPASS LIBOBJS HAVE_GNUTLS_EXTRA HAVE_GNUTLS PKG_CONFIG EGREP GREP CPP MKOCTFILE ac_ct_CC CFLAGS CC OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX 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 ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC CC CFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false 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 parallel 3.0.3 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/parallel] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of parallel 3.0.3:";; esac cat <<\_ACEOF Some influential environment variables: CXX C++ compiler command CXXFLAGS 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 CC C compiler command CFLAGS C compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _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 parallel configure 3.0.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_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_cxx_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_cxx_try_compile # 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 i7tiol@t-online.de ## ## --------------------------------- ##" ) | 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_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_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_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done 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_find_intX_t # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done 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_find_uintX_t # 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 parallel $as_me 3.0.3, 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" # Checks for programs. ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$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 CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $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_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $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 CXX=$ac_ct_CXX fi fi fi fi # 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_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 # Extract the first word of "mkoctfile", so it can be a program name with args. set dummy mkoctfile; 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_MKOCTFILE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MKOCTFILE"; then ac_cv_prog_MKOCTFILE="$MKOCTFILE" # 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_MKOCTFILE="mkoctfile" $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 MKOCTFILE=$ac_cv_prog_MKOCTFILE if test -n "$MKOCTFILE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKOCTFILE" >&5 $as_echo "$MKOCTFILE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Checks for libraries. 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" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default" if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then : fi if test "x$ac_cv_header_gnutls_gnutls_h" = "xno"; then as_fn_error $? "gnutls/gnutls.h not found or not compilable" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_global_init in -lgnutls" >&5 $as_echo_n "checking for gnutls_global_init in -lgnutls... " >&6; } if ${ac_cv_lib_gnutls_gnutls_global_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgnutls $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gnutls_global_init (); int main () { return gnutls_global_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gnutls_gnutls_global_init=yes else ac_cv_lib_gnutls_gnutls_global_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_global_init" >&5 $as_echo "$ac_cv_lib_gnutls_gnutls_global_init" >&6; } if test "x$ac_cv_lib_gnutls_gnutls_global_init" = xyes; then : echo -n "" fi if test "x$ac_cv_lib_gnutls_gnutls_global_init" = "xyes"; then LIBS="-lgnutls $LIBS" # 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_prog_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PKG_CONFIG"; then ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PKG_CONFIG="pkg-config" $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 PKG_CONFIG=$ac_cv_prog_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 if test -z "$PKG_CONFIG"; then HAVE_GNUTLS=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS disabled since pkg-config not found" >&5 $as_echo "$as_me: WARNING: TLS disabled since pkg-config not found" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { printf ("%u", gnutls_srp_2048_group_prime.size); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_LIBGNUTLS 1" >>confdefs.h HAVE_GNUTLS=yes else HAVE_GNUTLS=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS disabled since symbol gnutls_srp_2048_group_prime not found in gnutls library - built with --disable-srp-authentication?" >&5 $as_echo "$as_me: WARNING: TLS disabled since symbol gnutls_srp_2048_group_prime not found in gnutls library - built with --disable-srp-authentication?" >&2;} fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_global_init_extra in -lgnutls-extra" >&5 $as_echo_n "checking for gnutls_global_init_extra in -lgnutls-extra... " >&6; } if ${ac_cv_lib_gnutls_extra_gnutls_global_init_extra+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgnutls-extra $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gnutls_global_init_extra (); int main () { return gnutls_global_init_extra (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gnutls_extra_gnutls_global_init_extra=yes else ac_cv_lib_gnutls_extra_gnutls_global_init_extra=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_extra_gnutls_global_init_extra" >&5 $as_echo "$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" >&6; } if test "x$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" = xyes; then : echo -n "" fi if test "x$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" = "xyes"; then LIBS="-lgnutls-extra $LIBS" $as_echo "#define HAVE_LIBGNUTLS_EXTRA 1" >>confdefs.h HAVE_GNUTLS_EXTRA=yes else HAVE_GNUTLS_EXTRA=no fi else HAVE_GNUTLS=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS disabled since no gnutls library found" >&5 $as_echo "$as_me: WARNING: TLS disabled since no gnutls library found" >&2;} fi # Checks for header files. for ac_header in arpa/inet.h fcntl.h limits.h malloc.h sys/malloc.h netdb.h netinet/in.h stdio_ext.h stdlib.h string.h sys/socket.h sys/time.h termios.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$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 if test "x$ac_cv_header_malloc_h" = "xno"; then if test "x$ac_cv_header_sys_malloc_h" = "xno"; then as_fn_error $? "neither malloc.h nor sys/malloc.h found" "$LINENO" 5 fi fi # 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 ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 $as_echo_n "checking for error_at_line... " >&6; } if ${ac_cv_lib_error_at_line+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_error_at_line=yes else ac_cv_lib_error_at_line=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 $as_echo "$ac_cv_lib_error_at_line" >&6; } if test $ac_cv_lib_error_at_line = no; then case " $LIBOBJS " in *" error.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; esac fi for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork 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 if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 $as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } if ${ac_cv_sys_largefile_source+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=no; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=1; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_cv_sys_largefile_source=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 $as_echo "$ac_cv_sys_largefile_source" >&6; } case $ac_cv_sys_largefile_source in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source _ACEOF ;; esac rm -rf conftest* # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug # in glibc 2.1.3, but that breaks too many other things. # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. if test $ac_cv_sys_largefile_source != unknown; then $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in memset mkdir modf select socket strchr strdup uname do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_func "$LINENO" "getpass" "ac_cv_func_getpass" if test "x$ac_cv_func_getpass" = xyes; then : fi if test "x$ac_cv_func_getpass" = "xyes"; then $as_echo "#define HAVE_GETPASS 1" >>confdefs.h HAVE_GETPASS=yes else HAVE_GETPASS=no fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $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 : "${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 parallel $as_me 3.0.3, 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" _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 Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ parallel config.status 3.0.3 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' 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 _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" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) 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 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 " 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 # _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 $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 ;; 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 parallel-3.0.3/src/p-streams.h0000644000175000017500000005344512614416033014623 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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 __OCT_PARALLEL_STREAMS__ #define __OCT_PARALLEL_STREAMS__ #ifdef HAVE_LIBGNUTLS #include #ifdef HAVE_LIBGNUTLS_EXTRA #include #endif #endif #include #include #include #include #include #include /* Although we use the standard file format, we can't rely on gnutls_srp_set_server_credentials_file(), since current gnutls uses standard C library streams to read the files (external user space buffers) and own automatic variables which are not zero'ed to hold the sensitive data. */ #ifdef HAVE_LIBGNUTLS extern "C" int octave_parallel_server_credentials_callback (gnutls_session_t session, const char *username, gnutls_datum_t *salt, gnutls_datum_t *verifier, gnutls_datum_t *g, gnutls_datum_t *n); #endif // It is better to have classes for handling errors in input and // output. For some tasks we can't use default standard C++ // io-classes: file-io with sensitive data should not be buffered, // sockets have a system file-descriptor in the first place (and on // some systems 'read' and 'write' may not work for them), and gnutls // connections have special functions for sending and receiving. On // the other hand, it is necessary to have a std::ostream and a // std::istream for the connection, since Octaves functions for saving // and loading data require them. // // To address these related problems, a common parent class, derived // from std::streambuf, and several derived classes are declared // here. Also, a class is provided which takes one of these // streambuf objects and also contains a std::ostream and a // std::istream which reference the streambuf object. // parent class class octave_parallel_streambuf : public std::streambuf { public: octave_parallel_streambuf (void) : fid (-1), store_errno (0), readable (false), writeable (false) { // no character in the one-character-wide buffer at the beginning setg (&inbuf, (&inbuf) + 1, (&inbuf) + 1); } virtual ~octave_parallel_streambuf (void) { inbuf = '\0'; } virtual bool good (void) = 0; virtual bool connection_state_undefined (void) { return false; } virtual void set_connection_state_undefined (void) { } void close (void) { if (fid >= 0) { int ret; // don't repeat interrupted close() ret = do_close (); if (ret == -1) store_errno = errno; fid = -1; } } ssize_t write (const void *buf, size_t count) { if (! good ()) return -1; if (fid < 0) return -1; if (count == 0) return 0; // if nothing needs to be written, there's no need to // risk write() still being interrupted by a signal else if (count < 0) return -1; ssize_t ret; size_t left = count; // If write returns zero though count is positive, the reason must // be something different than being interrupted by a signal, // since in the latter case write would return -1 if no data was // written at all. do { if ((ret = do_write ((char *) buf + count - left, left)) > 0) left -= ret; } while (left && ret > 0); // don't repeat interrupted write() // while (left && // ((ret == -1 && errno == EINTR) || // ret > 0)); if (ret == -1) store_errno = errno; else if (left) store_errno = -1; if (store_errno) return -1; else return count; } virtual int gnutls_write_alert_for_flushing (void) { if (! good () || fid < 0) return -1; else return 0; } ssize_t read (void *buf, size_t count) { if (! good ()) return -1; if (fid < 0) return -1; if (count == 0) return 0; else if (count < 0) return -1; int ndiff = 0; if (gptr () != egptr ()) { *((char *) buf) = *(gptr ()); gbump (1); buf = (void *)(((char *) buf) + 1); count--; ndiff = 1; } int ret = read_directly (buf, count); if (ret > -1) ret += ndiff; return ret; } bool readable; bool writeable; int get_fid (void) { return fid; } // redefined streambuf virtual functions std::streamsize xsputn (const char *buf, std::streamsize count) { ssize_t ret = write ((const void *) buf, count); return ret >= 0 ? ret : 0; } int overflow (int c = traits_type::eof ()) { if (c != traits_type::eof ()) { traits_type::char_type tc = traits_type::to_char_type (c); if (write ((void *) &tc, sizeof (traits_type::char_type)) == -1) return traits_type::eof (); } return traits_type::to_int_type (c); } std::streamsize xsgetn (char *buf, std::streamsize count) { ssize_t ret = read ((void *) buf, count); return ret >= 0 ? ret : 0; } // the only member capable of storing something in the input buffer; // and the only reading member which never increases gptr() int underflow (void) { if (gptr () != egptr ()) return traits_type::to_int_type (*(gptr ())); else { if (read_directly ((void *) eback (), 1) == -1) return traits_type::to_int_type (traits_type::eof ()); else { gbump (-1); return traits_type::to_int_type (*(gptr ())); } } } int uflow (void) { if (gptr () != egptr ()) { gbump (1); return traits_type::to_int_type (*(gptr () - 1)); } else { traits_type::char_type ret; if (read_directly ((void *) &ret, sizeof (traits_type::char_type)) == -1) return traits_type::to_int_type (traits_type::eof ()); else return traits_type::to_int_type (ret); } } protected: int fid; int store_errno; virtual ssize_t do_write (const void *buf, size_t count) = 0; virtual ssize_t do_read (void *buf, size_t count) = 0; virtual int do_close (void) = 0; private: ssize_t read_directly (void *buf, size_t count) { if (! good ()) return -1; if (fid < 0) return -1; if (count == 0) return 0; // if nothing needs to be written, there's no need to // risk read() still being interrupted by a signal else if (count < 0) return -1; ssize_t ret; size_t left = count; // If read returns zero though count is positive, the reason must // be something different than being interrupted by a signal, // since in the latter case read would return -1 if no data was // written at all. do { if ((ret = do_read ((char *) buf + count - left, left)) > 0) left -= ret; } while (left && ret > 0); // don't repeat interrupted read() // while (left && // ((ret == -1 && errno == EINTR) || // ret > 0)); if (ret == -1) store_errno = errno; else if (left) store_errno = -1; if (store_errno) return -1; else return count; } // We need to provide an input buffer of at least one character to // be able to implement underflow(), needed by sgetc(), possibly // needed by istream.getline(). This buffer must be zero'ed at // destruction. char inbuf; }; // class octave_parallel_streambuf // To avoid user space buffers, provided by external libraries, which // can not be zero'ed after use, we have to directly use system calls // for reading and writing sensitive data from/to files. Luckily, for // this small amount of file-io we don't need to construct a custom // user space buffer. class octave_parallel_file_streambuf : public octave_parallel_streambuf { public: octave_parallel_file_streambuf (const char *path, int flags, mode_t mode = 0) { while ((fid = open (path, flags, mode)) == -1 && errno == EINTR); if (fid == -1) store_errno = errno; else { // care is needed here, one of the flag constants can // represent the value zero (O_RDONLY on my system), so that // checking for (flags & flag_constant) does not work if ((O_RDONLY == 0 && ! (flags & O_WRONLY)) || (O_RDONLY && flags & (O_RDONLY | O_RDWR))) readable = true; if ((O_WRONLY == 0 && ! (flags & O_RDONLY)) || (O_WRONLY && flags & (O_WRONLY | O_RDWR))) writeable = true; } } ~octave_parallel_file_streambuf (void) { if (fid >= 0) while (::close (fid) == -1 && errno == EINTR); } bool good (void) { return (store_errno == 0); } protected: ssize_t do_read (void *buf, size_t count) { return ::read (fid, buf, count); } ssize_t do_write (const void *buf, size_t count) { return ::write (fid, buf, count); } int do_close (void) { return ::close (fid); } }; // class octave_parallel_file_streambuf #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_PSSTREAMBUF \ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; \ undefined_connection_state = true; \ octave_rethrow_exception (); \ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2 // TCP sockets without authentication or encryption, as an alternative // to a TLS connection, which is derived from this. class octave_parallel_socket_streambuf : public octave_parallel_streambuf { public: octave_parallel_socket_streambuf (int sid) : undefined_connection_state (false) { fid = sid; if (fid == -1) { store_errno = -1; error ("no valid socket"); } else readable = writeable = true; } ~octave_parallel_socket_streambuf (void) { if (fid >= 0) while (::close (fid) == -1 && errno == EINTR); } bool good (void) { return (store_errno == 0); } bool connection_state_undefined (void) { return undefined_connection_state; } void set_connection_state_undefined (void) { undefined_connection_state = true; } // redefined streambuf virtual functions std::streamsize showmanyc () { if (! good () || fid == -1) return -1; struct pollfd pfd; pfd.fd = fid; pfd.events = POLLIN; pfd.revents = 0; std::streamsize ret; if ((ret = poll (&pfd, 1, 0)) == 1 && pfd.revents & POLLIN) return 1; else { if (ret < 0) store_errno = -1; return ret; } } protected: ssize_t do_read (void *buf, size_t count) { return ::recv (fid, buf, count, 0); } ssize_t do_write (const void *buf, size_t count) { return ::send (fid, buf, count, 0); } int do_close (void) { return ::close (fid); } bool undefined_connection_state; }; // for usage with class octave_parallel_gnutls_streambuf, one parent // class and one derived class for server and client, respectively; // objects meant to be allocated; the class storing the pointer should // check the refcount and care for deallocation #ifdef HAVE_LIBGNUTLS class octave_parallel_gnutls_srp_credentials { public: octave_parallel_gnutls_srp_credentials (void) : cred (NULL), refcount (0) { } virtual ~octave_parallel_gnutls_srp_credentials (void) { } void *get_ref (void) { refcount++; dlprintf ("cred incr its refcount to %i\n", refcount); return cred; } int release_ref (void) { dlprintf ("cred will decr its refcount to %i\n", refcount - 1); return --refcount; } int check_ref (void) { dlprintf ("cred refcount was checked, is %i\n", refcount); return refcount; } void *check_cred (void) { return cred; } protected: void *cred; virtual void free_credentials (void) = 0; private: int refcount; }; // see comment of parent class class octave_parallel_gnutls_srp_client_credentials : public octave_parallel_gnutls_srp_credentials { public: octave_parallel_gnutls_srp_client_credentials (const char *user, char *apasswd = NULL); octave_parallel_gnutls_srp_client_credentials (std::string passwd_file); ~octave_parallel_gnutls_srp_client_credentials (void) { dlprintf ("ccred destr called\n"); if (password) { memset ((void *) password, '\0', strlen (password)); if (pw_allocated) delete [] password; } if (cred) { dlprintf ("ccred destr will call 'free_credentials()'\n"); free_credentials (); } } const char *get_passwd (void) { return password; } protected: void free_credentials (void) { gnutls_srp_free_client_credentials ((gnutls_srp_client_credentials_t) cred); cred = NULL; } private: char *password; bool pw_allocated; }; // see comment of parent class class octave_parallel_gnutls_srp_server_credentials : public octave_parallel_gnutls_srp_credentials { public: octave_parallel_gnutls_srp_server_credentials (std::string passwd_file) { if (! gnutls_srp_allocate_server_credentials ((gnutls_srp_server_credentials_t *) &cred)) { // initialize filename in callback function octave_parallel_server_credentials_callback (NULL, passwd_file.c_str (), NULL, NULL, NULL, NULL); gnutls_srp_set_server_credentials_function ((gnutls_srp_server_credentials_t) cred, octave_parallel_server_credentials_callback); } } ~octave_parallel_gnutls_srp_server_credentials (void) { if (cred) free_credentials (); } protected: void free_credentials (void) { gnutls_srp_free_server_credentials ((gnutls_srp_server_credentials_t) cred); cred = NULL; } }; // TCP sockets with a gnutls connection. class octave_parallel_gnutls_streambuf : public octave_parallel_socket_streambuf { public: octave_parallel_gnutls_streambuf (int sid, octave_parallel_gnutls_srp_credentials *accred, bool server) : octave_parallel_socket_streambuf (sid), ccred (accred), session (NULL) { // check result of parent class constructor, reset if necessary if (! good ()) return; else readable = writeable = false; dlprintf ("gnutls_steambuf ctor requests incr cred refcount\n"); if (! (cred = ccred->get_ref ())) { store_errno = -1; error ("no valid credentials"); return; } if (gnutls_init (&session, server ? GNUTLS_SERVER : GNUTLS_CLIENT)) { store_errno = -1; error ("could not initialize gnutls session"); return; } if (gnutls_priority_set_direct (session, "NORMAL:+SRP:+SRP-DSS:+SRP-RSA", NULL)) { store_errno = -1; error ("error in setting gnutls priorities"); return; } if (gnutls_credentials_set (session, GNUTLS_CRD_SRP, cred)) { store_errno = -1; error ("could not set credentials"); return; } gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) fid); int ret; ret = gnutls_handshake (session); // don't repeat interrupted handshake if (ret) { store_errno = -1; error ("handshake failed"); return; } readable = writeable = true; } ~octave_parallel_gnutls_streambuf (void) { if (session) gnutls_deinit (session); if (ccred) dlprintf ("gstreambuf destructor will requcest decr of cred refcount\n"); int tpdebug; if (ccred && (tpdebug = ccred->release_ref ()) <= 0) { dlprintf ("gstreambuf destructor got decr cred refcount of %i and will delete cred\n", tpdebug); delete ccred; } } bool good (void) { return (store_errno == 0); } const char *server_get_username (void) { return gnutls_srp_server_get_username (session); } int gnutls_write_alert_for_flushing (void) { if (! good () || fid < 0) return -1; int ret; // this is a dummy alert to force flushing while ((ret = gnutls_alert_send (session, GNUTLS_AL_WARNING, GNUTLS_A_INTERNAL_ERROR)) == GNUTLS_E_AGAIN); // don't repeat if interrupted // GNUTLS_E_INTERRUPTED || // ret == GNUTLS_E_AGAIN); if (ret != GNUTLS_E_SUCCESS) { store_errno = -1; return -1; } else return 0; } protected: ssize_t do_read (void *buf, size_t count) { ssize_t ret; while ((ret = gnutls_record_recv (session, buf, count)) == GNUTLS_E_WARNING_ALERT_RECEIVED) gnutls_alert_get (session); // discard the alert if (ret < 0) { // although checking GNUTLS_E_AGAIN is probably not necessary // with blocking calls configured if (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN) errno = EINTR; ret = -1; } return ret; } ssize_t do_write (const void *buf, size_t count) { ssize_t ret; while ((ret = gnutls_record_send (session, buf, count)) == GNUTLS_E_WARNING_ALERT_RECEIVED) gnutls_alert_get (session); // discard the alert if (ret < 0) { // although checking GNUTLS_E_AGAIN is probably not necessary // with blocking calls configured if (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN) errno = EINTR; ret = -1; } return ret; } int do_close (void) { if (session) { gnutls_deinit (session); session = NULL; } if (ccred && ccred->release_ref () <= 0) delete ccred; ccred = NULL; return octave_parallel_socket_streambuf::do_close (); } octave_parallel_gnutls_srp_credentials *ccred; void *cred; gnutls_session_t session; }; #endif // HAVE_LIBGNUTLS class octave_parallel_stream { public: octave_parallel_stream (octave_parallel_streambuf *strbuf_arg) : strbuf (strbuf_arg), istr (NULL), ostr (NULL) { if (strbuf->readable) istr = new std::istream (strbuf); if (strbuf->writeable) ostr = new std::ostream (strbuf); } ~octave_parallel_stream (void) { if (istr) delete istr; if (ostr) delete ostr; dlprintf ("pstream destructor will delete streambuf\n"); delete strbuf; } bool good (void) const { return strbuf->good (); } void close (void) const { if (strbuf) strbuf->close (); } std::istream &get_istream (void) const { return *istr; } std::ostream &get_ostream (void) const { return *ostr; } int network_send_4byteint (uint32_t v, bool) const { uint32_t t = htonl (v); strbuf->write ((void *) &t, 4); if (strbuf->good ()) return 0; else return -1; } int network_recv_4byteint (uint32_t &v) const { uint32_t t; strbuf->read ((void *) &t, 4); if (! strbuf->good ()) return -1; v = ntohl (t); return 0; } int network_send_4byteint (int32_t v) { if (signed_int_rep () && v < 0) { once_gripe_neg_int_rep (); return -1; } union { int32_t s; uint32_t u; } cast; cast.s = v; return network_send_4byteint (cast.u, true); } int network_recv_4byteint (int32_t &v) { uint32_t t; union { int32_t s; uint32_t u; } cast; strbuf->read ((void *) &t, 4); if (! strbuf->good ()) return -1; cast.u = ntohl (t); v = cast.s; if (signed_int_rep () && v < 0) { once_gripe_neg_int_rep (); return -1; } return 0; } int network_send_string (const char *s) const { uint32_t l = strlen (s); uint32_t t = htonl (l); strbuf->write ((void *) &t, 4); strbuf->write ((const void *) s, l); if (strbuf->good ()) return 0; else return -1; } int network_recv_string (char *s, int maxl) const { uint32_t l, t; strbuf->read ((void *) &t, 4); if (! strbuf->good ()) return -1; l = ntohl (t); if (l > maxl - 1) { error ("string to be received would be longer than buffer"); return -1; } s[l] = '\0'; strbuf->read ((void *) s, l); if (strbuf->good ()) return 0; else return -1; } int network_recv_string (std::string &str) const { uint32_t l, t; strbuf->read ((void *) &t, 4); if (! strbuf->good ()) return -1; l = ntohl (t); str.resize (l); strbuf->read ((void *) str.c_str (), l); if (strbuf->good ()) return 0; else return -1; } octave_parallel_streambuf *get_strbuf (void) { return strbuf; } static int signed_int_rep (void) { // I know this is paranoid, and that current Octave itself just // relies on twos complement in saving/loading signed integers. static int ret = -1; if (ret == -1) { union { uint32_t u; int32_t s; } t; t.s = -1; if (t.u != 0xFFFFFFFF) ret = 1; else ret = 0; } return ret; } private: octave_parallel_streambuf *strbuf; std::istream *istr; std::ostream *ostr; void once_gripe_neg_int_rep (void) { static bool first_time = true; if (first_time) { error ("This machine doesn't seem to use twos complement as negative integer representation. If you want this to be supported, please file a bug report."); first_time = false; } } }; #endif // __OCT_PARALLEL_STREAMS__ /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.0.3/src/sensitive-data.h0000644000175000017500000001617312614416033015625 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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 __OCT_PARALLEL_SENSITIVE_DATA__ #define __OCT_PARALLEL_SENSITIVE_DATA__ #include class sensitive_base { public: virtual void zero_val (void) = 0; }; class zero_sensitive_base { public: zero_sensitive_base (void) {} ~zero_sensitive_base (void) { for (std::list::const_iterator it = list.begin (); it != list.end (); it++) (*it)->zero_val (); } void add (sensitive_base *el) { list.push_front (el); } private: std::list list; }; class verifier: public sensitive_base { public: verifier (void) : valid (false), locked_length (0) { val.data = NULL; val.size = 0; } verifier (const char *username, const char *passwd, const gnutls_datum_t *salt, bool lock = false) : valid (false), locked_length (0) { val.data = NULL; val.size = 0; do_assign (username, passwd, salt, lock); } void assign (const char *username, const char *passwd, const gnutls_datum_t *salt, bool lock = false) { do_assign (username, passwd, salt, lock); } void free_val (void) { if (val.data) { zero_val (); if (locked_length) { if (munlock (val.data, locked_length)) fprintf (stderr, "Could not unlock memory pages!\n"); else locked_length = 0; } free (val.data); val.data = NULL; } val.size = 0; valid = false; } void zero_val (void) { valid = false; if (val.data) memset ((void *) val.data, '\0', val.size); } ~verifier (void) { free_val (); } bool good (void) {return valid;} const gnutls_datum_t &get_val (void) {return val;} private: void do_assign (const char *&username, const char *&passwd, const gnutls_datum_t *&salt, bool lock) { if (gnutls_srp_verifier (username, passwd, salt, &gnutls_srp_2048_group_generator, &gnutls_srp_2048_group_prime, &val) == GNUTLS_E_SUCCESS && val.data) { if (lock) { if (mlock (val.data, val.size)) error ("could not lock memory pages"); else { valid = true; locked_length = val.size; } } else valid = true; } } gnutls_datum_t val; bool valid; int locked_length; }; class sensitive_string: public sensitive_base { public: sensitive_string (void) : valid (false), internally_allocated (false), locked_length (0) { val.data = NULL; val.size = 0; } sensitive_string (char *s, bool lock = false) : valid (false), internally_allocated (false), locked_length (0) { assign (s, lock); } sensitive_string (int n, bool lock = false) : valid (false), internally_allocated (false), locked_length (0) { val.data = NULL; val.size = 0; fill (n, lock); } void fill (int n, bool lock = false); void assign (char *s, bool lock = false) { if (valid || locked_length || internally_allocated) { valid = false; return; } val.data = (unsigned char *) s; val.size = strlen ((char *) val.data); valid = true; if (val.size != 0 && lock) { if (mlock (val.data, val.size)) { error ("could not lock memory pages"); valid = false; } else locked_length = val.size; } } void free_val (void) { if (val.data) { zero_val (); if (locked_length) { if (munlock (val.data, locked_length)) fprintf (stderr, "Could not unlock memory pages!\n"); else locked_length = 0; } if (internally_allocated) { delete [] val.data; internally_allocated = false; } val.data = NULL; } val.size = 0; valid = false; } void zero_val (void) { valid = false; if (val.data) memset ((void *) val.data, '\0', val.size); } ~sensitive_string (void) { free_val (); } bool good (void) {return valid;} const gnutls_datum_t &get_val (void) {return val;} char *get_string (void) {return (char *) val.data;} int get_size (void) {return val.size;} private: // val.size is the length of the string (without terminating '\0'), // not the length of the data. This is because gnutls encoding // functions expect a gnutls_datum_t with binary data. gnutls_datum_t val; bool valid; bool internally_allocated; int locked_length; }; class srp_base64_encode: public sensitive_base { public: srp_base64_encode (void) : valid (false), locked_length (0) { val.data = NULL; val.size = 0; } srp_base64_encode (const gnutls_datum_t *data, bool lock = false) : valid (false), locked_length (0) { val.data = NULL; val.size = 0; encode (data, lock); } void encode (const gnutls_datum_t *data, bool lock = false) { if (gnutls_srp_base64_encode_alloc (data, &val)) { error ("base64 encoding failed"); valid = false; } else { valid = true; if (lock) { if (mlock (val.data, val.size)) { error ("could not lock memory pages"); valid = false; } else locked_length = val.size; } } } void free_val (void) { if (val.data) { zero_val (); if (locked_length) { if (munlock (val.data, locked_length)) fprintf (stderr, "Could not unlock memory pages!\n"); else locked_length = 0; } gnutls_free ((void *) val.data); val.data = NULL; } val.size = 0; } void zero_val (void) { valid = false; if (val.data) memset ((void *) val.data, '\0', val.size); } ~srp_base64_encode (void) { free_val (); } bool good (void) {return valid;} const gnutls_datum_t &get_val (void) {return val;} char *get_string (void) {return (char *) val.data;} int get_size (void) {return val.size;} private: gnutls_datum_t val; bool valid; int locked_length; }; #endif // __OCT_PARALLEL_SENSITIVE_DATA__ parallel-3.0.3/src/reval.cc0000644000175000017500000001240312614416033014144 0ustar olafolaf/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2015 Olaf Till 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, see . */ // PKG_ADD: autoload ("reval", "parallel_interface.oct"); // PKG_DEL: autoload ("reval", "parallel_interface.oct", "remove"); #include #include "defun-dld.h" #include "dirfns.h" #include "error.h" #include "help.h" #include "oct-map.h" // #include "systime.h" #include "ov.h" #include "oct-obj.h" #include "utils.h" #include "oct-env.h" #include "parallel-gnutls.h" #include #include #include #include #include #include #include #include #include DEFUN_DLD (reval, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} reval (@var{commands}, @var{connections})\n\ Evaluate @var{commands} at all remote hosts specified by @var{connections}.\n\ \n\ This function can only be successfully called at the client\n\ machine. @var{commands} must be a string containing Octave commands\n\ suitable for execution with Octaves @code{eval()} function. See\n\ @code{pconnect} for a description of the @var{connections}\n\ variable. @var{connections} can contain all connections of the\n\ network, a subset of them, or a single connection. The local machine\n\ (client), if contained in @var{connections}, is\n\ ignored. @var{commands} is executed in the same way at each specified\n\ machine.\n\ \n\ @seealso{pconnect, pserver, psend, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("reval"); octave_value retval; if (args.length () != 2 || args(1).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } octave_value val = args(0); charMatrix cm = val.char_matrix_value (); if (error_state) { error ("%s: could not convert first argument to char matrix", fname.c_str ()); return retval; } int rows = val.rows (); int cols = val.columns (); const octave_base_value &rep = args(1).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); int nconns = conns->get_connections ().numel (); if (conns->get_whole_network ()->is_closed ()) { error ("%s: network is closed", fname.c_str ()); return retval; } if (conns->is_server ()) { error ("%s: 'reval' can't be called at the server side", fname.c_str ()); return retval; } inthandler_dont_restart_syscalls __inthandler_guard__; // check each connection before a command is sent over any if (nconns < conns->get_all_connections ().numel ()) // it's a subnet for (int i = 0; i < nconns; i++) if (conns->get_connections ()(i)->is_pseudo_connection ()) { error ("%s: using a subnet and client was given as one of the servers (index %i)", fname.c_str (), i + 1); return retval; } bool command_errors = false, stream_errors = false; int err; for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; if ((err = conns->get_connections ()(i)->poll_for_errors ())) { if (err > 0) { error ("%s: a previous command at server with index %i caused an error", fname.c_str (), i + 1); command_errors = true; } else // err < 0 { error ("%s: communication error with server with index %i", fname.c_str (), i + 1); stream_errors = true; } } } if (stream_errors) conns->close (); if (stream_errors || command_errors) return retval; std::string command (cols + 1, '\n'); // all but the last '\n' will // be overwritten for (int i = 0; i < nconns; i++) { if (conns->get_connections ()(i)->is_pseudo_connection ()) continue; for (int j = 0; j < rows; j++) { command.replace (0, cols, cm.extract (j, 0, j, cols - 1).data (), cols); if (conns->get_connections ()(i)->get_cmd_stream ()-> network_send_string (command.c_str ())) { error ("%s: error sending command to server with index %i", fname.c_str (), i + 1); conns->close (); return retval; } } } return retval; } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.0.3/src/__visglobal__.cc0000644000175000017500000000330712614416033015614 0ustar olafolaf// Copyright (C) 2015 Olaf Till // 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 "pt-all.h" DEFUN_DLD (__visglobal__, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} __visglobal__ (@var{vars})\n\ Internal function. Vector version of isglobal(), executed in calling frame. @var{vars} is a cellstr.\n\ @end deftypefn") { std::string fname ("__visglobal__"); if (args.length () != 1) { print_usage (); return octave_value_list (); } Array vars = args(0).cellstr_value (); if (error_state) { print_usage (); return octave_value_list (); } octave_idx_type n = vars.numel (); boolNDArray retval (dim_vector (n, 1)); unwind_protect frame; octave_call_stack::goto_caller_frame (); if (error_state) { error ("%s: goto_caller_frame() returned an error", fname.c_str ()); return octave_value_list (); } frame.add_fcn (octave_call_stack::pop); for (octave_idx_type i = 0; i < n; i++) retval(i) = symbol_table::is_global (vars(i)); return octave_value (retval); } parallel-3.0.3/src/configure.ac0000644000175000017500000000520012614416033015007 0ustar olafolaf# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.62) AC_INIT(parallel, 3.0.3, i7tiol@t-online.de) AC_CONFIG_SRCDIR([pconnect.cc]) AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CXX AC_PROG_CC AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile) # Checks for libraries. AC_CHECK_HEADER([gnutls/gnutls.h]) if test "x$ac_cv_header_gnutls_gnutls_h" = "xno"; then AC_MSG_ERROR([gnutls/gnutls.h not found or not compilable]) fi AC_CHECK_LIB([gnutls], [gnutls_global_init], [[echo -n ""]]) if test "x$ac_cv_lib_gnutls_gnutls_global_init" = "xyes"; then LIBS="-lgnutls $LIBS" AC_CHECK_PROG(PKG_CONFIG, pkg-config, pkg-config) if test -z "$PKG_CONFIG"; then AC_SUBST([HAVE_GNUTLS], [no]) AC_MSG_WARN([TLS disabled since pkg-config not found]) else AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include ] [#include ]], [[printf ("%u", gnutls_srp_2048_group_prime.size);]])], [AC_DEFINE([HAVE_LIBGNUTLS], 1) AC_SUBST([HAVE_GNUTLS], [yes])], [AC_SUBST([HAVE_GNUTLS], [no]) AC_MSG_WARN([TLS disabled since symbol gnutls_srp_2048_group_prime not found in gnutls library - built with --disable-srp-authentication?])]) fi AC_CHECK_LIB([gnutls-extra], [gnutls_global_init_extra], [[echo -n ""]]) if test "x$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" = "xyes"; then LIBS="-lgnutls-extra $LIBS" AC_DEFINE([HAVE_LIBGNUTLS_EXTRA], 1) AC_SUBST([HAVE_GNUTLS_EXTRA], [yes]) else AC_SUBST([HAVE_GNUTLS_EXTRA], [no]) fi else AC_SUBST([HAVE_GNUTLS], [no]) AC_MSG_WARN([TLS disabled since no gnutls library found]) fi # Checks for header files. AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h sys/malloc.h netdb.h netinet/in.h stdio_ext.h stdlib.h string.h sys/socket.h sys/time.h termios.h unistd.h]) if test "x$ac_cv_header_malloc_h" = "xno"; then if test "x$ac_cv_header_sys_malloc_h" = "xno"; then AC_MSG_ERROR([neither malloc.h nor sys/malloc.h found]) fi fi # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_TYPE_INT32_T AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT32_T # Checks for library functions. AC_FUNC_ERROR_AT_LINE AC_FUNC_FORK AC_FUNC_FSEEKO AC_FUNC_MALLOC AC_TYPE_SIGNAL AC_CHECK_FUNCS([memset mkdir modf select socket strchr strdup uname]) AC_CHECK_FUNC([getpass]) if test "x$ac_cv_func_getpass" = "xyes"; then AC_DEFINE([HAVE_GETPASS], 1) AC_SUBST([HAVE_GETPASS], [yes]) else AC_SUBST([HAVE_GETPASS], [no]) fi AC_CONFIG_FILES([Makefile]) AC_OUTPUT parallel-3.0.3/src/pconnect.cc0000644000175000017500000006156012614416033014654 0ustar olafolaf/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2015 Olaf Till 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, see . */ // PKG_ADD: autoload ("pconnect", "parallel_interface.oct"); // PKG_DEL: autoload ("pconnect", "parallel_interface.oct", "remove"); #include "config.h" #include #include #include #include #include #include // reported necessary for FreeBSD-8 #if HAVE_UNISTD_H #include #endif #include "parallel-gnutls.h" static int assert_file (std::string &path) { file_stat stat (path); if (! stat.is_reg ()) return -1; else return 0; } DEFUN_DLD (pconnect, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{connections} =} pconnect (@var{hosts})\n\ @deftypefnx {Loadable Function} {@var{connections} =} pconnect (@var{hosts}, @var{options})\n\ Connects to a network of parallel cluster servers.\n\ \n\ As a precondition, a server must have been started at each machine of\n\ the cluster, see @code{pserver}.\n\ \n\ @var{hosts} is a cell-array of strings, holding the names of all\n\ server machines. The machines must be unique, and their names must be\n\ resolvable to the correct addresses also at each server machine, not\n\ only at the client. This means e.g. that the name @code{localhost} is\n\ not acceptable (exception: @code{localhost} is acceptable as the first\n\ of all names).\n\ \n\ Alternatively, but deprecated, @var{hosts} can be given as previously,\n\ as a character array with a machine name in each row. If it is given\n\ in this way, the first row must contain the name of the client machine\n\ (for backwards compatibility), so that there is one row more than the\n\ now preferred cell-array @var{hosts} would have entries.\n\ \n\ @code{pconnect} returns an opaque variable holding the network\n\ connections. This variable can be indexed to obtain a subset of\n\ connections or even a single connection. (For backwards compatibility,\n\ a second index of @code{:} is allowed, which has no effect). At the\n\ first index position is the client machine, so this position does not\n\ correspond to a real connection. At the following index positions are\n\ the server machines in the same order as specified in the cell-array\n\ @var{hosts}. So in the whole the variable of network connections has\n\ one position more than the number of servers given in @var{hosts}\n\ (except if @var{hosts} was given in the above mentioned deprecated\n\ way). You can display the variable of network connections to see what\n\ is in it. The variable of network connections, or subsets of it, is\n\ passed to the other functions for parallel cluster excecution\n\ (@code{reval}, @code{psend}, @code{precv}, @code{sclose},\n\ @code{select_sockets} among others -- see documentation of these\n\ functions).\n\ \n\ @var{options}: structure of options; field @code{use_tls} is\n\ @code{true} by default (TLS with SRP authentication); if set to\n\ @code{false}, there will be no encryption or authentication. Field\n\ @code{password_file} can be set to an alternative path to the file\n\ with authentication information (see below). Field @code{user} can\n\ specify the username for authentication; if the username is so\n\ specified, no file with authentication information will be used at the\n\ client, but the password will be queried from the user.\n\ \n\ The client and the server must both use or both not use TLS. If TLS is\n\ switched off, different measures must be taken to protect ports 12501\n\ and 12502 at the servers and the client against unauthorized access;\n\ e.g. by a firewall or by physical isolation of the network.\n\ \n\ For using TLS, authorization data must be present at the server\n\ machine. These data can conveniently be generated by\n\ @code{parallel_generate_srp_data}. By default, the client\n\ authentication file is created in the same run. The helptext of\n\ @code{parallel_generate_srp_data} documents the expected locations of\n\ the authentication data.\n\ \n\ The SRP password will be sent over the encrypted TLS channel from the\n\ client to each server, to avoid permanently storing passwords at the\n\ server for server-to-server data connections. Due to inevitable usage\n\ of external libraries, memory with sensitive data can, however, be on\n\ the swap device even after shutdown of the application, both at the\n\ client and at the server machines.\n\ \n\ Example (let data travel through all machines), assuming\n\ @code{pserver} was called on each remote machine and authentication\n\ data is present (e.g. generated with\n\ @code{parallel_generate_srp_data}):\n\ \n\ @example\n\ @group\n\ sockets = pconnect (@{'remote.machine.1', 'remote.machine.2'@});\n\ reval ('psend (precv (sockets(2)), sockets(1))', sockets(3));\n\ reval ('psend (precv (sockets(1)), sockets(3))', sockets(2));\n\ psend ('some data', sockets(2));\n\ precv (sockets(3))\n\ --> ans = some data\n\ sclose (sockets);\n\ @end group\n\ @end example\n\ \n\ @seealso{pserver, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets, rfefal}\n\ @end deftypefn") { std::string fname ("pconnect"); octave_value retval; if (args.length () < 1 || args.length () > 2) { print_usage (); return retval; } if (nargout == 0) { error ("%s: An output argument must be given to hold the network connections.", fname.c_str ()); return retval; } // A negative integer might be sent as Octave data, and Octave // doesn't care about coding of negative integers. (I know, there // probably will never be a current C-compiler with something // different than twos complement, but the C99-standard allows for // it.) if (octave_parallel_stream::signed_int_rep ()) { error ("This machine doesn't seem to use twos complement as negative integer representation. If you want this machine to be supported, please file a bug report."); return retval; } // The original character array argument had client name in first // row. We still accept such an argument. But currently the client // and server names of connections at the server sides are taken // from the systems connection structures. This means e.g. that the // name under which a client appears to servers can be different on // different servers and different from the client hostname // retrieved at the client itself. // // The new cell-array argument does not give the client name; so it // has one entry less than the previous character array would have // had rows. Array hosts = args(0).cellstr_value (); if (error_state) { error_state = 0; charMatrix cm = args(0).char_matrix_value (); if (error_state) { error ("%s: first argument must be a cell array of strings or a character matrix", fname.c_str ()); return retval; } int rows = cm.rows (); int cols = cm.columns (); cm = cm.transpose (); hosts.resize1 (rows - 1, std::string ()); const char *pts, *pte; for (int i = 1; i < rows; i++) { if ((pte = (char *) memchr ((void *) (pts = &cm.data ()[cols * i]), ' ', cols))) hosts(i - 1) = std::string (pts, pte - pts); else hosts(i - 1) = std::string (pts, cols); } } uint32_t nhosts = hosts.numel (); inthandler_dont_restart_syscalls __inthandler_guard__; // "canonicalize" host names and check for uniqueness Array canhosts (dim_vector (nhosts, 1)); struct addrinfo *ai, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = AI_CANONNAME; struct __aiguard { struct addrinfo *__ai; __aiguard (struct addrinfo *__aai) : __ai (__aai) { } ~__aiguard (void) { freeaddrinfo (__ai); } }; for (uint32_t i = 0; i < nhosts; i++) { if (getaddrinfo (hosts(i).c_str (), NULL, &hints, &ai)) { error ("getaddrinfo returned an error"); return retval; } struct __aiguard __aig (ai); canhosts(i) = std::string (ai->ai_canonname); dcprintf ("orig: %s, canon: %s\n", hosts(i).c_str (), ai->ai_canonname); } Array s_canhosts (canhosts.sort ()); for (uint32_t i = 1; i < nhosts; i++) { if (! s_canhosts(i - 1).compare (s_canhosts(i))) { error ("%s: hostnames not unique after canonicalizing", fname.c_str ()); return retval; } } // default options bool use_gnutls = true; bool use_pfile = true; std::string cpfile; std::string user; // get options, if any if (args.length () == 2) { octave_scalar_map options; options = args(1).scalar_map_value (); if (error_state) { error ("%s: could not convert second argument to scalar structure", fname.c_str ()); return retval; } octave_value tmp; // use TLS tmp = options.contents ("use_tls"); if (tmp.is_defined ()) { use_gnutls = tmp.bool_value (); if (error_state) { error ("%s: could not convert option 'use_tls' to bool", fname.c_str ()); return retval; } } // custom password file tmp = options.contents ("password_file"); if (tmp.is_defined ()) { cpfile = tmp.string_value (); if (error_state) { error ("%s: could not convert option 'password_file' to string", fname.c_str ()); return retval; } } // user name tmp = options.contents ("user"); if (tmp.is_defined ()) { user = tmp.string_value (); if (error_state) { error ("%s: could not convert option 'user' to string", fname.c_str ()); return retval; } if (user.length ()) use_pfile = false; } } // args.length () == 2 // check options integrity #ifndef HAVE_LIBGNUTLS if (use_gnutls) { error ("TLS not available"); return retval; } #endif if (! use_gnutls && (! use_pfile || cpfile.length ())) warning ("no TLS used, options 'user' and 'password_file' have no effect"); if (use_gnutls && ! use_pfile && cpfile.length ()) warning ("option 'password_file' has no effect since option 'user' was given and is not empty"); #ifdef HAVE_LIBGNUTLS // if necessary, initialize gnutls and create credentials struct __credguard { octave_parallel_gnutls_srp_client_credentials *__c; __credguard (void) : __c (NULL) { } ~__credguard (void) { if (__c && ! __c->check_ref ()) { dcprintf ("__credguard will delete cred\n"); delete __c; } } octave_parallel_gnutls_srp_client_credentials *__get (void) { return __c; } void __set (octave_parallel_gnutls_srp_client_credentials *__ic) { __c = __ic; } void __release (void) { __c = NULL; } } __cg; octave_parallel_gnutls_srp_client_credentials *ccred; if (use_gnutls) { // There is no deinitialization routine for extra, _init_extra() // requires _init() to have been called before, and only the // first call to each of these functions does anything beyond // incrementing a counter. So we can't ever deinitialize even // the general globals, since we would not be able to // reinitialize _extra after this. So we can just as well call // the init functions for each pconnect, as long as their global // counters don't overflow. gnutls_global_init (); #ifdef HAVE_LIBGNUTLS_EXTRA gnutls_global_init_extra (); // for SRP parallel_gnutls_set_mem_functions (); #endif if (use_pfile) { if (! cpfile.length ()) { extern std::string Voctave_home; cpfile = Voctave_home + file_ops::dir_sep_str () + "share" + file_ops::dir_sep_str () + "octave" + file_ops::dir_sep_str () + "parallel-srp-data" + file_ops::dir_sep_str () + "client" + file_ops::dir_sep_str () + "user_passwd"; if (assert_file (cpfile)) { octave_value_list f_args (1); f_args(0) = octave_value ("prefix"); octave_value_list f_ret = feval ("pkg", f_args, 1); if (error_state) { error ("%s: could not get prefix from pkg", fname.c_str ()); return retval; } cpfile = f_ret(0).string_value (); if (error_state) { error ("%s: could not convert output of pkg ('prefix') to string)", fname.c_str ()); return retval; } cpfile = cpfile + file_ops::dir_sep_str () + "parallel-srp-data" + file_ops::dir_sep_str () + "client" + file_ops::dir_sep_str () + "user_passwd"; if (assert_file (cpfile)) { error ("%s: no regular file found at default password file paths", fname.c_str ()); return retval; } } } else if (assert_file (cpfile)) { error ("%s: no regular file found at password file path given by user", fname.c_str ()); return retval; } __cg.__set (ccred = new octave_parallel_gnutls_srp_client_credentials (cpfile)); // arg is std::string } else __cg.__set (ccred = new octave_parallel_gnutls_srp_client_credentials (user.c_str ())); // arg is char* string if (! __cg.__get ()->check_cred ()) { error ("%s: could not create credentials", fname.c_str ()); return retval; } } #endif // HAVE_LIBGNUTLS char tuuid[37]; char *uuid = (char *) tuuid; if (oct_parallel_store_unique_identifier (uuid)) return retval; octave_parallel_network *network; struct __netwguard { octave_parallel_network *__n; __netwguard (octave_parallel_network *__an): __n (__an) { __n->get_ref (); } ~__netwguard (void) { if (__n->release_ref () <= 0) { dcprintf ("__netwguard will delete network\n"); delete __n; } } } __ng (network = new octave_parallel_network (nhosts + 1)); // a pseudo-connection, representing the own node in the network octave_parallel_connection *conn = new octave_parallel_connection (false, uuid); network->insert_connection (conn, 0); // store number of processor cores available in client conn->set_nproc (num_processors (NPROC_CURRENT)); for (uint32_t i = 0; i < nhosts; i++) { dcprintf ("host number %i\n", i); int sock = socket (PF_INET, SOCK_STREAM, 0); if (sock == -1) { error ("socket error"); return retval; } struct __sockguard { __sockguard (int __isock) { __sock = __isock; } ~__sockguard (void) { if (__sock > -1) close (__sock); } void __release (void) { __sock = -1; } int __sock; } __sockg (sock); struct addrinfo *ai, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = 0; if (getaddrinfo (hosts(i).c_str (), "12502", &hints, &ai)) { error ("getaddrinfo returned an error"); return retval; } struct __aiguard __aig (ai); int not_connected = 1; for (int j = 0; j < N_CONNECT_RETRIES; j++) { if((not_connected = connect (sock, ai->ai_addr, ai->ai_addrlen)) == 0) break; else if (errno != ECONNREFUSED && errno != EINTR) { error ("connect error"); break; } else usleep(5000); } if (not_connected) { error ("Unable to connect to %s", hosts(i).c_str ()); return retval; } else { conn = new octave_parallel_connection (hosts(i).c_str (), false, uuid); network->insert_connection (conn, i + 1); #ifdef HAVE_LIBGNUTLS if (use_gnutls) { conn->insert_cmd_stream (new octave_parallel_stream (new octave_parallel_gnutls_streambuf (sock, ccred, false))); __cg.__release (); } else #endif conn->insert_cmd_stream (new octave_parallel_stream (new octave_parallel_socket_streambuf (sock))); __sockg.__release (); if (! conn->get_cmd_stream ()->good ()) { error ("could not create command stream to %s", hosts(i).c_str ()); return retval; } conn->get_cmd_stream ()->network_send_4byteint (nhosts, true); dcprintf ("nhosts written\n"); uint32_t nproc; conn->get_cmd_stream ()->network_recv_4byteint (nproc); dcprintf ("nproc read (%u)\n", nproc); conn->set_nproc (nproc); conn->get_cmd_stream ()->network_send_4byteint (i + 1, true); dcprintf ("current host number written (%i)\n", i + 1); conn->get_cmd_stream ()->network_send_string (uuid); dcprintf ("uuid written (%s)\n", uuid); for (uint32_t j = 0; j < nhosts; j++) { conn->get_cmd_stream ()->network_send_string (hosts(j).c_str ()); dcprintf ("hostname %i written (%s)\n", j, hosts(j).c_str ()); } std::string directory = octave_env::get_current_directory (); conn->get_cmd_stream ()->network_send_string (directory.c_str ()); dcprintf ("directory written (%s)\n", directory.c_str ()); #ifdef HAVE_LIBGNUTLS // This is to enable the servers to authenticate to each // other with TLS-SRP without having passwords stored at the // servers. The username can be read from the TLS-SRP // structures by the server. if (use_gnutls) { conn->get_cmd_stream ()->network_send_string (ccred->get_passwd ()); dcprintf ("password written (%s)\n", ccred->get_passwd ()); } #endif if (! conn->get_cmd_stream ()->good ()) { error ("communication error in initialization"); return retval; } } } // go through the (now short) chain of deallocation-safeguarding // objects up to octave_value octave_parallel_connections *cconns = new octave_parallel_connections (network, uuid, false); retval = octave_value (cconns); octave_parallel_connections_rep *conns = cconns->get_rep (); // usleep (100); dcprintf ("\n data socket \n\n"); for (uint32_t i = 0; i < nhosts; i++) { dcprintf ("host number %i\n", i); struct addrinfo *ai = NULL, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = 0; if (getaddrinfo (hosts(i).c_str (), "12501", &hints, &ai)) { error ("getaddrinfo returned an error"); return retval; } struct __aiguard __aig (ai); int not_connected = 1; for (int j = 0; j < N_CONNECT_RETRIES; j++) { dcprintf ("host %i, connect retry %i\n", i, j); int sock = socket (PF_INET, SOCK_STREAM, 0); if (sock == -1) { error ("socket error"); return retval; } struct __sockguard { __sockguard (int __isock) { __sock = __isock; } ~__sockguard (void) { if (__sock > -1) close (__sock); } void __release (void) { __sock = -1; } int __sock; } __sockg (sock); dcprintf ("%i, %i, trying to connect \n", i, j); if (connect (sock, ai->ai_addr, ai->ai_addrlen) == 0) { dcprintf ("%i, %i, connect successful\n", i, j); octave_parallel_stream *data_stream; #ifdef HAVE_LIBGNUTLS if (use_gnutls) conns->get_connections ()(i + 1)->insert_data_stream (data_stream = new octave_parallel_stream (new octave_parallel_gnutls_streambuf (sock, ccred, false))); else #endif conns->get_connections ()(i + 1)->insert_data_stream (data_stream = new octave_parallel_stream (new octave_parallel_socket_streambuf (sock))); __sockg.__release (); if (! data_stream->good ()) { error ("%i, %i, could not create data stream to %s", i, j, hosts(i).c_str ()); return retval; } dcprintf ("data connection established\n"); data_stream->network_send_string (uuid); dcprintf ("%i, %i, uuid written (%s)\n", i, j, uuid); // send host number 0 (me, the master) data_stream->network_send_4byteint (0, true); dcprintf ("%i, %i, me (0) written\n", i, j); // recv result code int32_t res; data_stream->network_recv_4byteint (res); if (! data_stream->good ()) { error ("communication error in initialization"); return retval; } if (res == -1) { if (conns->get_connections ()(i + 1)->delete_data_stream ()) { error ("could not delete data stream"); return retval; } dcprintf ("%i, %i, sleeping after receiving bad result (%i)\n", i, j, res); usleep (5000); } else if (res) { error ("unexpected server error"); return retval; } else { write_header (data_stream->get_ostream (), LS_BINARY); conns->get_connections ()(i + 1)->connection_read_header (); if (error_state || ! data_stream->good ()) { error ("communication error in initialization"); return retval; } not_connected = 0; dcprintf ("%i, %i, good result read, header written and read and datastream good, breaking\n", i, j); break; } } else if (errno != ECONNREFUSED && errno != EINTR) { error ("connect error"); break; } else { dcprintf ("%i, %i, sleeping after failed connect\n", i, j); usleep (5000); } } if (not_connected) { error ("unable to connect to %s", hosts(i).c_str ()); return retval; } } char dummy; for (uint32_t i = 1; i <= nhosts; i++) { conns->get_connections ()(i)->get_cmd_stream ()->get_istream () >> std::noskipws >> dummy; dcprintf ("host %i, final dummy read from command stream (%i)\n", i, dummy); dummy = '\n'; conns->get_connections ()(i)->get_cmd_stream ()->get_ostream () << dummy; dcprintf ("host %i, final newline written to command stream\n", i); if (! conns->get_connections ()(i)->get_cmd_stream ()->good ()) { error ("could not finish initialization"); return retval; } dcprintf ("host %i, command stream good\n", i); } dcprintf ("returning retval\n"); return retval; } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.0.3/src/fload.cc0000644000175000017500000000413712614416033014125 0ustar olafolaf// Copyright (C) 2009 VZLU Prague, a.s., Czech Republic // // 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 . // Author: Jaroslav Hajek #include #include #include #include DEFUN_DLD (fload, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{var} =} fload (@var{fid})\n\ Loads a single variable of any type from a binary stream, where it was previously\n\ saved with fsave.\n\ Not suitable for data transfer between machines of different type.\n\ @end deftypefn") { octave_value retval; int nargin = args.length (); if (nargin == 1) { int fid = octave_stream_list::get_file_number (args (0)); octave_stream octs = octave_stream_list::lookup (fid, "fload"); std::istream *is = octs.input_stream (); if (is) { // FIXME: these are dummies. It would be nice to get rid of them and call // a more low-level interface, but there doesn't seem to be a more suitable // one in Octave, that still does the automatic type lookup. std::string doc, filename; bool swap = false, global; read_binary_data (*is, swap, oct_mach_info::native_float_format (), filename, global, retval, doc); if (retval.is_undefined ()) error ("fload: failed to extract value"); } else error ("fload: stream not opened for reading."); } else print_usage (); return retval; } parallel-3.0.3/src/sclose.cc0000644000175000017500000000461712614416033014333 0ustar olafolaf/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2015 Olaf Till 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, see . */ // PKG_ADD: autoload ("sclose", "parallel_interface.oct"); // PKG_DEL: autoload ("sclose", "parallel_interface.oct", "remove"); #include #include #include "defun-dld.h" #include "dirfns.h" #include "error.h" #include "help.h" #include "oct-map.h" // #include "systime.h" #include "ov.h" #include "oct-obj.h" #include "utils.h" #include "oct-env.h" #include "parallel-gnutls.h" #include #include #include #include #include #include #include #include DEFUN_DLD (sclose, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} sclose (@var{connections})\n\ Close the parallel cluster network to which @var{connections} belongs.\n\ \n\ See @code{pconnect} for a description of the @var{connections}\n\ variable. All connections of the network are closed, even if\n\ @var{connections} contains only a subnet or a single connection.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { std::string fname ("sclose"); octave_value retval; if (args.length () != 1 || args(0).type_id () != octave_parallel_connections::static_type_id ()) { print_usage (); return retval; } const octave_base_value &rep = args(0).get_rep (); const octave_parallel_connections &cconns = dynamic_cast (rep); octave_parallel_connections_rep *conns = cconns.get_rep (); inthandler_dont_restart_syscalls __inthandler_guard__; conns->close (); return retval; } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.0.3/src/getpass.c0000644000175000017500000001211012614416033014331 0ustar olafolaf/* Copyright (C) 1992-2001, 2003-2007, 2009-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. 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 . */ #include #include #include #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) # include # if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING # if HAVE_STDIO_EXT_H # include # endif # else # define __fsetlocking(stream, type) /* empty */ # endif # if HAVE_TERMIOS_H # include # endif # if USE_UNLOCKED_IO # include "unlocked-io.h" # else # if !HAVE_DECL_FFLUSH_UNLOCKED # undef fflush_unlocked # define fflush_unlocked(x) fflush (x) # endif # if !HAVE_DECL_FLOCKFILE # undef flockfile # define flockfile(x) ((void) 0) # endif # if !HAVE_DECL_FUNLOCKFILE # undef funlockfile # define funlockfile(x) ((void) 0) # endif # if !HAVE_DECL_FPUTS_UNLOCKED # undef fputs_unlocked # define fputs_unlocked(str,stream) fputs (str, stream) # endif # if !HAVE_DECL_PUTC_UNLOCKED # undef putc_unlocked # define putc_unlocked(c,stream) putc (c, stream) # endif # endif /* It is desirable to use this bit on systems that have it. The only bit of terminal state we want to twiddle is echoing, which is done in software; there is no need to change the state of the terminal hardware. */ # ifndef TCSASOFT # define TCSASOFT 0 # endif static void call_fclose (void *arg) { if (arg != NULL) fclose (arg); } char * getpass (const char *prompt) { FILE *tty; FILE *in, *out; struct termios s, t; bool tty_changed = false; static char *buf; static size_t bufsize; ssize_t nread; /* Try to write to and read from the terminal if we can. If we can't open the terminal, use stderr and stdin. */ tty = fopen ("/dev/tty", "w+"); if (tty == NULL) { in = stdin; out = stderr; } else { /* We do the locking ourselves. */ __fsetlocking (tty, FSETLOCKING_BYCALLER); out = in = tty; } flockfile (out); /* Turn echoing off if it is on now. */ # if HAVE_TCGETATTR if (tcgetattr (fileno (in), &t) == 0) { /* Save the old one. */ s = t; /* Tricky, tricky. */ t.c_lflag &= ~(ECHO | ISIG); tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0); } # endif /* Write the prompt. */ fputs_unlocked (prompt, out); fflush_unlocked (out); /* Read the password. */ nread = getline (&buf, &bufsize, in); /* According to the C standard, input may not be followed by output on the same stream without an intervening call to a file positioning function. Suppose in == out; then without this fseek call, on Solaris, HP-UX, AIX, OSF/1, the previous input gets echoed, whereas on IRIX, the following newline is not output as it should be. POSIX imposes similar restrictions if fileno (in) == fileno (out). The POSIX restrictions are tricky and change from POSIX version to POSIX version, so play it safe and invoke fseek even if in != out. */ fseeko (out, 0, SEEK_CUR); if (buf != NULL) { if (nread < 0) buf[0] = '\0'; else if (buf[nread - 1] == '\n') { /* Remove the newline. */ buf[nread - 1] = '\0'; if (tty_changed) { /* Write the newline that was not echoed. */ putc_unlocked ('\n', out); } } } /* Restore the original setting. */ # if HAVE_TCSETATTR if (tty_changed) tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s); # endif funlockfile (out); call_fclose (tty); return buf; } #else /* W32 native */ /* Windows implementation by Martin Lambers , improved by Simon Josefsson. */ /* For PASS_MAX. */ # include /* For _getch(). */ # include /* For strdup(). */ # include # ifndef PASS_MAX # define PASS_MAX 512 # endif char * getpass (const char *prompt) { char getpassbuf[PASS_MAX + 1]; size_t i = 0; int c; if (prompt) { fputs (prompt, stderr); fflush (stderr); } for (;;) { c = _getch (); if (c == '\r') { getpassbuf[i] = '\0'; break; } else if (i < PASS_MAX) { getpassbuf[i++] = c; } if (i >= PASS_MAX) { getpassbuf[i] = '\0'; break; } } if (prompt) { fputs ("\r\n", stderr); fflush (stderr); } return strdup (getpassbuf); } #endif parallel-3.0.3/src/pserver.cc0000644000175000017500000011713412614416033014530 0ustar olafolaf/* Copyright (C) 2002 Hayato Fujiwara Copyright (C) 2010-2015 Olaf Till 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, see . */ // PKG_ADD: autoload ("pserver", "parallel_interface.oct"); // PKG_DEL: autoload ("pserver", "parallel_interface.oct", "remove"); #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // reported necessary for FreeBSD-8 #if HAVE_UNISTD_H #include #endif #include "parallel-gnutls.h" #include "config.h" // Octave > 3.2.4 does not have these in a header file, but in // sighandlers.cc, and uses gnulib:: for these. So this is copied from // Octave-3.2.4. #define BLOCK_SIGNAL(sig, nvar, ovar) \ do \ { \ sigemptyset (&nvar); \ sigaddset (&nvar, sig); \ sigemptyset (&ovar); \ sigprocmask (SIG_BLOCK, &nvar, &ovar); \ } \ while (0) #if !defined (SIGCHLD) && defined (SIGCLD) #define SIGCHLD SIGCLD #endif // FIXME: Octave-3.2.4 had HAVE_POSIX_SIGNALS in config.h, newer // Octave has not (probably due to using gnulib?). We have not this // test in configure now, but assume HAVE_POSIX_SIGNALS defined. #define BLOCK_CHILD(nvar, ovar) BLOCK_SIGNAL (SIGCHLD, nvar, ovar) #define UNBLOCK_CHILD(ovar) sigprocmask (SIG_SETMASK, &ovar, 0) // #else // #define BLOCK_CHILD(nvar, ovar) ovar = sigblock (sigmask (SIGCHLD)) // #define UNBLOCK_CHILD(ovar) sigsetmask (ovar) static int assert_file (std::string &path) { file_stat stat (path); if (! stat.is_reg ()) return -1; else return 0; } /* children are not killed on parent exit; for that octave_child_list can not be used and an own SIGCHLD handler is needed */ static bool pserver_child_event_handler (pid_t pid, int ev) { return 1; // remove child from octave_child_list } void reval_loop (octave_parallel_stream &cstr) { dsprintf ("reval, trying to write and read dummy\n"); // send and read the final character of the initialization protocol // to and from the client char dummy = '\n'; cstr.get_ostream () << dummy; dsprintf ("reval, wrote dummy (%i)\n", dummy); cstr.get_istream () >> std::noskipws >> dummy; dsprintf ("reval, read dummy (%i)\n", dummy); if (! cstr.good ()) { error ("could not finish initialization"); _exit (1); } bool firsttime = true; dsprintf ("reval, entering loop\n"); while (true) // function does not return { std::string s; if (firsttime) { dsprintf ("reval, setting command to 'rehash ()' at first repetition of loop\n"); s = "rehash ()\n"; // this avoided some problems firsttime = false; } else { dsprintf ("reval loop, before network_recv_string\n"); if (cstr.network_recv_string (s)) { error ("error reading command"); _exit (1); } dsprintf ("reval loop, after successful network_recv_string\n"); } int p_err; eval_string (s, false, p_err, 0); dsprintf ("reval loop, after evaluating string\n"); uint32_t nl = 0; if (error_state) { dsprintf ("reval loop, error state was set\n"); nl = 1; error_state = 0; } else if (p_err) { dsprintf ("reval loop, p_err was set\n"); nl = 1; } if (nl) { dsprintf ("reval loop, before sending error indication\n"); if (cstr.network_send_4byteint (nl, true)) { error ("error sending error code"); _exit (1); } dsprintf ("reval loop, after successful sending error indication\n"); } else { dsprintf ("reval loop, no error, caring for Octave command number\n"); if (octave_completion_matches_called) octave_completion_matches_called = false; else command_editor::increment_current_command_number (); dsprintf ("reval loop, no error, after caring for Octave command number\n"); } } } static int check_and_write_pidfile (const char *fname, int pid) { int fd, ret, nread; while ((fd = open (fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0 && errno == EINTR); if (fd < 0) return -1; struct flock fl; fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; while ((ret = fcntl (fd, F_SETLKW, &fl)) < 0 && errno == EINTR); if (ret < 0) { close (fd); return -1; } char b; while ((nread = read (fd, &b, 1)) < 0 && errno == EINTR); if (nread < 0 || nread == 1) { close (fd); return -1; } if (lseek (fd, 0, SEEK_SET)) { close (fd); return -1; } FILE *fstr; if (! (fstr = fdopen (fd, "w+"))) { close (fd); return -1; } if (fprintf (fstr, "%i", pid) < 0) { fclose (fstr); return -1; } if (fclose (fstr) == EOF) return -1; else return 0; } DEFUN_DLD (pserver, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} pserver ()\n\ @deftypefnx {Loadable Function} {} pserver (@var{options})\n\ This function starts a server of the parallel cluster and should be called once at any server machine.\n\ \n\ It is important to call this function in a way assuring that Octave is\n\ quit as soon as the function returns, i.e. call it e.g. like\n\ @code{octave --eval \"pserver\"} or @code{octave --eval \"pserver\n\ (struct ('fieldname', value))\"}.\n\ \n\ If a directory path corresponding to the current directory of the\n\ client exists on the server machine, it will be used as the servers\n\ current directory for the respective client (multiple clients are\n\ possible). Otherwise, @code{/tmp} will be used. The Octave functions\n\ the server is supposed to call and the files it possibly has to access\n\ must be available at the server machine. This can e.g. be achieved by\n\ having the server machine mount a network file system (which is\n\ outside the scope of this package documentation).\n\ \n\ The parent server process can only be terminated by sending it a\n\ signal. The pid of this process, as long as it is running, will be\n\ stored in the file @code{/tmp/.octave-.pid}.\n\ \n\ If a connection is accepted from a client, the server collects a\n\ network identifier and the names of all server machines of the network\n\ from the client. Then, connections are automatically established\n\ between all machines of the network. Data exchange will be possible\n\ between all machines (client or server) in both directions. Commands\n\ can only be sent from the client to any server.\n\ \n\ The opaque variable holding the network connections, in the same order\n\ as in the corresponding variable returned by @code{pconnect}, is\n\ accessible under the variable name @code{sockets} at the server\n\ side. Do not overwrite or clear this variable. The own server machine\n\ will also be contained at some index position of this variable, but\n\ will not correspond to a real connection. See @code{pconnect} for\n\ further information.\n\ \n\ @var{options}: structure of options; field @code{use_tls} is\n\ @code{true} by default (TLS with SRP authentication); if set to\n\ @code{false}, there will be no encryption or authentication. Field\n\ @code{auth_file} can be set to an alternative path to the file with\n\ authentication information (see below).\n\ \n\ The client and the server must both use or both not use TLS. If TLS is\n\ switched off, different measures must be taken to protect ports 12501\n\ and 12502 at the servers and the client against unauthorized access;\n\ e.g. by a firewall or by physical isolation of the network.\n\ \n\ For using TLS, authorization data must be present at the server\n\ machine. These data can conveniently be generated by\n\ @code{parallel_generate_srp_data}; the helptext of the latter function\n\ documents the expected location of these data.\n\ \n\ The SRP password will be sent over the encrypted TLS channel from the\n\ client to each server, to avoid permanently storing passwords at the\n\ server for server-to-server data connections. Due to inevitable usage\n\ of external libraries, memory with sensitive data can, however, be on\n\ the swap device even after shutdown of the application.\n\ \n\ @seealso{pconnect, reval, psend, precv, sclose, parallel_generate_srp_data, select_sockets}\n\ @end deftypefn") { // Contrary to what is done in the client side function connect.cc, // it is not necessarily always explicitely cared here for closing // of sockets and freeing of allocated memory in cases of // error. Since the processes exit in case of an internal error, // there is sometimes no need to do this. Exceptions may return to // the Octave prompt instead of exiting, but this is as good as // exiting provided the server was started in a way that leads to // exiting Octave as soon as the server returns. // // However, deallocation of anything which uses credentials has to // be carefully provided here also, since the destructor of the // ref-counted credentials must be called in the end to zero // sensitive data before deallocation. octave_value_list retval; std::string fname ("pserver"); if (args.length () > 1) { print_usage (); return retval; } // A negative integer might be sent as Octave data, and Octave // doesn't care about coding of negative integers. (I know, there // probably will never be a current C-compiler with something // different than twos complement, but the C-standard allows for // it.) if (octave_parallel_stream::signed_int_rep ()) { error ("This machine doesn't seem to use twos complement as negative integer representation. If you want this to be supported, please file a bug report."); return retval; } struct utsname utsname_buf; if (uname (&utsname_buf)) { error ("error calling uname()"); return retval; } std::string hostname (utsname_buf.nodename); std::string pidname ("/tmp/.octave-"); pidname = pidname + hostname + ".pid"; // default options bool use_gnutls = true; std::string cafile; // get options, if any if (args.length () == 1) { octave_scalar_map options; options = args(0).scalar_map_value (); if (error_state) { error ("%s: could not convert second argument to scalar structure", fname.c_str ()); return retval; } octave_value tmp; // use TLS tmp = options.contents ("use_tls"); if (tmp.is_defined ()) { use_gnutls = tmp.bool_value (); if (error_state) { error ("%s: could not convert option 'use_tls' to bool", fname.c_str ()); return retval; } } // custom authentication file tmp = options.contents ("auth_file"); if (tmp.is_defined ()) { cafile = tmp.string_value (); if (error_state) { error ("%s: could not convert option 'auth_file' to string", fname.c_str ()); return retval; } } } // args.length () == 1 // check options integrity #ifndef HAVE_LIBGNUTLS if (use_gnutls) { error ("TLS not available"); return retval; } #endif if (! use_gnutls && cafile.length ()) warning ("no TLS used, option 'auth_file' has no effect"); // initialize exit function feval ("__pserver_exit__", octave_value (hostname), 0); int tp; if (tp = fork ()) { if (tp == -1) error ("could not fork"); return retval; } // register exit function feval ("atexit", octave_value ("__pserver_exit__"), 0); /* write pidfile and mark for deletion. */ if (check_and_write_pidfile (pidname.c_str (), getpid ())) { std::cerr << "octave: " << hostname.c_str () << ": can't write pidfile, server possibly already running" << std::endl; clean_up_and_exit (1); } mark_for_deletion (pidname.c_str ()); std::cout << pidname.c_str () << std::endl; // avoid dumping octave_core if killed by a signal feval ("sigterm_dumps_octave_core", octave_value (0), 0); feval ("sighup_dumps_octave_core", octave_value (0), 0); /* Redirect stdin and stdout to /dev/null. */ if (! freopen ("/dev/null", "r", stdin)) { perror ("freopen"); clean_up_and_exit (1); } if (! freopen ("/dev/null", "w", stdout)) { perror ("freopen"); clean_up_and_exit (1); } std::string errname ("/tmp/octave_error-"); errname = errname + hostname.c_str () + ".log"; struct stat fstat; if (stat (errname.c_str (), &fstat) == 0) { std::string bakname ("/tmp/octave_error-"); bakname = bakname + hostname.c_str () + ".bak"; if (rename (errname.c_str (), bakname.c_str ())) { perror ("rename"); clean_up_and_exit (1); } } if (! freopen (errname.c_str (), "w", stderr)) { perror ("freopen"); clean_up_and_exit (1); } struct addrinfo *ai, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = AI_PASSIVE; if (getaddrinfo (NULL, "12502", &hints, &ai)) { perror ("getaddrinfo"); clean_up_and_exit (1); } int sock = socket (PF_INET, SOCK_STREAM, 0); if (sock == -1) { perror ("socket"); clean_up_and_exit (1); } if (bind (sock, ai->ai_addr, ai->ai_addrlen)) { perror ("bind"); clean_up_and_exit (1); } if (listen (sock, SOMAXCONN)) { perror ("listen"); clean_up_and_exit (1); } if (getaddrinfo (NULL, "12501", &hints, &ai)) { perror ("getaddrinfo"); clean_up_and_exit (1); } int dsock = socket (PF_INET, SOCK_STREAM, 0); if (dsock == -1) { perror ("socket"); clean_up_and_exit (1); } if (bind (dsock, ai->ai_addr, ai->ai_addrlen)) { perror ("bind"); clean_up_and_exit (1); } if (listen (dsock, SOMAXCONN)) { perror ("listen"); clean_up_and_exit (1); } freeaddrinfo (ai); int server_no = -1; // for debugging for(;;) { server_no++; dsprintf ("server_no: %i, trying to accept command stream\n", server_no); int asock = accept (sock, 0, 0); if (asock == -1) { perror ("accept"); clean_up_and_exit (1); } dsprintf ("%i: accepted command stream\n", server_no); /* Normal production daemon. Fork, and have the child process the connection. The parent continues listening. */ // remove non-existing children from octave_child_list OCTAVE_QUIT; sigset_t nset, oset, dset; BLOCK_CHILD (nset, oset); BLOCK_SIGNAL (SIGTERM, nset, dset); BLOCK_SIGNAL (SIGHUP, nset, dset); // restores all signals to state before BLOCK_CHILD #define RESTORE_SIGNALS(ovar) UNBLOCK_CHILD(ovar) int pid; if ((pid = fork ()) == -1) { perror ("fork"); clean_up_and_exit (1); } else if (pid == 0) { int tp; if (tp = fork ()) { if (tp == -1) { perror ("fork"); _exit (1); } else _exit (0); } dsprintf ("%i: child after fork\n", server_no); close (sock); signal (SIGCHLD, SIG_DFL); signal (SIGTERM, SIG_DFL); signal (SIGQUIT, SIG_DFL); RESTORE_SIGNALS (oset); #ifdef HAVE_LIBGNUTLS struct __ccredguard { octave_parallel_gnutls_srp_client_credentials *__c; __ccredguard (void) : __c (NULL) { } ~__ccredguard (void) { if (__c && ! __c->check_ref ()) delete __c; } octave_parallel_gnutls_srp_client_credentials *__get (void) { return __c; } void __set (octave_parallel_gnutls_srp_client_credentials *__ic) { __c = __ic; } void __release (void) { __c = NULL; } } __ccg; octave_parallel_gnutls_srp_client_credentials *ccred; struct __scredguard { octave_parallel_gnutls_srp_server_credentials *__c; __scredguard (void) : __c (NULL) { } ~__scredguard (void) { if (__c && ! __c->check_ref ()) delete __c; } octave_parallel_gnutls_srp_server_credentials *__get (void) { return __c; } void __set (octave_parallel_gnutls_srp_server_credentials *__ic) { __c = __ic; } void __release (void) { __c = NULL; } } __scg; octave_parallel_gnutls_srp_server_credentials *scred; if (use_gnutls) { gnutls_global_init (); #ifdef HAVE_LIBGNUTLS_EXTRA gnutls_global_init_extra (); // for SRP parallel_gnutls_set_mem_functions (); #endif dsprintf ("%i: after initializing gnutls\n", server_no); // generate credentials if (! cafile.length ()) { extern std::string Voctave_home; cafile = Voctave_home + file_ops::dir_sep_str () + "share" + file_ops::dir_sep_str () + "octave" + file_ops::dir_sep_str () + "parallel-srp-data" + file_ops::dir_sep_str () + "server" + file_ops::dir_sep_str () + "passwd"; if (assert_file (cafile)) { octave_value_list f_args (1); f_args(0) = octave_value ("prefix"); octave_value_list f_ret = feval ("pkg", f_args, 1); if (error_state) { error ("%s: could not get prefix from pkg", fname.c_str ()); _exit (1); } cafile = f_ret(0).string_value (); if (error_state) { error ("%s: could not convert output of pkg ('prefix') to string)", fname.c_str ()); _exit (1); } cafile = cafile + file_ops::dir_sep_str () + "parallel-srp-data" + file_ops::dir_sep_str () + file_ops::dir_sep_str () + "server" + file_ops::dir_sep_str () + "passwd"; if (assert_file (cafile)) { error ("%s: no regular file found at default password file paths", fname.c_str ()); _exit (1); } } } else if (assert_file (cafile)) { error ("%s: no regular file found at password file path given by user", fname.c_str ()); _exit (1); } __scg.__set (scred = new octave_parallel_gnutls_srp_server_credentials (cafile)); dsprintf ("%i: after generating credentials\n", server_no); if (! __scg.__get ()->check_cred ()) { error ("%s: could not create credentials", fname.c_str ()); _exit (1); } } #endif // HAVE_LIBGNUTLS // determine own number of usable processor cores uint32_t nproc = num_processors (NPROC_CURRENT); // The servers command stream will not be inserted into a // connection object. octave_parallel_streambuf *cmd_strb; #ifdef HAVE_LIBGNUTLS if (use_gnutls) { dsprintf ("%i: will generate gnutls streambuf\n", server_no); cmd_strb = new octave_parallel_gnutls_streambuf (asock, scred, true); __scg.__release (); dsprintf ("%i: generated gnutls streambuf\n", server_no); } else #endif cmd_strb = new octave_parallel_socket_streambuf (asock); octave_parallel_stream cmd_str (cmd_strb); if (! cmd_str.good ()) { error ("could not create command stream"); _exit (1); } uint32_t nhosts; cmd_str.network_recv_4byteint (nhosts); dsprintf ("%i: received nhosts (%i), good: %i\n", server_no, nhosts, cmd_str.good ()); cmd_str.network_send_4byteint (nproc, true); dsprintf ("%i: sent nproc (%u), good: %i\n", server_no, nproc, cmd_str.good ()); uint32_t me; cmd_str.network_recv_4byteint (me); dsprintf ("%i: received me (%i), good: %i\n", server_no, me, cmd_str.good ()); std::string uuid; cmd_str.network_recv_string (uuid); dsprintf ("%i: received uuid (%s), good: %i\n", server_no, uuid.c_str (), cmd_str.good ()); if (! cmd_str.good ()) // check before using the received 'nhosts' { error ("communication error in initialization"); _exit (1); } Array hosts (dim_vector (nhosts, 1)); for (uint32_t i = 0; i < nhosts; i++) { cmd_str.network_recv_string (hosts(i)); dsprintf ("%i: received hostname no %i (%s)\n", server_no, i, hosts(i).c_str ()); } dsprintf ("will now change name of error file\n"); errname = std::string ("/tmp/octave_error-") + hostname.c_str () + "_" + uuid.c_str () + ".log"; if (stat (errname.c_str (), &fstat) == 0) { std::string bakname ("/tmp/octave_error-"); bakname = bakname + hostname.c_str () + "_" + uuid.c_str () + ".bak"; if (rename (errname.c_str (), bakname.c_str ())) { perror ("rename"); _exit (1); } } if (! freopen (errname.c_str (), "w", stderr)) { perror ("freopen"); _exit (1); } std::string directory; cmd_str.network_recv_string (directory); dsprintf ("%i: received directory (%s)\n", server_no, directory.c_str ()); #define BUFLEN 1024 struct __pwguard { char *__pw; int __len; __pwguard (int __alen) : __pw (new char[__alen]), __len (__alen) { } void __free (void) { if (__pw) { memset ((void *) __pw, 0, __len); delete [] __pw; __pw = NULL; } } ~__pwguard (void) { __free (); } char *__get (void) { return __pw; } } __pwg (BUFLEN); if (use_gnutls) { cmd_str.network_recv_string (__pwg.__get (), BUFLEN); if (me == nhosts) // we won't need it __pwg.__free (); dsprintf ("%i: received password (%s)\n", server_no, __pwg.__get ()); } if (! cmd_str.good ()) { error ("communication error in initialization"); _exit (1); } // client may shut down before starting data connections (if // it was unable to establish all command connections) struct pollfd pfd[2]; pfd[0].fd = asock; pfd[0].events = POLLIN | POLLHUP; // POLLHUP meaningless here? pfd[0].revents = 0; pfd[1].fd = dsock; pfd[1].events = POLLIN; // will be set if accept is possible pfd[1].revents = 0; if (poll (pfd, 2, -1) == -1) { error ("error in poll()"); _exit (1); } if (pfd[0].revents) { error ("unexpected event at command socket"); _exit (1); } octave_parallel_network *network; struct __netwguard { octave_parallel_network *__n; __netwguard (octave_parallel_network *__an) : __n (__an) { __n->get_ref (); } ~__netwguard (void) { if (__n->release_ref () <= 0) delete __n; } } __ng (network = new octave_parallel_network (nhosts + 1)); for (uint32_t i = 0; i < me; i++) { // recv; dsprintf ("%i: trying to accept data connection, %i\n", server_no, i); int not_connected = 1; for (int j = 0; j < N_CONNECT_RETRIES; j++) { int32_t result; struct sockaddr_in rem_addr; socklen_t addrlen = sizeof (rem_addr); int adsock = accept (dsock, (sockaddr *) &rem_addr, &addrlen); if (adsock == -1) { perror ("accept, data stream"); _exit (1); } dsprintf ("server %i, host %i, retry %i, accept successful\n", server_no, i, j); if (addrlen > sizeof (rem_addr)) { perror ("accept, data stream, address buffer to short"); _exit (1); } struct __sockguard { __sockguard (int __isock) { __sock = __isock; } ~__sockguard (void) { if (__sock > -1) close (__sock); } void __release (void) { __sock = -1; } int __sock; } __sockg (adsock); #define HOSTNAMEBUFLEN 257 char peername[HOSTNAMEBUFLEN]; if (getnameinfo ((sockaddr *) &rem_addr, addrlen, (char *) peername, HOSTNAMEBUFLEN, NULL, 0, 0)) { error ("getnameinfo returned an error"); _exit (1); } octave_parallel_connection *conn = new octave_parallel_connection (peername, true, uuid.c_str ()); // you don't know the position to insert the // connection (protecting it) yet, an exception may // be thrown before you know it struct __connguard { __connguard (octave_parallel_connection *__ipt) { __pt = __ipt; } ~__connguard (void) { if (__pt) delete __pt; } void __set (octave_parallel_connection *__ipt) { __pt = __ipt; } octave_parallel_connection *__pt; void __release (void) { __pt = NULL; } } __conng (conn); #ifdef HAVE_LIBGNUTLS if (use_gnutls) { conn->insert_data_stream (new octave_parallel_stream (new octave_parallel_gnutls_streambuf (adsock, scred, true))); dsprintf ("server %i, host %i, retry %i, generated gnutls streambuf\n", server_no, i, j); } else #endif conn->insert_data_stream (new octave_parallel_stream (new octave_parallel_socket_streambuf (adsock))); __sockg.__release (); if (! conn->get_data_stream ()->good ()) { error ("could not create data stream to %s", peername); _exit (1); } std::string duuid; conn->get_data_stream ()->network_recv_string (duuid); dsprintf ("server %i, host %i, retry %i, received uuid (%s)\n", server_no, i, j, duuid.c_str ()); uint32_t host_n; conn->get_data_stream ()->network_recv_4byteint (host_n); dsprintf ("server %i, host %i, retry %i, received host_n (%i)\n", server_no, i, j, host_n); if (! conn->get_data_stream ()->good ()) { error ("communication error in initialization"); _exit (1); } if (uuid.compare (duuid)) { // a different call to 'connect', i.e. a different network conn->get_data_stream ()->network_send_4byteint (-1); if (conn->delete_data_stream ()) { error ("could not delete data stream"); _exit (1); } dsprintf ("server %i, host %i, retry %i, sent result -1\n", server_no, i, j); sleep (1); } else if (me <= host_n || network->is_connection (host_n)) { // we should never get here (since duuid == uuid) conn->get_data_stream ()->network_send_4byteint (-2); error ("server %i, host %i, retry %i, internal error, unexpected host id %i, is_connection(host id): %i", server_no, i, j, host_n, network->is_connection (host_n)); _exit (1); } else { conn->get_data_stream ()->network_send_4byteint (0); conn->connection_read_header (); write_header (conn->get_data_stream ()->get_ostream (), LS_BINARY); if (error_state || ! conn->get_data_stream ()->good ()) { error ("communication error in initialization"); _exit (1); } network->insert_connection (conn, host_n); __conng.__release (); not_connected = 0; dsprintf ("server %i, host %i, retry %i, good result sent, header read, header written and data stream good, breaking\n", server_no, i, j); break; } } if (not_connected) { error ("maximum number of connect retries exceeded"); _exit (-1); } } close (dsock); // a pseudo-connection, representing the own node in the network octave_parallel_connection *conn = new octave_parallel_connection (true, uuid.c_str ()); network->insert_connection (conn, me); dsprintf ("server %i inserted pseudoconnection at %i\n", server_no, me); // store number of available processor cores at the own // machine, although this is not necessary (but we have this // information here ...) conn->set_nproc (nproc); #ifdef HAVE_LIBGNUTLS if (use_gnutls && me < nhosts) { const char *username = static_cast(cmd_strb)-> server_get_username (); dsprintf ("server %i determined username %s from command stream, will now allocate client credentials (for data connections) with this username and password %s\n", server_no, username, __pwg.__get ()); __ccg.__set (ccred = new octave_parallel_gnutls_srp_client_credentials (username, __pwg.__get ())); } #endif for (uint32_t i = me + 1; i <= nhosts; i++) { // connect; dsprintf ("connect, server %i, host %i\n", server_no, i); struct addrinfo *ai = NULL, hints; memset ((void *) &hints, 0, sizeof (hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; hints.ai_flags = 0; if (getaddrinfo (hosts(i - 1).c_str (), "12501", &hints, &ai)) { error ("getaddrinfo returned an error"); return retval; } struct __aiguard { __aiguard (struct addrinfo *__iai) { __ai = __iai; } ~__aiguard (void) { if (__ai) freeaddrinfo (__ai); } struct addrinfo *__ai; } __aig (ai); int not_connected = 1; for (int j = 0; j < N_CONNECT_RETRIES; j++) { int dsock = socket (PF_INET, SOCK_STREAM, 0); if (dsock == -1) { perror ("socket"); _exit (1); } struct __sockguard { __sockguard (int __isock) { __sock = __isock; } ~__sockguard (void) { if (__sock > -1) close (__sock); } void __release (void) { __sock = -1; } int __sock; } __sockg (dsock); if (connect (dsock, ai->ai_addr, ai->ai_addrlen) == 0) { dsprintf ("connect, server %i, host %i, retry %i, connect succesful\n", server_no, i, j); octave_parallel_connection *conn = new octave_parallel_connection (hosts(i - 1).c_str (), true, uuid.c_str ()); network->insert_connection (conn, i); #ifdef HAVE_LIBGNUTLS if (use_gnutls) { conn->insert_data_stream (new octave_parallel_stream (new octave_parallel_gnutls_streambuf (dsock, ccred, false))); __ccg.__release (); dsprintf ("connect, server %i, host %i, retry %i, generated gnutls streambuf\n", server_no, i, j); } else #endif conn->insert_data_stream (new octave_parallel_stream (new octave_parallel_socket_streambuf (dsock))); __sockg.__release (); if (! conn->get_data_stream ()->good ()) { error ("could not create data stream to %s", hosts(i - 1).c_str ()); _exit (1); } conn->get_data_stream ()-> network_send_string (uuid.c_str ()); dsprintf ("connect, server %i, host %i, retry %i, uuid written (%s)\n", server_no, i, j, uuid.c_str ()); conn->get_data_stream ()->network_send_4byteint (me, true); dsprintf ("connect, server %i, host %i, retry %i, 'me' written (%i)\n", server_no, i, j, me); int32_t res; conn->get_data_stream ()->network_recv_4byteint (res); if (! conn->get_data_stream ()->good ()) { error ("communication error in initialization"); _exit (1); } if (res == -1) { if (conn->delete_data_stream ()) { error ("could not delete data stream"); _exit (1); } dsprintf ("connect, server %i, host %i, retry %i, sleeping after bad result\n", server_no, i, j); usleep (5000); } else if (res) { error ("unexpected error in remote server"); _exit (1); } else { write_header (conn->get_data_stream ()->get_ostream (), LS_BINARY); conn->connection_read_header (); if (error_state || ! conn->get_data_stream ()->good ()) { error ("communication error in initialization"); _exit (1); } not_connected = 0; dsprintf ("connect, server %i, host %i, retry %i, good result read, header written and read and datastream good, breaking\n", server_no, i, j); break; } } else if (errno != ECONNREFUSED && errno != EINTR) { perror ("connect"); break; } else usleep (5000); } if (not_connected) { error ("unable to connect to %s", hosts(i - 1).c_str ()); _exit (1); } } octave_parallel_connections *conns = new octave_parallel_connections (network, uuid.c_str (), true); octave_value sockets (conns); __pwg.__free (); interactive = false; // install 'sockets' as Octave variable symbol_table::assign ("sockets", sockets); dsprintf ("'sockets' installed\n"); int cd_ok = octave_env::chdir (directory.c_str ()); if (! cd_ok) { octave_env::chdir ("/tmp"); dsprintf ("performed chdir to /tmp\n"); } else dsprintf ("performed chdir to %s\n", directory.c_str ()); dsprintf ("calling function reval_loop\n"); reval_loop (cmd_str); // does not return } // parent waitpid (pid, NULL, 0); // child with pid has forked another child // FIXME: forgotten how this is organized in Octave, find it out // again and at least make a comment which better explains it. octave_child_list::insert (pid, pserver_child_event_handler); RESTORE_SIGNALS (oset); close (asock); } // This code is currently not reached since the server parent // process can only be killed by a signal. close (sock); clean_up_and_exit (1); } parallel-3.0.3/src/parallel-gnutls.h0000644000175000017500000000664612614416033016017 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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, see . */ #ifndef __OCT_PARALLEL_GNUTLS__ #define __OCT_PARALLEL_GNUTLS__ #include "config.h" #ifdef HAVE_LIBGNUTLS #include #endif #include #include #include #include #include #include #include #ifdef HAVE_MALLOC_H #include #elif HAVE_SYS_MALLOC_H #include #else #error "No malloc.h present." #endif /* not necessary with current Octave #include #include */ #include // next is from gnulib, getpass of unistd.h is deprecated /* Get getpass declaration, if available. */ // # if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS #ifndef HAVE_GETPASS /* Read a password of arbitrary length from /dev/tty or stdin. */ extern "C" { char *getpass (const char *prompt); } #endif // We link against the gnulib num_processors() used by Octave. nproc.h // used by Octave is not accessible. If the interface changes, this // will stop working. extern "C" { enum nproc_query { NPROC_ALL, /* total number of processors */ NPROC_CURRENT, /* processors available to the current process */ NPROC_CURRENT_OVERRIDABLE /* likewise, but overridable through the OMP_NUM_THREADS environment variable */ }; /* Return the total number of processors. The result is guaranteed to be at least 1. */ extern unsigned long int num_processors (enum nproc_query query); } // Octave includes #include #include #include #include #include #include #include #define N_CONNECT_RETRIES 10 /* define some of the following for debugging, but take care: sensitive data (e.g. the password) will be written to standard error and to logfiles */ #undef octave_parallel_debug_server // #define octave_parallel_debug_server 1 #undef octave_parallel_debug_client // #define octave_parallel_debug_client 1 #undef octave_parallel_debug_lib // #define octave_parallel_debug_lib 1 #ifdef octave_parallel_debug_server #define dsprintf(...) fprintf (stderr, __VA_ARGS__); fflush (stderr); #else #define dsprintf(...) #endif #ifdef octave_parallel_debug_client #define dcprintf(...) fprintf (stderr, __VA_ARGS__); #else #define dcprintf(...) #endif #ifdef octave_parallel_debug_lib #define dlprintf(...) fprintf (stderr, __VA_ARGS__); fflush (stderr); #else #define dlprintf(...) #endif // parallel package includes #ifdef HAVE_LIBGNUTLS #include "sensitive-data.h" #endif #include "p-streams.h" #include "p-connection.h" #include "p-sighandler.h" #ifdef HAVE_LIBGNUTLS void parallel_gnutls_set_mem_functions (void); #endif #endif // __OCT_PARALLEL_GNUTLS__ parallel-3.0.3/src/parallel_generate_srp_data.cc0000644000175000017500000002311212614416033020355 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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 "parallel-gnutls.h" static int assert_dir (std::string &path) { file_stat stat (path); if (! stat.is_dir () && mkdir (path.c_str (), 0700)) return -1; else return 0; } DEFUN_DLD (parallel_generate_srp_data, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} parallel_generate_srp_data (@var{username})\n\ @deftypefnx {Loadable Function} {} parallel_generate_srp_data (@var{username}, @var{options})\n\ Prompts for a password (press enter for a random password) and writes TLS-SRP authentication files into the directory given by:\n\ \n\ @code{fullfile (a = pkg (\"prefix\"), \"parallel-srp-data\")}\n\ \n\ Server files are placed in subdirectory @code{server}. By default, a\n\ client authentication file is placed in subdirectory\n\ @code{client}. The latter contains the given @var{username} and the\n\ cleartext password. You do not need this file if you prefer to be\n\ prompted for username and password at connection time. In this case,\n\ you can prevent the client authentication file from being written by\n\ passing as the argument @var{options} a structure with a value of\n\ @code{false} in the field @code{unattended}.\n\ \n\ For authentication, subdir @code{server}, and possibly subdir\n\ @code{client}, have to be placed together with their contents at the\n\ respective machines. They can either be placed under the directory\n\ given by:\n\ \n\ @code{fullfile (OCTAVE_HOME (), \"share\", \"octave\", \"parallel-srp-data\")}\n\ \n\ or -- which might be the same directory -- under:\n\ \n\ @code{fullfile (a = pkg (\"prefix\"), \"parallel-srp-data\")}\n\ \n\ Files in the former directory will take precedence over those in the\n\ latter. The contents of the files @code{passwd} and @code{user_passwd}\n\ (if present) must be kept secret.\n\ \n\ This function zeroizes sensitive data before releasing its memory. Due\n\ to usage of external libraries, however, it still can't be excluded\n\ that sensitive data is still on the swap device after application\n\ shutdown.\n\ \n\ @seealso{pconnect, pserver, reval, psend, precv, sclose, select_sockets}\n\ @end deftypefn") { std::string fname ("parallel_generate_srp_data"); octave_value_list retval; if (args.length () < 1 || args.length () > 2) { print_usage (); return retval; } // get username std::string username (args(0).string_value ()); if (error_state) { error ("%s: first argument can not be converted to a string", fname.c_str ()); return retval; } // default options bool clientfile (true); // get options, if any if (args.length () == 2) { octave_scalar_map options; options = args(1).scalar_map_value (); if (error_state) { error ("%s: could not convert second argument to scalar structure", fname.c_str ()); return retval; } octave_value tmp; // write client data to file tmp = options.contents ("unattended"); if (tmp.is_defined ()) { clientfile = tmp.bool_value (); if (error_state) { error ("%s: could not convert option 'unattended' to bool", fname.c_str ()); return retval; } } } // args.length () == 2 // define directories and filenames octave_value_list f_args (1); f_args(0) = octave_value ("prefix"); octave_value_list f_ret; f_ret = feval ("pkg", f_args, 1); if (error_state) { error ("%s: could not get prefix from pkg", fname.c_str ()); return retval; } std::string basedir = f_ret(0).string_value (); if (error_state) { error ("%s: could not convert output of pkg ('prefix') to string)", fname.c_str ()); return retval; } basedir = basedir + file_ops::dir_sep_str () + "parallel-srp-data" + file_ops::dir_sep_str (); std::string serverdir = basedir + "server" + file_ops::dir_sep_str (); std::string clientdir = basedir + "client" + file_ops::dir_sep_str (); if (assert_dir (basedir)) { error ("%s: directory %s does not exist and can't be created, consider creating it manually", fname.c_str (), basedir.c_str ()); return retval; } if (assert_dir (serverdir)) { error ("%s: directory %s does not exist and can't be created, consider creating it manually", fname.c_str (), serverdir.c_str ()); return retval; } if (clientfile && assert_dir (clientdir)) { error ("%s: directory %s does not exist and can't be created, consider creating it manually", fname.c_str (), clientdir.c_str ()); return retval; } std::string passwd = serverdir + "passwd"; std::string passwd_conf = serverdir + "passwd.conf"; std::string user_passwd = clientdir + "user_passwd"; // get password; not supposed to be free'd again, don't do it sensitive_string user_password (getpass ("password (default is random password): ")); if (! user_password.good ()) { error ("%s: could not read password", fname.c_str ()); return retval; } if (user_password.get_size () == 0) { // no use making a random password if it is not written to a file if (! clientfile) { error ("%s: if the password is not provided by the user, option 'unattended' must not be false", fname.c_str ()); return retval; } // get a random password of 10 bytes, each restricted to 128 values user_password.fill (10); if (! user_password.good ()) { error ("%s: could not get random password", fname.c_str ()); return retval; } } // get random salt of 10 bytes, each restricted to 128 values sensitive_string salt (10); if (! salt.good ()) { error ("%s: could not get random salt", fname.c_str ()); return retval; } // let gnutls compute the srp verifier verifier v (username.c_str (), user_password.get_string (), &salt.get_val ()); if (! v.good ()) { error ("%s: could not generate verifier", fname.c_str ()); return retval; } // if desired, write client authentication information if (clientfile) { octave_parallel_stream cfio (new octave_parallel_file_streambuf (user_passwd.c_str (), O_WRONLY | O_CREAT | O_TRUNC, 0600)); if (! cfio.good ()) { error ("%s: could not open client file %s", fname.c_str (), user_passwd.c_str ()); return retval; } cfio.get_ostream () << username.c_str () << " " << user_password.get_string () << "\n"; cfio.close (); if (! cfio.good ()) { error ("%s: could not write client file", fname.c_str ()); return retval; } } // password not needed anymore, zero and free it (but only zero it // and not free it if it was made with 'getpass' user_password.free_val (); // write server passwd file or append if it exists std::string group_index ("1"); if (true) { srp_base64_encode v_enc (&(v.get_val ())); srp_base64_encode salt_enc (&(salt.get_val ())); if (! (v_enc.good () && salt_enc.good ())) return retval; octave_parallel_stream spfio (new octave_parallel_file_streambuf (passwd.c_str (), O_WRONLY | O_CREAT | O_APPEND, 0600)); if (! spfio.good ()) { error ("%s: could not open server passwd file %s", fname.c_str (), passwd.c_str ()); return retval; } spfio.get_ostream () << username.c_str () << ":" << v_enc.get_string () << ":" << salt_enc.get_string () << ":" << group_index.c_str () << "\n"; spfio.close (); if (! spfio.good ()) { error ("%s: could not write server passwd file", fname.c_str ()); return retval; } } // verifier and salt not needed anymore, zero and free them v.free_val (); salt.free_val (); // write server passwd.conf file srp_base64_encode prime_enc (&gnutls_srp_2048_group_prime); octave_parallel_stream scfio (new octave_parallel_file_streambuf (passwd_conf.c_str (), O_WRONLY | O_CREAT | O_TRUNC, 0600)); if (! scfio.good ()) { error ("%s: could not open server passwd.conf file %s", fname.c_str (), passwd_conf.c_str ()); return retval; } scfio.get_ostream () << group_index.c_str () << ":" << prime_enc.get_string () << ":" << (int) *((unsigned char *) gnutls_srp_2048_group_generator.data) << "\n"; scfio.close (); if (! scfio.good ()) { error ("%s: could not write server passwd.conf file", fname.c_str ()); return retval; } return retval; } parallel-3.0.3/src/__exit__.cc0000644000175000017500000000234212614416033014601 0ustar olafolaf// Copyright (C) 2008 Olaf Till // // 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 DEFUN_DLD (__exit__, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} __exit__ (status)\n\ This is a wrapper over the POSIX _exit() system call. Calling this function\n\ will terminate the running process immediatelly, bypassing normal Octave\n\ terminating sequence. It is suitable to terminate a forked process. It\n\ should be considered expert-only and not to be used in normal code.\n\ @end deftypefn") { _exit (args.length () > 0 ? args(0).int_value () : 0); } parallel-3.0.3/src/Makefile.in0000644000175000017500000000455612614416033014603 0ustar olafolafDEBUG := no MKOCTFILE ?= @MKOCTFILE@ PKG_CONFIG ?= @PKG_CONFIG@ CC ?= @CC@ CXX ?= @CXX@ CFLAGS ?= -g -O2 ifeq ($(DEBUG), yes) CXXFLAGS ?= -g -O0 CLUSTER_CXXFLAGS = $(CXXFLAGS) else CXXFLAGS ?= -g -O2 # no reason anymore to be different, but leave them extra just in case CLUSTER_CXXFLAGS = $(CXXFLAGS) endif HAVE_GNUTLS := @HAVE_GNUTLS@ HAVE_GNUTLS_EXTRA := @HAVE_GNUTLS_EXTRA@ HAVE_GETPASS := @HAVE_GETPASS@ octs = $(cluster_oct) $(generate_srp_data_oct) $(local_octs) # All compiled user functions for parallel cluster must be in one # file, otherwise registration of new octave_base_value derived type # is not seen by the other functions. cluster_oct := parallel_interface.oct local_octs := fload.oct fsave.oct __exit__.oct select.oct __visglobal__.oct cluster_objs = $(cluster_oobjs) $(cluster_lobjs) cluster_oobjs := pconnect.o pserver.o sclose.o \ reval.o precv.o psend.o select_sockets.o \ network_get_info.o network_set.o cluster_lobjs := p-connection.o p-streams.o ifeq ($(HAVE_GNUTLS), yes) generate_srp_data_oct := parallel_generate_srp_data.oct cluster_oobjs := $(cluster_oobjs) parallel_generate_srp_data.o cluster_lobjs := $(cluster_lobjs) gnutls-callbacks.o sensitive-data.o ifneq ($(HAVE_GETPASS), yes) getpass_obj := getpass.o endif ifeq ($(HAVE_GNUTLS_EXTRA), yes) GNUTLS_CFLAGS := $(shell $(PKG_CONFIG) --cflags gnutls-extra) -Wno-int-to-pointer-cast GNUTLS_LIBS := $(shell $(PKG_CONFIG) --libs gnutls-extra) else GNUTLS_CFLAGS := $(shell $(PKG_CONFIG) --cflags gnutls) -Wno-int-to-pointer-cast GNUTLS_LIBS := $(shell $(PKG_CONFIG) --libs gnutls) endif endif all: $(octs) getpass.o: getpass.c $(CC) -c getpass.c $(CFLAGS) -fPIC $(cluster_objs): parallel-gnutls.h p-connection.h p-streams.h sensitive-data.h \ p-sighandler.h $(cluster_objs): %.o: %.cc config.h CXX=$(CXX) CXXFLAGS="$(CLUSTER_CXXFLAGS) $(GNUTLS_CFLAGS)" $(MKOCTFILE) -c $< %.o: %.cc config.h CXX=$(CXX) CXXFLAGS="$(CXXFLAGS)" $(MKOCTFILE) -c $< $(generate_srp_data_oct): %.oct: %.o $(cluster_lobjs) $(getpass_obj) CXX=$(CXX) $(MKOCTFILE) $< $(cluster_lobjs) $(getpass_obj) $(GNUTLS_LIBS) $(cluster_oct): $(cluster_objs) $(getpass_obj) CXX=$(CXX) $(MKOCTFILE) -o $(cluster_oct) $(cluster_objs) $(getpass_obj) $(GNUTLS_LIBS) %.oct: %.o CXX=$(CXX) $(MKOCTFILE) $< .PHONY: clean clean: ; rm -f *.o *.oct parallel-3.0.3/src/sensitive-data.cc0000644000175000017500000000400312614416033015750 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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 "parallel-gnutls.h" void sensitive_string::fill (int n, bool lock) { valid = false; if (internally_allocated || locked_length) { error ("internal error in filling"); return; } val.data = new unsigned char[n + 1]; if (val.data) { internally_allocated = true; val.size = n; if (lock) { if (mlock (val.data, n)) { error ("could not lock memory pages"); return; } else locked_length = n; } } else { val.size = 0; error ("could not allocate memory"); return; } int rfd; if ((rfd = open ("/dev/random", O_RDONLY)) == -1) { error ("could not open /dev/random"); return; } // reduces each random byte to the 128 characters from 0x20 to 0x9F, // in order to disallow value 0x0 (end of string) without unevenly // redistributing the probability of the allowed values for (int i = 0; i < n; i++) { if (read (rfd, &(val.data[i]), 1) != 1) { error ("could not read from /dev/random"); break; } val.data[i] = (unsigned char) (((unsigned int) (val.data[i]>>1)) + 0x20); } val.data[n] = '\0'; if (close (rfd)) error ("could not close /dev/random"); if (! error_state) valid = true; } parallel-3.0.3/src/p-connection.h0000644000175000017500000003746712614416033015312 0ustar olafolaf/* Copyright (C) 2015 Olaf Till 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 __OCT_PARALLEL_CONNECTION__ #define __OCT_PARALLEL_CONNECTION__ #include #include #include "oct-refcount.h" #include "p-streams.h" // at 'p' 37 bytes must be available; returns 0 on success and -1 on failure int oct_parallel_store_unique_identifier (char *p); #define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_PCONNECTION \ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1; \ if(cmd_stream) cmd_stream->get_strbuf()->set_connection_state_undefined(); \ if(data_stream) data_stream->get_strbuf()->set_connection_state_undefined(); \ octave_rethrow_exception (); \ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2 class octave_parallel_connection { public: octave_parallel_connection (const char *arg_peer_name, bool i_am_server, const char *auuid) : cmd_stream (NULL), data_stream (NULL), peer_name (arg_peer_name), server (i_am_server), connection_open (false), uuid (auuid), pseudo_connection (false), peer_node_n (-1), nproc (0), nlocaljobs (0) { } octave_parallel_connection (bool i_am_server, const char *auuid) : cmd_stream (NULL), data_stream (NULL), peer_name (""), server (i_am_server), connection_open (false), uuid (auuid), pseudo_connection (true), peer_node_n (-1), nproc (0), nlocaljobs (0) { } octave_parallel_connection *insert_cmd_stream (octave_parallel_stream *s) { cmd_stream = s; connection_open = true; return this; } octave_parallel_connection *insert_data_stream (octave_parallel_stream *s) { data_stream = s; connection_open = true; return this; } void set_nproc (uint32_t anproc) { nproc = anproc; } void set_nlocaljobs (uint32_t anlocaljobs) { nlocaljobs = anlocaljobs; } uint32_t get_nproc (void) { return nproc; } uint32_t get_nlocaljobs (void) { return nlocaljobs; } octave_parallel_stream *get_cmd_stream (void) const { return cmd_stream; } octave_parallel_stream *get_data_stream (void) const { return data_stream; } int poll_for_errors (void) { if (! cmd_stream) { error ("can't poll since no command stream present"); return -1; } if (! cmd_stream->get_strbuf ()-> good ()) { error ("can't poll since command stream not good"); return -1; } int ret = 0; uint32_t err; while (cmd_stream->get_strbuf ()->in_avail () > 0) { err = cmd_stream->network_recv_4byteint (err); if (! cmd_stream->good ()) { error ("error in reading error code"); return -1; } error ("An error with code %u occured in server %s.\nSee %s:/tmp/octave_error-_%s.log for details.", err, peer_name.c_str (), peer_name.c_str (), uuid.c_str ()); ret = 1; } return ret; } int wait_for_errors_or_data (void); const std::string &get_peer_name (void) { return peer_name; } ~octave_parallel_connection (void) { dlprintf ("pconnection destructor called\n"); if (connection_open) close (); if (cmd_stream) { dlprintf ("pconnection destructor will delete cmd_stream\n"); delete cmd_stream; } if (data_stream) { dlprintf ("pconnection destructor will delete data_stream\n"); delete data_stream; } } int delete_data_stream (void) { if (data_stream) { data_stream->close (); if (! data_stream->good ()) { error ("could not close data stream"); return -1; } delete data_stream; data_stream = NULL; } return 0; } int close (void) { int ret = 0; if (connection_open) { if (cmd_stream) { if (! server) { bool send_close_cmd = true; if (cmd_stream->get_strbuf ()->connection_state_undefined ()) { if (fcntl (cmd_stream->get_strbuf ()->get_fid (), F_SETFL, O_NONBLOCK)) { error ("tried to switch to non-blocking mode due to undefined connection state, but it did not work; not sending close command"); send_close_cmd = false; } } poll_for_errors (); if (send_close_cmd) cmd_stream->network_send_string ("sclose (sockets); __exit__;\n"); } cmd_stream->close (); if (! cmd_stream->good ()) { error ("could not close command stream"); ret = -1; } } if (data_stream) { data_stream->close (); if (! data_stream->good ()) { error ("could not close data stream"); ret = -1; } } connection_open = false; return ret; } else if (! pseudo_connection) { error ("connection is not open"); return -1; } else return ret; } bool is_pseudo_connection (void) { return pseudo_connection; } bool is_server (void) { return server; } int32_t peer_node_n; // -1 is unset, 0 is client int connection_read_header (void) { return read_binary_file_header (data_stream->get_istream (), swap, flt_fmt, false); } std::string connection_read_data (octave_value &tc) { // FIXME: some code duplication would probably be better than // calling this convenience function return read_binary_data (data_stream->get_istream (), swap, flt_fmt, "", global, tc, doc); } bool is_open (void) { return connection_open; } const std::string &get_uuid (void) { return uuid; } private: octave_parallel_stream *cmd_stream; octave_parallel_stream *data_stream; bool connection_open; bool pseudo_connection; // for indicating own node in network std::string peer_name; // number of usable processor cores in peer, or in own machine if // this is a pseudoconnection; num_processors() returns an unsigned // long int, but there is no specific transefer function implemented // here for long int, and such large numbers probably don't occur // for nproc; supposed to be available (i.e. non-zero) for all // connections in the clients network variable; not necessary in the // servers network variables uint32_t nproc; // configurable, this information can be used by the client to // decide how many local processes should be spawned at the server; // not necessary in the servers network variables uint32_t nlocaljobs; bool server; std::string uuid; // for Octaves save and load functions bool global; bool swap; oct_mach_info::float_format flt_fmt; std::string doc; }; class octave_parallel_network { public: typedef Array connarray; octave_parallel_network (void) : refcount (0), closed (false) { } octave_parallel_network (int n) : refcount (0), closed (false), connections (dim_vector (n, 1), NULL) { } void resize (int n) { connections.resize1 (n, NULL); } void add_connection (octave_parallel_connection *connection) { connections.resize1 (connections.numel () + 1, connection); } void insert_connection (octave_parallel_connection *connection, int idx) { connections(idx) = connection; connection->peer_node_n = idx; } bool is_connection (int idx) { return (bool) connections(idx); } int close (void) { if (closed) { error ("network already closed"); return -1; } else { int ret = 0; for (int i = 0; i < connections.numel (); i++) if (connections(i) && connections(i)->close ()) ret = -1; if (ret) error ("could not close network"); else closed = true; return ret; } } ~octave_parallel_network (void) { dlprintf ("pnetwork destructor called ...\n"); for (int i = 0; i < connections.numel (); i++) { dlprintf ("... checks that connections(%i) is not NULL ...\n", i); if (connections(i)) { dlprintf ("... and deletes it.\n"); delete connections(i); } } } const connarray &get_ref (void) { refcount++; return connections; } int release_ref (void) { return --refcount; } bool is_closed (void) { return closed; } private: connarray connections; octave_refcount refcount; bool closed; }; // This additional class is declared to circumvent const-ness of // octave_value::get_rep() without a . It contains the // members specific for the package, while the containing class // octave_parallel_connections contains the stuff related to // octave_base_value. class octave_parallel_connections_rep { friend class octave_parallel_connections; public: octave_parallel_connections_rep (octave_parallel_network *net, const char *auuid, bool i_am_server) : network (net), uuid (auuid), server (i_am_server), connections (net->get_ref ()), indexed (false) { subnet = connections; } // for indexing octave_parallel_connections_rep (octave_parallel_network *net, const char *auuid, bool i_am_server, octave_parallel_network::connarray &asubnet) : network (net), uuid (auuid), server (i_am_server), connections (net->get_ref ()), indexed (true) { subnet = asubnet; } ~octave_parallel_connections_rep (void) { dlprintf ("pconnections_rep destructor called, will request decr of network refcount and will check if it's <= 0 ...\n"); int tpdebug; if ((tpdebug = network->release_ref ()) <= 0) { dlprintf ("... since it is %i, will delete network\n", tpdebug); delete network; } } int close (void) { return network->close (); } // function to return the _whole_ net (even if this is a subnet), to // make it possible to construct a new octave_value with this octave_parallel_network *get_whole_network (void) { return network; } // oct-functions work with this const octave_parallel_network::connarray &get_connections (void) { return subnet; } bool is_server (void) { return server; } const octave_parallel_network::connarray &get_all_connections (void) { return connections; } private: octave_parallel_network *network; const octave_parallel_network::connarray &connections; octave_parallel_network::connarray subnet; std::string uuid; bool server; bool indexed; }; class octave_parallel_connections : public octave_base_value { public: void octave_parallel_register_type (void) { static bool type_registered = false; if (! type_registered) { register_type (); type_registered = true; } } octave_parallel_connections (octave_parallel_network *net, const char *auuid, bool i_am_server) : rep (new octave_parallel_connections_rep (net, auuid, i_am_server)) { octave_parallel_register_type (); } // for indexing octave_parallel_connections (octave_parallel_network *net, const char *auuid, bool i_am_server, octave_parallel_network::connarray &asubnet) : rep (new octave_parallel_connections_rep (net, auuid, i_am_server, asubnet)) { octave_parallel_register_type (); } ~octave_parallel_connections (void) { dlprintf ("pconnections destructor called, deletes pconnections_rep\n"); delete rep; } // Octave internal stuff octave_value do_index_op (const octave_value_list& idx, bool resize_ok = false); octave_value_list do_multi_index_op (int, const octave_value_list& idx) { return do_index_op (idx); } // copied from ov-base-mat octave_value subsref (const std::string& type, const std::list& idx) { octave_value retval; switch (type[0]) { case '(': retval = do_index_op (idx.front ()); break; case '{': case '.': { std::string nm = type_name (); error ("%s cannot be indexed with %c", nm.c_str (), type[0]); } break; default: panic_impossible (); } return retval.next_subsref (type, idx); } octave_value_list subsref (const std::string& type, const std::list& idx, int) { return subsref (type, idx); } bool is_constant (void) const { return true; } bool is_defined (void) const { return true; } bool is_true (void) const { return ! rep->network->is_closed (); } dim_vector dims (void) const { return rep->subnet.dims (); } void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const { octave_idx_type n = rep->connections.numel (); octave_idx_type sn = rep->subnet.numel (); indent (os); os << " "; if (sn < n) os << "subnet with " << sn << " of "; os << n << " nodes"; newline (os); os << "network id: " << rep->uuid.c_str (); newline (os); if (rep->network->is_closed ()) os << "----- closed -----"; else os << "----- open -----"; newline (os); for (octave_idx_type i = 0; i < sn; i++) { os << rep->subnet(i)->peer_node_n << ") "; // if (rep->subnet(i)->is_server ()) // os << "[server] "; // else // os << "[client] "; if (rep->subnet(i)->is_pseudo_connection ()) os << ""; else os << rep->subnet(i)->get_peer_name ().c_str (); newline (os); } } void print (std::ostream& os, bool pr_as_read_syntax = false) const { print_raw (os); } // Octave changeset bcd71a2531d3 (Jan 31st 2014) made // octave_base_value::print() non-const, after that this virtual // function is not re-defined by the above print() function. Having // both const and non-const print() here seems to work both with // Octave < and >= bcd71a2531d3 (print() is only called over the // parent class virtual function). void print (std::ostream& os, bool pr_as_read_syntax = false) { print_raw (os); } bool print_as_scalar (void) const { return true; } octave_parallel_connections_rep *get_rep (void) const { return rep; } private: // needed by Octave for register_type(), also used here in indexing octave_parallel_connections (void) : rep (new octave_parallel_connections_rep (new octave_parallel_network (), "", false)) { dlprintf ("pconnections default ctor called\n"); } octave_parallel_connections_rep *rep; DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; #endif // __OCT_PARALLEL_CONNECTION__ /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ parallel-3.0.3/inst/0002755000175000017500000000000012614416033012714 5ustar olafolafparallel-3.0.3/inst/__bw_prcv__.m0000644000175000017500000000044712614416033015333 0ustar olafolaf## This code is in the public domain. ## -*- texinfo -*- ## @deftypefn {Function File} {ret =} __bw_prcv__ (@var{fd}) ## Wrapper for fload for backwards compatibility (optim package). ## @end deftypefn function ret = __bw_prcv__ (varargin) ret.psend_var = fload (varargin{:}); endfunction parallel-3.0.3/inst/__bw_psend__.m0000644000175000017500000000043112614416033015463 0ustar olafolaf## This code is in the public domain. ## -*- texinfo -*- ## @deftypefn {Function File} {} __bw_psend__ (@var{fd}, @var{var}) ## Wrapper for fload for backwards compatibility (optim package). ## @end deftypefn function __bw_psend__ (varargin) fsave (varargin{:}); endfunction parallel-3.0.3/inst/server.m0000644000175000017500000000161412614416033014400 0ustar olafolaf## Copyright (C) 2002 by Hayato Fujiwara ## ## 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 . ## This script is here for backwards compatibility and is deprecated. It ## just calls 'pserver', which should be called directly instead. See ## documentation of 'pserver'. pserver parallel-3.0.3/inst/netarrayfun.m0000644000175000017500000000341212614416033015426 0ustar olafolaf## Copyright (C) 2015 Olaf Till ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} netarrayfun (@var{connections}, @var{fun}, @dots{}) ## Evaluates function @var{fun} in a parallel cluster and collects results. ## ## This function handles arguments and options equivalently to ## @code{pararrayfun} and returnes equivalent output. Differently, the ## first argument specifies server machines for parallel remote ## execution, see @code{pconnect} for a description of the ## @var{connections} variable. A further difference is that the option ## "ChunksPerProc" is ignored and instead the chunk size can be ## specified directly with an option "ChunkSize" (option "Vectorized" ## can be used together with option "ChunkSize" in function ## @code{netarrayfun}). ## ## The further details of operation are the same as for ## @code{netcellfun}, please see there. ## ## @seealso{netcellfun, pconnect, pserver, sclose, rfeval, install_vars} ## @end deftypefn function varargout = netarrayfun (varargin) if (nargin () < 3) print_usage (); endif [varargout{1 : nargout ()}] = netcellfun_worker (true, varargin{:}); endfunction parallel-3.0.3/inst/rfeval.m0000644000175000017500000001335312614416033014354 0ustar olafolaf## Copyright (C) 2015 Olaf Till ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} rfeval (@var{func}, @dots{}, @var{nout}, @var{isout}, @var{connection}) ## Evaluate a function at a remote machine. ## ## @var{func} is evaluated with arguments @code{@dots{}} and number of ## output arguments set to @var{nout} at remote machine given by ## @var{connection}. If @var{isout} is not empty, it must be a logical ## array with @var{nout} elements, which are true for each of the ## @var{nout} output arguments which are requested from the function; ## the other output arguments will be marked as not requested ## with @code{~} at remote execution. ## ## This function can only be successfully called at the client machine. ## See @code{pconnect} for a description of the @var{connection} ## variable. @var{connection} must contain one single connection. ## ## If an output argument is given to @code{rfeval}, the function waits ## for completion of the remote function call, retrieves the results and ## returns them. They will be returned as one cell-array with an entry ## for each output argument. If some output arguments are marked as not ## requested by setting some elements of @var{isout} to false, the ## returned cell-array will only have entries for the requested output ## arguments. For consistency, the returned cell-array can be empty. To ## assign the output arguments to single variables, you can for example ## use: @code{[a, b, c] = returned_cell_array@{:@};}. ## ## If no output argument is given to @code{rfeval}, the function does ## not retrieve the results of the remote function call but returns ## immediately. It is left to the user to retrieve the results with ## @code{precv}. The results will be in the same format as if returned ## by @code{rfeval}. Note that a cell-array, possibly empty, will always ## have to be retrieved, even if the remote function call should have ## been performed without output arguments. ## ## Parallel execution can be achieved by calling @code{rfeval} several ## times with different specified server machines before starting to ## retrieve the results. ## ## The specified function handle can refer to a function present at the ## executing machine or be an anonymous function. In the latter case, ## the function specification sent to the server includes the anonymous ## functions context (generation of the sent function specification is ## implemented in the Octave core). Sending a handle to a subfunction, ## however, will currently not work. Sending a handle to a private ## function will only work if its file path is the same at the server. ## Sending an anonymous function using "varargin" in the argument list ## will currently not work. ## ## @seealso{pconnect, pserver, sclose, install_vars, netcellfun} ## @end deftypefn function ret = rfeval (varargin) if ((nargs = nargin ()) < 4) print_usage (); endif fname = "rfeval"; if (! isa (conn = varargin{end}, "pconnections")) error ("%s: `connection' must be a parallel connections object", fname); elseif (numel (conn) != 1) error ("%s: exactly one connection must be specified", fname); elseif (network_get_info (conn).local_machine) error ("%s: client was specified instead of server"); ## reval() checks if specified at server side endif if (! is_function_handle (varargin{1})) error ("%s: `func' must be a function handle", fname); endif if (! isnumeric (nout = varargin{end - 2}) || ! isscalar (nout) || ... (nout = round (nout)) < 0) error ("%s: `nout' must be a non-negative integer", fname); endif if (isempty (isout = varargin{end - 1})) isout = true (1, nout); elseif (! islogical (isout) || numel (isout) != nout) error ("%s: `isout' must be empty or a logical with `nout' elements", fname); endif isout = isout(:); ## feval() isn't called remotely since it doesn't resepect ignoring of ## output variables with '~'. So the function handle has to be sent ## separately and a remote temporary variable has to be used for it. ## ## rargs = varargin(1 : end - 3); # could be used with feval func = varargin{1}; rargs = varargin(2 : end - 3); if (any (ign = ! isout)) rout = repmat ({"__pserver_tout__{%i},"}, nout, 1); rout(ign) = {"~,"}; rout = cstrcat (rout{:}); rout = sprintf (rout, 1 : sum (isout)); rout = rout(1 : end - 1); # remove final ',' rout = sprintf ("[%s]", rout); if (all (ign)) init_rout = "__pserver_tout__ = {}; "; else init_rout = ""; endif else rout = sprintf ("[__pserver_tout__{1:%i}]", nout); init_rout = ""; endif cmd = sprintf ... ("__pserver_tfunc__ = precv (sockets(1)); %s%s = __pserver_tfunc__ (precv (sockets(1)){:}); psend (__pserver_tout__, sockets(1)); clear ('__pserver_tout__');", init_rout, rout); reval (cmd, conn); ready = false; unwind_protect psend (func, conn); psend (rargs, conn); ready = true; unwind_protect_cleanup if (! ready) sclose (conns); # might already be closed from within reval or psend endif end_unwind_protect if (nargout () > 0) ret = precv (conn); endif endfunction parallel-3.0.3/inst/scloseall.m0000644000175000017500000000226212614416033015053 0ustar olafolaf## Copyright (C) 2002 by Hayato Fujiwara ## ## 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 . ## -*- texinfo -*- ## @deftypefn {Function File} {} scloseall (@var{connections}) ## Deprecated function, calls @code{sclose (connections)}, which should ## be called directly. ## ## @seealso {sclose} ## @end deftypefn function scloseall (connections) persistent warned = false; if (! warned) warned = true; warning ("Octave:deprecated-function", "scloseall is deprecated, please use sclose directly."); endif sclose (connections); endfunction parallel-3.0.3/inst/netcellfun.m0000644000175000017500000000606412614416033015235 0ustar olafolaf## Copyright (C) 2015 Olaf Till ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} netcellfun (@var{connections}, @var{fun}, @dots{}) ## Evaluates function @var{fun} in a parallel cluster and collects results. ## ## This function handles arguments and options equivalently to ## @code{parcellfun} and returnes equivalent output. Differently, the ## first argument specifies server machines for parallel remote ## execution, see @code{pconnect} for a description of the ## @var{connections} variable. A further difference is that the option ## "ChunksPerProc" is ignored and instead the chunk size can be ## specified directly with an option "ChunkSize". ## ## This function can only be successfully called at the client machine ## of the parallel cluster. @var{connections} can contain all ## connections of the network, a subset of them, or a single connection. ## The local machine (client), if contained in @var{connections}, is ## ignored. However, one of the servers can run at the local machine ## under certain conditions (see @code{pconnect}) and will not be ## ignored in this case, so that the local machine can take part in ## parallel execution with @code{netcellfun}. ## ## As a second level of parallelism, @var{fun} is executed at each ## server machine (using @code{parcellfun or pararrayfun}) by default in ## as many local processes in parallel as the server has processor cores ## available. The number of local parallel processes can be configured ## for each server with the "nlocaljobs" option (see ## @code{network_set}), a value of @code{0} means that the default value ## will be used, a value of @code{1} means that execution is not ## parallel within the server (but still parallel over the cluster). ## ## There are certain limitations on how @var{fun} can be defined. These ## are explained in the documentation of @code{rfeval}. ## ## A speedup is likely if the computation time of @var{fun} is long. To ## speed up execution of a large set of arguments with short computation ## times of @var{fun}, increase "ChunkSize", possibly use "Vectorize" ## (see @code{pararrayfun}), and possibly experiment with increasing ## "nlocaljobs" from the default. ## ## @seealso{netarrayfun, pconnect, pserver, sclose, rfeval, install_vars} ## @end deftypefn function varargout = netcellfun (varargin) if (nargin () < 3) print_usage (); endif [varargout{1 : nargout ()}] = netcellfun_worker (false, varargin{:}); endfunction parallel-3.0.3/inst/__internal_exit__.m0000644000175000017500000000042212614416033016527 0ustar olafolaf## This code is in the public domain. ## -*- texinfo -*- ## @deftypefn {Function File} {} __internal_exit__ (@var{status}) ## Wrapper for __exit__ for backwards compatibility. ## @end deftypefn function __internal_exit__ (varargin) __exit__ (varargin{:}); endfunction parallel-3.0.3/inst/pararrayfun.m0000644000175000017500000000755412614416033015435 0ustar olafolaf## Copyright (C) 2009 Jaroslav Hajek ## Copyright (C) 2009 VZLU Prague, a.s., Czech Republic ## Copyright (C) 2009 Travis Collier ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {[@var{o1}, @var{o2}, @dots{}] =} pararrayfun (@var{nproc}, @var{fun}, @var{a1}, @var{a2}, @dots{}) ## @deftypefnx{Function File} {} pararrayfun (nproc, fun, @dots{}, "UniformOutput", @var{val}) ## @deftypefnx{Function File} {} pararrayfun (nproc, fun, @dots{}, "ErrorHandler", @var{errfunc}) ## Evaluates a function for corresponding elements of an array. ## Argument and options handling is analogical to @code{parcellfun}, except that ## arguments are arrays rather than cells. If cells occur as arguments, they are treated ## as arrays of singleton cells. ## Arrayfun supports one extra option compared to parcellfun: "Vectorized". ## This option must be given together with "ChunksPerProc" and it indicates ## that @var{fun} is able to operate on vectors rather than just scalars, and returns ## a vector. The same must be true for @var{errfunc}, if given. ## In this case, the array is split into chunks which are then directly served to @var{func} ## for evaluation, and the results are concatenated to output arrays. ## If "CumFunc" is also specified (see @code{parcellfun}), @var{fun} is ## expected to return the result of the same cumulative operation ## instead of vectors. ## @seealso{parcellfun, arrayfun} ## @end deftypefn function varargout = pararrayfun (nproc, func, varargin) if (nargin < 3) print_usage (); endif [nargs, uniform_output, error_handler, verbose_level, ... chunks_per_proc, cumfunc, vectorized] = parcellfun_opts ... ("pararrayfun", varargin); args = varargin(1:nargs); opts = varargin(nargs+1:end); if (nargs == 0) print_usage (); elseif (nargs > 1) [err, args{:}] = common_size (args{:}); if (err) error ("pararrayfun: arguments size must match"); endif endif njobs = numel (args{1}); if (vectorized && chunks_per_proc > 0 && ... chunks_per_proc < njobs / nproc) ## If "Vectorized" is on, we apply the function directly on chunks of ## arrays. if (! uniform_output && isempty (cumfunc)) func = @ (varargin) num2cell (func (varargin{:})); endif [varargout{1:nargout}] = chunk_parcellfun (nproc, chunks_per_proc, func, error_handler, verbose_level, cumfunc, uniform_output, args{:}); else args = cellfun (@num2cell, args, "UniformOutput", false, "ErrorHandler", @arg_class_error); if (chunks_per_proc == 0) chunks_per_proc = []; endif [varargout{1:nargout}] = parcellfun (nproc, func, args{:}, "UniformOutput", uniform_output, "ErrorHandler", error_handler, "VerboseLevel", verbose_level, "ChunksPerProc", chunks_per_proc, "CumFunc", cumfunc); endif endfunction function arg_class_error (S, X) error ("arrayfun: invalid argument of class %s", class (X)) endfunction parallel-3.0.3/inst/parcellfun.m0000644000175000017500000003572112614416033015233 0ustar olafolaf## Copyright (C) 2009 VZLU Prague, a.s., Czech Republic ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {[@var{o1}, @var{o2}, @dots{}] =} parcellfun (@var{nproc}, @var{fun}, @var{a1}, @var{a2}, @dots{}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "UniformOutput", @var{val}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "ErrorHandler", @var{errfunc}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "VerboseLevel", @var{val}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "ChunksPerProc", @var{val}) ## @deftypefnx{Function File} {} parcellfun (nproc, fun, @dots{}, "CumFunc", @var{cumfunc}) ## Evaluates a function for multiple argument sets using multiple processes. ## @var{nproc} should specify the number of processes. A maximum recommended value is ## equal to number of CPUs on your machine or one less. ## @var{fun} is a function handle pointing to the requested evaluating function. ## @var{a1}, @var{a2} etc. should be cell arrays of equal size. ## @var{o1}, @var{o2} etc. will be set to corresponding output arguments. ## ## The UniformOutput and ErrorHandler options are supported with meaning identical ## to @dfn{cellfun}. ## A VerboseLevel option controlling the level output is supported. ## A value of 0 is quiet, 1 is normal, and 2 or more enables ## debugging output. ## The ChunksPerProc option control the number of chunks which contains elementary jobs. This ## option particularly useful when time execution of function is small. Setting this option ## to 100 is a good choice in most cases. ## ## Instead of returning a result for each argument, parcellfun returns ## only one cumulative result if "CumFunc" is non-empty. @var{cumfunc} ## must be a function which performs an operation on two sets of outputs ## of @var{fun} and returnes as many outputs as @var{fun}. If @var{nout} ## is the number of outputs of @var{fun}, @var{cumfunc} gets a previous ## output set of @var{fun} or of @var{cumfunc} as first @var{nout} ## arguments and the current output of @var{fun} as last @var{nout} ## arguments. The performed operation must be commutative and ## associative. If the operation is e.g. addition, the result will be ## the sum(s) of the outputs of @var{fun} over all calls of @var{fun}. ## ## Notice that jobs are served from a single first-come first-served queue, ## so the number of jobs executed by each process is generally unpredictable. ## This means, for example, that when using this function to perform Monte-Carlo ## simulations one cannot expect results to be exactly reproducible. The pseudo ## random number generators of each process are initialised with a unique state. ## This currently works only for new style generators. ## ## NOTE: this function is implemented using "fork" and a number of pipes for IPC. ## Suitable for systems with an efficient "fork" implementation (such as GNU/Linux), ## on other systems (Windows) it should be used with caution. ## Also, if you use a multithreaded BLAS, it may be wise to turn off multi-threading ## when using this function. ## ## CAUTION: This function should be regarded as experimental. Although all subprocesses ## should be cleared in theory, there is always a danger of a subprocess hanging up, ## especially if unhandled errors occur. Under GNU and compatible systems, the following ## shell command may be used to display orphaned Octave processes: ## ps --ppid 1 | grep octave ## ## @end deftypefn ## Author: Jaroslav Hajek ## Several improvements thanks to: Travis Collier ## CumFunc feature added by Olaf Till function varargout = parcellfun (nproc, fun, varargin) ## The list of functions to be seeded in each slave. persistent random_func_list = {@rand, @randn, @rande, @randp, @randg}; if (nargin < 3 || ! isscalar (nproc) || nproc <= 0) print_usage (); endif if (ischar (fun)) fun = str2func (fun); elseif (! isa (fun, "function_handle")) error ("parcellfun: fun must be either a function handle or name") endif [nargs, uniform_output, error_handler, verbose_level, ... chunks_per_proc, cumfunc] = parcellfun_opts ("parcellfun", varargin); accumulate = ifelse (isempty (cumfunc), false, true); args = varargin(1:nargs); if (! all (cellfun ("isclass", args, "cell"))) error ("parcellfun: all non-option arguments except the first one must be cell arrays"); endif if (nargs == 0) print_usage (); elseif (nargs > 1) [err, args{:}] = common_size (args{:}); if (err) error ("parcellfun: arguments size must match"); endif endif njobs = numel (args{1}); if (chunks_per_proc > 0 && chunks_per_proc < njobs / nproc) ## We need chunked evaluation. if (accumulate) chunk_uniform_output = false; else chunk_uniform_output = uniform_output; endif ## Function executed for a chunk. if (isempty (error_handler)) chunk_fun = @(varargin) cellfun (fun, varargin{:}, "UniformOutput", chunk_uniform_output); else chunk_fun = @(varargin) cellfun (fun, varargin{:}, "UniformOutput", chunk_uniform_output, "ErrorHandler", error_handler); endif if (accumulate) chunk_fun = @(varargin) acc_chunk_fun (cumfunc, chunk_fun, varargin{:}); endif [varargout{1:nargout}] = chunk_parcellfun (nproc, chunks_per_proc, chunk_fun, [], verbose_level, cumfunc, uniform_output, args{:}); return endif nproc = min (nproc, numel (args{1})); ## create communication pipes. cmdr = cmdw = resr = resw = zeros (nproc, 1); err = 0; for i = 1:nproc ## command pipes [cmdr(i), cmdw(i), err, msg] = pipe (); if (err) break; endif ## result pipes [resr(i), resw(i), err, msg] = pipe (); if (err) break; endif endfor if (! err) ## status pipe [statr, statw, err, msg] = pipe (); endif if (err) error ("failed to open pipe: %s", msg); endif iproc = 0; # the parent process nsuc = 0; # number of processes succesfully forked. fflush (stdout); # prevent subprocesses from inheriting buffered output ## get a seed and change state seed = rand; pids = zeros (nproc, 1); ## fork subprocesses for i = 1:nproc [pid, msg] = fork (); if (pid > 0) ## parent process. fork succeded. nsuc ++; pids(i) = pid; if (verbose_level > 1) fprintf (stderr,"parcellfun: child process %d created\n", pids(i)); fflush (stderr); endif elseif (pid == 0) ## child process. iproc = i; break; elseif (pid < 0) ## parent process. fork failed. err = 1; break; endif endfor if (iproc) ## child process. close unnecessary pipe ends. fclose (statr); for i = 1:nproc ## we won't write commands and read results fclose (cmdw (i)); fclose (resr (i)); if (i != iproc) ## close also those pipes that don't belong to us. fclose (cmdr (i)); fclose (resw (i)); endif endfor else ## parent process. close unnecessary pipe ends. fclose (statw); for i = 1:nproc ## we won't read commands and write results fclose (cmdr (i)); fclose (resw (i)); endfor if (nsuc) ## we forked some processes. if this is less than we opted for, gripe ## but continue. if (nsuc < nproc) warning ("parcellfun: only %d out of %d processes forked", nsuc, nproc); nproc = nsuc; endif else ## this is bad. error ("parcellfun: failed to fork processes"); endif endif ## At this point, everything should be OK (?) if (iproc) ## the border patrol. we really don't want errors escape after the forks. unwind_protect try ## re-seed random number states, adjusted for each process seed *= iproc*bitmax; cellfun (@ (fun) fun ("state", seed), random_func_list); ## child process. indicate ready state. fwrite (statw, -iproc, "double"); fflush (statw); do ## get command cmd = fread (cmdr(iproc), 1, "double"); if (cmd) ## we've got a job to do. prepare argument and return lists. res = cell (1, nargout); argsc = cell (1, nargs); for i = 1:nargs argsc{i} = args{i}{cmd}; endfor if (isempty (error_handler)) ## unguarded evaluation. [res{:}] = fun (argsc{:}); else ## guarded evaluation try [res{:}] = fun (argsc{:}); catch errs = lasterror (); # fields 'message', 'identifier', 'stack' errs.index = cmd; [res{:}] = error_handler (errs, argsc{:}); end_try_catch endif ## indicate ready state. fwrite (statw, iproc, "double"); fflush (statw); ## write the result. ## FIXME: this can fail. fsave (resw(iproc), res); fflush (resw(iproc)); endif until (cmd == 0) catch ## just indicate the error. don't quit this function !!!! fputs (stderr, "\n"); warning ("parcellfun: unhandled error in subprocess %d", iproc); ## send a termination notice. fwrite (statw, -iproc, "double"); fflush (statw); end_try_catch unwind_protect_cleanup ## This is enclosed in another handler to prevent errors from escaping. ## If something goes wrong, we'll get a broken pipe signal, but anything ## is better than skipping the following __exit__. try fclose (statw); fclose (resw(iproc)); fclose (cmdr(iproc)); end_try_catch ## no more work for us. We call __exit__, which bypasses termination sequences. __exit__ (); ## we should never get here. exit (); end_unwind_protect else ## parent process. if (accumulate) res = cell (nargout, 1); else res = cell (nargout, njobs); endif firstresult = true; pjobs = 0; stop = false; pending = zeros (1, nproc); ## we need these flags additionally to 'pending' because 1) a child ## might send a result (so pending is set to false) and yet signal ## failure and exit due to an error in sending (which would be ## mistaken for a 'ready' signal if only 'pending' is checked) and ## 2) a child might not signal to be ready until all jobs are ## finished, so pending never gets true (see where the flags are ## used) ready = false (1, nproc); terminated = false (1, nproc); unwind_protect while ((pjobs < njobs && ! stop) || any (pending)) ## wait for a process state. isubp = fread (statr, 1, "double"); ## if pipe contained no more data, that's bad if (feof (statr)) warning ("parcellfun: premature exit due to closed pipe"); break; endif if (isubp > 0) ijob = pending(isubp); ## we have a result ready. if (accumulate) if (firstresult) res(:, 1) = fload (resr(isubp)); firstresult = false; else [res{:, 1}] = cumfunc (res{:}, fload (resr(isubp)){:}); endif else res(:, ijob) = fload (resr(isubp)); endif ## clear pending state pending(isubp) = 0; else isubp = -isubp; if (ready(isubp)) ## premature exit means an unhandled error occured in a subprocess. ## the process should have griped, we just try to exit gracefully. pending(isubp) = 0; terminated(isubp) = true; ## no more jobs to start. stop = true; ## skip the rest; don't send commands to the process. fclose(cmdw(isubp)); continue; else ready(isubp) = true; endif endif if (pjobs < njobs && ! stop) ijob = ++pjobs; ## send the next job to the process. fwrite (cmdw(isubp), ijob, "double"); fflush (cmdw(isubp)); ## set pending state pending(isubp) = ijob; else ## send terminating signal fwrite (cmdw(isubp), 0, "double"); fclose (cmdw(isubp)); terminated(isubp) = true; endif if (verbose_level > 0) fprintf (stderr, "\rparcellfun: %d/%d jobs done", pjobs - sum (pending != 0), njobs); fflush (stderr); endif endwhile if (verbose_level > 0) fputs (stderr, "\n"); fflush (stderr); endif unwind_protect_cleanup ## send termination signals to active processes. for isubp = find (! terminated) ## send terminating signal fwrite (cmdw(isubp), 0, "double"); fclose (cmdw(isubp)); endfor ## explicitly recognize all terminated processes. for i = 1:nproc if (verbose_level > 1) fprintf(stderr,"parcellfun: waiting for child process %d to close\n", pids(i)); fflush (stderr); endif [pid, status] = waitpid (pids(i)); endfor ## FIXME: I think order is possibly important here, and this is correct. ## close all pipe ends fclose (statr); for i = 1:nproc fclose (resr(i)); endfor end_unwind_protect ## we're finished. transform the result. if (accumulate) if (uniform_output) varargout = res; else varargout = num2cell (res); endif else varargout = cell (1, nargout); shape = size (varargin{1}); for i = 1:nargout varargout{i} = reshape (res(i,:), shape); if (uniform_output) varargout{i} = cell2mat (varargout{i}); endif endfor endif endif endfunction function varargout = acc_chunk_fun (cumfunc, chunk_fun, varargin) [chunk_out{1:nargout}] = chunk_fun (varargin{:}); nel = numel (chunk_out{1}); chunk_out = horzcat (chunk_out{:}); res = chunk_out(1, :); for (id = 2 : nel) [res{:}] = cumfunc (res{:}, chunk_out{id, :}); endfor varargout = res; endfunction parallel-3.0.3/inst/__netcellfun_guardfun__.m0000644000175000017500000000227312614416033017722 0ustar olafolaf## Copyright (C) 2015 Olaf Till ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} __netcellfun_guardfun__ (@dots{}) ## ## Undocumented internal function. ## ## @end deftypefn function varargout = __netcellfun_guardfun__ (func, errh, idx, varargin) ## This must be an extra function file to be visible at the remote ## side. nout = nargout (); try [varargout{1:nout}] = func (varargin{:}); catch errs = lasterror (); errs.index = idx; [varargout{1:nout}] = errh (errs, varargin{:}); end_try_catch endfunction parallel-3.0.3/inst/install_vars.m0000644000175000017500000001536112614416033015577 0ustar olafolaf## Copyright (C) 2015 Olaf Till ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} install_vars (@var{varname}, @dots{}, @var{connections}) ## Install named variables at remote machines. ## ## The variables named in the arguments are distrubted to the remote ## machines specified by @var{connections} and installed there. The ## variables must be accessible within the calling function. If ## variables have been declared to have global scope, they will also ## have global scope at the remote machines. ## ## This function can only be successfully called at the client machine. ## See @code{pconnect} for a description of the @var{connections} ## variable. @var{connections} can contain all connections of the ## network, a subset of them, or a single connection. The local machine ## (client), if contained in @var{connections}, is ignored. ## ## To install, e.g., all visible variables, ## ## @code{install_vars (who ()@{:@}, @dots{});} ## ## can be used. ## ## Internally, this function sends the variables only to one server and ## then issues the necessary commands to distribute them to all ## specified servers over server-to-server data connections. ## ## @seealso{pconnect, pserver, sclose, rfeval, netcellfun} ## @end deftypefn function ret = install_vars (varargin) if ((nargs = nargin ()) < 1 || ... ! iscellstr (varnames = varargin(1 : end - 1))) print_usage (); endif fname = "install_vars"; if (! isa (conns = varargin{end}, "pconnections")) error ("%s: `connections' must be a parallel connections object", fname); endif ## reval() will check if specified at server side ## delete local machine from connections if present conns = conns(! [network_get_info(conns).local_machine]); if ((nhosts = numel (conns)) == 0) return; endif if ((nvars = numel (varnames)) == 0) return; endif ## get an index translation into the remote variable of connections ## ('sockets') ridx = [network_get_info(conns).real_node_id] + 1; ## retrieve cell-array of variable values from variable names in ## calling function [vars{1:nvars}] = evalin("caller", sprintf ("{%s%s}{:}", varnames{1}, ifelse (nvars > 1, sprintf (", %s", varnames{2:end}), ""))); ## retrieve logical vector of corresponding 'global' states vglobal = __visglobal__ (varnames); ## construct binary tree of transfers source_hosts = 1; source_id = zeros (0, 1); target_ids = zeros (0, 2); [source_id, target_ids] = add_transfers (source_id, target_ids, source_hosts, nhosts); if (any (vglobal)) recv_cmd1 = sprintf ("%s%s%s", "global ", sprintf ("%s ", varnames{vglobal}), "; "); else recv_cmd1 = ""; endif ## we need a temporary for easily sending the vars to the next server recv_cmd2_mask = sprintf ("__pserver_tvars__ = precv (sockets(%%i)); [%s%s] = __pserver_tvars__{:}; ", varnames{1}, ifelse (nvars > 1, sprintf (", %s", varnames{2:end}), "")); recv_cmd_mask = cstrcat (recv_cmd1, recv_cmd2_mask); send_cmd_mask = "psend (__pserver_tvars__, sockets([%s]));"; ## It is better to reval the recv command and the possibly following ## send commands for a specific server within the same string. ## Otherwise the client or a server might block if the command string ## does not fit into the socket buffers (and we may have long command ## strings here). error_in_first_command = false; ready = false; unwind_protect ## initial transfer recv_cmd = sprintf (recv_cmd_mask, 1); if (nhosts > 1) send_cmd = sprintf (send_cmd_mask, get_ridx_string (target_ids(1, :), ridx)); else send_cmd = ""; endif cmd = sprintf ("%s%s", recv_cmd, send_cmd); try reval (cmd, conns(1)); catch error_in_first_command = true; error (lasterror ()); end_try_catch psend (vars, conns(1)); ## remote transfers for ida = 1 : numel (source_id) for idb = 1:2 if ((did = target_ids(ida, idb)) != 0) recv_cmd = sprintf (recv_cmd_mask, ridx(source_id(ida))); if (isempty (sid = find (source_id == did))) send_cmd = ""; else send_cmd = sprintf (send_cmd_mask, get_ridx_string (target_ids(sid, :), ... ridx)); endif cmd = sprintf ("%s%s", recv_cmd, send_cmd); reval (cmd, conns(did)); endif endfor endfor ready = true; unwind_protect_cleanup if (! (ready || error_in_first_command)) sclose (conns); endif end_unwind_protect endfunction function ret = get_ridx_string (targ_idx, ridx) ret = sprintf ("%i", ridx(targ_idx(1))); if (targ_idx(2) != 0) ret = sprintf ("%s, %i", ret, ridx(targ_idx(2))); endif endfunction function [source_id, target_ids] = add_transfers (source_id, target_ids, source_hosts, nhosts) if ((left = nhosts - source_hosts(end)) == 0) return; endif new_source_hosts = zeros (1, 0); for idb = 1:2 # two branches for ids = 1 : (nsh = numel (source_hosts)) current_target_id = nhosts + 1 - left; if (idb == 1) source_id = vertcat (source_id, source_hosts(ids)); target_ids = vertcat (target_ids, [current_target_id, 0]); else target_ids(end + ids - nsh, 2) = current_target_id; endif new_source_hosts = horzcat (new_source_hosts, current_target_id); left--; if (left == 0) break; endif endfor # source hosts if (left == 0) break; endif endfor # two branches [source_id, target_ids] = add_transfers (source_id, target_ids, new_source_hosts, nhosts); endfunction parallel-3.0.3/inst/private/0002755000175000017500000000000012614416033014366 5ustar olafolafparallel-3.0.3/inst/private/netcellfun_worker.m0000644000175000017500000002037512614416033020301 0ustar olafolaf## Copyright (C) 2015 Olaf Till ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} netcellfun_worker (@var{in_arrays} @var{connections}, @var{fun}, @dots{}) ## ## Undocumented internal function. ## ## @end deftypefn function varargout = netcellfun_worker (in_arrays, conns, func, varargin) fname = ifelse (in_arrays, "netarrayfun", "netcellfun"); ## nargin () >= 4 has been assured by caller (netcellfun or netarrayfun) if (! isa (conns, "pconnections")) error ("%s: `connections' must be a parallel connections object", fname); endif info = network_get_info (conns); ## delete local machine, if present, from connections and from info server_idx = ! [info.local_machine]; conns = conns(server_idx); info = info(server_idx); if ((nhosts = numel (conns)) == 0) error ("%s: connections object contains no servers", fname); endif nout = nargout (); ## options are similar to for parcellfun/pararrayfun [nargs, uniform_output, error_handler, verbose_level, ... ~, cumfunc, vectorized, chunk_size] = parcellfun_opts (fname, varargin); accumulate = ifelse (isempty (cumfunc), false, true); args = varargin(1:nargs); ## configured or default number of processes at each machine rnproc = ifelse ([info.nlocaljobs] == 0, [info.nproc], [info.nlocaljobs]); ## number of jobs per call at each machine rnjobs = rnproc * chunk_size; ## The anonymous functions for remote function calls had to be defined ## without using "varargin", since (up to Octave 4.0.0 at least) ## anonymous functions with varargin were not saved/loaded ## (sent/received) correctly. if (any (rnjobs == 1)) ## There will be (some) single function calls (without parallelity ## within one machine and not via cellfun). Prepare function for ## single function calls. See below why the 'eh' argument is ## necessary. if (isempty (error_handler)) if (in_arrays) single_func = @ (idx, eh, varargs) func (varargs{:}); else single_func = @ (idx, eh, varargs) func (vertcat (varargs{:}){:}); endif else if (in_arrays) single_func = @ (idx, eh, varargs) __netcellfun_guardfun__ ... (func, error_handler, idx, varargs{:}); else single_func = @ (idx, eh, varargs) __netcellfun_guardfun__ ... (func, error_handler, idx, vertcat (varargs{:}){:}); endif endif endif ## (For function calls via parcell/arrayfun, the possibly specified ## error handler must be wrapped to add a base to errs.index.) ## construct function calls specific to each server funs = cell (nhosts, 1); ## this caused some difficulties (4.0.0) with visibility of private functions ## rem_parfun = ifelse (in_arrays, @ pararrayfun, @ parcellfun); rem_parfun = ifelse (in_arrays, "pararrayfun", "parcellfun"); ## (number of argument sets in remote call will be rnproc * ## chunk_size, while ChunksPerProc will be 1) for (id = 1:nhosts) if (rnjobs(id) == 1) funs{id} = single_func; else ## If (rnproc(id) == 1), this will lead to a single call of ## cellfun via parcell/arrayfun. This case could be treated more ## efficiently. But then we'd have to care for CumFunc here. ## We use eval() to shorten the logic, since a function handle for ## rem_parfun did not work (see comment above). See next comment ## for why the second argument 'eh' is necessary. if (isempty (error_handler)) eval (sprintf ("funs{id} = @ (idx, eh, varargs) %s \ (rnproc(id), func, varargs{:}, \ 'ChunksPerProc', 1, \ 'UniformOutput', false, \ 'VerboseLevel', 0, \ 'Vectorized', vectorized, \ 'CumFunc', cumfunc, \ 'ErrorHandler', eh);", ... rem_parfun)); else ## The eval() with explicitely named anonymous function ## arguments is necessary due to the above mentioned issue with ## save/loading anonymous functions with varargin. Also, Octave ## doesn't seem to save the context of an anonymous function ## defined within another anonymous function -- it doesn't save ## the original error handler within the defined error handler ## wrapper; for this reason, the error handler has to be passed ## as an additional (second) argument to the funcion funs{id}, ## an argument which could be dropped otherwise. arg_list = sprintf (", _%i", 1:nargs); eval (sprintf ("funs{id} = @ (idx, eh, varargs) %s \ (rnproc(id), func, varargs{:}, \ 'ChunksPerProc', 1, \ 'UniformOutput', false, \ 'VerboseLevel', 0, \ 'Vectorized', vectorized, \ 'CumFunc', cumfunc, \ 'ErrorHandler', \ @ (err %s) eh \ (setfield (err, 'index', idx(err.index)) \ %s));", rem_parfun, arg_list, arg_list)); endif endif endfor ## the scheduler njobs = numel (args{1}); busy_hosts_lidx = false (1, nhosts); busy_hosts_jobs = cell (1, nhosts); # will contain index vectors # into jobs left_lidx = true (njobs, 1); firstresult = true; first_rfeval = true; error_in_first_rfeval = false; ready = false; if (! accumulate) varargout = cell (njobs, nout); endif orig_size = size (args{1}); unwind_protect while (any (left_lidx) || any (busy_hosts_lidx)) ## create remote jobs if jobs are left ## go through all free hosts, there are some (first time or select ## returned) for host_nid = find (! busy_hosts_lidx) ## index vector into jobs for that host, stop creating remote ## jobs if no job is left if (isempty (job_idxv = find (left_lidx, rnjobs(host_nid)))) break; endif ## cargs will contain _column_ arrays cargs = cellfun (@ (x) x(job_idxv), args, "UniformOutput", false); try rfeval (funs{host_nid}, job_idxv, error_handler, cargs, nout, [], conns(host_nid)); catch if (first_rfeval) error_in_first_rfeval = true; endif error (lasterr ()); end_try_catch first_rfeval = false; busy_hosts_lidx(host_nid) = true; busy_hosts_jobs{host_nid} = job_idxv; left_lidx(job_idxv) = false; endfor ## ready creating jobs, now collect some results ## there are busy hosts, if not directly due to the enclosing ## while-condition, then due to creating jobs above ready_nidx = select_sockets (conns, -1); for id = ready_nidx ## a cell-array of the outputs, outputs are columns res = precv (conns(id)); ## distinguish between single function and others if (rnjobs(id) > 1) ## the outputs are in cell-arrays res = horzcat (res{:}); endif if (accumulate) if (firstresult) varargout = res; firstresult = false; else [varargout{:}] = cumfunc (varargout{:}, res{:}); endif else varargout(busy_hosts_jobs{id}, :) = res; endif busy_hosts_lidx(id) = false; left_lidx(busy_hosts_jobs{id}) = false; endfor endwhile ready = true; unwind_protect_cleanup if (! (ready || error_in_first_rfeval)) sclose (conns); # might already be closed endif end_unwind_protect ## transform the result if (uniform_output) varargout = cell2mat (varargout); endif varargout = mat2cell (varargout, rows (varargout), ones (1, nout)); endfunction parallel-3.0.3/inst/private/parcellfun_opts.m0000644000175000017500000000634112614416033017746 0ustar olafolaf## Copyright (C) 2010 VZLU Prague, a.s., Czech Republic ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} parcellfun_opts (args) ## Undocumented internal function. ## @end deftypefn function [nargs, uniform_output, error_handler, verbose_level, ... chunks_per_proc, cumfunc, vectorized, ... chunk_size] = parcellfun_opts (caller, args) uniform_output = true; error_handler = []; verbose_level = 1; # default to normal output level chunks_per_proc = 0; # 0 means than size of chunk is 1 vectorized = false; cumfunc = []; chunk_size = 1; nargs = length (args); ## parse options while (nargs > 1) opt = args{nargs-1}; if (! ischar (opt)) break; else optl = tolower (opt); val = args{nargs}; endif switch (optl) case "uniformoutput" uniform_output = logical (val); if (! isscalar (uniform_output)) error ("%s: UniformOutput must be a logical scalar", caller); endif case "errorhandler" error_handler = val; if (! (isempty (error_handler) || isa (error_handler, "function_handle"))) error ("%s: ErrorHandler must be a function handle", caller); endif case "verboselevel" verbose_level = val; if (! isscalar (verbose_level)) error ("%s: VerboseLevel must be a numeric scalar", caller); endif case "chunksperproc" if (! isempty (val)) chunks_per_proc = round (val); if (! isscalar (chunks_per_proc) || chunks_per_proc <= 0) error ("%s: ChunksPerProc must be a positive scalar", caller); endif endif case "vectorized" vectorized = logical (val); if (! isscalar (vectorized)) error ("%s: Vectorized must be a logical scalar", caller); endif case "cumfunc" cumfunc = val; if (! (isempty (cumfunc) || is_function_handle (cumfunc))) error ("%s: CumFunc must be empty or a function handle", caller); endif case "chunksize" chunk_size = round (val); if (! isscalar (chunk_size) || chunk_size <= 0) error ("%s: ChunkSize must be a positive scalar", caller); endif otherwise error ("%s: invalid option ""%s""", caller, opt); endswitch nargs -= 2; endwhile if (vectorized) if (any (strcmp (caller, {"parcellfun", "netcellfun"}))) error ("%s: ""Vectorized"" option not accepted by %s", caller, caller); elseif (chunks_per_proc <= 0 && strcmp (caller, "pararrayfun")) error ("%s: the ""Vectorized"" option requires also ""ChunksPerProc""", caller); endif endif endfunction parallel-3.0.3/inst/private/chunk_parcellfun.m0000644000175000017500000000447712614416033020101 0ustar olafolaf## Copyright (C) 2010 VZLU Prague, a.s., Czech Republic ## Copyright (C) 2010 Jean-Benoist Leger ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} chunk_parcellfun (@dots{:}) ## Undocumented internal function. ## @end deftypefn function varargout = chunk_parcellfun (nproc, chunks_per_proc, func, error_handler, verbose_level, cumfunc, uniform_output, varargin) args = varargin; nchunks = chunks_per_proc * nproc; ## Compute optimal chunk sizes. N = numel (args{1}); len_chunk = ceil (N/nchunks); chunk_sizes = len_chunk (ones(1, nchunks)); chunk_sizes(1:nchunks*len_chunk - N) -= 1; ## Split argument arrays into chunks (thus making arrays of arrays). chunked_args = cellfun (@(arg) mat2cell (arg(:), chunk_sizes), args, ... "UniformOutput", false); ## Attach error handler if present. if (! isempty (error_handler)) chunked_args = [chunked_args, {"ErrorHandler", error_handler}]; endif ## Main call. [out_brut{1:nargout}] = parcellfun (nproc, func, chunked_args{:}, "UniformOutput", false, "VerboseLevel", verbose_level, "CumFunc", cumfunc); ## Concatenate output args and reshape them to correct size. if (isempty (cumfunc)) true_size = size (args{1}); varargout = cellfun (@(arg) reshape (vertcat (arg{:}), true_size), out_brut, "UniformOutput", false); elseif (uniform_output) varargout = cellfun (@(arg) arg{:}, out_brut, "UniformOutput", false); else varargout = out_brut; endif endfunction parallel-3.0.3/inst/__pserver_exit__.m0000644000175000017500000000224012614416033016401 0ustar olafolaf## Copyright (C) 2010, 2013 Olaf Till ## ## 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 . ## -*- texinfo -*- ## @deftypefn{Function File} {} __pserver_exit__ () ## ## Undocumented internal function. ## ## @end deftypefn function __pserver_exit__ (hn) ## Will be initialized and then registered as an exit function of ## Octave, so pserver does not have to wrap Octaves clean_up_and_exit ## and Octaves sigterm handler. persistent hostname; if (nargin == 1) hostname = hn; else fprintf (stderr, "exiting, %s\n", hostname); endif endfunction