diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000000..540821528b
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+See README.txt
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000000..805d7df96b
--- /dev/null
+++ b/COPYING
@@ -0,0 +1 @@
+See LICENSE.txt
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000000..540821528b
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1 @@
+See README.txt
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000000..2ee1151e63
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,9 @@
+
+It is advised to run ./autogen.sh before./configure (autoconf and automake
+need to be installed on your system for autogen.sh to work)
+
+./configure has an option named --with-cuda that allows you to specify
+where your CUDA 5.5 toolkit is installed (usually /usr/local/cuda-5.5,
+but some distros may have a different default location)
+
+See README.txt
diff --git a/LICENSE b/LICENSE
index 70566f2d0e..2d7f3b98d8 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,674 +1,3 @@
-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.
-
- {one line to give the program's name and a brief idea of what it does.}
- Copyright (C) {year} {name of author}
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-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:
-
- {project} Copyright (C) {year} {fullname}
- 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
-.
\ No newline at end of file
+ccminer is available under the terms of the GNU Public License version 3.
+
+See LICENSE.TXT for details.
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000000..8e70fb3c86
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,885 @@
+ 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
+.
+
+
+
+
+
+
+
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000000..26f8d7e3e4
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,45 @@
+
+if WANT_JANSSON
+JANSSON_INCLUDES= -I$(top_srcdir)/compat/jansson
+else
+JANSSON_INCLUDES=
+endif
+
+EXTRA_DIST = autogen.sh README.txt LICENSE.txt \
+ cudaminer.sln cudaminer.vcxproj cudaminer.vcxproj.filters \
+ compat/gettimeofday.c compat/getopt/getopt_long.c cpuminer-config.h.in
+
+SUBDIRS = compat
+
+bin_PROGRAMS = ccminer
+
+ccminer_SOURCES = elist.h miner.h compat.h \
+ compat/inttypes.h compat/stdbool.h compat/unistd.h \
+ compat/sys/time.h compat/getopt/getopt.h \
+ cpu-miner.c util.c blake.c groestl.c hefty1.c keccak.c scrypt.c sha2.c \
+ sph_blake.h sph_groestl.h sph_keccak.h sph_types.h \
+ heavy.cu \
+ cuda_blake512.cu cuda_blake512.h \
+ cuda_combine.cu cuda_combine.h \
+ cuda_groestl512.cu cuda_groestl512.h \
+ cuda_hefty1.cu cuda_hefty1.h \
+ cuda_keccak512.cu cuda_keccak512.h \
+ cuda_sha256.cu cuda_sha256.h \
+ cuda_fugue256.cu \
+ fuguecoin.cpp fugue.c sph_fugue.h uint256.h
+
+
+ccminer_LDFLAGS = $(PTHREAD_FLAGS) @CUDA_LDFLAGS@
+ccminer_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@ @CUDA_LIBS@ @OPENMP_CFLAGS@ @LIBS@
+ccminer_CPPFLAGS = -msse2 @LIBCURL_CPPFLAGS@ @OPENMP_CFLAGS@ $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES) -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME
+
+.cu.o:
+ $(NVCC) @CFLAGS@ -Xptxas "-abi=no -v" -arch=compute_20 --maxrregcount=63 --ptxas-options=-v $(JANSSON_INCLUDES) -o $@ -c $<
+
+## Thrust needs Compute 2.0 minimum
+#heavy.o: heavy.cu
+# $(NVCC) @CFLAGS@ -Xptxas "-abi=no -v" -arch=compute_20 --maxrregcount=63 --ptxas-options=-v $(JANSSON_INCLUDES) -o $@ -c $<
+#
+#cuda_hefty1.o: cuda_hefty1.cu
+# $(NVCC) @CFLAGS@ -Xptxas "-abi=no -v" -arch=compute_20 --maxrregcount=63 --ptxas-options=-v $(JANSSON_INCLUDES) -o $@ -c $<
+
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000000..963c70dfde
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,1107 @@
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = ccminer$(EXEEXT)
+subdir = .
+DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
+ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) \
+ $(srcdir)/cpuminer-config.h.in depcomp COPYING compile \
+ config.guess config.sub install-sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = cpuminer-config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_ccminer_OBJECTS = ccminer-cpu-miner.$(OBJEXT) \
+ ccminer-util.$(OBJEXT) ccminer-blake.$(OBJEXT) \
+ ccminer-groestl.$(OBJEXT) ccminer-hefty1.$(OBJEXT) \
+ ccminer-keccak.$(OBJEXT) ccminer-scrypt.$(OBJEXT) \
+ ccminer-sha2.$(OBJEXT) heavy.$(OBJEXT) cuda_blake512.$(OBJEXT) \
+ cuda_combine.$(OBJEXT) cuda_groestl512.$(OBJEXT) \
+ cuda_hefty1.$(OBJEXT) cuda_keccak512.$(OBJEXT) \
+ cuda_sha256.$(OBJEXT) cuda_fugue256.$(OBJEXT) \
+ ccminer-fuguecoin.$(OBJEXT) ccminer-fugue.$(OBJEXT)
+ccminer_OBJECTS = $(am_ccminer_OBJECTS)
+ccminer_DEPENDENCIES =
+ccminer_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(ccminer_LDFLAGS) \
+ $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
+SOURCES = $(ccminer_SOURCES)
+DIST_SOURCES = $(ccminer_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+ cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+ $(LISP)cpuminer-config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CUDA_CFLAGS = @CUDA_CFLAGS@
+CUDA_LDFLAGS = @CUDA_LDFLAGS@
+CUDA_LIBS = @CUDA_LIBS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JANSSON_LIBS = @JANSSON_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBCURL = @LIBCURL@
+LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NVCC = @NVCC@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_FLAGS = @PTHREAD_FLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WS2_LIBS = @WS2_LIBS@
+_libcurl_config = @_libcurl_config@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+@WANT_JANSSON_FALSE@JANSSON_INCLUDES =
+@WANT_JANSSON_TRUE@JANSSON_INCLUDES = -I$(top_srcdir)/compat/jansson
+EXTRA_DIST = autogen.sh README.txt LICENSE.txt \
+ cudaminer.sln cudaminer.vcxproj cudaminer.vcxproj.filters \
+ compat/gettimeofday.c compat/getopt/getopt_long.c cpuminer-config.h.in
+
+SUBDIRS = compat
+ccminer_SOURCES = elist.h miner.h compat.h \
+ compat/inttypes.h compat/stdbool.h compat/unistd.h \
+ compat/sys/time.h compat/getopt/getopt.h \
+ cpu-miner.c util.c blake.c groestl.c hefty1.c keccak.c scrypt.c sha2.c \
+ sph_blake.h sph_groestl.h sph_keccak.h sph_types.h \
+ heavy.cu \
+ cuda_blake512.cu cuda_blake512.h \
+ cuda_combine.cu cuda_combine.h \
+ cuda_groestl512.cu cuda_groestl512.h \
+ cuda_hefty1.cu cuda_hefty1.h \
+ cuda_keccak512.cu cuda_keccak512.h \
+ cuda_sha256.cu cuda_sha256.h \
+ cuda_fugue256.cu \
+ fuguecoin.cpp fugue.c sph_fugue.h uint256.h
+
+ccminer_LDFLAGS = $(PTHREAD_FLAGS) @CUDA_LDFLAGS@
+ccminer_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@ @CUDA_LIBS@ @OPENMP_CFLAGS@ @LIBS@
+ccminer_CPPFLAGS = -msse2 @LIBCURL_CPPFLAGS@ @OPENMP_CFLAGS@ $(PTHREAD_FLAGS) -fno-strict-aliasing $(JANSSON_INCLUDES) -DSCRYPT_KECCAK512 -DSCRYPT_CHACHA -DSCRYPT_CHOOSE_COMPILETIME
+all: cpuminer-config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .cpp .cu .o .obj
+am--refresh: Makefile
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+cpuminer-config.h: stamp-h1
+ @if test ! -f $@; then rm -f stamp-h1; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+
+stamp-h1: $(srcdir)/cpuminer-config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status cpuminer-config.h
+$(srcdir)/cpuminer-config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f cpuminer-config.h stamp-h1
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+ccminer$(EXEEXT): $(ccminer_OBJECTS) $(ccminer_DEPENDENCIES) $(EXTRA_ccminer_DEPENDENCIES)
+ @rm -f ccminer$(EXEEXT)
+ $(AM_V_CXXLD)$(ccminer_LINK) $(ccminer_OBJECTS) $(ccminer_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-blake.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-cpu-miner.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-fugue.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-fuguecoin.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-groestl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-hefty1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-keccak.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-scrypt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-sha2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccminer-util.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+ccminer-cpu-miner.o: cpu-miner.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-cpu-miner.o -MD -MP -MF $(DEPDIR)/ccminer-cpu-miner.Tpo -c -o ccminer-cpu-miner.o `test -f 'cpu-miner.c' || echo '$(srcdir)/'`cpu-miner.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-cpu-miner.Tpo $(DEPDIR)/ccminer-cpu-miner.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cpu-miner.c' object='ccminer-cpu-miner.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-cpu-miner.o `test -f 'cpu-miner.c' || echo '$(srcdir)/'`cpu-miner.c
+
+ccminer-cpu-miner.obj: cpu-miner.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-cpu-miner.obj -MD -MP -MF $(DEPDIR)/ccminer-cpu-miner.Tpo -c -o ccminer-cpu-miner.obj `if test -f 'cpu-miner.c'; then $(CYGPATH_W) 'cpu-miner.c'; else $(CYGPATH_W) '$(srcdir)/cpu-miner.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-cpu-miner.Tpo $(DEPDIR)/ccminer-cpu-miner.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cpu-miner.c' object='ccminer-cpu-miner.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-cpu-miner.obj `if test -f 'cpu-miner.c'; then $(CYGPATH_W) 'cpu-miner.c'; else $(CYGPATH_W) '$(srcdir)/cpu-miner.c'; fi`
+
+ccminer-util.o: util.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-util.o -MD -MP -MF $(DEPDIR)/ccminer-util.Tpo -c -o ccminer-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-util.Tpo $(DEPDIR)/ccminer-util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util.c' object='ccminer-util.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c
+
+ccminer-util.obj: util.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-util.obj -MD -MP -MF $(DEPDIR)/ccminer-util.Tpo -c -o ccminer-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-util.Tpo $(DEPDIR)/ccminer-util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util.c' object='ccminer-util.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi`
+
+ccminer-blake.o: blake.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-blake.o -MD -MP -MF $(DEPDIR)/ccminer-blake.Tpo -c -o ccminer-blake.o `test -f 'blake.c' || echo '$(srcdir)/'`blake.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-blake.Tpo $(DEPDIR)/ccminer-blake.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='blake.c' object='ccminer-blake.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-blake.o `test -f 'blake.c' || echo '$(srcdir)/'`blake.c
+
+ccminer-blake.obj: blake.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-blake.obj -MD -MP -MF $(DEPDIR)/ccminer-blake.Tpo -c -o ccminer-blake.obj `if test -f 'blake.c'; then $(CYGPATH_W) 'blake.c'; else $(CYGPATH_W) '$(srcdir)/blake.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-blake.Tpo $(DEPDIR)/ccminer-blake.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='blake.c' object='ccminer-blake.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-blake.obj `if test -f 'blake.c'; then $(CYGPATH_W) 'blake.c'; else $(CYGPATH_W) '$(srcdir)/blake.c'; fi`
+
+ccminer-groestl.o: groestl.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-groestl.o -MD -MP -MF $(DEPDIR)/ccminer-groestl.Tpo -c -o ccminer-groestl.o `test -f 'groestl.c' || echo '$(srcdir)/'`groestl.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-groestl.Tpo $(DEPDIR)/ccminer-groestl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='groestl.c' object='ccminer-groestl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-groestl.o `test -f 'groestl.c' || echo '$(srcdir)/'`groestl.c
+
+ccminer-groestl.obj: groestl.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-groestl.obj -MD -MP -MF $(DEPDIR)/ccminer-groestl.Tpo -c -o ccminer-groestl.obj `if test -f 'groestl.c'; then $(CYGPATH_W) 'groestl.c'; else $(CYGPATH_W) '$(srcdir)/groestl.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-groestl.Tpo $(DEPDIR)/ccminer-groestl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='groestl.c' object='ccminer-groestl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-groestl.obj `if test -f 'groestl.c'; then $(CYGPATH_W) 'groestl.c'; else $(CYGPATH_W) '$(srcdir)/groestl.c'; fi`
+
+ccminer-hefty1.o: hefty1.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-hefty1.o -MD -MP -MF $(DEPDIR)/ccminer-hefty1.Tpo -c -o ccminer-hefty1.o `test -f 'hefty1.c' || echo '$(srcdir)/'`hefty1.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-hefty1.Tpo $(DEPDIR)/ccminer-hefty1.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hefty1.c' object='ccminer-hefty1.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-hefty1.o `test -f 'hefty1.c' || echo '$(srcdir)/'`hefty1.c
+
+ccminer-hefty1.obj: hefty1.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-hefty1.obj -MD -MP -MF $(DEPDIR)/ccminer-hefty1.Tpo -c -o ccminer-hefty1.obj `if test -f 'hefty1.c'; then $(CYGPATH_W) 'hefty1.c'; else $(CYGPATH_W) '$(srcdir)/hefty1.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-hefty1.Tpo $(DEPDIR)/ccminer-hefty1.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hefty1.c' object='ccminer-hefty1.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-hefty1.obj `if test -f 'hefty1.c'; then $(CYGPATH_W) 'hefty1.c'; else $(CYGPATH_W) '$(srcdir)/hefty1.c'; fi`
+
+ccminer-keccak.o: keccak.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-keccak.o -MD -MP -MF $(DEPDIR)/ccminer-keccak.Tpo -c -o ccminer-keccak.o `test -f 'keccak.c' || echo '$(srcdir)/'`keccak.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-keccak.Tpo $(DEPDIR)/ccminer-keccak.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='keccak.c' object='ccminer-keccak.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-keccak.o `test -f 'keccak.c' || echo '$(srcdir)/'`keccak.c
+
+ccminer-keccak.obj: keccak.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-keccak.obj -MD -MP -MF $(DEPDIR)/ccminer-keccak.Tpo -c -o ccminer-keccak.obj `if test -f 'keccak.c'; then $(CYGPATH_W) 'keccak.c'; else $(CYGPATH_W) '$(srcdir)/keccak.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-keccak.Tpo $(DEPDIR)/ccminer-keccak.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='keccak.c' object='ccminer-keccak.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-keccak.obj `if test -f 'keccak.c'; then $(CYGPATH_W) 'keccak.c'; else $(CYGPATH_W) '$(srcdir)/keccak.c'; fi`
+
+ccminer-scrypt.o: scrypt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-scrypt.o -MD -MP -MF $(DEPDIR)/ccminer-scrypt.Tpo -c -o ccminer-scrypt.o `test -f 'scrypt.c' || echo '$(srcdir)/'`scrypt.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-scrypt.Tpo $(DEPDIR)/ccminer-scrypt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scrypt.c' object='ccminer-scrypt.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-scrypt.o `test -f 'scrypt.c' || echo '$(srcdir)/'`scrypt.c
+
+ccminer-scrypt.obj: scrypt.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-scrypt.obj -MD -MP -MF $(DEPDIR)/ccminer-scrypt.Tpo -c -o ccminer-scrypt.obj `if test -f 'scrypt.c'; then $(CYGPATH_W) 'scrypt.c'; else $(CYGPATH_W) '$(srcdir)/scrypt.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-scrypt.Tpo $(DEPDIR)/ccminer-scrypt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scrypt.c' object='ccminer-scrypt.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-scrypt.obj `if test -f 'scrypt.c'; then $(CYGPATH_W) 'scrypt.c'; else $(CYGPATH_W) '$(srcdir)/scrypt.c'; fi`
+
+ccminer-sha2.o: sha2.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-sha2.o -MD -MP -MF $(DEPDIR)/ccminer-sha2.Tpo -c -o ccminer-sha2.o `test -f 'sha2.c' || echo '$(srcdir)/'`sha2.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-sha2.Tpo $(DEPDIR)/ccminer-sha2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sha2.c' object='ccminer-sha2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-sha2.o `test -f 'sha2.c' || echo '$(srcdir)/'`sha2.c
+
+ccminer-sha2.obj: sha2.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-sha2.obj -MD -MP -MF $(DEPDIR)/ccminer-sha2.Tpo -c -o ccminer-sha2.obj `if test -f 'sha2.c'; then $(CYGPATH_W) 'sha2.c'; else $(CYGPATH_W) '$(srcdir)/sha2.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-sha2.Tpo $(DEPDIR)/ccminer-sha2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sha2.c' object='ccminer-sha2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-sha2.obj `if test -f 'sha2.c'; then $(CYGPATH_W) 'sha2.c'; else $(CYGPATH_W) '$(srcdir)/sha2.c'; fi`
+
+ccminer-fugue.o: fugue.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-fugue.o -MD -MP -MF $(DEPDIR)/ccminer-fugue.Tpo -c -o ccminer-fugue.o `test -f 'fugue.c' || echo '$(srcdir)/'`fugue.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-fugue.Tpo $(DEPDIR)/ccminer-fugue.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fugue.c' object='ccminer-fugue.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-fugue.o `test -f 'fugue.c' || echo '$(srcdir)/'`fugue.c
+
+ccminer-fugue.obj: fugue.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ccminer-fugue.obj -MD -MP -MF $(DEPDIR)/ccminer-fugue.Tpo -c -o ccminer-fugue.obj `if test -f 'fugue.c'; then $(CYGPATH_W) 'fugue.c'; else $(CYGPATH_W) '$(srcdir)/fugue.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-fugue.Tpo $(DEPDIR)/ccminer-fugue.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fugue.c' object='ccminer-fugue.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ccminer-fugue.obj `if test -f 'fugue.c'; then $(CYGPATH_W) 'fugue.c'; else $(CYGPATH_W) '$(srcdir)/fugue.c'; fi`
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ccminer-fuguecoin.o: fuguecoin.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ccminer-fuguecoin.o -MD -MP -MF $(DEPDIR)/ccminer-fuguecoin.Tpo -c -o ccminer-fuguecoin.o `test -f 'fuguecoin.cpp' || echo '$(srcdir)/'`fuguecoin.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-fuguecoin.Tpo $(DEPDIR)/ccminer-fuguecoin.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='fuguecoin.cpp' object='ccminer-fuguecoin.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ccminer-fuguecoin.o `test -f 'fuguecoin.cpp' || echo '$(srcdir)/'`fuguecoin.cpp
+
+ccminer-fuguecoin.obj: fuguecoin.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ccminer-fuguecoin.obj -MD -MP -MF $(DEPDIR)/ccminer-fuguecoin.Tpo -c -o ccminer-fuguecoin.obj `if test -f 'fuguecoin.cpp'; then $(CYGPATH_W) 'fuguecoin.cpp'; else $(CYGPATH_W) '$(srcdir)/fuguecoin.cpp'; fi`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ccminer-fuguecoin.Tpo $(DEPDIR)/ccminer-fuguecoin.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='fuguecoin.cpp' object='ccminer-fuguecoin.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ccminer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ccminer-fuguecoin.obj `if test -f 'fuguecoin.cpp'; then $(CYGPATH_W) 'fuguecoin.cpp'; else $(CYGPATH_W) '$(srcdir)/fuguecoin.cpp'; fi`
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+ test ! -s cscope.files \
+ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+ -rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__post_remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ $(am__post_remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+ $(am__post_remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__post_remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__post_remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__post_remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__post_remove_distdir)
+
+dist dist-all:
+ $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+ $(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir)
+ chmod u+w $(distdir)
+ mkdir $(distdir)/_build $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__post_remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS) cpuminer-config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: $(am__recursive_targets) all install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+ am--refresh check check-am clean clean-binPROGRAMS \
+ clean-cscope clean-generic cscope cscopelist-am ctags ctags-am \
+ dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \
+ dist-tarZ dist-xz dist-zip distcheck distclean \
+ distclean-compile distclean-generic distclean-hdr \
+ distclean-tags distcleancheck distdir distuninstallcheck dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+ ps ps-am tags tags-am uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+
+.cu.o:
+ $(NVCC) @CFLAGS@ -Xptxas "-abi=no -v" -arch=compute_20 --maxrregcount=63 --ptxas-options=-v $(JANSSON_INCLUDES) -o $@ -c $<
+
+#heavy.o: heavy.cu
+# $(NVCC) @CFLAGS@ -Xptxas "-abi=no -v" -arch=compute_20 --maxrregcount=63 --ptxas-options=-v $(JANSSON_INCLUDES) -o $@ -c $<
+#
+#cuda_hefty1.o: cuda_hefty1.cu
+# $(NVCC) @CFLAGS@ -Xptxas "-abi=no -v" -arch=compute_20 --maxrregcount=63 --ptxas-options=-v $(JANSSON_INCLUDES) -o $@ -c $<
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000000..d3f5a12faa
--- /dev/null
+++ b/NEWS
@@ -0,0 +1 @@
+
diff --git a/README b/README
new file mode 100644
index 0000000000..f5c26fca65
--- /dev/null
+++ b/README
@@ -0,0 +1,3 @@
+
+A CUDA based miner for Heavycoin and Fuguecoin. For more information, take a look at README.txt
+
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000000..12981970d1
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,117 @@
+
+HeavyCUDA release Mar 18th 2014 - Initial Release
+-------------------------------------------------------------
+
+***************************************************************
+If you find this tool useful and like to support its continued
+ development, then consider a donation.
+
+ LTC donation address: LKS1WDKGED647msBQfLBHV3Ls8sveGncnm
+ BTC donation address: 16hJF5mceSojnTD3ZTUDqdRhDyPJzoRakM
+ YAC donation address: Y87sptDEcpLkLeAuex6qZioDbvy1qXZEj4
+ VTC donation address: VrjeFzMgvteCGarLw85KivBzmsiH9fqp4a
+ MAX donation address: mHrhQP9EFArechWxTFJ97s9D3jvcCvEEnt
+ DOGE donation address: DT9ghsGmez6ojVdEZgvaZbT2Z3TruXG6yP
+ PANDA donation address: PvgtxJ2ZKaudRogCXfUMLXVaWUMcKQgRed
+ MRC donation address: 1Lxc4JPDpQRJB8BN4YwhmSQ3Rcu8gjj2Kd
+ HVC donation address: HNN3PyyTMkDo4RkEjkWSGMwqia1yD8mwJN
+***************************************************************
+
+>>> Introduction <<<
+
+This is a CUDA accelerated mining application for use with
+HeavyCoin and FugueCoin. We did not take effort on usability,
+so please set your parameters carefuly.
+
+THIS PROGRAMM IS PROVIDED "AS-IS", USE IT AT YOUR OWN RISK!
+
+If you're interessted and read the source-code, please excuse
+that the most of our comments are in german.
+
+>>> Command Line Interface <<<
+
+This code is based on the pooler cpuminer 2.3.2 release and inherits
+its command line interface and options.
+
+ -a, --algo=ALGO specify the algorithm to use
+ heavy use to mine Heavycoin
+ fugue256 use to mine Fuguecoin
+
+ -o, --url=URL URL of mining server (default: " DEF_RPC_URL ")
+ -O, --userpass=U:P username:password pair for mining server
+ -u, --user=USERNAME username for mining server
+ -p, --pass=PASSWORD password for mining server
+ -v, --vote Heavycoin block vote (default: 512)
+ --cert=FILE certificate for mining server using SSL
+ -x, --proxy=[PROTOCOL://]HOST[:PORT] connect through a proxy
+ -t, --threads=N number of miner threads (default: number of nVidia GPUs in your system)
+ -r, --retries=N number of times to retry if a network call fails
+ (default: retry indefinitely)
+ -R, --retry-pause=N time to pause between retries, in seconds (default: 15)
+ -T, --timeout=N network timeout, in seconds (default: 270)
+ -s, --scantime=N upper bound on time spent scanning current work when
+ long polling is unavailable, in seconds (default: 5)
+ --no-longpoll disable X-Long-Polling support
+ --no-stratum disable X-Stratum support
+ -q, --quiet disable per-thread hashmeter output
+ -D, --debug enable debug output
+ -P, --protocol-dump verbose dump of protocol-level activities
+ -B, --background run the miner in the background
+ --benchmark run in offline benchmark mode
+ -c, --config=FILE load a JSON-format configuration file
+ -V, --version display version information and exit
+ -h, --help display this help text and exit
+
+>>> Examples <<<
+
+Example for Heavycoin Mining on heavycoinpool.com with a single gpu in your system
+
+cudaminer.exe -t 1 -a heavy -o stratum+tcp://stratum01.heavycoinpool.com:5333 -u <> -p <> -v 512
+
+
+
+Example for Heavycoin Mining on hvc.1gh.com with a dual gpu in your system
+
+cudaminer.exe -t 2 -a heavy -o stratum+tcp://hvcpool.1gh.com:5333 -u <> -p x -v 512
+
+
+
+Example for Fuguecoin solo-mining with 4 gpu's in your system and a Fuguecoin-wallet running on localhost
+
+cudaminer.exe -q -s 1 -t 4 -a fugue256 -o http://localhost:9089 -u <> -p <>
+
+For solo-mining you typically use -o 127.0.0.1:xxxx where xxxx represents
+the RPC portnumber specified in your wallet's .conf file and you have to
+pass the same username and password with -O as specified in the wallet's
+.conf file. The wallet must also be started with the -server option and
+the server flag in the wallet's .conf file set to 1
+
+
+>>> Additional Notes <<<
+
+This code should be running on nVidia GPUs ranging from compute capability
+2.0 up to compute capability 3.5. Just don't expect any hashing miracles
+from your old clunkers.
+
+>>> RELEASE HISTORY <<<
+
+ March, 18 2014 initial release.
+
+
+>>> AUTHORS <<<
+
+Notable contributors to this application are:
+
+Christian Buchner, Christian H. (Germany): CUDA implementation
+
+and also many thanks to anyone else who contributed to the original
+cpuminer application (Jeff Garzik, pooler), it's original HVC-fork
+and the HVC-fork available at hvc.1gh.com
+
+Source code is included to satisfy GNU GPL V2 requirements.
+
+
+With kind regards,
+
+ Christian Buchner ( Christian.Buchner@gmail.com )
+ Christian H. ( Chris84 )
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000000..1b2c558401
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,1379 @@
+# generated automatically by aclocal 1.13.3 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
+# [ACTION-IF-YES], [ACTION-IF-NO])
+# ----------------------------------------------------------
+# David Shaw May-09-2006
+#
+# Checks for libcurl. DEFAULT-ACTION is the string yes or no to
+# specify whether to default to --with-libcurl or --without-libcurl.
+# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the
+# minimum version of libcurl to accept. Pass the version as a regular
+# version number like 7.10.1. If not supplied, any version is
+# accepted. ACTION-IF-YES is a list of shell commands to run if
+# libcurl was successfully found and passed the various tests.
+# ACTION-IF-NO is a list of shell commands that are run otherwise.
+# Note that using --without-libcurl does run ACTION-IF-NO.
+#
+# This macro #defines HAVE_LIBCURL if a working libcurl setup is
+# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary
+# values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are
+# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
+# where yyy are the various protocols supported by libcurl. Both xxx
+# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of
+# the macro for the complete list of possible defines. Shell
+# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
+# defined to 'yes' for those features and protocols that were found.
+# Note that xxx and yyy keep the same capitalization as in the
+# curl-config list (e.g. it's "HTTP" and not "http").
+#
+# Users may override the detected values by doing something like:
+# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure
+#
+# For the sake of sanity, this macro assumes that any libcurl that is
+# found is after version 7.7.2, the first version that included the
+# curl-config script. Note that it is very important for people
+# packaging binary versions of libcurl to include this script!
+# Without curl-config, we can only guess what protocols are available,
+# or use curl_version_info to figure it out at runtime.
+
+AC_DEFUN([LIBCURL_CHECK_CONFIG],
+[
+ AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
+ AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
+ AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
+ AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
+ AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
+ AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN])
+ AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI])
+ AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM])
+
+ AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP])
+
+ AC_ARG_WITH(libcurl,
+ AC_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]),
+ [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
+
+ if test "$_libcurl_with" != "no" ; then
+
+ AC_PROG_AWK
+
+ _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
+
+ _libcurl_try_link=yes
+
+ if test -d "$_libcurl_with" ; then
+ LIBCURL_CPPFLAGS="-I$withval/include"
+ _libcurl_ldflags="-L$withval/lib"
+ AC_PATH_PROG([_libcurl_config],[curl-config],[],
+ ["$withval/bin"])
+ else
+ AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH])
+ fi
+
+ if test x$_libcurl_config != "x" ; then
+ AC_CACHE_CHECK([for the version of libcurl],
+ [libcurl_cv_lib_curl_version],
+ [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`])
+
+ _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
+ _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse`
+
+ if test $_libcurl_wanted -gt 0 ; then
+ AC_CACHE_CHECK([for libcurl >= version $2],
+ [libcurl_cv_lib_version_ok],
+ [
+ if test $_libcurl_version -ge $_libcurl_wanted ; then
+ libcurl_cv_lib_version_ok=yes
+ else
+ libcurl_cv_lib_version_ok=no
+ fi
+ ])
+ fi
+
+ if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
+ if test x"$LIBCURL_CPPFLAGS" = "x" ; then
+ LIBCURL_CPPFLAGS=`$_libcurl_config --cflags`
+ fi
+ if test x"$LIBCURL" = "x" ; then
+ LIBCURL=`$_libcurl_config --libs`
+
+ # This is so silly, but Apple actually has a bug in their
+ # curl-config script. Fixed in Tiger, but there are still
+ # lots of Panther installs around.
+ case "${host}" in
+ powerpc-apple-darwin7*)
+ LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
+ ;;
+ esac
+ fi
+
+ # All curl-config scripts support --feature
+ _libcurl_features=`$_libcurl_config --feature`
+
+ # Is it modern enough to have --protocols? (7.12.4)
+ if test $_libcurl_version -ge 461828 ; then
+ _libcurl_protocols=`$_libcurl_config --protocols`
+ fi
+ else
+ _libcurl_try_link=no
+ fi
+
+ unset _libcurl_wanted
+ fi
+
+ if test $_libcurl_try_link = yes ; then
+
+ # we didn't find curl-config, so let's see if the user-supplied
+ # link line (or failing that, "-lcurl") is enough.
+ LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"}
+
+ AC_CACHE_CHECK([whether libcurl is usable],
+ [libcurl_cv_lib_curl_usable],
+ [
+ _libcurl_save_cppflags=$CPPFLAGS
+ CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
+ _libcurl_save_libs=$LIBS
+ LIBS="$LIBCURL $LIBS"
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[
+/* Try and use a few common options to force a failure if we are
+ missing symbols or can't link. */
+int x;
+curl_easy_setopt(NULL,CURLOPT_URL,NULL);
+x=CURL_ERROR_SIZE;
+x=CURLOPT_WRITEFUNCTION;
+x=CURLOPT_FILE;
+x=CURLOPT_ERRORBUFFER;
+x=CURLOPT_STDERR;
+x=CURLOPT_VERBOSE;
+if (x) ;
+]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
+
+ CPPFLAGS=$_libcurl_save_cppflags
+ LIBS=$_libcurl_save_libs
+ unset _libcurl_save_cppflags
+ unset _libcurl_save_libs
+ ])
+
+ if test $libcurl_cv_lib_curl_usable = yes ; then
+
+ # Does curl_free() exist in this version of libcurl?
+ # If not, fake it with free()
+
+ _libcurl_save_cppflags=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
+ _libcurl_save_libs=$LIBS
+ LIBS="$LIBS $LIBCURL"
+
+ AC_CHECK_FUNC(curl_free,,
+ AC_DEFINE(curl_free,free,
+ [Define curl_free() as free() if our version of curl lacks curl_free.]))
+
+ CPPFLAGS=$_libcurl_save_cppflags
+ LIBS=$_libcurl_save_libs
+ unset _libcurl_save_cppflags
+ unset _libcurl_save_libs
+
+ AC_DEFINE(HAVE_LIBCURL,1,
+ [Define to 1 if you have a functional curl library.])
+ AC_SUBST(LIBCURL_CPPFLAGS)
+ AC_SUBST(LIBCURL)
+
+ for _libcurl_feature in $_libcurl_features ; do
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
+ eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
+ done
+
+ if test "x$_libcurl_protocols" = "x" ; then
+
+ # We don't have --protocols, so just assume that all
+ # protocols are available
+ _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP"
+
+ if test x$libcurl_feature_SSL = xyes ; then
+ _libcurl_protocols="$_libcurl_protocols HTTPS"
+
+ # FTPS wasn't standards-compliant until version
+ # 7.11.0 (0x070b00 == 461568)
+ if test $_libcurl_version -ge 461568; then
+ _libcurl_protocols="$_libcurl_protocols FTPS"
+ fi
+ fi
+
+ # RTSP, IMAP, POP3 and SMTP were added in
+ # 7.20.0 (0x071400 == 463872)
+ if test $_libcurl_version -ge 463872; then
+ _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP"
+ fi
+ fi
+
+ for _libcurl_protocol in $_libcurl_protocols ; do
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
+ eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
+ done
+ else
+ unset LIBCURL
+ unset LIBCURL_CPPFLAGS
+ fi
+ fi
+
+ unset _libcurl_try_link
+ unset _libcurl_version_parse
+ unset _libcurl_config
+ unset _libcurl_feature
+ unset _libcurl_features
+ unset _libcurl_protocol
+ unset _libcurl_protocols
+ unset _libcurl_version
+ unset _libcurl_ldflags
+ fi
+
+ if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
+ # This is the IF-NO path
+ ifelse([$4],,:,[$4])
+ else
+ # This is the IF-YES path
+ ifelse([$3],,:,[$3])
+ fi
+
+ unset _libcurl_with
+])dnl
+
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.13'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.13.3], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.13.3])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# Figure out how to run the assembler. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_AS
+# ----------
+AC_DEFUN([AM_PROG_AS],
+[# By default we simply use the C compiler to build assembly code.
+AC_REQUIRE([AC_PROG_CC])
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)])
+AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
+_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
+])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Older Autoconf quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "$am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each '.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.65])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+ [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+#
+#
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES([CC])],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES([CXX])],
+ [m4_define([AC_PROG_CXX],
+ m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES([OBJC])],
+ [m4_define([AC_PROG_OBJC],
+ m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+ [_AM_DEPENDENCIES([OBJCXX])],
+ [m4_define([AC_PROG_OBJCXX],
+ m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
+])
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST([install_sh])])
+
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless 'enable' is passed literally.
+# For symmetry, 'disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+ [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
+ am_maintainer_other[ make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer])],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ MAINT=$MAINTAINER_MODE_TRUE
+ AC_SUBST([MAINT])dnl
+]
+)
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+ [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
+else
+ am_missing_run=
+ AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+ [--enable-silent-rules],
+ [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+ [--disable-silent-rules],
+ [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+ [am_cv_make_support_nested_variables],
+ [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+#
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+ [m4_case([$1],
+ [ustar],
+ [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+ # There is notably a 21 bits limit for the UID and the GID. In fact,
+ # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+ # and bug#13588).
+ am_max_uid=2097151 # 2^21 - 1
+ am_max_gid=$am_max_uid
+ # The $UID and $GID variables are not portable, so we need to resort
+ # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
+ # below are definitely unexpected, so allow the users to see them
+ # (that is, avoid stderr redirection).
+ am_uid=`id -u || echo unknown`
+ am_gid=`id -g || echo unknown`
+ AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+ if test $am_uid -le $am_max_uid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi
+ AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+ if test $am_gid -le $am_max_gid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi],
+
+ [pax],
+ [],
+
+ [m4_fatal([Unknown tar format])])
+
+ AC_MSG_CHECKING([how to create a $1 tar archive])
+
+ # Go ahead even if we have the value already cached. We do so because we
+ # need to set the values for the 'am__tar' and 'am__untar' variables.
+ _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+ for _am_tool in $_am_tools; do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar; do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar /dev/null 2>&1 && break
+ fi
+ done
+ rm -rf conftest.dir
+
+ AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+ AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000000..8261a2c136
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1 @@
+aclocal && autoheader && automake --add-missing --gnu --copy && autoconf
diff --git a/blake.c b/blake.c
new file mode 100644
index 0000000000..a9043e9780
--- /dev/null
+++ b/blake.c
@@ -0,0 +1,1120 @@
+/* $Id: blake.c 252 2011-06-07 17:55:14Z tp $ */
+/*
+ * BLAKE implementation.
+ *
+ * ==========================(LICENSE BEGIN)============================
+ *
+ * Copyright (c) 2007-2010 Projet RNRT SAPHIR
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ===========================(LICENSE END)=============================
+ *
+ * @author Thomas Pornin
+ */
+
+#include
+#include
+#include
+
+#include "sph_blake.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#if SPH_SMALL_FOOTPRINT && !defined SPH_SMALL_FOOTPRINT_BLAKE
+#define SPH_SMALL_FOOTPRINT_BLAKE 1
+#endif
+
+#if SPH_SMALL_FOOTPRINT_BLAKE
+#define SPH_COMPACT_BLAKE_32 1
+#endif
+
+#if SPH_64 && (SPH_SMALL_FOOTPRINT_BLAKE || !SPH_64_TRUE)
+#define SPH_COMPACT_BLAKE_64 1
+#endif
+
+#ifdef _MSC_VER
+#pragma warning (disable: 4146)
+#endif
+
+static const sph_u32 IV224[8] = {
+ SPH_C32(0xC1059ED8), SPH_C32(0x367CD507),
+ SPH_C32(0x3070DD17), SPH_C32(0xF70E5939),
+ SPH_C32(0xFFC00B31), SPH_C32(0x68581511),
+ SPH_C32(0x64F98FA7), SPH_C32(0xBEFA4FA4)
+};
+
+static const sph_u32 IV256[8] = {
+ SPH_C32(0x6A09E667), SPH_C32(0xBB67AE85),
+ SPH_C32(0x3C6EF372), SPH_C32(0xA54FF53A),
+ SPH_C32(0x510E527F), SPH_C32(0x9B05688C),
+ SPH_C32(0x1F83D9AB), SPH_C32(0x5BE0CD19)
+};
+
+#if SPH_64
+
+static const sph_u64 IV384[8] = {
+ SPH_C64(0xCBBB9D5DC1059ED8), SPH_C64(0x629A292A367CD507),
+ SPH_C64(0x9159015A3070DD17), SPH_C64(0x152FECD8F70E5939),
+ SPH_C64(0x67332667FFC00B31), SPH_C64(0x8EB44A8768581511),
+ SPH_C64(0xDB0C2E0D64F98FA7), SPH_C64(0x47B5481DBEFA4FA4)
+};
+
+static const sph_u64 IV512[8] = {
+ SPH_C64(0x6A09E667F3BCC908), SPH_C64(0xBB67AE8584CAA73B),
+ SPH_C64(0x3C6EF372FE94F82B), SPH_C64(0xA54FF53A5F1D36F1),
+ SPH_C64(0x510E527FADE682D1), SPH_C64(0x9B05688C2B3E6C1F),
+ SPH_C64(0x1F83D9ABFB41BD6B), SPH_C64(0x5BE0CD19137E2179)
+};
+
+#endif
+
+#if SPH_COMPACT_BLAKE_32 || SPH_COMPACT_BLAKE_64
+
+static const unsigned sigma[16][16] = {
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },
+ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },
+ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },
+ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },
+ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
+ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
+ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
+ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
+ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }
+};
+
+/*
+ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ 14 10 4 8 9 15 13 6 1 12 0 2 11 7 5 3
+ 11 8 12 0 5 2 15 13 10 14 3 6 7 1 9 4
+ 7 9 3 1 13 12 11 14 2 6 5 10 4 0 15 8
+ 9 0 5 7 2 4 10 15 14 1 11 12 6 8 3 13
+ 2 12 6 10 0 11 8 3 4 13 7 5 15 14 1 9
+ 12 5 1 15 14 13 4 10 0 7 6 3 9 2 8 11
+ 13 11 7 14 12 1 3 9 5 0 15 4 8 6 2 10
+ 6 15 14 9 11 3 0 8 12 2 13 7 1 4 10 5
+ 10 2 8 4 7 6 1 5 15 11 9 14 3 12 13 0
+*/
+#endif
+
+#define Z00 0
+#define Z01 1
+#define Z02 2
+#define Z03 3
+#define Z04 4
+#define Z05 5
+#define Z06 6
+#define Z07 7
+#define Z08 8
+#define Z09 9
+#define Z0A A
+#define Z0B B
+#define Z0C C
+#define Z0D D
+#define Z0E E
+#define Z0F F
+
+#define Z10 E
+#define Z11 A
+#define Z12 4
+#define Z13 8
+#define Z14 9
+#define Z15 F
+#define Z16 D
+#define Z17 6
+#define Z18 1
+#define Z19 C
+#define Z1A 0
+#define Z1B 2
+#define Z1C B
+#define Z1D 7
+#define Z1E 5
+#define Z1F 3
+
+#define Z20 B
+#define Z21 8
+#define Z22 C
+#define Z23 0
+#define Z24 5
+#define Z25 2
+#define Z26 F
+#define Z27 D
+#define Z28 A
+#define Z29 E
+#define Z2A 3
+#define Z2B 6
+#define Z2C 7
+#define Z2D 1
+#define Z2E 9
+#define Z2F 4
+
+#define Z30 7
+#define Z31 9
+#define Z32 3
+#define Z33 1
+#define Z34 D
+#define Z35 C
+#define Z36 B
+#define Z37 E
+#define Z38 2
+#define Z39 6
+#define Z3A 5
+#define Z3B A
+#define Z3C 4
+#define Z3D 0
+#define Z3E F
+#define Z3F 8
+
+#define Z40 9
+#define Z41 0
+#define Z42 5
+#define Z43 7
+#define Z44 2
+#define Z45 4
+#define Z46 A
+#define Z47 F
+#define Z48 E
+#define Z49 1
+#define Z4A B
+#define Z4B C
+#define Z4C 6
+#define Z4D 8
+#define Z4E 3
+#define Z4F D
+
+#define Z50 2
+#define Z51 C
+#define Z52 6
+#define Z53 A
+#define Z54 0
+#define Z55 B
+#define Z56 8
+#define Z57 3
+#define Z58 4
+#define Z59 D
+#define Z5A 7
+#define Z5B 5
+#define Z5C F
+#define Z5D E
+#define Z5E 1
+#define Z5F 9
+
+#define Z60 C
+#define Z61 5
+#define Z62 1
+#define Z63 F
+#define Z64 E
+#define Z65 D
+#define Z66 4
+#define Z67 A
+#define Z68 0
+#define Z69 7
+#define Z6A 6
+#define Z6B 3
+#define Z6C 9
+#define Z6D 2
+#define Z6E 8
+#define Z6F B
+
+#define Z70 D
+#define Z71 B
+#define Z72 7
+#define Z73 E
+#define Z74 C
+#define Z75 1
+#define Z76 3
+#define Z77 9
+#define Z78 5
+#define Z79 0
+#define Z7A F
+#define Z7B 4
+#define Z7C 8
+#define Z7D 6
+#define Z7E 2
+#define Z7F A
+
+#define Z80 6
+#define Z81 F
+#define Z82 E
+#define Z83 9
+#define Z84 B
+#define Z85 3
+#define Z86 0
+#define Z87 8
+#define Z88 C
+#define Z89 2
+#define Z8A D
+#define Z8B 7
+#define Z8C 1
+#define Z8D 4
+#define Z8E A
+#define Z8F 5
+
+#define Z90 A
+#define Z91 2
+#define Z92 8
+#define Z93 4
+#define Z94 7
+#define Z95 6
+#define Z96 1
+#define Z97 5
+#define Z98 F
+#define Z99 B
+#define Z9A 9
+#define Z9B E
+#define Z9C 3
+#define Z9D C
+#define Z9E D
+#define Z9F 0
+
+#define Mx(r, i) Mx_(Z ## r ## i)
+#define Mx_(n) Mx__(n)
+#define Mx__(n) M ## n
+
+#define CSx(r, i) CSx_(Z ## r ## i)
+#define CSx_(n) CSx__(n)
+#define CSx__(n) CS ## n
+
+#define CS0 SPH_C32(0x243F6A88)
+#define CS1 SPH_C32(0x85A308D3)
+#define CS2 SPH_C32(0x13198A2E)
+#define CS3 SPH_C32(0x03707344)
+#define CS4 SPH_C32(0xA4093822)
+#define CS5 SPH_C32(0x299F31D0)
+#define CS6 SPH_C32(0x082EFA98)
+#define CS7 SPH_C32(0xEC4E6C89)
+#define CS8 SPH_C32(0x452821E6)
+#define CS9 SPH_C32(0x38D01377)
+#define CSA SPH_C32(0xBE5466CF)
+#define CSB SPH_C32(0x34E90C6C)
+#define CSC SPH_C32(0xC0AC29B7)
+#define CSD SPH_C32(0xC97C50DD)
+#define CSE SPH_C32(0x3F84D5B5)
+#define CSF SPH_C32(0xB5470917)
+
+#if SPH_COMPACT_BLAKE_32
+
+static const sph_u32 CS[16] = {
+ SPH_C32(0x243F6A88), SPH_C32(0x85A308D3),
+ SPH_C32(0x13198A2E), SPH_C32(0x03707344),
+ SPH_C32(0xA4093822), SPH_C32(0x299F31D0),
+ SPH_C32(0x082EFA98), SPH_C32(0xEC4E6C89),
+ SPH_C32(0x452821E6), SPH_C32(0x38D01377),
+ SPH_C32(0xBE5466CF), SPH_C32(0x34E90C6C),
+ SPH_C32(0xC0AC29B7), SPH_C32(0xC97C50DD),
+ SPH_C32(0x3F84D5B5), SPH_C32(0xB5470917)
+};
+
+#endif
+
+#if SPH_64
+
+#define CBx(r, i) CBx_(Z ## r ## i)
+#define CBx_(n) CBx__(n)
+#define CBx__(n) CB ## n
+
+#define CB0 SPH_C64(0x243F6A8885A308D3)
+#define CB1 SPH_C64(0x13198A2E03707344)
+#define CB2 SPH_C64(0xA4093822299F31D0)
+#define CB3 SPH_C64(0x082EFA98EC4E6C89)
+#define CB4 SPH_C64(0x452821E638D01377)
+#define CB5 SPH_C64(0xBE5466CF34E90C6C)
+#define CB6 SPH_C64(0xC0AC29B7C97C50DD)
+#define CB7 SPH_C64(0x3F84D5B5B5470917)
+#define CB8 SPH_C64(0x9216D5D98979FB1B)
+#define CB9 SPH_C64(0xD1310BA698DFB5AC)
+#define CBA SPH_C64(0x2FFD72DBD01ADFB7)
+#define CBB SPH_C64(0xB8E1AFED6A267E96)
+#define CBC SPH_C64(0xBA7C9045F12C7F99)
+#define CBD SPH_C64(0x24A19947B3916CF7)
+#define CBE SPH_C64(0x0801F2E2858EFC16)
+#define CBF SPH_C64(0x636920D871574E69)
+
+#if SPH_COMPACT_BLAKE_64
+
+static const sph_u64 CB[16] = {
+ SPH_C64(0x243F6A8885A308D3), SPH_C64(0x13198A2E03707344),
+ SPH_C64(0xA4093822299F31D0), SPH_C64(0x082EFA98EC4E6C89),
+ SPH_C64(0x452821E638D01377), SPH_C64(0xBE5466CF34E90C6C),
+ SPH_C64(0xC0AC29B7C97C50DD), SPH_C64(0x3F84D5B5B5470917),
+ SPH_C64(0x9216D5D98979FB1B), SPH_C64(0xD1310BA698DFB5AC),
+ SPH_C64(0x2FFD72DBD01ADFB7), SPH_C64(0xB8E1AFED6A267E96),
+ SPH_C64(0xBA7C9045F12C7F99), SPH_C64(0x24A19947B3916CF7),
+ SPH_C64(0x0801F2E2858EFC16), SPH_C64(0x636920D871574E69)
+};
+
+#endif
+
+#endif
+
+#define GS(m0, m1, c0, c1, a, b, c, d) do { \
+ a = SPH_T32(a + b + (m0 ^ c1)); \
+ d = SPH_ROTR32(d ^ a, 16); \
+ c = SPH_T32(c + d); \
+ b = SPH_ROTR32(b ^ c, 12); \
+ a = SPH_T32(a + b + (m1 ^ c0)); \
+ d = SPH_ROTR32(d ^ a, 8); \
+ c = SPH_T32(c + d); \
+ b = SPH_ROTR32(b ^ c, 7); \
+ } while (0)
+
+#if SPH_COMPACT_BLAKE_32
+
+#define ROUND_S(r) do { \
+ GS(M[sigma[r][0x0]], M[sigma[r][0x1]], \
+ CS[sigma[r][0x0]], CS[sigma[r][0x1]], V0, V4, V8, VC); \
+ GS(M[sigma[r][0x2]], M[sigma[r][0x3]], \
+ CS[sigma[r][0x2]], CS[sigma[r][0x3]], V1, V5, V9, VD); \
+ GS(M[sigma[r][0x4]], M[sigma[r][0x5]], \
+ CS[sigma[r][0x4]], CS[sigma[r][0x5]], V2, V6, VA, VE); \
+ GS(M[sigma[r][0x6]], M[sigma[r][0x7]], \
+ CS[sigma[r][0x6]], CS[sigma[r][0x7]], V3, V7, VB, VF); \
+ GS(M[sigma[r][0x8]], M[sigma[r][0x9]], \
+ CS[sigma[r][0x8]], CS[sigma[r][0x9]], V0, V5, VA, VF); \
+ GS(M[sigma[r][0xA]], M[sigma[r][0xB]], \
+ CS[sigma[r][0xA]], CS[sigma[r][0xB]], V1, V6, VB, VC); \
+ GS(M[sigma[r][0xC]], M[sigma[r][0xD]], \
+ CS[sigma[r][0xC]], CS[sigma[r][0xD]], V2, V7, V8, VD); \
+ GS(M[sigma[r][0xE]], M[sigma[r][0xF]], \
+ CS[sigma[r][0xE]], CS[sigma[r][0xF]], V3, V4, V9, VE); \
+ } while (0)
+
+#else
+
+#define ROUND_S(r) do { \
+ GS(Mx(r, 0), Mx(r, 1), CSx(r, 0), CSx(r, 1), V0, V4, V8, VC); \
+ GS(Mx(r, 2), Mx(r, 3), CSx(r, 2), CSx(r, 3), V1, V5, V9, VD); \
+ GS(Mx(r, 4), Mx(r, 5), CSx(r, 4), CSx(r, 5), V2, V6, VA, VE); \
+ GS(Mx(r, 6), Mx(r, 7), CSx(r, 6), CSx(r, 7), V3, V7, VB, VF); \
+ GS(Mx(r, 8), Mx(r, 9), CSx(r, 8), CSx(r, 9), V0, V5, VA, VF); \
+ GS(Mx(r, A), Mx(r, B), CSx(r, A), CSx(r, B), V1, V6, VB, VC); \
+ GS(Mx(r, C), Mx(r, D), CSx(r, C), CSx(r, D), V2, V7, V8, VD); \
+ GS(Mx(r, E), Mx(r, F), CSx(r, E), CSx(r, F), V3, V4, V9, VE); \
+ } while (0)
+
+#endif
+
+#if SPH_64
+
+#define GB(m0, m1, c0, c1, a, b, c, d) do { \
+ a = SPH_T64(a + b + (m0 ^ c1)); \
+ d = SPH_ROTR64(d ^ a, 32); \
+ c = SPH_T64(c + d); \
+ b = SPH_ROTR64(b ^ c, 25); \
+ a = SPH_T64(a + b + (m1 ^ c0)); \
+ d = SPH_ROTR64(d ^ a, 16); \
+ c = SPH_T64(c + d); \
+ b = SPH_ROTR64(b ^ c, 11); \
+ } while (0)
+
+#if SPH_COMPACT_BLAKE_64
+
+#define ROUND_B(r) do { \
+ GB(M[sigma[r][0x0]], M[sigma[r][0x1]], \
+ CB[sigma[r][0x0]], CB[sigma[r][0x1]], V0, V4, V8, VC); \
+ GB(M[sigma[r][0x2]], M[sigma[r][0x3]], \
+ CB[sigma[r][0x2]], CB[sigma[r][0x3]], V1, V5, V9, VD); \
+ GB(M[sigma[r][0x4]], M[sigma[r][0x5]], \
+ CB[sigma[r][0x4]], CB[sigma[r][0x5]], V2, V6, VA, VE); \
+ GB(M[sigma[r][0x6]], M[sigma[r][0x7]], \
+ CB[sigma[r][0x6]], CB[sigma[r][0x7]], V3, V7, VB, VF); \
+ GB(M[sigma[r][0x8]], M[sigma[r][0x9]], \
+ CB[sigma[r][0x8]], CB[sigma[r][0x9]], V0, V5, VA, VF); \
+ GB(M[sigma[r][0xA]], M[sigma[r][0xB]], \
+ CB[sigma[r][0xA]], CB[sigma[r][0xB]], V1, V6, VB, VC); \
+ GB(M[sigma[r][0xC]], M[sigma[r][0xD]], \
+ CB[sigma[r][0xC]], CB[sigma[r][0xD]], V2, V7, V8, VD); \
+ GB(M[sigma[r][0xE]], M[sigma[r][0xF]], \
+ CB[sigma[r][0xE]], CB[sigma[r][0xF]], V3, V4, V9, VE); \
+ } while (0)
+
+#else
+
+#define ROUND_B(r) do { \
+ GB(Mx(r, 0), Mx(r, 1), CBx(r, 0), CBx(r, 1), V0, V4, V8, VC); \
+ GB(Mx(r, 2), Mx(r, 3), CBx(r, 2), CBx(r, 3), V1, V5, V9, VD); \
+ GB(Mx(r, 4), Mx(r, 5), CBx(r, 4), CBx(r, 5), V2, V6, VA, VE); \
+ GB(Mx(r, 6), Mx(r, 7), CBx(r, 6), CBx(r, 7), V3, V7, VB, VF); \
+ GB(Mx(r, 8), Mx(r, 9), CBx(r, 8), CBx(r, 9), V0, V5, VA, VF); \
+ GB(Mx(r, A), Mx(r, B), CBx(r, A), CBx(r, B), V1, V6, VB, VC); \
+ GB(Mx(r, C), Mx(r, D), CBx(r, C), CBx(r, D), V2, V7, V8, VD); \
+ GB(Mx(r, E), Mx(r, F), CBx(r, E), CBx(r, F), V3, V4, V9, VE); \
+ } while (0)
+
+#endif
+
+#endif
+
+#define DECL_STATE32 \
+ sph_u32 H0, H1, H2, H3, H4, H5, H6, H7; \
+ sph_u32 S0, S1, S2, S3, T0, T1;
+
+#define READ_STATE32(state) do { \
+ H0 = (state)->H[0]; \
+ H1 = (state)->H[1]; \
+ H2 = (state)->H[2]; \
+ H3 = (state)->H[3]; \
+ H4 = (state)->H[4]; \
+ H5 = (state)->H[5]; \
+ H6 = (state)->H[6]; \
+ H7 = (state)->H[7]; \
+ S0 = (state)->S[0]; \
+ S1 = (state)->S[1]; \
+ S2 = (state)->S[2]; \
+ S3 = (state)->S[3]; \
+ T0 = (state)->T0; \
+ T1 = (state)->T1; \
+ } while (0)
+
+#define WRITE_STATE32(state) do { \
+ (state)->H[0] = H0; \
+ (state)->H[1] = H1; \
+ (state)->H[2] = H2; \
+ (state)->H[3] = H3; \
+ (state)->H[4] = H4; \
+ (state)->H[5] = H5; \
+ (state)->H[6] = H6; \
+ (state)->H[7] = H7; \
+ (state)->S[0] = S0; \
+ (state)->S[1] = S1; \
+ (state)->S[2] = S2; \
+ (state)->S[3] = S3; \
+ (state)->T0 = T0; \
+ (state)->T1 = T1; \
+ } while (0)
+
+#if SPH_COMPACT_BLAKE_32
+
+#define COMPRESS32 do { \
+ sph_u32 M[16]; \
+ sph_u32 V0, V1, V2, V3, V4, V5, V6, V7; \
+ sph_u32 V8, V9, VA, VB, VC, VD, VE, VF; \
+ unsigned r; \
+ V0 = H0; \
+ V1 = H1; \
+ V2 = H2; \
+ V3 = H3; \
+ V4 = H4; \
+ V5 = H5; \
+ V6 = H6; \
+ V7 = H7; \
+ V8 = S0 ^ CS0; \
+ V9 = S1 ^ CS1; \
+ VA = S2 ^ CS2; \
+ VB = S3 ^ CS3; \
+ VC = T0 ^ CS4; \
+ VD = T0 ^ CS5; \
+ VE = T1 ^ CS6; \
+ VF = T1 ^ CS7; \
+ M[0x0] = sph_dec32be_aligned(buf + 0); \
+ M[0x1] = sph_dec32be_aligned(buf + 4); \
+ M[0x2] = sph_dec32be_aligned(buf + 8); \
+ M[0x3] = sph_dec32be_aligned(buf + 12); \
+ M[0x4] = sph_dec32be_aligned(buf + 16); \
+ M[0x5] = sph_dec32be_aligned(buf + 20); \
+ M[0x6] = sph_dec32be_aligned(buf + 24); \
+ M[0x7] = sph_dec32be_aligned(buf + 28); \
+ M[0x8] = sph_dec32be_aligned(buf + 32); \
+ M[0x9] = sph_dec32be_aligned(buf + 36); \
+ M[0xA] = sph_dec32be_aligned(buf + 40); \
+ M[0xB] = sph_dec32be_aligned(buf + 44); \
+ M[0xC] = sph_dec32be_aligned(buf + 48); \
+ M[0xD] = sph_dec32be_aligned(buf + 52); \
+ M[0xE] = sph_dec32be_aligned(buf + 56); \
+ M[0xF] = sph_dec32be_aligned(buf + 60); \
+ for (r = 0; r < 14; r ++) \
+ ROUND_S(r); \
+ H0 ^= S0 ^ V0 ^ V8; \
+ H1 ^= S1 ^ V1 ^ V9; \
+ H2 ^= S2 ^ V2 ^ VA; \
+ H3 ^= S3 ^ V3 ^ VB; \
+ H4 ^= S0 ^ V4 ^ VC; \
+ H5 ^= S1 ^ V5 ^ VD; \
+ H6 ^= S2 ^ V6 ^ VE; \
+ H7 ^= S3 ^ V7 ^ VF; \
+ } while (0)
+
+#else
+
+#define COMPRESS32 do { \
+ sph_u32 M0, M1, M2, M3, M4, M5, M6, M7; \
+ sph_u32 M8, M9, MA, MB, MC, MD, ME, MF; \
+ sph_u32 V0, V1, V2, V3, V4, V5, V6, V7; \
+ sph_u32 V8, V9, VA, VB, VC, VD, VE, VF; \
+ V0 = H0; \
+ V1 = H1; \
+ V2 = H2; \
+ V3 = H3; \
+ V4 = H4; \
+ V5 = H5; \
+ V6 = H6; \
+ V7 = H7; \
+ V8 = S0 ^ CS0; \
+ V9 = S1 ^ CS1; \
+ VA = S2 ^ CS2; \
+ VB = S3 ^ CS3; \
+ VC = T0 ^ CS4; \
+ VD = T0 ^ CS5; \
+ VE = T1 ^ CS6; \
+ VF = T1 ^ CS7; \
+ M0 = sph_dec32be_aligned(buf + 0); \
+ M1 = sph_dec32be_aligned(buf + 4); \
+ M2 = sph_dec32be_aligned(buf + 8); \
+ M3 = sph_dec32be_aligned(buf + 12); \
+ M4 = sph_dec32be_aligned(buf + 16); \
+ M5 = sph_dec32be_aligned(buf + 20); \
+ M6 = sph_dec32be_aligned(buf + 24); \
+ M7 = sph_dec32be_aligned(buf + 28); \
+ M8 = sph_dec32be_aligned(buf + 32); \
+ M9 = sph_dec32be_aligned(buf + 36); \
+ MA = sph_dec32be_aligned(buf + 40); \
+ MB = sph_dec32be_aligned(buf + 44); \
+ MC = sph_dec32be_aligned(buf + 48); \
+ MD = sph_dec32be_aligned(buf + 52); \
+ ME = sph_dec32be_aligned(buf + 56); \
+ MF = sph_dec32be_aligned(buf + 60); \
+ ROUND_S(0); \
+ ROUND_S(1); \
+ ROUND_S(2); \
+ ROUND_S(3); \
+ ROUND_S(4); \
+ ROUND_S(5); \
+ ROUND_S(6); \
+ ROUND_S(7); \
+ ROUND_S(8); \
+ ROUND_S(9); \
+ ROUND_S(0); \
+ ROUND_S(1); \
+ ROUND_S(2); \
+ ROUND_S(3); \
+ H0 ^= S0 ^ V0 ^ V8; \
+ H1 ^= S1 ^ V1 ^ V9; \
+ H2 ^= S2 ^ V2 ^ VA; \
+ H3 ^= S3 ^ V3 ^ VB; \
+ H4 ^= S0 ^ V4 ^ VC; \
+ H5 ^= S1 ^ V5 ^ VD; \
+ H6 ^= S2 ^ V6 ^ VE; \
+ H7 ^= S3 ^ V7 ^ VF; \
+ } while (0)
+
+#endif
+
+#if SPH_64
+
+#define DECL_STATE64 \
+ sph_u64 H0, H1, H2, H3, H4, H5, H6, H7; \
+ sph_u64 S0, S1, S2, S3, T0, T1;
+
+#define READ_STATE64(state) do { \
+ H0 = (state)->H[0]; \
+ H1 = (state)->H[1]; \
+ H2 = (state)->H[2]; \
+ H3 = (state)->H[3]; \
+ H4 = (state)->H[4]; \
+ H5 = (state)->H[5]; \
+ H6 = (state)->H[6]; \
+ H7 = (state)->H[7]; \
+ S0 = (state)->S[0]; \
+ S1 = (state)->S[1]; \
+ S2 = (state)->S[2]; \
+ S3 = (state)->S[3]; \
+ T0 = (state)->T0; \
+ T1 = (state)->T1; \
+ } while (0)
+
+#define WRITE_STATE64(state) do { \
+ (state)->H[0] = H0; \
+ (state)->H[1] = H1; \
+ (state)->H[2] = H2; \
+ (state)->H[3] = H3; \
+ (state)->H[4] = H4; \
+ (state)->H[5] = H5; \
+ (state)->H[6] = H6; \
+ (state)->H[7] = H7; \
+ (state)->S[0] = S0; \
+ (state)->S[1] = S1; \
+ (state)->S[2] = S2; \
+ (state)->S[3] = S3; \
+ (state)->T0 = T0; \
+ (state)->T1 = T1; \
+ } while (0)
+
+#if SPH_COMPACT_BLAKE_64
+
+#define COMPRESS64 do { \
+ sph_u64 M[16]; \
+ sph_u64 V0, V1, V2, V3, V4, V5, V6, V7; \
+ sph_u64 V8, V9, VA, VB, VC, VD, VE, VF; \
+ unsigned r; \
+ V0 = H0; \
+ V1 = H1; \
+ V2 = H2; \
+ V3 = H3; \
+ V4 = H4; \
+ V5 = H5; \
+ V6 = H6; \
+ V7 = H7; \
+ V8 = S0 ^ CB0; \
+ V9 = S1 ^ CB1; \
+ VA = S2 ^ CB2; \
+ VB = S3 ^ CB3; \
+ VC = T0 ^ CB4; \
+ VD = T0 ^ CB5; \
+ VE = T1 ^ CB6; \
+ VF = T1 ^ CB7; \
+ M[0x0] = sph_dec64be_aligned(buf + 0); \
+ M[0x1] = sph_dec64be_aligned(buf + 8); \
+ M[0x2] = sph_dec64be_aligned(buf + 16); \
+ M[0x3] = sph_dec64be_aligned(buf + 24); \
+ M[0x4] = sph_dec64be_aligned(buf + 32); \
+ M[0x5] = sph_dec64be_aligned(buf + 40); \
+ M[0x6] = sph_dec64be_aligned(buf + 48); \
+ M[0x7] = sph_dec64be_aligned(buf + 56); \
+ M[0x8] = sph_dec64be_aligned(buf + 64); \
+ M[0x9] = sph_dec64be_aligned(buf + 72); \
+ M[0xA] = sph_dec64be_aligned(buf + 80); \
+ M[0xB] = sph_dec64be_aligned(buf + 88); \
+ M[0xC] = sph_dec64be_aligned(buf + 96); \
+ M[0xD] = sph_dec64be_aligned(buf + 104); \
+ M[0xE] = sph_dec64be_aligned(buf + 112); \
+ M[0xF] = sph_dec64be_aligned(buf + 120); \
+ for (r = 0; r < 16; r ++) \
+ ROUND_B(r); \
+ H0 ^= S0 ^ V0 ^ V8; \
+ H1 ^= S1 ^ V1 ^ V9; \
+ H2 ^= S2 ^ V2 ^ VA; \
+ H3 ^= S3 ^ V3 ^ VB; \
+ H4 ^= S0 ^ V4 ^ VC; \
+ H5 ^= S1 ^ V5 ^ VD; \
+ H6 ^= S2 ^ V6 ^ VE; \
+ H7 ^= S3 ^ V7 ^ VF; \
+ } while (0)
+
+#else
+
+#define COMPRESS64 do { \
+ sph_u64 M0, M1, M2, M3, M4, M5, M6, M7; \
+ sph_u64 M8, M9, MA, MB, MC, MD, ME, MF; \
+ sph_u64 V0, V1, V2, V3, V4, V5, V6, V7; \
+ sph_u64 V8, V9, VA, VB, VC, VD, VE, VF; \
+ V0 = H0; \
+ V1 = H1; \
+ V2 = H2; \
+ V3 = H3; \
+ V4 = H4; \
+ V5 = H5; \
+ V6 = H6; \
+ V7 = H7; \
+ V8 = S0 ^ CB0; \
+ V9 = S1 ^ CB1; \
+ VA = S2 ^ CB2; \
+ VB = S3 ^ CB3; \
+ VC = T0 ^ CB4; \
+ VD = T0 ^ CB5; \
+ VE = T1 ^ CB6; \
+ VF = T1 ^ CB7; \
+ M0 = sph_dec64be_aligned(buf + 0); \
+ M1 = sph_dec64be_aligned(buf + 8); \
+ M2 = sph_dec64be_aligned(buf + 16); \
+ M3 = sph_dec64be_aligned(buf + 24); \
+ M4 = sph_dec64be_aligned(buf + 32); \
+ M5 = sph_dec64be_aligned(buf + 40); \
+ M6 = sph_dec64be_aligned(buf + 48); \
+ M7 = sph_dec64be_aligned(buf + 56); \
+ M8 = sph_dec64be_aligned(buf + 64); \
+ M9 = sph_dec64be_aligned(buf + 72); \
+ MA = sph_dec64be_aligned(buf + 80); \
+ MB = sph_dec64be_aligned(buf + 88); \
+ MC = sph_dec64be_aligned(buf + 96); \
+ MD = sph_dec64be_aligned(buf + 104); \
+ ME = sph_dec64be_aligned(buf + 112); \
+ MF = sph_dec64be_aligned(buf + 120); \
+ ROUND_B(0); \
+ ROUND_B(1); \
+ ROUND_B(2); \
+ ROUND_B(3); \
+ ROUND_B(4); \
+ ROUND_B(5); \
+ ROUND_B(6); \
+ ROUND_B(7); \
+ ROUND_B(8); \
+ ROUND_B(9); \
+ ROUND_B(0); \
+ ROUND_B(1); \
+ ROUND_B(2); \
+ ROUND_B(3); \
+ ROUND_B(4); \
+ ROUND_B(5); \
+ H0 ^= S0 ^ V0 ^ V8; \
+ H1 ^= S1 ^ V1 ^ V9; \
+ H2 ^= S2 ^ V2 ^ VA; \
+ H3 ^= S3 ^ V3 ^ VB; \
+ H4 ^= S0 ^ V4 ^ VC; \
+ H5 ^= S1 ^ V5 ^ VD; \
+ H6 ^= S2 ^ V6 ^ VE; \
+ H7 ^= S3 ^ V7 ^ VF; \
+ } while (0)
+
+#endif
+
+#endif
+
+static const sph_u32 salt_zero_small[4] = { 0, 0, 0, 0 };
+
+static void
+blake32_init(sph_blake_small_context *sc,
+ const sph_u32 *iv, const sph_u32 *salt)
+{
+ memcpy(sc->H, iv, 8 * sizeof(sph_u32));
+ memcpy(sc->S, salt, 4 * sizeof(sph_u32));
+ sc->T0 = sc->T1 = 0;
+ sc->ptr = 0;
+}
+
+static void
+blake32(sph_blake_small_context *sc, const void *data, size_t len)
+{
+ unsigned char *buf;
+ size_t ptr;
+ DECL_STATE32
+
+ buf = sc->buf;
+ ptr = sc->ptr;
+ if (len < (sizeof sc->buf) - ptr) {
+ memcpy(buf + ptr, data, len);
+ ptr += len;
+ sc->ptr = ptr;
+ return;
+ }
+
+ READ_STATE32(sc);
+ while (len > 0) {
+ size_t clen;
+
+ clen = (sizeof sc->buf) - ptr;
+ if (clen > len)
+ clen = len;
+ memcpy(buf + ptr, data, clen);
+ ptr += clen;
+ data = (const unsigned char *)data + clen;
+ len -= clen;
+ if (ptr == sizeof sc->buf) {
+ if ((T0 = SPH_T32(T0 + 512)) < 512)
+ T1 = SPH_T32(T1 + 1);
+ COMPRESS32;
+ ptr = 0;
+ }
+ }
+ WRITE_STATE32(sc);
+ sc->ptr = ptr;
+}
+
+static void
+blake32_close(sph_blake_small_context *sc,
+ unsigned ub, unsigned n, void *dst, size_t out_size_w32)
+{
+ union {
+ unsigned char buf[64];
+ sph_u32 dummy;
+ } u;
+ size_t ptr, k;
+ unsigned bit_len;
+ unsigned z;
+ sph_u32 th, tl;
+ unsigned char *out;
+
+ ptr = sc->ptr;
+ bit_len = ((unsigned)ptr << 3) + n;
+ z = 0x80 >> n;
+ u.buf[ptr] = ((ub & -z) | z) & 0xFF;
+ tl = sc->T0 + bit_len;
+ th = sc->T1;
+ if (ptr == 0 && n == 0) {
+ sc->T0 = SPH_C32(0xFFFFFE00);
+ sc->T1 = SPH_C32(0xFFFFFFFF);
+ } else if (sc->T0 == 0) {
+ sc->T0 = SPH_C32(0xFFFFFE00) + bit_len;
+ sc->T1 = SPH_T32(sc->T1 - 1);
+ } else {
+ sc->T0 -= 512 - bit_len;
+ }
+ if (bit_len <= 446) {
+ memset(u.buf + ptr + 1, 0, 55 - ptr);
+ if (out_size_w32 == 8)
+ u.buf[55] |= 1;
+ sph_enc32be_aligned(u.buf + 56, th);
+ sph_enc32be_aligned(u.buf + 60, tl);
+ blake32(sc, u.buf + ptr, 64 - ptr);
+ } else {
+ memset(u.buf + ptr + 1, 0, 63 - ptr);
+ blake32(sc, u.buf + ptr, 64 - ptr);
+ sc->T0 = SPH_C32(0xFFFFFE00);
+ sc->T1 = SPH_C32(0xFFFFFFFF);
+ memset(u.buf, 0, 56);
+ if (out_size_w32 == 8)
+ u.buf[55] = 1;
+ sph_enc32be_aligned(u.buf + 56, th);
+ sph_enc32be_aligned(u.buf + 60, tl);
+ blake32(sc, u.buf, 64);
+ }
+ out = dst;
+ for (k = 0; k < out_size_w32; k ++)
+ sph_enc32be(out + (k << 2), sc->H[k]);
+}
+
+#if SPH_64
+
+static const sph_u64 salt_zero_big[4] = { 0, 0, 0, 0 };
+
+static void
+blake64_init(sph_blake_big_context *sc,
+ const sph_u64 *iv, const sph_u64 *salt)
+{
+ memcpy(sc->H, iv, 8 * sizeof(sph_u64));
+ memcpy(sc->S, salt, 4 * sizeof(sph_u64));
+ sc->T0 = sc->T1 = 0;
+ sc->ptr = 0;
+}
+
+static void
+blake64(sph_blake_big_context *sc, const void *data, size_t len)
+{
+ unsigned char *buf;
+ size_t ptr;
+ DECL_STATE64
+
+ buf = sc->buf;
+ ptr = sc->ptr;
+ if (len < (sizeof sc->buf) - ptr) {
+ memcpy(buf + ptr, data, len);
+ ptr += len;
+ sc->ptr = ptr;
+ return;
+ }
+
+ READ_STATE64(sc);
+ while (len > 0) {
+ size_t clen;
+
+ clen = (sizeof sc->buf) - ptr;
+ if (clen > len)
+ clen = len;
+ memcpy(buf + ptr, data, clen);
+ ptr += clen;
+ data = (const unsigned char *)data + clen;
+ len -= clen;
+ if (ptr == sizeof sc->buf) {
+ if ((T0 = SPH_T64(T0 + 1024)) < 1024)
+ T1 = SPH_T64(T1 + 1);
+ COMPRESS64;
+ ptr = 0;
+ }
+ }
+ WRITE_STATE64(sc);
+ sc->ptr = ptr;
+}
+
+static void
+blake64_close(sph_blake_big_context *sc,
+ unsigned ub, unsigned n, void *dst, size_t out_size_w64)
+{
+ union {
+ unsigned char buf[128];
+ sph_u64 dummy;
+ } u;
+ size_t ptr, k;
+ unsigned bit_len;
+ unsigned z;
+ sph_u64 th, tl;
+ unsigned char *out;
+
+ ptr = sc->ptr;
+ bit_len = ((unsigned)ptr << 3) + n;
+ z = 0x80 >> n;
+ u.buf[ptr] = ((ub & -z) | z) & 0xFF;
+ tl = sc->T0 + bit_len;
+ th = sc->T1;
+ if (ptr == 0 && n == 0) {
+ sc->T0 = SPH_C64(0xFFFFFFFFFFFFFC00);
+ sc->T1 = SPH_C64(0xFFFFFFFFFFFFFFFF);
+ } else if (sc->T0 == 0) {
+ sc->T0 = SPH_C64(0xFFFFFFFFFFFFFC00) + bit_len;
+ sc->T1 = SPH_T64(sc->T1 - 1);
+ } else {
+ sc->T0 -= 1024 - bit_len;
+ }
+ if (bit_len <= 894) {
+ memset(u.buf + ptr + 1, 0, 111 - ptr);
+ if (out_size_w64 == 8)
+ u.buf[111] |= 1;
+ sph_enc64be_aligned(u.buf + 112, th);
+ sph_enc64be_aligned(u.buf + 120, tl);
+ blake64(sc, u.buf + ptr, 128 - ptr);
+ } else {
+ memset(u.buf + ptr + 1, 0, 127 - ptr);
+ blake64(sc, u.buf + ptr, 128 - ptr);
+ sc->T0 = SPH_C64(0xFFFFFFFFFFFFFC00);
+ sc->T1 = SPH_C64(0xFFFFFFFFFFFFFFFF);
+ memset(u.buf, 0, 112);
+ if (out_size_w64 == 8)
+ u.buf[111] = 1;
+ sph_enc64be_aligned(u.buf + 112, th);
+ sph_enc64be_aligned(u.buf + 120, tl);
+ blake64(sc, u.buf, 128);
+ }
+ out = dst;
+ for (k = 0; k < out_size_w64; k ++)
+ sph_enc64be(out + (k << 3), sc->H[k]);
+}
+
+#endif
+
+/* see sph_blake.h */
+void
+sph_blake224_init(void *cc)
+{
+ blake32_init(cc, IV224, salt_zero_small);
+}
+
+/* see sph_blake.h */
+void
+sph_blake224(void *cc, const void *data, size_t len)
+{
+ blake32(cc, data, len);
+}
+
+/* see sph_blake.h */
+void
+sph_blake224_close(void *cc, void *dst)
+{
+ sph_blake224_addbits_and_close(cc, 0, 0, dst);
+}
+
+/* see sph_blake.h */
+void
+sph_blake224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
+{
+ blake32_close(cc, ub, n, dst, 7);
+ sph_blake224_init(cc);
+}
+
+/* see sph_blake.h */
+void
+sph_blake256_init(void *cc)
+{
+ blake32_init(cc, IV256, salt_zero_small);
+}
+
+/* see sph_blake.h */
+void
+sph_blake256(void *cc, const void *data, size_t len)
+{
+ blake32(cc, data, len);
+}
+
+/* see sph_blake.h */
+void
+sph_blake256_close(void *cc, void *dst)
+{
+ sph_blake256_addbits_and_close(cc, 0, 0, dst);
+}
+
+/* see sph_blake.h */
+void
+sph_blake256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
+{
+ blake32_close(cc, ub, n, dst, 8);
+ sph_blake256_init(cc);
+}
+
+#if SPH_64
+
+/* see sph_blake.h */
+void
+sph_blake384_init(void *cc)
+{
+ blake64_init(cc, IV384, salt_zero_big);
+}
+
+/* see sph_blake.h */
+void
+sph_blake384(void *cc, const void *data, size_t len)
+{
+ blake64(cc, data, len);
+}
+
+/* see sph_blake.h */
+void
+sph_blake384_close(void *cc, void *dst)
+{
+ sph_blake384_addbits_and_close(cc, 0, 0, dst);
+}
+
+/* see sph_blake.h */
+void
+sph_blake384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
+{
+ blake64_close(cc, ub, n, dst, 6);
+ sph_blake384_init(cc);
+}
+
+/* see sph_blake.h */
+void
+sph_blake512_init(void *cc)
+{
+ blake64_init(cc, IV512, salt_zero_big);
+}
+
+/* see sph_blake.h */
+void
+sph_blake512(void *cc, const void *data, size_t len)
+{
+ blake64(cc, data, len);
+}
+
+/* see sph_blake.h */
+void
+sph_blake512_close(void *cc, void *dst)
+{
+ sph_blake512_addbits_and_close(cc, 0, 0, dst);
+}
+
+/* see sph_blake.h */
+void
+sph_blake512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
+{
+ blake64_close(cc, ub, n, dst, 8);
+ sph_blake512_init(cc);
+}
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/ccminer.sln b/ccminer.sln
new file mode 100644
index 0000000000..a28278f2db
--- /dev/null
+++ b/ccminer.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccminer", "ccminer.vcxproj", "{36DC07F9-A4A6-4877-A146-1B960083CF6F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|Win32.Build.0 = Debug|Win32
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|x64.ActiveCfg = Debug|x64
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|x64.Build.0 = Debug|x64
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|Win32.ActiveCfg = Release|Win32
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|Win32.Build.0 = Release|Win32
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|x64.ActiveCfg = Release|x64
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/ccminer.vcxproj b/ccminer.vcxproj
new file mode 100644
index 0000000000..b721b6c964
--- /dev/null
+++ b/ccminer.vcxproj
@@ -0,0 +1,291 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {36DC07F9-A4A6-4877-A146-1B960083CF6F}
+ ccminer
+
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+ Application
+ false
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)
+ .;compat;compat\jansson;compat\getopt;..\pthreads\Pre-built.2\include;..\curl-7.29.0\include;..\OpenSSL-Win32\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir)
+
+
+ true
+ Console
+ cudart.lib;cuda.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;pthreadVC2.lib;libcurl.lib;ws2_32.lib;Wldap32.lib;libeay32MTd.lib;ssleay32MTd.lib;%(AdditionalDependencies)
+ ..\pthreads\Pre-built.2\lib\x86;..\curl-7.29.0\build\lib\Debug;..\OpenSSL-Win32\lib\VC\static;%(AdditionalLibraryDirectories);$(CudaToolkitLibDir)
+
+
+ echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)"
+copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)"
+
+
+ true
+
+
+ 128
+
+
+ true
+ true
+ compute_35,sm_35
+
+
+ -Xptxas "-abi=no -v" %(AdditionalOptions)
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)
+ .;compat;compat\jansson;compat\getopt;..\pthreads\Pre-built.2\include;..\curl-7.29.0_x64\include;..\OpenSSL-Win64\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir)
+
+
+ true
+ Console
+ cudart.lib;cuda.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;pthreadVC2.lib;libcurl.lib;ws2_32.lib;Wldap32.lib;libeay32MTd.lib;ssleay32MTd.lib;%(AdditionalDependencies)
+ ..\pthreads\Pre-built.2\lib\x64;..\curl-7.29.0_x64\build\lib\Debug;..\OpenSSL-Win64\lib\VC\static;%(AdditionalLibraryDirectories);$(CudaToolkitLibDir)
+
+
+ echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)"
+copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)"
+
+
+ true
+
+
+ 128
+
+
+ true
+ true
+ compute_35,sm_35
+
+
+ -Xptxas "-abi=no -v" %(AdditionalOptions)
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)
+ .;compat;compat\jansson;compat\getopt;..\pthreads\Pre-built.2\include;..\curl-7.29.0\include;..\OpenSSL-Win32\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir)
+
+
+ true
+ true
+ true
+ Console
+ cudart.lib;cuda.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;pthreadVC2.lib;libcurl.lib;ws2_32.lib;Wldap32.lib;libeay32MT.lib;ssleay32MT.lib;%(AdditionalDependencies)
+ ..\pthreads\Pre-built.2\lib\x86;..\curl-7.29.0\build\lib\Release;..\OpenSSL-Win32\lib\VC\static;%(AdditionalLibraryDirectories);$(CudaToolkitLibDir)
+
+
+ echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)"
+copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)"
+
+
+ true
+
+
+ 128
+
+
+ true
+ true
+ compute_35,sm_35
+
+
+ -Xptxas "-abi=no -v" %(AdditionalOptions)
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;SCRYPT_KECCAK512;SCRYPT_CHACHA;SCRYPT_CHOOSE_COMPILETIME;%(PreprocessorDefinitions)
+ .;compat;compat\jansson;compat\getopt;..\pthreads\Pre-built.2\include;..\curl-7.29.0_x64\include;..\OpenSSL-Win64\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir)
+
+
+ true
+ true
+ true
+ Console
+ cudart.lib;cuda.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;pthreadVC2.lib;libcurl.lib;ws2_32.lib;Wldap32.lib;libeay32MT.lib;ssleay32MT.lib;%(AdditionalDependencies)
+ ..\pthreads\Pre-built.2\lib\x64;..\curl-7.29.0_x64\build\lib\Release;..\OpenSSL-Win64\lib\VC\static;%(AdditionalLibraryDirectories);$(CudaToolkitLibDir)
+
+
+ echo copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)"
+copy "$(CudaToolkitBinDir)\cudart*.dll" "$(OutDir)"
+
+
+ true
+
+
+ 128
+
+
+ true
+ true
+ compute_35,sm_35
+
+
+ -Xptxas "-abi=no -v" %(AdditionalOptions)
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+
+
+
+
+
+
+
+
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+
+
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+ /TP %(AdditionalOptions)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ compute_10,sm_10
+ compute_10,sm_10
+ compute_10,sm_10
+ compute_10,sm_10
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccminer.vcxproj.filters b/ccminer.vcxproj.filters
new file mode 100644
index 0000000000..f3b22cef6b
--- /dev/null
+++ b/ccminer.vcxproj.filters
@@ -0,0 +1,188 @@
+
+
+
+
+ {2450a9c7-a97a-49e1-ba19-c8dbc5a4e3e7}
+
+
+ {c53ce808-c5c5-4c6c-99a2-3947090c62f1}
+
+
+ {5a45c1bf-81d2-4bc6-97b5-714e34f51a82}
+
+
+ {431cec61-9376-4de9-aae9-04c4250652e7}
+
+
+ {cc8bb259-5332-4a45-ba81-f4840a55b604}
+
+
+ {89362bd8-4690-4f0c-a4f7-6b2fa67a1f34}
+
+
+ {6c3cd392-b6b8-424c-87d2-10e33dbd4b41}
+
+
+ {5a31b6f4-4943-4b22-b69a-230f3cc96269}
+
+
+ {a0f072d0-a831-4c23-8d64-7a026521df9c}
+
+
+ {fe39ded0-754b-415f-a284-038a15a0aa55}
+
+
+ {17b56151-79ec-4a32-bac3-9d94ae7f68fe}
+
+
+
+
+ Source Files\CUDA\jansson
+
+
+ Source Files\CUDA\jansson
+
+
+ Source Files\CUDA\jansson
+
+
+ Source Files\CUDA\jansson
+
+
+ Source Files\CUDA\jansson
+
+
+ Source Files\CUDA\jansson
+
+
+ Source Files\getopt
+
+
+ Source Files\gettimeofday
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files\compat\sys
+
+
+ Header Files\compat
+
+
+ Header Files\compat
+
+
+ Header Files\compat\getopt
+
+
+ Header Files\compat
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files\CUDA
+
+
+ Header Files\CUDA
+
+
+ Header Files\CUDA
+
+
+ Header Files\CUDA
+
+
+ Header Files\CUDA
+
+
+ Header Files\CUDA
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Source Files\CUDA
+
+
+ Source Files\CUDA
+
+
+ Source Files\CUDA
+
+
+ Source Files\CUDA
+
+
+ Source Files\CUDA
+
+
+ Source Files\CUDA
+
+
+ Source Files\CUDA
+
+
+ Source Files\CUDA
+
+
+
\ No newline at end of file
diff --git a/compat.h b/compat.h
new file mode 100644
index 0000000000..ac7b8b9f11
--- /dev/null
+++ b/compat.h
@@ -0,0 +1,24 @@
+#ifndef __COMPAT_H__
+#define __COMPAT_H__
+
+#ifdef WIN32
+
+#include
+
+static __inline void sleep(int secs)
+{
+ Sleep(secs * 1000);
+}
+
+enum {
+ PRIO_PROCESS = 0,
+};
+
+static __inline int setpriority(int which, int who, int prio)
+{
+ return -!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE /*THREAD_PRIORITY_TIME_CRITICAL*/);
+}
+
+#endif /* WIN32 */
+
+#endif /* __COMPAT_H__ */
diff --git a/compat/Makefile.am b/compat/Makefile.am
new file mode 100644
index 0000000000..9401c8e510
--- /dev/null
+++ b/compat/Makefile.am
@@ -0,0 +1,7 @@
+
+if WANT_JANSSON
+SUBDIRS = jansson
+else
+SUBDIRS =
+endif
+
diff --git a/compat/Makefile.in b/compat/Makefile.in
new file mode 100644
index 0000000000..d1d76d9c3b
--- /dev/null
+++ b/compat/Makefile.in
@@ -0,0 +1,601 @@
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = compat
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/cpuminer-config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+ ctags-recursive dvi-recursive html-recursive info-recursive \
+ install-data-recursive install-dvi-recursive \
+ install-exec-recursive install-html-recursive \
+ install-info-recursive install-pdf-recursive \
+ install-ps-recursive install-recursive installcheck-recursive \
+ installdirs-recursive pdf-recursive ps-recursive \
+ tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+am__recursive_targets = \
+ $(RECURSIVE_TARGETS) \
+ $(RECURSIVE_CLEAN_TARGETS) \
+ $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+ distdir
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = jansson
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CUDA_CFLAGS = @CUDA_CFLAGS@
+CUDA_LDFLAGS = @CUDA_LDFLAGS@
+CUDA_LIBS = @CUDA_LIBS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JANSSON_LIBS = @JANSSON_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBCURL = @LIBCURL@
+LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NVCC = @NVCC@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_FLAGS = @PTHREAD_FLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WS2_LIBS = @WS2_LIBS@
+_libcurl_config = @_libcurl_config@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+@WANT_JANSSON_FALSE@SUBDIRS =
+@WANT_JANSSON_TRUE@SUBDIRS = jansson
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu compat/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu compat/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+ @fail=; \
+ if $(am__make_keepgoing); then \
+ failcom='fail=yes'; \
+ else \
+ failcom='exit 1'; \
+ fi; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
+ check-am clean clean-generic cscopelist-am ctags ctags-am \
+ distclean distclean-generic distclean-tags distdir dvi dvi-am \
+ html html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am tags tags-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/compat/getopt/getopt.h b/compat/getopt/getopt.h
new file mode 100644
index 0000000000..068cc24618
--- /dev/null
+++ b/compat/getopt/getopt.h
@@ -0,0 +1,93 @@
+/* $Id: getopt.h,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $ */
+/* $OpenBSD: getopt.h,v 1.1 2002/12/03 20:24:29 millert Exp $ */
+/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _GETOPT_H_
+#define _GETOPT_H_
+
+#if 0
+#include
+#endif
+
+/*
+ * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
+ */
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+struct option {
+ /* name of long option */
+ const char *name;
+ /*
+ * one of no_argument, required_argument, and optional_argument:
+ * whether option takes an argument
+ */
+ int has_arg;
+ /* if not NULL, set *flag to val when option found */
+ int *flag;
+ /* if flag not NULL, value to set *flag to; else return value */
+ int val;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getopt_long(int, char * const *, const char *,
+ const struct option *, int *);
+int getopt_long_only(int, char * const *, const char *,
+ const struct option *, int *);
+#ifndef _GETOPT_DEFINED
+#define _GETOPT_DEFINED
+int getopt(int, char * const *, const char *);
+int getsubopt(char **, char * const *, char **);
+
+extern char *optarg; /* getopt(3) external variables */
+extern int opterr;
+extern int optind;
+extern int optopt;
+extern int optreset;
+extern char *suboptarg; /* getsubopt(3) external variable */
+#endif /* _GETOPT_DEFINED */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !_GETOPT_H_ */
diff --git a/compat/getopt/getopt_long.c b/compat/getopt/getopt_long.c
new file mode 100644
index 0000000000..90fc0cfaac
--- /dev/null
+++ b/compat/getopt/getopt_long.c
@@ -0,0 +1,554 @@
+/* $Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $ */
+/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $ */
+/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
+
+/*
+ * Copyright (c) 2002 Todd C. Miller
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+ */
+
+#ifndef lint
+static const char rcsid[]="$Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $";
+#endif /* lint */
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if 0
+#include
+#endif
+#include
+#include
+#include
+#include
+
+#ifdef _WIN32
+
+/* Windows needs warnx(). We change the definition though:
+ * 1. (another) global is defined, opterrmsg, which holds the error message
+ * 2. errors are always printed out on stderr w/o the program name
+ * Note that opterrmsg always gets set no matter what opterr is set to. The
+ * error message will not be printed if opterr is 0 as usual.
+ */
+
+#include
+#include
+#include
+
+char opterrmsg[128]; /* last error message is stored here */
+
+static void warnx(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ if (fmt != NULL)
+ _vsnprintf(opterrmsg, 128, fmt, ap);
+ else
+ opterrmsg[0]='\0';
+ va_end(ap);
+ fprintf(stderr, opterrmsg);
+ fprintf(stderr, "\n");
+}
+
+#endif /*_WIN32*/
+
+#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
+
+#ifdef REPLACE_GETOPT
+int opterr = 1; /* if error message should be printed */
+int optind = 1; /* index into parent argv vector */
+int optopt = '?'; /* character checked for validity */
+int optreset; /* reset getopt */
+char *optarg; /* argument associated with option */
+#endif
+
+#define PRINT_ERROR ((opterr) && (*options != ':'))
+
+#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */
+#define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */
+#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */
+
+/* return values */
+#define BADCH (int)'?'
+#define BADARG ((*options == ':') ? (int)':' : (int)'?')
+#define INORDER (int)1
+
+#define EMSG ""
+
+static int getopt_internal(int, char * const *, const char *,
+ const struct option *, int *, int);
+static int parse_long_options(char * const *, const char *,
+ const struct option *, int *, int);
+static int gcd(int, int);
+static void permute_args(int, int, int, char * const *);
+
+static char *place = EMSG; /* option letter processing */
+
+/* XXX: set optreset to 1 rather than these two */
+static int nonopt_start = -1; /* first non option argument (for permute) */
+static int nonopt_end = -1; /* first option after non options (for permute) */
+
+/* Error messages */
+static const char recargchar[] = "option requires an argument -- %c";
+static const char recargstring[] = "option requires an argument -- %s";
+static const char ambig[] = "ambiguous option -- %.*s";
+static const char noarg[] = "option doesn't take an argument -- %.*s";
+static const char illoptchar[] = "unknown option -- %c";
+static const char illoptstring[] = "unknown option -- %s";
+
+/*
+ * Compute the greatest common divisor of a and b.
+ */
+static int
+gcd(int a, int b)
+{
+ int c;
+
+ c = a % b;
+ while (c != 0) {
+ a = b;
+ b = c;
+ c = a % b;
+ }
+
+ return (b);
+}
+
+/*
+ * Exchange the block from nonopt_start to nonopt_end with the block
+ * from nonopt_end to opt_end (keeping the same order of arguments
+ * in each block).
+ */
+static void
+permute_args(int panonopt_start, int panonopt_end, int opt_end,
+ char * const *nargv)
+{
+ int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
+ char *swap;
+
+ /*
+ * compute lengths of blocks and number and size of cycles
+ */
+ nnonopts = panonopt_end - panonopt_start;
+ nopts = opt_end - panonopt_end;
+ ncycle = gcd(nnonopts, nopts);
+ cyclelen = (opt_end - panonopt_start) / ncycle;
+
+ for (i = 0; i < ncycle; i++) {
+ cstart = panonopt_end+i;
+ pos = cstart;
+ for (j = 0; j < cyclelen; j++) {
+ if (pos >= panonopt_end)
+ pos -= nnonopts;
+ else
+ pos += nopts;
+ swap = nargv[pos];
+ /* LINTED const cast */
+ ((char **) nargv)[pos] = nargv[cstart];
+ /* LINTED const cast */
+ ((char **)nargv)[cstart] = swap;
+ }
+ }
+}
+
+/*
+ * parse_long_options --
+ * Parse long options in argc/argv argument vector.
+ * Returns -1 if short_too is set and the option does not match long_options.
+ */
+static int
+parse_long_options(char * const *nargv, const char *options,
+ const struct option *long_options, int *idx, int short_too)
+{
+ char *current_argv, *has_equal;
+ size_t current_argv_len;
+ int i, match;
+
+ current_argv = place;
+ match = -1;
+
+ optind++;
+
+ if ((has_equal = strchr(current_argv, '=')) != NULL) {
+ /* argument found (--option=arg) */
+ current_argv_len = has_equal - current_argv;
+ has_equal++;
+ } else
+ current_argv_len = strlen(current_argv);
+
+ for (i = 0; long_options[i].name; i++) {
+ /* find matching long option */
+ if (strncmp(current_argv, long_options[i].name,
+ current_argv_len))
+ continue;
+
+ if (strlen(long_options[i].name) == current_argv_len) {
+ /* exact match */
+ match = i;
+ break;
+ }
+ /*
+ * If this is a known short option, don't allow
+ * a partial match of a single character.
+ */
+ if (short_too && current_argv_len == 1)
+ continue;
+
+ if (match == -1) /* partial match */
+ match = i;
+ else {
+ /* ambiguous abbreviation */
+ if (PRINT_ERROR)
+ warnx(ambig, (int)current_argv_len,
+ current_argv);
+ optopt = 0;
+ return (BADCH);
+ }
+ }
+ if (match != -1) { /* option found */
+ if (long_options[match].has_arg == no_argument
+ && has_equal) {
+ if (PRINT_ERROR)
+ warnx(noarg, (int)current_argv_len,
+ current_argv);
+ /*
+ * XXX: GNU sets optopt to val regardless of flag
+ */
+ if (long_options[match].flag == NULL)
+ optopt = long_options[match].val;
+ else
+ optopt = 0;
+ return (BADARG);
+ }
+ if (long_options[match].has_arg == required_argument ||
+ long_options[match].has_arg == optional_argument) {
+ if (has_equal)
+ optarg = has_equal;
+ else if (long_options[match].has_arg ==
+ required_argument) {
+ /*
+ * optional argument doesn't use next nargv
+ */
+ optarg = nargv[optind++];
+ }
+ }
+ if ((long_options[match].has_arg == required_argument)
+ && (optarg == NULL)) {
+ /*
+ * Missing argument; leading ':' indicates no error
+ * should be generated.
+ */
+ if (PRINT_ERROR)
+ warnx(recargstring,
+ current_argv);
+ /*
+ * XXX: GNU sets optopt to val regardless of flag
+ */
+ if (long_options[match].flag == NULL)
+ optopt = long_options[match].val;
+ else
+ optopt = 0;
+ --optind;
+ return (BADARG);
+ }
+ } else { /* unknown option */
+ if (short_too) {
+ --optind;
+ return (-1);
+ }
+ if (PRINT_ERROR)
+ warnx(illoptstring, current_argv);
+ optopt = 0;
+ return (BADCH);
+ }
+ if (idx)
+ *idx = match;
+ if (long_options[match].flag) {
+ *long_options[match].flag = long_options[match].val;
+ return (0);
+ } else
+ return (long_options[match].val);
+}
+
+/*
+ * getopt_internal --
+ * Parse argc/argv argument vector. Called by user level routines.
+ */
+static int
+getopt_internal(int nargc, char * const *nargv, const char *options,
+ const struct option *long_options, int *idx, int flags)
+{
+ char *oli; /* option letter list index */
+ int optchar, short_too;
+ static int posixly_correct = -1;
+
+ if (options == NULL)
+ return (-1);
+
+ /*
+ * Disable GNU extensions if POSIXLY_CORRECT is set or options
+ * string begins with a '+'.
+ */
+ if (posixly_correct == -1)
+ posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
+ if (posixly_correct || *options == '+')
+ flags &= ~FLAG_PERMUTE;
+ else if (*options == '-')
+ flags |= FLAG_ALLARGS;
+ if (*options == '+' || *options == '-')
+ options++;
+
+ /*
+ * XXX Some GNU programs (like cvs) set optind to 0 instead of
+ * XXX using optreset. Work around this braindamage.
+ */
+ if (optind == 0)
+ optind = optreset = 1;
+
+ optarg = NULL;
+ if (optreset)
+ nonopt_start = nonopt_end = -1;
+start:
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc) { /* end of argument vector */
+ place = EMSG;
+ if (nonopt_end != -1) {
+ /* do permutation, if we have to */
+ permute_args(nonopt_start, nonopt_end,
+ optind, nargv);
+ optind -= nonopt_end - nonopt_start;
+ }
+ else if (nonopt_start != -1) {
+ /*
+ * If we skipped non-options, set optind
+ * to the first of them.
+ */
+ optind = nonopt_start;
+ }
+ nonopt_start = nonopt_end = -1;
+ return (-1);
+ }
+ if (*(place = nargv[optind]) != '-' ||
+ (place[1] == '\0' && strchr(options, '-') == NULL)) {
+ place = EMSG; /* found non-option */
+ if (flags & FLAG_ALLARGS) {
+ /*
+ * GNU extension:
+ * return non-option as argument to option 1
+ */
+ optarg = nargv[optind++];
+ return (INORDER);
+ }
+ if (!(flags & FLAG_PERMUTE)) {
+ /*
+ * If no permutation wanted, stop parsing
+ * at first non-option.
+ */
+ return (-1);
+ }
+ /* do permutation */
+ if (nonopt_start == -1)
+ nonopt_start = optind;
+ else if (nonopt_end != -1) {
+ permute_args(nonopt_start, nonopt_end,
+ optind, nargv);
+ nonopt_start = optind -
+ (nonopt_end - nonopt_start);
+ nonopt_end = -1;
+ }
+ optind++;
+ /* process next argument */
+ goto start;
+ }
+ if (nonopt_start != -1 && nonopt_end == -1)
+ nonopt_end = optind;
+
+ /*
+ * If we have "-" do nothing, if "--" we are done.
+ */
+ if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
+ optind++;
+ place = EMSG;
+ /*
+ * We found an option (--), so if we skipped
+ * non-options, we have to permute.
+ */
+ if (nonopt_end != -1) {
+ permute_args(nonopt_start, nonopt_end,
+ optind, nargv);
+ optind -= nonopt_end - nonopt_start;
+ }
+ nonopt_start = nonopt_end = -1;
+ return (-1);
+ }
+ }
+
+ /*
+ * Check long options if:
+ * 1) we were passed some
+ * 2) the arg is not just "-"
+ * 3) either the arg starts with -- we are getopt_long_only()
+ */
+ if (long_options != NULL && place != nargv[optind] &&
+ (*place == '-' || (flags & FLAG_LONGONLY))) {
+ short_too = 0;
+ if (*place == '-')
+ place++; /* --foo long option */
+ else if (*place != ':' && strchr(options, *place) != NULL)
+ short_too = 1; /* could be short option too */
+
+ optchar = parse_long_options(nargv, options, long_options,
+ idx, short_too);
+ if (optchar != -1) {
+ place = EMSG;
+ return (optchar);
+ }
+ }
+
+ if ((optchar = (int)*place++) == (int)':' ||
+ (optchar == (int)'-' && *place != '\0') ||
+ (oli = strchr(options, optchar)) == NULL) {
+ /*
+ * If the user specified "-" and '-' isn't listed in
+ * options, return -1 (non-option) as per POSIX.
+ * Otherwise, it is an unknown option character (or ':').
+ */
+ if (optchar == (int)'-' && *place == '\0')
+ return (-1);
+ if (!*place)
+ ++optind;
+ if (PRINT_ERROR)
+ warnx(illoptchar, optchar);
+ optopt = optchar;
+ return (BADCH);
+ }
+ if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
+ /* -W long-option */
+ if (*place) /* no space */
+ /* NOTHING */;
+ else if (++optind >= nargc) { /* no arg */
+ place = EMSG;
+ if (PRINT_ERROR)
+ warnx(recargchar, optchar);
+ optopt = optchar;
+ return (BADARG);
+ } else /* white space */
+ place = nargv[optind];
+ optchar = parse_long_options(nargv, options, long_options,
+ idx, 0);
+ place = EMSG;
+ return (optchar);
+ }
+ if (*++oli != ':') { /* doesn't take argument */
+ if (!*place)
+ ++optind;
+ } else { /* takes (optional) argument */
+ optarg = NULL;
+ if (*place) /* no white space */
+ optarg = place;
+ else if (oli[1] != ':') { /* arg not optional */
+ if (++optind >= nargc) { /* no arg */
+ place = EMSG;
+ if (PRINT_ERROR)
+ warnx(recargchar, optchar);
+ optopt = optchar;
+ return (BADARG);
+ } else
+ optarg = nargv[optind];
+ }
+ place = EMSG;
+ ++optind;
+ }
+ /* dump back option letter */
+ return (optchar);
+}
+
+#ifdef REPLACE_GETOPT
+/*
+ * getopt --
+ * Parse argc/argv argument vector.
+ *
+ * [eventually this will replace the BSD getopt]
+ */
+int
+getopt(int nargc, char * const *nargv, const char *options)
+{
+
+ /*
+ * We don't pass FLAG_PERMUTE to getopt_internal() since
+ * the BSD getopt(3) (unlike GNU) has never done this.
+ *
+ * Furthermore, since many privileged programs call getopt()
+ * before dropping privileges it makes sense to keep things
+ * as simple (and bug-free) as possible.
+ */
+ return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
+}
+#endif /* REPLACE_GETOPT */
+
+/*
+ * getopt_long --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt_long(int nargc, char * const *nargv, const char *options,
+ const struct option *long_options, int *idx)
+{
+
+ return (getopt_internal(nargc, nargv, options, long_options, idx,
+ FLAG_PERMUTE));
+}
+
+/*
+ * getopt_long_only --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt_long_only(int nargc, char * const *nargv, const char *options,
+ const struct option *long_options, int *idx)
+{
+
+ return (getopt_internal(nargc, nargv, options, long_options, idx,
+ FLAG_PERMUTE|FLAG_LONGONLY));
+}
diff --git a/compat/gettimeofday.c b/compat/gettimeofday.c
new file mode 100644
index 0000000000..da17893d0f
--- /dev/null
+++ b/compat/gettimeofday.c
@@ -0,0 +1,83 @@
+#include < time.h >
+#include //I've ommited this line.
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
+#else
+ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
+#endif
+
+struct timezone
+{
+ int tz_minuteswest; /* minutes W of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+ FILETIME ft;
+ unsigned __int64 tmpres = 0;
+ static int tzflag;
+
+ if (NULL != tv)
+ {
+ GetSystemTimeAsFileTime(&ft);
+
+ tmpres |= ft.dwHighDateTime;
+ tmpres <<= 32;
+ tmpres |= ft.dwLowDateTime;
+
+ /*converting file time to unix epoch*/
+ tmpres /= 10; /*convert into microseconds*/
+ tmpres -= DELTA_EPOCH_IN_MICROSECS;
+ tv->tv_sec = (long)(tmpres / 1000000UL);
+ tv->tv_usec = (long)(tmpres % 1000000UL);
+ }
+
+ if (NULL != tz)
+ {
+ if (!tzflag)
+ {
+ _tzset();
+ tzflag++;
+ }
+ tz->tz_minuteswest = _timezone / 60;
+ tz->tz_dsttime = _daylight;
+ }
+
+ return 0;
+}
+
+void usleep(__int64 waitTime)
+{
+ if (waitTime > 0)
+ {
+ if (waitTime > 100)
+ {
+ // use a waitable timer for larger intervals > 0.1ms
+
+ HANDLE timer;
+ LARGE_INTEGER ft;
+
+ ft.QuadPart = -(10*waitTime); // Convert to 100 nanosecond interval, negative value indicates relative time
+
+ timer = CreateWaitableTimer(NULL, TRUE, NULL);
+ SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
+ WaitForSingleObject(timer, INFINITE);
+ CloseHandle(timer);
+ }
+ else
+ {
+ // use a polling loop for short intervals <= 100ms
+
+ LARGE_INTEGER perfCnt, start, now;
+ __int64 elapsed;
+
+ QueryPerformanceFrequency(&perfCnt);
+ QueryPerformanceCounter(&start);
+ do {
+ QueryPerformanceCounter((LARGE_INTEGER*) &now);
+ elapsed = (__int64)((now.QuadPart - start.QuadPart) / (float)perfCnt.QuadPart * 1000 * 1000);
+ } while ( elapsed < waitTime );
+ }
+ }
+}
diff --git a/compat/inttypes.h b/compat/inttypes.h
new file mode 100644
index 0000000000..f07d50f391
--- /dev/null
+++ b/compat/inttypes.h
@@ -0,0 +1,2 @@
+#pragma once
+#include
diff --git a/compat/jansson/Makefile.am b/compat/jansson/Makefile.am
new file mode 100644
index 0000000000..ff38e51653
--- /dev/null
+++ b/compat/jansson/Makefile.am
@@ -0,0 +1,18 @@
+
+noinst_LIBRARIES = libjansson.a
+
+libjansson_a_SOURCES = \
+ config.h \
+ dump.c \
+ hashtable.c \
+ hashtable.h \
+ jansson.h \
+ jansson_private.h \
+ load.c \
+ strbuffer.c \
+ strbuffer.h \
+ utf.c \
+ utf.h \
+ util.h \
+ value.c
+
diff --git a/compat/jansson/Makefile.in b/compat/jansson/Makefile.in
new file mode 100644
index 0000000000..f5e30acea8
--- /dev/null
+++ b/compat/jansson/Makefile.in
@@ -0,0 +1,571 @@
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = compat/jansson
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/cpuminer-config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+AM_V_AR = $(am__v_AR_@AM_V@)
+am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
+am__v_AR_0 = @echo " AR " $@;
+am__v_AR_1 =
+libjansson_a_AR = $(AR) $(ARFLAGS)
+libjansson_a_LIBADD =
+am_libjansson_a_OBJECTS = dump.$(OBJEXT) hashtable.$(OBJEXT) \
+ load.$(OBJEXT) strbuffer.$(OBJEXT) utf.$(OBJEXT) \
+ value.$(OBJEXT)
+libjansson_a_OBJECTS = $(am_libjansson_a_OBJECTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(libjansson_a_SOURCES)
+DIST_SOURCES = $(libjansson_a_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CUDA_CFLAGS = @CUDA_CFLAGS@
+CUDA_LDFLAGS = @CUDA_LDFLAGS@
+CUDA_LIBS = @CUDA_LIBS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JANSSON_LIBS = @JANSSON_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBCURL = @LIBCURL@
+LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NVCC = @NVCC@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_FLAGS = @PTHREAD_FLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WS2_LIBS = @WS2_LIBS@
+_libcurl_config = @_libcurl_config@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libjansson.a
+libjansson_a_SOURCES = \
+ config.h \
+ dump.c \
+ hashtable.c \
+ hashtable.h \
+ jansson.h \
+ jansson_private.h \
+ load.c \
+ strbuffer.c \
+ strbuffer.h \
+ utf.c \
+ utf.h \
+ util.h \
+ value.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu compat/jansson/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu compat/jansson/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+libjansson.a: $(libjansson_a_OBJECTS) $(libjansson_a_DEPENDENCIES) $(EXTRA_libjansson_a_DEPENDENCIES)
+ $(AM_V_at)-rm -f libjansson.a
+ $(AM_V_AR)$(libjansson_a_AR) libjansson.a $(libjansson_a_OBJECTS) $(libjansson_a_LIBADD)
+ $(AM_V_at)$(RANLIB) libjansson.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashtable.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strbuffer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/value.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/compat/jansson/config.h b/compat/jansson/config.h
new file mode 100644
index 0000000000..f11075a3c5
--- /dev/null
+++ b/compat/jansson/config.h
@@ -0,0 +1,73 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "jansson"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "petri@digip.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "jansson"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "jansson 1.3"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "jansson"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.3"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.3"
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef int32_t */
diff --git a/compat/jansson/dump.c b/compat/jansson/dump.c
new file mode 100644
index 0000000000..a8c9cc646a
--- /dev/null
+++ b/compat/jansson/dump.c
@@ -0,0 +1,460 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+
+#include
+#include "jansson_private.h"
+#include "strbuffer.h"
+#include "utf.h"
+
+#define MAX_INTEGER_STR_LENGTH 100
+#define MAX_REAL_STR_LENGTH 100
+
+typedef int (*dump_func)(const char *buffer, int size, void *data);
+
+struct string
+{
+ char *buffer;
+ int length;
+ int size;
+};
+
+static int dump_to_strbuffer(const char *buffer, int size, void *data)
+{
+ return strbuffer_append_bytes((strbuffer_t *)data, buffer, size);
+}
+
+static int dump_to_file(const char *buffer, int size, void *data)
+{
+ FILE *dest = (FILE *)data;
+ if(fwrite(buffer, size, 1, dest) != 1)
+ return -1;
+ return 0;
+}
+
+/* 256 spaces (the maximum indentation size) */
+static char whitespace[] = " ";
+
+static int dump_indent(unsigned long flags, int depth, int space, dump_func dump, void *data)
+{
+ if(JSON_INDENT(flags) > 0)
+ {
+ int i, ws_count = JSON_INDENT(flags);
+
+ if(dump("\n", 1, data))
+ return -1;
+
+ for(i = 0; i < depth; i++)
+ {
+ if(dump(whitespace, ws_count, data))
+ return -1;
+ }
+ }
+ else if(space && !(flags & JSON_COMPACT))
+ {
+ return dump(" ", 1, data);
+ }
+ return 0;
+}
+
+static int dump_string(const char *str, int ascii, dump_func dump, void *data)
+{
+ const char *pos, *end;
+ int32_t codepoint;
+
+ if(dump("\"", 1, data))
+ return -1;
+
+ end = pos = str;
+ while(1)
+ {
+ const char *text;
+ char seq[13];
+ int length;
+
+ while(*end)
+ {
+ end = utf8_iterate(pos, &codepoint);
+ if(!end)
+ return -1;
+
+ /* mandatory escape or control char */
+ if(codepoint == '\\' || codepoint == '"' || codepoint < 0x20)
+ break;
+
+ /* non-ASCII */
+ if(ascii && codepoint > 0x7F)
+ break;
+
+ pos = end;
+ }
+
+ if(pos != str) {
+ if(dump(str, pos - str, data))
+ return -1;
+ }
+
+ if(end == pos)
+ break;
+
+ /* handle \, ", and control codes */
+ length = 2;
+ switch(codepoint)
+ {
+ case '\\': text = "\\\\"; break;
+ case '\"': text = "\\\""; break;
+ case '\b': text = "\\b"; break;
+ case '\f': text = "\\f"; break;
+ case '\n': text = "\\n"; break;
+ case '\r': text = "\\r"; break;
+ case '\t': text = "\\t"; break;
+ default:
+ {
+ /* codepoint is in BMP */
+ if(codepoint < 0x10000)
+ {
+ sprintf(seq, "\\u%04x", codepoint);
+ length = 6;
+ }
+
+ /* not in BMP -> construct a UTF-16 surrogate pair */
+ else
+ {
+ int32_t first, last;
+
+ codepoint -= 0x10000;
+ first = 0xD800 | ((codepoint & 0xffc00) >> 10);
+ last = 0xDC00 | (codepoint & 0x003ff);
+
+ sprintf(seq, "\\u%04x\\u%04x", first, last);
+ length = 12;
+ }
+
+ text = seq;
+ break;
+ }
+ }
+
+ if(dump(text, length, data))
+ return -1;
+
+ str = pos = end;
+ }
+
+ return dump("\"", 1, data);
+}
+
+static int object_key_compare_keys(const void *key1, const void *key2)
+{
+ return strcmp((*(const object_key_t **)key1)->key,
+ (*(const object_key_t **)key2)->key);
+}
+
+static int object_key_compare_serials(const void *key1, const void *key2)
+{
+ return (*(const object_key_t **)key1)->serial -
+ (*(const object_key_t **)key2)->serial;
+}
+
+static int do_dump(const json_t *json, unsigned long flags, int depth,
+ dump_func dump, void *data)
+{
+ int ascii = flags & JSON_ENSURE_ASCII ? 1 : 0;
+
+ switch(json_typeof(json)) {
+ case JSON_NULL:
+ return dump("null", 4, data);
+
+ case JSON_TRUE:
+ return dump("true", 4, data);
+
+ case JSON_FALSE:
+ return dump("false", 5, data);
+
+ case JSON_INTEGER:
+ {
+ char buffer[MAX_INTEGER_STR_LENGTH];
+ int size;
+
+ size = snprintf(buffer, MAX_INTEGER_STR_LENGTH, "%d", json_integer_value(json));
+ if(size >= MAX_INTEGER_STR_LENGTH)
+ return -1;
+
+ return dump(buffer, size, data);
+ }
+
+ case JSON_REAL:
+ {
+ char buffer[MAX_REAL_STR_LENGTH];
+ int size;
+
+ size = snprintf(buffer, MAX_REAL_STR_LENGTH, "%.17g",
+ json_real_value(json));
+ if(size >= MAX_REAL_STR_LENGTH)
+ return -1;
+
+ /* Make sure there's a dot or 'e' in the output. Otherwise
+ a real is converted to an integer when decoding */
+ if(strchr(buffer, '.') == NULL &&
+ strchr(buffer, 'e') == NULL)
+ {
+ if(size + 2 >= MAX_REAL_STR_LENGTH) {
+ /* No space to append ".0" */
+ return -1;
+ }
+ buffer[size] = '.';
+ buffer[size + 1] = '0';
+ size += 2;
+ }
+
+ return dump(buffer, size, data);
+ }
+
+ case JSON_STRING:
+ return dump_string(json_string_value(json), ascii, dump, data);
+
+ case JSON_ARRAY:
+ {
+ int i;
+ int n;
+ json_array_t *array;
+
+ /* detect circular references */
+ array = json_to_array(json);
+ if(array->visited)
+ goto array_error;
+ array->visited = 1;
+
+ n = json_array_size(json);
+
+ if(dump("[", 1, data))
+ goto array_error;
+ if(n == 0) {
+ array->visited = 0;
+ return dump("]", 1, data);
+ }
+ if(dump_indent(flags, depth + 1, 0, dump, data))
+ goto array_error;
+
+ for(i = 0; i < n; ++i) {
+ if(do_dump(json_array_get(json, i), flags, depth + 1,
+ dump, data))
+ goto array_error;
+
+ if(i < n - 1)
+ {
+ if(dump(",", 1, data) ||
+ dump_indent(flags, depth + 1, 1, dump, data))
+ goto array_error;
+ }
+ else
+ {
+ if(dump_indent(flags, depth, 0, dump, data))
+ goto array_error;
+ }
+ }
+
+ array->visited = 0;
+ return dump("]", 1, data);
+
+ array_error:
+ array->visited = 0;
+ return -1;
+ }
+
+ case JSON_OBJECT:
+ {
+ json_object_t *object;
+ void *iter;
+ const char *separator;
+ int separator_length;
+
+ if(flags & JSON_COMPACT) {
+ separator = ":";
+ separator_length = 1;
+ }
+ else {
+ separator = ": ";
+ separator_length = 2;
+ }
+
+ /* detect circular references */
+ object = json_to_object(json);
+ if(object->visited)
+ goto object_error;
+ object->visited = 1;
+
+ iter = json_object_iter((json_t *)json);
+
+ if(dump("{", 1, data))
+ goto object_error;
+ if(!iter) {
+ object->visited = 0;
+ return dump("}", 1, data);
+ }
+ if(dump_indent(flags, depth + 1, 0, dump, data))
+ goto object_error;
+
+ if(flags & JSON_SORT_KEYS || flags & JSON_PRESERVE_ORDER)
+ {
+ const object_key_t **keys;
+ unsigned int size;
+ unsigned int i;
+ int (*cmp_func)(const void *, const void *);
+
+ size = json_object_size(json);
+ keys = malloc(size * sizeof(object_key_t *));
+ if(!keys)
+ goto object_error;
+
+ i = 0;
+ while(iter)
+ {
+ keys[i] = jsonp_object_iter_fullkey(iter);
+ iter = json_object_iter_next((json_t *)json, iter);
+ i++;
+ }
+ assert(i == size);
+
+ if(flags & JSON_SORT_KEYS)
+ cmp_func = object_key_compare_keys;
+ else
+ cmp_func = object_key_compare_serials;
+
+ qsort((void*)keys, size, sizeof(object_key_t *), cmp_func);
+
+ for(i = 0; i < size; i++)
+ {
+ const char *key;
+ json_t *value;
+
+ key = keys[i]->key;
+ value = json_object_get(json, key);
+ assert(value);
+
+ dump_string(key, ascii, dump, data);
+ if(dump(separator, separator_length, data) ||
+ do_dump(value, flags, depth + 1, dump, data))
+ {
+ free((void*)keys);
+ goto object_error;
+ }
+
+ if(i < size - 1)
+ {
+ if(dump(",", 1, data) ||
+ dump_indent(flags, depth + 1, 1, dump, data))
+ {
+ free((void*)keys);
+ goto object_error;
+ }
+ }
+ else
+ {
+ if(dump_indent(flags, depth, 0, dump, data))
+ {
+ free((void*)keys);
+ goto object_error;
+ }
+ }
+ }
+
+ free((void*)keys);
+ }
+ else
+ {
+ /* Don't sort keys */
+
+ while(iter)
+ {
+ void *next = json_object_iter_next((json_t *)json, iter);
+
+ dump_string(json_object_iter_key(iter), ascii, dump, data);
+ if(dump(separator, separator_length, data) ||
+ do_dump(json_object_iter_value(iter), flags, depth + 1,
+ dump, data))
+ goto object_error;
+
+ if(next)
+ {
+ if(dump(",", 1, data) ||
+ dump_indent(flags, depth + 1, 1, dump, data))
+ goto object_error;
+ }
+ else
+ {
+ if(dump_indent(flags, depth, 0, dump, data))
+ goto object_error;
+ }
+
+ iter = next;
+ }
+ }
+
+ object->visited = 0;
+ return dump("}", 1, data);
+
+ object_error:
+ object->visited = 0;
+ return -1;
+ }
+
+ default:
+ /* not reached */
+ return -1;
+ }
+}
+
+
+char *json_dumps(const json_t *json, unsigned long flags)
+{
+ strbuffer_t strbuff;
+ char *result;
+
+ if(!json_is_array(json) && !json_is_object(json))
+ return NULL;
+
+ if(strbuffer_init(&strbuff))
+ return NULL;
+
+ if(do_dump(json, flags, 0, dump_to_strbuffer, (void *)&strbuff)) {
+ strbuffer_close(&strbuff);
+ return NULL;
+ }
+
+ result = strdup(strbuffer_value(&strbuff));
+ strbuffer_close(&strbuff);
+
+ return result;
+}
+
+int json_dumpf(const json_t *json, FILE *output, unsigned long flags)
+{
+ if(!json_is_array(json) && !json_is_object(json))
+ return -1;
+
+ return do_dump(json, flags, 0, dump_to_file, (void *)output);
+}
+
+int json_dump_file(const json_t *json, const char *path, unsigned long flags)
+{
+ int result;
+
+ FILE *output = fopen(path, "w");
+ if(!output)
+ return -1;
+
+ result = json_dumpf(json, output, flags);
+
+ fclose(output);
+ return result;
+}
diff --git a/compat/jansson/hashtable.c b/compat/jansson/hashtable.c
new file mode 100644
index 0000000000..791f9acbe2
--- /dev/null
+++ b/compat/jansson/hashtable.c
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#include
+
+#include
+#include "hashtable.h"
+
+#ifdef WIN32
+#define inline __inline
+#endif
+
+typedef struct hashtable_list list_t;
+typedef struct hashtable_pair pair_t;
+typedef struct hashtable_bucket bucket_t;
+
+#define container_of(ptr_, type_, member_) \
+ ((type_ *)((char *)ptr_ - (size_t)&((type_ *)0)->member_))
+
+#define list_to_pair(list_) container_of(list_, pair_t, list)
+
+static inline void list_init(list_t *list)
+{
+ list->next = list;
+ list->prev = list;
+}
+
+static inline void list_insert(list_t *list, list_t *node)
+{
+ node->next = list;
+ node->prev = list->prev;
+ list->prev->next = node;
+ list->prev = node;
+}
+
+static inline void list_remove(list_t *list)
+{
+ list->prev->next = list->next;
+ list->next->prev = list->prev;
+}
+
+static inline int bucket_is_empty(hashtable_t *hashtable, bucket_t *bucket)
+{
+ return bucket->first == &hashtable->list && bucket->first == bucket->last;
+}
+
+static void insert_to_bucket(hashtable_t *hashtable, bucket_t *bucket,
+ list_t *list)
+{
+ if(bucket_is_empty(hashtable, bucket))
+ {
+ list_insert(&hashtable->list, list);
+ bucket->first = bucket->last = list;
+ }
+ else
+ {
+ list_insert(bucket->first, list);
+ bucket->first = list;
+ }
+}
+
+static unsigned int primes[] = {
+ 5, 13, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593,
+ 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469,
+ 12582917, 25165843, 50331653, 100663319, 201326611, 402653189,
+ 805306457, 1610612741
+};
+static const unsigned int num_primes = sizeof(primes) / sizeof(unsigned int);
+
+static inline unsigned int num_buckets(hashtable_t *hashtable)
+{
+ return primes[hashtable->num_buckets];
+}
+
+
+static pair_t *hashtable_find_pair(hashtable_t *hashtable, bucket_t *bucket,
+ const void *key, unsigned int hash)
+{
+ list_t *list;
+ pair_t *pair;
+
+ if(bucket_is_empty(hashtable, bucket))
+ return NULL;
+
+ list = bucket->first;
+ while(1)
+ {
+ pair = list_to_pair(list);
+ if(pair->hash == hash && hashtable->cmp_keys(pair->key, key))
+ return pair;
+
+ if(list == bucket->last)
+ break;
+
+ list = list->next;
+ }
+
+ return NULL;
+}
+
+/* returns 0 on success, -1 if key was not found */
+static int hashtable_do_del(hashtable_t *hashtable,
+ const void *key, unsigned int hash)
+{
+ pair_t *pair;
+ bucket_t *bucket;
+ unsigned int index;
+
+ index = hash % num_buckets(hashtable);
+ bucket = &hashtable->buckets[index];
+
+ pair = hashtable_find_pair(hashtable, bucket, key, hash);
+ if(!pair)
+ return -1;
+
+ if(&pair->list == bucket->first && &pair->list == bucket->last)
+ bucket->first = bucket->last = &hashtable->list;
+
+ else if(&pair->list == bucket->first)
+ bucket->first = pair->list.next;
+
+ else if(&pair->list == bucket->last)
+ bucket->last = pair->list.prev;
+
+ list_remove(&pair->list);
+
+ if(hashtable->free_key)
+ hashtable->free_key(pair->key);
+ if(hashtable->free_value)
+ hashtable->free_value(pair->value);
+
+ free(pair);
+ hashtable->size--;
+
+ return 0;
+}
+
+static void hashtable_do_clear(hashtable_t *hashtable)
+{
+ list_t *list, *next;
+ pair_t *pair;
+
+ for(list = hashtable->list.next; list != &hashtable->list; list = next)
+ {
+ next = list->next;
+ pair = list_to_pair(list);
+ if(hashtable->free_key)
+ hashtable->free_key(pair->key);
+ if(hashtable->free_value)
+ hashtable->free_value(pair->value);
+ free(pair);
+ }
+}
+
+static int hashtable_do_rehash(hashtable_t *hashtable)
+{
+ list_t *list, *next;
+ pair_t *pair;
+ unsigned int i, index, new_size;
+
+ free(hashtable->buckets);
+
+ hashtable->num_buckets++;
+ new_size = num_buckets(hashtable);
+
+ hashtable->buckets = malloc(new_size * sizeof(bucket_t));
+ if(!hashtable->buckets)
+ return -1;
+
+ for(i = 0; i < num_buckets(hashtable); i++)
+ {
+ hashtable->buckets[i].first = hashtable->buckets[i].last =
+ &hashtable->list;
+ }
+
+ list = hashtable->list.next;
+ list_init(&hashtable->list);
+
+ for(; list != &hashtable->list; list = next) {
+ next = list->next;
+ pair = list_to_pair(list);
+ index = pair->hash % new_size;
+ insert_to_bucket(hashtable, &hashtable->buckets[index], &pair->list);
+ }
+
+ return 0;
+}
+
+
+hashtable_t *hashtable_create(key_hash_fn hash_key, key_cmp_fn cmp_keys,
+ free_fn free_key, free_fn free_value)
+{
+ hashtable_t *hashtable = malloc(sizeof(hashtable_t));
+ if(!hashtable)
+ return NULL;
+
+ if(hashtable_init(hashtable, hash_key, cmp_keys, free_key, free_value))
+ {
+ free(hashtable);
+ return NULL;
+ }
+
+ return hashtable;
+}
+
+void hashtable_destroy(hashtable_t *hashtable)
+{
+ hashtable_close(hashtable);
+ free(hashtable);
+}
+
+int hashtable_init(hashtable_t *hashtable,
+ key_hash_fn hash_key, key_cmp_fn cmp_keys,
+ free_fn free_key, free_fn free_value)
+{
+ unsigned int i;
+
+ hashtable->size = 0;
+ hashtable->num_buckets = 0; /* index to primes[] */
+ hashtable->buckets = malloc(num_buckets(hashtable) * sizeof(bucket_t));
+ if(!hashtable->buckets)
+ return -1;
+
+ list_init(&hashtable->list);
+
+ hashtable->hash_key = hash_key;
+ hashtable->cmp_keys = cmp_keys;
+ hashtable->free_key = free_key;
+ hashtable->free_value = free_value;
+
+ for(i = 0; i < num_buckets(hashtable); i++)
+ {
+ hashtable->buckets[i].first = hashtable->buckets[i].last =
+ &hashtable->list;
+ }
+
+ return 0;
+}
+
+void hashtable_close(hashtable_t *hashtable)
+{
+ hashtable_do_clear(hashtable);
+ free(hashtable->buckets);
+}
+
+int hashtable_set(hashtable_t *hashtable, void *key, void *value)
+{
+ pair_t *pair;
+ bucket_t *bucket;
+ unsigned int hash, index;
+
+ /* rehash if the load ratio exceeds 1 */
+ if(hashtable->size >= num_buckets(hashtable))
+ if(hashtable_do_rehash(hashtable))
+ return -1;
+
+ hash = hashtable->hash_key(key);
+ index = hash % num_buckets(hashtable);
+ bucket = &hashtable->buckets[index];
+ pair = hashtable_find_pair(hashtable, bucket, key, hash);
+
+ if(pair)
+ {
+ if(hashtable->free_key)
+ hashtable->free_key(key);
+ if(hashtable->free_value)
+ hashtable->free_value(pair->value);
+ pair->value = value;
+ }
+ else
+ {
+ pair = malloc(sizeof(pair_t));
+ if(!pair)
+ return -1;
+
+ pair->key = key;
+ pair->value = value;
+ pair->hash = hash;
+ list_init(&pair->list);
+
+ insert_to_bucket(hashtable, bucket, &pair->list);
+
+ hashtable->size++;
+ }
+ return 0;
+}
+
+void *hashtable_get(hashtable_t *hashtable, const void *key)
+{
+ pair_t *pair;
+ unsigned int hash;
+ bucket_t *bucket;
+
+ hash = hashtable->hash_key(key);
+ bucket = &hashtable->buckets[hash % num_buckets(hashtable)];
+
+ pair = hashtable_find_pair(hashtable, bucket, key, hash);
+ if(!pair)
+ return NULL;
+
+ return pair->value;
+}
+
+int hashtable_del(hashtable_t *hashtable, const void *key)
+{
+ unsigned int hash = hashtable->hash_key(key);
+ return hashtable_do_del(hashtable, key, hash);
+}
+
+void hashtable_clear(hashtable_t *hashtable)
+{
+ unsigned int i;
+
+ hashtable_do_clear(hashtable);
+
+ for(i = 0; i < num_buckets(hashtable); i++)
+ {
+ hashtable->buckets[i].first = hashtable->buckets[i].last =
+ &hashtable->list;
+ }
+
+ list_init(&hashtable->list);
+ hashtable->size = 0;
+}
+
+void *hashtable_iter(hashtable_t *hashtable)
+{
+ return hashtable_iter_next(hashtable, &hashtable->list);
+}
+
+void *hashtable_iter_at(hashtable_t *hashtable, const void *key)
+{
+ pair_t *pair;
+ unsigned int hash;
+ bucket_t *bucket;
+
+ hash = hashtable->hash_key(key);
+ bucket = &hashtable->buckets[hash % num_buckets(hashtable)];
+
+ pair = hashtable_find_pair(hashtable, bucket, key, hash);
+ if(!pair)
+ return NULL;
+
+ return &pair->list;
+}
+
+void *hashtable_iter_next(hashtable_t *hashtable, void *iter)
+{
+ list_t *list = (list_t *)iter;
+ if(list->next == &hashtable->list)
+ return NULL;
+ return list->next;
+}
+
+void *hashtable_iter_key(void *iter)
+{
+ pair_t *pair = list_to_pair((list_t *)iter);
+ return pair->key;
+}
+
+void *hashtable_iter_value(void *iter)
+{
+ pair_t *pair = list_to_pair((list_t *)iter);
+ return pair->value;
+}
+
+void hashtable_iter_set(hashtable_t *hashtable, void *iter, void *value)
+{
+ pair_t *pair = list_to_pair((list_t *)iter);
+
+ if(hashtable->free_value)
+ hashtable->free_value(pair->value);
+
+ pair->value = value;
+}
diff --git a/compat/jansson/hashtable.h b/compat/jansson/hashtable.h
new file mode 100644
index 0000000000..52f8549281
--- /dev/null
+++ b/compat/jansson/hashtable.h
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef HASHTABLE_H
+#define HASHTABLE_H
+
+typedef unsigned int (*key_hash_fn)(const void *key);
+typedef int (*key_cmp_fn)(const void *key1, const void *key2);
+typedef void (*free_fn)(void *key);
+
+struct hashtable_list {
+ struct hashtable_list *prev;
+ struct hashtable_list *next;
+};
+
+struct hashtable_pair {
+ void *key;
+ void *value;
+ unsigned int hash;
+ struct hashtable_list list;
+};
+
+struct hashtable_bucket {
+ struct hashtable_list *first;
+ struct hashtable_list *last;
+};
+
+typedef struct hashtable {
+ unsigned int size;
+ struct hashtable_bucket *buckets;
+ unsigned int num_buckets; /* index to primes[] */
+ struct hashtable_list list;
+
+ key_hash_fn hash_key;
+ key_cmp_fn cmp_keys; /* returns non-zero for equal keys */
+ free_fn free_key;
+ free_fn free_value;
+} hashtable_t;
+
+/**
+ * hashtable_create - Create a hashtable object
+ *
+ * @hash_key: The key hashing function
+ * @cmp_keys: The key compare function. Returns non-zero for equal and
+ * zero for unequal unequal keys
+ * @free_key: If non-NULL, called for a key that is no longer referenced.
+ * @free_value: If non-NULL, called for a value that is no longer referenced.
+ *
+ * Returns a new hashtable object that should be freed with
+ * hashtable_destroy when it's no longer used, or NULL on failure (out
+ * of memory).
+ */
+hashtable_t *hashtable_create(key_hash_fn hash_key, key_cmp_fn cmp_keys,
+ free_fn free_key, free_fn free_value);
+
+/**
+ * hashtable_destroy - Destroy a hashtable object
+ *
+ * @hashtable: The hashtable
+ *
+ * Destroys a hashtable created with hashtable_create().
+ */
+void hashtable_destroy(hashtable_t *hashtable);
+
+/**
+ * hashtable_init - Initialize a hashtable object
+ *
+ * @hashtable: The (statically allocated) hashtable object
+ * @hash_key: The key hashing function
+ * @cmp_keys: The key compare function. Returns non-zero for equal and
+ * zero for unequal unequal keys
+ * @free_key: If non-NULL, called for a key that is no longer referenced.
+ * @free_value: If non-NULL, called for a value that is no longer referenced.
+ *
+ * Initializes a statically allocated hashtable object. The object
+ * should be cleared with hashtable_close when it's no longer used.
+ *
+ * Returns 0 on success, -1 on error (out of memory).
+ */
+int hashtable_init(hashtable_t *hashtable,
+ key_hash_fn hash_key, key_cmp_fn cmp_keys,
+ free_fn free_key, free_fn free_value);
+
+/**
+ * hashtable_close - Release all resources used by a hashtable object
+ *
+ * @hashtable: The hashtable
+ *
+ * Destroys a statically allocated hashtable object.
+ */
+void hashtable_close(hashtable_t *hashtable);
+
+/**
+ * hashtable_set - Add/modify value in hashtable
+ *
+ * @hashtable: The hashtable object
+ * @key: The key
+ * @value: The value
+ *
+ * If a value with the given key already exists, its value is replaced
+ * with the new value.
+ *
+ * Key and value are "stealed" in the sense that hashtable frees them
+ * automatically when they are no longer used. The freeing is
+ * accomplished by calling free_key and free_value functions that were
+ * supplied to hashtable_new. In case one or both of the free
+ * functions is NULL, the corresponding item is not "stealed".
+ *
+ * Returns 0 on success, -1 on failure (out of memory).
+ */
+int hashtable_set(hashtable_t *hashtable, void *key, void *value);
+
+/**
+ * hashtable_get - Get a value associated with a key
+ *
+ * @hashtable: The hashtable object
+ * @key: The key
+ *
+ * Returns value if it is found, or NULL otherwise.
+ */
+void *hashtable_get(hashtable_t *hashtable, const void *key);
+
+/**
+ * hashtable_del - Remove a value from the hashtable
+ *
+ * @hashtable: The hashtable object
+ * @key: The key
+ *
+ * Returns 0 on success, or -1 if the key was not found.
+ */
+int hashtable_del(hashtable_t *hashtable, const void *key);
+
+/**
+ * hashtable_clear - Clear hashtable
+ *
+ * @hashtable: The hashtable object
+ *
+ * Removes all items from the hashtable.
+ */
+void hashtable_clear(hashtable_t *hashtable);
+
+/**
+ * hashtable_iter - Iterate over hashtable
+ *
+ * @hashtable: The hashtable object
+ *
+ * Returns an opaque iterator to the first element in the hashtable.
+ * The iterator should be passed to hashtable_iter_* functions.
+ * The hashtable items are not iterated over in any particular order.
+ *
+ * There's no need to free the iterator in any way. The iterator is
+ * valid as long as the item that is referenced by the iterator is not
+ * deleted. Other values may be added or deleted. In particular,
+ * hashtable_iter_next() may be called on an iterator, and after that
+ * the key/value pair pointed by the old iterator may be deleted.
+ */
+void *hashtable_iter(hashtable_t *hashtable);
+
+/**
+ * hashtable_iter_at - Return an iterator at a specific key
+ *
+ * @hashtable: The hashtable object
+ * @key: The key that the iterator should point to
+ *
+ * Like hashtable_iter() but returns an iterator pointing to a
+ * specific key.
+ */
+void *hashtable_iter_at(hashtable_t *hashtable, const void *key);
+
+/**
+ * hashtable_iter_next - Advance an iterator
+ *
+ * @hashtable: The hashtable object
+ * @iter: The iterator
+ *
+ * Returns a new iterator pointing to the next element in the
+ * hashtable or NULL if the whole hastable has been iterated over.
+ */
+void *hashtable_iter_next(hashtable_t *hashtable, void *iter);
+
+/**
+ * hashtable_iter_key - Retrieve the key pointed by an iterator
+ *
+ * @iter: The iterator
+ */
+void *hashtable_iter_key(void *iter);
+
+/**
+ * hashtable_iter_value - Retrieve the value pointed by an iterator
+ *
+ * @iter: The iterator
+ */
+void *hashtable_iter_value(void *iter);
+
+/**
+ * hashtable_iter_set - Set the value pointed by an iterator
+ *
+ * @iter: The iterator
+ * @value: The value to set
+ */
+void hashtable_iter_set(hashtable_t *hashtable, void *iter, void *value);
+
+#endif
diff --git a/compat/jansson/jansson.h b/compat/jansson/jansson.h
new file mode 100644
index 0000000000..781896ce9f
--- /dev/null
+++ b/compat/jansson/jansson.h
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef JANSSON_H
+#define JANSSON_H
+
+#include
+
+#ifdef WIN32
+#define snprintf(...) _snprintf(__VA_ARGS__)
+#define strdup(x) _strdup(x)
+#endif
+
+#ifdef WIN32
+#define inline __inline
+#endif
+
+#ifndef __cplusplus
+#define JSON_INLINE inline
+#else
+#define JSON_INLINE inline
+extern "C" {
+#endif
+
+/* types */
+
+typedef enum {
+ JSON_OBJECT,
+ JSON_ARRAY,
+ JSON_STRING,
+ JSON_INTEGER,
+ JSON_REAL,
+ JSON_TRUE,
+ JSON_FALSE,
+ JSON_NULL
+} json_type;
+
+typedef struct {
+ json_type type;
+ unsigned long refcount;
+} json_t;
+
+#define json_typeof(json) ((json)->type)
+#define json_is_object(json) (json && json_typeof(json) == JSON_OBJECT)
+#define json_is_array(json) (json && json_typeof(json) == JSON_ARRAY)
+#define json_is_string(json) (json && json_typeof(json) == JSON_STRING)
+#define json_is_integer(json) (json && json_typeof(json) == JSON_INTEGER)
+#define json_is_real(json) (json && json_typeof(json) == JSON_REAL)
+#define json_is_number(json) (json_is_integer(json) || json_is_real(json))
+#define json_is_true(json) (json && json_typeof(json) == JSON_TRUE)
+#define json_is_false(json) (json && json_typeof(json) == JSON_FALSE)
+#define json_is_boolean(json) (json_is_true(json) || json_is_false(json))
+#define json_is_null(json) (json && json_typeof(json) == JSON_NULL)
+
+/* construction, destruction, reference counting */
+
+json_t *json_object(void);
+json_t *json_array(void);
+json_t *json_string(const char *value);
+json_t *json_string_nocheck(const char *value);
+json_t *json_integer(int value);
+json_t *json_real(double value);
+json_t *json_true(void);
+json_t *json_false(void);
+json_t *json_null(void);
+
+static JSON_INLINE
+json_t *json_incref(json_t *json)
+{
+ if(json && json->refcount != (unsigned int)-1)
+ ++json->refcount;
+ return json;
+}
+
+/* do not call json_delete directly */
+void json_delete(json_t *json);
+
+static JSON_INLINE
+void json_decref(json_t *json)
+{
+ if(json && json->refcount != (unsigned int)-1 && --json->refcount == 0)
+ json_delete(json);
+}
+
+
+/* getters, setters, manipulation */
+
+unsigned int json_object_size(const json_t *object);
+json_t *json_object_get(const json_t *object, const char *key);
+int json_object_set_new(json_t *object, const char *key, json_t *value);
+int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value);
+int json_object_del(json_t *object, const char *key);
+int json_object_clear(json_t *object);
+int json_object_update(json_t *object, json_t *other);
+void *json_object_iter(json_t *object);
+void *json_object_iter_at(json_t *object, const char *key);
+void *json_object_iter_next(json_t *object, void *iter);
+const char *json_object_iter_key(void *iter);
+json_t *json_object_iter_value(void *iter);
+int json_object_iter_set_new(json_t *object, void *iter, json_t *value);
+
+static JSON_INLINE
+int json_object_set(json_t *object, const char *key, json_t *value)
+{
+ return json_object_set_new(object, key, json_incref(value));
+}
+
+static JSON_INLINE
+int json_object_set_nocheck(json_t *object, const char *key, json_t *value)
+{
+ return json_object_set_new_nocheck(object, key, json_incref(value));
+}
+
+static inline
+int json_object_iter_set(json_t *object, void *iter, json_t *value)
+{
+ return json_object_iter_set_new(object, iter, json_incref(value));
+}
+
+unsigned int json_array_size(const json_t *array);
+json_t *json_array_get(const json_t *array, unsigned int index);
+int json_array_set_new(json_t *array, unsigned int index, json_t *value);
+int json_array_append_new(json_t *array, json_t *value);
+int json_array_insert_new(json_t *array, unsigned int index, json_t *value);
+int json_array_remove(json_t *array, unsigned int index);
+int json_array_clear(json_t *array);
+int json_array_extend(json_t *array, json_t *other);
+
+static JSON_INLINE
+int json_array_set(json_t *array, unsigned int index, json_t *value)
+{
+ return json_array_set_new(array, index, json_incref(value));
+}
+
+static JSON_INLINE
+int json_array_append(json_t *array, json_t *value)
+{
+ return json_array_append_new(array, json_incref(value));
+}
+
+static JSON_INLINE
+int json_array_insert(json_t *array, unsigned int index, json_t *value)
+{
+ return json_array_insert_new(array, index, json_incref(value));
+}
+
+const char *json_string_value(const json_t *string);
+int json_integer_value(const json_t *integer);
+double json_real_value(const json_t *real);
+double json_number_value(const json_t *json);
+
+int json_string_set(json_t *string, const char *value);
+int json_string_set_nocheck(json_t *string, const char *value);
+int json_integer_set(json_t *integer, int value);
+int json_real_set(json_t *real, double value);
+
+
+/* equality */
+
+int json_equal(json_t *value1, json_t *value2);
+
+
+/* copying */
+
+json_t *json_copy(json_t *value);
+json_t *json_deep_copy(json_t *value);
+
+
+/* loading, printing */
+
+#define JSON_ERROR_TEXT_LENGTH 160
+
+typedef struct {
+ char text[JSON_ERROR_TEXT_LENGTH];
+ int line;
+} json_error_t;
+
+json_t *json_loads(const char *input, json_error_t *error);
+json_t *json_loadf(FILE *input, json_error_t *error);
+json_t *json_load_file(const char *path, json_error_t *error);
+
+#define JSON_INDENT(n) (n & 0xFF)
+#define JSON_COMPACT 0x100
+#define JSON_ENSURE_ASCII 0x200
+#define JSON_SORT_KEYS 0x400
+#define JSON_PRESERVE_ORDER 0x800
+
+char *json_dumps(const json_t *json, unsigned long flags);
+int json_dumpf(const json_t *json, FILE *output, unsigned long flags);
+int json_dump_file(const json_t *json, const char *path, unsigned long flags);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/compat/jansson/jansson_private.h b/compat/jansson/jansson_private.h
new file mode 100644
index 0000000000..3a3ed75480
--- /dev/null
+++ b/compat/jansson/jansson_private.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef JANSSON_PRIVATE_H
+#define JANSSON_PRIVATE_H
+
+#include "jansson.h"
+#include "hashtable.h"
+
+#define container_of(ptr_, type_, member_) \
+ ((type_ *)((char *)ptr_ - (size_t)&((type_ *)0)->member_))
+
+typedef struct {
+ json_t json;
+ hashtable_t hashtable;
+ unsigned long serial;
+ int visited;
+} json_object_t;
+
+typedef struct {
+ json_t json;
+ unsigned int size;
+ unsigned int entries;
+ json_t **table;
+ int visited;
+} json_array_t;
+
+typedef struct {
+ json_t json;
+ char *value;
+} json_string_t;
+
+typedef struct {
+ json_t json;
+ double value;
+} json_real_t;
+
+typedef struct {
+ json_t json;
+ int value;
+} json_integer_t;
+
+#define json_to_object(json_) container_of(json_, json_object_t, json)
+#define json_to_array(json_) container_of(json_, json_array_t, json)
+#define json_to_string(json_) container_of(json_, json_string_t, json)
+#define json_to_real(json_) container_of(json_, json_real_t, json)
+#define json_to_integer(json_) container_of(json_, json_integer_t, json)
+
+typedef struct {
+ unsigned long serial;
+ char key[];
+} object_key_t;
+
+const object_key_t *jsonp_object_iter_fullkey(void *iter);
+
+#endif
diff --git a/compat/jansson/load.c b/compat/jansson/load.c
new file mode 100644
index 0000000000..ee56fbe733
--- /dev/null
+++ b/compat/jansson/load.c
@@ -0,0 +1,879 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include "jansson_private.h"
+#include "strbuffer.h"
+#include "utf.h"
+
+#define TOKEN_INVALID -1
+#define TOKEN_EOF 0
+#define TOKEN_STRING 256
+#define TOKEN_INTEGER 257
+#define TOKEN_REAL 258
+#define TOKEN_TRUE 259
+#define TOKEN_FALSE 260
+#define TOKEN_NULL 261
+
+/* read one byte from stream, return EOF on end of file */
+typedef int (*get_func)(void *data);
+
+/* return non-zero if end of file has been reached */
+typedef int (*eof_func)(void *data);
+
+typedef struct {
+ get_func get;
+ eof_func eof;
+ void *data;
+ int stream_pos;
+ char buffer[5];
+ int buffer_pos;
+} stream_t;
+
+
+typedef struct {
+ stream_t stream;
+ strbuffer_t saved_text;
+ int token;
+ int line, column;
+ union {
+ char *string;
+ int integer;
+ double real;
+ } value;
+} lex_t;
+
+
+/*** error reporting ***/
+
+static void error_init(json_error_t *error)
+{
+ if(error)
+ {
+ error->text[0] = '\0';
+ error->line = -1;
+ }
+}
+
+static void error_set(json_error_t *error, const lex_t *lex,
+ const char *msg, ...)
+{
+ va_list ap;
+ char text[JSON_ERROR_TEXT_LENGTH];
+
+ if(!error || error->text[0] != '\0') {
+ /* error already set */
+ return;
+ }
+
+ va_start(ap, msg);
+ vsnprintf(text, JSON_ERROR_TEXT_LENGTH, msg, ap);
+ va_end(ap);
+
+ if(lex)
+ {
+ const char *saved_text = strbuffer_value(&lex->saved_text);
+ error->line = lex->line;
+ if(saved_text && saved_text[0])
+ {
+ if(lex->saved_text.length <= 20) {
+ snprintf(error->text, JSON_ERROR_TEXT_LENGTH,
+ "%s near '%s'", text, saved_text);
+ }
+ else
+ snprintf(error->text, JSON_ERROR_TEXT_LENGTH, "%s", text);
+ }
+ else
+ {
+ snprintf(error->text, JSON_ERROR_TEXT_LENGTH,
+ "%s near end of file", text);
+ }
+ }
+ else
+ {
+ error->line = -1;
+ snprintf(error->text, JSON_ERROR_TEXT_LENGTH, "%s", text);
+ }
+}
+
+
+/*** lexical analyzer ***/
+
+static void
+stream_init(stream_t *stream, get_func get, eof_func eof, void *data)
+{
+ stream->get = get;
+ stream->eof = eof;
+ stream->data = data;
+ stream->stream_pos = 0;
+ stream->buffer[0] = '\0';
+ stream->buffer_pos = 0;
+}
+
+static char stream_get(stream_t *stream, json_error_t *error)
+{
+ char c;
+
+ if(!stream->buffer[stream->buffer_pos])
+ {
+ stream->buffer[0] = stream->get(stream->data);
+ stream->buffer_pos = 0;
+
+ c = stream->buffer[0];
+
+ if((unsigned char)c >= 0x80 && c != (char)EOF)
+ {
+ /* multi-byte UTF-8 sequence */
+ int i, count;
+
+ count = utf8_check_first(c);
+ if(!count)
+ goto out;
+
+ assert(count >= 2);
+
+ for(i = 1; i < count; i++)
+ stream->buffer[i] = stream->get(stream->data);
+
+ if(!utf8_check_full(stream->buffer, count, NULL))
+ goto out;
+
+ stream->stream_pos += count;
+ stream->buffer[count] = '\0';
+ }
+ else {
+ stream->buffer[1] = '\0';
+ stream->stream_pos++;
+ }
+ }
+
+ return stream->buffer[stream->buffer_pos++];
+
+out:
+ error_set(error, NULL, "unable to decode byte 0x%x at position %d",
+ (unsigned char)c, stream->stream_pos);
+
+ stream->buffer[0] = EOF;
+ stream->buffer[1] = '\0';
+ stream->buffer_pos = 1;
+
+ return EOF;
+}
+
+static void stream_unget(stream_t *stream, char c)
+{
+ assert(stream->buffer_pos > 0);
+ stream->buffer_pos--;
+ assert(stream->buffer[stream->buffer_pos] == c);
+}
+
+
+static int lex_get(lex_t *lex, json_error_t *error)
+{
+ return stream_get(&lex->stream, error);
+}
+
+static int lex_eof(lex_t *lex)
+{
+ return lex->stream.eof(lex->stream.data);
+}
+
+static void lex_save(lex_t *lex, char c)
+{
+ strbuffer_append_byte(&lex->saved_text, c);
+}
+
+static int lex_get_save(lex_t *lex, json_error_t *error)
+{
+ char c = stream_get(&lex->stream, error);
+ lex_save(lex, c);
+ return c;
+}
+
+static void lex_unget_unsave(lex_t *lex, char c)
+{
+ char d;
+ stream_unget(&lex->stream, c);
+ d = strbuffer_pop(&lex->saved_text);
+ assert(c == d);
+}
+
+static void lex_save_cached(lex_t *lex)
+{
+ while(lex->stream.buffer[lex->stream.buffer_pos] != '\0')
+ {
+ lex_save(lex, lex->stream.buffer[lex->stream.buffer_pos]);
+ lex->stream.buffer_pos++;
+ }
+}
+
+/* assumes that str points to 'u' plus at least 4 valid hex digits */
+static int32_t decode_unicode_escape(const char *str)
+{
+ int i;
+ int32_t value = 0;
+
+ assert(str[0] == 'u');
+
+ for(i = 1; i <= 4; i++) {
+ char c = str[i];
+ value <<= 4;
+ if(isdigit(c))
+ value += c - '0';
+ else if(islower(c))
+ value += c - 'a' + 10;
+ else if(isupper(c))
+ value += c - 'A' + 10;
+ else
+ assert(0);
+ }
+
+ return value;
+}
+
+static void lex_scan_string(lex_t *lex, json_error_t *error)
+{
+ char c;
+ const char *p;
+ char *t;
+ int i;
+
+ lex->value.string = NULL;
+ lex->token = TOKEN_INVALID;
+
+ c = lex_get_save(lex, error);
+
+ while(c != '"') {
+ if(c == (char)EOF) {
+ lex_unget_unsave(lex, c);
+ if(lex_eof(lex))
+ error_set(error, lex, "premature end of input");
+ goto out;
+ }
+
+ else if((unsigned char)c <= 0x1F) {
+ /* control character */
+ lex_unget_unsave(lex, c);
+ if(c == '\n')
+ error_set(error, lex, "unexpected newline", c);
+ else
+ error_set(error, lex, "control character 0x%x", c);
+ goto out;
+ }
+
+ else if(c == '\\') {
+ c = lex_get_save(lex, error);
+ if(c == 'u') {
+ c = lex_get_save(lex, error);
+ for(i = 0; i < 4; i++) {
+ if(!isxdigit(c)) {
+ lex_unget_unsave(lex, c);
+ error_set(error, lex, "invalid escape");
+ goto out;
+ }
+ c = lex_get_save(lex, error);
+ }
+ }
+ else if(c == '"' || c == '\\' || c == '/' || c == 'b' ||
+ c == 'f' || c == 'n' || c == 'r' || c == 't')
+ c = lex_get_save(lex, error);
+ else {
+ lex_unget_unsave(lex, c);
+ error_set(error, lex, "invalid escape");
+ goto out;
+ }
+ }
+ else
+ c = lex_get_save(lex, error);
+ }
+
+ /* the actual value is at most of the same length as the source
+ string, because:
+ - shortcut escapes (e.g. "\t") (length 2) are converted to 1 byte
+ - a single \uXXXX escape (length 6) is converted to at most 3 bytes
+ - two \uXXXX escapes (length 12) forming an UTF-16 surrogate pair
+ are converted to 4 bytes
+ */
+ lex->value.string = malloc(lex->saved_text.length + 1);
+ if(!lex->value.string) {
+ /* this is not very nice, since TOKEN_INVALID is returned */
+ goto out;
+ }
+
+ /* the target */
+ t = lex->value.string;
+
+ /* + 1 to skip the " */
+ p = strbuffer_value(&lex->saved_text) + 1;
+
+ while(*p != '"') {
+ if(*p == '\\') {
+ p++;
+ if(*p == 'u') {
+ char buffer[4];
+ int length;
+ int32_t value;
+
+ value = decode_unicode_escape(p);
+ p += 5;
+
+ if(0xD800 <= value && value <= 0xDBFF) {
+ /* surrogate pair */
+ if(*p == '\\' && *(p + 1) == 'u') {
+ int32_t value2 = decode_unicode_escape(++p);
+ p += 5;
+
+ if(0xDC00 <= value2 && value2 <= 0xDFFF) {
+ /* valid second surrogate */
+ value =
+ ((value - 0xD800) << 10) +
+ (value2 - 0xDC00) +
+ 0x10000;
+ }
+ else {
+ /* invalid second surrogate */
+ error_set(error, lex,
+ "invalid Unicode '\\u%04X\\u%04X'",
+ value, value2);
+ goto out;
+ }
+ }
+ else {
+ /* no second surrogate */
+ error_set(error, lex, "invalid Unicode '\\u%04X'",
+ value);
+ goto out;
+ }
+ }
+ else if(0xDC00 <= value && value <= 0xDFFF) {
+ error_set(error, lex, "invalid Unicode '\\u%04X'", value);
+ goto out;
+ }
+ else if(value == 0)
+ {
+ error_set(error, lex, "\\u0000 is not allowed");
+ goto out;
+ }
+
+ if(utf8_encode(value, buffer, &length))
+ assert(0);
+
+ memcpy(t, buffer, length);
+ t += length;
+ }
+ else {
+ switch(*p) {
+ case '"': case '\\': case '/':
+ *t = *p; break;
+ case 'b': *t = '\b'; break;
+ case 'f': *t = '\f'; break;
+ case 'n': *t = '\n'; break;
+ case 'r': *t = '\r'; break;
+ case 't': *t = '\t'; break;
+ default: assert(0);
+ }
+ t++;
+ p++;
+ }
+ }
+ else
+ *(t++) = *(p++);
+ }
+ *t = '\0';
+ lex->token = TOKEN_STRING;
+ return;
+
+out:
+ free(lex->value.string);
+}
+
+static int lex_scan_number(lex_t *lex, char c, json_error_t *error)
+{
+ const char *saved_text;
+ char *end;
+ double value;
+
+ lex->token = TOKEN_INVALID;
+
+ if(c == '-')
+ c = lex_get_save(lex, error);
+
+ if(c == '0') {
+ c = lex_get_save(lex, error);
+ if(isdigit(c)) {
+ lex_unget_unsave(lex, c);
+ goto out;
+ }
+ }
+ else if(isdigit(c)) {
+ c = lex_get_save(lex, error);
+ while(isdigit(c))
+ c = lex_get_save(lex, error);
+ }
+ else {
+ lex_unget_unsave(lex, c);
+ goto out;
+ }
+
+ if(c != '.' && c != 'E' && c != 'e') {
+ long value;
+
+ lex_unget_unsave(lex, c);
+
+ saved_text = strbuffer_value(&lex->saved_text);
+ value = strtol(saved_text, &end, 10);
+ assert(end == saved_text + lex->saved_text.length);
+
+ if((value == LONG_MAX && errno == ERANGE) || value > INT_MAX) {
+ error_set(error, lex, "too big integer");
+ goto out;
+ }
+ else if((value == LONG_MIN && errno == ERANGE) || value < INT_MIN) {
+ error_set(error, lex, "too big negative integer");
+ goto out;
+ }
+
+ lex->token = TOKEN_INTEGER;
+ lex->value.integer = (int)value;
+ return 0;
+ }
+
+ if(c == '.') {
+ c = lex_get(lex, error);
+ if(!isdigit(c))
+ goto out;
+ lex_save(lex, c);
+
+ c = lex_get_save(lex, error);
+ while(isdigit(c))
+ c = lex_get_save(lex, error);
+ }
+
+ if(c == 'E' || c == 'e') {
+ c = lex_get_save(lex, error);
+ if(c == '+' || c == '-')
+ c = lex_get_save(lex, error);
+
+ if(!isdigit(c)) {
+ lex_unget_unsave(lex, c);
+ goto out;
+ }
+
+ c = lex_get_save(lex, error);
+ while(isdigit(c))
+ c = lex_get_save(lex, error);
+ }
+
+ lex_unget_unsave(lex, c);
+
+ saved_text = strbuffer_value(&lex->saved_text);
+ value = strtod(saved_text, &end);
+ assert(end == saved_text + lex->saved_text.length);
+
+ if(errno == ERANGE && value != 0) {
+ error_set(error, lex, "real number overflow");
+ goto out;
+ }
+
+ lex->token = TOKEN_REAL;
+ lex->value.real = value;
+ return 0;
+
+out:
+ return -1;
+}
+
+static int lex_scan(lex_t *lex, json_error_t *error)
+{
+ char c;
+
+ strbuffer_clear(&lex->saved_text);
+
+ if(lex->token == TOKEN_STRING) {
+ free(lex->value.string);
+ lex->value.string = NULL;
+ }
+
+ c = lex_get(lex, error);
+ while(c == ' ' || c == '\t' || c == '\n' || c == '\r')
+ {
+ if(c == '\n')
+ lex->line++;
+
+ c = lex_get(lex, error);
+ }
+
+ if(c == (char)EOF) {
+ if(lex_eof(lex))
+ lex->token = TOKEN_EOF;
+ else
+ lex->token = TOKEN_INVALID;
+ goto out;
+ }
+
+ lex_save(lex, c);
+
+ if(c == '{' || c == '}' || c == '[' || c == ']' || c == ':' || c == ',')
+ lex->token = c;
+
+ else if(c == '"')
+ lex_scan_string(lex, error);
+
+ else if(isdigit(c) || c == '-') {
+ if(lex_scan_number(lex, c, error))
+ goto out;
+ }
+
+ else if(isupper(c) || islower(c)) {
+ /* eat up the whole identifier for clearer error messages */
+ const char *saved_text;
+
+ c = lex_get_save(lex, error);
+ while(isupper(c) || islower(c))
+ c = lex_get_save(lex, error);
+ lex_unget_unsave(lex, c);
+
+ saved_text = strbuffer_value(&lex->saved_text);
+
+ if(strcmp(saved_text, "true") == 0)
+ lex->token = TOKEN_TRUE;
+ else if(strcmp(saved_text, "false") == 0)
+ lex->token = TOKEN_FALSE;
+ else if(strcmp(saved_text, "null") == 0)
+ lex->token = TOKEN_NULL;
+ else
+ lex->token = TOKEN_INVALID;
+ }
+
+ else {
+ /* save the rest of the input UTF-8 sequence to get an error
+ message of valid UTF-8 */
+ lex_save_cached(lex);
+ lex->token = TOKEN_INVALID;
+ }
+
+out:
+ return lex->token;
+}
+
+static char *lex_steal_string(lex_t *lex)
+{
+ char *result = NULL;
+ if(lex->token == TOKEN_STRING)
+ {
+ result = lex->value.string;
+ lex->value.string = NULL;
+ }
+ return result;
+}
+
+static int lex_init(lex_t *lex, get_func get, eof_func eof, void *data)
+{
+ stream_init(&lex->stream, get, eof, data);
+ if(strbuffer_init(&lex->saved_text))
+ return -1;
+
+ lex->token = TOKEN_INVALID;
+ lex->line = 1;
+
+ return 0;
+}
+
+static void lex_close(lex_t *lex)
+{
+ if(lex->token == TOKEN_STRING)
+ free(lex->value.string);
+ strbuffer_close(&lex->saved_text);
+}
+
+
+/*** parser ***/
+
+static json_t *parse_value(lex_t *lex, json_error_t *error);
+
+static json_t *parse_object(lex_t *lex, json_error_t *error)
+{
+ json_t *object = json_object();
+ if(!object)
+ return NULL;
+
+ lex_scan(lex, error);
+ if(lex->token == '}')
+ return object;
+
+ while(1) {
+ char *key;
+ json_t *value;
+
+ if(lex->token != TOKEN_STRING) {
+ error_set(error, lex, "string or '}' expected");
+ goto error;
+ }
+
+ key = lex_steal_string(lex);
+ if(!key)
+ return NULL;
+
+ lex_scan(lex, error);
+ if(lex->token != ':') {
+ free(key);
+ error_set(error, lex, "':' expected");
+ goto error;
+ }
+
+ lex_scan(lex, error);
+ value = parse_value(lex, error);
+ if(!value) {
+ free(key);
+ goto error;
+ }
+
+ if(json_object_set_nocheck(object, key, value)) {
+ free(key);
+ json_decref(value);
+ goto error;
+ }
+
+ json_decref(value);
+ free(key);
+
+ lex_scan(lex, error);
+ if(lex->token != ',')
+ break;
+
+ lex_scan(lex, error);
+ }
+
+ if(lex->token != '}') {
+ error_set(error, lex, "'}' expected");
+ goto error;
+ }
+
+ return object;
+
+error:
+ json_decref(object);
+ return NULL;
+}
+
+static json_t *parse_array(lex_t *lex, json_error_t *error)
+{
+ json_t *array = json_array();
+ if(!array)
+ return NULL;
+
+ lex_scan(lex, error);
+ if(lex->token == ']')
+ return array;
+
+ while(lex->token) {
+ json_t *elem = parse_value(lex, error);
+ if(!elem)
+ goto error;
+
+ if(json_array_append(array, elem)) {
+ json_decref(elem);
+ goto error;
+ }
+ json_decref(elem);
+
+ lex_scan(lex, error);
+ if(lex->token != ',')
+ break;
+
+ lex_scan(lex, error);
+ }
+
+ if(lex->token != ']') {
+ error_set(error, lex, "']' expected");
+ goto error;
+ }
+
+ return array;
+
+error:
+ json_decref(array);
+ return NULL;
+}
+
+static json_t *parse_value(lex_t *lex, json_error_t *error)
+{
+ json_t *json;
+
+ switch(lex->token) {
+ case TOKEN_STRING: {
+ json = json_string_nocheck(lex->value.string);
+ break;
+ }
+
+ case TOKEN_INTEGER: {
+ json = json_integer(lex->value.integer);
+ break;
+ }
+
+ case TOKEN_REAL: {
+ json = json_real(lex->value.real);
+ break;
+ }
+
+ case TOKEN_TRUE:
+ json = json_true();
+ break;
+
+ case TOKEN_FALSE:
+ json = json_false();
+ break;
+
+ case TOKEN_NULL:
+ json = json_null();
+ break;
+
+ case '{':
+ json = parse_object(lex, error);
+ break;
+
+ case '[':
+ json = parse_array(lex, error);
+ break;
+
+ case TOKEN_INVALID:
+ error_set(error, lex, "invalid token");
+ return NULL;
+
+ default:
+ error_set(error, lex, "unexpected token");
+ return NULL;
+ }
+
+ if(!json)
+ return NULL;
+
+ return json;
+}
+
+static json_t *parse_json(lex_t *lex, json_error_t *error)
+{
+ error_init(error);
+
+ lex_scan(lex, error);
+ if(lex->token != '[' && lex->token != '{') {
+ error_set(error, lex, "'[' or '{' expected");
+ return NULL;
+ }
+
+ return parse_value(lex, error);
+}
+
+typedef struct
+{
+ const char *data;
+ int pos;
+} string_data_t;
+
+static int string_get(void *data)
+{
+ char c;
+ string_data_t *stream = (string_data_t *)data;
+ c = stream->data[stream->pos];
+ if(c == '\0')
+ return EOF;
+ else
+ {
+ stream->pos++;
+ return c;
+ }
+}
+
+static int string_eof(void *data)
+{
+ string_data_t *stream = (string_data_t *)data;
+ return (stream->data[stream->pos] == '\0');
+}
+
+json_t *json_loads(const char *string, json_error_t *error)
+{
+ lex_t lex;
+ json_t *result;
+
+ string_data_t stream_data = {
+ string,
+ 0
+ };
+
+ if(lex_init(&lex, string_get, string_eof, (void *)&stream_data))
+ return NULL;
+
+ result = parse_json(&lex, error);
+ if(!result)
+ goto out;
+
+ lex_scan(&lex, error);
+ if(lex.token != TOKEN_EOF) {
+ error_set(error, &lex, "end of file expected");
+ json_decref(result);
+ result = NULL;
+ }
+
+out:
+ lex_close(&lex);
+ return result;
+}
+
+json_t *json_loadf(FILE *input, json_error_t *error)
+{
+ lex_t lex;
+ json_t *result;
+
+ if(lex_init(&lex, (get_func)fgetc, (eof_func)feof, input))
+ return NULL;
+
+ result = parse_json(&lex, error);
+ if(!result)
+ goto out;
+
+ lex_scan(&lex, error);
+ if(lex.token != TOKEN_EOF) {
+ error_set(error, &lex, "end of file expected");
+ json_decref(result);
+ result = NULL;
+ }
+
+out:
+ lex_close(&lex);
+ return result;
+}
+
+json_t *json_load_file(const char *path, json_error_t *error)
+{
+ json_t *result;
+ FILE *fp;
+
+ error_init(error);
+
+ fp = fopen(path, "r");
+ if(!fp)
+ {
+ error_set(error, NULL, "unable to open %s: %s",
+ path, strerror(errno));
+ return NULL;
+ }
+
+ result = json_loadf(fp, error);
+
+ fclose(fp);
+ return result;
+}
diff --git a/compat/jansson/strbuffer.c b/compat/jansson/strbuffer.c
new file mode 100644
index 0000000000..0019645ed1
--- /dev/null
+++ b/compat/jansson/strbuffer.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#define _GNU_SOURCE
+#include
+#include
+#include "strbuffer.h"
+#include "util.h"
+
+#define STRBUFFER_MIN_SIZE 16
+#define STRBUFFER_FACTOR 2
+
+int strbuffer_init(strbuffer_t *strbuff)
+{
+ strbuff->size = STRBUFFER_MIN_SIZE;
+ strbuff->length = 0;
+
+ strbuff->value = malloc(strbuff->size);
+ if(!strbuff->value)
+ return -1;
+
+ /* initialize to empty */
+ strbuff->value[0] = '\0';
+ return 0;
+}
+
+void strbuffer_close(strbuffer_t *strbuff)
+{
+ free(strbuff->value);
+ strbuff->size = 0;
+ strbuff->length = 0;
+ strbuff->value = NULL;
+}
+
+void strbuffer_clear(strbuffer_t *strbuff)
+{
+ strbuff->length = 0;
+ strbuff->value[0] = '\0';
+}
+
+const char *strbuffer_value(const strbuffer_t *strbuff)
+{
+ return strbuff->value;
+}
+
+char *strbuffer_steal_value(strbuffer_t *strbuff)
+{
+ char *result = strbuff->value;
+ strbuffer_init(strbuff);
+ return result;
+}
+
+int strbuffer_append(strbuffer_t *strbuff, const char *string)
+{
+ return strbuffer_append_bytes(strbuff, string, strlen(string));
+}
+
+int strbuffer_append_byte(strbuffer_t *strbuff, char byte)
+{
+ return strbuffer_append_bytes(strbuff, &byte, 1);
+}
+
+int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, int size)
+{
+ if(strbuff->length + size >= strbuff->size)
+ {
+ strbuff->size = max(strbuff->size * STRBUFFER_FACTOR,
+ strbuff->length + size + 1);
+
+ strbuff->value = realloc(strbuff->value, strbuff->size);
+ if(!strbuff->value)
+ return -1;
+ }
+
+ memcpy(strbuff->value + strbuff->length, data, size);
+ strbuff->length += size;
+ strbuff->value[strbuff->length] = '\0';
+
+ return 0;
+}
+
+char strbuffer_pop(strbuffer_t *strbuff)
+{
+ if(strbuff->length > 0) {
+ char c = strbuff->value[--strbuff->length];
+ strbuff->value[strbuff->length] = '\0';
+ return c;
+ }
+ else
+ return '\0';
+}
diff --git a/compat/jansson/strbuffer.h b/compat/jansson/strbuffer.h
new file mode 100644
index 0000000000..816594a826
--- /dev/null
+++ b/compat/jansson/strbuffer.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef STRBUFFER_H
+#define STRBUFFER_H
+
+typedef struct {
+ char *value;
+ int length; /* bytes used */
+ int size; /* bytes allocated */
+} strbuffer_t;
+
+int strbuffer_init(strbuffer_t *strbuff);
+void strbuffer_close(strbuffer_t *strbuff);
+
+void strbuffer_clear(strbuffer_t *strbuff);
+
+const char *strbuffer_value(const strbuffer_t *strbuff);
+char *strbuffer_steal_value(strbuffer_t *strbuff);
+
+int strbuffer_append(strbuffer_t *strbuff, const char *string);
+int strbuffer_append_byte(strbuffer_t *strbuff, char byte);
+int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, int size);
+
+char strbuffer_pop(strbuffer_t *strbuff);
+
+#endif
diff --git a/compat/jansson/utf.c b/compat/jansson/utf.c
new file mode 100644
index 0000000000..2b644501cb
--- /dev/null
+++ b/compat/jansson/utf.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#include
+#include "utf.h"
+
+int utf8_encode(int32_t codepoint, char *buffer, int *size)
+{
+ if(codepoint < 0)
+ return -1;
+ else if(codepoint < 0x80)
+ {
+ buffer[0] = (char)codepoint;
+ *size = 1;
+ }
+ else if(codepoint < 0x800)
+ {
+ buffer[0] = 0xC0 + ((codepoint & 0x7C0) >> 6);
+ buffer[1] = 0x80 + ((codepoint & 0x03F));
+ *size = 2;
+ }
+ else if(codepoint < 0x10000)
+ {
+ buffer[0] = 0xE0 + ((codepoint & 0xF000) >> 12);
+ buffer[1] = 0x80 + ((codepoint & 0x0FC0) >> 6);
+ buffer[2] = 0x80 + ((codepoint & 0x003F));
+ *size = 3;
+ }
+ else if(codepoint <= 0x10FFFF)
+ {
+ buffer[0] = 0xF0 + ((codepoint & 0x1C0000) >> 18);
+ buffer[1] = 0x80 + ((codepoint & 0x03F000) >> 12);
+ buffer[2] = 0x80 + ((codepoint & 0x000FC0) >> 6);
+ buffer[3] = 0x80 + ((codepoint & 0x00003F));
+ *size = 4;
+ }
+ else
+ return -1;
+
+ return 0;
+}
+
+int utf8_check_first(char byte)
+{
+ unsigned char u = (unsigned char)byte;
+
+ if(u < 0x80)
+ return 1;
+
+ if(0x80 <= u && u <= 0xBF) {
+ /* second, third or fourth byte of a multi-byte
+ sequence, i.e. a "continuation byte" */
+ return 0;
+ }
+ else if(u == 0xC0 || u == 0xC1) {
+ /* overlong encoding of an ASCII byte */
+ return 0;
+ }
+ else if(0xC2 <= u && u <= 0xDF) {
+ /* 2-byte sequence */
+ return 2;
+ }
+
+ else if(0xE0 <= u && u <= 0xEF) {
+ /* 3-byte sequence */
+ return 3;
+ }
+ else if(0xF0 <= u && u <= 0xF4) {
+ /* 4-byte sequence */
+ return 4;
+ }
+ else { /* u >= 0xF5 */
+ /* Restricted (start of 4-, 5- or 6-byte sequence) or invalid
+ UTF-8 */
+ return 0;
+ }
+}
+
+int utf8_check_full(const char *buffer, int size, int32_t *codepoint)
+{
+ int i;
+ int32_t value = 0;
+ unsigned char u = (unsigned char)buffer[0];
+
+ if(size == 2)
+ {
+ value = u & 0x1F;
+ }
+ else if(size == 3)
+ {
+ value = u & 0xF;
+ }
+ else if(size == 4)
+ {
+ value = u & 0x7;
+ }
+ else
+ return 0;
+
+ for(i = 1; i < size; i++)
+ {
+ u = (unsigned char)buffer[i];
+
+ if(u < 0x80 || u > 0xBF) {
+ /* not a continuation byte */
+ return 0;
+ }
+
+ value = (value << 6) + (u & 0x3F);
+ }
+
+ if(value > 0x10FFFF) {
+ /* not in Unicode range */
+ return 0;
+ }
+
+ else if(0xD800 <= value && value <= 0xDFFF) {
+ /* invalid code point (UTF-16 surrogate halves) */
+ return 0;
+ }
+
+ else if((size == 2 && value < 0x80) ||
+ (size == 3 && value < 0x800) ||
+ (size == 4 && value < 0x10000)) {
+ /* overlong encoding */
+ return 0;
+ }
+
+ if(codepoint)
+ *codepoint = value;
+
+ return 1;
+}
+
+const char *utf8_iterate(const char *buffer, int32_t *codepoint)
+{
+ int count;
+ int32_t value;
+
+ if(!*buffer)
+ return buffer;
+
+ count = utf8_check_first(buffer[0]);
+ if(count <= 0)
+ return NULL;
+
+ if(count == 1)
+ value = (unsigned char)buffer[0];
+ else
+ {
+ if(!utf8_check_full(buffer, count, &value))
+ return NULL;
+ }
+
+ if(codepoint)
+ *codepoint = value;
+
+ return buffer + count;
+}
+
+int utf8_check_string(const char *string, int length)
+{
+ int i;
+
+ if(length == -1)
+ length = strlen(string);
+
+ for(i = 0; i < length; i++)
+ {
+ int count = utf8_check_first(string[i]);
+ if(count == 0)
+ return 0;
+ else if(count > 1)
+ {
+ if(i + count > length)
+ return 0;
+
+ if(!utf8_check_full(&string[i], count, NULL))
+ return 0;
+
+ i += count - 1;
+ }
+ }
+
+ return 1;
+}
diff --git a/compat/jansson/utf.h b/compat/jansson/utf.h
new file mode 100644
index 0000000000..8e95296404
--- /dev/null
+++ b/compat/jansson/utf.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef UTF_H
+#define UTF_H
+
+#include
+
+#ifdef HAVE_INTTYPES_H
+/* inttypes.h includes stdint.h in a standard environment, so there's
+no need to include stdint.h separately. If inttypes.h doesn't define
+int32_t, it's defined in config.h. */
+#include
+#endif
+
+int utf8_encode(int codepoint, char *buffer, int *size);
+
+int utf8_check_first(char byte);
+int utf8_check_full(const char *buffer, int size, int32_t *codepoint);
+const char *utf8_iterate(const char *buffer, int32_t *codepoint);
+
+int utf8_check_string(const char *string, int length);
+
+#endif
diff --git a/compat/jansson/util.h b/compat/jansson/util.h
new file mode 100644
index 0000000000..33e5d62680
--- /dev/null
+++ b/compat/jansson/util.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#ifndef UTIL_H
+#define UTIL_H
+
+#ifndef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+#endif
diff --git a/compat/jansson/value.c b/compat/jansson/value.c
new file mode 100644
index 0000000000..591b89e1fe
--- /dev/null
+++ b/compat/jansson/value.c
@@ -0,0 +1,976 @@
+/*
+ * Copyright (c) 2009, 2010 Petri Lehtinen
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
+#define _GNU_SOURCE
+
+#include
+
+#include
+#include
+
+#include
+#include "hashtable.h"
+#include "jansson_private.h"
+#include "utf.h"
+#include "util.h"
+
+
+static inline void json_init(json_t *json, json_type type)
+{
+ json->type = type;
+ json->refcount = 1;
+}
+
+
+/*** object ***/
+
+/* This macro just returns a pointer that's a few bytes backwards from
+ string. This makes it possible to pass a pointer to object_key_t
+ when only the string inside it is used, without actually creating
+ an object_key_t instance. */
+#define string_to_key(string) container_of(string, object_key_t, key)
+
+static unsigned int hash_key(const void *ptr)
+{
+ const char *str = ((const object_key_t *)ptr)->key;
+
+ unsigned int hash = 5381;
+ unsigned int c;
+
+ while((c = (unsigned int)*str))
+ {
+ hash = ((hash << 5) + hash) + c;
+ str++;
+ }
+
+ return hash;
+}
+
+static int key_equal(const void *ptr1, const void *ptr2)
+{
+ return strcmp(((const object_key_t *)ptr1)->key,
+ ((const object_key_t *)ptr2)->key) == 0;
+}
+
+static void value_decref(void *value)
+{
+ json_decref((json_t *)value);
+}
+
+json_t *json_object(void)
+{
+ json_object_t *object = malloc(sizeof(json_object_t));
+ if(!object)
+ return NULL;
+ json_init(&object->json, JSON_OBJECT);
+
+ if(hashtable_init(&object->hashtable, hash_key, key_equal,
+ free, value_decref))
+ {
+ free(object);
+ return NULL;
+ }
+
+ object->serial = 0;
+ object->visited = 0;
+
+ return &object->json;
+}
+
+static void json_delete_object(json_object_t *object)
+{
+ hashtable_close(&object->hashtable);
+ free(object);
+}
+
+unsigned int json_object_size(const json_t *json)
+{
+ json_object_t *object;
+
+ if(!json_is_object(json))
+ return -1;
+
+ object = json_to_object(json);
+ return object->hashtable.size;
+}
+
+json_t *json_object_get(const json_t *json, const char *key)
+{
+ json_object_t *object;
+
+ if(!json_is_object(json))
+ return NULL;
+
+ object = json_to_object(json);
+ return hashtable_get(&object->hashtable, string_to_key(key));
+}
+
+int json_object_set_new_nocheck(json_t *json, const char *key, json_t *value)
+{
+ json_object_t *object;
+ object_key_t *k;
+
+ if(!key || !value)
+ return -1;
+
+ if(!json_is_object(json) || json == value)
+ {
+ json_decref(value);
+ return -1;
+ }
+ object = json_to_object(json);
+
+ k = malloc(sizeof(object_key_t) + strlen(key) + 1);
+ if(!k)
+ return -1;
+
+ k->serial = object->serial++;
+ strcpy(k->key, key);
+
+ if(hashtable_set(&object->hashtable, k, value))
+ {
+ json_decref(value);
+ return -1;
+ }
+
+ return 0;
+}
+
+int json_object_set_new(json_t *json, const char *key, json_t *value)
+{
+ if(!key || !utf8_check_string(key, -1))
+ {
+ json_decref(value);
+ return -1;
+ }
+
+ return json_object_set_new_nocheck(json, key, value);
+}
+
+int json_object_del(json_t *json, const char *key)
+{
+ json_object_t *object;
+
+ if(!json_is_object(json))
+ return -1;
+
+ object = json_to_object(json);
+ return hashtable_del(&object->hashtable, string_to_key(key));
+}
+
+int json_object_clear(json_t *json)
+{
+ json_object_t *object;
+
+ if(!json_is_object(json))
+ return -1;
+
+ object = json_to_object(json);
+ hashtable_clear(&object->hashtable);
+
+ return 0;
+}
+
+int json_object_update(json_t *object, json_t *other)
+{
+ void *iter;
+
+ if(!json_is_object(object) || !json_is_object(other))
+ return -1;
+
+ iter = json_object_iter(other);
+ while(iter) {
+ const char *key;
+ json_t *value;
+
+ key = json_object_iter_key(iter);
+ value = json_object_iter_value(iter);
+
+ if(json_object_set_nocheck(object, key, value))
+ return -1;
+
+ iter = json_object_iter_next(other, iter);
+ }
+
+ return 0;
+}
+
+void *json_object_iter(json_t *json)
+{
+ json_object_t *object;
+
+ if(!json_is_object(json))
+ return NULL;
+
+ object = json_to_object(json);
+ return hashtable_iter(&object->hashtable);
+}
+
+void *json_object_iter_at(json_t *json, const char *key)
+{
+ json_object_t *object;
+
+ if(!key || !json_is_object(json))
+ return NULL;
+
+ object = json_to_object(json);
+ return hashtable_iter_at(&object->hashtable, string_to_key(key));
+}
+
+void *json_object_iter_next(json_t *json, void *iter)
+{
+ json_object_t *object;
+
+ if(!json_is_object(json) || iter == NULL)
+ return NULL;
+
+ object = json_to_object(json);
+ return hashtable_iter_next(&object->hashtable, iter);
+}
+
+const object_key_t *jsonp_object_iter_fullkey(void *iter)
+{
+ if(!iter)
+ return NULL;
+
+ return hashtable_iter_key(iter);
+}
+
+const char *json_object_iter_key(void *iter)
+{
+ if(!iter)
+ return NULL;
+
+ return jsonp_object_iter_fullkey(iter)->key;
+}
+
+json_t *json_object_iter_value(void *iter)
+{
+ if(!iter)
+ return NULL;
+
+ return (json_t *)hashtable_iter_value(iter);
+}
+
+int json_object_iter_set_new(json_t *json, void *iter, json_t *value)
+{
+ json_object_t *object;
+
+ if(!json_is_object(json) || !iter || !value)
+ return -1;
+
+ object = json_to_object(json);
+ hashtable_iter_set(&object->hashtable, iter, value);
+
+ return 0;
+}
+
+static int json_object_equal(json_t *object1, json_t *object2)
+{
+ void *iter;
+
+ if(json_object_size(object1) != json_object_size(object2))
+ return 0;
+
+ iter = json_object_iter(object1);
+ while(iter)
+ {
+ const char *key;
+ json_t *value1, *value2;
+
+ key = json_object_iter_key(iter);
+ value1 = json_object_iter_value(iter);
+ value2 = json_object_get(object2, key);
+
+ if(!json_equal(value1, value2))
+ return 0;
+
+ iter = json_object_iter_next(object1, iter);
+ }
+
+ return 1;
+}
+
+static json_t *json_object_copy(json_t *object)
+{
+ json_t *result;
+ void *iter;
+
+ result = json_object();
+ if(!result)
+ return NULL;
+
+ iter = json_object_iter(object);
+ while(iter)
+ {
+ const char *key;
+ json_t *value;
+
+ key = json_object_iter_key(iter);
+ value = json_object_iter_value(iter);
+ json_object_set_nocheck(result, key, value);
+
+ iter = json_object_iter_next(object, iter);
+ }
+
+ return result;
+}
+
+static json_t *json_object_deep_copy(json_t *object)
+{
+ json_t *result;
+ void *iter;
+
+ result = json_object();
+ if(!result)
+ return NULL;
+
+ iter = json_object_iter(object);
+ while(iter)
+ {
+ const char *key;
+ json_t *value;
+
+ key = json_object_iter_key(iter);
+ value = json_object_iter_value(iter);
+ json_object_set_new_nocheck(result, key, json_deep_copy(value));
+
+ iter = json_object_iter_next(object, iter);
+ }
+
+ return result;
+}
+
+
+/*** array ***/
+
+json_t *json_array(void)
+{
+ json_array_t *array = malloc(sizeof(json_array_t));
+ if(!array)
+ return NULL;
+ json_init(&array->json, JSON_ARRAY);
+
+ array->entries = 0;
+ array->size = 8;
+
+ array->table = malloc(array->size * sizeof(json_t *));
+ if(!array->table) {
+ free(array);
+ return NULL;
+ }
+
+ array->visited = 0;
+
+ return &array->json;
+}
+
+static void json_delete_array(json_array_t *array)
+{
+ unsigned int i;
+
+ for(i = 0; i < array->entries; i++)
+ json_decref(array->table[i]);
+
+ free(array->table);
+ free(array);
+}
+
+unsigned int json_array_size(const json_t *json)
+{
+ if(!json_is_array(json))
+ return 0;
+
+ return json_to_array(json)->entries;
+}
+
+json_t *json_array_get(const json_t *json, unsigned int index)
+{
+ json_array_t *array;
+ if(!json_is_array(json))
+ return NULL;
+ array = json_to_array(json);
+
+ if(index >= array->entries)
+ return NULL;
+
+ return array->table[index];
+}
+
+int json_array_set_new(json_t *json, unsigned int index, json_t *value)
+{
+ json_array_t *array;
+
+ if(!value)
+ return -1;
+
+ if(!json_is_array(json) || json == value)
+ {
+ json_decref(value);
+ return -1;
+ }
+ array = json_to_array(json);
+
+ if(index >= array->entries)
+ {
+ json_decref(value);
+ return -1;
+ }
+
+ json_decref(array->table[index]);
+ array->table[index] = value;
+
+ return 0;
+}
+
+static void array_move(json_array_t *array, unsigned int dest,
+ unsigned int src, unsigned int count)
+{
+ memmove(&array->table[dest], &array->table[src], count * sizeof(json_t *));
+}
+
+static void array_copy(json_t **dest, unsigned int dpos,
+ json_t **src, unsigned int spos,
+ unsigned int count)
+{
+ memcpy(&dest[dpos], &src[spos], count * sizeof(json_t *));
+}
+
+static json_t **json_array_grow(json_array_t *array,
+ unsigned int amount,
+ int copy)
+{
+ unsigned int new_size;
+ json_t **old_table, **new_table;
+
+ if(array->entries + amount <= array->size)
+ return array->table;
+
+ old_table = array->table;
+
+ new_size = max(array->size + amount, array->size * 2);
+ new_table = malloc(new_size * sizeof(json_t *));
+ if(!new_table)
+ return NULL;
+
+ array->size = new_size;
+ array->table = new_table;
+
+ if(copy) {
+ array_copy(array->table, 0, old_table, 0, array->entries);
+ free(old_table);
+ return array->table;
+ }
+
+ return old_table;
+}
+
+int json_array_append_new(json_t *json, json_t *value)
+{
+ json_array_t *array;
+
+ if(!value)
+ return -1;
+
+ if(!json_is_array(json) || json == value)
+ {
+ json_decref(value);
+ return -1;
+ }
+ array = json_to_array(json);
+
+ if(!json_array_grow(array, 1, 1)) {
+ json_decref(value);
+ return -1;
+ }
+
+ array->table[array->entries] = value;
+ array->entries++;
+
+ return 0;
+}
+
+int json_array_insert_new(json_t *json, unsigned int index, json_t *value)
+{
+ json_array_t *array;
+ json_t **old_table;
+
+ if(!value)
+ return -1;
+
+ if(!json_is_array(json) || json == value) {
+ json_decref(value);
+ return -1;
+ }
+ array = json_to_array(json);
+
+ if(index > array->entries) {
+ json_decref(value);
+ return -1;
+ }
+
+ old_table = json_array_grow(array, 1, 0);
+ if(!old_table) {
+ json_decref(value);
+ return -1;
+ }
+
+ if(old_table != array->table) {
+ array_copy(array->table, 0, old_table, 0, index);
+ array_copy(array->table, index + 1, old_table, index,
+ array->entries - index);
+ free(old_table);
+ }
+ else
+ array_move(array, index + 1, index, array->entries - index);
+
+ array->table[index] = value;
+ array->entries++;
+
+ return 0;
+}
+
+int json_array_remove(json_t *json, unsigned int index)
+{
+ json_array_t *array;
+
+ if(!json_is_array(json))
+ return -1;
+ array = json_to_array(json);
+
+ if(index >= array->entries)
+ return -1;
+
+ json_decref(array->table[index]);
+
+ array_move(array, index, index + 1, array->entries - index);
+ array->entries--;
+
+ return 0;
+}
+
+int json_array_clear(json_t *json)
+{
+ json_array_t *array;
+ unsigned int i;
+
+ if(!json_is_array(json))
+ return -1;
+ array = json_to_array(json);
+
+ for(i = 0; i < array->entries; i++)
+ json_decref(array->table[i]);
+
+ array->entries = 0;
+ return 0;
+}
+
+int json_array_extend(json_t *json, json_t *other_json)
+{
+ json_array_t *array, *other;
+ unsigned int i;
+
+ if(!json_is_array(json) || !json_is_array(other_json))
+ return -1;
+ array = json_to_array(json);
+ other = json_to_array(other_json);
+
+ if(!json_array_grow(array, other->entries, 1))
+ return -1;
+
+ for(i = 0; i < other->entries; i++)
+ json_incref(other->table[i]);
+
+ array_copy(array->table, array->entries, other->table, 0, other->entries);
+
+ array->entries += other->entries;
+ return 0;
+}
+
+static int json_array_equal(json_t *array1, json_t *array2)
+{
+ unsigned int i, size;
+
+ size = json_array_size(array1);
+ if(size != json_array_size(array2))
+ return 0;
+
+ for(i = 0; i < size; i++)
+ {
+ json_t *value1, *value2;
+
+ value1 = json_array_get(array1, i);
+ value2 = json_array_get(array2, i);
+
+ if(!json_equal(value1, value2))
+ return 0;
+ }
+
+ return 1;
+}
+
+static json_t *json_array_copy(json_t *array)
+{
+ json_t *result;
+ unsigned int i;
+
+ result = json_array();
+ if(!result)
+ return NULL;
+
+ for(i = 0; i < json_array_size(array); i++)
+ json_array_append(result, json_array_get(array, i));
+
+ return result;
+}
+
+static json_t *json_array_deep_copy(json_t *array)
+{
+ json_t *result;
+ unsigned int i;
+
+ result = json_array();
+ if(!result)
+ return NULL;
+
+ for(i = 0; i < json_array_size(array); i++)
+ json_array_append_new(result, json_deep_copy(json_array_get(array, i)));
+
+ return result;
+}
+
+/*** string ***/
+
+json_t *json_string_nocheck(const char *value)
+{
+ json_string_t *string;
+
+ if(!value)
+ return NULL;
+
+ string = malloc(sizeof(json_string_t));
+ if(!string)
+ return NULL;
+ json_init(&string->json, JSON_STRING);
+
+ string->value = strdup(value);
+ if(!string->value) {
+ free(string);
+ return NULL;
+ }
+
+ return &string->json;
+}
+
+json_t *json_string(const char *value)
+{
+ if(!value || !utf8_check_string(value, -1))
+ return NULL;
+
+ return json_string_nocheck(value);
+}
+
+const char *json_string_value(const json_t *json)
+{
+ if(!json_is_string(json))
+ return NULL;
+
+ return json_to_string(json)->value;
+}
+
+int json_string_set_nocheck(json_t *json, const char *value)
+{
+ char *dup;
+ json_string_t *string;
+
+ dup = strdup(value);
+ if(!dup)
+ return -1;
+
+ string = json_to_string(json);
+ free(string->value);
+ string->value = dup;
+
+ return 0;
+}
+
+int json_string_set(json_t *json, const char *value)
+{
+ if(!value || !utf8_check_string(value, -1))
+ return -1;
+
+ return json_string_set_nocheck(json, value);
+}
+
+static void json_delete_string(json_string_t *string)
+{
+ free(string->value);
+ free(string);
+}
+
+static int json_string_equal(json_t *string1, json_t *string2)
+{
+ return strcmp(json_string_value(string1), json_string_value(string2)) == 0;
+}
+
+static json_t *json_string_copy(json_t *string)
+{
+ return json_string_nocheck(json_string_value(string));
+}
+
+
+/*** integer ***/
+
+json_t *json_integer(int value)
+{
+ json_integer_t *integer = malloc(sizeof(json_integer_t));
+ if(!integer)
+ return NULL;
+ json_init(&integer->json, JSON_INTEGER);
+
+ integer->value = value;
+ return &integer->json;
+}
+
+int json_integer_value(const json_t *json)
+{
+ if(!json_is_integer(json))
+ return 0;
+
+ return json_to_integer(json)->value;
+}
+
+int json_integer_set(json_t *json, int value)
+{
+ if(!json_is_integer(json))
+ return -1;
+
+ json_to_integer(json)->value = value;
+
+ return 0;
+}
+
+static void json_delete_integer(json_integer_t *integer)
+{
+ free(integer);
+}
+
+static int json_integer_equal(json_t *integer1, json_t *integer2)
+{
+ return json_integer_value(integer1) == json_integer_value(integer2);
+}
+
+static json_t *json_integer_copy(json_t *integer)
+{
+ return json_integer(json_integer_value(integer));
+}
+
+
+/*** real ***/
+
+json_t *json_real(double value)
+{
+ json_real_t *real = malloc(sizeof(json_real_t));
+ if(!real)
+ return NULL;
+ json_init(&real->json, JSON_REAL);
+
+ real->value = value;
+ return &real->json;
+}
+
+double json_real_value(const json_t *json)
+{
+ if(!json_is_real(json))
+ return 0;
+
+ return json_to_real(json)->value;
+}
+
+int json_real_set(json_t *json, double value)
+{
+ if(!json_is_real(json))
+ return 0;
+
+ json_to_real(json)->value = value;
+
+ return 0;
+}
+
+static void json_delete_real(json_real_t *real)
+{
+ free(real);
+}
+
+static int json_real_equal(json_t *real1, json_t *real2)
+{
+ return json_real_value(real1) == json_real_value(real2);
+}
+
+static json_t *json_real_copy(json_t *real)
+{
+ return json_real(json_real_value(real));
+}
+
+
+/*** number ***/
+
+double json_number_value(const json_t *json)
+{
+ if(json_is_integer(json))
+ return json_integer_value(json);
+ else if(json_is_real(json))
+ return json_real_value(json);
+ else
+ return 0.0;
+}
+
+
+/*** simple values ***/
+
+json_t *json_true(void)
+{
+ static json_t the_true = {
+ JSON_TRUE,
+ (unsigned int)-1
+ };
+ return &the_true;
+}
+
+
+json_t *json_false(void)
+{
+ static json_t the_false = {
+ JSON_FALSE,
+ (unsigned int)-1
+ };
+ return &the_false;
+}
+
+
+json_t *json_null(void)
+{
+ static json_t the_null = {
+ JSON_NULL,
+ (unsigned int)-1
+ };
+ return &the_null;
+}
+
+
+/*** deletion ***/
+
+void json_delete(json_t *json)
+{
+ if(json_is_object(json))
+ json_delete_object(json_to_object(json));
+
+ else if(json_is_array(json))
+ json_delete_array(json_to_array(json));
+
+ else if(json_is_string(json))
+ json_delete_string(json_to_string(json));
+
+ else if(json_is_integer(json))
+ json_delete_integer(json_to_integer(json));
+
+ else if(json_is_real(json))
+ json_delete_real(json_to_real(json));
+
+ /* json_delete is not called for true, false or null */
+}
+
+
+/*** equality ***/
+
+int json_equal(json_t *json1, json_t *json2)
+{
+ if(!json1 || !json2)
+ return 0;
+
+ if(json_typeof(json1) != json_typeof(json2))
+ return 0;
+
+ /* this covers true, false and null as they are singletons */
+ if(json1 == json2)
+ return 1;
+
+ if(json_is_object(json1))
+ return json_object_equal(json1, json2);
+
+ if(json_is_array(json1))
+ return json_array_equal(json1, json2);
+
+ if(json_is_string(json1))
+ return json_string_equal(json1, json2);
+
+ if(json_is_integer(json1))
+ return json_integer_equal(json1, json2);
+
+ if(json_is_real(json1))
+ return json_real_equal(json1, json2);
+
+ return 0;
+}
+
+
+/*** copying ***/
+
+json_t *json_copy(json_t *json)
+{
+ if(!json)
+ return NULL;
+
+ if(json_is_object(json))
+ return json_object_copy(json);
+
+ if(json_is_array(json))
+ return json_array_copy(json);
+
+ if(json_is_string(json))
+ return json_string_copy(json);
+
+ if(json_is_integer(json))
+ return json_integer_copy(json);
+
+ if(json_is_real(json))
+ return json_real_copy(json);
+
+ if(json_is_true(json) || json_is_false(json) || json_is_null(json))
+ return json;
+
+ return NULL;
+}
+
+json_t *json_deep_copy(json_t *json)
+{
+ if(!json)
+ return NULL;
+
+ if(json_is_object(json))
+ return json_object_deep_copy(json);
+
+ if(json_is_array(json))
+ return json_array_deep_copy(json);
+
+ /* for the rest of the types, deep copying doesn't differ from
+ shallow copying */
+
+ if(json_is_string(json))
+ return json_string_copy(json);
+
+ if(json_is_integer(json))
+ return json_integer_copy(json);
+
+ if(json_is_real(json))
+ return json_real_copy(json);
+
+ if(json_is_true(json) || json_is_false(json) || json_is_null(json))
+ return json;
+
+ return NULL;
+}
diff --git a/compat/stdbool.h b/compat/stdbool.h
new file mode 100644
index 0000000000..31d04564de
--- /dev/null
+++ b/compat/stdbool.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#define false 0
+#define true 1
+
+#define bool int
diff --git a/compat/sys/time.h b/compat/sys/time.h
new file mode 100644
index 0000000000..0326e1dfd7
--- /dev/null
+++ b/compat/sys/time.h
@@ -0,0 +1,11 @@
+#pragma once
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+int gettimeofday(struct timeval *tv, struct timezone *tz);
+void usleep(__int64 usec);
+#ifdef __cplusplus
+}
+#endif
+typedef __int64 useconds_t;
diff --git a/compat/thrust/CHANGELOG b/compat/thrust/CHANGELOG
new file mode 100644
index 0000000000..110c6689c2
--- /dev/null
+++ b/compat/thrust/CHANGELOG
@@ -0,0 +1,662 @@
+#######################################
+# Thrust v1.7.0 #
+#######################################
+
+Summary
+ Thrust 1.7.0 introduces a new interface for controlling algorithm execution as
+ well as several new algorithms and performance improvements. With this new
+ interface, users may directly control how algorithms execute as well as details
+ such as the allocation of temporary storage. Key/value versions of thrust::merge
+ and the set operation algorithms have been added, as well stencil versions of
+ partitioning algorithms. thrust::tabulate has been introduced to tabulate the
+ values of functions taking integers. For 32b types, new CUDA merge and set
+ operations provide 2-15x faster performance while a new CUDA comparison sort
+ provides 1.3-4x faster performance. Finally, a new TBB reduce_by_key implementation
+ provides 80% faster performance.
+
+Breaking API Changes
+ Dispatch
+ Custom user backend systems' tag types must now inherit from the corresponding system's execution_policy template (e.g. thrust::cuda::execution_policy) instead
+ of the tag struct (e.g. thrust::cuda::tag). Otherwise, algorithm specializations will silently go unfound during dispatch.
+ See examples/minimal_custom_backend.cu and examples/cuda/fallback_allocator.cu for usage examples.
+
+ thrust::advance and thrust::distance are no longer dispatched based on iterator system type and thus may no longer be customized.
+
+ Iterators
+ iterator_facade and iterator_adaptor's Pointer template parameters have been eliminated.
+ iterator_adaptor has been moved into the thrust namespace (previously thrust::experimental::iterator_adaptor).
+ iterator_facade has been moved into the thrust namespace (previously thrust::experimental::iterator_facade).
+ iterator_core_access has been moved into the thrust namespace (previously thrust::experimental::iterator_core_access).
+ All iterators' nested pointer typedef (the type of the result of operator->) is now void instead of a pointer type to indicate that such expressions are currently impossible.
+ Floating point counting_iterators' nested difference_type typedef is now a signed integral type instead of a floating point type.
+
+ Other
+ normal_distribution has been moved into the thrust::random namespace (previously thrust::random::experimental::normal_distribution).
+ Placeholder expressions may no longer include the comma operator.
+
+New Features
+ Execution Policies
+ Users may directly control the dispatch of algorithm invocations with optional execution policy arguments.
+ For example, instead of wrapping raw pointers allocated by cudaMalloc with thrust::device_ptr, the thrust::device execution_policy may be passed as an argument to an algorithm invocation to enable CUDA execution.
+ The following execution policies are supported in this version:
+
+ thrust::host
+ thrust::device
+ thrust::cpp::par
+ thrust::cuda::par
+ thrust::omp::par
+ thrust::tbb::par
+
+ Algorithms
+ free
+ get_temporary_buffer
+ malloc
+ merge_by_key
+ partition with stencil
+ partition_copy with stencil
+ return_temporary_buffer
+ set_difference_by_key
+ set_intersection_by_key
+ set_symmetric_difference_by_key
+ set_union_by_key
+ stable_partition with stencil
+ stable_partition_copy with stencil
+ tabulate
+
+New Examples
+ uninitialized_vector demonstrates how to use a custom allocator to avoid the automatic initialization of elements in thrust::device_vector.
+
+Other Enhancements
+ Authors of custom backend systems may manipulate arbitrary state during algorithm dispatch by incorporating it into their execution_policy parameter.
+ Users may control the allocation of temporary storage during algorithm execution by passing standard allocators as parameters via execution policies such as thrust::device.
+ THRUST_DEVICE_SYSTEM_CPP has been added as a compile-time target for the device backend.
+ CUDA merge performance is 2-15x faster.
+ CUDA comparison sort performance is 1.3-4x faster.
+ CUDA set operation performance is 1.5-15x faster.
+ TBB reduce_by_key performance is 80% faster.
+ Several algorithms have been parallelized with TBB.
+ Support for user allocators in vectors has been improved.
+ The sparse_vector example is now implemented with merge_by_key instead of sort_by_key.
+ Warnings have been eliminated in various contexts.
+ Warnings about __host__ or __device__-only functions called from __host__ __device__ functions have been eliminated in various contexts.
+ Documentation about algorithm requirements have been improved.
+ Simplified the minimal_custom_backend example.
+ Simplified the cuda/custom_temporary_allocation example.
+ Simplified the cuda/fallback_allocator example.
+
+Bug Fixes
+ #248 fix broken counting_iterator behavior with OpenMP
+ #231, #209 fix set operation failures with CUDA
+ #187 fix incorrect occupancy calculation with CUDA
+ #153 fix broken multigpu behavior with CUDA
+ #142 eliminate warning produced by thrust::random::taus88 and MSVC 2010
+ #208 correctly initialize elements in temporary storage when necessary
+ #16 fix compilation error when sorting bool with CUDA
+ #10 fix ambiguous overloads of reinterpret_tag
+
+Known Issues
+ g++ versions 4.3 and lower may fail to dispatch thrust::get_temporary_buffer correctly causing infinite recursion in examples such as cuda/custom_temporary_allocation.
+
+Acknowledgments
+ Thanks to Sean Baxter, Bryan Catanzaro, and Manjunath Kudlur for contributing a faster merge implementation for CUDA.
+ Thanks to Sean Baxter for contributing a faster set operation implementation for CUDA.
+ Thanks to Cliff Woolley for contributing a correct occupancy calculation algorithm.
+
+#######################################
+# Thrust v1.6.0 #
+#######################################
+
+Summary
+ Thrust v1.6.0 provides an interface for customization and extension and a new
+ backend system based on the Threading Building Blocks library. With this
+ new interface, programmers may customize the behavior of specific algorithms
+ as well as control the allocation of temporary storage or invent entirely new
+ backends. These enhancements also allow multiple different backend systems
+ such as CUDA and OpenMP to coexist within a single program. Support for TBB
+ allows Thrust programs to integrate more naturally into applications which
+ may already employ the TBB task scheduler.
+
+Breaking API Changes
+ The header has been moved to
+ thrust::experimental::cuda::pinned_allocator has been moved to thrust::cuda::experimental::pinned_allocator
+ The macro THRUST_DEVICE_BACKEND has been renamed THRUST_DEVICE_SYSTEM
+ The macro THRUST_DEVICE_BACKEND_CUDA has been renamed THRUST_DEVICE_SYSTEM_CUDA
+ The macro THRUST_DEVICE_BACKEND_OMP has been renamed THRUST_DEVICE_SYSTEM_OMP
+ thrust::host_space_tag has been renamed thrust::host_system_tag
+ thrust::device_space_tag has been renamed thrust::device_system_tag
+ thrust::any_space_tag has been renamed thrust::any_system_tag
+ thrust::iterator_space has been renamed thrust::iterator_system
+
+
+New Features
+ Backend Systems
+ Threading Building Blocks (TBB) is now supported
+ Functions
+ for_each_n
+ raw_reference_cast
+ Types
+ pointer
+ reference
+
+New Examples
+ cuda/custom_temporary_allocation
+ cuda/fallback_allocator
+ device_ptr
+ expand
+ minimal_custom_backend
+ raw_reference_cast
+ set_operations
+
+Other Enhancements
+ thrust::for_each now returns the end of the input range similar to most other algorithms
+ thrust::pair and thrust::tuple have swap functionality
+ all CUDA algorithms now support large data types
+ iterators may be dereferenced in user __device__ or __global__ functions
+ the safe use of different backend systems is now possible within a single binary
+
+Bug Fixes
+ #469 min_element and max_element algorithms no longer require a const comparison operator
+
+Known Issues
+ cudafe++.exe may crash when parsing TBB headers on Windows.
+
+#######################################
+# Thrust v1.5.3 #
+#######################################
+
+Summary
+ Small bug fixes
+
+Bug Fixes
+ Avoid warnings about potential race due to __shared__ non-POD variable
+
+#######################################
+# Thrust v1.5.2 #
+#######################################
+
+Summary
+ Small bug fixes
+
+Bug Fixes
+ Fixed warning about C-style initialization of structures
+
+#######################################
+# Thrust v1.5.1 #
+#######################################
+
+Summary
+ Small bug fixes
+
+Bug Fixes
+ Sorting data referenced by permutation_iterators on CUDA produces invalid results
+
+#######################################
+# Thrust v1.5.0 #
+#######################################
+
+Summary
+ Thrust v1.5.0 provides introduces new programmer productivity and performance
+ enhancements. New functionality for creating anonymous "lambda" functions has
+ been added. A faster host sort provides 2-10x faster performance for sorting
+ arithmetic types on (single-threaded) CPUs. A new OpenMP sort provides
+ 2.5x-3.0x speedup over the host sort using a quad-core CPU. When sorting
+ arithmetic types with the OpenMP backend the combined performance improvement
+ is 5.9x for 32-bit integers and ranges from 3.0x (64-bit types) to 14.2x
+ (8-bit types). A new CUDA reduce_by_key implementation provides 2-3x faster
+ performance.
+
+Breaking API Changes
+ device_ptr no longer unsafely converts to device_ptr without an
+ explicit cast. Use the expression
+ device_pointer_cast(static_cast(void_ptr.get()))
+ to convert, for example, device_ptr to device_ptr.
+
+New Features
+ Functions
+ stencil-less transform_if
+
+ Types
+ lambda placeholders
+
+New Examples
+ lambda
+
+Other Enhancements
+ host sort is 2-10x faster for arithmetic types
+ OMP sort provides speedup over host sort
+ reduce_by_key is 2-3x faster
+ reduce_by_key no longer requires O(N) temporary storage
+ CUDA scan algorithms are 10-40% faster
+ host_vector and device_vector are now documented
+ out-of-memory exceptions now provide detailed information from CUDART
+ improved histogram example
+ device_reference now has a specialized swap
+ reduce_by_key and scan algorithms are compatible with discard_iterator
+
+Removed Functionality
+
+Bug Fixes
+ #44 allow host_vector to compile when value_type uses __align__
+ #198 allow adjacent_difference to permit safe in-situ operation
+ #303 make thrust thread-safe
+ #313 avoid race conditions in device_vector::insert
+ #314 avoid unintended adl invocation when dispatching copy
+ #365 fix merge and set operation failures
+
+Known Issues
+ None
+
+Acknowledgments
+ Thanks to Manjunath Kudlur for contributing his Carbon library, from which the lambda functionality is derived.
+ Thanks to Jean-Francois Bastien for suggesting a fix for issue 303.
+
+#######################################
+# Thrust v1.4.0 #
+#######################################
+
+Summary
+ Thrust v1.4.0 provides support for CUDA 4.0 in addition to many feature
+ and performance improvements. New set theoretic algorithms operating on
+ sorted sequences have been added. Additionally, a new fancy iterator
+ allows discarding redundant or otherwise unnecessary output from
+ algorithms, conserving memory storage and bandwidth.
+
+Breaking API Changes
+ Eliminations
+ thrust/is_sorted.h
+ thrust/utility.h
+ thrust/set_intersection.h
+ thrust/experimental/cuda/ogl_interop_allocator.h and the functionality therein
+ thrust::deprecated::copy_when
+ thrust::deprecated::absolute_value
+
+New Features
+ Functions
+ copy_n
+ merge
+ set_difference
+ set_symmetric_difference
+ set_union
+
+ Types
+ discard_iterator
+
+ Device support
+ Compute Capability 2.1 GPUs
+
+New Examples
+ run_length_decoding
+
+Other Enhancements
+ Compilation warnings are substantially reduced in various contexts.
+ The compilation time of thrust::sort, thrust::stable_sort, thrust::sort_by_key,
+ and thrust::stable_sort_by_key are substantially reduced.
+ A fast sort implementation is used when sorting primitive types with thrust::greater.
+ The performance of thrust::set_intersection is improved.
+ The performance of thrust::fill is improved on SM 1.x devices.
+ A code example is now provided in each algorithm's documentation.
+ thrust::reverse now operates in-place
+
+Removed Functionality
+ thrust::deprecated::copy_when
+ thrust::deprecated::absolute_value
+ thrust::experimental::cuda::ogl_interop_allocator
+ thrust::gather and thrust::scatter from host to device and vice versa are no longer supported.
+ Operations which modify the elements of a thrust::device_vector are no longer
+ available from source code compiled without nvcc when the device backend is CUDA.
+ Instead, use the idiom from the cpp_interop example.
+
+Bug Fixes
+ #212 set_intersection works correctly for large input sizes.
+ #275 counting_iterator and constant_iterator work correctly with OpenMP as the
+ backend when compiling with optimization
+ #256 min and max correctly return their first argument as a tie-breaker
+ #248 NDEBUG is interpreted correctly
+
+Known Issues
+ nvcc may generate code containing warnings when compiling some Thrust algorithms.
+ When compiling with -arch=sm_1x, some Thrust algorithms may cause nvcc to issue
+ benign pointer advisories.
+ When compiling with -arch=sm_1x and -G, some Thrust algorithms may fail to execute correctly.
+ thrust::inclusive_scan, thrust::exclusive_scan, thrust::inclusive_scan_by_key,
+ and thrust::exclusive_scan_by_key are currently incompatible with thrust::discard_iterator.
+
+Acknowledgments
+ Thanks to David Tarjan for improving the performance of set_intersection.
+ Thanks to Duane Merrill for continued help with sort.
+ Thanks to Nathan Whitehead for help with CUDA Toolkit integration.
+
+#######################################
+# Thrust v1.3.0 #
+#######################################
+
+Summary
+ Thrust v1.3.0 provides support for CUDA 3.2 in addition to many feature
+ and performance enhancements.
+
+ Performance of the sort and sort_by_key algorithms is improved by as much
+ as 3x in certain situations. The performance of stream compaction algorithms,
+ such as copy_if, is improved by as much as 2x. Reduction performance is
+ also improved, particularly for small input sizes.
+
+ CUDA errors are now converted to runtime exceptions using the system_error
+ interface. Combined with a debug mode, also new in v1.3, runtime errors
+ can be located with greater precision.
+
+ Lastly, a few header files have been consolidated or renamed for clarity.
+ See the deprecations section below for additional details.
+
+
+Breaking API Changes
+ Promotions
+ thrust::experimental::inclusive_segmented_scan has been renamed thrust::inclusive_scan_by_key and exposes a different interface
+ thrust::experimental::exclusive_segmented_scan has been renamed thrust::exclusive_scan_by_key and exposes a different interface
+ thrust::experimental::partition_copy has been renamed thrust::partition_copy and exposes a different interface
+ thrust::next::gather has been renamed thrust::gather
+ thrust::next::gather_if has been renamed thrust::gather_if
+ thrust::unique_copy_by_key has been renamed thrust::unique_by_key_copy
+ Deprecations
+ thrust::copy_when has been renamed thrust::deprecated::copy_when
+ thrust::absolute_value has been renamed thrust::deprecated::absolute_value
+ The header thrust/set_intersection.h is now deprecated; use thrust/set_operations.h instead
+ The header thrust/utility.h is now deprecated; use thrust/swap.h instead
+ The header thrust/swap_ranges.h is now deprecated; use thrust/swap.h instead
+ Eliminations
+ thrust::deprecated::gather
+ thrust::deprecated::gather_if
+ thrust/experimental/arch.h and the functions therein
+ thrust/sorting/merge_sort.h
+ thrust/sorting/radix_sort.h
+
+New Features
+ Functions
+ exclusive_scan_by_key
+ find
+ find_if
+ find_if_not
+ inclusive_scan_by_key
+ is_partitioned
+ is_sorted_until
+ mismatch
+ partition_point
+ reverse
+ reverse_copy
+ stable_partition_copy
+
+ Types
+ system_error and related types
+ experimental::cuda::ogl_interop_allocator
+ bit_and, bit_or, and bit_xor
+
+ Device support
+ gf104-based GPUs
+
+New Examples
+ opengl_interop.cu
+ repeated_range.cu
+ simple_moving_average.cu
+ sparse_vector.cu
+ strided_range.cu
+
+Other Enhancements
+ Performance of thrust::sort and thrust::sort_by_key is substantially improved for primitive key types
+ Performance of thrust::copy_if is substantially improved
+ Performance of thrust::reduce and related reductions is improved
+ THRUST_DEBUG mode added
+ Callers of Thrust functions may detect error conditions by catching thrust::system_error, which derives from std::runtime_error
+ The number of compiler warnings generated by Thrust has been substantially reduced
+ Comparison sort now works correctly for input sizes > 32M
+ min & max usage no longer collides with definitions
+ Compiling against the OpenMP backend no longer requires nvcc
+ Performance of device_vector initialized in .cpp files is substantially improved in common cases
+ Performance of thrust::sort_by_key on the host is substantially improved
+
+Removed Functionality
+ nvcc 2.3 is no longer supported
+
+Bug Fixes
+ Debug device code now compiles correctly
+ thrust::uninitialized_copy and thrust::unintialized_fill now dispatch constructors on the device rather than the host
+
+Known Issues
+ #212 set_intersection is known to fail for large input sizes
+ partition_point is known to fail for 64b types with nvcc 3.2
+
+Acknowledgments
+ Thanks to Duane Merrill for contributing a fast CUDA radix sort implementation
+ Thanks to Erich Elsen for contributing an implementation of find_if
+ Thanks to Andrew Corrigan for contributing changes which allow the OpenMP backend to compile in the absence of nvcc
+ Thanks to Andrew Corrigan, Cliff Wooley, David Coeurjolly, Janick Martinez Esturo, John Bowers, Maxim Naumov, Michael Garland, and Ryuta Suzuki for bug reports
+ Thanks to Cliff Woolley for help with testing
+
+#######################################
+# Thrust v1.2.1 #
+#######################################
+
+Summary
+ Small fixes for compatibility with CUDA 3.1
+
+Known Issues
+ inclusive_scan & exclusive_scan may fail with very large types
+ the Microsoft compiler may fail to compile code using both sort and binary search algorithms
+ uninitialized_fill & uninitialized_copy dispatch constructors on the host rather than the device
+ # 109 some algorithms may exhibit poor performance with the OpenMP backend with large numbers (>= 6) of CPU threads
+ default_random_engine::discard is not accelerated with nvcc 2.3
+ nvcc 3.1 may fail to compile code using types derived from thrust::subtract_with_carry_engine, such as thrust::ranlux24 & thrust::ranlux48.
+
+#######################################
+# Thrust v1.2.0 #
+#######################################
+
+Summary
+ Thrust v1.2 introduces support for compilation to multicore CPUs
+ and the Ocelot virtual machine, and several new facilities for
+ pseudo-random number generation. New algorithms such as set
+ intersection and segmented reduction have also been added. Lastly,
+ improvements to the robustness of the CUDA backend ensure
+ correctness across a broad set of (uncommon) use cases.
+
+Breaking API Changes
+ thrust::gather's interface was incorrect and has been removed.
+ The old interface is deprecated but will be preserved for Thrust
+ version 1.2 at thrust::deprecated::gather &
+ thrust::deprecated::gather_if. The new interface is provided at
+ thrust::next::gather & thrust::next::gather_if. The new interface
+ will be promoted to thrust:: in Thrust version 1.3. For more details,
+ please refer to this thread:
+ http://groups.google.com/group/thrust-users/browse_thread/thread/f5f0583cb97b51fd
+
+ The thrust::sorting namespace has been deprecated in favor of the
+ top-level sorting functions, such as thrust::sort() and
+ thrust::sort_by_key().
+
+New Features
+ Functions
+ reduce_by_key
+ set_intersection
+ tie
+ unique_copy
+ unique_by_key
+ unique_copy_by_key
+
+ Types
+ Random Number Generation
+ discard_block_engine
+ default_random_engine
+ linear_congruential_engine
+ linear_feedback_shift_engine
+ minstd_rand
+ minstd_rand0
+ normal_distribution (experimental)
+ ranlux24
+ ranlux48
+ ranlux24_base
+ ranlux48_base
+ subtract_with_carry_engine
+ taus88
+ uniform_int_distribution
+ uniform_real_distribution
+ xor_combine_engine
+ Functionals
+ project1st
+ project2nd
+
+ Fancy Iterators
+ permutation_iterator
+ reverse_iterator
+
+ Device support
+ Add support for multicore CPUs via OpenMP
+ Add support for Fermi-class GPUs
+ Add support for Ocelot virtual machine
+
+New Examples
+ cpp_integration
+ histogram
+ mode
+ monte_carlo
+ monte_carlo_disjoint_sequences
+ padded_grid_reduction
+ permutation_iterator
+ row_sum
+ run_length_encoding
+ segmented_scan
+ stream_compaction
+ summary_statistics
+ transform_iterator
+ word_count
+
+Other Enhancements
+ vector functions operator!=, rbegin, crbegin, rend, crend, data, & shrink_to_fit
+ integer sorting performance is improved when max is large but (max - min) is small and when min is negative
+ performance of inclusive_scan() and exclusive_scan() is improved by 20-25% for primitive types
+ support for nvcc 3.0
+
+Removed Functionality
+ removed support for equal between host & device sequences
+ removed support for gather() and scatter() between host & device sequences
+
+Bug Fixes
+ # 8 cause a compiler error if the required compiler is not found rather than a mysterious error at link time
+ # 42 device_ptr & device_reference are classes rather than structs, eliminating warnings on certain platforms
+ # 46 gather & scatter handle any space iterators correctly
+ # 51 thrust::experimental::arch functions gracefully handle unrecognized GPUs
+ # 52 avoid collisions with common user macros such as BLOCK_SIZE
+ # 62 provide better documentation for device_reference
+ # 68 allow built-in CUDA vector types to work with device_vector in pure C++ mode
+ # 102 eliminated a race condition in device_vector::erase
+ various compilation warnings eliminated
+
+Known Issues
+ inclusive_scan & exclusive_scan may fail with very large types
+ the Microsoft compiler may fail to compile code using both sort and binary search algorithms
+ uninitialized_fill & uninitialized_copy dispatch constructors on the host rather than the device
+ # 109 some algorithms may exhibit poor performance with the OpenMP backend with large numbers (>= 6) of CPU threads
+ default_random_engine::discard is not accelerated with nvcc 2.3
+
+Acknowledgments
+ Thanks to Gregory Diamos for contributing a CUDA implementation of set_intersection
+ Thanks to Ryuta Suzuki & Gregory Diamos for rigorously testing Thrust's unit tests and examples against Ocelot
+ Thanks to Tom Bradley for contributing an implementation of normal_distribution
+ Thanks to Joseph Rhoads for contributing the example summary_statistics
+
+#######################################
+# Thrust v1.1.1 #
+#######################################
+
+Summary
+ Small fixes for compatibility with CUDA 2.3a and Mac OSX Snow Leopard.
+
+#######################################
+# Thrust v1.1.0 #
+#######################################
+
+Summary
+ Thrust v1.1 introduces fancy iterators, binary search functions, and
+ several specialized reduction functions. Experimental support for
+ segmented scan has also been added.
+
+Breaking API Changes
+ counting_iterator has been moved into the thrust namespace (previously thrust::experimental)
+
+New Features
+ Functions
+ copy_if
+ lower_bound
+ upper_bound
+ vectorized lower_bound
+ vectorized upper_bound
+ equal_range
+ binary_search
+ vectorized binary_search
+ all_of
+ any_of
+ none_of
+ minmax_element
+ advance
+ inclusive_segmented_scan (experimental)
+ exclusive_segmented_scan (experimental)
+
+ Types
+ pair
+ tuple
+ device_malloc_allocator
+
+ Fancy Iterators
+ constant_iterator
+ counting_iterator
+ transform_iterator
+ zip_iterator
+
+New Examples
+ computing the maximum absolute difference between vectors
+ computing the bounding box of a two-dimensional point set
+ sorting multiple arrays together (lexicographical sorting)
+ constructing a summed area table
+ using zip_iterator to mimic an array of structs
+ using constant_iterator to increment array values
+
+Other Enhancements
+ added pinned memory allocator (experimental)
+ added more methods to host_vector & device_vector (issue #4)
+ added variant of remove_if with a stencil argument (issue #29)
+ scan and reduce use cudaFuncGetAttributes to determine grid size
+ exceptions are reported when temporary device arrays cannot be allocated
+
+Bug Fixes
+ #5 make vector work for larger data types
+ #9 stable_partition_copy doesn't respect OutputIterator concept semantics
+ #10 scans should return OutputIterator
+ #16 make algorithms work for larger data types
+ #27 dispatch radix_sort even when comp=less is explicitly provided
+
+Known Issues
+ Using functors with Thrust entry points may not compile on Mac OSX with gcc-4.0.1
+ uninitialized_copy & uninitialized_fill dispatch constructors on the host rather than the device.
+ inclusive_scan, inclusive_scan_by_key, exclusive_scan, and exclusive_scan_by_key may fail when used with large types with the CUDA 3.1 driver
+
+
+#######################################
+# Thrust v1.0.0 #
+#######################################
+
+Breaking API changes
+ Rename top level namespace komrade to thrust.
+ Move partition_copy() & stable_partition_copy() into thrust::experimental namespace until we can easily provide the standard interface.
+ Rename range() to sequence() to avoid collision with Boost.Range.
+ Rename copy_if() to copy_when() due to semantic differences with C++0x copy_if().
+
+New Features
+ Add C++0x style cbegin() & cend() methods to host_vector & device_vector.
+ Add transform_if function.
+ Add stencil versions of replace_if() & replace_copy_if().
+ Allow counting_iterator to work with for_each().
+ Allow types with constructors in comparison sort & reduce.
+
+Other Enhancements
+ merge_sort and stable_merge_sort are now 2 to 5x faster when executed on the parallel device.
+
+Bug fixes
+ Workaround an issue where an incremented iterator causes nvcc to crash. (Komrade issue #6)
+ Fix an issue where const_iterators could not be passed to transform. (Komrade issue #7)
+
diff --git a/compat/thrust/adjacent_difference.h b/compat/thrust/adjacent_difference.h
new file mode 100644
index 0000000000..772b5f993f
--- /dev/null
+++ b/compat/thrust/adjacent_difference.h
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2008-2012 NVIDIA Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*! \file adjacent_difference.h
+ * \brief Compute difference between consecutive elements of a range
+ */
+
+#pragma once
+
+#include
+#include
+
+namespace thrust
+{
+
+
+/*! \addtogroup transformations Transformations
+ * \{
+ */
+
+
+/*! \p adjacent_difference calculates the differences of adjacent elements in the
+ * range [first, last). That is, \*first is assigned to
+ * \*result, and, for each iterator \p i in the range
+ * [first + 1, last), the difference of \*i and *(i - 1)
+ * is assigned to \*(result + (i - first)).
+ *
+ * This version of \p adjacent_difference uses operator- to calculate
+ * differences.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the input range.
+ * \param last The end of the input range.
+ * \param result The beginning of the output range.
+ * \return The iterator result + (last - first)
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam InputIterator is a model of Input Iterator,
+ * and \c x and \c y are objects of \p InputIterator's \c value_type, then \c x - \c is defined,
+ * and \p InputIterator's \c value_type is convertible to a type in \p OutputIterator's set of \c value_types,
+ * and the return type of x - y is convertible to a type in \p OutputIterator's set of \c value_types.
+ * \tparam OutputIterator is a model of Output Iterator.
+ *
+ * \remark Note that \p result is permitted to be the same iterator as \p first. This is
+ * useful for computing differences "in place".
+ *
+ * The following code snippet demonstrates how to use \p adjacent_difference to compute
+ * the difference between adjacent elements of a range using the \p thrust::device execution policy:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * int h_data[8] = {1, 2, 1, 2, 1, 2, 1, 2};
+ * thrust::device_vector d_data(h_data, h_data + 8);
+ * thrust::device_vector d_result(8);
+ *
+ * thrust::adjacent_difference(thrust::device, d_data.begin(), d_data.end(), d_result.begin());
+ *
+ * // d_result is now [1, 1, -1, 1, -1, 1, -1, 1]
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/adjacent_difference.html
+ * \see inclusive_scan
+ */
+template
+OutputIterator adjacent_difference(const thrust::detail::execution_policy_base &exec,
+ InputIterator first, InputIterator last,
+ OutputIterator result);
+
+/*! \p adjacent_difference calculates the differences of adjacent elements in the
+ * range [first, last). That is, *first is assigned to
+ * \*result, and, for each iterator \p i in the range
+ * [first + 1, last), binary_op(\*i, \*(i - 1)) is assigned to
+ * \*(result + (i - first)).
+ *
+ * This version of \p adjacent_difference uses the binary function \p binary_op to
+ * calculate differences.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the input range.
+ * \param last The end of the input range.
+ * \param result The beginning of the output range.
+ * \param binary_op The binary function used to compute differences.
+ * \return The iterator result + (last - first)
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam InputIterator is a model of Input Iterator,
+ * and \p InputIterator's \c value_type is convertible to \p BinaryFunction's \c first_argument_type and \c second_argument_type,
+ * and \p InputIterator's \c value_type is convertible to a type in \p OutputIterator's set of \c value_types.
+ * \tparam OutputIterator is a model of Output Iterator.
+ * \tparam BinaryFunction's \c result_type is convertible to a type in \p OutputIterator's set of \c value_types.
+ *
+ * \remark Note that \p result is permitted to be the same iterator as \p first. This is
+ * useful for computing differences "in place".
+ *
+ * The following code snippet demonstrates how to use \p adjacent_difference to compute
+ * the sum between adjacent elements of a range using the \p thrust::device execution policy:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * #include
+ * ...
+ * int h_data[8] = {1, 2, 1, 2, 1, 2, 1, 2};
+ * thrust::device_vector d_data(h_data, h_data + 8);
+ * thrust::device_vector d_result(8);
+ *
+ * thrust::adjacent_difference(thrust::device, d_data.begin(), d_data.end(), d_result.begin(), thrust::plus());
+ *
+ * // d_data is now [1, 3, 3, 3, 3, 3, 3, 3]
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/adjacent_difference.html
+ * \see inclusive_scan
+ */
+template
+OutputIterator adjacent_difference(const thrust::detail::execution_policy_base &exec,
+ InputIterator first, InputIterator last,
+ OutputIterator result,
+ BinaryFunction binary_op);
+
+/*! \p adjacent_difference calculates the differences of adjacent elements in the
+ * range [first, last). That is, \*first is assigned to
+ * \*result, and, for each iterator \p i in the range
+ * [first + 1, last), the difference of \*i and *(i - 1)
+ * is assigned to \*(result + (i - first)).
+ *
+ * This version of \p adjacent_difference uses operator- to calculate
+ * differences.
+ *
+ * \param first The beginning of the input range.
+ * \param last The end of the input range.
+ * \param result The beginning of the output range.
+ * \return The iterator result + (last - first)
+ *
+ * \tparam InputIterator is a model of Input Iterator,
+ * and \c x and \c y are objects of \p InputIterator's \c value_type, then \c x - \c is defined,
+ * and \p InputIterator's \c value_type is convertible to a type in \p OutputIterator's set of \c value_types,
+ * and the return type of x - y is convertible to a type in \p OutputIterator's set of \c value_types.
+ * \tparam OutputIterator is a model of Output Iterator.
+ *
+ * \remark Note that \p result is permitted to be the same iterator as \p first. This is
+ * useful for computing differences "in place".
+ *
+ * The following code snippet demonstrates how to use \p adjacent_difference to compute
+ * the difference between adjacent elements of a range.
+ *
+ * \code
+ * #include
+ * #include
+ * ...
+ * int h_data[8] = {1, 2, 1, 2, 1, 2, 1, 2};
+ * thrust::device_vector d_data(h_data, h_data + 8);
+ * thrust::device_vector d_result(8);
+ *
+ * thrust::adjacent_difference(d_data.begin(), d_data.end(), d_result.begin());
+ *
+ * // d_result is now [1, 1, -1, 1, -1, 1, -1, 1]
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/adjacent_difference.html
+ * \see inclusive_scan
+ */
+template
+OutputIterator adjacent_difference(InputIterator first, InputIterator last,
+ OutputIterator result);
+
+/*! \p adjacent_difference calculates the differences of adjacent elements in the
+ * range [first, last). That is, *first is assigned to
+ * \*result, and, for each iterator \p i in the range
+ * [first + 1, last), binary_op(\*i, \*(i - 1)) is assigned to
+ * \*(result + (i - first)).
+ *
+ * This version of \p adjacent_difference uses the binary function \p binary_op to
+ * calculate differences.
+ *
+ * \param first The beginning of the input range.
+ * \param last The end of the input range.
+ * \param result The beginning of the output range.
+ * \param binary_op The binary function used to compute differences.
+ * \return The iterator result + (last - first)
+ *
+ * \tparam InputIterator is a model of Input Iterator,
+ * and \p InputIterator's \c value_type is convertible to \p BinaryFunction's \c first_argument_type and \c second_argument_type,
+ * and \p InputIterator's \c value_type is convertible to a type in \p OutputIterator's set of \c value_types.
+ * \tparam OutputIterator is a model of Output Iterator.
+ * \tparam BinaryFunction's \c result_type is convertible to a type in \p OutputIterator's set of \c value_types.
+ *
+ * \remark Note that \p result is permitted to be the same iterator as \p first. This is
+ * useful for computing differences "in place".
+ *
+ * The following code snippet demonstrates how to use \p adjacent_difference to compute
+ * the sum between adjacent elements of a range.
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * int h_data[8] = {1, 2, 1, 2, 1, 2, 1, 2};
+ * thrust::device_vector d_data(h_data, h_data + 8);
+ * thrust::device_vector d_result(8);
+ *
+ * thrust::adjacent_difference(d_data.begin(), d_data.end(), d_result.begin(), thrust::plus());
+ *
+ * // d_data is now [1, 3, 3, 3, 3, 3, 3, 3]
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/adjacent_difference.html
+ * \see inclusive_scan
+ */
+template
+OutputIterator adjacent_difference(InputIterator first, InputIterator last,
+ OutputIterator result,
+ BinaryFunction binary_op);
+
+/*! \}
+ */
+
+} // end namespace thrust
+
+#include
+
diff --git a/compat/thrust/advance.h b/compat/thrust/advance.h
new file mode 100644
index 0000000000..e7f60b0d54
--- /dev/null
+++ b/compat/thrust/advance.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2008-2012 NVIDIA Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*! \file advance.h
+ * \brief Advance an iterator by a given distance.
+ */
+
+#pragma once
+
+#include
+
+namespace thrust
+{
+
+
+/*! \addtogroup iterators
+ * \{
+ */
+
+/*! \p advance(i, n) increments the iterator \p i by the distance \p n.
+ * If n > 0 it is equivalent to executing ++i \p n
+ * times, and if n < 0 it is equivalent to executing --i
+ * \p n times. If n == 0, the call has no effect.
+ *
+ * \param i The iterator to be advanced.
+ * \param n The distance by which to advance the iterator.
+ *
+ * \tparam InputIterator is a model of Input Iterator.
+ * \tparam Distance is an integral type that is convertible to \p InputIterator's distance type.
+ *
+ * \pre \p n shall be negative only for bidirectional and random access iterators.
+ *
+ * The following code snippet demonstrates how to use \p advance to increment
+ * an iterator a given number of times.
+ *
+ * \code
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector vec(13);
+ * thrust::device_vector::iterator iter = vec.begin();
+ *
+ * thrust::advance(iter, 7);
+ *
+ * // iter - vec.begin() == 7
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/advance.html
+ */
+template
+void advance(InputIterator& i, Distance n);
+
+/*! \} // end iterators
+ */
+
+} // end thrust
+
+#include
+
diff --git a/compat/thrust/binary_search.h b/compat/thrust/binary_search.h
new file mode 100644
index 0000000000..d2ac5a621e
--- /dev/null
+++ b/compat/thrust/binary_search.h
@@ -0,0 +1,1888 @@
+/*
+ * Copyright 2008-2012 NVIDIA Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*! \file binary_search.h
+ * \brief Search for values in sorted ranges.
+ */
+
+#pragma once
+
+#include
+#include
+#include
+
+namespace thrust
+{
+
+
+/*! \addtogroup algorithms
+ */
+
+
+/*! \addtogroup searching
+ * \ingroup algorithms
+ * \{
+ */
+
+
+/*! \addtogroup binary_search Binary Search
+ * \ingroup searching
+ * \{
+ */
+
+
+//////////////////////
+// Scalar Functions //
+//////////////////////
+
+
+/*! \p lower_bound is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * Specifically, it returns the first position where value could be
+ * inserted without violating the ordering. This version of
+ * \p lower_bound uses operator< for comparison and returns
+ * the furthermost iterator \c i in [first, last) such that,
+ * for every iterator \c j in [first, i), *j < value.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \return The furthermost iterator \c i, such that *i < value.
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam LessThanComparable is a model of LessThanComparable.
+ *
+ * The following code snippet demonstrates how to use \p lower_bound
+ * to search for values in a ordered range using the \p thrust::device execution policy for parallelization:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::lower_bound(thrust::device, input.begin(), input.end(), 0); // returns input.begin()
+ * thrust::lower_bound(thrust::device, input.begin(), input.end(), 1); // returns input.begin() + 1
+ * thrust::lower_bound(thrust::device, input.begin(), input.end(), 2); // returns input.begin() + 1
+ * thrust::lower_bound(thrust::device, input.begin(), input.end(), 3); // returns input.begin() + 2
+ * thrust::lower_bound(thrust::device, input.begin(), input.end(), 8); // returns input.begin() + 4
+ * thrust::lower_bound(thrust::device, input.begin(), input.end(), 9); // returns input.end()
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/lower_bound.html
+ * \see \p upper_bound
+ * \see \p equal_range
+ * \see \p binary_search
+ */
+template
+ForwardIterator lower_bound(const thrust::detail::execution_policy_base &exec,
+ ForwardIterator first,
+ ForwardIterator last,
+ const LessThanComparable &value);
+
+
+/*! \p lower_bound is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * Specifically, it returns the first position where value could be
+ * inserted without violating the ordering. This version of
+ * \p lower_bound uses operator< for comparison and returns
+ * the furthermost iterator \c i in [first, last) such that,
+ * for every iterator \c j in [first, i), *j < value.
+ *
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \return The furthermost iterator \c i, such that *i < value.
+ *
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam LessThanComparable is a model of LessThanComparable.
+ *
+ * The following code snippet demonstrates how to use \p lower_bound
+ * to search for values in a ordered range.
+ *
+ * \code
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::lower_bound(input.begin(), input.end(), 0); // returns input.begin()
+ * thrust::lower_bound(input.begin(), input.end(), 1); // returns input.begin() + 1
+ * thrust::lower_bound(input.begin(), input.end(), 2); // returns input.begin() + 1
+ * thrust::lower_bound(input.begin(), input.end(), 3); // returns input.begin() + 2
+ * thrust::lower_bound(input.begin(), input.end(), 8); // returns input.begin() + 4
+ * thrust::lower_bound(input.begin(), input.end(), 9); // returns input.end()
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/lower_bound.html
+ * \see \p upper_bound
+ * \see \p equal_range
+ * \see \p binary_search
+ */
+template
+ForwardIterator lower_bound(ForwardIterator first,
+ ForwardIterator last,
+ const LessThanComparable& value);
+
+
+/*! \p lower_bound is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * Specifically, it returns the first position where value could be
+ * inserted without violating the ordering. This version of
+ * \p lower_bound uses function object \c comp for comparison
+ * and returns the furthermost iterator \c i in [first, last)
+ * such that, for every iterator \c j in [first, i),
+ * comp(*j, value) is \c true.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \param comp The comparison operator.
+ * \return The furthermost iterator \c i, such that comp(*i, value) is \c true.
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam T is comparable to \p ForwardIterator's \c value_type.
+ * \tparam StrictWeakOrdering is a model of Strict Weak Ordering.
+ *
+ * The following code snippet demonstrates how to use \p lower_bound
+ * to search for values in a ordered range using the \p thrust::device execution policy for parallelization:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::lower_bound(input.begin(), input.end(), 0, thrust::less()); // returns input.begin()
+ * thrust::lower_bound(input.begin(), input.end(), 1, thrust::less()); // returns input.begin() + 1
+ * thrust::lower_bound(input.begin(), input.end(), 2, thrust::less()); // returns input.begin() + 1
+ * thrust::lower_bound(input.begin(), input.end(), 3, thrust::less()); // returns input.begin() + 2
+ * thrust::lower_bound(input.begin(), input.end(), 8, thrust::less()); // returns input.begin() + 4
+ * thrust::lower_bound(input.begin(), input.end(), 9, thrust::less()); // returns input.end()
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/lower_bound.html
+ * \see \p upper_bound
+ * \see \p equal_range
+ * \see \p binary_search
+ */
+template
+ForwardIterator lower_bound(const thrust::detail::execution_policy_base &exec,
+ ForwardIterator first,
+ ForwardIterator last,
+ const T &value,
+ StrictWeakOrdering comp);
+
+
+/*! \p lower_bound is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * Specifically, it returns the first position where value could be
+ * inserted without violating the ordering. This version of
+ * \p lower_bound uses function object \c comp for comparison
+ * and returns the furthermost iterator \c i in [first, last)
+ * such that, for every iterator \c j in [first, i),
+ * comp(*j, value) is \c true.
+ *
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \param comp The comparison operator.
+ * \return The furthermost iterator \c i, such that comp(*i, value) is \c true.
+ *
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam T is comparable to \p ForwardIterator's \c value_type.
+ * \tparam StrictWeakOrdering is a model of Strict Weak Ordering.
+ *
+ * The following code snippet demonstrates how to use \p lower_bound
+ * to search for values in a ordered range.
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::lower_bound(input.begin(), input.end(), 0, thrust::less()); // returns input.begin()
+ * thrust::lower_bound(input.begin(), input.end(), 1, thrust::less()); // returns input.begin() + 1
+ * thrust::lower_bound(input.begin(), input.end(), 2, thrust::less()); // returns input.begin() + 1
+ * thrust::lower_bound(input.begin(), input.end(), 3, thrust::less()); // returns input.begin() + 2
+ * thrust::lower_bound(input.begin(), input.end(), 8, thrust::less()); // returns input.begin() + 4
+ * thrust::lower_bound(input.begin(), input.end(), 9, thrust::less()); // returns input.end()
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/lower_bound.html
+ * \see \p upper_bound
+ * \see \p equal_range
+ * \see \p binary_search
+ */
+template
+ForwardIterator lower_bound(ForwardIterator first,
+ ForwardIterator last,
+ const T& value,
+ StrictWeakOrdering comp);
+
+
+/*! \p upper_bound is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * Specifically, it returns the last position where value could be
+ * inserted without violating the ordering. This version of
+ * \p upper_bound uses operator< for comparison and returns
+ * the furthermost iterator \c i in [first, last) such that,
+ * for every iterator \c j in [first, i), value < *j
+ * is \c false.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \return The furthermost iterator \c i, such that value < *i is \c false.
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam LessThanComparable is a model of LessThanComparable.
+ *
+ * The following code snippet demonstrates how to use \p upper_bound
+ * to search for values in a ordered range using the \p thrust::device execution policy for parallelism:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 0); // returns input.begin() + 1
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 1); // returns input.begin() + 1
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 2); // returns input.begin() + 2
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 3); // returns input.begin() + 2
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 8); // returns input.end()
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 9); // returns input.end()
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/upper_bound.html
+ * \see \p lower_bound
+ * \see \p equal_range
+ * \see \p binary_search
+ */
+template
+ForwardIterator upper_bound(const thrust::detail::execution_policy_base &exec,
+ ForwardIterator first,
+ ForwardIterator last,
+ const LessThanComparable &value);
+
+
+/*! \p upper_bound is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * Specifically, it returns the last position where value could be
+ * inserted without violating the ordering. This version of
+ * \p upper_bound uses operator< for comparison and returns
+ * the furthermost iterator \c i in [first, last) such that,
+ * for every iterator \c j in [first, i), value < *j
+ * is \c false.
+ *
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \return The furthermost iterator \c i, such that value < *i is \c false.
+ *
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam LessThanComparable is a model of LessThanComparable.
+ *
+ * The following code snippet demonstrates how to use \p upper_bound
+ * to search for values in a ordered range.
+ *
+ * \code
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::upper_bound(input.begin(), input.end(), 0); // returns input.begin() + 1
+ * thrust::upper_bound(input.begin(), input.end(), 1); // returns input.begin() + 1
+ * thrust::upper_bound(input.begin(), input.end(), 2); // returns input.begin() + 2
+ * thrust::upper_bound(input.begin(), input.end(), 3); // returns input.begin() + 2
+ * thrust::upper_bound(input.begin(), input.end(), 8); // returns input.end()
+ * thrust::upper_bound(input.begin(), input.end(), 9); // returns input.end()
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/upper_bound.html
+ * \see \p lower_bound
+ * \see \p equal_range
+ * \see \p binary_search
+ */
+template
+ForwardIterator upper_bound(ForwardIterator first,
+ ForwardIterator last,
+ const LessThanComparable& value);
+
+
+/*! \p upper_bound is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * Specifically, it returns the last position where value could be
+ * inserted without violating the ordering. This version of
+ * \p upper_bound uses function object \c comp for comparison and returns
+ * the furthermost iterator \c i in [first, last) such that,
+ * for every iterator \c j in [first, i), comp(value, *j)
+ * is \c false.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \param comp The comparison operator.
+ * \return The furthermost iterator \c i, such that comp(value, *i) is \c false.
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam T is comparable to \p ForwardIterator's \c value_type.
+ * \tparam StrictWeakOrdering is a model of Strict Weak Ordering.
+ *
+ * The following code snippet demonstrates how to use \p upper_bound
+ * to search for values in a ordered range using the \p thrust::device execution policy for parallelization:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 0, thrust::less()); // returns input.begin() + 1
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 1, thrust::less()); // returns input.begin() + 1
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 2, thrust::less()); // returns input.begin() + 2
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 3, thrust::less()); // returns input.begin() + 2
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 8, thrust::less()); // returns input.end()
+ * thrust::upper_bound(thrust::device, input.begin(), input.end(), 9, thrust::less()); // returns input.end()
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/upper_bound.html
+ * \see \p lower_bound
+ * \see \p equal_range
+ * \see \p binary_search
+ */
+template
+ForwardIterator upper_bound(const thrust::detail::execution_policy_base &exec,
+ ForwardIterator first,
+ ForwardIterator last,
+ const T &value,
+ StrictWeakOrdering comp);
+
+/*! \p upper_bound is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * Specifically, it returns the last position where value could be
+ * inserted without violating the ordering. This version of
+ * \p upper_bound uses function object \c comp for comparison and returns
+ * the furthermost iterator \c i in [first, last) such that,
+ * for every iterator \c j in [first, i), comp(value, *j)
+ * is \c false.
+ *
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \param comp The comparison operator.
+ * \return The furthermost iterator \c i, such that comp(value, *i) is \c false.
+ *
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam T is comparable to \p ForwardIterator's \c value_type.
+ * \tparam StrictWeakOrdering is a model of Strict Weak Ordering.
+ *
+ * The following code snippet demonstrates how to use \p upper_bound
+ * to search for values in a ordered range.
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::upper_bound(input.begin(), input.end(), 0, thrust::less()); // returns input.begin() + 1
+ * thrust::upper_bound(input.begin(), input.end(), 1, thrust::less()); // returns input.begin() + 1
+ * thrust::upper_bound(input.begin(), input.end(), 2, thrust::less()); // returns input.begin() + 2
+ * thrust::upper_bound(input.begin(), input.end(), 3, thrust::less()); // returns input.begin() + 2
+ * thrust::upper_bound(input.begin(), input.end(), 8, thrust::less()); // returns input.end()
+ * thrust::upper_bound(input.begin(), input.end(), 9, thrust::less()); // returns input.end()
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/upper_bound.html
+ * \see \p lower_bound
+ * \see \p equal_range
+ * \see \p binary_search
+ */
+template
+ForwardIterator upper_bound(ForwardIterator first,
+ ForwardIterator last,
+ const T& value,
+ StrictWeakOrdering comp);
+
+
+/*! \p binary_search is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * It returns \c true if an element that is equivalent to \c value
+ * is present in [first, last) and \c false if no such element
+ * exists. Specifically, this version returns \c true if and only if
+ * there exists an iterator \c i in [first, last) such that
+ * *i < value and value < *i are both \c false.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \return \c true if an equivalent element exists in [first, last), otherwise \c false.
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam LessThanComparable is a model of LessThanComparable.
+ *
+ * The following code snippet demonstrates how to use \p binary_search
+ * to search for values in a ordered range using the \p thrust::device execution policy for parallelization:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 0); // returns true
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 1); // returns false
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 2); // returns true
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 3); // returns false
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 8); // returns true
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 9); // returns false
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/binary_search.html
+ * \see \p lower_bound
+ * \see \p upper_bound
+ * \see \p equal_range
+ */
+template
+bool binary_search(const thrust::detail::execution_policy_base &exec,
+ ForwardIterator first,
+ ForwardIterator last,
+ const LessThanComparable& value);
+
+
+/*! \p binary_search is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * It returns \c true if an element that is equivalent to \c value
+ * is present in [first, last) and \c false if no such element
+ * exists. Specifically, this version returns \c true if and only if
+ * there exists an iterator \c i in [first, last) such that
+ * *i < value and value < *i are both \c false.
+ *
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \return \c true if an equivalent element exists in [first, last), otherwise \c false.
+ *
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam LessThanComparable is a model of LessThanComparable.
+ *
+ * The following code snippet demonstrates how to use \p binary_search
+ * to search for values in a ordered range.
+ *
+ * \code
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::binary_search(input.begin(), input.end(), 0); // returns true
+ * thrust::binary_search(input.begin(), input.end(), 1); // returns false
+ * thrust::binary_search(input.begin(), input.end(), 2); // returns true
+ * thrust::binary_search(input.begin(), input.end(), 3); // returns false
+ * thrust::binary_search(input.begin(), input.end(), 8); // returns true
+ * thrust::binary_search(input.begin(), input.end(), 9); // returns false
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/binary_search.html
+ * \see \p lower_bound
+ * \see \p upper_bound
+ * \see \p equal_range
+ */
+template
+bool binary_search(ForwardIterator first,
+ ForwardIterator last,
+ const LessThanComparable& value);
+
+
+/*! \p binary_search is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * It returns \c true if an element that is equivalent to \c value
+ * is present in [first, last) and \c false if no such element
+ * exists. Specifically, this version returns \c true if and only if
+ * there exists an iterator \c i in [first, last) such that
+ * comp(*i, value) and comp(value, *i) are both \c false.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \param comp The comparison operator.
+ * \return \c true if an equivalent element exists in [first, last), otherwise \c false.
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam T is comparable to \p ForwardIterator's \c value_type.
+ * \tparam StrictWeakOrdering is a model of Strict Weak Ordering.
+ *
+ * The following code snippet demonstrates how to use \p binary_search
+ * to search for values in a ordered range using the \p thrust::device execution policy for parallelization:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 0, thrust::less()); // returns true
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 1, thrust::less()); // returns false
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 2, thrust::less()); // returns true
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 3, thrust::less()); // returns false
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 8, thrust::less()); // returns true
+ * thrust::binary_search(thrust::device, input.begin(), input.end(), 9, thrust::less()); // returns false
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/binary_search.html
+ * \see \p lower_bound
+ * \see \p upper_bound
+ * \see \p equal_range
+ */
+template
+bool binary_search(const thrust::detail::execution_policy_base &exec,
+ ForwardIterator first,
+ ForwardIterator last,
+ const T& value,
+ StrictWeakOrdering comp);
+
+
+/*! \p binary_search is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last).
+ * It returns \c true if an element that is equivalent to \c value
+ * is present in [first, last) and \c false if no such element
+ * exists. Specifically, this version returns \c true if and only if
+ * there exists an iterator \c i in [first, last) such that
+ * comp(*i, value) and comp(value, *i) are both \c false.
+ *
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \param comp The comparison operator.
+ * \return \c true if an equivalent element exists in [first, last), otherwise \c false.
+ *
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam T is comparable to \p ForwardIterator's \c value_type.
+ * \tparam StrictWeakOrdering is a model of Strict Weak Ordering.
+ *
+ * The following code snippet demonstrates how to use \p binary_search
+ * to search for values in a ordered range.
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::binary_search(input.begin(), input.end(), 0, thrust::less()); // returns true
+ * thrust::binary_search(input.begin(), input.end(), 1, thrust::less()); // returns false
+ * thrust::binary_search(input.begin(), input.end(), 2, thrust::less()); // returns true
+ * thrust::binary_search(input.begin(), input.end(), 3, thrust::less()); // returns false
+ * thrust::binary_search(input.begin(), input.end(), 8, thrust::less()); // returns true
+ * thrust::binary_search(input.begin(), input.end(), 9, thrust::less()); // returns false
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/binary_search.html
+ * \see \p lower_bound
+ * \see \p upper_bound
+ * \see \p equal_range
+ */
+template
+bool binary_search(ForwardIterator first,
+ ForwardIterator last,
+ const T& value,
+ StrictWeakOrdering comp);
+
+
+/*! \p equal_range is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last). The
+ * value returned by \p equal_range is essentially a combination of
+ * the values returned by \p lower_bound and \p upper_bound: it returns
+ * a \p pair of iterators \c i and \c j such that \c i is the first
+ * position where value could be inserted without violating the
+ * ordering and \c j is the last position where value could be inserted
+ * without violating the ordering. It follows that every element in the
+ * range [i, j) is equivalent to value, and that
+ * [i, j) is the largest subrange of [first, last) that
+ * has this property.
+ *
+ * This version of \p equal_range returns a \p pair of iterators
+ * [i, j), where \c i is the furthermost iterator in
+ * [first, last) such that, for every iterator \c k in
+ * [first, i), *k < value. \c j is the furthermost
+ * iterator in [first, last) such that, for every iterator
+ * \c k in [first, j), value < *k is \c false.
+ * For every iterator \c k in [i, j), neither
+ * value < *k nor *k < value is \c true.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \return A \p pair of iterators [i, j) that define the range of equivalent elements.
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam LessThanComparable is a model of LessThanComparable.
+ *
+ * The following code snippet demonstrates how to use \p equal_range
+ * to search for values in a ordered range using the \p thrust::device execution policy for parallelization:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::equal_range(thrust::device, input.begin(), input.end(), 0); // returns [input.begin(), input.begin() + 1)
+ * thrust::equal_range(thrust::device, input.begin(), input.end(), 1); // returns [input.begin() + 1, input.begin() + 1)
+ * thrust::equal_range(thrust::device, input.begin(), input.end(), 2); // returns [input.begin() + 1, input.begin() + 2)
+ * thrust::equal_range(thrust::device, input.begin(), input.end(), 3); // returns [input.begin() + 2, input.begin() + 2)
+ * thrust::equal_range(thrust::device, input.begin(), input.end(), 8); // returns [input.begin() + 4, input.end)
+ * thrust::equal_range(thrust::device, input.begin(), input.end(), 9); // returns [input.end(), input.end)
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/equal_range.html
+ * \see \p lower_bound
+ * \see \p upper_bound
+ * \see \p binary_search
+ */
+template
+thrust::pair
+equal_range(const thrust::detail::execution_policy_base &exec,
+ ForwardIterator first,
+ ForwardIterator last,
+ const LessThanComparable& value);
+
+
+/*! \p equal_range is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last). The
+ * value returned by \p equal_range is essentially a combination of
+ * the values returned by \p lower_bound and \p upper_bound: it returns
+ * a \p pair of iterators \c i and \c j such that \c i is the first
+ * position where value could be inserted without violating the
+ * ordering and \c j is the last position where value could be inserted
+ * without violating the ordering. It follows that every element in the
+ * range [i, j) is equivalent to value, and that
+ * [i, j) is the largest subrange of [first, last) that
+ * has this property.
+ *
+ * This version of \p equal_range returns a \p pair of iterators
+ * [i, j), where \c i is the furthermost iterator in
+ * [first, last) such that, for every iterator \c k in
+ * [first, i), *k < value. \c j is the furthermost
+ * iterator in [first, last) such that, for every iterator
+ * \c k in [first, j), value < *k is \c false.
+ * For every iterator \c k in [i, j), neither
+ * value < *k nor *k < value is \c true.
+ *
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \return A \p pair of iterators [i, j) that define the range of equivalent elements.
+ *
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam LessThanComparable is a model of LessThanComparable.
+ *
+ * The following code snippet demonstrates how to use \p equal_range
+ * to search for values in a ordered range.
+ *
+ * \code
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::equal_range(input.begin(), input.end(), 0); // returns [input.begin(), input.begin() + 1)
+ * thrust::equal_range(input.begin(), input.end(), 1); // returns [input.begin() + 1, input.begin() + 1)
+ * thrust::equal_range(input.begin(), input.end(), 2); // returns [input.begin() + 1, input.begin() + 2)
+ * thrust::equal_range(input.begin(), input.end(), 3); // returns [input.begin() + 2, input.begin() + 2)
+ * thrust::equal_range(input.begin(), input.end(), 8); // returns [input.begin() + 4, input.end)
+ * thrust::equal_range(input.begin(), input.end(), 9); // returns [input.end(), input.end)
+ * \endcode
+ *
+ * \see http://www.sgi.com/tech/stl/equal_range.html
+ * \see \p lower_bound
+ * \see \p upper_bound
+ * \see \p binary_search
+ */
+template
+thrust::pair
+equal_range(ForwardIterator first,
+ ForwardIterator last,
+ const LessThanComparable& value);
+
+
+/*! \p equal_range is a version of binary search: it attempts to find
+ * the element value in an ordered range [first, last). The
+ * value returned by \p equal_range is essentially a combination of
+ * the values returned by \p lower_bound and \p upper_bound: it returns
+ * a \p pair of iterators \c i and \c j such that \c i is the first
+ * position where value could be inserted without violating the
+ * ordering and \c j is the last position where value could be inserted
+ * without violating the ordering. It follows that every element in the
+ * range [i, j) is equivalent to value, and that
+ * [i, j) is the largest subrange of [first, last) that
+ * has this property.
+ *
+ * This version of \p equal_range returns a \p pair of iterators
+ * [i, j). \c i is the furthermost iterator in
+ * [first, last) such that, for every iterator \c k in
+ * [first, i), comp(*k, value) is \c true.
+ * \c j is the furthermost iterator in [first, last) such
+ * that, for every iterator \c k in [first, last),
+ * comp(value, *k) is \c false. For every iterator \c k
+ * in [i, j), neither comp(value, *k) nor
+ * comp(*k, value) is \c true.
+ *
+ * The algorithm's execution is parallelized as determined by \p exec.
+ *
+ * \param exec The execution policy to use for parallelization.
+ * \param first The beginning of the ordered sequence.
+ * \param last The end of the ordered sequence.
+ * \param value The value to be searched.
+ * \param comp The comparison operator.
+ * \return A \p pair of iterators [i, j) that define the range of equivalent elements.
+ *
+ * \tparam DerivedPolicy The name of the derived execution policy.
+ * \tparam ForwardIterator is a model of Forward Iterator.
+ * \tparam T is comparable to \p ForwardIterator's \c value_type.
+ * \tparam StrictWeakOrdering is a model of Strict Weak Ordering.
+ *
+ * The following code snippet demonstrates how to use \p equal_range
+ * to search for values in a ordered range using the \p thrust::device execution policy for parallelization:
+ *
+ * \code
+ * #include
+ * #include
+ * #include
+ * #include
+ * ...
+ * thrust::device_vector input(5);
+ *
+ * input[0] = 0;
+ * input[1] = 2;
+ * input[2] = 5;
+ * input[3] = 7;
+ * input[4] = 8;
+ *
+ * thrust::equal_range(thrust::device, input.begin(), input.end(), 0, thrust::less()); // returns [input.begin(), input.begin() + 1)
+ * thrust::equal_range(thrust::device, input.begin(), input.end(), 1, thrust::less