pbdZMQ/0000755000176200001440000000000013273403364011414 5ustar liggesuserspbdZMQ/COPYING0000644000176200001440000010451413260234554012453 0ustar liggesusers GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . pbdZMQ/inst/0000755000176200001440000000000013260234554012370 5ustar liggesuserspbdZMQ/inst/examples/0000755000176200001440000000000013260234554014206 5ustar liggesuserspbdZMQ/inst/examples/README0000644000176200001440000000234213260234554015067 0ustar liggesusers# Instructions Before proceeding with the examples contained in this subdirectory, please read all of the following carefully. Failure to do so may lead to confusion. ## Naming Conventions Examples are given in the variety of interfaces avaialable in pbdZMQ. The naming convention goes: 1. No preface is placed on the file name for the basic interface. 2. pyzmq_ prefaces the file name if the example uses the PyZMQ-like R6 interface (see help("pyzmq") for details). 3. rzmq_ prefaces the file name if the example uses the rzmq-like interface (see help("rzmq") for details). ## Running An Example Each of these examples should be executed in the following way: 1. Start the server by running server.r IN BATCH. You can do this by executing `Rscript server.r` from a terminal. 2. Start the client by sourcing client.r INTERACTIVELY. You can do this by starting an R session (Rstudio, wingui, R.app, ...) and running `source client.r`. 3. Pass commands from client to server by executing `sendrecv(socket, "1+1")` from the client (replace "1+1" with the command of your choice, as a string). 4. Shut down the server by executing `sendrecv(socket, "EXIT")` on the client. See the package vignette for more details. pbdZMQ/inst/examples/reqrep/0000755000176200001440000000000013260234554015504 5ustar liggesuserspbdZMQ/inst/examples/reqrep/rzmq_client.r0000644000176200001440000000102113260234554020210 0ustar liggesusersif (!interactive()) stop("Please run the client interactively; you can do so by executing 'source(\"client.r\")' from an interactive R session.") library(pbdZMQ) ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REQ") connect.socket(socket, "tcp://localhost:55555") sendrecv <- function(socket, data) { send.socket(socket, data) receive.socket(socket) } cat("Send commands to the server using sendrecv(). For example, 'sendrecv(socket, \"1+1\")'. Send 'sendrecv(socket, \"EXIT\")' to shut down the server.\n\n") pbdZMQ/inst/examples/reqrep/client.r0000644000176200001440000000102513260234554017143 0ustar liggesusersif (!interactive()) stop("Please run the client interactively; you can do so by executing 'source(\"client.r\")' from an interactive R session.") library(pbdZMQ) ctxt <- zmq.ctx.new() socket <- zmq.socket(ctxt, .pbd_env$ZMQ.ST$REQ) zmq.connect(socket, "tcp://localhost:55555") sendrecv <- function(socket, data) { zmq.msg.send(data, socket) zmq.msg.recv(socket) } cat("Send commands to the server using sendrecv().\nFor example, 'sendrecv(socket, \"1+1\")'.\nSend 'sendrecv(socket, \"EXIT\")' to shut down the server.\n\n") pbdZMQ/inst/examples/reqrep/rzmq_server.r0000644000176200001440000000076513260234554020256 0ustar liggesusersif (interactive()) cat("WARNING: You are encouraged to run the server in batch; you can do so by executing 'Rscript server.r' from a terminal.\n\n") library(pbdZMQ) ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REP") bind.socket(socket, "tcp://*:55555") while(TRUE) { cat("Client command: ") msg <- receive.socket(socket) cat(msg, "\n") if (msg == "EXIT") break result <- eval(parse(text=msg)) send.socket(socket, result) } send.socket(socket, "shutting down!") pbdZMQ/inst/examples/reqrep/server.r0000644000176200001440000000104613260234554017176 0ustar liggesusersif (interactive()) cat("WARNING: You are encouraged to run the server in batch; you can do so by executing 'Rscript server.r' from a terminal.\n\n") library(pbdZMQ) ctxt <- zmq.ctx.new() socket <- zmq.socket(ctxt, .pbd_env$ZMQ.ST$REP) zmq.bind(socket, "tcp://*:55555") while(TRUE) { cat("Client command: ") msg <- zmq.msg.recv(socket) cat(msg, "\n") if (msg == "EXIT") break result <- eval(parse(text=msg)) zmq.msg.send(result, socket) } zmq.msg.send("shutting down!", socket) zmq.close(socket) zmq.ctx.destroy(ctxt) pbdZMQ/inst/CITATION0000644000176200001440000000217213260234554013527 0ustar liggesuserscitHeader("To cite pbdZMQ in a publication use:") citEntry( entry = "Misc", title = "{pbdZMQ}: Programming with Big Data -- Interface to {ZeroMQ}", author = personList(as.person("Wei-Chen Chen"), as.person("Drew Schmidt"), as.person("Christian Heckendorf"), as.person("George Ostrouchov")), year = "2015", note = "{R} Package, URL https://cran.r-project.org/package=pbdZMQ", textVersion = "Chen, W.-C., Schmidt, D., Heckendorf, C., and Ostrouchov, G. (2015) pbdZMQ: Programming with Big Data -- Interface to ZeroMQ. R Package, URL https://cran.r-project.org/package=pbdZMQ", key = "Chen2015pbdZMQpackage" ) citEntry( entry = "Manual", title = "A Quick Guide for the {pbdZMQ} Package", author = personList(as.person("Wei-Chen Chen"), as.person("Drew Schmidt")), year = "2015", note = "{R} Vignette, URL https://cran.r-project.org/package=pbdZMQ", textVersion = "Chen, W.-C. and Schmidt, D. (2015) A Quick Guide for the pbdZMQ Package. R Vignette, URL https://cran.r-project.org/package=pbdZMQ", key = "Chen2015pbdZMQvignette" ) pbdZMQ/inst/doc/0000755000176200001440000000000013271756330013140 5ustar liggesuserspbdZMQ/inst/doc/pbdZMQ-guide.Rnw0000644000176200001440000000467513271756330016074 0ustar liggesusers%\VignetteIndexEntry{pbdZMQ-guide} \documentclass[article,shortnames,nojss]{jss} \newcommand{\zmqversion}{0.1-0} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% declarations for jss.cls %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% almost as usual \author{ \begin{minipage}{6in} \centering Wei-Chen Chen$^1$ and Drew Schmidt$^1$ \end{minipage} \\ \\ $^1$pbdR Core Team \\ %\\ %\\ %\today } %\title{A Quick Guide for the \pkg{pbdZMQ} Package {\small (Ver. \mpiversion)}} \title{A Quick Guide for the \pkg{pbdZMQ} Package} %% for pretty printing and a nice hypersummary also set: \Plainauthor{Wei-Chen Chen, Drew Schmidt} %% comma-separated \Plaintitle{Quick Guide for pbdZMQ} %% without formatting \Shorttitle{Quick Guide for pbdZMQ} %% a short title (if necessary) %% an abstract and keywords %\Abstract{ %} %\Keywords{} %\Plainkeywords{} %% without formatting %% at least one keyword must be supplied %% publication information %% NOTE: Typically, this can be left commented and will be filled out by the technical editor %% \Volume{13} %% \Issue{9} %% \Month{September} %% \Year{2004} %% \Submitdate{2004-09-29} %% \Acceptdate{2004-09-29} %% The address of (at least) one author should be given %% in the following format: \Address{ Wei-Chen Chen\\ E-mail: \email{wccsnow@gmail.com}\\ URL: \url{http://snoweye.github.io/} } %% It is also possible to add a telephone and fax number %% before the e-mail in the following format: %% Telephone: +43/1/31336-5053 %% Fax: +43/1/31336-734 %% for those who use Sweave please include the following line (with % symbols): %% need no \usepackage{Sweave.sty} %% end of declarations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \input{./pbdZMQ-include/my_jss.cls} \input{./pbdZMQ-include/00-preamble} \begin{document} \pagenumbering{roman} \tableofcontents %\newpage \input{./pbdZMQ-include/01-copyright} %% include your article here, just as usual %% Note that you should use the \pkg{}, \proglang{} and \code{} commands. \newpage \input{./pbdZMQ-include/01-acknowledgement} \newpage \pagenumbering{arabic} \setcounter{page}{1} \input{./pbdZMQ-include/01-introduction} \input{./pbdZMQ-include/02-installation} \input{./pbdZMQ-include/03-example} \input{./pbdZMQ-include/04-backward} \input{./pbdZMQ-include/05-cs} \input{./pbdZMQ-include/06-solaris} \input{./pbdZMQ-include/99-faq} \newpage \phantomsection \addcontentsline{toc}{section}{References} \bibliography{./pbdZMQ-include/pbdZMQ} \end{document} pbdZMQ/configure.ac0000644000176200001440000001055313260234554013705 0ustar liggesusersdnl Process this file with autoconf to produce a configure script AC_INIT(DESCRIPTION) dnl Check chmod chmod +x ./src/zmqsrc/autogen.sh chmod +x ./src/zmqsrc/configure chmod +x ./src/zmqsrc/version.sh chmod +x ./src/zmqsrc/config/compile chmod +x ./src/zmqsrc/config/config.guess chmod +x ./src/zmqsrc/config/config.sub chmod +x ./src/zmqsrc/config/depcomp chmod +x ./src/zmqsrc/config/install-sh chmod +x ./src/zmqsrc/config/missing dnl Determine R_HOME. : ${R_HOME=‘R RHOME‘} if test -z "${R_HOME}"; then echo "could not determine R_HOME" exit 1 fi R_SCMD="${R_HOME}/bin/Rscript -e" dnl Check if force enable internal ZeroMQ. AC_ARG_ENABLE(internal-zmq, AC_HELP_STRING([--enable-internal-zmq], [Enable internal ZeroMQ, default no.]), [ENABLE_INTERNAL_ZMQ="yes"], [ENABLE_INTERNAL_ZMQ="no"]) dnl Check system ZMQ with pkg-config GET_PKG_CONFIG="no" GET_SYSTEM_ZMQ="no" m4_include([src/pkg.m4]) PKG_PROG_PKG_CONFIG([0.25]) if test "X$PKG_CONFIG" != "X" ; then GET_PKG_CONFIG="yes" PKG_CHECK_MODULES([zmq], [libzmq >= 4.0.4], GET_SYSTEM_ZMQ="yes", GET_SYSTEM_ZMQ="no") fi dnl Find system ZMQ header and share library. SYSTEM_ZMQ_INCLUDEDIR="" SYSTEM_ZMQ_LIBDIR="" if test "X$GET_PKG_CONFIG" = "Xyes" -a "X$GET_SYSTEM_ZMQ" = "Xyes" -a "X$ENABLE_INTERNAL_ZMQ" = "Xno" ; then SYSTEM_ZMQ_INCLUDEDIR=`$PKG_CONFIG --variable=includedir libzmq` SYSTEM_ZMQ_LIBDIR=`$PKG_CONFIG --variable=libdir libzmq` fi dnl Check internal ZMQ (default). INTERNAL_ZMQ_INCLUDEDIR="./zmqsrc/include" INTERNAL_ZMQ_LIBDIR="./" dnl Check external ZMQ. AC_ARG_VAR(ZMQ_INCLUDE, [], [ "-I/path_to_zmq_include/" ]) AS_VAR_SET_IF(ZMQ_INCLUDE, [], [ AS_VAR_SET(ZMQ_INCLUDE, "") ]) EXTERNAL_ZMQ_INCLUDE="${ZMQ_INCLUDE}" AC_ARG_VAR(ZMQ_LDFLAGS, [], [ "-L/path_to_zmq_lib/ -lzmq" ]) AS_VAR_SET_IF(ZMQ_LDFLAGS, [], [ AS_VAR_SET(ZMQ_LDFLAGS, "") ]) EXTERNAL_ZMQ_LDFLAGS="${ZMQ_LDFLAGS}" dnl I decide to the order: system, internal, external. dnl However, I need to test the order in backward. ZMQ_INCLUDE="" ZMQ_LDFLAGS="" if test "X$EXTERNAL_ZMQ_INCLUDE" != "X" -a "X$EXTERNAL_ZMQ_LDFLAGS" != "X" ; then ZMQ_INCLUDE="${EXTERNAL_ZMQ_INCLUDE}" ZMQ_LDFLAGS="${EXTERNAL_ZMQ_LDFLAGS}" else if test "X$ENABLE_INTERNAL_ZMQ" = "Xyes" ; then ZMQ_INCLUDE="-I${INTERNAL_ZMQ_INCLUDEDIR}" ZMQ_LDFLAGS="-L${INTERNAL_ZMQ_LIBDIR} -lzmq" else if test "X$SYSTEM_ZMQ_INCLUDEDIR" != "X" -a "X$SYSTEM_ZMQ_LIBDIR" != "X" ; then ZMQ_INCLUDE="-I${SYSTEM_ZMQ_INCLUDEDIR}" ZMQ_LDFLAGS="-L${SYSTEM_ZMQ_LIBDIR} -lzmq" else ZMQ_INCLUDE="-I${INTERNAL_ZMQ_INCLUDEDIR}" ZMQ_LDFLAGS="-L${INTERNAL_ZMQ_LIBDIR} -lzmq" fi fi fi dnl Set EXT_LIBS if external ZeroMQ library is provided. if test "$ZMQ_INCLUDE" != "-I./zmqsrc/include" -a "$ZMQ_LDFLAGS" != "-L./ -lzmq" ; then EXT_LIBS="" else EXT_LIBS="\$(R_ZMQ)" fi dnl Set ZMQ pollig system. AC_ARG_VAR(ZMQ_POLLER, [select], [ polling system: autodetect, kqueue, epoll, devpoll, poll, or select ]) AS_VAR_SET_IF(ZMQ_POLLER, [], [ AS_VAR_SET(ZMQ_POLLER, "") ]) if test "X$ZMQ_POLLER" = "X" ; then ZMQ_POLLER="select" fi dnl Report echo " " echo "****************** Results of pbdZMQ package configure *****************" echo " " echo ">> GET_PKG_CONFIG = ${GET_PKG_CONFIG}" echo ">> GET_SYSTEM_ZMQ = ${GET_SYSTEM_ZMQ}" echo ">> PKG_CONFIG = ${PKG_CONFIG}" echo ">> SYSTEM_ZMQ_INCLUDEDIR = ${SYSTEM_ZMQ_INCLUDEDIR}" echo ">> SYSTEM_ZMQ_LIBDIR = ${SYSTEM_ZMQ_LIBDIR}" echo ">> ENABLE_INTERNAL_ZMQ = ${ENABLE_INTERNAL_ZMQ}" echo ">> INTERNAL_ZMQ_INCLUDEDIR = ${INTERNAL_ZMQ_INCLUDEDIR}" echo ">> INTERNAL_ZMQ_LIBDIR = ${INTERNAL_ZMQ_LIBDIR}" echo ">> EXTERNAL_ZMQ_INCLUDE = ${EXTERNAL_ZMQ_INCLUDE}" echo ">> EXTERNAL_ZMQ_LDFLAGS = ${EXTERNAL_ZMQ_LDFLAGS}" echo ">> ZMQ_INCLUDE = ${ZMQ_INCLUDE}" echo ">> ZMQ_LDFLAGS = ${ZMQ_LDFLAGS}" echo ">> EXT_LIBS = ${EXT_LIBS}" echo ">> ZMQ_POLLER = ${ZMQ_POLLER}" echo " " echo "************************************************************************" echo " " dnl Start to substitute templates AC_SUBST(GET_PKG_CONFIG) AC_SUBST(GET_SYSTEM_ZMQ) AC_SUBST(PKG_CONFIG) AC_SUBST(SYSTEM_ZMQ_INCLUDEDIR) AC_SUBST(SYSTEM_ZMQ_LIBDIR) AC_SUBST(ENABLE_INTERNAL_ZMQ) AC_SUBST(INTERNAL_ZMQ_INCLUDEDIR) AC_SUBST(INTERNAL_ZMQ_LIBDIR) AC_SUBST(EXTERNAL_ZMQ_INCLUDE) AC_SUBST(EXTERNAL_ZMQ_LDFLAGS) AC_SUBST(ZMQ_INCLUDE) AC_SUBST(ZMQ_LDFLAGS) AC_SUBST(EXT_LIBS) AC_SUBST(ZMQ_POLLER) AC_OUTPUT(src/Makevars) AC_OUTPUT(src/build_zmq) AC_OUTPUT(R/zzz.r) pbdZMQ/tests/0000755000176200001440000000000013260234554012555 5ustar liggesuserspbdZMQ/tests/send_recv.R0000644000176200001440000000243113260234554014650 0ustar liggesuserssuppressPackageStartupMessages(library(pbdZMQ)) ### zmq interface # Server server_context = zmq.ctx.new() server_socket = zmq.socket(server_context, .pbd_env$ZMQ.ST$REP) zmq.bind(server_socket, "tcp://*:55555") # Client client_context = zmq.ctx.new() client_socket = zmq.socket(client_context, .pbd_env$ZMQ.ST$REQ) zmq.connect(client_socket, "tcp://localhost:55555") tester = function(indata) { zmq.msg.send(indata, client_socket) c2s <- zmq.msg.recv(server_socket) stopifnot(all.equal(c2s, indata)) zmq.send(server_socket, "ok") s2c <- zmq.recv(client_socket) stopifnot(all.equal(s2c$buf, "ok")) } tester("test") tester(1:5) zmq.close(server_socket) zmq.close(client_socket) ### rzmq interface # Server server_context = init.context() server_socket = init.socket(server_context, "ZMQ_REP") bind.socket(server_socket, "tcp://*:55555") # Client client_context = init.context() client_socket = init.socket(client_context, "ZMQ_REQ") connect.socket(client_socket, "tcp://localhost:55555") tester_rzmq = function(indata) { send.socket(client_socket, indata) c2s <- receive.socket(server_socket) stopifnot(all.equal(c2s, indata)) send.socket(server_socket, "ok") s2c <- receive.socket(client_socket) stopifnot(all.equal(s2c, "ok")) } tester_rzmq("test") tester_rzmq(1:5) pbdZMQ/tests/address.R0000644000176200001440000000046513260234554014332 0ustar liggesuserssuppressPackageStartupMessages(library(pbdZMQ)) addr = "notarealaddress.com.biz.google" port = 8080 test = address(addr, port) truth = paste0("tcp://", addr, ":", port) stopifnot(identical(test, truth)) test = address(addr, transport="ipc") truth = paste0("ipc://", addr) stopifnot(identical(test, truth)) pbdZMQ/tests/ports.R0000644000176200001440000000044013260234554014045 0ustar liggesuserssuppressPackageStartupMessages(library(pbdZMQ)) min = 49152 max = 65536 rp = random_port(min_port=min, max_port=max) stopifnot(isTRUE(rp > min) && isTRUE(rp < max)) rop = random_open_port(min_port=49152, max_port=65536, max_tries=100) stopifnot(isTRUE(rop > min) && isTRUE(rop < max)) pbdZMQ/src/0000755000176200001440000000000013260234554012202 5ustar liggesuserspbdZMQ/src/shellexec_wcc.c0000644000176200001440000000740413271756337015175 0ustar liggesusers/* This file partially modifies from * * R-devel\src\include\Defn.h * R-devel\src\main\sysutils.c * R-devel\src\main\names.c * R-devel\src\gnuwin32\extra.c * * WCC: The default shell.exec did not have any option. The application is * always active in a normal window. This modification is trying to add * options such that the application can be in a minimized window or an * invisible window or a background running window. The application should * not block the R GUI in any case. */ #include #include #include #include #ifdef WIN #include #endif /* From R-devel\src\include\Defn.h */ #define BYTES_MASK (1<<1) #define LATIN1_MASK (1<<2) #define UTF8_MASK (1<<3) #define IS_BYTES(x) (LEVELS(x) & BYTES_MASK) #define IS_LATIN1(x) (LEVELS(x) & LATIN1_MASK) #define IS_UTF8(x) (LEVELS(x) & UTF8_MASK) /* From R-devel\src\main\sysutils.c */ #define BSIZE 100000 wchar_t *filenameToWchar_wcc(const SEXP fn, const Rboolean expand){ static wchar_t filename[BSIZE + 1]; void *obj; const char *from = "", *inbuf; char *outbuf; size_t inb, outb, res; if(!strlen(CHAR(fn))){ wcscpy(filename, L""); return filename; } if(IS_LATIN1(fn)) from = "latin1"; if(IS_UTF8(fn)) from = "UTF-8"; if(IS_BYTES(fn)) warning("encoding of a filename cannot be 'bytes'"); obj = Riconv_open("UCS-2LE", from); if(obj == (void *)(-1)) warning("unsupported conversion from '%s' in shellexec_wcc.c", from); if(expand) inbuf = R_ExpandFileName(CHAR(fn)); else inbuf = CHAR(fn); inb = strlen(inbuf)+1; outb = 2*BSIZE; outbuf = (char *) filename; res = Riconv(obj, &inbuf , &inb, &outbuf, &outb); Riconv_close(obj); if(inb > 0) warning("file name conversion problem -- name too long?"); if(res == -1) warning("file name conversion problem"); return filename; } /* End of filenameToWchar_wcc(). */ /* From R-devel\src\gnuwin32\extra.c */ #ifdef WIN static inline void internal_shellexecW_wcc(const wchar_t * file, Rboolean rhome, int C_SW_cmd){ const wchar_t *home; wchar_t home2[10000], *p; uintptr_t ret; if(rhome){ home = _wgetenv(L"R_HOME"); if(home == NULL) warning("R_HOME not set"); wcsncpy(home2, home, 10000); for(p = home2; *p; p++) if(*p == L'/') *p = L'\\'; home = home2; } else{ home = NULL; } ret = (uintptr_t) ShellExecuteW(NULL, L"open", file, NULL, home, C_SW_cmd); if(ret <= 32){ /* an error condition */ if(ret == ERROR_FILE_NOT_FOUND || ret == ERROR_PATH_NOT_FOUND || ret == SE_ERR_FNF || ret == SE_ERR_PNF) warning("'%ls' not found", file); if(ret == SE_ERR_ASSOCINCOMPLETE || ret == SE_ERR_NOASSOC) warning("file association for '%ls' not available or invalid", file); if(ret == SE_ERR_ACCESSDENIED || ret == SE_ERR_SHARE) warning("access to '%ls' denied", file); warning("problem in displaying '%ls'", file); } } /* End of internal_shellexecW_wcc().*/ #endif /* From R-devel\src\main\names.c and R-devel\src\gnuwin32\extra.c */ SEXP shellexec_wcc(SEXP R_file, SEXP R_SW_cmd){ /* Possible values of R_SW_cmd, see MS website for details. * https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx * * SW_SHOW (5) * Activates the window and displays it in its current size * and position. * * SW_SHOWMINIMIZED (2) * Activates the window and displays it as a minimized window. * * SW_SHOWMINNOACTIVE (7) * Displays the window as a minimized window. * The active window remains active. * * SW_SHOWNA (8) * Displays the window in its current state. * The active window remains active. */ #ifdef WIN internal_shellexecW_wcc( filenameToWchar_wcc(STRING_ELT(R_file, 0), FALSE), FALSE, INTEGER(R_SW_cmd)[0]); #endif return(R_NilValue); } /* End of shellexec_wcc(). */ pbdZMQ/src/R_zmq_utility.c0000644000176200001440000000165613271756337015243 0ustar liggesusers#include "R_zmq.h" /* Internal. */ SEXP AsInt(int C_x){ SEXP R_x; PROTECT(R_x = allocVector(INTSXP, 1)); INTEGER(R_x)[0] = C_x; UNPROTECT(1); return(R_x); } /* End of AsInt(). */ /* Error related. */ SEXP R_zmq_strerror(SEXP R_errno){ SEXP R_strerror; PROTECT(R_strerror = allocVector(STRSXP, 1)); SET_STRING_ELT(R_strerror, 0, mkChar(zmq_strerror(INTEGER(R_errno)[0]))); UNPROTECT(1); return(R_strerror); } /* End of R_zmq_strerror(). */ /* Version. */ SEXP R_zmq_version(){ int major, minor, patch; /* (10 bytes for int + 1 byte for sign) * 3 + 2 dots + 1 NUL */ char ver[36]; int chars; SEXP ret; zmq_version(&major, &minor, &patch); //Rprintf("Current ZeroMQ version is %d.%d.%d\n", major, minor, patch); chars = sprintf(ver, "%d.%d.%d", major, minor, patch); ret = PROTECT(allocVector(STRSXP, 1)); SET_STRING_ELT(ret, 0, mkCharLen(ver, chars)); UNPROTECT(1); return(ret); } /* End of R_zmq_version(). */ pbdZMQ/src/install.libs.R0000644000176200001440000000675313260234554014736 0ustar liggesusers### Modified from Rserve/src/install.libs.R ### For libs files <- c("pbdZMQ.so", "pbdZMQ.so.dSYM", "pbdZMQ.dylib", "pbdZMQ.dll", "symbols.rds", "libzmq.so", "libzmq.so.dSYM", "libzmq.dll") files <- files[file.exists(files)] lib.osx <- list.files(pattern = "libzmq\\.(.*)\\.dylib") files <- c(files, lib.osx) if(length(files) > 0){ libsarch <- if (nzchar(R_ARCH)) paste("libs", R_ARCH, sep='') else "libs" dest <- file.path(R_PACKAGE_DIR, libsarch) dir.create(dest, recursive = TRUE, showWarnings = FALSE) file.copy(files, dest, overwrite = TRUE, recursive = TRUE) ### For Mac OSX and when "internal ZMQ" is asked. ### Overwrite RPATH from the shared library installed to the destination. if(Sys.info()[['sysname']] == "Darwin" && length(lib.osx) > 0){ cmd.int <- system("which install_name_tool", intern = TRUE) cmd.ot <- system("which otool", intern = TRUE) fn.pbdZMQ.so <- file.path(dest, "pbdZMQ.so") if(length(lib.osx) != 1){ print(lib.osx) stop("More than one libzmq.*.dylib are found.") } else{ fn.libzmq.dylib <- file.path(dest, lib.osx) if(file.exists(fn.pbdZMQ.so) && file.exists(fn.libzmq.dylib)){ ### For pbdZMQ.so rpath <- system(paste(cmd.ot, " -L ", fn.pbdZMQ.so, sep = ""), intern = TRUE) cat("\nBefore install_name_tool (install.libs.R & pbdZMQ.so):\n") print(rpath) cmd <- paste(cmd.int, " -id ", fn.pbdZMQ.so, " ", fn.pbdZMQ.so, sep = "") cat("\nIn install_name_tool (install.libs.R & pbdZMQ.so & id):\n") print(cmd) system(cmd) str.lib <- paste("zmq/lib/", lib.osx, sep = "") org <- file.path(getwd(), str.lib) cmd <- paste(cmd.int, " -change ", org, " @loader_path/", lib.osx, " ", fn.pbdZMQ.so, sep = "") cat("\nIn install_name_tool (install.libs.R & pbdZMQ.so & path):\n") print(cmd) system(cmd) rpath <- system(paste(cmd.ot, " -L ", fn.pbdZMQ.so, sep = ""), intern = TRUE) cat("\nAfter install_name_tool (install.libs.R & pbdZMQ.so):\n") print(rpath) ### For libzmq.dylib rpath <- system(paste(cmd.ot, " -L ", fn.libzmq.dylib, sep = ""), intern = TRUE) cat("\nBefore install_name_tool (install.libs.R & libzmq.dylib):\n") print(rpath) cmd <- paste(cmd.int, " -id ", fn.libzmq.dylib, " ", fn.libzmq.dylib, sep = "") cat("\nIn install_name_tool (install.libs.R & libzmq.dylib & id):\n") print(cmd) system(cmd) rpath <- system(paste(cmd.ot, " -L ", fn.libzmq.dylib, sep = ""), intern = TRUE) cat("\nAfter install_name_tool (install.libs.R & libzmq.dylib):\n") print(rpath) } } } } ### For etc file <- "Makeconf" if(file.exists(file)){ etcarch <- if (nzchar(R_ARCH)) paste("etc", R_ARCH, sep='') else "etc" dest <- file.path(R_PACKAGE_DIR, etcarch) dir.create(dest, recursive = TRUE, showWarnings = FALSE) file.copy(file, dest, overwrite = TRUE) } ### For zmq and pbdZMQ include dir.zmq <- "./zmq" if(file.exists(dir.zmq)){ libarch <- if (nzchar(R_ARCH)) paste("zmq", R_ARCH, sep='') else "zmq" dest <- file.path(R_PACKAGE_DIR, libarch) dir.create(dest, recursive = TRUE, showWarnings = FALSE) files <- paste(dir.zmq, "/include" , sep = "") file.copy("./R_zmq.h", files) file.copy(files, dest, overwrite = TRUE, recursive = TRUE) } pbdZMQ/src/R_zmq_sendrecv.c0000644000176200001440000000633213271756337015345 0ustar liggesusers#include "R_zmq.h" /* Send related. */ SEXP R_zmq_send(SEXP R_socket, void *C_buf, SEXP R_len, SEXP R_flags){ int C_ret = -1, C_errno, C_flags = INTEGER(R_flags)[0]; void *C_socket = R_ExternalPtrAddr(R_socket); size_t C_len = (size_t) INTEGER(R_len)[0]; if(C_socket != NULL){ C_ret = zmq_send(C_socket, C_buf, C_len, C_flags); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_send errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } } else{ warning("R_zmq_send: C_socket is not available.\n"); } return(AsInt(C_ret)); } /* End of R_zmq_send(). */ SEXP R_zmq_send_char(SEXP R_socket, SEXP R_buf, SEXP R_len, SEXP R_flags){ return(R_zmq_send(R_socket, (void *) CHARPT(R_buf, 0), R_len, R_flags)); } /* End of R_zmq_send_char(). */ SEXP R_zmq_send_raw(SEXP R_socket, SEXP R_buf, SEXP R_len, SEXP R_flags){ return(R_zmq_send(R_socket, (void *) RAW(R_buf), R_len, R_flags)); } /* End of R_zmq_send_raw(). */ /* Recv related. */ int R_zmq_recv(SEXP R_socket, void *C_buf, SEXP R_len, SEXP R_flags){ int C_ret = -1, C_errno, C_flags = INTEGER(R_flags)[0]; void *C_socket = R_ExternalPtrAddr(R_socket); size_t C_len = (size_t) INTEGER(R_len)[0]; if(C_socket != NULL){ C_ret = zmq_recv(C_socket, C_buf, C_len, C_flags); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_recv errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } } else{ warning("R_zmq_recv: C_socket is not available.\n"); } return(C_ret); } /* End of R_zmq_recv(). */ SEXP R_zmq_recv_char(SEXP R_socket, SEXP R_len, SEXP R_flags){ SEXP R_ret, R_buf, R_recv_len, R_ret_names; char *names_R_ret[] = {"buf", "len"}; void *C_buf; /* Allocate and protect storages. */ PROTECT(R_ret = allocVector(VECSXP, 2)); PROTECT(R_ret_names = allocVector(STRSXP, 2)); PROTECT(R_buf = allocVector(STRSXP, 1)); PROTECT(R_recv_len = allocVector(INTSXP, 1)); /* Receive buffer. */ C_buf = (void *) Calloc(INTEGER(R_len)[0], char); INTEGER(R_recv_len)[0] = R_zmq_recv(R_socket, C_buf, R_len, R_flags); SET_STRING_ELT(R_buf, 0, mkChar(C_buf)); /* Set the elements and names. */ SET_VECTOR_ELT(R_ret, 0, R_buf); SET_VECTOR_ELT(R_ret, 1, R_recv_len); SET_STRING_ELT(R_ret_names, 0, mkChar(names_R_ret[0])); SET_STRING_ELT(R_ret_names, 1, mkChar(names_R_ret[1])); setAttrib(R_ret, R_NamesSymbol, R_ret_names); /* Return. */ UNPROTECT(4); Free(C_buf); return(R_ret); } /* End of R_zmq_recv_char(). */ SEXP R_zmq_recv_raw(SEXP R_socket, SEXP R_len, SEXP R_flags){ SEXP R_ret, R_buf, R_recv_len, R_ret_names; char *names_R_ret[] = {"buf", "len"}; /* Allocate and protect storages. */ PROTECT(R_ret = allocVector(VECSXP, 2)); PROTECT(R_ret_names = allocVector(STRSXP, 2)); PROTECT(R_buf = allocVector(RAWSXP, INTEGER(R_len)[0])); PROTECT(R_recv_len = allocVector(INTSXP, 1)); /* Receive buffer. */ INTEGER(R_recv_len)[0] = R_zmq_recv(R_socket, (void *) RAW(R_buf), R_len, R_flags); /* Set the elements and names. */ SET_VECTOR_ELT(R_ret, 0, R_buf); SET_VECTOR_ELT(R_ret, 1, R_recv_len); SET_STRING_ELT(R_ret_names, 0, mkChar(names_R_ret[0])); SET_STRING_ELT(R_ret_names, 1, mkChar(names_R_ret[1])); setAttrib(R_ret, R_NamesSymbol, R_ret_names); /* Return. */ UNPROTECT(4); return(R_ret); } /* End of R_zmq_recv_raw(). */ pbdZMQ/src/chmod_zmq.inc0000644000176200001440000000044713260234554014663 0ustar liggesuserschmod +x ./zmqsrc/autogen.sh chmod +x ./zmqsrc/configure chmod +x ./zmqsrc/version.sh chmod +x ./zmqsrc/config/compile chmod +x ./zmqsrc/config/config.guess chmod +x ./zmqsrc/config/config.sub chmod +x ./zmqsrc/config/depcomp chmod +x ./zmqsrc/config/install-sh chmod +x ./zmqsrc/config/missing pbdZMQ/src/build_zmq_linux.inc0000644000176200001440000000323113260234554016101 0ustar liggesusers### This file contains steps that pre-build ZeroMQ 4.2.2 source for linux. ### The pre-build ZeroMQ source is only for CRAN and tested under xubuntu. ### ### Wei-Chen Chen 12/23/2017 rm -rf zeromq-4.2.2 tar zxvf zeromq-4.2.2.tar.gz cd zeromq-4.2.2 ### Remove rm -rf AUTHORS ChangeLog CMakeLists.txt COPYING* foreign INSTALL rm -rf MAINTAINERS NEWS perf tools tests FindSodium.cmake rm -rf doc builds cp ../4.1.0-rc1/zzz.cpp ./src cp ../cppzmq-master/zmq*.hpp ./include ### Disable all sed -i "/doc\/Makefile/i \]\)" configure.ac sed -i "689,691 s/^/# /" configure.ac sed -i "s/SUBDIRS = .*/SUBDIRS = /" Makefile.am sed -i "/src\/zmq_draft.h/ s/$/ \\\/" Makefile.am sed -i "/src\/zmq_draft.h/ s/$/\n\tsrc\/zzz.cpp/" Makefile.am sed -i "/include\/zmq_utils.h/ s/$/ \\\/" Makefile.am sed -i "/include\/zmq_utils.h/ s/$/\n\tinclude\/zmq_addon.hpp/" Makefile.am sed -i "/include\/zmq_utils.h/ s/$/\n\tinclude\/zmq.hpp \\\/" Makefile.am sed -i "s/config\/lt\~obsolete.m4/config\/lt_obsolete.m4/" aclocal.m4 mv ./config/lt~obsolete.m4 ./config/lt_obsolete.m4 ### Reconfigure aclocal autoconf automake rm -rf autom4te.cache rm -rf /home/snoweye/work-my/tmp_pbd/pbdZMQ/pbdZMQ/src/zmqsrc cp -R ./ /home/snoweye/work-my/tmp_pbd/pbdZMQ/pbdZMQ/src/zmqsrc ### Test CPPFLAGS="-I/home/snoweye/work-my/local/R-devel/lib/R/include/" \ ./configure \ --prefix=/home/snoweye/work-my/tmp_pbd/pbdZMQ/pbdZMQ/src/zmq \ --enable-static=no \ --enable-shared=yes \ --without-docs \ --without-documentation \ --disable-pedantic \ --disable-eventfd \ --disable-perf \ --disable-curve-keygen \ --disable-curve # make -j 4 # make install # make distclean # cd ../ pbdZMQ/src/R_zmq_message.c0000644000176200001440000000604013271756337015154 0ustar liggesusers#include "R_zmq.h" /* Message related. */ /* Use R level reg.finalizer to handle this and avoid seg. fault. static void msg_Finalizer(SEXP R_msg_t){ }*/ /* End of msg_Finalizer(). */ SEXP R_zmq_msg_init(){ SEXP R_msg_t = R_NilValue; int C_ret = -1, C_errno; zmq_msg_t C_msg_t; C_ret = zmq_msg_init(&C_msg_t); if(C_ret != -1){ PROTECT(R_msg_t = R_MakeExternalPtr((void *) &C_msg_t, R_NilValue, R_NilValue)); // R_Register(R_msg_t, msg_Finalizer, TRUE); UNPROTECT(1); } else{ C_errno = zmq_errno(); Rprintf("R_zmq_msg_init errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } return(R_msg_t); } /* End of R_zmq_init(). */ SEXP R_zmq_msg_close(SEXP R_msg_t){ int C_ret = -1, C_errno; zmq_msg_t *C_msg_t = R_ExternalPtrAddr(R_msg_t); if(C_msg_t == NULL){ return(R_NilValue); } C_ret = zmq_msg_close(C_msg_t); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_msg_close errno: %d stderror: %s\n", C_errno, zmq_strerror(C_errno)); } return(AsInt(C_ret)); } /* End of R_zmq_msg_close(). */ SEXP R_zmq_msg_send(SEXP R_rmsg, SEXP R_socket, SEXP R_flags){ int C_rmsg_length = LENGTH(R_rmsg); int C_ret = -1, C_errno, C_flags = INTEGER(R_flags)[0]; void *C_socket = R_ExternalPtrAddr(R_socket); zmq_msg_t msg; if(C_socket != NULL){ C_ret = zmq_msg_init_size(&msg, C_rmsg_length); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_msg_init_size errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } memcpy(zmq_msg_data(&msg), RAW(R_rmsg), C_rmsg_length); C_ret = zmq_msg_send(&msg, C_socket, C_flags); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_msg_send errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } C_ret = zmq_msg_close(&msg); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_msg_close errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } } else{ warning("R_zmq_send: C_socket is not available.\n"); } return(R_NilValue); } /* End of R_zmq_msg_send(). */ SEXP R_zmq_msg_recv(SEXP R_socket, SEXP R_flags){ SEXP R_rmsg = R_NilValue; int C_rmsg_length; int C_ret = -1, C_errno, C_flags = INTEGER(R_flags)[0]; void *C_socket = R_ExternalPtrAddr(R_socket); zmq_msg_t msg; if(C_socket != NULL){ C_ret = zmq_msg_init(&msg); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_msg_init errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } C_ret = zmq_msg_recv(&msg, C_socket, C_flags); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_msg_recv errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } C_rmsg_length = zmq_msg_size(&msg); PROTECT(R_rmsg = allocVector(RAWSXP, C_rmsg_length)); memcpy(RAW(R_rmsg), zmq_msg_data(&msg), C_rmsg_length); C_ret = zmq_msg_close(&msg); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_msg_close errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } UNPROTECT(1); return(R_rmsg); } else{ warning("R_zmq_send: C_socket is not available.\n"); } return(R_rmsg); } /* End of R_zmq_msg_recv(). */ pbdZMQ/src/zzz.c0000644000176200001440000000336513271756337013224 0ustar liggesusers#include #include #include "R_zmq.h" static const R_CallMethodDef callMethods[] = { /* In file "R_zmq_context.c". */ {"R_zmq_ctx_new", (DL_FUNC) &R_zmq_ctx_new, 0}, {"R_zmq_ctx_destroy", (DL_FUNC) &R_zmq_ctx_destroy, 1}, /* In file "R_zmq_socket.c". */ {"R_zmq_socket", (DL_FUNC) &R_zmq_socket, 2}, {"R_zmq_close", (DL_FUNC) &R_zmq_close, 1}, {"R_zmq_bind", (DL_FUNC) &R_zmq_bind, 2}, {"R_zmq_connect", (DL_FUNC) &R_zmq_connect, 2}, {"R_zmq_setsockopt", (DL_FUNC) &R_zmq_setsockopt, 4}, {"R_zmq_getsockopt", (DL_FUNC) &R_zmq_getsockopt, 4}, /* In file "R_zmq_message.c". */ {"R_zmq_msg_init", (DL_FUNC) &R_zmq_msg_init, 0}, {"R_zmq_msg_close", (DL_FUNC) &R_zmq_msg_close, 1}, {"R_zmq_msg_send", (DL_FUNC) &R_zmq_msg_send, 3}, {"R_zmq_msg_recv", (DL_FUNC) &R_zmq_msg_recv, 2}, /* In file "R_zmq_sendrecv.c". */ {"R_zmq_send_char", (DL_FUNC) &R_zmq_send_char, 4}, {"R_zmq_send_raw", (DL_FUNC) &R_zmq_send_raw, 4}, {"R_zmq_recv_char", (DL_FUNC) &R_zmq_recv_char, 3}, {"R_zmq_recv_raw", (DL_FUNC) &R_zmq_recv_raw, 3}, /* In file "R_zmq_utility.c". */ {"R_zmq_strerror", (DL_FUNC) &R_zmq_strerror, 1}, {"R_zmq_version", (DL_FUNC) &R_zmq_version, 0}, /* In file "shellexec_wcc.c". */ {"shellexec_wcc", (DL_FUNC) &shellexec_wcc, 2}, /* In file "R_zmq_poll.c". */ {"R_zmq_poll", (DL_FUNC) &R_zmq_poll, 4}, {"R_zmq_poll_free", (DL_FUNC) &R_zmq_poll_free, 0}, {"R_zmq_poll_length", (DL_FUNC) &R_zmq_poll_length, 0}, {"R_zmq_poll_get_revents", (DL_FUNC) &R_zmq_poll_get_revents, 1}, /* Finish R_CallMethodDef. */ {NULL, NULL, 0} }; /* End of the callMethods[]. */ void R_init_pbdZMQ(DllInfo *info){ R_registerRoutines(info, NULL, callMethods, NULL, NULL); R_useDynamicSymbols(info, FALSE); } /* End of R_init_pbdZMQ(). */ pbdZMQ/src/R_zmq_context.c0000644000176200001440000000160613271756337015217 0ustar liggesusers#include "R_zmq.h" /* Context related. */ /* Use R level reg.finalizer to handle this and avoid seg. fault. */ SEXP R_zmq_ctx_new(){ SEXP R_context = R_NilValue; void *C_context = zmq_ctx_new(); if(C_context != NULL){ PROTECT(R_context = R_MakeExternalPtr(C_context, R_NilValue, R_NilValue)); // R_RegisterCFinalizerEx(R_context, ctx_Finalizer, TRUE); UNPROTECT(1); } else{ Rprintf("R_zmq_ctx_new: R_context is not available.\n"); } return(R_context); } /* End of Rzmq_ctx_new(). */ SEXP R_zmq_ctx_destroy(SEXP R_context){ int C_ret = -1, C_errno; void *C_context = R_ExternalPtrAddr(R_context); if(C_context == NULL){ return(R_NilValue); } C_ret = zmq_ctx_destroy(C_context); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_ctx_destroy errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } return(AsInt(C_ret)); } /* End of R_zmq_ctx_destroy(). */ pbdZMQ/src/Makevars.in0000644000176200001440000000507713271756337014326 0ustar liggesusers### R Default Makeconf MkInclude = ${R_HOME}/etc${R_ARCH}/Makeconf ### Setup R package flags and substitute by configure PKG_CPPFLAGS = @ZMQ_INCLUDE@ PKG_CFLAGS = @ZMQ_INCLUDE@ PKG_CXXFLAGS = @ZMQ_INCLUDE@ PKG_LIBS = @ZMQ_LDFLAGS@ ### Setup R source code and objects. R_OBJS = R_zmq_context.o R_zmq_socket.o R_zmq_sendrecv.o R_zmq_utility.o \ R_zmq_message.o R_zmq_transfer.o shellexec_wcc.o \ R_zmq_poll.o \ zzz.o R_ZMQ = libzmq$(SHLIB_EXT) OBJECTS = $(R_OBJS) BUILD_LIBS = $(SHLIB) @EXT_LIBS@ ### Start making here. all: $(BUILD_LIBS) @echo "GET_PKG_CONFIG = @GET_PKG_CONFIG@" >> Makeconf @echo "GET_SYSTEM_ZMQ = @GET_SYSTEM_ZMQ@" >> Makeconf @echo "PKG_CONFIG = @PKG_CONFIG@" >> Makeconf @echo "SYSTEM_ZMQ_INCLUDEDIR = @SYSTEM_ZMQ_INCLUDEDIR@" >> Makeconf @echo "SYSTEM_ZMQ_LIBDIR = @SYSTEM_ZMQ_LIBDIR@" >> Makeconf @echo "ENABLE_INTERNAL_ZMQ = @ENABLE_INTERNAL_ZMQ@" >> Makeconf @echo "INTERNAL_ZMQ_INCLUDEDIR = @INTERNAL_ZMQ_INCLUDEDIR@" >> Makeconf @echo "INTERNAL_ZMQ_LIBDIR = @INTERNAL_ZMQ_LIBDIR@" >> Makeconf @echo "EXTERNAL_ZMQ_INCLUDE = @EXTERNAL_ZMQ_INCLUDE@" >> Makeconf @echo "EXTERNAL_ZMQ_LDFLAGS = @EXTERNAL_ZMQ_LDFLAGS@" >> Makeconf @echo "ZMQ_INCLUDE = @ZMQ_INCLUDE@" >> Makeconf @echo "ZMQ_LDFLAGS = @ZMQ_LDFLAGS@" >> Makeconf @echo "EXT_LIBS = @EXT_LIBS@" >> Makeconf @echo "ZMQ_POLLER = @ZMQ_POLLER@" >> Makeconf @echo "PKG_CPPFLAGS = $(PKG_CPPFLAGS)" >> Makeconf @echo "PKG_CFLAGS = $(PKG_CFLAGS)" >> Makeconf @echo "PKG_CXXFLAGS = $(PKG_CXXFLAGS)" >> Makeconf @echo "PKG_LIBS = $(PKG_LIBS)" >> Makeconf $(SHLIB): $(OBJECTS) $(OBJECTS): @EXT_LIBS@ $(R_ZMQ): @sed -e "s#@MAKE@#${MAKE}#g" build_zmq > build_zmq.tmp && mv -f build_zmq.tmp build_zmq @sed -e "s#@CC@#${CC}#g" build_zmq > build_zmq.tmp && mv -f build_zmq.tmp build_zmq @sed -e "s#@CFLAGS@#${CFLAGS}#g" build_zmq > build_zmq.tmp && mv -f build_zmq.tmp build_zmq @sed -e "s#@LDFLAGS@#${LDFLAGS}#g" build_zmq > build_zmq.tmp && mv -f build_zmq.tmp build_zmq @sed -e "s#@CPPFLAGS@#${ALL_CPPFLAGS}#g" build_zmq > build_zmq.tmp && mv -f build_zmq.tmp build_zmq @sed -e "s#@CXX@#${CXX}#g" build_zmq > build_zmq.tmp && mv -f build_zmq.tmp build_zmq @sed -e "s#@CXXFLAGS@#${CXXFLAGS}#g" build_zmq > build_zmq.tmp && mv -f build_zmq.tmp build_zmq ( sh ./chmod_zmq.inc; cd zmqsrc; sh ../build_zmq ) mv ./zmqsrc/Makefile ./zmqsrc/Makefile.done # ( cp ./zmq/lib/libzmq$(SHLIB_EXT) ./libzmq$(SHLIB_EXT) ) ( cp ./zmq/lib/libzmq* ./ ) clean: @rm -rf *.o *.d *.rc *.so* *.dylib *.dll *.a *.lib *.la \ Makedeps Makevars Makeconf @rm -rf build_zmq zmq ( cd zmqsrc; make distclean ) pbdZMQ/src/build_zmq_mingw.inc0000644000176200001440000000263213260234554016067 0ustar liggesusers### This file contains steps that pre-build ZeroMQ 4.2.2 rc1 source for windows. ### The pre-build ZeroMQ source is only for CRAN and tested under Rtools31. ### ### Wei-Chen Chen 12/22/2017 ### Install R-devel ### Install Rtool34 which should have Rtools\mingw_32 and Rtools\mingw_64 # SET RHOME=C:\Program Files\R\R-devel # SET RTOOLS=C:\Rtools\bin\ # IF NOT DEFINED PATH_ORG SET PATH_ORG=%PATH% # SET PATH=%RHOME%;%RTOOLS%;%PATH_ORG% ### tar and gzip are available from Rtools34. tar zxvf zeromq-4.2.2.tar.gz ### Copy to pbdZMQ rm -rf C:/Users/snoweye/Desktop/DESKTOP-MY/R_Packages/13_pbdZMQ/pbdZMQ/src/zmqsrc.win* cp -Rf zeromq-4.2.2/builds/mingw32 C:/Users/snoweye/Desktop/DESKTOP-MY/R_Packages/13_pbdZMQ/pbdZMQ/src/zmqsrc.win cd C:/Users/snoweye/Desktop/DESKTOP-MY/R_Packages/13_pbdZMQ/pbdZMQ/src/zmqsrc.win mv Makefile.mingw32 Makefile ### Change Makefile sed -i "1 s/^/include ..\/Makeconf\n\n/" Makefile sed -i "s/^CC=gcc/CC=\$(MY_CC)/" Makefile sed -i "/^CFLAGS=/ s/$/ \$(R_XTRA_CPPFLAGS)/" Makefile sed -i "/^LIBS=/ s/$/ \$(PKG_LIBS_ZMQ)/" Makefile sed -i "s/ -g / /" Makefile sed -i "s/ -lsodium//" Makefile sed -i "/ dgram.o/ s/$/ zzz.o/" Makefile sed -i "s/%.o: ..\/..\//%.o: ..\/zmqsrc\//" Makefile sed -i "s/g++ -shared -static /\$(MY_CXX) -shared /" Makefile sed -i "s/ -Wl,--out-implib,\$@.a / /" Makefile ### Change platform.hpp sed -i "s/#define ZMQ_USE_LIBSODIUM/\/\/ #define ZMQ_USE_LIBSODIUM/" platform.hpp pbdZMQ/src/R_zmq_socket.c0000644000176200001440000001123713271756337015024 0ustar liggesusers#include "R_zmq.h" /* Socket related. */ /* Use R level reg.finalizer to handle this and avoid seg. fault. */ SEXP R_zmq_socket(SEXP R_context, SEXP R_type){ SEXP R_socket = R_NilValue; int C_type = INTEGER(R_type)[0]; void *C_context = R_ExternalPtrAddr(R_context); void *C_socket; if(C_context != NULL){ C_socket = zmq_socket(C_context, C_type); if(C_socket != NULL){ PROTECT(R_socket = R_MakeExternalPtr(C_socket, R_NilValue, R_NilValue)); // R_RegisterCFinalizerEx(R_socket, socket_Finalizer, TRUE); UNPROTECT(1); } else{ warning("R_zmq_socket: R_socket is not available.\n"); } } else{ warning("R_zmq_socket: C_context is not available.\n"); } return(R_socket); } /* End of R_zmq_socket(). */ SEXP R_zmq_close(SEXP R_socket){ int C_ret = -1, C_errno; void *C_socket = R_ExternalPtrAddr(R_socket); if(C_socket == NULL){ return(R_NilValue); } C_ret = zmq_close(C_socket); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_socket_close errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } return(AsInt(C_ret)); } /* End of R_zmq_close(). */ SEXP R_zmq_bind(SEXP R_socket, SEXP R_endpoint){ int C_ret = -1, C_errno; void *C_socket = R_ExternalPtrAddr(R_socket); const char *C_endpoint = CHARPT(R_endpoint, 0); if(C_socket != NULL){ C_ret = zmq_bind(C_socket, C_endpoint); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_bind errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } } else{ warning("R_zmq_bind: C_socket is not available.\n"); } return(AsInt(C_ret)); } /* End of R_zmq_bind(). */ SEXP R_zmq_connect(SEXP R_socket, SEXP R_endpoint){ int C_ret = -1, C_errno; void *C_socket = R_ExternalPtrAddr(R_socket); const char *C_endpoint = CHARPT(R_endpoint, 0); if(C_socket != NULL){ C_ret = zmq_connect(C_socket, C_endpoint); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_connect errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } } else{ warning("R_zmq_connect: C_socket is not available.\n"); } return(AsInt(C_ret)); } /* End of R_zmq_connect(). */ SEXP R_zmq_disconnect(SEXP R_socket, SEXP R_endpoint){ int C_ret = -1, C_errno; void *C_socket = R_ExternalPtrAddr(R_socket); const char *C_endpoint = CHARPT(R_endpoint, 0); if(C_socket != NULL){ C_ret = zmq_disconnect(C_socket, C_endpoint); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_disconnect errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } } else{ warning("R_zmq_disconnect: C_socket is not available.\n"); } return(AsInt(C_ret)); } /* End of R_zmq_disconnect(). */ SEXP R_zmq_setsockopt(SEXP R_socket, SEXP R_option_name, SEXP R_option_value, SEXP R_option_type){ int C_ret = -1, C_errno; int C_option_name = INTEGER(R_option_name)[0]; int C_option_type = INTEGER(R_option_type)[0]; void *C_socket = R_ExternalPtrAddr(R_socket); void *C_option_value; size_t C_option_len; if(C_socket != NULL){ switch(C_option_type){ case 0: C_option_value = (void *) CHARPT(R_option_value, 0); C_option_len = strlen(C_option_value); break; case 1: C_option_value = (void *) INTEGER(R_option_value); C_option_len = sizeof(int); break; default: error("C_option_type: %d is not implemented.\n", C_option_type); } // End of switch(). C_ret = zmq_setsockopt(C_socket, C_option_name, C_option_value, C_option_len); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_setsockopt errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } } else{ warning("R_zmq_setsockopt: C_socket is not available.\n"); } return(AsInt(C_ret)); } /* End of R_zmq_setsockopt(). */ SEXP R_zmq_getsockopt(SEXP R_socket, SEXP R_option_name, SEXP R_option_value, SEXP R_option_type){ int C_ret = -1, C_errno; int C_option_name = INTEGER(R_option_name)[0]; int C_option_type = INTEGER(R_option_type)[0]; void *C_socket = R_ExternalPtrAddr(R_socket); void *C_option_value; size_t C_option_len; if(C_socket != NULL){ switch(C_option_type){ case 0: C_option_value = (void *) CHARPT(R_option_value, 0); C_option_len = strlen(C_option_value); break; case 1: C_option_value = (void *) INTEGER(R_option_value); C_option_len = sizeof(int); break; default: error("C_option_type: %d is not implemented.\n", C_option_type); } // End of switch(). C_ret = zmq_getsockopt(C_socket, C_option_name, C_option_value, &C_option_len); if(C_ret == -1){ C_errno = zmq_errno(); Rprintf("R_zmq_getsockopt errno: %d strerror: %s\n", C_errno, zmq_strerror(C_errno)); } } else{ warning("R_zmq_getsockopt: C_socket is not available.\n"); } return(AsInt(C_ret)); } /* End of R_zmq_getsockopt(). */ pbdZMQ/src/R_zmq.h0000644000176200001440000000350513271756337013460 0ustar liggesusers#ifndef __R_ZMQ__ #define __R_ZMQ__ #include #include #include "zmq.h" /* Obtain character pointers. */ #define CHARPT(x,i) ((char*)CHAR(STRING_ELT(x,i))) /* Context related. */ // static void ctx_Finalizer(SEXP R_context); SEXP R_zmq_ctx_new(); SEXP R_zmq_ctx_destroy(SEXP R_context); /* Socket related. */ // static void socket_Finalizer(SEXP R_socket); SEXP R_zmq_socket(SEXP R_context, SEXP type); SEXP R_zmq_close(SEXP R_socket); SEXP R_zmq_bind(SEXP R_socket, SEXP R_endpoint); SEXP R_zmq_connect(SEXP R_socket, SEXP R_endpoint); SEXP R_zmq_disconnect(SEXP R_socket, SEXP R_endpoint); SEXP R_zmq_setsockopt(SEXP R_socket, SEXP R_option_name, SEXP R_option_value, SEXP R_option_type); SEXP R_zmq_getsockopt(SEXP R_socket, SEXP R_option_name, SEXP R_option_value, SEXP R_option_type); /* Message related. */ // static void msg_Finalizer(SEXP R_msg_t); SEXP R_zmq_msg_init(); SEXP R_zmq_msg_close(SEXP R_msg_t); SEXP R_zmq_msg_send(SEXP R_rmsg, SEXP R_socket, SEXP R_flags); SEXP R_zmq_msg_recv(SEXP R_socket, SEXP R_flags); /* Send and receive related. */ SEXP R_zmq_send(SEXP R_socket, void *C_buf, SEXP R_len, SEXP R_flags); SEXP R_zmq_send_char(SEXP R_socket, SEXP R_buf, SEXP R_len, SEXP R_flags); SEXP R_zmq_send_raw(SEXP R_socket, SEXP R_buf, SEXP R_len, SEXP R_flags); int R_zmq_recv(SEXP R_socket, void *C_buf, SEXP R_len, SEXP R_flags); SEXP R_zmq_recv_char(SEXP R_socket, SEXP R_len, SEXP R_flags); SEXP R_zmq_recv_raw(SEXP R_socket, SEXP R_len, SEXP R_flags); /* Utility related. */ SEXP AsInt(int x); SEXP R_zmq_strerror(); SEXP R_zmq_version(); /* shellexec. */ SEXP shellexec_wcc(SEXP R_file, SEXP R_SW_cmd); /* Poll related. */ SEXP R_zmq_poll(SEXP R_socket, SEXP R_type, SEXP R_timeout, SEXP R_check_eintr); SEXP R_zmq_poll_free(); SEXP R_zmq_poll_length(); SEXP R_zmq_poll_get_revents(SEXP R_index); #endif pbdZMQ/src/R_zmq_transfer.c0000644000176200001440000000710613271756337015360 0ustar liggesusers#include "R_zmq.h" #include // 200 KiB #define BUFLEN 204800 #define BARLEN 30 #define SCALE 1024 static const char *memnames[] = {"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"}; static inline int progress_init(const int verbose, double total) { int i; int ind = 0; if (!verbose) return -1; while (total >= SCALE) { total /= (double) SCALE; ind++; } Rprintf("["); for (i=0; i BUFLEN) /* Truncated data. Error? */ size = BUFLEN; total_size += size; expected_size=size; size = fwrite(buf, 1, size, outfile); if (size < expected_size) error("Could not write to file: %s", CHARPT(R_filename, 0)); progress_update(verbose, (double) total_size, filesize, ind); } while (size == BUFLEN); free(buf); fclose(outfile); Rprintf("\n"); PROTECT(ret = allocVector(INTSXP, 1)); INTEGER(ret)[0] = 0; UNPROTECT(1); return ret; } pbdZMQ/src/R_zmq_poll.c0000644000176200001440000000325213271756337014500 0ustar liggesusers#include "R_zmq.h" #include zmq_pollitem_t *PBD_POLLITEM = NULL; int PBD_POLLITEM_LENGTH = 0; /* Poll related. */ SEXP R_zmq_poll(SEXP R_socket, SEXP R_type, SEXP R_timeout, SEXP R_check_eintr){ SEXP R_x, R_pbd_pollitem; int C_ret = -1, C_errno, i; PBD_POLLITEM_LENGTH = LENGTH(R_socket); // TODO: Preallocated in R as an external pointer which can be as an // input and reused for a common poller in a while loop. No need to // allocated for each iteration. PBD_POLLITEM = (zmq_pollitem_t *) malloc(PBD_POLLITEM_LENGTH * sizeof(zmq_pollitem_t)); PROTECT(R_pbd_pollitem = R_MakeExternalPtr(PBD_POLLITEM, R_NilValue, R_NilValue)); for(i = 0; i < PBD_POLLITEM_LENGTH; i++){ PBD_POLLITEM[i].socket = R_ExternalPtrAddr(VECTOR_ELT(R_socket, i)); PBD_POLLITEM[i].events = (short) INTEGER(R_type)[i]; } C_ret = zmq_poll(PBD_POLLITEM, PBD_POLLITEM_LENGTH, (long) INTEGER(R_timeout)[0]); if(LOGICAL(R_check_eintr)[0] == TRUE){ R_CheckUserInterrupt(); } C_errno = zmq_errno(); /* Bring both C_ret and C_errno back to R. */ PROTECT(R_x = allocVector(INTSXP, 2)); INTEGER(R_x)[0] = C_ret; INTEGER(R_x)[1] = C_errno; UNPROTECT(2); return(R_x); } /* End of R_zmq_poll(). */ SEXP R_zmq_poll_free(){ if(PBD_POLLITEM_LENGTH != 0){ free(PBD_POLLITEM); PBD_POLLITEM = NULL; PBD_POLLITEM_LENGTH = 0; } return(R_NilValue); } /* End of R_zmq_poll_free(). */ SEXP R_zmq_poll_length(){ return(AsInt(PBD_POLLITEM_LENGTH)); } /* End of R_zmq_poll_length(). */ SEXP R_zmq_poll_get_revents(SEXP R_index){ int C_ret, C_index = INTEGER(R_index)[0]; C_ret = (int) PBD_POLLITEM[C_index].revents; return(AsInt(C_ret)); } /* End of R_zmq_poll_get_revents(). */ pbdZMQ/src/build_zmq.in0000644000176200001440000000330513260234554014521 0ustar liggesusers#!/bin/sh removeFlags(){ # sed -e "s/-g //g" -e "s/-f[Pp][Ii][Cc] //g" -e "s/-w //g" -e "s/-O\?[0-9] //g" $1 sed -e "s/-f[Pp][Ii][Cc] //g" -e "s/-w //g" $1 } ### Change make and flags. MY_MAKE=`echo '@MAKE@'` MY_CC=`echo '@CC@' | sed -e "s/ -std=gnu99//"` MY_CFLAGS=`echo '@CFLAGS@' | removeFlags` MY_LDFLAGS=`echo '@LDFLAGS@' | removeFlags` MY_CPPFLAGS=`echo '@CPPFLAGS@' | removeFlags` MY_CXX=`echo '@CXX@'` MY_CXXFLAGS=`echo '@CXXFLAGS@' | removeFlags` MY_POLLER=`echo '@ZMQ_POLLER@'` echo "MY_MAKE = '${MY_MAKE}'" > ../Makeconf echo "MY_CC = '${MY_CC}'" >> ../Makeconf echo "MY_CFLAGAS = '${MY_CFLAGS}'" >> ../Makeconf echo "MY_LDFLAGAS = '${MY_LDFLAGS}'" >> ../Makeconf echo "MY_CPPFLAGAS = '${MY_CPPFLAGS}'" >> ../Makeconf echo "MY_CXX = '${MY_CXX}'" >> ../Makeconf echo "MY_CXXFLAGAS = '${MY_CXXFLAGS}'" >> ../Makeconf echo "MY_POLLER = '${MY_POLLER}'" >> ../Makeconf ### Configure zmq. MY_PREFIX_DIR=`pwd | sed -e "s/zmqsrc$/zmq/"` CC="${MY_CC}" \ CFLAGS="${MY_CFLAGS}" \ LDFLAGS="${MY_LDFLAGS}" \ CPPFLAGS="${MY_CPPFLAGS}" \ CXX="${MY_CXX}" \ CXXFLAGS="${MY_CXXFLAGS}" \ ./configure \ --prefix="${MY_PREFIX_DIR}" \ --with-poller="${MY_POLLER}" \ --enable-static=no \ --enable-shared=yes \ --without-docs \ --without-documentation \ --disable-pedantic \ --disable-eventfd \ --disable-perf \ --disable-curve-keygen \ --disable-curve # --with-pic=PIC # --without-libsodium ### Assign zmq informaton, make, and install. MY_ZMQ_DIR=`pwd` echo "MY_ZMQ_DIR = '${MY_ZMQ_DIR}'" >> ../Makeconf ${MY_MAKE} ### Install ${MY_MAKE} install # rm -rf ../../zmq # mkdir ../../zmq # mkdir ../../zmq/include # mkdir ../../zmq/lib # cp ../include/* ../../zmq/include # cp ./libzmq.* ../../zmq/lib pbdZMQ/src/Makevars.win0000644000176200001440000000271513271756337014511 0ustar liggesusers### Rscript R_SCMD = ${R_HOME}/bin${R_ARCH_BIN}/Rscript -e ### Default Makeconf MkInclude = ${R_HOME}/etc${R_ARCH}/Makeconf ### Setup R package flags. PKG_CPPFLAGS = -I./zmqsrc/include -DWIN PKG_CFLAGS = -I./zmqsrc/include PKG_CXXFLAGS = -I./zmqsrc/include PKG_LIBS_ZMQ = -liphlpapi -lrpcrt4 -lws2_32 -lstdc++ ${LIBR} PKG_LIBS = -L./ -lzmq ${PKG_LIBS_ZMQ} ### Setup R source code and objects. R_SRCS_C = $(wildcard *.c) R_OBJS = $(R_SRCS_C:.c=.o) R_ZMQ = ./libzmq.dll OBJECTS = $(R_OBJS) ### Start making here. all: Makeconf $(SHLIB) userLibrary @$(CP) ../R/windows/zzz.r ../R/ Makeconf: $(ECHO) 'MY_CC = $(CC)' >> Makeconf $(ECHO) 'MY_CXX = $(CXX)' >> Makeconf $(ECHO) 'PKG_CPPFLAGS = $(PKG_CPPFLAGS)' >> Makeconf $(ECHO) 'PKG_CFLAGS = $(PKG_CFLAGS)' >> Makeconf $(ECHO) 'PKG_CXXFLAGS = $(PKG_CXXFLAGS)' >> Makeconf $(ECHO) 'PKG_LIBS = $(PKG_LIBS)' >> Makeconf $(ECHO) 'PKG_LIBS_ZMQ = $(PKG_LIBS_ZMQ)' >> Makeconf $(ECHO) 'R_ZMQ_INC = zmq${R_ARCH}/include/' >> Makeconf $(ECHO) 'R_ZMQ_LIB = libs${R_ARCH}/' >> Makeconf $(ECHO) 'R_XTRA_CPPFLAGS = ${R_XTRA_CPPFLAGS}' >> Makeconf $(SHLIB): $(OBJECTS) userLibrary: $(SHLIB) $(R_ZMQ) $(R_OBJS): $(R_ZMQ) $(R_ZMQ): Makeconf ( cd ./zmqsrc.win; $(MAKE) all ) $(CP) ./zmqsrc.win/libzmq.dll ./ $(MKDIR) ./zmq $(MKDIR) ./zmq/include $(CP) ./zmqsrc/include/* ./zmq/include clean: @$(RM) -rf *.o *.d *.rc *.so* *.dll *.dylib *.a *.lib *.la \ Makedeps Makevars Makeconf $(SHLIB) $(OBJECTS) \ zmq pbdZMQ/src/pkg.m40000644000176200001440000001212013260234554013221 0ustar liggesusers# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$PKG_CONFIG"; then if test -n "$$1"; then pkg_cv_[]$1="$$1" else PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) fi else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` else $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT ])], [$4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES pbdZMQ/NAMESPACE0000644000176200001440000000202113260234554012625 0ustar liggesusers# Generated by roxygen2: do not edit by hand export(.zmqopt_get) export(.zmqopt_init) export(.zmqopt_set) export(ZMQ.MC) export(ZMQ.PO) export(ZMQ.SO) export(ZMQ.SR) export(ZMQ.ST) export(address) export(bind.socket) export(connect.socket) export(get.pbdZMQ.ldflags) export(get.zmq.cppflags) export(get.zmq.ldflags) export(init.context) export(init.socket) export(ls) export(overwrite.shpkg.rpath) export(pbd_opt) export(random_open_port) export(random_port) export(receive.socket) export(send.socket) export(test.load.zmq) export(zmq.bind) export(zmq.close) export(zmq.connect) export(zmq.ctx.destroy) export(zmq.ctx.new) export(zmq.disconnect) export(zmq.getsockopt) export(zmq.msg.recv) export(zmq.msg.send) export(zmq.poll) export(zmq.poll.free) export(zmq.poll.get.revents) export(zmq.poll.length) export(zmq.recv) export(zmq.recv.multipart) export(zmq.recvfile) export(zmq.send) export(zmq.send.multipart) export(zmq.sendfile) export(zmq.setsockopt) export(zmq.socket) export(zmq.strerror) export(zmq.version) importFrom(stats,runif) pbdZMQ/demo/0000755000176200001440000000000013260234554012337 5ustar liggesuserspbdZMQ/demo/iter_try.r0000644000176200001440000000105613260234554014365 0ustar liggesusers### Iterative pollers # SHELL> Rscript iter_try.r library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) zmq.connect(receiver, "tcp://localhost:5557") ### Process messages from the socket. for(i in 1:5){ cat("Press Ctrl+C or Esc to stop iter_script ... ", i, "\n", sep = "") aa <- tryCatch(zmq.poll2.interrupt(c(receiver), c(.pbd_env$ZMQ.PO$POLLIN)), interrupt = function(c){ c$ret$pollret }) print(aa) } ### Finish. zmq.close(receiver) zmq.ctx.destroy(context) pbdZMQ/demo/wuserver.r0000644000176200001440000000172613260234554014412 0ustar liggesusers### Weather updates server as in the ZeroMQ guide. # SHELL> Rscript wuserver.r & # SHELL> Rscript wuclient.r # SHELL> rm weather.ipc library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() publisher <- zmq.socket(context, .pbd_env$ZMQ.ST$PUB) zmq.bind(publisher, "tcp://*:5556") if(.Platform$OS.type != "windows"){ # Windows does not support ipc. zmq.bind(publisher, "ipc://weather.ipc") } ### Send message to all subscribers. cat("Press Ctrl+C or Esc to stop wuserver.\n") zipcodes <- c(50011, 37831, 37996, 20993, sample.int(100000, size = 5)) while(TRUE){ zipcode <- sample(zipcodes, 1) temperature <- sample.int(215, size = 1) - 80 humidity <- sample.int(50, size = 1) + 10 ret <- sprintf("%05d %d %d", zipcode, temperature, humidity) zmq.send(publisher, ret) Sys.sleep(runif(1, 0.1, 0.5)) } ### Finish. zmq.close(publisher) zmq.ctx.destroy(context) ### Remove ipc file if exists. if(file.exists("weather.ipc")){ file.remove("weather.ipc") } pbdZMQ/demo/check_eintr.r0000644000176200001440000000135013260234554014777 0ustar liggesuserslibrary(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) zmq.connect(receiver, "tcp://localhost:5557") a1 <- zmq.poll(c(receiver), .pbd_env$ZMQ.PO$POLLIN) print(a1) a2 <- tryCatch(zmq.poll(c(receiver), .pbd_env$ZMQ.PO$POLLIN), interrupt = function(c) return(9), error = function(c) return(99)) print(a2) a3 <- tryCatch(zmq.poll(c(receiver), .pbd_env$ZMQ.PO$POLLIN, MC = ZMQ.MC(check.eintr = TRUE)), interrupt = function(c) return(9), error = function(c) return(99)) print(a3) a4 <- zmq.poll(c(receiver), .pbd_env$ZMQ.PO$POLLIN, MC = ZMQ.MC(check.eintr = TRUE)) print(a4) print("This message should not be reached.") pbdZMQ/demo/taskwork.r0000644000176200001440000000146013260234554014370 0ustar liggesusers### Task workers as in the ZeroMQ guide. # SHELL> Rscript taskwork.r & # SHELL> Rscript taskvent.r; Rscript tasksink.r ### Remember to kill two worker processors at the end, such as # SHELL> ps -x|grep "file=task.*\.r"|sed "s/\(.*\) pts.*/\1/"|xargs kill -9 library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) zmq.connect(receiver, "tcp://localhost:5557") sender <- zmq.socket(context, .pbd_env$ZMQ.ST$PUSH) zmq.connect(sender, "tcp://localhost:5558") ### Process tasks forever. while(TRUE){ string <- zmq.recv(receiver) # cat(string$buf, "\n") Sys.sleep(as.integer(string$buf) / 1000) zmq.send(sender, paste("sleep", string$buf, "sec at", Sys.getpid())) } ### Finish. zmq.close(receiver) zmq.close(sender) zmq.ctx.destroy(context) pbdZMQ/demo/mspoller.r0000644000176200001440000000257413260234554014367 0ustar liggesusers### Multiple socket reader as in the ZeroMQ guide. # SHELL> Rscript wuserver.r & # SHELL> Rscript taskvent.r & # SHELL> Rscript mspoller.r # SHELL> rm weather.ipc library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) zmq.connect(receiver, "tcp://localhost:5557") subscriber <- zmq.socket(context, .pbd_env$ZMQ.ST$SUB) zmq.connect(subscriber, "tcp://localhost:5556") zmq.setsockopt(subscriber, .pbd_env$ZMQ.SO$SUBSCRIBE, "20993") ### Process messages from both sockets. cat("Press Ctrl+C or Esc to stop mspoller.\n") i.rec <- 0 i.sub <- 0 while(TRUE){ ### Set poller. poller <- zmq.poll(c(receiver, subscriber), c(.pbd_env$ZMQ.PO$POLLIN, .pbd_env$ZMQ.PO$POLLIN)) ### Check receiver. if(bitwAnd(zmq.poll.get.revents(1), .pbd_env$ZMQ.PO$POLLIN)){ ret <- zmq.recv(receiver) if(ret$len != -1){ cat("task ventilator:", ret$buf, "at", i.rec, "\n") i.rec <- i.rec + 1 } } ### Check subscriber. if(bitwAnd(zmq.poll.get.revents(2), .pbd_env$ZMQ.PO$POLLIN)){ ret <- zmq.recv(subscriber) if(ret$len != -1){ cat("weather update:", ret$buf, "at", i.sub, "\n") i.sub <- i.sub + 1 } } if(i.rec >= 5 & i.sub >= 5){ break } Sys.sleep(runif(1, 0.5, 1)) } ### Finish. zmq.poll.free() zmq.close(receiver) zmq.close(subscriber) zmq.ctx.destroy(context) pbdZMQ/demo/hwserver.r0000644000176200001440000000074113260234554014371 0ustar liggesusers### Hello world server as in the ZeroMQ guide. # SHELL> Rscript hwserver.r & # SHELL> Rscript hwclient.r library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) zmq.bind(responder, "tcp://*:5555") ### Send and receive 5 times. for(i.res in 1:5){ buf <- zmq.recv(responder, 10L) cat(buf$buf, "\n") Sys.sleep(0.5) zmq.send(responder, "World") } ### Finish. zmq.close(responder) zmq.ctx.destroy(context) pbdZMQ/demo/mpserver.r0000644000176200001440000000075413260234554014373 0ustar liggesusers### Multiple part server. # SHELL> Rscript mpserver.r & # SHELL> Rscript mpclient.r library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) zmq.bind(responder, "tcp://*:5555") ### Send and receive 5 times. ret <- zmq.recv.multipart(responder, unserialize = TRUE) parts <- as.list(rep("World", 5)) zmq.send.multipart(responder, parts) for(i in 1:5) cat(ret[[i]]) ### Finish. zmq.close(responder) zmq.ctx.destroy(context) pbdZMQ/demo/mpclient.r0000644000176200001440000000102213260234554014330 0ustar liggesusers### Multiple part client. # SHELL> Rscript mpserver.r & # SHELL> Rscript mpclient.r library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) zmq.connect(requester, "tcp://localhost:5555") ### Send and receive 5 times. parts <- lapply(1:5, function(i.req){ paste("Sending Hello ", i.req, "\n") }) zmq.send.multipart(requester, parts) ret <- zmq.recv.multipart(requester, unserialize = TRUE) print(ret) ### Finish. zmq.close(requester) zmq.ctx.destroy(context) pbdZMQ/demo/tasksink.r0000644000176200001440000000135213260234554014352 0ustar liggesusers### Task sink from two workers as in the ZeroMQ guide. # SHELL> Rscript taskwork.r & # SHELL> Rscript taskvent.r; Rscript tasksink.r ### Remember to kill two worker processors at the end, such as # SHELL> ps -x|grep "file=task.*\.r"|sed "s/\(.*\) pts.*/\1/"|xargs kill -9 library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) zmq.bind(receiver, "tcp://*:5558") ### Wait for start of batch. string <- zmq.recv(receiver) ### Process 100 confirmations. start.time <- Sys.time() for(i in 1:50){ string <- zmq.recv(receiver) cat(i, ":", string$buf, "\n") } cat("Total elapsed time:", Sys.time() - start.time, "\n") ### Finish. zmq.close(receiver) zmq.ctx.destroy(context) pbdZMQ/demo/00Index0000644000176200001440000000117713260234554013477 0ustar liggesusershwserver pbdZMQ Hello World server. hwclient pbdZMQ Hello World client. wuserver pbdZMQ Weather update server. wuclient pbdZMQ Weather update client. taskvent pbdZMQ Parallel task ventilator. taskwork pbdZMQ Parallel task worker. tasksink pbdZMQ Parallel task sink. msreader pbdZMQ Multiple socket reader. mspoller pbdZMQ Multiple socket reader using poll method. mpserver pbdZMQ Hello World server in multiple part version. mpclient pbdZMQ Hello World client in multiple part version. iter_next pbdZMQ "source('iter_next.r')" or "Rscript iter_next.r". iter_try pbdZMQ "Rscript iter_try.r". check_eintr pbdZMQ check event of interrupt. pbdZMQ/demo/msreader.r0000644000176200001440000000202513260234554014323 0ustar liggesusers### Multiple socket reader as in the ZeroMQ guide. # SHELL> Rscript wuserver.r & # SHELL> Rscript taskvent.r & # SHELL> Rscript msreader.r # SHELL> rm weather.ipc library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) zmq.connect(receiver, "tcp://localhost:5557") subscriber <- zmq.socket(context, .pbd_env$ZMQ.ST$SUB) zmq.connect(subscriber, "tcp://localhost:5556") zmq.setsockopt(subscriber, .pbd_env$ZMQ.SO$SUBSCRIBE, "20993") ### Process messages from both sockets. cat("Press Ctrl+C or Esc to stop msreader.\n") # while(TRUE){ # while(TRUE){ for(i in 1:5){ ret <- zmq.recv(receiver) if(ret$len != -1){ cat("task ventilator:", ret$buf, "\n") } else{ break } } # while(TRUE){ for(i in 1:5){ ret <- zmq.recv(subscriber) if(ret$len != -1){ cat("weather update:", ret$buf, "\n") } else{ break } } # Sys.sleep(1/1000) # } ### Finish. zmq.close(receiver) zmq.close(subscriber) zmq.ctx.destroy(context) pbdZMQ/demo/taskvent.r0000644000176200001440000000200413260234554014355 0ustar liggesusers### Task ventilator send to two workers as in the ZeroMQ guide. # SHELL> Rscript taskwork.r & # SHELL> Rscript taskvent.r; Rscript tasksink.r ### Remember to kill two worker processors at the end, such as # SHELL> ps -x|grep "file=task.*\.r"|sed "s/\(.*\) pts.*/\1/"|xargs kill -9 library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() sender <- zmq.socket(context, .pbd_env$ZMQ.ST$PUSH) zmq.bind(sender, "tcp://*:5557") sink <- zmq.socket(context, .pbd_env$ZMQ.ST$PUSH) zmq.connect(sink, "tcp://localhost:5558") ### Send sink. readline("Press Enter when workers are ready:") cat("Sending tasks to workers ...\n") zmq.send(sink, "0") ### Send 100 tasks. set.seed(1234) total.msec <- 0 for(i in 1:100){ workload <- as.integer(runif(1, 1, 30)) total.msec <- total.msec + workload string <- sprintf("%d", workload) zmq.send(sender, string) Sys.sleep(runif(1, 3, 5)) } cat("Total expected cost: ", total.msec, " msec\n", sep = "") ### Finish. zmq.close(sink) zmq.close(sender) zmq.ctx.destroy(context) pbdZMQ/demo/hwclient.r0000644000176200001440000000102213260234554014332 0ustar liggesusers### Hello world client as in the ZeroMQ guide. # SHELL> Rscript hwserver.r & # SHELL> Rscript hwclient.r library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) zmq.connect(requester, "tcp://localhost:5555") ### Send and receive 5 times. for(i.req in 1:5){ cat("Sending Hello ", i.req, "\n") zmq.send(requester, "Hello") buf <- zmq.recv(requester, 10L) cat("Received World ", i.req, "\n") } ### Finish. zmq.close(requester) zmq.ctx.destroy(context) pbdZMQ/demo/iter_next.r0000644000176200001440000000112113260234554014516 0ustar liggesusers### Iterative pollers # R> source("iter_skip.r") # or # SHELL> Rscript iter_skip.r library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) zmq.connect(receiver, "tcp://localhost:5557") ### Process messages from the socket. for(i in 1:5){ cat("Press Ctrl+C or Esc to stop iter_gui ... ", i, "\n", sep = "") aa <- zmq.poll2(c(receiver), c(.pbd_env$ZMQ.PO$POLLIN)) if(aa$pollret[1] == -1 && aa$pollret[2] == 4){ print(aa$pollret) next } print(aa) } ### Finish. zmq.close(receiver) zmq.ctx.destroy(context) pbdZMQ/demo/wuclient.r0000644000176200001440000000271713260234554014363 0ustar liggesusers### Weather updates client as in the ZeroMQ guide. # SHELL> Rscript wuserver.r & # SHELL> Rscript wuclient.r # SHELL> rm weather.ipc library(pbdZMQ, quietly = TRUE) ### Initial. cat("Collecting updates from weather server ...\n"); context <- zmq.ctx.new() subscriber <- zmq.socket(context, .pbd_env$ZMQ.ST$SUB) zmq.connect(subscriber, "tcp://localhost:5556") ### Ask for four zip codes. filters <- c("50011", "37831", "37996", "20993") for(i in 1:length(filters)){ cat("Subscribe zipcode", filters[i], "\n") zmq.setsockopt(subscriber, .pbd_env$ZMQ.SO$SUBSCRIBE, filters[i]) } ### Process weather updates. N.updates <- 30 temperature <- vector(mode = "list", length = 4) while(any(sapply(temperature, length) < N.updates)){ string <- zmq.recv(subscriber) msg <- strsplit(string$buf, " ")[[1]] # c(zipcode, temperature, humidity) # cat(msg, "\n") id <- which(msg[1] == filters) temperature[[id]] <- c(temperature[[id]], as.integer(msg[2])) if(length(temperature[[id]]) == N.updates){ ### No need to unsubscribe but demo the way how to do it. cat("Unsubscribe zipcode", filters[id], "\n", sep = " "); zmq.setsockopt(subscriber, .pbd_env$ZMQ.SO$UNSUBSCRIBE, filters[id]) } } avg.temperature <- sapply(temperature, mean) ### Print average temperature for asked zip codes. for(i in 1:length(filters)){ cat("Average temperature for zipcode", filters[i], "was", avg.temperature[i], "\n") } ### Finish. zmq.close(subscriber) zmq.ctx.destroy(context) pbdZMQ/INSTALL0000644000176200001440000001143213260234554012445 0ustar liggesusers### Read pbdZMQ vignettes "pbdZMQ-guide.pdf" first at ### "https://cran.r-project.org/package=pbdZMQ". ### ### pbdZMQ can be installed with/without external ZeroMQ 4.2.2 library ### since pbdZMQ includes a minimum requirement of ZeroMQ 4.2.2 library. ### ### pbdZMQ is also tested mainly on Linux (XUbuntu-14.04.1), Windows 7, and ### Mac OSX 10.7 systems. ### ### Solaris needs ZeroMQ 4.0.7 library with GNU Make 4.1 (OpenCSW). ### See Section for Solaris in next for installation steps and read pbdZMQ --- 'pbdZMQ' installation: 0. 'pkg-config' and system ZeroMQ library (libzmq, libzmq-dev) are requrired. 1. Default installation: > R CMD INSTALL pbdZMQ_0.3-0.tar.gz --- 'pbdZMQ' installation with internal ZeroMQ library: 1. Enable internal ZeroMQ: This should work with most platforms. > R CMD INSTALL pbdZMQ_0.3-0.tar.gz \ --configure-args="--enable-internal-zmq" --- 'pbdZMQ' installation with external ZeroMQ library such as version 4.2.2: 0. Minimum steps for installing ZeroMQ 4.2.2 shared library > ./configure \ --prefix=/usr/local/zmq \ --enable-static=no \ --enable-shared=yes \ --with-poller=select \ --without-documentation \ --without-libsodium > make -j 4; make install or ZeroMQ 4.2.2 static library > ./configure \ --prefix=/usr/local/zmq \ --with-pic=yes \ --enable-static=yes \ --enable-shared=no \ --with-poller=select \ --without-documentation \ --without-libsodium > make -j 4; make install 1. Steps for pbdZMQ with the external ZeroMQ shared library > R CMD INSTALL pbdZMQ_0.3-0.tar.gz \ --configure-vars="ZMQ_INCLUDE='-I/usr/local/zmq/include' \ ZMQ_LDFLAGS='-L/usr/local/zmq/lib -lzmq'" or with the external ZeroMQ static library > R CMD INSTALL pbdZMQ_0.3-0.tar.gz \ --configure-vars="ZMQ_INCLUDE='-I/usr/local/zmq/include' \ ZMQ_LDFLAGS='/usr/local/zmq/lib/libzmq.a'" provided the external library is installed at "/usr/local/zmq" where "include/" subdirectory contains "zmq.h" and "lib/" subdirectory contains the shared library such as "libzmq.so" or the static library such as "libzmq.a". --- Testing: Suppose 'pbdZMQ' is installed correctly. I can run the next from one terminal. > Rscript -e "demo(hwserver,'pbdZMQ',ask=F,echo=F)" & > Rscript -e "demo(hwclient,'pbdZMQ',ask=F,echo=F)" --- Installation with different polling system: By default 'select' method is used in 'pbdZMQ' for Linux, Windows, and Mac OSX. However, users may want to use 'autodetect' or try others for better polling. Currently, the options as given by ZeroMQ may be 'kqueue', 'epoll', 'devpoll', 'poll', or 'select' depending on libraries and system. > R CMD INSTALL pbdZMQ_0.3-0.tar.gz \ --configure-vars="ZMQ_POLLER='autodetect'" ### Section for Solaris --- Install OpenCSW and 'ZeroMQ 4.0.7' library: 0. Make sure GNU tools are installed including gmake, gcc, g++, autoconf, automake, gtar, etc. Usually, OpenCSW hase them at "https://www.opencsw.org/get-it/packages/" and can be installed by "pkgutil". For example, "gcc4core" can be installed by > pkgadd -d http://get.opencsw.org/now > /opt/csw/bin/pkgutil -U > /opt/csw/bin/pkgutil -y -i gcc4core > /usr/sbin/pkgchk -L CSWgcc4core # list files 1. Make sure gmake, gcc, g++, autoconf, automake are in the PATH and export it to environment. For example, I have PATH=/opt/csw/gnu:/opt/csw/bin:/opt/csw/i386-pc-solaris2.10/bin:/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/ucb export PATH I also have a symbolic link "make" to "gmake" to avoid configuration problems. If not, use "ln -s" to make one. 2. Download 'zeromq-4.0.7.tar.gz' from "http://download.zeromq.org". 3. Untar, configure, make, and make install as next: > gtar zxvf zeromq-4.0.7.tar.gz > cd zeromq-4.0.7 > ./configure --prefix=/work-my/local/zmq > make > make install where I install the ZeroMQ library to "/work-my/local/zmq". --- 'pbdZMQ' installation with external ZeroMQ library such as version 4.0.7: 1. Steps for pbdZMQ with the external ZeroMQ library. > R CMD INSTALL pbdZMQ_0.3-0.tar.gz \ --configure-vars="ZMQ_INCLUDE='-I/work-my/local/zmq/include' \ ZMQ_LDFLAGS='-L/work-my/local/zmq/lib -lzmq'" provided the external library is installed at "/work-my/local/zmq" where "include/" subdirectory contains "zmq.h" and "lib/" subdirectory contains the shared library such as "libzmq.so". --- Testing: Suppose 'pbdZMQ' is installed correctly. I can run the next from one terminal. > Rscript -e "demo(hwserver,'pbdZMQ',ask=F,echo=F)" & > Rscript -e "demo(hwclient,'pbdZMQ',ask=F,echo=F)" pbdZMQ/R/0000755000176200001440000000000013260234554011614 5ustar liggesuserspbdZMQ/R/overwrite_shpkg.r0000644000176200001440000000616613260234554015232 0ustar liggesusers#' Overwrite rpath of linked shared library in osx #' #' Overwrite rpath of linked shared library #' (e.g. \code{JuniperKernel/libs/JuniperKernel.so} #' in osx only. #' Typically, it is called by \code{.onLoad()} to update rpath if #' \code{pbdZMQ} or \code{pbdZMQ/libs/libzmq.*.dylib} was moved to #' a personal directory #' (e.g. the binary package was installed to a none default path). #' The commands \code{otool} and \code{install_name_tool} are required. #' Permission may be needed (e.g. \code{sudo}) to overwrite the shared #' library. #' #' @param mylib #' the path where \code{mypkg} was installed (default \code{NULL} that will #' search from R's path) #' @param mypkg #' the package for where \code{mypkg.so} will be checked or updated #' @param linkingto #' the package for where \code{libshpkg*.dylib} is located #' @param shlib #' name of shlib to be searched for #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' ### Called by .onLoad() within "JuniperKernel/R/zzz.R" #' overwrite.shpkg.rpath(mypkg = "JuniperKernel", #' linkingto = "pbdZMQ", #' shlib = "zmq") #' } #' #' @keywords compile #' @rdname zz_overwrite_shpkg #' @name Overwrite shpkg NULL #' @rdname zz_overwrite_shpkg #' @export overwrite.shpkg.rpath <- function(mylib = NULL, mypkg = "JuniperKernel", linkingto = "pbdZMQ", shlib = "zmq"){ if(Sys.info()[['sysname']] == "Darwin"){ cmd.ot <- system("which otool", intern = TRUE) ### Find mylib if NULL. if(is.null(mylib)){ mylib <- tools::file_path_as_absolute(system.file(package = mypkg)) } ### Get rpath from mypkg's shared library. fn.so <- paste(mylib, "/", mypkg, "/libs/", mypkg, ".so", sep = "") rpath <- system(paste(cmd.ot, " -L ", fn.so, sep = ""), intern = TRUE) ### Get the installed dylib from mypkg's rpath. ptn1 <- paste("^\\t(.*/", linkingto, "/libs/lib", shlib, ".*\\.dylib) .*$", sep = "") i.rpath <- grep(ptn1, rpath) ### 0 means external shlib was linked. ### 1 means internal shlib was built. if(length(i.rpath) == 1){ fn.dylib <- gsub(ptn1, "\\1", rpath[i.rpath]) ### Check if the file were moved to somewhere. if(!file.exists(fn.dylib)){ ### Search the new location from R's library path. dn <- tools::file_path_as_absolute( system.file("./libs", package = linkingto)) ptn2 <- paste("lib", shlib, ".*\\.dylib", sep = "") fn <- list.files(path = dn, pattern = ptn2) ### Install the new location to the mypkg's shared library. if(length(fn) == 1){ cmd.int <- system("which install_name_tool", intern = TRUE) new.fn.dylib <- paste(dn, "/", fn, sep = "") cmd <- paste(cmd.int, " -change ", fn.dylib, " ", new.fn.dylib, " ", fn.so, sep = "") system(cmd) } else{ stop("The internal shlib can not be identified in linkingto.") } } } } return(invisible()) } # End of overwrite.shpkg(). pbdZMQ/R/111_pbd_opt.r0000644000176200001440000000362613260234554014017 0ustar liggesusers#' Set controls in pbdZMQ #' #' Set control functions #' #' \code{pbd_opt()} sets pbd options for ZMQ controls. #' #' \code{...} allows multiple options in #' \code{envir$.pbd_env}, but only in a simple way. #' #' \code{bytext} allows to assign options by text in #' \code{envir$.pbd_env}, but can assign advanced objects. For example, #' \code{"option$suboption <- value"} will set #' \code{envir$.pbd_env$option$suboption <- value}. #' #' @param ... #' in argument format \code{option = value} to set #' \code{.pbd_env$option <- value} inside the \code{envir} #' @param bytext #' in text format \code{"option = value"} to set #' \code{.pbd_env$option <- value} inside the \code{envir}. #' @param envir #' by default the global environment is used. #' #' @return #' No value is returned. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com} and Drew Schmidt. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' library(pbdZMQ, quietly = TRUE) #' #' ls(.pbd_env) #' rm(.pbd_env) #' .zmqopt_init() #' ls(.pbd_env) #' #' .pbd_env$ZMQ.SR$BLOCK #' pbd_opt(bytext = "ZMQ.SR$BLOCK <- 0L") #' } #' #' @keywords programming #' @seealso \code{\link{.pbd_env}}. #' @rdname a0_b_pbd_opt #' @name Set Control Functions ### Set pbd options. #' @export #' @rdname a0_b_pbd_opt pbd_opt <- function(..., bytext = "", envir = .GlobalEnv){ if(!exists(".pbd_env", envir = envir)){ envir$.pbd_env <- new.env() } arg <- list(...) if(length(arg) > 0){ names.arg <- names(arg) if(is.null(names.arg) || any(names.arg == "")){ stop("Options are all named.") } for(i.arg in 1:length(arg)){ envir$.pbd_env[[names.arg[i.arg]]] <- arg[[i.arg]] } } if(bytext != ""){ eval(parse(text = bytext), envir = envir$.pbd_env) } invisible() } # End of pbd_opt(). pbdZMQ/R/R_zmq_sendrecv.r0000644000176200001440000001031713260234554014762 0ustar liggesusers#' Send Receive Functions #' #' Send and receive functions #' #' \code{zmq.send()} is a high level R function calling ZMQ C API #' \code{zmq_send()} sending \code{buf} out. #' #' \code{zmq.recv()} is a high level R function calling ZMQ C API #' \code{zmq_recv()} receiving buffers of length \code{len} according to the #' \code{buf.type}. #' #' \code{flags} see \code{\link{ZMQ.SR}()} for detail options of send and #' receive functions. #' #' \code{buf.type} currently supports \code{char} and \code{raw} which are both #' in R object format. #' #' @param socket #' a ZMQ socket #' @param buf #' a buffer to be sent #' @param len #' a length of buffer to be received, default 1024 bytes #' @param flags #' a flag for the method using by \code{zmq_send} and #' \code{zmq_recv} #' @param buf.type #' buffer type to be received #' #' @return \code{zmq.send()} returns number of bytes (invisible) in the sent #' message if successful, otherwise returns -1 (invisible) and sets #' \code{errno} to the error value, see ZeroMQ manual for details. #' #' \code{zmq.recv()} returns a list (\code{ret}) containing the received buffer #' \code{ret$buf} and the length of received buffer (\code{ret$len} which is #' less or equal to the input \code{len}) if successful, otherwise returns -1 #' and sets \code{errno} to the error value, see ZeroMQ manual for details. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' ### Using request-reply pattern. #' #' ### At the server, run next in background or the other window. #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) #' zmq.bind(responder, "tcp://*:5555") #' for(i.res in 1:5){ #' buf <- zmq.recv(responder, 10L) #' cat(buf$buf, "\n") #' Sys.sleep(0.5) #' zmq.send(responder, "World") #' } #' zmq.close(responder) #' zmq.ctx.destroy(context) #' #' #' ### At a client, run next in foreground. #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) #' zmq.connect(requester, "tcp://localhost:5555") #' for(i.req in 1:5){ #' cat("Sending Hello ", i.req, "\n") #' zmq.send(requester, "Hello") #' buf <- zmq.recv(requester, 10L) #' cat("Received World ", i.req, "\n") #' } #' zmq.close(requester) #' zmq.ctx.destroy(context) #' } #' #' @keywords programming #' @seealso \code{\link{zmq.msg.send}()}, \code{\link{zmq.msg.recv}()}. #' @rdname b0_sendrecv #' @name Send Receive Functions NULL #' @rdname b0_sendrecv #' @export zmq.send <- function(socket, buf, flags = .pbd_env$ZMQ.SR$BLOCK){ if(is.character(buf)){ ret <- zmq.send.char(socket, buf[1], nchar(buf[1]), flags = flags) } else if(is.raw(buf)){ ret <- zmq.send.raw(socket, buf[1], length(buf[1]), flags = flags) } else{ stop("buf type should be char or raw.") } invisible(ret) } zmq.send.char <- function(socket, buf, len, flags = .pbd_env$ZMQ.SR$BLOCK){ ret <- .Call("R_zmq_send_char", socket, buf, as.integer(len), as.integer(flags), PACKAGE = "pbdZMQ") invisible(ret) } zmq.send.raw <- function(socket, buf, len, flags = .pbd_env$ZMQ.SR$BLOCK){ ret <- .Call("R_zmq_send_raw", socket, buf, as.integer(len), as.integer(flags), PACKAGE = "pbdZMQ") invisible(ret) } #' @rdname b0_sendrecv #' @export zmq.recv <- function(socket, len = 1024L, flags = .pbd_env$ZMQ.SR$BLOCK, buf.type = c("char", "raw")){ if(buf.type[1] == "char"){ ret <- zmq.recv.char(socket, len, flags = flags) } else if(buf.type[1] == "raw"){ ret <- zmq.recv.raw(socket, len, flags = flags) } else{ stop("buf type should be char or raw.") } invisible(ret) } zmq.recv.char <- function(socket, len, flags = .pbd_env$ZMQ.SR$BLOCK){ ret <- .Call("R_zmq_recv_char", socket, as.integer(len), as.integer(flags), PACKAGE = "pbdZMQ") invisible(ret) } zmq.recv.raw <- function(socket, len, flags = .pbd_env$ZMQ.SR$BLOCK){ ret <- .Call("R_zmq_recv_raw", socket, as.integer(len), as.integer(flags), PACKAGE = "pbdZMQ") invisible(ret) } pbdZMQ/R/222_export_opt.r0000644000176200001440000000367713260234554014604 0ustar liggesusers#' Initial controls in pbdZMQ #' #' Initial control functions #' #' \code{.zmqopt_init()} initials default ZMQ controls. #' \code{.zmqopt_get()} gets a ZMQ control. #' \code{.zmqopt_set()} sets a ZMQ control. #' #' @param envir #' an environment where ZMQ controls locate #' @param val #' a value to be set #' @param main #' a variable to be get from or set to #' @param sub #' a subvariable to be get from or set to #' #' @return #' \code{.zmqopt_init()} initial the ZMQ control #' at \code{envir}. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' library(pbdZMQ, quietly = TRUE) #' #' ls(.pbd_env) #' rm(.pbd_env) #' .zmqopt_init() #' ls(.pbd_env) #' #' .pbd_env$ZMQ.SR$BLOCK #' pbd_opt(bytext = "ZMQ.SR$BLOCK = 0L") #' } #' #' @keywords programming #' @seealso \code{\link{.pbd_env}}. #' @rdname a0_c_options #' @name Initial Control Functions ### Get ZMQ options. #' @export #' @rdname a0_c_options .zmqopt_get <- function(main, sub = NULL, envir = .GlobalEnv){ if(!is.null(sub)){ envir$.pbd_env[[main]][[sub]] } else{ envir$.pbd_env[[main]] } } # End of .zmqopt_get(). ### Set ZMQ options. #' @export #' @rdname a0_c_options .zmqopt_set <- function(val, main, sub = NULL, envir = .GlobalEnv){ if(!is.null(sub)){ envir$.pbd_env[[main]][[sub]] <- val } else{ envir$.pbd_env[[main]] <- val } invisible() } # End of .zmqopt_set(). ### Initial ZMQ options. #' @export #' @rdname a0_c_options .zmqopt_init <- function(envir = .GlobalEnv){ if(!exists(".pbd_env", envir = envir)){ envir$.pbd_env <- new.env() } envir$.pbd_env$ZMQ.MC <- ZMQ.MC() envir$.pbd_env$ZMQ.SR <- ZMQ.SR() envir$.pbd_env$ZMQ.SO <- ZMQ.SO() envir$.pbd_env$ZMQ.ST <- ZMQ.ST() envir$.pbd_env$ZMQ.PO <- ZMQ.PO() invisible() } # End of .zmqopt_init(). pbdZMQ/R/random_port.r0000644000176200001440000000375013260234554014330 0ustar liggesusers#' Random Port #' #' Generate a valid, random TCP port. #' #' By definition, a TCP port is an unsigned short, and so it can not #' exceed 65535. Additionally, ports in the range 1024 to 49151 are #' (possibly) registered by ICANN for specific uses. #' #' \code{random_port()} will simply generate a valid, non-registered #' tcp port. \code{random_unused_port()} will generate a port #' that is available for socket connections. #' #' \code{random_open_port()} finds a random port not already bound #' to an endpoint. #' #' @param min_port,max_port #' The minimum/maximum value to be generated. The minimum should not #' be below 49152 and the maximum should not exceed 65536 (see #' details). #' @param max_tries #' The maximum number of times a random port will be searched for. #' #' @references #' "The Ephemeral Port Range" by Mike Gleason. #' \url{http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html} #' #' @author Drew Schmidt #' #' @examples #' random_port() #' #' @importFrom stats runif #' #' @rdname random_port #' @export random_port <- function(min_port=49152, max_port=65536) { if (min_port < 49152) warning("non-recommended 'min_port' value; see ?random_port for details") if (max_port > 65536) warning("non-recommended 'max_port' value; see ?random_port for details") as.integer(runif(1, min_port, max_port+1)) } #' @rdname random_port #' @export random_open_port <- function(min_port=49152, max_port=65536, max_tries=100) { ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REP") ret <- -1 for (i in 1:max_tries) { port <- random_port(min_port=min_port, max_port=max_port) addr <- paste0("tcp://*:", port) catch <- tryCatch(zmq.bind(socket, addr), error=identity, warning=identity) if (!inherits(catch, "error") && !inherits(catch, "warning")) { ret <- port break } } rm(socket);rm(ctxt); invisible(gc()) if (ret == -1) stop("No valid port could be found.") else return(ret) } pbdZMQ/R/000_globalVariables.r0000644000176200001440000000053613260234554015453 0ustar liggesusers### Do not delete this file and file name!! ### This file should be loaded before all other *.r files. ### This is to avoid the false positive messages from R CMD check. ### "no visible binding for global variable" ### Suggested by Prof Brian Ripley ### ?globalVariables if(getRversion() >= "2.15.1"){ # utils::globalVariables(c(".pbd_env")) } pbdZMQ/R/R_zmq_utility.r0000644000176200001440000000235313260234554014655 0ustar liggesusers#' Utility Functions #' #' Utility functions #' #' \code{zmq.strerror()} gets ZeroMQ error message string. #' #' \code{zmq.version()} print current ZeroMQ version. #' #' @param errno #' an integer for the error number #' #' @return #' \code{zmq.strerror()} returns an R string containing ZeroMQ error #' message. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' zmq.ctx.destroy(context) #' zmq.strerror(0) #' #' zmq.ctx.destroy(context) # Error since context is free. #' zmq.strerror(14) #' } #' #' @keywords internal #' @seealso \code{\link{zmq.ctx.new}()}, \code{\link{zmq.ctx.destroy}()}, #' \code{\link{zmq.socket}()}, \code{\link{zmq.close}()}. #' @rdname xx_utility #' @name Utility Functions NULL #' @rdname xx_utility #' @export zmq.strerror <- function(errno){ .Call("R_zmq_strerror", as.integer(errno[1]), PACKAGE = "pbdZMQ") } #' @rdname xx_utility #' @export zmq.version <- function(){ ret <- .Call("R_zmq_version", PACKAGE = "pbdZMQ") package_version(ret) } pbdZMQ/R/pbdZMQ-package.r0000644000176200001440000000337513260234554014535 0ustar liggesusers#' Programming with Big Data -- Interface to ZeroMQ #' #' ZeroMQ is a well-known library for high-performance #' asynchronous messaging in scalable, distributed applications. This #' package provides high level R wrapper functions to easily utilize #' ZeroMQ. We mainly focus on interactive client/server programming #' frameworks. For convenience, a minimal ZeroMQ library (4.1.0 rc1) #' is shipped with pbdZMQ, which can be used if no system installation #' of ZeroMQ is available. A few wrapper functions compatible with #' rzmq are also provided. #' #' \tabular{ll}{ #' Package: \tab pbdZMQ \cr #' Type: \tab Package \cr #' License: \tab GPL-3 2.0 \cr #' LazyLoad: \tab yes \cr #' } #' #' The install command using default \pkg{pbdZMQ}'s internal ZeroMQ library is #' \cr \cr #' \code{> R CMD INSTALL pbdZMQ_0.1-0.tar.gz} \cr #' \code{--configure-args="--enable-internal-zmq"} #' \cr \cr #' Other available variables include #' \tabular{ll}{ #' Variable \tab Default \cr #' \code{ZMQ_INCLUDE} \tab \code{-I./zmqsrc/include} \cr #' \code{ZMQ_LDFLAGS} \tab \code{-L./ -lzmq} \cr #' \code{ZMQ_POLLER} \tab \code{select} \cr #' } #' See the package source file \code{pbdZMQ/configure.ac} for details. #' #' For installation using an external ZeroMQ library, see the package source #' file \code{pbdZMQ/INSTALL} for details. #' #' @name pbdZMQ-package #' @aliases pbdZMQ-package pbdZMQ #' @docType package #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' @seealso \code{\link{zmq.ctx.new}()}, \code{\link{zmq.socket}()}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @keywords package #' #' @rdname a0_a_pbdZMQ-package #' NULL pbdZMQ/R/zzz.r.in0000644000176200001440000000631213260234554013243 0ustar liggesusers.onLoad <- function(libname, pkgname){ zmq.ldflags <- "@ZMQ_LDFLAGS@" ext.libs <- "@EXT_LIBS@" if(ext.libs == "$(R_ZMQ)"){ ### Use default zmq library. dn <- paste(libname, "/", pkgname, "/libs/", sep = "") } else{ ### Use external zmq library. dn <- gsub("-L(.*) -lzmq", "\\1", zmq.ldflags) if(gsub(".*(.)$", "\\1", dn) != "/"){ dn <- paste(dn, "/", sep = "") } } ### Find ZMQ shared libraries. if(Sys.info()[['sysname']] == "Darwin"){ files <- list.files(path = dn, pattern = "libzmq.*\\.dylib") ### Make sure the rpath is correct, otherwise overwrite it. if(ext.libs == "$(R_ZMQ)"){ ### By default, there is only one libzmq.*.dylib. if(length(files) == 1){ cmd.int <- system("which install_name_tool", intern = TRUE) cmd.ot <- system("which otool", intern = TRUE) ### Get id from libzmq.*.dylib. fn.dylib <- paste(dn, files, sep = "") id <- system(paste(cmd.ot, " -D ", fn.dylib, sep = ""), intern = TRUE) ### Overwrite for new rpath. if(id[2] != fn.dylib){ # cat("\nBefore install_name_tool: (zzz.r & libzmq.dylib & id)\n") # print(id) cmd <- paste(cmd.int, " -id ", fn.dylib, " ", fn.dylib, sep = "") system(cmd) # id <- system(paste(cmd.ot, " -D ", fn.dylib, sep = ""), # intern = TRUE) # cat("\nAfter install_name_tool: (zzz.r & libzmq.dylib & id)\n") # print(id) } } else{ stop(paste("More than one libzmq*.dylib found:", paste(files, collapse = ", "), sep = " ")) } } } else{ files <- c("libzmq.so", "libzmq.so.dSYM") } ### Load "libzmq.*". for(i.file in files){ dn.file <- paste(dn, i.file, sep = "") if(file.exists(dn.file)){ test <- try(dyn.load(dn.file, local = FALSE), silent = TRUE) if(class(test) == "try-error"){ stop(paste("Could not load ", dn.file, ":", paste(test, collapse = ", "), sep = " ")) } break } } ### Load "pbdZMQ.so". library.dynam("pbdZMQ", pkgname, libname) ### Preload to global environment. invisible(eval(parse(text = "pbdZMQ:::.zmqopt_init()"))) invisible() } # End of .onLoad(). .onUnload <- function(libpath){ ### Unload "pbdZMQ.so". library.dynam.unload("pbdZMQ", libpath) ### Check external. zmq.ldflags <- "@ZMQ_LDFLAGS@" ext.libs <- "@EXT_LIBS@" if(ext.libs == ""){ ### Use default zmq library. dn <- paste(libpath, "/libs/", sep = "") } else{ ### Use external zmq library. dn <- gsub("-L(.*) -lzmq", "\\1", zmq.ldflags) if(gsub(".*(.)$", "\\1", dn) != "/"){ dn <- paste(dn, "/", sep = "") } } ### Unload ZMQ. if(Sys.info()[['sysname']] == "Darwin"){ files <- list.files(path = dn, pattern = "libzmq.*\\.dylib") } else{ files <- c("libzmq.so", "libzmq.so.dSYM") } files <- paste(dn, files, sep = "") for(i.file in files){ if(file.exists(i.file)){ ### Unload "libzmq.so". test <- try(dyn.unload(i.file), silent = TRUE) } } invisible() } # End of .onUnload(). .onAttach <- function(libname, pkgname){ invisible() } # End of .onAttach(). pbdZMQ/R/R_zmq_socket.r0000644000176200001440000001656013260234554014447 0ustar liggesusers#' Socket Functions #' #' Socket functions #' #' \code{zmq.socket()} initials a ZMQ socket given a ZMQ context \code{ctx} and #' a socket \code{type}. See \code{\link{ZMQ.ST}()} for the possible values of #' \code{type}. ZMQ defines several patterns for the socket type and utilize #' them to communicate in different ways including request-reply, #' publish-subscribe, pipeline, exclusive pair, and naive patterns. #' #' \code{zmq.close()} destroys the ZMQ socket. #' #' \code{zmq.bind()} binds the socket to a local endpoint and then accepts #' incoming connections on that endpoint. See \code{endpoint} next for details. #' #' \code{zmq.connect()} connects the socket to a remote endpoint and then #' accepts outgoing connections on that endpoint. See \code{endpoint} next for #' details. #' #' \code{endpoint} is a string consisting of a transport :// followed by an #' address. The transport specifies the underlying protocol to use. The address #' specifies the transport-specific address to bind to. pbdZMQ/ZMQ provides #' the following transports: \tabular{ll}{ Transport \tab Usage \cr \code{tcp} #' \tab unicast transport using TCP \cr \code{ipc} \tab local inter-process #' communication transport \cr \code{inproc} \tab local in-process #' (inter-thread) communication transport \cr \code{pgm,epgm} \tab reliable #' multicast transport using PGM } *** warning: \code{epgm} is not turned on by #' default in the pbdZMQ's internal ZeroMQ library. \cr *** warning: \code{ipc} #' is not supported in Windows system. #' #' \code{zmq.setsockopt()} is to set/change socket options. #' #' \code{zmq.getsockopt()} is to get socket options and returns #' \code{option.value}. #' #' @param ctx #' a ZMQ context #' @param type #' a socket type #' @param socket #' a ZMQ socket #' @param endpoint #' a ZMQ socket endpoint #' @param option.name #' an option name to the socket #' @param option.value #' an option value to the option name #' @param MC #' a message control, see \code{\link{ZMQ.MC}()} for details #' #' @return \code{zmq.socket()} returns an R external pointer (\code{socket}) #' generated by ZMQ C API pointing to a socket if successful, otherwise returns #' an R \code{NULL} and sets \code{errno} to the error value, see ZeroMQ manual #' for details. #' #' \code{zmq.close()} destroys the socket reference/pointer (\code{socket}) and #' returns 0 if successful, otherwise returns -1 and sets \code{errno} to the #' error value, see ZeroMQ manual for details. #' #' \code{zmq.bind()} binds the socket to specific \code{endpoint} and returns 0 #' if successful, otherwise returns -1 and sets \code{errno} to the error #' value, see ZeroMQ manual for details. #' #' \code{zmq.connect()} connects the socket to specific \code{endpoint} and #' returns 0 if successful, otherwise returns -1 and sets \code{errno} to the #' error value, see ZeroMQ manual for details. #' #' \code{zmq.setsockopt()} sets/changes the socket option and returns 0 if #' successful, otherwise returns -1 and sets \code{errno} to the error value, #' see ZeroMQ manual for details. #' #' \code{zmq.getsockopt()} returns the value of socket option, #' see ZeroMQ manual for details. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' ### Using request-reply pattern. #' #' ### At the server, run next in background or the other windows. #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) #' zmq.bind(responder, "tcp://*:5555") #' zmq.close(responder) #' zmq.ctx.destroy(context) #' #' #' ### At a client, run next in foreground. #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) #' zmq.connect(requester, "tcp://localhost:5555") #' zmq.close(requester) #' zmq.ctx.destroy(context) #' } #' #' @keywords programming #' @seealso \code{\link{zmq.ctx.new}()}, \code{\link{zmq.ctx.destroy}()}. #' @rdname a1_socket #' @name Socket Functions NULL #' @rdname a1_socket #' @export zmq.socket <- function(ctx, type = .pbd_env$ZMQ.ST$REP){ ret <- .Call("R_zmq_socket", ctx, type, PACKAGE = "pbdZMQ") ### Users are responsible to take care free and gc. # reg.finalizer(ret, zmq.close, TRUE) ret } #' @rdname a1_socket #' @export zmq.close <- function(socket){ ret <- .Call("R_zmq_close", socket, PACKAGE = "pbdZMQ") invisible(ret) } #' @rdname a1_socket #' @export zmq.bind <- function(socket, endpoint, MC = .pbd_env$ZMQ.MC){ ret <- .Call("R_zmq_bind", socket, endpoint, PACKAGE = "pbdZMQ") if(ret == -1){ if(MC$stop.at.error){ stop(paste("zmq.bind fails, ", endpoint, sep = "")) return(invisible(ret)) } if(MC$warning.at.error){ warning(paste("zmq.bind fails, ", endpoint, sep = "")) return(invisible(ret)) } } else{ return(invisible(ret)) } } #' @rdname a1_socket #' @export zmq.connect <- function(socket, endpoint, MC = .pbd_env$ZMQ.MC){ ret <- .Call("R_zmq_connect", socket, endpoint, PACKAGE = "pbdZMQ") if(ret == -1){ if(MC$stop.at.error){ stop(paste("zmq.connect fails, ", endpoint, sep = "")) return(invisible(ret)) } if(MC$warning.at.error){ warning(paste("zmq.connect fails, ", endpoint, sep = "")) return(invisible(ret)) } } else{ return(invisible(ret)) } } #' @rdname a1_socket #' @export zmq.disconnect <- function(socket, endpoint, MC = .pbd_env$ZMQ.MC){ ret <- .Call("R_zmq_disconnect", socket, endpoint, PACKAGE = "pbdZMQ") if(ret == -1){ if(MC$stop.at.error){ stop(paste("zmq.disconnect fails, ", endpoint, sep = "")) return(invisible(ret)) } if(MC$warning.at.error){ warning(paste("zmq.disconnect fails, ", endpoint, sep = "")) return(invisible(ret)) } } else{ return(invisible(ret)) } } #' @rdname a1_socket #' @export zmq.setsockopt <- function(socket, option.name, option.value, MC = .pbd_env$ZMQ.MC){ if(is.character(option.value)){ option.type <- 0L } else if(is.integer(option.value)){ option.type <- 1L } else{ stop("Type of option.value is not implemented") } ret <- .Call("R_zmq_setsockopt", socket, option.name, option.value, option.type, PACKAGE = "pbdZMQ") if(ret == -1){ if(MC$stop.at.error){ stop(paste("zmq.setsockopt fails, ", option.value, sep = "")) return(invisible(ret)) } if(MC$warning.at.error){ warning(paste("zmq.setsockopt fails, ", option.value, sep = "")) return(invisible(ret)) } } else{ return(invisible(ret)) } } #' @rdname a1_socket #' @export zmq.getsockopt <- function(socket, option.name, option.value, MC = .pbd_env$ZMQ.MC){ if(is.character(option.value)){ option.type <- 0L } else if(is.integer(option.value)){ option.type <- 1L } else{ stop("Type of option.value is not implemented") } ret <- .Call("R_zmq_getsockopt", socket, option.name, option.value, option.type, PACKAGE = "pbdZMQ") if(ret == -1){ if(MC$stop.at.error){ stop(paste("zmq.getsockopt fails, ", option.value, sep = "")) return(invisible(ret)) } if(MC$warning.at.error){ warning(paste("zmq.getsockopt fails, ", option.value, sep = "")) return(invisible(ret)) } } else{ return(invisible(option.value)) } } pbdZMQ/R/R_zmq_poll.r0000644000176200001440000001056213260234554014121 0ustar liggesusers#' Poll Functions #' #' Poll functions #' #' \code{zmq.poll()} initials ZMQ poll items given ZMQ \code{socket}'s #' and ZMQ poll \code{type}'s. Both \code{socket} and \code{type} are #' in vectors of the same length, while \code{socket} contains socket pointers #' and \code{type} contains types of poll. #' See \code{\link{ZMQ.PO}()} for the possible values of #' \code{type}. ZMQ defines several poll types and utilize #' them to poll multiple sockets. #' #' \code{zmq.poll.free()} frees ZMQ poll structure memory internally. #' #' \code{zmq.poll.length()} obtains total numbers of ZMQ poll items. #' #' \code{zmq.poll.get.revents()} obtains revent types from ZMQ poll item by #' the input index. #' #' @param socket #' a vector of ZMQ sockets #' @param type #' a vector of socket types corresponding to \code{socket} argument #' @param timeout #' timeout for poll, see ZeroMQ manual for details #' @param index #' an index of ZMQ poll items to obtain revents #' @param MC #' a message control, see \code{\link{ZMQ.MC}()} for details #' #' @return \code{zmq.poll()} returns a ZMQ code and an errno, #' see ZeroMQ manual for details, no error/warning/interrupt in this #' \code{R} function, but some error/warning/interrupt may catch by #' the \code{C} function \code{zmq_poll()}. #' @return \code{zmq.poll.length()} returns the total number of poll items #' @return \code{zmq.poll.get.revents()} returns the revent type #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' ### Using poll pattern. #' ### See demo/mspoller.r for details. #' #' ### Run next in background or the other window. #' SHELL> Rscript wuserver.r & #' SHELL> Rscript taskvent.r & #' SHELL> Rscript mspoller.r #' #' ### The mspoller.r has next. #' library(pbdZMQ, quietly = TRUE) #' #' ### Initial. #' context <- zmq.ctx.new() #' receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) #' zmq.connect(receiver, "tcp://localhost:5557") #' subscriber <- zmq.socket(context, .pbd_env$ZMQ.ST$SUB) #' zmq.connect(subscriber, "tcp://localhost:5556") #' zmq.setsockopt(subscriber, .pbd_env$ZMQ.SO$SUBSCRIBE, "20993") #' #' ### Process messages from both sockets. #' cat("Press Ctrl+C or Esc to stop mspoller.\n") #' i.rec <- 0 #' i.sub <- 0 #' while(TRUE){ #' ### Set poller. #' zmq.poll(c(receiver, subscriber), #' c(.pbd_env$ZMQ.PO$POLLIN, .pbd_env$ZMQ.PO$POLLIN)) #' #' ### Check receiver. #' if(bitwAnd(zmq.poll.get.revents(1), .pbd_env$ZMQ.PO$POLLIN)){ #' ret <- zmq.recv(receiver) #' if(ret$len != -1){ #' cat("task ventilator:", ret$buf, "at", i.rec, "\n") #' i.rec <- i.rec + 1 #' } #' } #' #' ### Check subscriber. #' if(bitwAnd(zmq.poll.get.revents(2), .pbd_env$ZMQ.PO$POLLIN)){ #' ret <- zmq.recv(subscriber) #' if(ret$len != -1){ #' cat("weather update:", ret$buf, "at", i.sub, "\n") #' i.sub <- i.sub + 1 #' } #' } #' #' if(i.rec >= 5 & i.sub >= 5){ #' break #' } #' #' Sys.sleep(runif(1, 0.5, 1)) #' } #' #' ### Finish. #' zmq.poll.free() #' zmq.close(receiver) #' zmq.close(subscriber) #' zmq.ctx.destroy(context) #' } #' #' @keywords programming #' @seealso \code{\link{zmq.recv}()}, \code{\link{zmq.send}()}. #' @rdname b3_poll #' @name Poll Functions NULL #' @rdname b3_poll #' @export zmq.poll <- function(socket, type, timeout = -1L, MC = .pbd_env$ZMQ.MC){ if(length(socket) != length(type)){ stop("socket and type are of different length.") } type <- as.integer(type) if(!all(type %in% 1:7)){ stop("type should be integers in 1 to 7.") } zmq.poll.free() ret <- .Call("R_zmq_poll", socket, type, as.integer(timeout), as.logical(MC$check.eintr), PACKAGE = "pbdZMQ") return(invisible(ret)) } #' @rdname b3_poll #' @export zmq.poll.free <- function(){ ret <- .Call("R_zmq_poll_free", PACKAGE = "pbdZMQ") invisible(ret) } #' @rdname b3_poll #' @export zmq.poll.length <- function(){ ret <- .Call("R_zmq_poll_length", PACKAGE = "pbdZMQ") invisible(ret) } #' @rdname b3_poll #' @export zmq.poll.get.revents <- function(index = 1L){ if(index < 1){ stop("index is a positive interger.") } ret <- .Call("R_zmq_poll_get_revents", as.integer(index - 1)[1], PACKAGE = "pbdZMQ") invisible(ret) } pbdZMQ/R/get_conf.r0000644000176200001440000001104313260234554013562 0ustar liggesusers### This file is only called by ### "pbd*/src/Makevars.in" or "pbd*/src/Makevar.win" ### to find the default configurations from ### "pbd*/etc${R_ARCH}/Makconf". get.path.lib <- function(arch, fn.in, debug = FALSE){ ### For the nm outputs to check 32- and 64-bits libraries. if(arch == "/i386"){ n.zero <- 8 } else if(arch == "/x64"){ n.zero <- 16 } else{ stop(paste(arch, " is not found.", sep = "")) } ### Find which path gcc.exe is located. path.env <- Sys.getenv("PATH") path <- unlist(strsplit(path.env, ";")) check.gcc <- FALSE for(i.path in 1:length(path)){ dir.gcc <- gsub("\\\\", "/", path[i.path]) path.gcc <- paste(dir.gcc, "./gcc.exe", sep = "") check.gcc <- file.exists(path.gcc) if(check.gcc){ break } } ### Get root for the Rtools if(!check.gcc){ if(debug){ print(path) } stop("gcc is not found.") } else{ if(debug){ print(path.gcc) } path.rtools <- gsub("/bin.*", "", path.gcc) } ### Check libraries. # fn.in <- "libiphlpapi.a" cmd <- paste("find ", path.rtools, " | grep '", fn.in, "$'", sep = "") libs <- shell(cmd, intern = TRUE, ignore.stderr = TRUE) if(debug){ print(libs) } if(length(libs) == 0){ stop(paste(fn.in, " is not found in ", path.rtools, sep = "")) } else{ check.bits <- FALSE for(i.lib in 1:length(libs)){ fn.out <- libs[i.lib] cmd <- paste("nm ", fn.out, " | grep '^0' | head -1 | sed -e 's/ .*//'", sep = "") bits <- shell(cmd, intern = TRUE, ignore.stderr = TRUE) zeros <- bits[1] if(debug){ print(zeros) } if(nchar(zeros) == n.zero){ check.bits <- TRUE break } } if(check.bits){ fn.in <- gsub("\\+", "\\\\+", fn.in) path.lib <- gsub(paste("/", fn.in, sep = ""), "/", fn.out) if(debug){ print(path.lib) } } else{ stop("check.bits is neither 8 nor 16.") } } path.lib } # End of get.path.lib(). get.path.lib.330 <- function(arch, binpref, fn.in, debug = FALSE){ ### For the nm outputs to check 32- and 64-bits libraries. if(arch == "/i386"){ arch <- gsub("^.", "", arch) } else if(arch == "/x64"){ arch <- gsub("^.", "", arch) } else{ stop(paste(arch, " is not found.", sep = "")) } ### Find which path gcc.exe is located. if(binpref != ""){ path.gcc <- paste(binpref, "gcc.exe", sep = "") } else{ ### For Rtools33 or newer version. ### This dose not work. cmd <- paste("R --arch ", arch, " CMD config CC", sep = "") path.gcc <- shell(cmd, intern = TRUE, ignore.stderr = TRUE) path.gcc <- paste(path.gcc, ".exe", sep = "") } check.gcc <- file.exists(path.gcc) ### Get root for the Rtools if(debug){ print(path.gcc) } path.rtools <- gsub("/bin.*", "", path.gcc) ### Check libraries. # fn.in <- "libiphlpapi.a" cmd <- paste("find ", path.rtools, " | grep '", fn.in, "$'", sep = "") libs <- shell(cmd, intern = TRUE, ignore.stderr = TRUE) fn.out <- libs[1] fn.in <- gsub("\\+", "\\\\+", fn.in) path.lib <- gsub(paste("/", fn.in, sep = ""), "/", fn.out) if(debug){ print(path.lib) } path.lib } # End of get.path.lib(). ### For libiphlpapi.a, librpcrt4.a, and libws2_32.a ### C:\Rtools32\gcc-4.6.3\i686-w64-mingw32\lib ### C:\Rtools32\gcc-4.6.3\i686-w64-mingw32\lib64 ### C:\Rtools33\mingw_32\i686-w64-mingw32\lib ### C:\Rtools33\mingw_64\x86_64-w64-mingw32\lib get.mingw.lib <- function(arch = '', binpref = '', debug = FALSE){ if(getRversion() < '3.3.0'){ fn.in <- "libiphlpapi.a" path.lib <- get.path.lib(arch, fn.in, debug = debug) fn.in <- "librpcrt4.a" path.fn <- paste(path.lib, fn.in, sep = "") check.fn <- file.exists(path.fn) if(!check.fn){ stop(paste(path.fn, " is not found.", sep = "")) } fn.in <- "libws2_32.a" path.fn <- paste(path.lib, fn.in, sep = "") check.fn <- file.exists(path.fn) if(!check.fn){ stop(paste(path.fn, " is not found.", sep = "")) } ### Cat back to "Makefile.win". cat(path.lib) } invisible() } # End of get.mingw.lib(). ### For libstdc++.a ### C:\Rtools32\gcc-4.6.3\lib ### C:\Rtools32\gcc-4.6.3\lib64 ### C:\Rtools33\mingw_32\lib\gcc\i686-w64-mingw32\4.9.3 ### C:\Rtools33\mingw_64\lib\gcc\x86_64-w64-mingw32\4.9.3 get.stdcxx.lib <- function(arch = '', binpref = '', debug = FALSE){ if(getRversion() < '3.3.0'){ fn.in <- "libstdc++.a" path.lib <- get.path.lib(arch, fn.in, debug = debug) ### Cat back to "Makefile.win". cat(path.lib) } invisible() } # End of get.stdcxx.lib(). pbdZMQ/R/base_ls.r0000644000176200001440000000260013260234554013405 0ustar liggesusers#' A wrapper function for base::ls #' #' @description #' The \code{ls()} function with modification to avoid listing hidden #' pbd objects. #' #' @details #' As the original \code{base::ls()}, it returns the names of the objects. #' #' @param name,pos,envir,all.names,pattern,sorted #' as the original \code{base::ls()}. #' #' @return #' As the original \code{base::ls()} except when \code{all.names} is \code{TRUE} #' and \code{envir} is \code{.GlobalEnv}, hidden pbd objects such as #' \code{.pbd_env} and \code{.pbdenv} will not be returned. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @rdname xx_ls_wrapper #' #' @examples #' \dontrun{ #' library(pbdRPC, quietly = TRUE) #' ls(all.names = TRUE) #' base::ls(all.names = TRUE) #' } #' #' @export ls <- function(name, pos = -1L, envir = as.environment(pos), all.names = FALSE, pattern, sorted = TRUE) { cmd <- "base::ls(" if (!missing(name)) cmd <- paste(cmd, as.character(name), ", ", sep = "") cmd <- paste(cmd, "all.names = ", all.names, ", ", sep = "") if (!missing(pattern)) cmd <- paste(cmd, "pattern = \"", as.character(pattern), "\", ", sep = "") cmd <- paste(cmd, "sorted = ", sorted, ")", sep = "") ret <- eval(parse(text = cmd), envir = -2L) if (all.names == TRUE && environmentName(parent.frame()) == "R_GlobalEnv") ret <- grep("^\\.pbd(_|)env$", ret, value = TRUE, invert = TRUE) ret } pbdZMQ/R/address.r0000644000176200001440000000204713260234554013427 0ustar liggesusers#' Form an Address/Endpoint #' #' A notationally convenient function for forming addresses/endpoints. #' It's a simple wrapper around the \code{paste0()} function. #' #' @param host #' The host ip address or url. #' @param port #' A port; necessary for all transports except ipc. #' @param transport #' The transport protocol. Choices are "inproc", "ipc", "tcp", and #' "pgm"/"epgm" for local in-process (inter-thread), local #' inter-process, tcp, and pgm, respectively. #' #' @return #' An address, for use with pbdZMQ functions. #' #' @author Drew Schmidt #' #' @examples #' address("localhost", 55555) #' #' @seealso #' \code{\link{zmq.bind}} #' #' @export address <- function(host, port, transport="tcp") { transports <- c("tcp", "inproc", "ipc", "pgm", "epgm") transport <- tolower(transport) match.arg(transport, transports) if (transport == "ipc") { if (!missing(port)) warning("Ignoring specified port for ipc transport.") paste0(transport, "://", host) } else paste0(transport, "://", host, ":", port) } pbdZMQ/R/R_zmq_sendrecv_multipart.r0000644000176200001440000000570313260234554017066 0ustar liggesusers#' Send Receive Multiple Raw Buffers #' #' Send and receive functions for multiple raw buffers #' #' \code{zmq.send.multipart()} is a high level R function to send multiple #' raw messages \code{parts} at once. #' #' \code{zmq.recv.multipart()} is a high level R function to receive multiple #' raw messages at once. #' #' @param socket #' a ZMQ socket #' @param parts #' a vector of multiple buffers to be sent #' @param serialize,unserialize #' if serialize/unserialize the received multiple buffers #' #' @return \code{zmq.send.multipart()} returns. #' #' \code{zmq.recv.multipart()} returns. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' ### Using request-reply pattern. #' #' ### At the server, run next in background or the other window. #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) #' zmq.bind(responder, "tcp://*:5555") #' #' ret <- zmq.recv.multipart(responder, unserialize = TRUE) #' parts <- as.list(rep("World", 5)) #' zmq.send.multipart(responder, parts) #' for(i in 1:5) cat(ret[[i]]) #' #' zmq.close(responder) #' zmq.ctx.destroy(context) #' #' ### At a client, run next in foreground. #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) #' zmq.connect(requester, "tcp://localhost:5555") #' #' parts <- lapply(1:5, function(i.req){ paste("Sending Hello ", i.req, "\n") }) #' zmq.send.multipart(requester, parts) #' ret <- zmq.recv.multipart(requester, unserialize = TRUE) #' print(ret) #' #' zmq.close(requester) #' zmq.ctx.destroy(context) #' } #' #' @keywords programming #' @seealso \code{\link{zmq.msg.send}()}, \code{\link{zmq.msg.recv}()}. #' @rdname b2_sendrecv_multipart #' @name Send Receive Multiple Raw Buffers NULL #' @rdname b2_sendrecv_multipart #' @export zmq.send.multipart <- function(socket, parts, serialize = TRUE){ for(i.part in 1:(length(parts) - 1)){ zmq.msg.send(parts[[i.part]], socket, flags = .pbd_env$ZMQ.SR$SNDMORE, serialize = serialize) } zmq.msg.send(parts[[length(parts)]], socket, flags = .pbd_env$ZMQ.SR$BLOCK, serialize = serialize) invisible() } #' @rdname b2_sendrecv_multipart #' @export zmq.recv.multipart <- function(socket, unserialize = TRUE){ ret <- list() i.part <- 1 ret[[i.part]] <- zmq.msg.recv(socket, flags = .pbd_env$ZMQ.SR$BLOCK, unserialize = unserialize) opt.val <- zmq.getsockopt(socket, .pbd_env$ZMQ.SO$RCVMORE, 0L) while(opt.val == 1){ i.part <- i.part + 1 ret[[i.part]] <- zmq.msg.recv(socket, flags = .pbd_env$ZMQ.SR$BLOCK, unserialize = unserialize) opt.val <- zmq.getsockopt(socket, .pbd_env$ZMQ.SO$RCVMORE, 0L) } ret } pbdZMQ/R/222_export_env.r0000644000176200001440000000542713260234554014565 0ustar liggesusers#' Sets of controls in pbdZMQ. #' #' These sets of controls are used to provide default values in this package. #' #' The elements of \code{.pbd_env$ZMQ.ST} are default values for socket types #' as defined in `zmq.h' including \tabular{lcl}{ Elements \tab Value \tab #' Usage \cr \code{PAIR} \tab 0L \tab socket type PAIR \cr \code{PUB} \tab 1L #' \tab socket type PUB \cr \code{SUB} \tab 2L \tab socket type SUB \cr #' \code{REQ} \tab 3L \tab socket type REQ \cr \code{REP} \tab 4L \tab socket #' type REP \cr \code{DEALER} \tab 5L \tab socket type DEALER \cr \code{ROUTER} #' \tab 6L \tab socket type ROUTER \cr \code{PULL} \tab 7L \tab socket type #' PULL \cr \code{PUSH} \tab 8L \tab socket type PUSH \cr \code{XPUB} \tab 9L #' \tab socket type XPUB \cr \code{XSUB} \tab 10L \tab socket type XSUB \cr #' \code{STREAM} \tab 11L \tab socket type STREAM } #' #' The elements of \code{.pbd_env$ZMQ.SO} are default values for socket #' options as defined in `zmq.h' including 60 different values, see #' \code{.pbd_env$ZMQ.SO} and `zmq.h' for details. #' #' The elements of \code{.pbd_env$ZMQ.SR} are default values for send/recv #' options as defined in `zmq.h' including \tabular{lcl}{ Elements \tab Value #' \tab Usage \cr \code{BLOCK} \tab 0L \tab send/recv option BLOCK \cr #' \code{DONTWAIT} \tab 1L \tab send/recv option DONTWAIT \cr \code{NOBLOCK} #' \tab 1L \tab send/recv option NOBLOCK \cr \code{SNDMORE} \tab 2L \tab #' send/recv option SNDMORE (not supported) } #' #' The elements of \code{.pbd_env$ZMQ.MC} are default values for warning and #' stop controls in R. These are not the ZeroMQ's internal default values. They #' are defined as \tabular{lcl}{ Elements \tab Value \tab Usage \cr #' \code{warning.at.error} \tab TRUE \tab if warn at error \cr #' \code{stop.at.error} \tab TRUE \tab if stop at error } #' #' @name ZMQ Control Environment #' @aliases .pbd_env #' @docType data #' @format Objects contain several parameters for communicators and methods. #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' @keywords global variables #' @seealso \code{\link{.zmqopt_init}()}. #' @rdname a0_b_control NULL ### These are fake. These only be here for reference and to fool ### ``R CMD check''. ### The real one ``in practicee and runtime'' is initialed by the ### .zmqopt_init() which is always called by .OnLoad() in "zzz.r" to avoid ### overloaded and can be really accessed by users instead of sealed by R ### after loaded. ### ### WCC: DO ``NOT'' remark ``NOR'' use the next. # .pbd_env <- new.env() # .pbd_env$ZMQ.MC <- ZMQ.MC() # .pbd_env$ZMQ.SR <- ZMQ.SR() # .pbd_env$ZMQ.SO <- ZMQ.SO() # .pbd_env$ZMQ.ST <- ZMQ.ST() # .pbd_env$ZMQ.PO <- ZMQ.PO() pbdZMQ/R/windows/0000755000176200001440000000000013260234554013306 5ustar liggesuserspbdZMQ/R/windows/zzz.r0000644000176200001440000000202113260234554014321 0ustar liggesusers.onLoad <- function(libname, pkgname){ dn <- paste(libname, "/", pkgname, "/libs", Sys.getenv("R_ARCH"), "/", sep = "") i.file <- "libzmq.dll" fn <- paste(dn, i.file, sep = "") ### Load "libzmq.dll". test <- try(dyn.load(fn, local = FALSE), silent = TRUE) if(class(test) == "try-error"){ stop(paste("Could not load ", fn, sep = "")) } ### Load "pbdZMQ.dll". library.dynam("pbdZMQ", pkgname, libname) ### Preload to global environment. invisible(eval(parse(text = "pbdZMQ:::.zmqopt_init()"))) invisible() } # End of .onLoad(). .onUnload <- function(libpath){ ### Unload "pbdZMQ.dll". library.dynam.unload("pbdZMQ", libpath) dn <- paste(libpath, "/libs", Sys.getenv("R_ARCH"), "/", sep = "") i.file <- "libzmq.dll" fn <- paste(dn, i.file, sep = "") if(file.exists(fn)){ ### Unload "libzmq.dll". test <- try(dyn.unload(fn), silent = TRUE) } invisible() } # End of .onUnload(). .onAttach <- function(libname, pkgname){ invisible() } # End of .onAttach(). pbdZMQ/R/get_conf_zmq.r0000644000176200001440000001423413260234554014456 0ustar liggesusers#' ZMQ Flags #' #' ZMQ Flags #' #' \code{get.zmq.cppflags()} gets CFLAGS or CPPFLAGS #' #' \code{get.zmq.ldflags()} gets LDFLAGS for libzmq.so, libzmq.dll, or libzmq.*.dylib #' #' \code{get.pbdZMQ.ldflags()} gets LDFLAGS for pbdZMQ.so or pbdZMQ.dll #' #' \code{test.load.zmq()} tests load libzmq and pbdZMQ shared libraries #' #' @param arch #' '' (default) for non-windows or '/i386' and '/ix64' for windows #' @param package #' the pbdZMQ package #' #' @return flags to compile and link with ZMQ. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' get.zmq.cppflags(arch = '/i386') #' get.zmq.ldflags(arch = '/x64') #' get.pbdZMQ.ldflags(arch = '/x64') #' test.load.zmq(arch = '/x64') #' } #' #' @keywords compile #' @rdname zz_zmq_flags #' @name ZMQ Flags NULL #' @rdname zz_zmq_flags #' @export get.zmq.ldflags <- function(arch = '', package = "pbdZMQ"){ if(arch == "/i386" || arch == "/x64"){ file.name <- paste("./libs", arch, "/", sep = "") dir.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) zmq.ldflags <- paste("-L\"", dir.path, "\" -lzmq", sep = "") } else{ ### For non windows system. file.name <- paste("./etc", arch, "/Makeconf", sep = "") file.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) ret <- scan(file.path, what = character(), sep = "\n", quiet = TRUE) ### Check if system zmq is used. arg <- "SYSTEM_ZMQ_LIBDIR" id <- grep(paste("^", arg, " = ", sep = ""), ret) sys.zmq.ld <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) ### Check if external zmq is used. arg <- "EXTERNAL_ZMQ_LDFLAGS" id <- grep(paste("^", arg, " = ", sep = ""), ret) ext.zmq.ld <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) ### Check if internal zmq is used. arg <- "ENABLE_INTERNAL_ZMQ" id <- grep(paste("^", arg, " = ", sep = ""), ret) en.int.zmq <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) ### Check which zmq should be used. if((sys.zmq.ld == "" && ext.zmq.ld == "") || en.int.zmq == "yes"){ file.name <- paste("./libs", arch, "/", sep = "") dir.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) if(Sys.info()[['sysname']] == "Darwin"){ lib.osx <- list.files(dir.path, pattern = "libzmq\\.(.*)\\.dylib") i.ver <- gsub("libzmq\\.(.*)\\.dylib", "\\1", lib.osx) i.ver <- max(as.integer(i.ver)) zmq.ldflags <- paste("-L\"", dir.path, "\" -lzmq.", i.ver, sep = "") } else{ zmq.ldflags <- paste("-L\"", dir.path, "\" -lzmq", sep = "") } } else{ arg <- "ZMQ_LDFLAGS" id <- grep(paste("^", arg, " = ", sep = ""), ret) zmq.ldflags <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) } } ### Cat back to "Makevars". cat(zmq.ldflags) invisible(zmq.ldflags) } # End of get.zmq.ldflags(). #' @rdname zz_zmq_flags #' @export get.zmq.cppflags <- function(arch = '', package = "pbdZMQ"){ if(arch == "/i386" || arch == "/x64"){ file.name <- paste("./zmq", arch, "/include", sep = "") dir.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) zmq.cppflags <- paste("-I\"", dir.path, "\"", sep = "") } else{ ### For non windows system. file.name <- paste("./etc", arch, "/Makeconf", sep = "") file.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) ret <- scan(file.path, what = character(), sep = "\n", quiet = TRUE) ### Check if system zmq is used. arg <- "SYSTEM_ZMQ_INCLUDEDIR" id <- grep(paste("^", arg, " = ", sep = ""), ret) sys.zmq.inc <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) ### Check if external zmq is used. arg <- "EXTERNAL_ZMQ_INCLUDE" id <- grep(paste("^", arg, " = ", sep = ""), ret) ext.zmq.inc <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) ### Check if internal zmq is used. arg <- "ENABLE_INTERNAL_ZMQ" id <- grep(paste("^", arg, " = ", sep = ""), ret) en.int.zmq <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) ### Check which zmq should be used. if((sys.zmq.inc == "" && ext.zmq.inc == "") || en.int.zmq == "yes"){ file.name <- paste("./zmq", arch, "/include/", sep = "") dir.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) zmq.cppflags <- paste("-I\"", dir.path, "\"", sep = "") } else{ arg <- "ZMQ_INCLUDE" id <- grep(paste("^", arg, " = ", sep = ""), ret) zmq.cppflags <- gsub(paste("^", arg, " = (.*)", sep = ""), "\\1", ret[id[1]]) } } ### Cat back to "Makevars". cat(zmq.cppflags) invisible(zmq.cppflags) } # End of get.zmq.cppflags(). #' @rdname zz_zmq_flags #' @export test.load.zmq <- function(arch = '', package = "pbdZMQ"){ file.name <- paste("./libs", arch, "/", sep = "") dir.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) files <- c("libzmq.so", "libzmq.so.dSYM", "libzmq.dylib", "libzmq.4.dylib", "libzmq.5.dylib", "libzmq.dll") for(i.file in files){ fn <- paste(dir.path, "/", i.file, sep = "") if(file.exists(fn)){ ret <- try(dyn.load(fn, local = FALSE), silent = TRUE) print(ret) cat("\n") } } invisible(NULL) } # End of test.load.zmq(). #' @rdname zz_zmq_flags #' @export get.pbdZMQ.ldflags <- function(arch = '', package = "pbdZMQ"){ file.name <- paste("./libs", arch, "/", sep = "") dir.path <- tools::file_path_as_absolute( system.file(file.name, package = package)) if(arch == "/i386" || arch == "/x64"){ pbdZMQ.ldflags <- paste(dir.path, "/pbdZMQ.dll", sep = "") } else{ pbdZMQ.ldflags <- paste(dir.path, "/pbdZMQ.so", sep = "") } ### Cat back to "Makevars". cat(pbdZMQ.ldflags) invisible(pbdZMQ.ldflags) } # End of get.pbdZMQ.ldflags(). pbdZMQ/R/R_zmq_message.r0000644000176200001440000000510513260234554014574 0ustar liggesusers#' Message Functions #' #' Message functions #' #' \code{zmq.msg.send()} sends an R message. #' #' \code{zmq.msg.recv()} receives an R message. #' #' @param rmsg #' an R message #' @param socket #' a ZMQ socket #' @param flags #' a flag for method of send and receive #' @param serialize #' if serialize the \code{rmsg} #' @param unserialize #' if unserialize the received R message #' #' @return \code{zmq.msg.send()} returns 0 if successful, otherwise returns -1 #' and sets \code{errno} to \code{EFAULT}. #' #' \code{zmq.msg.recv()} returns the message if successful, otherwise returns #' -1 and sets \code{errno} to \code{EFAULT}. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' ### Using request-reply pattern. #' #' ### At the server, run next in background or the other window. #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) #' zmq.bind(responder, "tcp://*:5555") #' buf <- zmq.msg.recv(responder) #' set.seed(1234) #' ret <- rnorm(5) #' print(ret) #' zmq.msg.send(ret, responder) #' zmq.close(responder) #' zmq.ctx.destroy(context) #' #' #' ### At a client, run next in foreground. #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) #' zmq.connect(requester, "tcp://localhost:5555") #' zmq.msg.send(NULL, requester) #' ret <- zmq.msg.recv(requester) #' print(ret) #' zmq.close(requester) #' zmq.ctx.destroy(context) #' } #' #' @keywords programming #' @seealso \code{\link{zmq.send}()}, \code{\link{zmq.recv}()}. #' @rdname a2_message #' @name Message Function NULL zmq.msg.init <- function(){ .Call("R_zmq_msg_init", PACKAGE = "pbdZMQ") } zmq.msg.close <- function(msg.t){ .Call("R_zmq_msg_close", msg.t, PACKAGE = "pbdZMQ") } #' @rdname a2_message #' @export zmq.msg.send <- function(rmsg, socket, flags = .pbd_env$ZMQ.SR$BLOCK, serialize = TRUE){ if(serialize){ rmsg <- serialize(rmsg, NULL) } ret <- .Call("R_zmq_msg_send", rmsg, socket, as.integer(flags), PACKAGE = "pbdZMQ") invisible(ret) } #' @rdname a2_message #' @export zmq.msg.recv <- function(socket, flags = .pbd_env$ZMQ.SR$BLOCK, unserialize = TRUE){ rmsg <- .Call("R_zmq_msg_recv", socket, as.integer(flags), PACKAGE = "pbdZMQ") if(unserialize && is.raw(rmsg)){ rmsg <- unserialize(rmsg) } rmsg } pbdZMQ/R/zmq.r0000644000176200001440000000145413260234554012612 0ustar liggesusers#' The C-like ZeroMQ Interface #' #' @description #' The basic interface to ZeroMQ that somewhat models the C interface. #' #' @details #' A list of all functions for this interface is as follows: #' #' \tabular{lll}{ #' \code{zmq.bind()} \tab \code{zmq.close()} \tab \code{zmqconnect()} \cr #' \code{zmq.ctx.destroy()} \tab \code{zmq.ctx.new()} \tab \code{zmq.msg.recv()} \cr #' \code{zmq.msg.send()} \tab \code{zmq.recv()} \tab \code{zmq.send()} \cr #' \code{zmq.socket()} \tab \tab \cr #' } #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @keywords zmq #' @rdname xx_czmq_wrapper #' @name C-like Wrapper Functions for ZeroMQ NULL pbdZMQ/R/111_control.r0000644000176200001440000001427513260234554014052 0ustar liggesusers#' Sets of controls in pbdZMQ. #' #' These sets of controls are used to provide default values in this package. #' #' @param warning.at.error,stop.at.error,check.eintr #' Logical; if there is a messaging error, should there be an #' R warning/error, or check user interrupt events. #' @param POLLIN,POLLOUT,POLLERR #' ZMQ poll options; see zmq.h for details. #' @param BLOCK,DONTWAIT,NOBLOCK,SNDMORE #' ZMQ socket options; see zmq.h for details. #' @param AFFINITY,IDENTITY,SUBSCRIBE,UNSUBSCRIBE,RATE,RECOVERY_IVL,SNDBUF,RCVBUF,RCVMORE,FD,EVENTS,TYPE,LINGER,RECONNECT_IVL,BACKLOG,RECONNECT_IVL_MAX,MAXMSGSIZE,SNDHWM,RCVHWM,MULTICAST_HOPS,RCVTIMEO,SNDTIMEO,LAST_ENDPOINT,ROUTER_MANDATORY,TCP_KEEPALIVE,TCP_KEEPALIVE_CNT,TCP_KEEPALIVE_IDLE,TCP_KEEPALIVE_INTVL,TCP_ACCEPT_FILTER,IMMEDIATE,XPUB_VERBOSE,ROUTER_RAW,IPV6,MECHANISM,PLAIN_SERVER,PLAIN_USERNAME,PLAIN_PASSWORD,CURVE_SERVER,CURVE_PUBLICKEY,CURVE_SECRETKEY,CURVE_SERVERKEY,PROBE_ROUTER,REQ_CORRELATE,REQ_RELAXED,CONFLATE,ZAP_DOMAIN,ROUTER_HANDOVER,TOS,IPC_FILTER_PID,IPC_FILTER_UID,IPC_FILTER_GID,CONNECT_RID,GSSAPI_SERVER,GSSAPI_PRINCIPAL,GSSAPI_SERVICE_PRINCIPAL,GSSAPI_PLAINTEXT,HANDSHAKE_IVL,IDENTITY_FD,SOCKS_PROXY,XPUB_NODROP #' ZMQ socket options; see zmq.h for details. #' @param PAIR,PUB,SUB,REQ,REP,DEALER,ROUTER,PULL,PUSH,XPUB,XSUB,STREAM #' ZMQ socket types; see zmq.h for details. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @keywords global variables #' @seealso \code{\link{.pbd_env}}. #' @name ZMQ Control Functions #' @rdname zz_zmq_control NULL ### For ZMQ message control. #' @export #' @rdname zz_zmq_control ZMQ.MC <- function( warning.at.error = TRUE, stop.at.error = FALSE, check.eintr = FALSE ){ list( warning.at.error = warning.at.error, stop.at.error = stop.at.error, check.eintr = check.eintr ) } ### For ZMQ polll (I/O multiplexing). #' @export #' @rdname zz_zmq_control ZMQ.PO <- function( POLLIN = 1L, POLLOUT = 2L, POLLERR = 4L# , # POLLITEMS_DFLT = 16L ){ list( POLLIN = POLLIN, POLLOUT = POLLOUT, POLLERR = POLLERR# , # POLLITEMS_DFLT = POLLITEMS_DFLT ) } ### For ZMQ send/recv options, see zmq.h for details. #' @export #' @rdname zz_zmq_control ZMQ.SR <- function( BLOCK = 0L, DONTWAIT = 1L, NOBLOCK = 1L, SNDMORE = 2L ){ list( BLOCK = BLOCK, DONTWAIT = DONTWAIT, NOBLOCK = NOBLOCK, SNDMORE = SNDMORE ) } ### For ZMQ socket options, see zmq.h for details. #' @export #' @rdname zz_zmq_control ZMQ.SO <- function( AFFINITY = 4L, IDENTITY = 5L, SUBSCRIBE = 6L, UNSUBSCRIBE = 7L, RATE = 8L, RECOVERY_IVL = 9L, SNDBUF = 11L, RCVBUF = 12L, RCVMORE = 13L, FD = 14L, EVENTS = 15L, TYPE = 16L, LINGER = 17L, RECONNECT_IVL = 18L, BACKLOG = 19L, RECONNECT_IVL_MAX = 21L, MAXMSGSIZE = 22L, SNDHWM = 23L, RCVHWM = 24L, MULTICAST_HOPS = 25L, RCVTIMEO = 27L, SNDTIMEO = 28L, LAST_ENDPOINT = 32L, ROUTER_MANDATORY = 33L, TCP_KEEPALIVE = 34L, TCP_KEEPALIVE_CNT = 35L, TCP_KEEPALIVE_IDLE = 36L, TCP_KEEPALIVE_INTVL = 37L, TCP_ACCEPT_FILTER = 38L, IMMEDIATE = 39L, XPUB_VERBOSE = 40L, ROUTER_RAW = 41L, IPV6 = 42L, MECHANISM = 43L, PLAIN_SERVER = 44L, PLAIN_USERNAME = 45L, PLAIN_PASSWORD = 46L, CURVE_SERVER = 47L, CURVE_PUBLICKEY = 48L, CURVE_SECRETKEY = 49L, CURVE_SERVERKEY = 50L, PROBE_ROUTER = 51L, REQ_CORRELATE = 52L, REQ_RELAXED = 53L, CONFLATE = 54L, ZAP_DOMAIN = 55L, ROUTER_HANDOVER = 56L, TOS = 57L, IPC_FILTER_PID = 58L, IPC_FILTER_UID = 59L, IPC_FILTER_GID = 60L, CONNECT_RID = 61L, GSSAPI_SERVER = 62L, GSSAPI_PRINCIPAL = 63L, GSSAPI_SERVICE_PRINCIPAL = 64L, GSSAPI_PLAINTEXT = 65L, HANDSHAKE_IVL = 66L, IDENTITY_FD = 67L, SOCKS_PROXY = 68L, XPUB_NODROP = 69L ){ list( AFFINITY = AFFINITY, IDENTITY = IDENTITY, SUBSCRIBE = SUBSCRIBE, UNSUBSCRIBE = UNSUBSCRIBE, RATE = RATE, RECOVERY_IVL = RECOVERY_IVL, SNDBUF = SNDBUF, RCVBUF = RCVBUF, RCVMORE = RCVMORE, FD = FD, EVENTS = EVENTS, TYPE = TYPE, LINGER = LINGER, RECONNECT_IVL = RECONNECT_IVL, BACKLOG = BACKLOG, RECONNECT_IVL_MAX = RECONNECT_IVL_MAX, MAXMSGSIZE = MAXMSGSIZE, SNDHWM = SNDHWM, RCVHWM = RCVHWM, MULTICAST_HOPS = MULTICAST_HOPS, RCVTIMEO = RCVTIMEO, SNDTIMEO = SNDTIMEO, LAST_ENDPOINT = LAST_ENDPOINT, ROUTER_MANDATORY = ROUTER_MANDATORY, TCP_KEEPALIVE = TCP_KEEPALIVE, TCP_KEEPALIVE_CNT = TCP_KEEPALIVE_CNT, TCP_KEEPALIVE_IDLE = TCP_KEEPALIVE_IDLE, TCP_KEEPALIVE_INTVL = TCP_KEEPALIVE_INTVL, TCP_ACCEPT_FILTER = TCP_ACCEPT_FILTER, IMMEDIATE = IMMEDIATE, XPUB_VERBOSE = XPUB_VERBOSE, ROUTER_RAW = ROUTER_RAW, IPV6 = IPV6, MECHANISM = MECHANISM, PLAIN_SERVER = PLAIN_SERVER, PLAIN_USERNAME = PLAIN_USERNAME, PLAIN_PASSWORD = PLAIN_PASSWORD, CURVE_SERVER = CURVE_SERVER, CURVE_PUBLICKEY = CURVE_PUBLICKEY, CURVE_SECRETKEY = CURVE_SECRETKEY, CURVE_SERVERKEY = CURVE_SERVERKEY, PROBE_ROUTER = PROBE_ROUTER, REQ_CORRELATE = REQ_CORRELATE, REQ_RELAXED = REQ_RELAXED, CONFLATE = CONFLATE, ZAP_DOMAIN = ZAP_DOMAIN, ROUTER_HANDOVER = ROUTER_HANDOVER, TOS = TOS, IPC_FILTER_PID = IPC_FILTER_PID, IPC_FILTER_UID = IPC_FILTER_UID, IPC_FILTER_GID = IPC_FILTER_GID, CONNECT_RID = CONNECT_RID, GSSAPI_SERVER = GSSAPI_SERVER, GSSAPI_PRINCIPAL = GSSAPI_PRINCIPAL, GSSAPI_SERVICE_PRINCIPAL = GSSAPI_SERVICE_PRINCIPAL, GSSAPI_PLAINTEXT = GSSAPI_PLAINTEXT, HANDSHAKE_IVL = HANDSHAKE_IVL, IDENTITY_FD = IDENTITY_FD, SOCKS_PROXY = SOCKS_PROXY, XPUB_NODROP = XPUB_NODROP ) } ### For ZMQ socket types, see zmq.h for details. #' @export #' @rdname zz_zmq_control ZMQ.ST <- function( PAIR = 0L, PUB = 1L, SUB = 2L, REQ = 3L, REP = 4L, DEALER = 5L, ROUTER = 6L, PULL = 7L, PUSH = 8L, XPUB = 9L, XSUB = 10L, STREAM = 11L ){ list( PAIR = PAIR, PUB = PUB, SUB = SUB, REQ = REQ, REP = REP, DEALER = DEALER, ROUTER = ROUTER, PULL = PULL, PUSH = PUSH, XPUB = XPUB, XSUB = XSUB, STREAM = STREAM ) } pbdZMQ/R/shellexec_wcc.r0000644000176200001440000000410713260234554014611 0ustar liggesusers#' Shell Execution via cmd windows #' #' This function is an extension to the \code{shell.exec}() which is a native #' function of R #' #' \code{shell.exec("a.txt")} will open a windows (notepad) to edit the file #' \code{a.txt} in windows system. However, the notepad will block the (parent) #' active R windows, i.e. \code{SW.cmd = 5} as \code{SH_SHOW} by default. #' #' The \code{shellexec.wcc("a.txt", SW.cmd = 7L)} will open the notepad, but in #' a minimized window. Therefore, there is no blocking to the active R windows. #' See the website in the references section to see more options to control the #' behavior of new windows. Possible choices are #' #' \code{SW_SHOW (5)}: Activates the window and displays it in its current size #' and position. #' #' \code{SW_SHOWMINIMIZED (2)}: Activates the window and displays it as a #' minimized window. #' #' \code{SW_SHOWMINNOACTIVE (7)}: Displays the window as a minimized window. #' The active window remains active. #' #' \code{SW_SHOWNA (8)}: Displays the window in its current state. The active #' window remains active. #' #' @param file #' a file name as in \code{shell.exec}() #' @param SW.cmd #' a SW_* command of showing windows #' #' @return #' A new windows with certain applications depending on the association #' of the input \code{file}. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' #' @references Microsoft, Windows Dev Center: Windows desktop applications > #' Develop > Desktop technologies > Desktop Environment > The Windows Shell > #' Shell Reference > Shell Functions > ShellExecute #' #' \code{https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx} #' #' @examples #' \dontrun{ #' library(pbdZMQ, quietly = TRUE) #' #' shellexec.wcc("a.txt", 5L) #' } #' #' @keywords internal #' @seealso \code{shell.exec()}. #' @rdname u0_shellexec.wcc shellexec.wcc <- function(file, SW.cmd = 7L){ if(length(file) == 1 && is.character(file)){ .Call("shellexec_wcc", file, as.integer(SW.cmd), PACKAGE="pbdZMQ") } else{ stop("file should be a character vector of length 1.") } } pbdZMQ/R/R_zmq_transfer.r0000644000176200001440000000520613260234554014776 0ustar liggesusers#' File Transfer Functions #' #' High level functions calling \code{zmq_send()} and \code{zmq_recv()} #' to transfer a file in 200 KiB chunks. #' #' @details #' \code{zmq.sendfile()} binds a \code{ZMQ_PUSH} socket, and #' \code{zmq.recvfile()} connects to this with a \code{ZMQ_PULL} socket. #' #' @param port #' A valid tcp port. #' @param endpoint #' A ZMQ socket endpoint. #' @param filename #' The name (as a string) of the in/out files. #' @param verbose #' logical; determines if a progress bar should be shown. #' @param flags #' a flag for the method used by \code{zmq_sendfile} and #' \code{zmq_recvfile} #' #' #' @return \code{zmq.sendfile()} and \code{zmq.recvfile()} return #' number of bytes (invisible) in the sent message if successful, #' otherwise returns -1 (invisible) and sets \code{errno} to the error #' value, see ZeroMQ manual for details. #' #' @author Drew Schmidt and Christian Heckendorf #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' ### Run the sender and receiver code in separate R sessions. #' #' # Receiver #' library(pbdZMQ, quietly = TRUE) #' zmq.recvfile(55555, "localhost", "/tmp/outfile", verbose=TRUE) #' #' # Sender #' library(pbdZMQ, quietly = TRUE) #' zmq.sendfile(55555, "/tmp/infile", verbose=TRUE) #' } #' #' @keywords programming #' @seealso \code{\link{zmq.msg.send}()}, \code{\link{zmq.msg.recv}()}. #' @rdname b1_sendrecvfile #' @name File Transfer Functions NULL #' @rdname b1_sendrecvfile #' @export zmq.sendfile <- function(port, filename, verbose=FALSE, flags = .pbd_env$ZMQ.SR$BLOCK) { ctx <- zmq.ctx.new() socket <- zmq.socket(ctx, .pbd_env$ZMQ.ST$PUSH) endpoint <- address("*", port) zmq.bind(socket, endpoint) filesize <- as.double(file.info(filename)$size) send.socket(socket, filesize) ret <- .Call("R_zmq_send_file", socket, filename, as.integer(verbose), filesize, as.integer(flags), PACKAGE = "pbdZMQ") zmq.close(socket) zmq.ctx.destroy(ctx) invisible(ret) } #' @rdname b1_sendrecvfile #' @export zmq.recvfile <- function(port, endpoint, filename, verbose=FALSE, flags = .pbd_env$ZMQ.SR$BLOCK) { ctx <- zmq.ctx.new() socket <- zmq.socket(ctx, .pbd_env$ZMQ.ST$PULL) endpoint <- address(endpoint, port) zmq.connect(socket, endpoint) filesize <- receive.socket(socket) ret <- .Call("R_zmq_recv_file", socket, filename, as.integer(verbose), filesize, as.integer(flags), PACKAGE = "pbdZMQ") invisible(ret) } pbdZMQ/R/R_zmq_context.r0000644000176200001440000000273513260234554014642 0ustar liggesusers#' Context Functions #' #' Context functions #' #' \code{zmq.ctx.new()} initializes a ZMQ context for starting communication. #' #' \code{zmq.ctx.destroy()} terminates the context for stopping communication. #' #' @param ctx #' a ZMQ context #' #' @return #' \code{zmq.ctx.new()} returns an R external pointer (\code{ctx}) #' generated by ZMQ C API pointing to a context if successful, otherwise #' returns an R \code{NULL}. #' #' \code{zmq.ctx.destroy()} returns 0 if successful, otherwise returns -1 and #' sets \code{errno} to either \code{EFAULT} or \code{EINTR}. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @examples #' \dontrun{ #' library(pbdZMQ, quietly = TRUE) #' #' context <- zmq.ctx.new() #' zmq.ctx.destroy(context) #' } #' #' @keywords programming #' @seealso \code{\link{zmq.socket}()}, \code{\link{zmq.close}()}, #' \code{\link{zmq.bind}()}, \code{\link{zmq.connect}()}. #' @rdname a0_d_context #' @name Context Functions NULL #' @rdname a0_d_context #' @export zmq.ctx.new <- function(){ ret <- .Call("R_zmq_ctx_new", PACKAGE = "pbdZMQ") ### Users are responsible to take care free and gc. # reg.finalizer(ret, zmq.ctx.destroy, TRUE) ret } #' @rdname a0_d_context #' @export zmq.ctx.destroy <- function(ctx){ .Call("R_zmq_ctx_destroy", ctx, PACKAGE = "pbdZMQ") invisible() } pbdZMQ/R/rzmq_wrapper.r0000644000176200001440000000643513260234554014540 0ustar liggesusers#' All Wrapper Functions for rzmq #' #' Wrapper functions for backwards compatibility with rzmq. See vignette #' for examples. #' #' @details #' \code{send.socket()}/\code{receive.socket()} send/receive messages over #' a socket. These are simple wrappers around \code{zmq.msg.send()} and #' \code{zmq.msg.receive()}, respectively. #' #' \code{init.context()} creates a new ZeroMQ context. A useful wrapper #' around \code{zmq.ctx.new()} which handles freeing memory for you, i.e. #' \code{zmq.ctx.destroy()} will automatically be called for you. #' #' \code{init.socket()} creates a ZeroMQ socket; serves as a high-level #' binding for \code{zmq.socket()}, including handling freeing memory #' automatically. See also \code{.pbd_env$ZMQ.ST}. #' #' \code{bind.socket()}: see \code{zmq.bind()}. #' #' \code{connect.socket()}: see \code{zmq.connect()} #' #' @param socket #' A ZMQ socket. #' @param data #' An R object. #' @param send.more #' Logical; will more messages be sent? #' @param serialize,unserialize #' Logical; determines if serialize/unserialize should be called #' on the sent/received data. #' @param dont.wait #' Logical; determines if reception is blocking. #' @param context #' A ZMQ context. #' @param socket.type #' The type of ZMQ socket as a string, of the form "ZMQ_type". Valid 'type' #' values are PAIR, PUB, SUB, REQ, REP, DEALER, PULL, PUSH, XPUB, XSUB, and #' STERAM. #' @param address #' A valid address. See details. #' #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. #' #' @references ZeroMQ/4.1.0 API Reference: #' \url{http://api.zeromq.org/4-1:_start} #' #' Programming with Big Data in R Website: \url{http://r-pbd.org/} #' #' @keywords rzmq #' @rdname xx_rzmq_wrapper #' @name Wrapper Functions for rzmq NULL #' @rdname xx_rzmq_wrapper #' @export send.socket <- function(socket, data, send.more = FALSE, serialize = TRUE){ if(send.more){ flags <- .pbd_env$ZMQ.SR$SNDMORE } else{ flags <- .pbd_env$ZMQ.SR$BLOCK } zmq.msg.send(data, socket, flags = flags, serialize = serialize) } #' @rdname xx_rzmq_wrapper #' @export receive.socket <- function(socket, unserialize = TRUE, dont.wait = FALSE){ if(dont.wait){ flags <- .pbd_env$ZMQ.SR$DONTWAIT } else{ flags <- .pbd_env$ZMQ.SR$BLOCK } zmq.msg.recv(socket, flags = flags, unserialize = unserialize) } #' @rdname xx_rzmq_wrapper #' @export init.context <- function(){ try.zmq.ctx.destroy <- function(ctx){ invisible(suppressWarnings(zmq.ctx.destroy(ctx))) } ctx <- zmq.ctx.new() reg.finalizer(ctx, try.zmq.ctx.destroy, onexit = TRUE) ctx } #' @rdname xx_rzmq_wrapper #' @export init.socket <- function(context, socket.type){ try.zmqt.close <- function(socket){ invisible(suppressWarnings(zmq.close(socket))) } socket.type <- sub(".*_", "", socket.type) id <- which(names(.pbd_env$ZMQ.ST) == socket.type) if(length(id) != 1){ stop("socket.type is not found.") } else{ socket.type <- .pbd_env$ZMQ.ST[[id]] } socket <- zmq.socket(context, type = socket.type) reg.finalizer(socket, try.zmqt.close, onexit = TRUE) socket } #' @rdname xx_rzmq_wrapper #' @export bind.socket <- function(socket, address){ zmq.bind(socket, address) } #' @rdname xx_rzmq_wrapper #' @export connect.socket <- function(socket, address){ zmq.connect(socket, address) } pbdZMQ/vignettes/0000755000176200001440000000000013271756330013426 5ustar liggesuserspbdZMQ/vignettes/pbdZMQ-include/0000755000176200001440000000000013271756323016206 5ustar liggesuserspbdZMQ/vignettes/pbdZMQ-include/06-solaris.tex0000644000176200001440000001246713260234554020634 0ustar liggesusers\section[Solaris 10]{Solaris 10} \label{sec:solaris_10} \addcontentsline{toc}{section}{\thesection. Solaris 10} Solaris 10 with external ZeroMQ 4.0.7 library and GNU tools (OpenCSW) has be tested for \pkg{pbdZMQ} successfully. The \code{INSTALL.solaris} has the steps which basically are \begin{enumerate} \item install GNU tools from OpenCSW using \code{pkgutil}, \item set path to GNU tools, \item install external ZeroMQ 4.0.7 library using GNU tools, and \item install \pkg{pbdZMQ} linked with external ZeroMQ. \end{enumerate} The steps are tested without too much time effort for further changes and can quickly provide a compiled library and install the \pkg{pbdZMQ}. I write down some considerations about ZeroMQ library here as a note in next. \begin{enumerate} \item Current, the ZeroMQ library on OpenCSW is 2.2.0 which is too old to be compiled with \pkg{pbdZMQ}. \item Newer ZeroMQ (> 4.0.7) can not be compiled with OpenCSW, there are more bugs to fix for Solaris according github's pull request. \item Using Sun CC is even more complicated because there are more compile flags needed to take care first. \end{enumerate} \subsection[Have a Solaris 10?]{Have a Solaris 10?} \label{sec:have_solaris_10} \addcontentsline{toc}{subsection}{\thesubsection. Have a Solaris 10?} It is easy and has a lot of fun. \begin{enumerate} \item Install an Oracle VM VirtualBox which is available at \url{https://www.virtualbox.org/}. \item Download a Solaris template from \\ \url{http://www.oracle.com/technetwork/server-storage/vm/solaris-098101.html}. \item Import the template to the VM. \item Boot and setup root password, internet, share drives, etc. \item Done. \end{enumerate} The next to do is having compilers by installing OpenCSW first, then install libraries and software either from OpenCSW website or compile them manually. One can have most GNU tools and \proglang{R} installed from OpenCSW via \code{pkgutil} command, and compile ZeroMQ library externally using those tools, then install \pkg{pbdZMQ} by linking with the compiled ZeroMQ library. The details are given in the following Sections. \subsection[OpenCSW]{OpenCSW} \label{sec:opencsw} \addcontentsline{toc}{subsection}{\thesubsection. OpenCSW} The OpenCSW (\url{www.opencsw.org}) provides binary packages of GNU tools for Solaris 10. Ideally, gmake, gcc, g++, autoconf, automake, gtar are required which all available from the website. For example, the gcc is in "gcc4core" package which can be installed with a few \code{pkgutil} commands by \begin{Code} > pkgadd -d http://get.opencsw.org/now > /opt/csw/bin/pkgutil -U > /opt/csw/bin/pkgutil -y -i gcc4core > /usr/sbin/pkgchk -L CSWgcc4core # list files \end{Code} Typically, the binary packages are installed under \code{/opt/csw/}. Make sure those GNU tools are also in the path and export it to the environment. For example, I have \begin{Code} PATH=/opt/csw/gnu:/opt/csw/bin:/opt/csw/i386-pc-solaris2.10/bin: /usr/sbin:/usr/bin:/usr/openwin/bin:/usr/ucb export PATH \end{Code} in a file name \code{set_path.sh}. Then, I set it to the environment by \begin{Code} > . ./set_path.sh \end{Code} I also have a symbolic link "make" to "gmake" to avoid configuration problems. If not, use \code{ln -s} to make one. Further, the \proglang{R} may not be easy to compile in Solaris 10, but the binary package of \proglang{R} is also available in OpenCSW. It can be installed by \begin{Code} > pkgadd -d http://get.opencsw.org/now > /opt/csw/bin/pkgutil -U > /opt/csw/bin/pkgutil -y -i r_base > /usr/sbin/pkgchk -L CSWr-base # list files \end{Code} which has currently \proglang{R} version 3.1.1. It may be a little bit old, but it is good enough for testing ZeroMQ and \pkg{pbdZMQ}. The developing/daily version of \proglang{R} may not be easily compiled by the OpenCSW. \subsection[Compile ZeroMQ]{Compile ZeroMQ} \label{sec:compile_zeromq} \addcontentsline{toc}{subsection}{\thesubsection. Compile ZeroMQ} The OpenCSW also has binary packages for ZeroMQ, named \pkg{libzmq1} and \pkg{libzmq1\_dev}. The package is a little bit out of date (version 2.2.0 built in 2012). This old version is not comparable with current \pkg{pbdZMQ}. The solution is to compile and install an external ZeroMQ 4.0.7 which available from \url{http://download.zeromq.org}. This version 4.0.7 is the latest stable ZeroMQ version. The newer versions of ZeroMQ, such as >= 4.1.0, may have more bugs for Solaris 10. I install the ZeroMQ library to \code{/work-my/local/zmq} with the following commands. \begin{Code} > gtar zxvf zeromq-4.0.7.tar.gz > cd zeromq-4.0.7 > ./configure --prefix=/work-my/local/zmq > make > make install \end{Code} There may have some warnings, but they are ok. The default installs the share library which can be linked by \pkg{pbdZMQ}. \subsection[Install pbdZMQ]{Install pbdZMQ} \label{sec:install_pbdzmq} \addcontentsline{toc}{subsection}{\thesubsection. Install pbdZMQ} With the OpenCSW and external ZeroMQ 4.0.7 installed, I can install \pkg{pbdZMQ} simply via \begin{Code} > R CMD INSTALL pbdZMQ_0.2-0.tar.gz \ --configure-vars="ZMQ_INCLUDE='-I/work-my/local/zmq/include' \ ZMQ_LDFLAGS='-L/work-my/local/zmq/lib -lzmq'" \end{Code} Then, the test can be done by \begin{Code} > Rscript -e "demo(hwserver,'pbdZMQ',ask=F,echo=F)" & > Rscript -e "demo(hwclient,'pbdZMQ',ask=F,echo=F)" \end{Code} when the \pkg{pbdZMQ} installation is done correctly. pbdZMQ/vignettes/pbdZMQ-include/03-example.tex0000644000176200001440000000325013260234554020576 0ustar liggesusers\section[Examples]{Examples} \label{sec:examples} \addcontentsline{toc}{section}{\thesection. Examples} The package provides several simple examples based on \emph{the ZeroMQ guide for C developers} by Pieter Hintjens~\citep{Hintjens}. These are located in the \code{demo/} subdirectory of the \pkg{pbdZMQ} package source, and they include:\\ \begin{center} \vspace{0.2cm} \begin{tabular}{ll} \hline\hline Examples & Descriptions \\ \hline \code{hwclient.r} & hello world client \\ \code{hwserver.r} & hello world server \\ \hline \code{tasksink.r} & task sink from two workers \\ \code{taskvent.r} & task ventilator send jobs to two workers \\ \code{taskwork.r} & task workers \\ \hline \code{wuclient.r} & weather updating client \\ \code{wuserver.r} & weather updating server \\ \hline \code{mspoller.r} & using poller to receive messages from multiple sockets \\ \code{msreader.r} & receive messages from multiple sockets \\ \hline \code{mpclient.r} & hello world client in mpltiple part version \\ \code{mpserver.r} & hello world server in mpltiple part version \\ \hline \hline \end{tabular} \end{center} For instance, the task examples can be run by \begin{Command} Rscript taskwork.r & Rscript taskvent.r Rscript tasksink.r ### Remember to kill two worker processors at the end, such as ps -x|grep "file=task.*\.r"|sed "s/\(.*\) pts.*/\1/"|xargs kill -9 \end{Command} Or, via \code{demo()} function as the hello world example in Section~\ref{sec:installation}. The weather updating examples can be run by \begin{Command} Rscript wuserver.r & Rscript wuclient.r rm weather.ipc \end{Command} Or, via \code{demo()} function as the hello world example in Section~\ref{sec:installation}. pbdZMQ/vignettes/pbdZMQ-include/00-preamble.tex0000644000176200001440000000155713260234554020737 0ustar liggesusers\usepackage{verbatim} \usepackage{amsmath} \usepackage{amsthm} \usepackage{amssymb} \definecolor{mygreen}{RGB}{0,150,0} \usepackage{listings} %\lstset{numbers=left,numberstyle=\footnotesize\ttfamily, \lstset{numbers=none,numberstyle=\footnotesize\ttfamily, frame=single,frameround=tttt,language=R, showspaces=false,showstringspaces=false, breaklines=true,breakatwhitespace=true, basicstyle=\small\ttfamily} %\lstset{literate={<-}{{$\leftarrow$}}1} \makeatletter \let\Code\@undefined \let\CodeInput\@undefined \let\CodeOutput\@undefined \makeatother \lstnewenvironment{Command}[1][title=Shell Command]{\lstset{#1}}{} \lstnewenvironment{Code}[1][title=R Script]{\lstset{#1}}{} \lstnewenvironment{CodeOutput}[1][title=R Output]{\lstset{#1}}{} \lstnewenvironment{Error}[1][]{ \lstset{title=Error Message,basicstyle=\small\ttfamily}\color{Red}}{} pbdZMQ/vignettes/pbdZMQ-include/04-backward.tex0000644000176200001440000000150213260234554020720 0ustar liggesusers\section[Backwards Compatibility with rzmq]{Backwards Compatibility with \pkg{rzmq}} \label{sec:backward} \addcontentsline{toc}{section}{\thesection. Backwards Compatibility with \pkg{rzmq}} This package currently has a few wrapper functions to offer the same API as that of the \pkg{rzmq} package~\citep{Armstrong2014}. The intent is to offer backwards compatibility as much as possible, but possibly with a reduced functionality set. Users are encouraged to use native \code{zmq.*()} functions provided by \pkg{pbdZMQ}. The wrapper functions are:\\ \begin{center} \vspace{0.2cm} \begin{tabular}{l} \hline\hline Functions \\ \hline \code{send.socket()} \\ \code{receive.socket()} \\ \code{init.context()} \\ \code{init.socket()} \\ \code{bind.socket()} \\ \code{connect.socket()} \\ \hline\hline \end{tabular} \end{center} pbdZMQ/vignettes/pbdZMQ-include/01-acknowledgement.tex0000644000176200001440000000300513260234554022306 0ustar liggesusers \section*{Acknowledgement} \addcontentsline{toc}{section}{Acknowledgement} Chen was supported in part by the project ``Bayesian Assessment of Safety Profiles for Pregnant Women From Animal Study to Human Clinical Trial'' funded by U.S. Food and Drug Administration, Office of Women's Health. The project was supported in part by an appointment to the Research Participation Program at the Center For Biologics Evaluation and Research administered by the Oak Ridge Institute for Science and Education through an interagency agreement between the U.S. Department of Energy and the U.S. Food and Drug Administration. \\\\ Schmidt was supported in part by the project ``Harnessing Scalable Libraries for Statistical Computing on Modern Architectures and Bringing Statistics to Large Scale Computing'' funded by the National Science Foundation Division of Mathematical Sciences under Grant No. 1418195. \section*{Disclaimer} \addcontentsline{toc}{section}{Disclaimer} The findings and conclusions in this article have not been formally disseminated by the U.S. Department of Health \& Human Services, U.S. Food and Drug Administration, nor Oak Ridge Institute for Science and Education. They should not be construed to represent any determination or policy of University, Agency, Administration and National Laboratory. \\\\ Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. pbdZMQ/vignettes/pbdZMQ-include/05-cs.tex0000644000176200001440000002112513260234554017553 0ustar liggesusers\section[A Basic Client/Server]{A Basic Client/Server} \label{sec:cs} \addcontentsline{toc}{section}{\thesection. A Basic Client/Server} In this section, we will develop a more complicated and realistic example using \pkg{pbdZMQ}. The example will show the construction of a basic client and server. To do so, we will (eventually) use the Request/Reply pattern, where a message is passed from client to server, executed on the server, and then the result is passed back to the client as a message. All server code is meant to be executed in batch; though it can be used from an interactive R session, we feel this somewhat misses the point. To do this, save the server code as, say, \code{server.r} and start the server by running \begin{Command} Rscript server.r \end{Command} from a terminal. One could use \code{R CMD BATCH} in place of \code{Rscript}, though by default it will suppress some messages on the server that we will want to see. Finally, the client should be run inside of an interactive \proglang{R} session. This can be from RStudio, the Windows/Mac \proglang{R} guis, or by running the command \code{R} at the terminal --- the way you are used to using \proglang{R}. Throughout our examples here, we will be using the \pkg{rzmq}-like bindings available in \pkg{pbdZMQ}. The other interfaces are easy enough to figure out once you understand one of them; and the \pkg{rzmq} ones are arguably the most \proglang{R}-like of the three. The source code for the final example can be found in the \code{inst/examples/reqrep/} subtree of the \pkg{pbdZMQ} source, or under \code{examples/reqrep/} of the binary installation. The same directory contains versions of this example using the other \pkg{pbdZMQ} interfaces. \subsection{Our First Client/Server} \paragraph{The Server} Our first server will be very humble. It will receive one command from the client, print that command, and send back a success message before terminating --- nothing more. Save the following in a file, say \code{server.r}, and execute it by running \code{Rscript server.r} from a terminal: \begin{lstlisting}[language=R,title=Server] library(pbdZMQ) ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REP") bind.socket(socket, "tcp://*:55555") cat("Client command: ") msg <- receive.socket(socket) cat(msg, "\n") send.socket(socket, "Message received!") \end{lstlisting} Unfortunately, the first 4 lines are just boilerplate; see the package manual for an explanation. The good news is that this is about as complicated as it gets on the ZeroMQ side; everything beyond this is just \proglang{R} programming. \paragraph{The Client} From and interactive R session (\emph{not} in batch!), enter the following: \begin{lstlisting}[language=R,title=Client] library(pbdZMQ) ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REQ") connect.socket(socket, "tcp://localhost:55555") send.socket(socket, "1+1") receive.socket(socket) \end{lstlisting} If all goes well, your message (namely, \code{"1+1"}) should be sent from the client to the server, and the response \code{"Message received!"} should be sent from server to client. Afterwards, the server will terminate and you are free to exit your interactive \proglang{R} session (i.e., the client). This example is deliberately as basic as can be, and lacks 2 crucial features: server persistence, and remote execution of commands. We will develop examples with these features in the remainder of this section. \subsection{A Persistent Server} \paragraph{The Server} Next, we make the server \emph{persistent}, in the sense that it will not immediately die after receiving its first command. This is trivial, as all we need to do is encapsulate the receive/send piece inside a \code{while} loop. As before, save the following to a file and execute in batch via \code{Rscript}: \begin{lstlisting}[language=R,title=Server] library(pbdZMQ) ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REP") bind.socket(socket, "tcp://*:55555") while(TRUE) { cat("Client command: ") msg <- receive.socket(socket) cat(msg, "\n") send.socket(socket, "Message received!") } \end{lstlisting} The \code{receive.socket()} command does not use \emph{busy waiting}. You can verify this by starting up the server and then looking at a process monitor for your operating system; you should see no elevated activity. \paragraph{The Client} Set up the client as above (everything but the \code{send.socket()} line is necessary) in an interaction \proglang{R} session. Now that we have a persistent server, we can make a shorthand function that encapsulates sending a message (from client to server) and receiving a response (from server to client): \begin{lstlisting}[language=R,title=Client Send/Receive] sendrecv <- function(socket, data) { send.socket(socket, data) receive.socket(socket) } \end{lstlisting} This assumes that the various optional arguments in \code{send.socket()} and \code{receive.socket()} are acceptable; and for the purposes of this demonstration they are. But the reader is encouraged to consult the \pkg{pbdZMQ} manual for more details about these two functions. Now, with the convenience function, we can simply execute: \begin{lstlisting}[language=R,title=Client Usage] sendrecv(socket, "1+1") sendrecv(socket, "rnorm(10)") \end{lstlisting} or any other valid \proglang{R} command. \subsection{More Than Messaging}\label{fullcs} The final piece is to actually execute commands that are sent to the server, and to pass the result back to the client. This is very easy, and only requires a slight modification to the server code. Modify the server piece above to do the following just after receiving (and printing) the client's message: \begin{lstlisting}[language=R,title=Server Modification] result <- eval(parse(text=msg)) send.socket(socket, result) \end{lstlisting} Of course, you will also need to remove the original \code{send.socket()} line with the one here. A nasty source of bugs in client/server programming is sending when you should receive or vice-versa, leading to deadlocks. One additional thing the observant reader may have already realized is that our client/server framework leaves the server running perpetually, with no reasonable way for the client to terminate it. This just requires basic filtering of incoming messages (from the client, on the server). So for example, we might want the message \code{"EXIT"} to terminate the server. Modifying the server to handle this is trivial, and we present the full server below: \begin{lstlisting}[language=R,title=Full Server] library(pbdZMQ) ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REP") bind.socket(socket, "tcp://*:55555") while(TRUE) { cat("Client command: ") msg <- receive.socket(socket) cat(msg, "\n") if (msg == "EXIT") break result <- eval(parse(text=msg)) send.socket(socket, result) } send.socket(socket, "shutting down!") \end{lstlisting} Notice that we essentially added just a few lines. The first and more obvious is the check on \code{msg} for the magic word \code{"EXIT"}. The addition of the final \code{send.socket()} line at the end, which returns the string \code{"shutting down!"} to the client is necessary to prevent the client from hanging after the server shuts down. Recall, the client expects a response from the server for every message the client sends! \subsection{Other Issues} The above examples are all very basic, but should illustrate how one could proceed to a more complex client/server design using ZeroMQ from R. Of course, there are a host of issues that we have not gone into here that are very important. For example, we perform no scrubbing of inputs that are to be executed on the server. This could be more or less important depending on the application. Another important issue we have not addressed is error and warning handling. The reader is encouraged to return to the example in Subsection~\ref{fullcs} and try executing something like \code{sendrecv(socket, "object_does_not_exist")} or \code{sendrecv(socket, "warning('uh oh')")} to see what happens. Additionally, each time the client wanted to send a message, the user had to manually pass it as an argument to the function \code{sendrecv()}. It is possible --- though complicated --- to create a custom REPL which will automatically handle the client/server send-evaluate-receive pattern as though the user were at a standard \proglang{R} terminal. Finally, we have not addressed the important issue of logging user commands sent to the server. Although anyone comfortable with \proglang{R} should see the path forward. For a more detailed example illustrating these points, see the \pkg{pbdCS} package. pbdZMQ/vignettes/pbdZMQ-include/99-faq.tex0000644000176200001440000000663113260234554017737 0ustar liggesusers \section[FAQs]{FAQs} \label{sec:faqs} \addcontentsline{toc}{section}{\thesection. FAQs} \subsection[ZeroMQ Errors]{ZeroMQ Errors} \label{sec:zmq_errors} \addcontentsline{toc}{subsection}{\thesubsection. ZeroMQ Errors} \begin{enumerate} \item {\bf\color{blue} Q:} If the package installs successfully, but fails at initialization with \begin{Error} error: unable to load shared object '/Users/your_username/Library/R/3.2/library/pbdZMQ/libs/pbdZMQ.so': dlopen(/.../R/3.2/library/pbdZMQ/libs/pbdZMQ.so, 6): Library not loaded: /.../src/zmq/lib/libzmq.4.dylib Referenced from: /.../R/3.2/library/pbdZMQ/libs/pbdZMQ.so \end{Error} or \begin{Error} Library not loaded: /usr/lib/libzmq.4.dylib \end{Error} or \begin{Error} Library not loaded: /usr/lib/libzmq.so.4.0.0 \end{Error} {\bf\color{blue} A:} From the ZeroMQ installation messages: \begin{Code} If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. \end{Code} Further, for Mac OSX, the \code{otool} and \code{install_name_tool} commands are able to find and modify the linking path of \code{pbdZMQ.so} to the library \code{libzmq.4.dylib}. See the source of \code{pbdZMQ/src/install.libs.R} for how to change the linking path, accordingly. The basic steps are: \begin{enumerate} \item to use \code{otool -L pbdZMQ.so} to figure which \code{libzmq.4.dylib} is linked. Note that \code{pbdZMQ.so} should be the one in the installed directory, e.g. \\ \code{/your_R_library_root_path/library/pbdZMQ/libs/pbdZMQ.so}, and \item to use \code{install_name_tool -change org_dylib new_dylib pbdZMQ.so} to update to the right \code{new_dylib}, e.g. \\ \code{/your_R_library_root_path/library/pbdZMQ/libs/libzmq.4.dylib}. \end{enumerate} For linux/unix, the \code{readelf}, \code{chrpath}, \code{pathelf}, \code{ld.so}, and \code{/etc/ld.so.conf} (depending on systems and compilers) may serve the same roles as the \code{otool} and \code{install_name_tool} in Mac OSX. \end{enumerate} \subsection[ZeroMQ Flags]{ZeroMQ Flags} \label{sec:zmq_flags} \addcontentsline{toc}{subsection}{\thesubsection. ZeroMQ Flags} \begin{enumerate} \item {\bf\color{blue} Q:} How do I compile and link with ZeroMQ via \pkg{pbdZMQ} for my package which has \proglang{C/C++} code that call ZeroMQ functions? {\bf\color{blue} A:} There are two \pkg{pbdZMQ} functions: \code{get.zmq.cppflags()} and \code{get.zmq.ldflags()} that provide flags for compiling with ZMQ header files and linking against \code{libzmq.so} or \code{libzmq.dll}, respectivelly. Typically, these two functions will be envoked inside \code{Makevars} and \code{Makevars.win} via \code{Rscript -e '...'} to return the flags and append to whereever they are needed. \end{enumerate} pbdZMQ/vignettes/pbdZMQ-include/01-copyright.tex0000644000176200001440000000044413260234554021153 0ustar liggesusers \null \vfill \copyright\ 2015-2017 Wei-Chen Chen and Drew Schmidt. Permission is granted to make and distribute verbatim copies of this vignette and its source provided the copyright notice and this permission notice are preserved on all copies. This publication was typeset using \LaTeX. pbdZMQ/vignettes/pbdZMQ-include/01-introduction.tex0000644000176200001440000000364313271756323021675 0ustar liggesusers {\color{red} \bf Warning:} This document is written to explain the main functions of \pkg{pbdZMQ}~\citep{Chen2015}, version 0.1-0. Every effort will be made to ensure future versions are consistent with these instructions, but features in later versions may not be explained in this document. Information about the functionality of this package, and any changes in future versions can be found on website: ``Programming with Big Data in R'' at \url{http://r-pbd.org/}~\citep{pbdR2012}. \section[Introduction]{Introduction} \label{sec:introduction} \addcontentsline{toc}{section}{\thesection. Introduction} ZeroMQ (0MQ)~\citep{hintjens2013zeromq}\footnote{Available at \url{http://www.zeromq.org/}} is a library for high-performance asynchronous messaging in scalable distributed applications. It provides APIs in several messaging patterns that, enabling developers a standardized way to form connections between different devices, including laptop computers, mobile devices, servers, clusters, and supercomputers. The APIs also simplify the complex calls to sockets and reduce the burden for developers of handling low-level network communications. Several popular programming languages provide bindings to these APIs. In \pkg{pbdZMQ}, those ZeroMQ APIs are carefully wrapped in \proglang{R} via lower level \proglang{C} code and offers a few ZeroMQ patterns, including \begin{itemize} \item request-reply, in particular, one client and a server, and \item push-pull, in particular, one client and a set of servers. \end{itemize} These patterns are useful communication frameworks utilized in the \pkg{pbdCS}~\citep{Schmidt2015} that combines two different messaging libraries, namely ZeroMQ and MPI, and utilizes their respective advantages in: \begin{itemize} \item user-to-server communication via \pkg{pbdZMQ}, and \item server-to-server computations for statistical programming via \pkg{pbdMPI}~\citep{Chen2012}. \end{itemize} pbdZMQ/vignettes/pbdZMQ-include/my_jss.cls0000644000176200001440000000310613260234554020210 0ustar liggesusers \renewcommand{\makefooter}{% \vspace{\footerskip} } \makeatletter % \def\maketitle{% % \par\textbf{\@title}% % \par{\@author}% % \par} \def\maketitle{ {\centering {\LARGE\bf \@title\par} \vskip 0.2in plus 1fil minus 0.1in { \def\and{\unskip\enspace{\rm and}\enspace}% \def\And{\end{tabular}\hss \egroup \hskip 1in plus 2fil \hbox to 0pt\bgroup\hss \begin{tabular}[t]{c}\large\bf\rule{\z@}{24pt}\ignorespaces}% \def\AND{\end{tabular}\hss\egroup \hfil\hfil\egroup \vskip 0.1in plus 1fil minus 0.05in \hbox to \linewidth\bgroup\rule{\z@}{10pt} \hfil\hfil \hbox to 0pt\bgroup\hss \begin{tabular}[t]{c}\large\bf\rule{\z@}{24pt}\ignorespaces} \hbox to \linewidth\bgroup\rule{\z@}{10pt} \hfil\hfil \hbox to 0pt\bgroup\hss \begin{tabular}[t]{c}\large\bf\rule{\z@}{24pt}\@author \end{tabular}\hss\egroup \hfil\hfil\egroup } } } \makeatother \renewcommand{\jsssec}[2][default]{\vskip \preXLskip% \refstepcounter{section}% \centerline{\textbf{\Large \thesection. #2}} \nopagebreak \vskip \postMskip \nopagebreak} \renewcommand{\jsssubsec}[2][default]{\vskip \preMskip% \refstepcounter{subsection}% \textbf{\large \thesubsection. #2} \nopagebreak \vskip \postSskip \nopagebreak} \renewcommand{\jsssubsubsec}[2][default]{\vskip \preSskip% \refstepcounter{subsubsection}% {\large \textit{#2}} \nopagebreak \vskip \postSskip \nopagebreak} \renewcommand{\jsssimplesec}[2][default]{\vskip \preLskip% \refstepcounter{section}% \textbf{\large #1} \nopagebreak \vskip \postSskip \nopagebreak} pbdZMQ/vignettes/pbdZMQ-include/pbdZMQ.bib0000644000176200001440000000254113260234554020016 0ustar liggesusers@MISC{Chen2012, author = {Chen, W.-C. and Ostrouchov, G. and Schmidt, D. and Patel, P. and Yu, H.}, title = {pbdMPI: Programming with Big Data -- Interface to MPI}, year = {2012}, note = {R Package}, url = {https://cran.r-project.org/package=pbdMPI} } @MISC{Chen2015, author = {Chen, W.-C. and Schmidt, D. and Ostrouchov, G.}, title = {pbdZMQ: Programming with Big Data -- Interface to ZeroMQ}, year = {2015}, note = {R Package}, url = {https://cran.r-project.org/package=pbdZMQ} } @MISC{pbdR2012, author = {Ostrouchov, G. and Chen, W.-C. and Schmidt, D. and Patel, P.}, title = {Programming with Big Data in {R}}, year = {2012}, url = {http://r-pbd.org/} } @MISC{Schmidt2015, author = {Schmidt, D. and Chen, W.-C.}, title = {pbdCS: pbdR Client/Server Utilities}, year = {2015}, note = {R Package}, url = {http://github.com/wrathematics/pbdCS} } @MISC{Hintjens, author = {Hintjens, P.}, title = {The ZeroMQ Guide -- for C Developers}, year = {2013}, note = {}, url = {http://zguide.zeromq.org/page:all} } @MISC{Armstrong2014, author = {Armstrong, W.}, title = {rzmq: R Bindings for ZeroMQ}, year = {2014}, note = {R Package}, url = {https://cran.r-project.org/package=rzmq} } @misc{hintjens2013zeromq, title={ZeroMQ: The Guide}, author={Hintjens, Pieter}, year={2013}, publisher={O'Reilly} } pbdZMQ/vignettes/pbdZMQ-include/02-installation.tex0000644000176200001440000000777013260234554021656 0ustar liggesusers\section[Installation]{Installation} \label{sec:installation} \addcontentsline{toc}{section}{\thesection. Installation} \subsection{Installing} The \pkg{pbdZMQ} package requires an installation of the ZeroMQ library. So before we may discuss particulars of installing the \proglang{R} package, we take a moment here to describe the various ways in which you may install ZeroMQ itself. For convenience, we distribute with the package a distribution of ZeroMQ, although if you have access to a system installation, that may be preferable. We separate installation of ZeroMQ into 3 cases: \begin{enumerate} \item system package manager, such as the \code{libzmq} and \code{libzmq-dev} packages in Debian-derived systems, \item \pkg{pbdZMQ}'s internal ZeroMQ library (4.1.0 rc1), or \item an external ZeroMQ library (4.1.0 rc1 or later). \end{enumerate} \paragraph{With System Package Manager} This method is perhaps the easiest when a package managing system is available, such as on Linux, and returns the locations of the \code{libzmq} include and library paths via: \begin{itemize} \item \code{pkg-config --variable=includedir libzmq} and \item \code{pkg-config --variable=libsdir libzmq}. \end{itemize} In this setup, installation is very straightforward. From a shell, you can execute: \begin{Command} R CMD INSTALL pbdZMQ_0.1-0.tar.gz \end{Command} \paragraph{Using Internal ZeroMQ} This method uses the ZeroMQ library bundled with \pkg{pbdZMQ}, and should be fairly simple. This method has been successfully tested under Linux, Mac OSX, Windows, and FreeBSD. Solaris has been tested with no success. Installation in this way can be simply done by adding the configure argument \code{--enable-internal-zmq}. In practice, this might look something like: \begin{Command} R CMD INSTALL pbdZMQ_0.1-0.tar.gz \ --configure-args="--enable-internal-zmq" \end{Command} \paragraph{Using External ZeroMQ} This method assumes you have built your own ZeroMQ library somewhere, or perhaps one is offered to you by your system administrator. In any event, this method is only tested under Linux systems. As with the previous method, we were unsuccessful in our attempts to build on Solaris. To build ZeroMQ yourself, you might do something like the following: \begin{Command} ./configure \ --prefix=/usr/local/zmq \ --enable-shared=yes \ --with-poller=select \ --without-documentation \ --without-libsodium make -j 4 make install \end{Command} which will install the library to \code{/usr/local/zmq/} where \code{/usr/local/zmq/include/} will have the header file \code{zmq.h} and \code{/usr/local/zmq/lib/} will have the shared library file \code{libzmq.so}. With an external ZeroMQ available, we can install \pkg{pbdZMQ} via: \begin{Command} R CMD INSTALL pbdZMQ_0.1-0.tar.gz \ --configure-vars="ZMQ_INCLUDE='-I/usr/local/zmq/include' \ ZMQ_LDFLAGS='-L/usr/local/zmq/lib -lzmq'" \end{Command} \subsection{Testing the Installation} To make sure that \pkg{pbdZMQ} is installed correctly, one may run a simple ``hello world'' test from {\em one} terminal to test the library as follows: \begin{Command} Rscript -e "demo(hwserver,'pbdZMQ',ask=F,echo=F)" & Rscript -e "demo(hwclient,'pbdZMQ',ask=F,echo=F)" \end{Command} This will run 5 iterations of sending and receiving 'Hello World' messages between two instances (simple server and client). \subsection{Polling System} Note that one may want to use different polling system provided by the ZeroMQ library. By default, the \code{select} method is used in \pkg{pbdZMQ} for Linux, Windows, and Mac OSX. However, users may want to use \code{autodetect} or try others for better polling. Currently, the options as given by ZeroMQ may be \code{kqueue}, \code{epoll}, \code{devpoll}, \code{poll}, or \code{select} depending on libraries and system. You may set the polling method at compile time via: \begin{Command} R CMD INSTALL pbdZMQ_0.1-0.tar.gz \ --configure-vars="ZMQ_POLLER='autodetect'" \end{Command} See the ZeroMQ manual for more details. pbdZMQ/vignettes/pbdZMQ-guide.Rnw0000644000176200001440000000467513260234554016357 0ustar liggesusers%\VignetteIndexEntry{pbdZMQ-guide} \documentclass[article,shortnames,nojss]{jss} \newcommand{\zmqversion}{0.1-0} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% declarations for jss.cls %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% almost as usual \author{ \begin{minipage}{6in} \centering Wei-Chen Chen$^1$ and Drew Schmidt$^1$ \end{minipage} \\ \\ $^1$pbdR Core Team \\ %\\ %\\ %\today } %\title{A Quick Guide for the \pkg{pbdZMQ} Package {\small (Ver. \mpiversion)}} \title{A Quick Guide for the \pkg{pbdZMQ} Package} %% for pretty printing and a nice hypersummary also set: \Plainauthor{Wei-Chen Chen, Drew Schmidt} %% comma-separated \Plaintitle{Quick Guide for pbdZMQ} %% without formatting \Shorttitle{Quick Guide for pbdZMQ} %% a short title (if necessary) %% an abstract and keywords %\Abstract{ %} %\Keywords{} %\Plainkeywords{} %% without formatting %% at least one keyword must be supplied %% publication information %% NOTE: Typically, this can be left commented and will be filled out by the technical editor %% \Volume{13} %% \Issue{9} %% \Month{September} %% \Year{2004} %% \Submitdate{2004-09-29} %% \Acceptdate{2004-09-29} %% The address of (at least) one author should be given %% in the following format: \Address{ Wei-Chen Chen\\ E-mail: \email{wccsnow@gmail.com}\\ URL: \url{http://snoweye.github.io/} } %% It is also possible to add a telephone and fax number %% before the e-mail in the following format: %% Telephone: +43/1/31336-5053 %% Fax: +43/1/31336-734 %% for those who use Sweave please include the following line (with % symbols): %% need no \usepackage{Sweave.sty} %% end of declarations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \input{./pbdZMQ-include/my_jss.cls} \input{./pbdZMQ-include/00-preamble} \begin{document} \pagenumbering{roman} \tableofcontents %\newpage \input{./pbdZMQ-include/01-copyright} %% include your article here, just as usual %% Note that you should use the \pkg{}, \proglang{} and \code{} commands. \newpage \input{./pbdZMQ-include/01-acknowledgement} \newpage \pagenumbering{arabic} \setcounter{page}{1} \input{./pbdZMQ-include/01-introduction} \input{./pbdZMQ-include/02-installation} \input{./pbdZMQ-include/03-example} \input{./pbdZMQ-include/04-backward} \input{./pbdZMQ-include/05-cs} \input{./pbdZMQ-include/06-solaris} \input{./pbdZMQ-include/99-faq} \newpage \phantomsection \addcontentsline{toc}{section}{References} \bibliography{./pbdZMQ-include/pbdZMQ} \end{document} pbdZMQ/vignettes/build_pdf.sh0000755000176200001440000000071413260234554015714 0ustar liggesusers#!/bin/sh R_HOME=`Rscript -e 'cat(R.home()[1])'` JSS_BST=${R_HOME}/share/texmf/bibtex/bst/jss.bst JSS_CLS=${R_HOME}/share/texmf/tex/latex/jss.cls rm *.aux *.bbl *.blg *.log *.out *.toc *.bst *.cls cp ${JSS_BST} ./ cp ${JSS_CLS} ./ pdflatex pbdZMQ-guide.Rnw bibtex pbdZMQ-guide pdflatex pbdZMQ-guide.Rnw pdflatex pbdZMQ-guide.Rnw pdflatex pbdZMQ-guide.Rnw rm *.aux *.bbl *.blg *.log *.out *.toc *.bst *.cls mv -f *.pdf ../inst/doc/ cp -f *.Rnw ../inst/doc/ pbdZMQ/README.md0000644000176200001440000000767413260234554012710 0ustar liggesusers# pbdZMQ * **License:** [![License](http://img.shields.io/badge/license-GPL%20v3-orange.svg?style=flat)](http://www.gnu.org/licenses/gpl-3.0.en.html) * **Download:** [![Download](http://cranlogs.r-pkg.org/badges/pbdZMQ)](https://cran.r-project.org/package=pbdZMQ) * **Status:** [![Build Status](https://travis-ci.org/snoweye/pbdZMQ.png)](https://travis-ci.org/snoweye/pbdZMQ) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true)](https://ci.appveyor.com/project/snoweye/pbdZMQ) * **Author:** See section below. pbdZMQ is an R package providing a simplified interface to ZeroMQ with a focus on client/server programming frameworks. Notably, pbdZMQ should allow for the use of ZeroMQ on Windows platforms. ## Interfaces The package contains 2 separate interfaces: 1. One modeled after the ZeroMQ C interface (see help("czmq")) 2. One modeled after the rzmq interface (see help("rzmq")) ## Client/Server Example The primary focus of pbdZMQ is for building client/server interfaces for R. An example of this can be found in the pbdCS package, which uses this model to control batch MPI servers interactively. There are also several illustrative examples in the pbdZMQ package vignette. The basic idea is that you need a server R process, and a separate client R process. For demonstration/simplicity, assume they are both running on the same machine. The server we describe here is very basic. You can see a more detailed example in the pbdZMQ package vignette. #### Server Save the following as, say, `server.r` and run it in batch by running `Rscript server.r` from a terminal. ```r library(pbdZMQ) ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REP") bind.socket(socket, "tcp://*:55555") cat("Client command: ") msg <- receive.socket(socket) cat(msg, "\n") send.socket(socket, "Message received!") ``` #### Client From an interactive R session (not in batch), enter the following: ```r library(pbdZMQ) ctxt <- init.context() socket <- init.socket(ctxt, "ZMQ_REQ") connect.socket(socket, "tcp://localhost:55555") send.socket(socket, "1+1") receive.socket(socket) ``` If all goes well, your message should be sent from the client to the server, before your server terminates. For an example of how to do this more persistently, see the pbdZMQ package vignette. ## Installation pbdZMQ requires * R version 3.0.0 or higher. * Linux, Mac OSX, Windows, or FreeBSD. * libzmq >= 4.0.4. * Solaris 10 requiring external libzmq 4.0.7 and OpenCSW. A distribution of libzmq is shipped with pbdZMQ for convenience. However, if you already have a system installation of ZeroMQ, then it is simple to use that with pbdZMQ. Full details on installation and troubleshooting can be found in the package vignette, located at `inst/doc/pbdMPI-guide.pdf` of the pbdZMQ source tree. The package can be installed from the CRAN via the usual `install.packages("pbdZMQ")`, or via the devtools package: ```r library(devtools) install_github("RBigData/pbdZMQ") ``` ## Citation When mentioning the pbdZMQ, please cite: ``` @MISC{pbdZMQ2015, author = {Chen, W.-C. and Schmidt, D. and Heckendorf, C. and Ostrouchov, G.}, title = {pbdZMQ: Programming with Big Data -- Interface to ZeroMQ}, year = {2015}, note = {R Package, URL https://cran.r-project.org/package=pbdZMQ} } ``` ## Authors pbdMPI is authored and maintained by: * Wei-Chen Chen * Drew Schmidt * Christian Heckendorf * George Ostrouchov With additional contributions from: * Whit Armstrong (some functions are modified from rzmq for backwards compatibility) * Brian Ripley (C code of shellexec) * The R Core team (some functions are modified from the R source code) * Elliott Sales de Andrade (sprintf version underflow) * Spencer Aiello (windows conf spacing) For the distribution of ZeroMQ that is shipped with pbdZMQ, you can find details of authorship and copyright in `inst/zmq_copyright/` of the pbdZMQ source tree, or under `zmq_copyright/` of a binary installation of pbdZMQ. pbdZMQ/MD50000644000176200001440000005414513273403364011735 0ustar liggesusers8f0e2cd40e05189ec81232da84bd6e1a *COPYING 3262cc160c31f1f743e914d289d30d42 *ChangeLog 624dbf325cb8bf8fd990119fe600cc32 *DESCRIPTION 3590a8e237c02c1f135b1625b9219854 *INSTALL 34f6169d02c2fb63e9f5fa95d4dfe7f0 *NAMESPACE 817f699e130c106769e2651c1f2b7d6a *R/000_globalVariables.r df3d2a7b4ca01828065861d151295b2e *R/111_control.r b53dd46bd525d1bd37a2e91ae3928d9e *R/111_pbd_opt.r 5df687e9ee86344494461c5507d2641a *R/222_export_env.r fa5b282054c3ffadf45b50a818204776 *R/222_export_opt.r 29dc888d9327aa51fbcccc27c48fca92 *R/R_zmq_context.r 0796c72b587fb4be87a618e57b153d6b *R/R_zmq_message.r c7a852c9d1341672e356de3b4ad08c27 *R/R_zmq_poll.r 85ec88e052c1b9435990743d6c1f8446 *R/R_zmq_sendrecv.r a3a71629fec1a9680c19e597930e4946 *R/R_zmq_sendrecv_multipart.r 5ac7a664689f2bd48a7aebff64f31bde *R/R_zmq_socket.r e944baa7abeabf1bd0366752672d7452 *R/R_zmq_transfer.r 3c632b20d6cabe01c5296afb7c979d10 *R/R_zmq_utility.r 976020d575b778cef2431b80ffafe079 *R/address.r a2247e087a1cb053bb205c7237cbfb06 *R/base_ls.r 22551740a49599a7f53fcdfd68a1bf47 *R/get_conf.r 76212d4f14e87b5feabee7c9c994c972 *R/get_conf_zmq.r 6595ea634bdda4578a1b0e9d160a0324 *R/overwrite_shpkg.r 1650fdb4f88f31152e73a7a70eaa9904 *R/pbdZMQ-package.r c9eeb8ff07fbb5ebb21171f26670896b *R/random_port.r cf23a61f6239d8ac73d3fb7503effdd9 *R/rzmq_wrapper.r 2949727fd0f38a00b69f2f1c72257bbe *R/shellexec_wcc.r 9122b82c5068c6c761779f373aceb856 *R/windows/zzz.r 1e8a6fdf02bd8804cab4c1e652cf91f9 *R/zmq.r 820bf911b77a84cb2c8dfcd255cd3af2 *R/zzz.r.in 0ce509e008abb225a5fa2bc7e3be4491 *README.md 624a866a6346c275e1883ac449bfda79 *cleanup 736e3d8fd2c0a3e44111acdeba7cf8be *configure 6db7694cc8d0f445b438b9ebd5a13699 *configure.ac d41d8cd98f00b204e9800998ecf8427e *configure.win a1db393fdf21ca3402850629768eede8 *demo/00Index b6ac8b487a91df8ac323ba422dc07236 *demo/check_eintr.r dc30ad7f917efdbf6166a0695a14cda6 *demo/hwclient.r 3af8528ae83b5c9a10a428a633d7778a *demo/hwserver.r 4be37437c015d63521fbffe39acc6d2d *demo/iter_next.r b5e38da1930f62dd66497a10000218a5 *demo/iter_try.r afd95eb11519b808a1acc5c5d8ade70b *demo/mpclient.r 3e3fd802ea842945b1934b486cf47aca *demo/mpserver.r 115937dcc6514921c64f38d6029df876 *demo/mspoller.r 180ca4ad1d4933eb50c442ee27493a7d *demo/msreader.r 569e1385ee9449a7406f76deffc5e2dd *demo/tasksink.r 67fe5f7daa6ee2e3f53c1cd37689b489 *demo/taskvent.r c37a635cd01b6fa0239d813fbde5c78a *demo/taskwork.r 82ca4b7fc34541a5e2b532d9f68404a6 *demo/wuclient.r 93926d6d19797885161956e400034fa0 *demo/wuserver.r e59d7b81a68e497ffe1fa2fdae133847 *inst/CITATION 54d6919cde9f585522e15efbaf0ab26c *inst/doc/pbdZMQ-guide.Rnw f0c16ab34f306f5fb931a5c99348ae1a *inst/doc/pbdZMQ-guide.pdf 4d35f503fe3af101109f6c9a66fc46aa *inst/examples/README e3716e422ae0096bccf18260e169bca7 *inst/examples/reqrep/client.r 3bf953a366a7603c232b721b2464e85e *inst/examples/reqrep/rzmq_client.r 02092a11117868cd171db489d480e0ca *inst/examples/reqrep/rzmq_server.r 7d5aa602a4241e0008b36a89e2697c1f *inst/examples/reqrep/server.r e3cc1b78e020a36879e3f7a623a0e30f *inst/zmq_copyright/AUTHORS f7b40df666d41e6508d03e1c207d498f *inst/zmq_copyright/COPYING d5311495d952062e0e4fbba39cbf3de1 *inst/zmq_copyright/COPYING.LESSER 861e959f9889f45eb22996369d240083 *man/a0_a_pbdZMQ-package.Rd 65ffd096c8e49ee409ae5bdcc50c77f9 *man/a0_b_control.Rd 491ddc5fb7c59c62c249e3998fdf9034 *man/a0_b_pbd_opt.Rd 2b0e385f96a0d7f0891c1663df4cc190 *man/a0_c_options.Rd 3ff5945a1976884d262fcdc86c961cf9 *man/a0_d_context.Rd 4b4e6d294b830b167c13a3241a1571bb *man/a1_socket.Rd 9371beede5f611e7fa635eff6bfb3458 *man/a2_message.Rd 40e9daf3680c7642c8d6a537a6ceb65e *man/address.Rd d6c98d7afebae6abc74eec4e048c1002 *man/b0_sendrecv.Rd df245cafd9f6789906bb2e705059145f *man/b1_sendrecvfile.Rd 985c4c477cf1bb33022b6cb5cfaf924f *man/b2_sendrecv_multipart.Rd b9ced21e0b6938dac52e9a45fa9c2406 *man/b3_poll.Rd 4b7870ce9fb7584e55a87edac8142c9e *man/random_port.Rd dd2de7dcf4075f7fd117eceafd8891e4 *man/u0_shellexec.wcc.Rd 37e072e7db3bbe57a86acd2c2cd5662d *man/xx_czmq_wrapper.Rd e7baaf92e03f558dd8f7d3a0de6221c7 *man/xx_ls_wrapper.Rd 8a14ea8228921e9e3d751746e19ed958 *man/xx_rzmq_wrapper.Rd eda18e88a3301c83a2d5c96ce681a86b *man/xx_utility.Rd a28b49457b36dca1bbe605d692a643c2 *man/zz_overwrite_shpkg.Rd 3ee1b0ee9d5ca82b370a7abd1a21eb3d *man/zz_zmq_control.Rd a0a5e38b4335ebd7916f08409c5436ad *man/zz_zmq_flags.Rd 0c4dacab071e8f021ffdbf5719825f5a *src/Makevars.in 29e7341068398c22ef9f17a95f494ac2 *src/Makevars.win 2aa9cd02e1d8c928f0bf1941774a8fe0 *src/R_zmq.h 9d8a72a8cfa7c4350999d27245e15d91 *src/R_zmq_context.c 34eb2370accf5c8a31aae9308469dafc *src/R_zmq_message.c a25f8cd0395f9291595800082ddb29a2 *src/R_zmq_poll.c c4507eda313be2edb7d16dd0946dbcf2 *src/R_zmq_sendrecv.c 03004d3ce9e2c28c07be551aecd7d8c3 *src/R_zmq_socket.c 167650569be19453105d787bf2a826cf *src/R_zmq_transfer.c e0b4f5ca73ed2cee1ed9dcd79df5c625 *src/R_zmq_utility.c d337de8830759d7f6bb74e0811151bc6 *src/build_zmq.in e394c08b436cbced1ecd0555a8f61ac9 *src/build_zmq_linux.inc 40662e8b02d6bdf72e4296821ccfca12 *src/build_zmq_mingw.inc f47a8a39b80e1a5bb4579ba8607fbe15 *src/chmod_zmq.inc 7d2046495079224d69e2a8caf241063a *src/install.libs.R b870a1585760a8f43599b72fd30b382b *src/pkg.m4 bb11f17f2c2326c237a3a09ef6a812ac *src/shellexec_wcc.c 9f1c35ea7aff9adcd9b293a43f4a2a68 *src/zmqsrc.win/Makefile a2c652257d58178c6f7a574a62954896 *src/zmqsrc.win/platform.hpp 0571684a8fcdf7e5287458e63aa04a45 *src/zmqsrc/Makefile.am ea8e668187bdecc6e3590103f4e6fbdd *src/zmqsrc/Makefile.in 0876cbda3b18940288927a17c0c29606 *src/zmqsrc/acinclude.m4 4453f11bf59828c545dcaded57e172df *src/zmqsrc/aclocal.m4 2e52a11bce1dd08dbac3f62dca013e90 *src/zmqsrc/autogen.sh 0c8b042f99995c11aeb81bccc23c4c05 *src/zmqsrc/config/compile eea34cf893bb060ee20189e256a8065a *src/zmqsrc/config/config.guess 8a6c9da335b8fdce655cc2f944ff224b *src/zmqsrc/config/config.sub f4aafb270c2f983f35b365aad5fe8870 *src/zmqsrc/config/depcomp 6e5fe73723cd40a28adc5b7b5650c8d1 *src/zmqsrc/config/install-sh 42a15e936131c8cbcc3c88b839022f8a *src/zmqsrc/config/libtool.m4 47d420a13f9ba4e171772c3e3eee3e63 *src/zmqsrc/config/lt_obsolete.m4 c95ea69f1e4f13b7ccf3768e28a4bcb2 *src/zmqsrc/config/ltmain.sh 67d5ebceaac562ddf0dde4e5cdffbe09 *src/zmqsrc/config/ltoptions.m4 bc2f6032c98896249eadb56177c7d357 *src/zmqsrc/config/ltsugar.m4 91dd5e1355d100dbdab7d71244ed2625 *src/zmqsrc/config/ltversion.m4 1ad54e190e8322176a47a48621ad0887 *src/zmqsrc/config/missing 00f8b556839965233eb3912d24620a2d *src/zmqsrc/config/test-driver aab8935f927eecd46d2f25a6be1b2e7f *src/zmqsrc/configure 30229aa100f04f8e02ceff2ab5886bf3 *src/zmqsrc/configure.ac 8e0640298500943b18c3fe0ea4861ed8 *src/zmqsrc/include/zmq.h 0a74ca6fc42e20247fbb6fd381ba43a3 *src/zmqsrc/include/zmq.hpp d7e813de740c56c3f485007c0302c077 *src/zmqsrc/include/zmq_addon.hpp b65f99abdf2ed60f178d0585f9c83c2c *src/zmqsrc/include/zmq_utils.h 729039b9eb313a6ba9af51a02ff38fa7 *src/zmqsrc/m4/ax_check_compile_flag.m4 c77c972111b79564d6357a9410a7fbeb *src/zmqsrc/m4/ax_code_coverage.m4 ec69826f0e1adae2f684c99c706b09c1 *src/zmqsrc/m4/ax_cxx_compile_stdcxx.m4 1010d9423aceae3af75a5b000e7ee658 *src/zmqsrc/m4/ax_cxx_compile_stdcxx_11.m4 616de8a099c66826c90afd07a90641f5 *src/zmqsrc/m4/ax_valgrind_check.m4 b246ba82418edd796db104a806384793 *src/zmqsrc/src/address.cpp d1650d6d20c37f8f9debbb1dfcade6a6 *src/zmqsrc/src/address.hpp 56019041d1313318e7a9d4718ae819e4 *src/zmqsrc/src/array.hpp fc4eb31c0bf71d5c6f1c91c57d0ed48c *src/zmqsrc/src/atomic_counter.hpp e07d3764345b30abd0742b94acc37270 *src/zmqsrc/src/atomic_ptr.hpp 43be039af1ebde67a76b753d1a72d869 *src/zmqsrc/src/blob.hpp aa1485050fc0925c6b7a41963714b035 *src/zmqsrc/src/client.cpp ffb1580e36a958e8c06cba802479389a *src/zmqsrc/src/client.hpp c1670a7dc203ceee19efbeb69c71ac15 *src/zmqsrc/src/clock.cpp aeff784a7905cde3a4ab89786e73cbb0 *src/zmqsrc/src/clock.hpp 2275482884eaa3f09235c5e49ef5175e *src/zmqsrc/src/command.hpp 10ff035188ac9909760305d84ae20b0b *src/zmqsrc/src/condition_variable.hpp aa8b1659bb0726624686e98889f7218f *src/zmqsrc/src/config.hpp c637433770b8bbb4c59405e621a69c9f *src/zmqsrc/src/ctx.cpp dae698142eeea5a1da511ae10c1bd1a4 *src/zmqsrc/src/ctx.hpp d6ca80eec2cf06ab7b7445bfd5b9da9c *src/zmqsrc/src/curve_client.cpp 86810092cc606bcc23a9b31c4d922ec6 *src/zmqsrc/src/curve_client.hpp 2227b111d2f163ff98fb3f98e1e4bd2c *src/zmqsrc/src/curve_server.cpp 5ce369213a64bde4950dfbfaf8aa8108 *src/zmqsrc/src/curve_server.hpp f59aa99ceeb97dbb2d24a7571642a0f2 *src/zmqsrc/src/dbuffer.hpp f48e1cfe2150cca5f778d95ac808d799 *src/zmqsrc/src/dealer.cpp 6225aec9827765a50909cd557af00d5d *src/zmqsrc/src/dealer.hpp 826ec94971f08503e57642cd0f43ffa1 *src/zmqsrc/src/decoder.hpp 2c8153cf26ed3a316f2a8478b23de33e *src/zmqsrc/src/decoder_allocators.cpp 8a0e96098d3da5d667695d1344f36040 *src/zmqsrc/src/decoder_allocators.hpp 6ac90238504224d06ea74818cef9a727 *src/zmqsrc/src/devpoll.cpp 94d230ad299fba93d564cb2727698128 *src/zmqsrc/src/devpoll.hpp fc0736a211ba34efb362371419f2da83 *src/zmqsrc/src/dgram.cpp 0d5e468d72355826728b7d7473503dd8 *src/zmqsrc/src/dgram.hpp d15bc4eae9da54102eb5f32a677fd562 *src/zmqsrc/src/dish.cpp bdb7ecd26026b80c323fd607577fc071 *src/zmqsrc/src/dish.hpp 3709bea4b698048f14ef9538ae054c20 *src/zmqsrc/src/dist.cpp 9a46ca68e221cbac4e4a3839e0ac573b *src/zmqsrc/src/dist.hpp 36f29ba74b010617c7b4d6631b91a067 *src/zmqsrc/src/encoder.hpp f48921ad2ba3d2a547429e81a380f174 *src/zmqsrc/src/epoll.cpp 0e6d60b931db709b7dd8271f50af9d37 *src/zmqsrc/src/epoll.hpp 985be5e0a3238f138d3a90b598a4f9b2 *src/zmqsrc/src/err.cpp 64132f3bf7f3c523b524414432453923 *src/zmqsrc/src/err.hpp 746ea127c632ecd513ffc6ebca49c967 *src/zmqsrc/src/fd.hpp 4063866a6ce319c43a888089d43c2422 *src/zmqsrc/src/fq.cpp 78af27976c90eef9adc11896a66c2e8d *src/zmqsrc/src/fq.hpp 8d1bf0df1a33cc44733d7c53d57605d1 *src/zmqsrc/src/gather.cpp 32080d77cfadc3079f98a5bebf92c9fa *src/zmqsrc/src/gather.hpp 5d490cd7d587a6f1c28c9f94f1ad6ff7 *src/zmqsrc/src/gssapi_client.cpp e8335f55f46219a941caa2bea340bb0f *src/zmqsrc/src/gssapi_client.hpp 8f6de284748bb81bb5359713caace10a *src/zmqsrc/src/gssapi_mechanism_base.cpp 6202b6cccfa8b01f9260b5c7c1248c44 *src/zmqsrc/src/gssapi_mechanism_base.hpp 17a325dc44006019eed2b7687ce1a7d6 *src/zmqsrc/src/gssapi_server.cpp deecd06fc6eb327b546ffa87509abef7 *src/zmqsrc/src/gssapi_server.hpp 44b9f847ba3a888dee1ce49de9bf8a93 *src/zmqsrc/src/i_decoder.hpp 8b6f9840d5fdd02f0eef9f1477eb65fb *src/zmqsrc/src/i_encoder.hpp f3e249200c0084bc5ecb967217749b7f *src/zmqsrc/src/i_engine.hpp 9109ec6fe37b9f620c621c4a8fa0771d *src/zmqsrc/src/i_mailbox.hpp 75de14f66464baff7b925310f6ba922c *src/zmqsrc/src/i_poll_events.hpp 17be26cc6ca4cc06f19d9d3ae4f88633 *src/zmqsrc/src/io_object.cpp 66d7e17e75171fa58ff49bae3d11b698 *src/zmqsrc/src/io_object.hpp ed155c72f7cc0b415e1cfe3c931898da *src/zmqsrc/src/io_thread.cpp acda504cdf97eecd388b93b3dd01e564 *src/zmqsrc/src/io_thread.hpp 9e40a6688160a27f84bce56f3db55d5f *src/zmqsrc/src/ip.cpp 600f3fcec2c395c21a9f437d7c785a8a *src/zmqsrc/src/ip.hpp 6184f3dd3c0ebe62d9bb21d514756826 *src/zmqsrc/src/ipc_address.cpp d774b16d951a0dc18b98e2f4ccdb9d24 *src/zmqsrc/src/ipc_address.hpp d6b301b4e34825d77985b09e7ade6ecb *src/zmqsrc/src/ipc_connecter.cpp 17e0259fc7556d2f27e228a35c01e965 *src/zmqsrc/src/ipc_connecter.hpp 106fe832eafd53aea9a4a05219abbf70 *src/zmqsrc/src/ipc_listener.cpp df054e0c03ad5323614222578cc44ca3 *src/zmqsrc/src/ipc_listener.hpp a9ca841e4c2ef70b583a561099983b1c *src/zmqsrc/src/kqueue.cpp 646de6eaa656f11fd41b4d07a47f8141 *src/zmqsrc/src/kqueue.hpp 5ca71b3881b3e5783976da48e65ecb4f *src/zmqsrc/src/lb.cpp a79507e3356b81b45323c28ded47bb21 *src/zmqsrc/src/lb.hpp fa1d8b2088d07d8303fa3d959b3f3a2c *src/zmqsrc/src/libzmq.pc.cmake.in 229c04f41c4c181143ffd6ddd3fcbd1a *src/zmqsrc/src/libzmq.pc.in c48a30fc70e7e1777b9a3a2297cc58e5 *src/zmqsrc/src/libzmq.vers 625dafa30691cc79d23b953d68512cab *src/zmqsrc/src/likely.hpp 5864674d590f94bc6c807ac7d847d7a2 *src/zmqsrc/src/macros.hpp a21b9641c615a73ffcf0a8c63d523c65 *src/zmqsrc/src/mailbox.cpp 49513363b0260c84ebfe04b41ccb17d9 *src/zmqsrc/src/mailbox.hpp fb7f6abef55930293837f306315ba255 *src/zmqsrc/src/mailbox_safe.cpp 837c60499a50e605d1f075bb7eefe075 *src/zmqsrc/src/mailbox_safe.hpp a060dbd49c75b331befdfe4bafe4a76b *src/zmqsrc/src/mechanism.cpp 7b211d2afc27c3c712e284e31174dd3e *src/zmqsrc/src/mechanism.hpp 4fbfad06a92a8bfd09d27c2354c2ff9b *src/zmqsrc/src/metadata.cpp 3ff3c4364e1c27b1df4b981393143479 *src/zmqsrc/src/metadata.hpp 684e012b2a9b636639f1f8152310937d *src/zmqsrc/src/msg.cpp 1d3f9ec0654d15ecc1fee06512b9ac79 *src/zmqsrc/src/msg.hpp a0355e57db74b22c82be5acd659bd0bf *src/zmqsrc/src/mtrie.cpp e7433fbd61ea897596b6cc3c13b4cc4c *src/zmqsrc/src/mtrie.hpp ca1e94f72792f038f7af1822c1157a39 *src/zmqsrc/src/mutex.hpp d2ef2d1c9b40f3bcd4b4c5d24702d2a4 *src/zmqsrc/src/norm_engine.cpp 9f2ea7d8967c270532605d91972776e2 *src/zmqsrc/src/norm_engine.hpp 8780a86df5c3189ff5a26c63f3c3788e *src/zmqsrc/src/null_mechanism.cpp 2d6359d19f33c02aa1c0ca4c98624690 *src/zmqsrc/src/null_mechanism.hpp d994f7e299986f4f2636fb5d889faafa *src/zmqsrc/src/object.cpp 161d5ffceae51093a20887b2326d1679 *src/zmqsrc/src/object.hpp f504e65f34b2a293bbc8d377aa00935d *src/zmqsrc/src/options.cpp 2d25fe85f505d89fbb3f7d9097c2d9dd *src/zmqsrc/src/options.hpp 1c1fa8f99371d58a2d0a1836df13785d *src/zmqsrc/src/own.cpp 6edd3d0a98bddb687f943b7028bfc541 *src/zmqsrc/src/own.hpp 8bbdc610dc6e8db542d10c82cadc78d2 *src/zmqsrc/src/pair.cpp 072bae4044dad2c124a32a5935b14233 *src/zmqsrc/src/pair.hpp 1b3aac07d7560f537b34e5b2af09831e *src/zmqsrc/src/pgm_receiver.cpp bab4ff4abdb8a19551d7aa8e63a86bac *src/zmqsrc/src/pgm_receiver.hpp 72344b9a98fd45cac8b6cdf877df75b0 *src/zmqsrc/src/pgm_sender.cpp f648385dc5cc7d52c2d5a8096278cd25 *src/zmqsrc/src/pgm_sender.hpp 4450993e27c16022117e4f83292b0757 *src/zmqsrc/src/pgm_socket.cpp 44e37d8053881325d3b1003afab0051a *src/zmqsrc/src/pgm_socket.hpp f5fe7bca42216b205bf71085beaae4e2 *src/zmqsrc/src/pipe.cpp 757375669432eeed8d4bb27712c493d3 *src/zmqsrc/src/pipe.hpp cb7a6d5dedff81a065eb1eaedf59dae7 *src/zmqsrc/src/plain_client.cpp 37c637b79e462feed41b9800966cf3d5 *src/zmqsrc/src/plain_client.hpp 2bf8f147394fcfd99fecad744b9ee81d *src/zmqsrc/src/plain_server.cpp 06f2e80ea72f05bbe0add80a3b97c5e0 *src/zmqsrc/src/plain_server.hpp 3c8f1d279278e1ae93c24233ca675e9c *src/zmqsrc/src/platform.hpp.in b618192abc26ccdf6520415d078ee86c *src/zmqsrc/src/poll.cpp fa8c58b008e93286bb9de41714afcdf7 *src/zmqsrc/src/poll.hpp 56a3dac6fa5d36d69eaf03cd5b6e2556 *src/zmqsrc/src/poller.hpp 9b1a5da27e589c7a88e9c9ac8d82de4b *src/zmqsrc/src/poller_base.cpp ace0e38ba4ce50d574a0ff038e7a3b7c *src/zmqsrc/src/poller_base.hpp 2320488f6d64739d481f1b14a538a077 *src/zmqsrc/src/pollset.cpp 6af0170beb7f5ceb5c5ad6593313375e *src/zmqsrc/src/pollset.hpp bb6e4b395ca70663763a2e63f5794956 *src/zmqsrc/src/precompiled.cpp efe96b3d4e712d71bfb3c965e38ee065 *src/zmqsrc/src/precompiled.hpp db90e2363e63db47f6c052bf63670fe6 *src/zmqsrc/src/proxy.cpp 891e41f946137a17f6addb076b738315 *src/zmqsrc/src/proxy.hpp db76cf59f7bd06a40b64cc9dfaac7d80 *src/zmqsrc/src/pub.cpp cbc849e1ea5a689ab577eb4c91f5f7f3 *src/zmqsrc/src/pub.hpp af68483f7b4ff0f093fd2c190b63e652 *src/zmqsrc/src/pull.cpp 7d7b6ced544dc96b24f9bf04fb89df5b *src/zmqsrc/src/pull.hpp 3e48936ec934ce805010653a8804b064 *src/zmqsrc/src/push.cpp ea2ae090a47af8237ba03820c06f888f *src/zmqsrc/src/push.hpp 6b75b678ac257aedec15e8ccca5f1f5d *src/zmqsrc/src/radio.cpp 43d544428910d0a2729229205fec2142 *src/zmqsrc/src/radio.hpp 79eecc01a21a39bb7e6b0ba8345a852e *src/zmqsrc/src/random.cpp ed3b8b1da7a8a2f99e5bb6021956c9e6 *src/zmqsrc/src/random.hpp 9c1058e23c0932c31209e67029436ae2 *src/zmqsrc/src/raw_decoder.cpp 3971bd55b9593e0bdad33a183888e1c5 *src/zmqsrc/src/raw_decoder.hpp 3d74233ad17d2dd875bafdb767843a4e *src/zmqsrc/src/raw_encoder.cpp 12ccdbead63252c3b02611a570bde5f5 *src/zmqsrc/src/raw_encoder.hpp c938fa72490b12a49116de80ad040d3c *src/zmqsrc/src/reaper.cpp 6ce48498c19d5c743fdfef05c7eb9b03 *src/zmqsrc/src/reaper.hpp d4d082fa79ee564447dceedd63f8a8b4 *src/zmqsrc/src/rep.cpp b18b4e1c4aac6e1ac488cc61ff92cb37 *src/zmqsrc/src/rep.hpp fddf10bba14992549f7d0a2d9ad1c834 *src/zmqsrc/src/req.cpp 6e93745a02c8e0b4d862c0713bec12de *src/zmqsrc/src/req.hpp ca8531d4dfbb4070101247c91f221809 *src/zmqsrc/src/router.cpp 4236b3be376190d25a86a78e5acdb450 *src/zmqsrc/src/router.hpp 253302c53af4aeec7773d72cae3e9393 *src/zmqsrc/src/scatter.cpp 1e533c83b9868fe5d2da31e4065ebde9 *src/zmqsrc/src/scatter.hpp f2bcc671cfc725c3008e4a2c010767ff *src/zmqsrc/src/select.cpp ba343cc761c5e2854af2ffa5ae04627d *src/zmqsrc/src/select.hpp 99774c4b79d295e4e920188a04b14230 *src/zmqsrc/src/server.cpp 030829d2effaf87c3a09447bccfce31d *src/zmqsrc/src/server.hpp fefca228c8e1b6842a43c3defede9243 *src/zmqsrc/src/session_base.cpp 0469f478ba69158565a06b78a922c935 *src/zmqsrc/src/session_base.hpp bcf59344a8d3ca8a644af45c34712d91 *src/zmqsrc/src/signaler.cpp f60574bcd2e8efaf7b5ad1a51015fc96 *src/zmqsrc/src/signaler.hpp 3e90e18afd13bec93b577a37a031d805 *src/zmqsrc/src/socket_base.cpp f3fa8767bd51184882816c0b4644baf8 *src/zmqsrc/src/socket_base.hpp 460a516d67034807433be5e361cef287 *src/zmqsrc/src/socket_poller.cpp 82e015c990d38f1ef1a45f1bd6f985d8 *src/zmqsrc/src/socket_poller.hpp e788b7ded9e31c61856aabe560e3fbf5 *src/zmqsrc/src/socks.cpp 7fee1211682f25e3cb3584959922db4c *src/zmqsrc/src/socks.hpp c1b23ef25b8c484dce41a2eef818054c *src/zmqsrc/src/socks_connecter.cpp f5c3a3171d35168715a3b7f9aac99d02 *src/zmqsrc/src/socks_connecter.hpp caee1307b298b4f2fc3fd9b6d2140ba6 *src/zmqsrc/src/stdint.hpp aed3a211d992abaa4e3447d1126e0456 *src/zmqsrc/src/stream.cpp 6e239b6f5585dd31c72b5896ed77cfb1 *src/zmqsrc/src/stream.hpp 65d9b7ade2253a5a894632afdef45cc9 *src/zmqsrc/src/stream_engine.cpp 185b86b89e9cea59ac8f495bbc606ff3 *src/zmqsrc/src/stream_engine.hpp 937370a99a7c85cb6223e0a4728a703d *src/zmqsrc/src/sub.cpp e447b3b7990c832d1e741c316959a308 *src/zmqsrc/src/sub.hpp dd92020747401c891c3b342586ca0b17 *src/zmqsrc/src/tcp.cpp 197ef1d7b81428d67974f9dbdcfcc339 *src/zmqsrc/src/tcp.hpp 86d5bccedc9591b724801f3477ef5f31 *src/zmqsrc/src/tcp_address.cpp 5971cde5584d3823b02bbac73e426fc0 *src/zmqsrc/src/tcp_address.hpp ed313949f6303ebe3bab338ba8c7555c *src/zmqsrc/src/tcp_connecter.cpp e01483b9159d2b233743ed628bb24251 *src/zmqsrc/src/tcp_connecter.hpp 17a9922f55929cfd32316b45a61b064f *src/zmqsrc/src/tcp_listener.cpp 2bc14594d83f959f8c6af5433007deb1 *src/zmqsrc/src/tcp_listener.hpp eccba55991847cb70f9ce7b362529ec3 *src/zmqsrc/src/thread.cpp 5ce0934708ced0f67bad2809b8d0a4d1 *src/zmqsrc/src/thread.hpp 1efff33c1d1fd07c6ca02e2a2a400f88 *src/zmqsrc/src/timers.cpp 9e9712189c25bf839f8954b28dcf9918 *src/zmqsrc/src/timers.hpp 36e7f77ad474cc6c7f07b72d4ed267f4 *src/zmqsrc/src/tipc_address.cpp 0440addb4b2b4d3490f83cc0397d4d9a *src/zmqsrc/src/tipc_address.hpp 31a43ca346fcc82e4b0b39e6ab139f43 *src/zmqsrc/src/tipc_connecter.cpp 1049bfc6d9afd87c6098ba4ba8e80445 *src/zmqsrc/src/tipc_connecter.hpp 72e2e95bdf4b31d4cd404b195664fc65 *src/zmqsrc/src/tipc_listener.cpp c9c3e2a217fd6fcd5153231c67e8ac1e *src/zmqsrc/src/tipc_listener.hpp 3cde99ec49f9df4bdc9d8630ed3d1c93 *src/zmqsrc/src/trie.cpp 487229bb8020a68a341f11ff31adbdcc *src/zmqsrc/src/trie.hpp 8695a9caa30ce8827706d35d8db419be *src/zmqsrc/src/tweetnacl.c fdb8426cfbcf8ba7c69257e39815e76c *src/zmqsrc/src/tweetnacl.h 9a7b96e262a0ac4050b1b132c2f8caf6 *src/zmqsrc/src/udp_address.cpp 63f9c2db1a7a60604b7c263d52d418fc *src/zmqsrc/src/udp_address.hpp b5aec3c1fc6d0fcf1328eb9f182bc47f *src/zmqsrc/src/udp_engine.cpp 504ede3d48051c922c7a07f3ee516781 *src/zmqsrc/src/udp_engine.hpp c7bd54bfbd24aa40ed1a62bff3b40d6f *src/zmqsrc/src/v1_decoder.cpp 01af3b0e189973e5a85795338f678a97 *src/zmqsrc/src/v1_decoder.hpp 89818b2fcc82de2cbbed4a12cb738a5a *src/zmqsrc/src/v1_encoder.cpp 9ee1915deba8e481ffe126e4c726738e *src/zmqsrc/src/v1_encoder.hpp 66554807683b66088c1a60b00ae02384 *src/zmqsrc/src/v2_decoder.cpp 3531b76bff3803eb15dd170ceaf2c573 *src/zmqsrc/src/v2_decoder.hpp d3107531bec48fa4f908b7fc4baa9e00 *src/zmqsrc/src/v2_encoder.cpp 033fe194f8b35ba3738c6309bd9bd6c9 *src/zmqsrc/src/v2_encoder.hpp 46665e076972558647014b48d266ab70 *src/zmqsrc/src/v2_protocol.hpp ed478b827a7fc5bb1497db70910cf176 *src/zmqsrc/src/version.rc.in 117e3a17cfa71c54e14edc7f181efdbe *src/zmqsrc/src/vmci.cpp 3d5f885e99888e39c9a9ae3bc954b3b0 *src/zmqsrc/src/vmci.hpp 15df58a1e44b587320ffb62377c66268 *src/zmqsrc/src/vmci_address.cpp 4647384522d1e1a691dffc1ef8f0f246 *src/zmqsrc/src/vmci_address.hpp 54a79912d7976d2b25de29ef12388453 *src/zmqsrc/src/vmci_connecter.cpp 4e8f243ca90a70b5af99df5243b3edc0 *src/zmqsrc/src/vmci_connecter.hpp badd51b8a539b1a993256b25904414df *src/zmqsrc/src/vmci_listener.cpp e102c873c6fd523e01685a9edf71ba31 *src/zmqsrc/src/vmci_listener.hpp 466674e7444fd8cee2db0fe3f9ee0622 *src/zmqsrc/src/windows.hpp 5c3e9fca319d59f3d43e8cc3cb4f9bcf *src/zmqsrc/src/wire.hpp 549d3da595ca64a483873889a275900e *src/zmqsrc/src/xpub.cpp 2995a4f01399b87d5d8d5684d5b8f336 *src/zmqsrc/src/xpub.hpp a4d382fb0faad4b1aa6de7949bacbaba *src/zmqsrc/src/xsub.cpp d89b9593f46a856cc29fb4ef0543bc4a *src/zmqsrc/src/xsub.hpp 9f11fa9ead79939eb37b3f5283a1f56c *src/zmqsrc/src/ypipe.hpp 2262f33d0dea7f259f1a49bcb92ccc50 *src/zmqsrc/src/ypipe_base.hpp 3867c40de39e181372fe4c6b5c38e8d2 *src/zmqsrc/src/ypipe_conflate.hpp 2c4ec0761f550cc7cd81d3f6da3fa95f *src/zmqsrc/src/yqueue.hpp 80b627ee0d2c47ba1ae575b93fd00003 *src/zmqsrc/src/zmq.cpp b38ed8e2f71045e3768cbef5140a6f84 *src/zmqsrc/src/zmq_draft.h 83f65a431b623de96010e577480a8ba9 *src/zmqsrc/src/zmq_utils.cpp f38317e8941219ddddac4a6dc64014dc *src/zmqsrc/src/zzz.cpp 42278fe44ab2b650e6b65f06ca4a5ea5 *src/zmqsrc/version.sh c862dddceddaf617675e3824060b6263 *src/zzz.c 9488e8938659709daf2594d6430eb59c *tests/address.R 496a5f267defa645803d80907dcf56c8 *tests/ports.R ebe6ddb63ac9dd468cacc3e7ac20fead *tests/send_recv.R ae55bb781029e865a762cdc3fb27f464 *vignettes/build_pdf.sh 54d6919cde9f585522e15efbaf0ab26c *vignettes/pbdZMQ-guide.Rnw 6e3ca1e66839ff78adb64b3c76cbbfb7 *vignettes/pbdZMQ-include/00-preamble.tex e33297e2b5069d0f34e134d0e1d9d60e *vignettes/pbdZMQ-include/01-acknowledgement.tex 66eed1cec929858c6c3a4fda5e2c416c *vignettes/pbdZMQ-include/01-copyright.tex 4d397b2a9101f3101d9eda8f666c44ff *vignettes/pbdZMQ-include/01-introduction.tex 0adb702595152b65ae028bbd04a4e376 *vignettes/pbdZMQ-include/02-installation.tex 42fe0d53790e922e726fa03c0ef5da1f *vignettes/pbdZMQ-include/03-example.tex b0b8957f016b4132cc8a71158220a1ce *vignettes/pbdZMQ-include/04-backward.tex b0a4ea594cbdb41f0d03742b2989367e *vignettes/pbdZMQ-include/05-cs.tex 0463c2c9ae04f7899e00358d6c2ba5de *vignettes/pbdZMQ-include/06-solaris.tex 580cedfa33912536ed87712412d837da *vignettes/pbdZMQ-include/99-faq.tex 74d3410adf97cfd5151740fdac3488c3 *vignettes/pbdZMQ-include/my_jss.cls 09510fe40bc084041c2fc3d900019862 *vignettes/pbdZMQ-include/pbdZMQ.bib pbdZMQ/DESCRIPTION0000644000176200001440000000536413273403364013132 0ustar liggesusersPackage: pbdZMQ Version: 0.3-3 Date: 2018-04-30 Title: Programming with Big Data -- Interface to 'ZeroMQ' Authors@R: c(person("Wei-Chen", "Chen", role = c("aut", "cre"), email = "wccsnow@gmail.com"), person("Drew", "Schmidt", role = "aut"), person("Christian", "Heckendorf", role = "aut", comment = "file transfer"), person("George", "Ostrouchov", role = "aut", comment = "Mac OSX"), person("Whit", "Armstrong", role = "ctb", comment = "some functions are modified from the rzmq package for backwards compatibility"), person("Brian", "Ripley", role = "ctb", comment = "C code of shellexec, and Solaris"), person("R Core team", role = "ctb", comment = "some functions are modified from the R source code"), person("Philipp", "A.", role = "ctb", comment = "Fedora"), person("Elliott Sales", "de Andrade", role = "ctb", comment = "sprintf"), person("Spencer", "Aiello", role = "ctb", comment = "windows conf") ) Depends: R (>= 3.2.0) LazyLoad: yes LazyData: yes Copyright: See files AUTHORS, COPYING, COPYING.LESSER, and MAINTAINERS in 'pbdZMQ/inst/zmq_copyright/' for the 'ZeroMQ' source files in 'src/zmq_src/' which are under GPL-3. Description: 'ZeroMQ' is a well-known library for high-performance asynchronous messaging in scalable, distributed applications. This package provides high level R wrapper functions to easily utilize 'ZeroMQ'. We mainly focus on interactive client/server programming frameworks. For convenience, a minimal 'ZeroMQ' library (4.2.2) is shipped with 'pbdZMQ', which can be used if no system installation of 'ZeroMQ' is available. A few wrapper functions compatible with 'rzmq' are also provided. SystemRequirements: Linux, Mac OSX, and Windows, or 'ZeroMQ' library >= 4.0.4. Solaris 10 needs 'ZeroMQ' library 4.0.7 and 'OpenCSW'. License: GPL-3 URL: http://r-pbd.org/ BugReports: https://github.com/snoweye/pbdZMQ/issues MailingList: Please send questions and comments regarding pbdR to RBigData@gmail.com NeedsCompilation: yes Maintainer: Wei-Chen Chen RoxygenNote: 6.0.1 Packaged: 2018-05-01 03:19:59 UTC; snoweye Author: Wei-Chen Chen [aut, cre], Drew Schmidt [aut], Christian Heckendorf [aut] (file transfer), George Ostrouchov [aut] (Mac OSX), Whit Armstrong [ctb] (some functions are modified from the rzmq package for backwards compatibility), Brian Ripley [ctb] (C code of shellexec, and Solaris), R Core team [ctb] (some functions are modified from the R source code), Philipp A. [ctb] (Fedora), Elliott Sales de Andrade [ctb] (sprintf), Spencer Aiello [ctb] (windows conf) Repository: CRAN Date/Publication: 2018-05-05 19:33:08 UTC pbdZMQ/configure0000755000176200001440000046445613271756337013357 0ustar liggesusers#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # 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" 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 about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="DESCRIPTION" ac_subst_vars='LTLIBOBJS LIBOBJS EXT_LIBS EXTERNAL_ZMQ_LDFLAGS EXTERNAL_ZMQ_INCLUDE INTERNAL_ZMQ_LIBDIR INTERNAL_ZMQ_INCLUDEDIR ENABLE_INTERNAL_ZMQ SYSTEM_ZMQ_LIBDIR SYSTEM_ZMQ_INCLUDEDIR GET_SYSTEM_ZMQ GET_PKG_CONFIG ZMQ_POLLER ZMQ_LDFLAGS ZMQ_INCLUDE zmq_LIBS zmq_CFLAGS PKG_CONFIG target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_internal_zmq ' ac_precious_vars='build_alias host_alias target_alias PKG_CONFIG zmq_CFLAGS zmq_LIBS ZMQ_INCLUDE ZMQ_LDFLAGS ZMQ_POLLER' # 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}' 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 this package 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/PACKAGE] --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 cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-internal-zmq Enable internal ZeroMQ, default no. Some influential environment variables: PKG_CONFIG path to pkg-config utility zmq_CFLAGS C compiler flags for zmq, overriding pkg-config zmq_LIBS linker flags for zmq, overriding pkg-config ZMQ_INCLUDE ZMQ_LDFLAGS ZMQ_POLLER select 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 the package provider. _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 configure 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. ## ## ------------------------ ## 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 $as_me, 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 chmod +x ./src/zmqsrc/autogen.sh chmod +x ./src/zmqsrc/configure chmod +x ./src/zmqsrc/version.sh chmod +x ./src/zmqsrc/config/compile chmod +x ./src/zmqsrc/config/config.guess chmod +x ./src/zmqsrc/config/config.sub chmod +x ./src/zmqsrc/config/depcomp chmod +x ./src/zmqsrc/config/install-sh chmod +x ./src/zmqsrc/config/missing : ${R_HOME=‘R RHOME‘} if test -z "${R_HOME}"; then echo "could not determine R_HOME" exit 1 fi R_SCMD="${R_HOME}/bin/Rscript -e" # Check whether --enable-internal-zmq was given. if test "${enable_internal_zmq+set}" = set; then : enableval=$enable_internal_zmq; ENABLE_INTERNAL_ZMQ="yes" else ENABLE_INTERNAL_ZMQ="no" fi GET_PKG_CONFIG="no" GET_SYSTEM_ZMQ="no" # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- # PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- # _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- # _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- # PKG_CHECK_MODULES if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.25 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi if test "X$PKG_CONFIG" != "X" ; then GET_PKG_CONFIG="yes" pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zmq" >&5 $as_echo_n "checking for zmq... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$zmq_CFLAGS"; then pkg_cv_zmq_CFLAGS="$zmq_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzmq >= 4.0.4\""; } >&5 ($PKG_CONFIG --exists --print-errors "libzmq >= 4.0.4") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_zmq_CFLAGS=`$PKG_CONFIG --cflags "libzmq >= 4.0.4" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$zmq_LIBS"; then pkg_cv_zmq_LIBS="$zmq_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzmq >= 4.0.4\""; } >&5 ($PKG_CONFIG --exists --print-errors "libzmq >= 4.0.4") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_zmq_LIBS=`$PKG_CONFIG --libs "libzmq >= 4.0.4" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then zmq_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libzmq >= 4.0.4"` else zmq_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libzmq >= 4.0.4"` fi # Put the nasty error message in config.log where it belongs echo "$zmq_PKG_ERRORS" >&5 GET_SYSTEM_ZMQ="no" elif test $pkg_failed = untried; then GET_SYSTEM_ZMQ="no" else zmq_CFLAGS=$pkg_cv_zmq_CFLAGS zmq_LIBS=$pkg_cv_zmq_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } GET_SYSTEM_ZMQ="yes" fi fi SYSTEM_ZMQ_INCLUDEDIR="" SYSTEM_ZMQ_LIBDIR="" if test "X$GET_PKG_CONFIG" = "Xyes" -a "X$GET_SYSTEM_ZMQ" = "Xyes" -a "X$ENABLE_INTERNAL_ZMQ" = "Xno" ; then SYSTEM_ZMQ_INCLUDEDIR=`$PKG_CONFIG --variable=includedir libzmq` SYSTEM_ZMQ_LIBDIR=`$PKG_CONFIG --variable=libdir libzmq` fi INTERNAL_ZMQ_INCLUDEDIR="./zmqsrc/include" INTERNAL_ZMQ_LIBDIR="./" if ${ZMQ_INCLUDE+:} false; then : else ZMQ_INCLUDE="" fi EXTERNAL_ZMQ_INCLUDE="${ZMQ_INCLUDE}" if ${ZMQ_LDFLAGS+:} false; then : else ZMQ_LDFLAGS="" fi EXTERNAL_ZMQ_LDFLAGS="${ZMQ_LDFLAGS}" ZMQ_INCLUDE="" ZMQ_LDFLAGS="" if test "X$EXTERNAL_ZMQ_INCLUDE" != "X" -a "X$EXTERNAL_ZMQ_LDFLAGS" != "X" ; then ZMQ_INCLUDE="${EXTERNAL_ZMQ_INCLUDE}" ZMQ_LDFLAGS="${EXTERNAL_ZMQ_LDFLAGS}" else if test "X$ENABLE_INTERNAL_ZMQ" = "Xyes" ; then ZMQ_INCLUDE="-I${INTERNAL_ZMQ_INCLUDEDIR}" ZMQ_LDFLAGS="-L${INTERNAL_ZMQ_LIBDIR} -lzmq" else if test "X$SYSTEM_ZMQ_INCLUDEDIR" != "X" -a "X$SYSTEM_ZMQ_LIBDIR" != "X" ; then ZMQ_INCLUDE="-I${SYSTEM_ZMQ_INCLUDEDIR}" ZMQ_LDFLAGS="-L${SYSTEM_ZMQ_LIBDIR} -lzmq" else ZMQ_INCLUDE="-I${INTERNAL_ZMQ_INCLUDEDIR}" ZMQ_LDFLAGS="-L${INTERNAL_ZMQ_LIBDIR} -lzmq" fi fi fi if test "$ZMQ_INCLUDE" != "-I./zmqsrc/include" -a "$ZMQ_LDFLAGS" != "-L./ -lzmq" ; then EXT_LIBS="" else EXT_LIBS="\$(R_ZMQ)" fi if ${ZMQ_POLLER+:} false; then : else ZMQ_POLLER="" fi if test "X$ZMQ_POLLER" = "X" ; then ZMQ_POLLER="select" fi echo " " echo "****************** Results of pbdZMQ package configure *****************" echo " " echo ">> GET_PKG_CONFIG = ${GET_PKG_CONFIG}" echo ">> GET_SYSTEM_ZMQ = ${GET_SYSTEM_ZMQ}" echo ">> PKG_CONFIG = ${PKG_CONFIG}" echo ">> SYSTEM_ZMQ_INCLUDEDIR = ${SYSTEM_ZMQ_INCLUDEDIR}" echo ">> SYSTEM_ZMQ_LIBDIR = ${SYSTEM_ZMQ_LIBDIR}" echo ">> ENABLE_INTERNAL_ZMQ = ${ENABLE_INTERNAL_ZMQ}" echo ">> INTERNAL_ZMQ_INCLUDEDIR = ${INTERNAL_ZMQ_INCLUDEDIR}" echo ">> INTERNAL_ZMQ_LIBDIR = ${INTERNAL_ZMQ_LIBDIR}" echo ">> EXTERNAL_ZMQ_INCLUDE = ${EXTERNAL_ZMQ_INCLUDE}" echo ">> EXTERNAL_ZMQ_LDFLAGS = ${EXTERNAL_ZMQ_LDFLAGS}" echo ">> ZMQ_INCLUDE = ${ZMQ_INCLUDE}" echo ">> ZMQ_LDFLAGS = ${ZMQ_LDFLAGS}" echo ">> EXT_LIBS = ${EXT_LIBS}" echo ">> ZMQ_POLLER = ${ZMQ_POLLER}" echo " " echo "************************************************************************" echo " " ac_config_files="$ac_config_files src/Makevars" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${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 $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status 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;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _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 "src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;; *) 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " 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 ;; 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 ac_config_files="$ac_config_files src/build_zmq" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${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 $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status 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;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _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 "src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;; "src/build_zmq") CONFIG_FILES="$CONFIG_FILES src/build_zmq" ;; *) 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " 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 ;; 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 ac_config_files="$ac_config_files R/zzz.r" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${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 $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status 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;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _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 "src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;; "src/build_zmq") CONFIG_FILES="$CONFIG_FILES src/build_zmq" ;; "R/zzz.r") CONFIG_FILES="$CONFIG_FILES R/zzz.r" ;; *) 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 fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " 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 ;; 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 pbdZMQ/ChangeLog0000644000176200001440000001557413271756235013210 0ustar liggesusers2018-04-30: Ver 0.3-3 * Change some problems related UTF-8, latin1 TeX inputs, especially for TeXLive 2018. 2018-01-27: Ver 0.3-2 * Add overwrite.shpkg.rpath() for osx. * Adjust .onLoad() for osx with ZMQ static library. 2018-01-18: Ver 0.3-2 * Adjust .onLoad(). * Add back "src/pkg.m4". 2018-01-07: Ver 0.3-1 * Test with JuniperKernel. 2018-01-06: Ver 0.3-1 * Fix uses of osx external static library. * Fix get.zmq.conf(). 2018-01-03: Ver 0.3-0 * Disable "zmq_utils.h" because #pragma diagnostics is not needed at all. 2017-12-30: Ver 0.3-0 * Fix windows conf spacing problems. * Adjust contributions in DESCRIPTION. 2017-12-29: Ver 0.3-0 * A better script for osx is made: overwrite both pbdZMQ.so and libzmq.*.dylib. * Remove some initial scripts needed by osx. * pbdZMQ.so is now exported too. * Appveyor builds are added for windows (i386 and x64). 2017-12-26: Ver 0.3-0 * Modify and rearrange "install.libs.R" and "zzz.r.in". 2017-12-25: Ver 0.3-0 * Add libzmq.5.dylib for Mac OSX. * Add test.load.zmq(). 2017-12-24: Ver 0.3-0 * Change to ZeroMQ 4.2.2 library. * Export ZerMQ flags (CPPFLAGS and LDFLAGS). * Add zzz.cpp in zmqsrc/src/ and relevance. * Test with external ZeroMQ library. * Add vignettes. * Add C++ header files to ZeroMQ library. 2017-10-01: Ver 0.2-7 * Add check eintr to poller. * Fix a CRAN warning as R_zmq_utility.c:34:24: warning: ‘sprintf’ writing a terminating nul past the end of the destination [-Wformat-overflow=] 2017-07-05: Ver 0.2-7 * Retire R6/pyzmq-like bindings. 2017-05-14: Ver 0.2-6 * Add dynamic symbol registration. * Add zzz.cpp in zmqsrc/src/ and relevance. 2017-01-11: Ver 0.2-6 * Move remoter back to Enhances because sodium does not work on CRAN Solaris. * Add a fake `ls()` to avoid `rm(list = ls(all.names = TRUE)` to delete any hidden pbd objects mainly `.pbd_env` and `.pbdenv`. 2016-12-31: Ver 0.2-6 * Move pbdRPC and remoter to Suggests. 2016-12-17: Ver 0.2-5 * Change web address. 2016-12-04: Ver 0.2-5 * Patch zeromq checking return code problem for sodium_init(). See the discussion at https://github.com/zeromq/libzmq/issues/1632 and https://github.com/zeromq/libzmq/issues/1635 . This causes warning to stop because changes were made in new version of libsodium. curve_client.cpp: In constructor 'zmq::curve_client_t::curve_client_t(const zmq::options_t&)': curve_client.cpp:51:18: error: ignoring return value of 'int sodium_init()', declared with attribute warn_unused_result [-Werror=unused-result] sodium_init(); ^ cc1plus: all warnings being treated as errors Makefile:728: recipe for target 'libzmq_la-curve_client.lo' failed make[2]: *** [libzmq_la-curve_client.lo] Error 1 The patch is based on https://github.com/zeromq/libzmq/commit/479db2113643e459c11db392e0fefd6400657c9e . 2016-08-06: Ver 0.2-4 * Export zmq header files. * Add get.zmq.cppflags() and get.zmq.ldflags() to "R/get_conf.r". 2016-05-17: Ver 0.2-3 * Fix build_zmq.in bugs for Fedora/Red Hat GCC (Philipp A.) * Try to overwrite pbdZMQ.so path to libzmq.4.dylib in run-time. 2016-04-23: Ver 0.2-2 * Migrate to Rtools33 and R 3.3.0 for Windows. 2016-01-26: Ver 0.2-2 * Fix .pbd_env export problem. * Fix warning and error problems by tryCatch(). * Move C_errno to global. 2016-01-25: Ver 0.2-2 * Add MC option (stop.at.error) to zmq.poll(). 2015-12-25: Ver 0.2-1 * Poller demo and man added and checked. * Add multiple parts for send and recv using raw and serialization. 2015-12-20: Ver 0.2-1 * Add Poll functions. 2015-12-15: * Add vignettes for Solaris. 2015-12-10: * Solaris works with external ZeroMQ 4.0.7. 2015-11-22: * Added verbose option to zmq.sendfile() and zmq.recvfile(). * Change zmq.sendfile()/zmq.recvfile() to use PUSH/PULL. 2015-11-20: * Added zmq.sendfile() and zmq.recvfile(). 2015-11-14: Ver. 0.2-0 * Fix the RPATH problem in Mac OSX 10.10 Yosemite by using otool and install_name_tool after shared libraries are installed in "src/install.libs.R". 2015-11-03: Ver. 0.2-0 * Simplify global environment. 2015-10-24: Ver. 0.2-0 * Change to common environment, but this will create masking, overwritting, and texting problems when other pbdR pacakges are loading. * Change again to .pbd_env, .zmqopt_set(), .zmqopt_get(), and .zmqopt_init() with huge options rewritting. 2015-10-08: * Expanded PyZMQ-like interface. * Added address and port validation utilities. 2015-10-02: * Take off -rpath $(libdir) from line 598 in "src/zmqsrc/src/Makefile.in". (fail) 2015-10-01: * Added PyZMQ-like R6 interface. * Change to roxygen2. * Add vignettes. 2015-09-30: * Converted manual to roxygen. * Added significant examples to the vignette. * Enhanced the README. * Cleaned up DESCRIPTION. 2015-09-26: * Give Solaris another try. 2015-09-22: Ver. 0.1-1 * Fix src_Makefile (windows). 2015-09-15: * Rewrite configure.ac for version checking (Fedora). * Rewrite R/get_conf.r for windows. * Fix Mac OSX problem. $(SHLIB) can not be ".so", but on CRAN Mac checks ... 2015-09-14: * Check version of pkg-config. * Check version of system libzmq. 2015-09-11: Ver. 0.1-0 * Change to pkg-config and use different installation order. * On CRAN. ======================= Log Before Release ===================================== 2015-08-30: * Change option controlling method. Move from data to new.env. * Fix configure and installation. 2015-08-28: * Fix windows zzz.r with R_ARCH. 2015-08-15: * Add author. * Add local to dyn.load in zzz.r. * Try to migrate to ZeroMQ 4.1.2, but fail. * Add external linked library to ZeroMQ 4.1.2. * Add vignettes. 2015-05-30: * Clean up, check with new R-devel, and add vignettes. 2015-04-25: * Add shellexec.wcc() to active and minimize the new cmd window running mpiexec via batch files. No blocking the current windows nor rui. 2015-03-15: * Add more zmq_msg_* wrappers and test with pbdCS in win32 and win64. * Add vignettes. 2015-03-10: * Add some rzmq wrapper functions for pbdCS. * Adjust more rzmq wrapper functions. 2015-02-27: * Change zmq.recv() to return a list with two elements, buf and len. * Add msreader to demo. 2015-02-26: * taskvent, taskwork, and tasksink in demo are tested. 2015-02-22: * Add more ZMQ functions. * wuserver and wuclient are tested. 2015-02-21: * Add linking to external library options. * Add man and vignettes. 2015-02-20: * Mac OSX 10.7 works with shared library. 2015-02-18: * No success for Solaris. ZeroMQ can not be built standard alone. 2015-02-17: * Both Linux and Windows work with shared library. * hwserver and hwclient are tested successfully. 2015-02-16: * Change from static library to shared library. 2015-02-xx: * Build static library, but check with warnings such as printf, putc, abort. 2015-01-29: * First build for pbdZMQ. * First try for binaries build of Windows. pbdZMQ/man/0000755000176200001440000000000013260234554012166 5ustar liggesuserspbdZMQ/man/b1_sendrecvfile.Rd0000644000176200001440000000337713260234554015522 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/R_zmq_transfer.r \name{File Transfer Functions} \alias{File Transfer Functions} \alias{zmq.sendfile} \alias{zmq.recvfile} \title{File Transfer Functions} \usage{ zmq.sendfile(port, filename, verbose = FALSE, flags = .pbd_env$ZMQ.SR$BLOCK) zmq.recvfile(port, endpoint, filename, verbose = FALSE, flags = .pbd_env$ZMQ.SR$BLOCK) } \arguments{ \item{port}{A valid tcp port.} \item{filename}{The name (as a string) of the in/out files.} \item{verbose}{logical; determines if a progress bar should be shown.} \item{flags}{a flag for the method used by \code{zmq_sendfile} and \code{zmq_recvfile}} \item{endpoint}{A ZMQ socket endpoint.} } \value{ \code{zmq.sendfile()} and \code{zmq.recvfile()} return number of bytes (invisible) in the sent message if successful, otherwise returns -1 (invisible) and sets \code{errno} to the error value, see ZeroMQ manual for details. } \description{ High level functions calling \code{zmq_send()} and \code{zmq_recv()} to transfer a file in 200 KiB chunks. } \details{ \code{zmq.sendfile()} binds a \code{ZMQ_PUSH} socket, and \code{zmq.recvfile()} connects to this with a \code{ZMQ_PULL} socket. } \examples{ \dontrun{ ### Run the sender and receiver code in separate R sessions. # Receiver library(pbdZMQ, quietly = TRUE) zmq.recvfile(55555, "localhost", "/tmp/outfile", verbose=TRUE) # Sender library(pbdZMQ, quietly = TRUE) zmq.sendfile(55555, "/tmp/infile", verbose=TRUE) } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.msg.send}()}, \code{\link{zmq.msg.recv}()}. } \author{ Drew Schmidt and Christian Heckendorf } \keyword{programming} pbdZMQ/man/b0_sendrecv.Rd0000644000176200001440000000536113260234554014654 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/R_zmq_sendrecv.r \name{Send Receive Functions} \alias{Send Receive Functions} \alias{zmq.send} \alias{zmq.recv} \title{Send Receive Functions} \usage{ zmq.send(socket, buf, flags = .pbd_env$ZMQ.SR$BLOCK) zmq.recv(socket, len = 1024L, flags = .pbd_env$ZMQ.SR$BLOCK, buf.type = c("char", "raw")) } \arguments{ \item{socket}{a ZMQ socket} \item{buf}{a buffer to be sent} \item{flags}{a flag for the method using by \code{zmq_send} and \code{zmq_recv}} \item{len}{a length of buffer to be received, default 1024 bytes} \item{buf.type}{buffer type to be received} } \value{ \code{zmq.send()} returns number of bytes (invisible) in the sent message if successful, otherwise returns -1 (invisible) and sets \code{errno} to the error value, see ZeroMQ manual for details. \code{zmq.recv()} returns a list (\code{ret}) containing the received buffer \code{ret$buf} and the length of received buffer (\code{ret$len} which is less or equal to the input \code{len}) if successful, otherwise returns -1 and sets \code{errno} to the error value, see ZeroMQ manual for details. } \description{ Send and receive functions } \details{ \code{zmq.send()} is a high level R function calling ZMQ C API \code{zmq_send()} sending \code{buf} out. \code{zmq.recv()} is a high level R function calling ZMQ C API \code{zmq_recv()} receiving buffers of length \code{len} according to the \code{buf.type}. \code{flags} see \code{\link{ZMQ.SR}()} for detail options of send and receive functions. \code{buf.type} currently supports \code{char} and \code{raw} which are both in R object format. } \examples{ \dontrun{ ### Using request-reply pattern. ### At the server, run next in background or the other window. library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) zmq.bind(responder, "tcp://*:5555") for(i.res in 1:5){ buf <- zmq.recv(responder, 10L) cat(buf$buf, "\\n") Sys.sleep(0.5) zmq.send(responder, "World") } zmq.close(responder) zmq.ctx.destroy(context) ### At a client, run next in foreground. library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) zmq.connect(requester, "tcp://localhost:5555") for(i.req in 1:5){ cat("Sending Hello ", i.req, "\\n") zmq.send(requester, "Hello") buf <- zmq.recv(requester, 10L) cat("Received World ", i.req, "\\n") } zmq.close(requester) zmq.ctx.destroy(context) } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.msg.send}()}, \code{\link{zmq.msg.recv}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{programming} pbdZMQ/man/random_port.Rd0000644000176200001440000000232613260234554015004 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/random_port.r \name{random_port} \alias{random_port} \alias{random_open_port} \title{Random Port} \usage{ random_port(min_port = 49152, max_port = 65536) random_open_port(min_port = 49152, max_port = 65536, max_tries = 100) } \arguments{ \item{min_port, max_port}{The minimum/maximum value to be generated. The minimum should not be below 49152 and the maximum should not exceed 65536 (see details).} \item{max_tries}{The maximum number of times a random port will be searched for.} } \description{ Generate a valid, random TCP port. } \details{ By definition, a TCP port is an unsigned short, and so it can not exceed 65535. Additionally, ports in the range 1024 to 49151 are (possibly) registered by ICANN for specific uses. \code{random_port()} will simply generate a valid, non-registered tcp port. \code{random_unused_port()} will generate a port that is available for socket connections. \code{random_open_port()} finds a random port not already bound to an endpoint. } \examples{ random_port() } \references{ "The Ephemeral Port Range" by Mike Gleason. \url{http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html} } \author{ Drew Schmidt } pbdZMQ/man/a0_c_options.Rd0000644000176200001440000000242713260234554015037 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/222_export_opt.r \name{Initial Control Functions} \alias{Initial Control Functions} \alias{.zmqopt_get} \alias{.zmqopt_set} \alias{.zmqopt_init} \title{Initial controls in pbdZMQ} \usage{ .zmqopt_get(main, sub = NULL, envir = .GlobalEnv) .zmqopt_set(val, main, sub = NULL, envir = .GlobalEnv) .zmqopt_init(envir = .GlobalEnv) } \arguments{ \item{main}{a variable to be get from or set to} \item{sub}{a subvariable to be get from or set to} \item{envir}{an environment where ZMQ controls locate} \item{val}{a value to be set} } \value{ \code{.zmqopt_init()} initial the ZMQ control at \code{envir}. } \description{ Initial control functions } \details{ \code{.zmqopt_init()} initials default ZMQ controls. \code{.zmqopt_get()} gets a ZMQ control. \code{.zmqopt_set()} sets a ZMQ control. } \examples{ \dontrun{ library(pbdZMQ, quietly = TRUE) ls(.pbd_env) rm(.pbd_env) .zmqopt_init() ls(.pbd_env) .pbd_env$ZMQ.SR$BLOCK pbd_opt(bytext = "ZMQ.SR$BLOCK = 0L") } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{.pbd_env}}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{programming} pbdZMQ/man/xx_czmq_wrapper.Rd0000644000176200001440000000152313260234554015707 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/zmq.r \name{C-like Wrapper Functions for ZeroMQ} \alias{C-like Wrapper Functions for ZeroMQ} \title{The C-like ZeroMQ Interface} \description{ The basic interface to ZeroMQ that somewhat models the C interface. } \details{ A list of all functions for this interface is as follows: \tabular{lll}{ \code{zmq.bind()} \tab \code{zmq.close()} \tab \code{zmqconnect()} \cr \code{zmq.ctx.destroy()} \tab \code{zmq.ctx.new()} \tab \code{zmq.msg.recv()} \cr \code{zmq.msg.send()} \tab \code{zmq.recv()} \tab \code{zmq.send()} \cr \code{zmq.socket()} \tab \tab \cr } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{zmq} pbdZMQ/man/a0_b_pbd_opt.Rd0000644000176200001440000000264513260234554014774 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/111_pbd_opt.r \name{Set Control Functions} \alias{Set Control Functions} \alias{pbd_opt} \title{Set controls in pbdZMQ} \usage{ pbd_opt(..., bytext = "", envir = .GlobalEnv) } \arguments{ \item{...}{in argument format \code{option = value} to set \code{.pbd_env$option <- value} inside the \code{envir}} \item{bytext}{in text format \code{"option = value"} to set \code{.pbd_env$option <- value} inside the \code{envir}.} \item{envir}{by default the global environment is used.} } \value{ No value is returned. } \description{ Set control functions } \details{ \code{pbd_opt()} sets pbd options for ZMQ controls. \code{...} allows multiple options in \code{envir$.pbd_env}, but only in a simple way. \code{bytext} allows to assign options by text in \code{envir$.pbd_env}, but can assign advanced objects. For example, \code{"option$suboption <- value"} will set \code{envir$.pbd_env$option$suboption <- value}. } \examples{ \dontrun{ library(pbdZMQ, quietly = TRUE) ls(.pbd_env) rm(.pbd_env) .zmqopt_init() ls(.pbd_env) .pbd_env$ZMQ.SR$BLOCK pbd_opt(bytext = "ZMQ.SR$BLOCK <- 0L") } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{.pbd_env}}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com} and Drew Schmidt. } \keyword{programming} pbdZMQ/man/zz_zmq_control.Rd0000644000176200001440000000661113260234554015553 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/111_control.r \name{ZMQ Control Functions} \alias{ZMQ Control Functions} \alias{ZMQ.MC} \alias{ZMQ.PO} \alias{ZMQ.SR} \alias{ZMQ.SO} \alias{ZMQ.ST} \title{Sets of controls in pbdZMQ.} \usage{ ZMQ.MC(warning.at.error = TRUE, stop.at.error = FALSE, check.eintr = FALSE) ZMQ.PO(POLLIN = 1L, POLLOUT = 2L, POLLERR = 4L) ZMQ.SR(BLOCK = 0L, DONTWAIT = 1L, NOBLOCK = 1L, SNDMORE = 2L) ZMQ.SO(AFFINITY = 4L, IDENTITY = 5L, SUBSCRIBE = 6L, UNSUBSCRIBE = 7L, RATE = 8L, RECOVERY_IVL = 9L, SNDBUF = 11L, RCVBUF = 12L, RCVMORE = 13L, FD = 14L, EVENTS = 15L, TYPE = 16L, LINGER = 17L, RECONNECT_IVL = 18L, BACKLOG = 19L, RECONNECT_IVL_MAX = 21L, MAXMSGSIZE = 22L, SNDHWM = 23L, RCVHWM = 24L, MULTICAST_HOPS = 25L, RCVTIMEO = 27L, SNDTIMEO = 28L, LAST_ENDPOINT = 32L, ROUTER_MANDATORY = 33L, TCP_KEEPALIVE = 34L, TCP_KEEPALIVE_CNT = 35L, TCP_KEEPALIVE_IDLE = 36L, TCP_KEEPALIVE_INTVL = 37L, TCP_ACCEPT_FILTER = 38L, IMMEDIATE = 39L, XPUB_VERBOSE = 40L, ROUTER_RAW = 41L, IPV6 = 42L, MECHANISM = 43L, PLAIN_SERVER = 44L, PLAIN_USERNAME = 45L, PLAIN_PASSWORD = 46L, CURVE_SERVER = 47L, CURVE_PUBLICKEY = 48L, CURVE_SECRETKEY = 49L, CURVE_SERVERKEY = 50L, PROBE_ROUTER = 51L, REQ_CORRELATE = 52L, REQ_RELAXED = 53L, CONFLATE = 54L, ZAP_DOMAIN = 55L, ROUTER_HANDOVER = 56L, TOS = 57L, IPC_FILTER_PID = 58L, IPC_FILTER_UID = 59L, IPC_FILTER_GID = 60L, CONNECT_RID = 61L, GSSAPI_SERVER = 62L, GSSAPI_PRINCIPAL = 63L, GSSAPI_SERVICE_PRINCIPAL = 64L, GSSAPI_PLAINTEXT = 65L, HANDSHAKE_IVL = 66L, IDENTITY_FD = 67L, SOCKS_PROXY = 68L, XPUB_NODROP = 69L) ZMQ.ST(PAIR = 0L, PUB = 1L, SUB = 2L, REQ = 3L, REP = 4L, DEALER = 5L, ROUTER = 6L, PULL = 7L, PUSH = 8L, XPUB = 9L, XSUB = 10L, STREAM = 11L) } \arguments{ \item{warning.at.error, stop.at.error, check.eintr}{Logical; if there is a messaging error, should there be an R warning/error, or check user interrupt events.} \item{POLLIN, POLLOUT, POLLERR}{ZMQ poll options; see zmq.h for details.} \item{BLOCK, DONTWAIT, NOBLOCK, SNDMORE}{ZMQ socket options; see zmq.h for details.} \item{AFFINITY, IDENTITY, SUBSCRIBE, UNSUBSCRIBE, RATE, RECOVERY_IVL, SNDBUF, RCVBUF, RCVMORE, FD, EVENTS, TYPE, LINGER, RECONNECT_IVL, BACKLOG, RECONNECT_IVL_MAX, MAXMSGSIZE, SNDHWM, RCVHWM, MULTICAST_HOPS, RCVTIMEO, SNDTIMEO, LAST_ENDPOINT, ROUTER_MANDATORY, TCP_KEEPALIVE, TCP_KEEPALIVE_CNT, TCP_KEEPALIVE_IDLE, TCP_KEEPALIVE_INTVL, TCP_ACCEPT_FILTER, IMMEDIATE, XPUB_VERBOSE, ROUTER_RAW, IPV6, MECHANISM, PLAIN_SERVER, PLAIN_USERNAME, PLAIN_PASSWORD, CURVE_SERVER, CURVE_PUBLICKEY, CURVE_SECRETKEY, CURVE_SERVERKEY, PROBE_ROUTER, REQ_CORRELATE, REQ_RELAXED, CONFLATE, ZAP_DOMAIN, ROUTER_HANDOVER, TOS, IPC_FILTER_PID, IPC_FILTER_UID, IPC_FILTER_GID, CONNECT_RID, GSSAPI_SERVER, GSSAPI_PRINCIPAL, GSSAPI_SERVICE_PRINCIPAL, GSSAPI_PLAINTEXT, HANDSHAKE_IVL, IDENTITY_FD, SOCKS_PROXY, XPUB_NODROP}{ZMQ socket options; see zmq.h for details.} \item{PAIR, PUB, SUB, REQ, REP, DEALER, ROUTER, PULL, PUSH, XPUB, XSUB, STREAM}{ZMQ socket types; see zmq.h for details.} } \description{ These sets of controls are used to provide default values in this package. } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{.pbd_env}}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{global} \keyword{variables} pbdZMQ/man/xx_rzmq_wrapper.Rd0000644000176200001440000000414113260234554015725 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/rzmq_wrapper.r \name{Wrapper Functions for rzmq} \alias{Wrapper Functions for rzmq} \alias{send.socket} \alias{receive.socket} \alias{init.context} \alias{init.socket} \alias{bind.socket} \alias{connect.socket} \title{All Wrapper Functions for rzmq} \usage{ send.socket(socket, data, send.more = FALSE, serialize = TRUE) receive.socket(socket, unserialize = TRUE, dont.wait = FALSE) init.context() init.socket(context, socket.type) bind.socket(socket, address) connect.socket(socket, address) } \arguments{ \item{socket}{A ZMQ socket.} \item{data}{An R object.} \item{send.more}{Logical; will more messages be sent?} \item{serialize, unserialize}{Logical; determines if serialize/unserialize should be called on the sent/received data.} \item{dont.wait}{Logical; determines if reception is blocking.} \item{context}{A ZMQ context.} \item{socket.type}{The type of ZMQ socket as a string, of the form "ZMQ_type". Valid 'type' values are PAIR, PUB, SUB, REQ, REP, DEALER, PULL, PUSH, XPUB, XSUB, and STERAM.} \item{address}{A valid address. See details.} } \description{ Wrapper functions for backwards compatibility with rzmq. See vignette for examples. } \details{ \code{send.socket()}/\code{receive.socket()} send/receive messages over a socket. These are simple wrappers around \code{zmq.msg.send()} and \code{zmq.msg.receive()}, respectively. \code{init.context()} creates a new ZeroMQ context. A useful wrapper around \code{zmq.ctx.new()} which handles freeing memory for you, i.e. \code{zmq.ctx.destroy()} will automatically be called for you. \code{init.socket()} creates a ZeroMQ socket; serves as a high-level binding for \code{zmq.socket()}, including handling freeing memory automatically. See also \code{.pbd_env$ZMQ.ST}. \code{bind.socket()}: see \code{zmq.bind()}. \code{connect.socket()}: see \code{zmq.connect()} } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{rzmq} pbdZMQ/man/address.Rd0000644000176200001440000000144013260234554014101 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/address.r \name{address} \alias{address} \title{Form an Address/Endpoint} \usage{ address(host, port, transport = "tcp") } \arguments{ \item{host}{The host ip address or url.} \item{port}{A port; necessary for all transports except ipc.} \item{transport}{The transport protocol. Choices are "inproc", "ipc", "tcp", and "pgm"/"epgm" for local in-process (inter-thread), local inter-process, tcp, and pgm, respectively.} } \value{ An address, for use with pbdZMQ functions. } \description{ A notationally convenient function for forming addresses/endpoints. It's a simple wrapper around the \code{paste0()} function. } \examples{ address("localhost", 55555) } \seealso{ \code{\link{zmq.bind}} } \author{ Drew Schmidt } pbdZMQ/man/b3_poll.Rd0000644000176200001440000000664113260234554014016 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/R_zmq_poll.r \name{Poll Functions} \alias{Poll Functions} \alias{zmq.poll} \alias{zmq.poll.free} \alias{zmq.poll.length} \alias{zmq.poll.get.revents} \title{Poll Functions} \usage{ zmq.poll(socket, type, timeout = -1L, MC = .pbd_env$ZMQ.MC) zmq.poll.free() zmq.poll.length() zmq.poll.get.revents(index = 1L) } \arguments{ \item{socket}{a vector of ZMQ sockets} \item{type}{a vector of socket types corresponding to \code{socket} argument} \item{timeout}{timeout for poll, see ZeroMQ manual for details} \item{MC}{a message control, see \code{\link{ZMQ.MC}()} for details} \item{index}{an index of ZMQ poll items to obtain revents} } \value{ \code{zmq.poll()} returns a ZMQ code and an errno, see ZeroMQ manual for details, no error/warning/interrupt in this \code{R} function, but some error/warning/interrupt may catch by the \code{C} function \code{zmq_poll()}. \code{zmq.poll.length()} returns the total number of poll items \code{zmq.poll.get.revents()} returns the revent type } \description{ Poll functions } \details{ \code{zmq.poll()} initials ZMQ poll items given ZMQ \code{socket}'s and ZMQ poll \code{type}'s. Both \code{socket} and \code{type} are in vectors of the same length, while \code{socket} contains socket pointers and \code{type} contains types of poll. See \code{\link{ZMQ.PO}()} for the possible values of \code{type}. ZMQ defines several poll types and utilize them to poll multiple sockets. \code{zmq.poll.free()} frees ZMQ poll structure memory internally. \code{zmq.poll.length()} obtains total numbers of ZMQ poll items. \code{zmq.poll.get.revents()} obtains revent types from ZMQ poll item by the input index. } \examples{ \dontrun{ ### Using poll pattern. ### See demo/mspoller.r for details. ### Run next in background or the other window. SHELL> Rscript wuserver.r & SHELL> Rscript taskvent.r & SHELL> Rscript mspoller.r ### The mspoller.r has next. library(pbdZMQ, quietly = TRUE) ### Initial. context <- zmq.ctx.new() receiver <- zmq.socket(context, .pbd_env$ZMQ.ST$PULL) zmq.connect(receiver, "tcp://localhost:5557") subscriber <- zmq.socket(context, .pbd_env$ZMQ.ST$SUB) zmq.connect(subscriber, "tcp://localhost:5556") zmq.setsockopt(subscriber, .pbd_env$ZMQ.SO$SUBSCRIBE, "20993") ### Process messages from both sockets. cat("Press Ctrl+C or Esc to stop mspoller.\\n") i.rec <- 0 i.sub <- 0 while(TRUE){ ### Set poller. zmq.poll(c(receiver, subscriber), c(.pbd_env$ZMQ.PO$POLLIN, .pbd_env$ZMQ.PO$POLLIN)) ### Check receiver. if(bitwAnd(zmq.poll.get.revents(1), .pbd_env$ZMQ.PO$POLLIN)){ ret <- zmq.recv(receiver) if(ret$len != -1){ cat("task ventilator:", ret$buf, "at", i.rec, "\\n") i.rec <- i.rec + 1 } } ### Check subscriber. if(bitwAnd(zmq.poll.get.revents(2), .pbd_env$ZMQ.PO$POLLIN)){ ret <- zmq.recv(subscriber) if(ret$len != -1){ cat("weather update:", ret$buf, "at", i.sub, "\\n") i.sub <- i.sub + 1 } } if(i.rec >= 5 & i.sub >= 5){ break } Sys.sleep(runif(1, 0.5, 1)) } ### Finish. zmq.poll.free() zmq.close(receiver) zmq.close(subscriber) zmq.ctx.destroy(context) } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.recv}()}, \code{\link{zmq.send}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{programming} pbdZMQ/man/a1_socket.Rd0000644000176200001440000001070413260234554014330 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/R_zmq_socket.r \name{Socket Functions} \alias{Socket Functions} \alias{zmq.socket} \alias{zmq.close} \alias{zmq.bind} \alias{zmq.connect} \alias{zmq.disconnect} \alias{zmq.setsockopt} \alias{zmq.getsockopt} \title{Socket Functions} \usage{ zmq.socket(ctx, type = .pbd_env$ZMQ.ST$REP) zmq.close(socket) zmq.bind(socket, endpoint, MC = .pbd_env$ZMQ.MC) zmq.connect(socket, endpoint, MC = .pbd_env$ZMQ.MC) zmq.disconnect(socket, endpoint, MC = .pbd_env$ZMQ.MC) zmq.setsockopt(socket, option.name, option.value, MC = .pbd_env$ZMQ.MC) zmq.getsockopt(socket, option.name, option.value, MC = .pbd_env$ZMQ.MC) } \arguments{ \item{ctx}{a ZMQ context} \item{type}{a socket type} \item{socket}{a ZMQ socket} \item{endpoint}{a ZMQ socket endpoint} \item{MC}{a message control, see \code{\link{ZMQ.MC}()} for details} \item{option.name}{an option name to the socket} \item{option.value}{an option value to the option name} } \value{ \code{zmq.socket()} returns an R external pointer (\code{socket}) generated by ZMQ C API pointing to a socket if successful, otherwise returns an R \code{NULL} and sets \code{errno} to the error value, see ZeroMQ manual for details. \code{zmq.close()} destroys the socket reference/pointer (\code{socket}) and returns 0 if successful, otherwise returns -1 and sets \code{errno} to the error value, see ZeroMQ manual for details. \code{zmq.bind()} binds the socket to specific \code{endpoint} and returns 0 if successful, otherwise returns -1 and sets \code{errno} to the error value, see ZeroMQ manual for details. \code{zmq.connect()} connects the socket to specific \code{endpoint} and returns 0 if successful, otherwise returns -1 and sets \code{errno} to the error value, see ZeroMQ manual for details. \code{zmq.setsockopt()} sets/changes the socket option and returns 0 if successful, otherwise returns -1 and sets \code{errno} to the error value, see ZeroMQ manual for details. \code{zmq.getsockopt()} returns the value of socket option, see ZeroMQ manual for details. } \description{ Socket functions } \details{ \code{zmq.socket()} initials a ZMQ socket given a ZMQ context \code{ctx} and a socket \code{type}. See \code{\link{ZMQ.ST}()} for the possible values of \code{type}. ZMQ defines several patterns for the socket type and utilize them to communicate in different ways including request-reply, publish-subscribe, pipeline, exclusive pair, and naive patterns. \code{zmq.close()} destroys the ZMQ socket. \code{zmq.bind()} binds the socket to a local endpoint and then accepts incoming connections on that endpoint. See \code{endpoint} next for details. \code{zmq.connect()} connects the socket to a remote endpoint and then accepts outgoing connections on that endpoint. See \code{endpoint} next for details. \code{endpoint} is a string consisting of a transport :// followed by an address. The transport specifies the underlying protocol to use. The address specifies the transport-specific address to bind to. pbdZMQ/ZMQ provides the following transports: \tabular{ll}{ Transport \tab Usage \cr \code{tcp} \tab unicast transport using TCP \cr \code{ipc} \tab local inter-process communication transport \cr \code{inproc} \tab local in-process (inter-thread) communication transport \cr \code{pgm,epgm} \tab reliable multicast transport using PGM } *** warning: \code{epgm} is not turned on by default in the pbdZMQ's internal ZeroMQ library. \cr *** warning: \code{ipc} is not supported in Windows system. \code{zmq.setsockopt()} is to set/change socket options. \code{zmq.getsockopt()} is to get socket options and returns \code{option.value}. } \examples{ \dontrun{ ### Using request-reply pattern. ### At the server, run next in background or the other windows. library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) zmq.bind(responder, "tcp://*:5555") zmq.close(responder) zmq.ctx.destroy(context) ### At a client, run next in foreground. library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) zmq.connect(requester, "tcp://localhost:5555") zmq.close(requester) zmq.ctx.destroy(context) } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.ctx.new}()}, \code{\link{zmq.ctx.destroy}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{programming} pbdZMQ/man/b2_sendrecv_multipart.Rd0000644000176200001440000000414513260234554016756 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/R_zmq_sendrecv_multipart.r \name{Send Receive Multiple Raw Buffers} \alias{Send Receive Multiple Raw Buffers} \alias{zmq.send.multipart} \alias{zmq.recv.multipart} \title{Send Receive Multiple Raw Buffers} \usage{ zmq.send.multipart(socket, parts, serialize = TRUE) zmq.recv.multipart(socket, unserialize = TRUE) } \arguments{ \item{socket}{a ZMQ socket} \item{parts}{a vector of multiple buffers to be sent} \item{serialize, unserialize}{if serialize/unserialize the received multiple buffers} } \value{ \code{zmq.send.multipart()} returns. \code{zmq.recv.multipart()} returns. } \description{ Send and receive functions for multiple raw buffers } \details{ \code{zmq.send.multipart()} is a high level R function to send multiple raw messages \code{parts} at once. \code{zmq.recv.multipart()} is a high level R function to receive multiple raw messages at once. } \examples{ \dontrun{ ### Using request-reply pattern. ### At the server, run next in background or the other window. library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) zmq.bind(responder, "tcp://*:5555") ret <- zmq.recv.multipart(responder, unserialize = TRUE) parts <- as.list(rep("World", 5)) zmq.send.multipart(responder, parts) for(i in 1:5) cat(ret[[i]]) zmq.close(responder) zmq.ctx.destroy(context) ### At a client, run next in foreground. library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) zmq.connect(requester, "tcp://localhost:5555") parts <- lapply(1:5, function(i.req){ paste("Sending Hello ", i.req, "\\n") }) zmq.send.multipart(requester, parts) ret <- zmq.recv.multipart(requester, unserialize = TRUE) print(ret) zmq.close(requester) zmq.ctx.destroy(context) } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.msg.send}()}, \code{\link{zmq.msg.recv}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{programming} pbdZMQ/man/a0_b_control.Rd0000644000176200001440000000441113260234554015016 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/222_export_env.r \docType{data} \name{ZMQ Control Environment} \alias{ZMQ Control Environment} \alias{.pbd_env} \title{Sets of controls in pbdZMQ.} \format{Objects contain several parameters for communicators and methods.} \description{ These sets of controls are used to provide default values in this package. } \details{ The elements of \code{.pbd_env$ZMQ.ST} are default values for socket types as defined in `zmq.h' including \tabular{lcl}{ Elements \tab Value \tab Usage \cr \code{PAIR} \tab 0L \tab socket type PAIR \cr \code{PUB} \tab 1L \tab socket type PUB \cr \code{SUB} \tab 2L \tab socket type SUB \cr \code{REQ} \tab 3L \tab socket type REQ \cr \code{REP} \tab 4L \tab socket type REP \cr \code{DEALER} \tab 5L \tab socket type DEALER \cr \code{ROUTER} \tab 6L \tab socket type ROUTER \cr \code{PULL} \tab 7L \tab socket type PULL \cr \code{PUSH} \tab 8L \tab socket type PUSH \cr \code{XPUB} \tab 9L \tab socket type XPUB \cr \code{XSUB} \tab 10L \tab socket type XSUB \cr \code{STREAM} \tab 11L \tab socket type STREAM } The elements of \code{.pbd_env$ZMQ.SO} are default values for socket options as defined in `zmq.h' including 60 different values, see \code{.pbd_env$ZMQ.SO} and `zmq.h' for details. The elements of \code{.pbd_env$ZMQ.SR} are default values for send/recv options as defined in `zmq.h' including \tabular{lcl}{ Elements \tab Value \tab Usage \cr \code{BLOCK} \tab 0L \tab send/recv option BLOCK \cr \code{DONTWAIT} \tab 1L \tab send/recv option DONTWAIT \cr \code{NOBLOCK} \tab 1L \tab send/recv option NOBLOCK \cr \code{SNDMORE} \tab 2L \tab send/recv option SNDMORE (not supported) } The elements of \code{.pbd_env$ZMQ.MC} are default values for warning and stop controls in R. These are not the ZeroMQ's internal default values. They are defined as \tabular{lcl}{ Elements \tab Value \tab Usage \cr \code{warning.at.error} \tab TRUE \tab if warn at error \cr \code{stop.at.error} \tab TRUE \tab if stop at error } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{.zmqopt_init}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{global} \keyword{variables} pbdZMQ/man/zz_zmq_flags.Rd0000644000176200001440000000242613260234554015167 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/get_conf_zmq.r \name{ZMQ Flags} \alias{ZMQ Flags} \alias{get.zmq.ldflags} \alias{get.zmq.cppflags} \alias{test.load.zmq} \alias{get.pbdZMQ.ldflags} \title{ZMQ Flags} \usage{ get.zmq.ldflags(arch = "", package = "pbdZMQ") get.zmq.cppflags(arch = "", package = "pbdZMQ") test.load.zmq(arch = "", package = "pbdZMQ") get.pbdZMQ.ldflags(arch = "", package = "pbdZMQ") } \arguments{ \item{arch}{'' (default) for non-windows or '/i386' and '/ix64' for windows} \item{package}{the pbdZMQ package} } \value{ flags to compile and link with ZMQ. } \description{ ZMQ Flags } \details{ \code{get.zmq.cppflags()} gets CFLAGS or CPPFLAGS \code{get.zmq.ldflags()} gets LDFLAGS for libzmq.so, libzmq.dll, or libzmq.*.dylib \code{get.pbdZMQ.ldflags()} gets LDFLAGS for pbdZMQ.so or pbdZMQ.dll \code{test.load.zmq()} tests load libzmq and pbdZMQ shared libraries } \examples{ \dontrun{ get.zmq.cppflags(arch = '/i386') get.zmq.ldflags(arch = '/x64') get.pbdZMQ.ldflags(arch = '/x64') test.load.zmq(arch = '/x64') } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{compile} pbdZMQ/man/a0_a_pbdZMQ-package.Rd0000644000176200001440000000332313260234554016064 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/pbdZMQ-package.r \docType{package} \name{pbdZMQ-package} \alias{pbdZMQ-package} \alias{pbdZMQ} \title{Programming with Big Data -- Interface to ZeroMQ} \description{ ZeroMQ is a well-known library for high-performance asynchronous messaging in scalable, distributed applications. This package provides high level R wrapper functions to easily utilize ZeroMQ. We mainly focus on interactive client/server programming frameworks. For convenience, a minimal ZeroMQ library (4.1.0 rc1) is shipped with pbdZMQ, which can be used if no system installation of ZeroMQ is available. A few wrapper functions compatible with rzmq are also provided. } \details{ \tabular{ll}{ Package: \tab pbdZMQ \cr Type: \tab Package \cr License: \tab GPL-3 2.0 \cr LazyLoad: \tab yes \cr } The install command using default \pkg{pbdZMQ}'s internal ZeroMQ library is \cr \cr \code{> R CMD INSTALL pbdZMQ_0.1-0.tar.gz} \cr \code{--configure-args="--enable-internal-zmq"} \cr \cr Other available variables include \tabular{ll}{ Variable \tab Default \cr \code{ZMQ_INCLUDE} \tab \code{-I./zmqsrc/include} \cr \code{ZMQ_LDFLAGS} \tab \code{-L./ -lzmq} \cr \code{ZMQ_POLLER} \tab \code{select} \cr } See the package source file \code{pbdZMQ/configure.ac} for details. For installation using an external ZeroMQ library, see the package source file \code{pbdZMQ/INSTALL} for details. } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.ctx.new}()}, \code{\link{zmq.socket}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{package} pbdZMQ/man/xx_ls_wrapper.Rd0000644000176200001440000000161013260234554015350 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/base_ls.r \name{ls} \alias{ls} \title{A wrapper function for base::ls} \usage{ ls(name, pos = -1L, envir = as.environment(pos), all.names = FALSE, pattern, sorted = TRUE) } \arguments{ \item{name, pos, envir, all.names, pattern, sorted}{as the original \code{base::ls()}.} } \value{ As the original \code{base::ls()} except when \code{all.names} is \code{TRUE} and \code{envir} is \code{.GlobalEnv}, hidden pbd objects such as \code{.pbd_env} and \code{.pbdenv} will not be returned. } \description{ The \code{ls()} function with modification to avoid listing hidden pbd objects. } \details{ As the original \code{base::ls()}, it returns the names of the objects. } \examples{ \dontrun{ library(pbdRPC, quietly = TRUE) ls(all.names = TRUE) base::ls(all.names = TRUE) } } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } pbdZMQ/man/xx_utility.Rd0000644000176200001440000000211613260234554014677 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/R_zmq_utility.r \name{Utility Functions} \alias{Utility Functions} \alias{zmq.strerror} \alias{zmq.version} \title{Utility Functions} \usage{ zmq.strerror(errno) zmq.version() } \arguments{ \item{errno}{an integer for the error number} } \value{ \code{zmq.strerror()} returns an R string containing ZeroMQ error message. } \description{ Utility functions } \details{ \code{zmq.strerror()} gets ZeroMQ error message string. \code{zmq.version()} print current ZeroMQ version. } \examples{ \dontrun{ library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() zmq.ctx.destroy(context) zmq.strerror(0) zmq.ctx.destroy(context) # Error since context is free. zmq.strerror(14) } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.ctx.new}()}, \code{\link{zmq.ctx.destroy}()}, \code{\link{zmq.socket}()}, \code{\link{zmq.close}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{internal} pbdZMQ/man/u0_shellexec.wcc.Rd0000644000176200001440000000360713260234554015616 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/shellexec_wcc.r \name{shellexec.wcc} \alias{shellexec.wcc} \title{Shell Execution via cmd windows} \usage{ shellexec.wcc(file, SW.cmd = 7L) } \arguments{ \item{file}{a file name as in \code{shell.exec}()} \item{SW.cmd}{a SW_* command of showing windows} } \value{ A new windows with certain applications depending on the association of the input \code{file}. } \description{ This function is an extension to the \code{shell.exec}() which is a native function of R } \details{ \code{shell.exec("a.txt")} will open a windows (notepad) to edit the file \code{a.txt} in windows system. However, the notepad will block the (parent) active R windows, i.e. \code{SW.cmd = 5} as \code{SH_SHOW} by default. The \code{shellexec.wcc("a.txt", SW.cmd = 7L)} will open the notepad, but in a minimized window. Therefore, there is no blocking to the active R windows. See the website in the references section to see more options to control the behavior of new windows. Possible choices are \code{SW_SHOW (5)}: Activates the window and displays it in its current size and position. \code{SW_SHOWMINIMIZED (2)}: Activates the window and displays it as a minimized window. \code{SW_SHOWMINNOACTIVE (7)}: Displays the window as a minimized window. The active window remains active. \code{SW_SHOWNA (8)}: Displays the window in its current state. The active window remains active. } \examples{ \dontrun{ library(pbdZMQ, quietly = TRUE) shellexec.wcc("a.txt", 5L) } } \references{ Microsoft, Windows Dev Center: Windows desktop applications > Develop > Desktop technologies > Desktop Environment > The Windows Shell > Shell Reference > Shell Functions > ShellExecute \code{https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx} } \seealso{ \code{shell.exec()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{internal} pbdZMQ/man/a2_message.Rd0000644000176200001440000000371213260234554014466 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/R_zmq_message.r \name{Message Function} \alias{Message Function} \alias{zmq.msg.send} \alias{zmq.msg.recv} \title{Message Functions} \usage{ zmq.msg.send(rmsg, socket, flags = .pbd_env$ZMQ.SR$BLOCK, serialize = TRUE) zmq.msg.recv(socket, flags = .pbd_env$ZMQ.SR$BLOCK, unserialize = TRUE) } \arguments{ \item{rmsg}{an R message} \item{socket}{a ZMQ socket} \item{flags}{a flag for method of send and receive} \item{serialize}{if serialize the \code{rmsg}} \item{unserialize}{if unserialize the received R message} } \value{ \code{zmq.msg.send()} returns 0 if successful, otherwise returns -1 and sets \code{errno} to \code{EFAULT}. \code{zmq.msg.recv()} returns the message if successful, otherwise returns -1 and sets \code{errno} to \code{EFAULT}. } \description{ Message functions } \details{ \code{zmq.msg.send()} sends an R message. \code{zmq.msg.recv()} receives an R message. } \examples{ \dontrun{ ### Using request-reply pattern. ### At the server, run next in background or the other window. library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() responder <- zmq.socket(context, .pbd_env$ZMQ.ST$REP) zmq.bind(responder, "tcp://*:5555") buf <- zmq.msg.recv(responder) set.seed(1234) ret <- rnorm(5) print(ret) zmq.msg.send(ret, responder) zmq.close(responder) zmq.ctx.destroy(context) ### At a client, run next in foreground. library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() requester <- zmq.socket(context, .pbd_env$ZMQ.ST$REQ) zmq.connect(requester, "tcp://localhost:5555") zmq.msg.send(NULL, requester) ret <- zmq.msg.recv(requester) print(ret) zmq.close(requester) zmq.ctx.destroy(context) } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.send}()}, \code{\link{zmq.recv}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{programming} pbdZMQ/man/a0_d_context.Rd0000644000176200001440000000235013260234554015024 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/R_zmq_context.r \name{Context Functions} \alias{Context Functions} \alias{zmq.ctx.new} \alias{zmq.ctx.destroy} \title{Context Functions} \usage{ zmq.ctx.new() zmq.ctx.destroy(ctx) } \arguments{ \item{ctx}{a ZMQ context} } \value{ \code{zmq.ctx.new()} returns an R external pointer (\code{ctx}) generated by ZMQ C API pointing to a context if successful, otherwise returns an R \code{NULL}. \code{zmq.ctx.destroy()} returns 0 if successful, otherwise returns -1 and sets \code{errno} to either \code{EFAULT} or \code{EINTR}. } \description{ Context functions } \details{ \code{zmq.ctx.new()} initializes a ZMQ context for starting communication. \code{zmq.ctx.destroy()} terminates the context for stopping communication. } \examples{ \dontrun{ library(pbdZMQ, quietly = TRUE) context <- zmq.ctx.new() zmq.ctx.destroy(context) } } \references{ ZeroMQ/4.1.0 API Reference: \url{http://api.zeromq.org/4-1:_start} Programming with Big Data in R Website: \url{http://r-pbd.org/} } \seealso{ \code{\link{zmq.socket}()}, \code{\link{zmq.close}()}, \code{\link{zmq.bind}()}, \code{\link{zmq.connect}()}. } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. } \keyword{programming} pbdZMQ/man/zz_overwrite_shpkg.Rd0000644000176200001440000000271613260234554016430 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/overwrite_shpkg.r \name{Overwrite shpkg} \alias{Overwrite shpkg} \alias{overwrite.shpkg.rpath} \title{Overwrite rpath of linked shared library in osx} \usage{ overwrite.shpkg.rpath(mylib = NULL, mypkg = "JuniperKernel", linkingto = "pbdZMQ", shlib = "zmq") } \arguments{ \item{mylib}{the path where \code{mypkg} was installed (default \code{NULL} that will search from R's path)} \item{mypkg}{the package for where \code{mypkg.so} will be checked or updated} \item{linkingto}{the package for where \code{libshpkg*.dylib} is located} \item{shlib}{name of shlib to be searched for} } \description{ Overwrite rpath of linked shared library (e.g. \code{JuniperKernel/libs/JuniperKernel.so} in osx only. Typically, it is called by \code{.onLoad()} to update rpath if \code{pbdZMQ} or \code{pbdZMQ/libs/libzmq.*.dylib} was moved to a personal directory (e.g. the binary package was installed to a none default path). The commands \code{otool} and \code{install_name_tool} are required. Permission may be needed (e.g. \code{sudo}) to overwrite the shared library. } \examples{ \dontrun{ ### Called by .onLoad() within "JuniperKernel/R/zzz.R" overwrite.shpkg.rpath(mypkg = "JuniperKernel", linkingto = "pbdZMQ", shlib = "zmq") } } \author{ Wei-Chen Chen \email{wccsnow@gmail.com}. Programming with Big Data in R Website: \url{http://r-pbd.org/} } \keyword{compile} pbdZMQ/configure.win0000644000176200001440000000000013260234554014101 0ustar liggesuserspbdZMQ/cleanup0000755000176200001440000000072713271756337013010 0ustar liggesusers#! /bin/sh rm -rf ./chm rm -rf ./config.* rm -rf ./autom4te.cache rm -rf ./src/Makevars rm -rf ./src/Makedeps rm -rf ./src/Makeconf rm -rf ./src/*.dylib rm -rf ./src/*.so* rm -rf ./src/*.o rm -rf ./src/*.d rm -rf ./src/*.dll rm -rf ./src/*.a rm -rf ./src/*.rc rm -rf ./src/*.rds rm -rf ./src/*.la rm -rf ./src-* rm -rf ./R/zzz.r rm -rf ./man/*.pdf rm -rf ./src/zmq rm -rf ./src/build_zmq if [ -e "./src/zmqsrc/Makefile" ]; then (cd ./src/zmqsrc/; make distclean) fi