From ddd6fe77ab241a63543b28312df6d417261f56c9 Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 18 Aug 2000 15:44:26 +0000 Subject: [PATCH] [project @ 2000-08-18 15:44:25 by simonmar] Import stripped-down gmp-3.1. This will cause severe breakage until I can resolve the conflicts and check in the rest of the changes, so I'd advise not updating this directory for a while (unless you're using a system-installed gmp, in which case it won't matter). --- ghc/rts/gmp/AUTHORS | 12 + ghc/rts/gmp/COPYING | 336 ++++++++++ ghc/rts/gmp/COPYING.LIB | 280 +++++---- ghc/rts/gmp/INSTALL | 134 ++-- ghc/rts/gmp/Makefile.am | 196 ++++++ ghc/rts/gmp/NEWS | 79 ++- ghc/rts/gmp/README | 125 ++-- ghc/rts/gmp/acconfig.h | 92 +++ ghc/rts/gmp/acinclude.m4 | 835 +++++++++++++++++++++++++ ghc/rts/gmp/aclocal.m4 | 1515 ++++++++++++++++++++++++++++++++++++++++++++++ ghc/rts/gmp/ansi2knr.1 | 36 ++ ghc/rts/gmp/config.in | 162 +++++ ghc/rts/gmp/mp.h | 104 ++-- ghc/rts/gmp/stamp-h.in | 1 + 14 files changed, 3561 insertions(+), 346 deletions(-) create mode 100644 ghc/rts/gmp/AUTHORS create mode 100644 ghc/rts/gmp/COPYING create mode 100644 ghc/rts/gmp/Makefile.am create mode 100644 ghc/rts/gmp/acconfig.h create mode 100644 ghc/rts/gmp/acinclude.m4 create mode 100644 ghc/rts/gmp/aclocal.m4 create mode 100644 ghc/rts/gmp/ansi2knr.1 create mode 100644 ghc/rts/gmp/config.in create mode 100644 ghc/rts/gmp/stamp-h.in diff --git a/ghc/rts/gmp/AUTHORS b/ghc/rts/gmp/AUTHORS new file mode 100644 index 0000000..1fa057a --- /dev/null +++ b/ghc/rts/gmp/AUTHORS @@ -0,0 +1,12 @@ +Authors if GNU MP (in chronological order) +Torbjörn Granlund +John Amanatides +Paul Zimmermann +Ken Weber +Bennet Yee +Andreas Schwab +Robert Harley +Linus Nordberg +Kent Boortz +Kevin Ryde +Guillaume Hanrot diff --git a/ghc/rts/gmp/COPYING b/ghc/rts/gmp/COPYING new file mode 100644 index 0000000..a6d7d01 --- /dev/null +++ b/ghc/rts/gmp/COPYING @@ -0,0 +1,336 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + 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 +convey 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 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Hereny it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Section \ No newline at end of file diff --git a/ghc/rts/gmp/COPYING.LIB b/ghc/rts/gmp/COPYING.LIB index 92b8903..c4792dd 100644 --- a/ghc/rts/gmp/COPYING.LIB +++ b/ghc/rts/gmp/COPYING.LIB @@ -1,112 +1,128 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. +^L + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. +^L + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs @@ -123,7 +139,8 @@ included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation +interface definition files, plus the scripts used to control +compilation and installation of the library. Activities other than copying, distribution and modification are not @@ -133,7 +150,7 @@ such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an @@ -203,7 +220,7 @@ instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - +^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -254,8 +271,8 @@ Library will still fall under Section 6.) distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or +^L + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit @@ -282,23 +299,31 @@ of these things: Library will not necessarily be able to recompile the application to use the modified definitions.) - b) Accompany the work with a written offer, valid for at + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. - c) If distribution of the work is made by offering access to copy + d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. - d) Verify that the user has already received a copy of these + e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. @@ -308,7 +333,7 @@ restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - +^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -347,9 +372,9 @@ Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to +You are not responsible for enforcing compliance by third parties with this License. - +^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -363,9 +388,10 @@ all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any @@ -383,14 +409,14 @@ be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. +versions of the Lesser 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. @@ -401,7 +427,7 @@ conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - +^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -411,7 +437,7 @@ decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. @@ -434,48 +460,56 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - + END OF TERMS AND CONDITIONS +^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +It is safest to attach them to the start of each source file to most +effectively convey the exclusion of warranty; and each file should +have at least the "copyright" line and a pointer to where the full +notice is found. - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - + Copyright (C) This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -Also add information on how to contact you by electronic and paper mail. +Also add information on how to contact you by electronic and paper +mail. -You should also get your employer (if you work as a programmer) or your +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. + library `Frob' (a library for tweaking knobs) written by James +Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! + + diff --git a/ghc/rts/gmp/INSTALL b/ghc/rts/gmp/INSTALL index 38bfaa8..62faa1a 100644 --- a/ghc/rts/gmp/INSTALL +++ b/ghc/rts/gmp/INSTALL @@ -1,35 +1,47 @@ -INSTALLING GMP -============== + + INSTALLING GNU MP + ================= + These instructions are only for the impatient. Others should read the install -instructions in the manual, gmp.info. Use "info -f gmp.info", or, if you -don't have info, use type "C-h i g (gmp.info)Top" in emacs. +instructions in the manual, gmp.info. Use + + info -f ./gmp.info + +or in emacs -Here are short instructions how to install MP, and some examples that help you -get started using MP. + C-u C-h i gmp.info -First, you need to compile, and optionally install, MP. Since you're + +Here are some brief instructions on how to install GMP, and some examples to +help you get started using GMP. + +First, you need to compile, and optionally install, GMP. Since you're impatient, try this: ./configure; make -If that fails, or you care about the performance of MP, you need to read the -full instructions in the chapter "Installing MP", in the manual. +If that fails, or you care about the performance of GMP, you need to read the +full instructions in the chapter "Installing GMP", in the manual. + +Next, try some small test programs, for example the ones below. -Next, you need to try some small test programs, for example the ones below. +In GMP programs, all variables need to be initialized before they are +assigned, and cleared out before program flow leaves the scope in which they +were declared. Here is an example program that reads two numbers from the +command line, multiplies them, and prints the result to stdout. -In MP programs, all variables need to be initialized before they are assigned, -and cleared out before program flow leaves the scope in which it was declared. -Here is an example of a program that reads two numbers from the command line, -multiplies them, and prints the result to stdout. #include - #include /* All MP programs need to include gmp.h */ + #include /* All GMP programs need to include gmp.h */ main (int argc, char **argv) { mpz_t a, b, p; + if (argc != 3) + { printf ("Usage: %s \n", argv[0]); exit (1); } + /* Initialize variables */ mpz_init (a); mpz_init (b); @@ -54,7 +66,10 @@ multiplies them, and prints the result to stdout. } -In practice, that example would be written like this instead: +This might look tedious, with all the initializing and clearing. Fortunately +some of these operations can be combined, and other operations can often be +avoided. An experienced GMP user might write: + #include #include @@ -63,6 +78,9 @@ In practice, that example would be written like this instead: { mpz_t a, b, p; + if (argc != 3) + { printf ("Usage: %s \n", argv[0]); exit (1); } + /* Initialize and assign a and b from base 10 strings in argv */ mpz_init_set_str (a, argv[1], 10); mpz_init_set_str (b, argv[2], 10); @@ -80,75 +98,49 @@ In practice, that example would be written like this instead: exit (0); } -Finally, you have to compile your test program, and link it with the MP -library. Assuming your working directory is still the gmp source directory, -type: - gcc -g -I. example.c libgmp.a +Now you have to compile your test program, and link it with the GMP library. +Assuming your working directory is still the gmp source directory, and your +source file is called example.c, enter: + gcc -g -I. example.c .libs/libgmp.a + +After installing, the command becomes: "gcc -g example.c -lgmp". Also, GMP is +libtool based so you can use that to link if you want. Now try to run the example: - a.out 98365871231256752134 319378318340103345227 + ./a.out 98365871231256752134 319378318340103345227 31415926535897932384618573336104570964418 -The functions used here all operate on the domain of signed integers. -Functions operating on that domain have names starting with "mpz_". There are -many more such functions than used in these examples. See the chapter -"Integer Functions" in the manual, for a complete list. +The functions used here all operate on signed integers, and have names +starting with "mpz_". There are many more such functions than used in these +examples. See the chapter "Integer Functions" in the manual, for a complete +list. -There are two other main classes of functions in MP. They operate on rational -numbers and floating-point numbers, respectively. The chapters "Rational -Number Functions", and "Floating-point Functions" documents these classes. +There are two other main classes of functions in GMP. They operate on +rational numbers and floating-point numbers, respectively. The chapters +"Rational Number Functions", and "Floating-point Functions" document these +classes. To run a set of tests, do "make check". This will take a while. To create the printable documentation from the texinfo source, type "make -dvi". This requires the "tex" command to be available in your search path. +gmp.dvi" or "make gmp.ps". This requires various "tex" commands. -To install the library, do "make install". +To install the library, do "make install" (then you can use -lgmp instead of +.libs/libgmp.a). -If you decide to use MP, It is a good idea you read at least the chapter "MP +If you decide to use GMP, it is a good idea you at least read the chapter "GMP Basics" in the manual. +Some known build problems are noted in the "Installing GMP" chapter of +the manual. Please report other problems to bug-gmp@gnu.org. + + -Known Build Problems --------------------- - -Note that GCC 2.7.2 (as well as 2.6.3) for the RS/6000 and PowerPC can not -be used to compile GMP, due to a bug in GCC. If you want to use GCC, you -need to apply the patch at the end of this file, or use a later version of -the compiler. - -If you are on a Sequent Symmetry, use GAS instead of the system's assembler -due to the latter's serious bugs. - -The system compiler on NeXT is a massacred and old gcc, even if the -compiler calls itself cc. This compiler cannot be used to build GMP. You -need to get a real gcc, and install that before you compile GMP. (NeXT -might have fixed this in newer releases of their system.) - -Please report other problems to bug-gmp@prep.ai.mit.edu. - - -Patch to apply to GCC 2.6.3 and 2.7.2: - -*** config/rs6000/rs6000.md Sun Feb 11 08:22:11 1996 ---- config/rs6000/rs6000.md.new Sun Feb 18 03:33:37 1996 -*************** -*** 920,926 **** - (set (match_operand:SI 0 "gpc_reg_operand" "=r") - (not:SI (match_dup 1)))] - "" -! "nor. %0,%2,%1" - [(set_attr "type" "compare")]) - - (define_insn "" ---- 920,926 ---- - (set (match_operand:SI 0 "gpc_reg_operand" "=r") - (not:SI (match_dup 1)))] - "" -! "nor. %0,%1,%1" - [(set_attr "type" "compare")]) - - (define_insn "" +---------------- +Local variables: +mode: text +fill-column: 78 +End: diff --git a/ghc/rts/gmp/Makefile.am b/ghc/rts/gmp/Makefile.am new file mode 100644 index 0000000..79bf65b --- /dev/null +++ b/ghc/rts/gmp/Makefile.am @@ -0,0 +1,196 @@ +## Process this file with automake to generate Makefile.in + + +# Copyright (C) 1991, 1993, 1994, 1996, 1997, 1999, 2000 Free Software +# Foundation, Inc. +# +# This file is part of the GNU MP Library. +# +# The GNU MP Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at your +# option) any later version. +# +# The GNU MP Library 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 Lesser General Public +# License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with the GNU MP Library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA. + + +# make check +# +# It'd be good if "make check" first did a "make all" or whatever to +# build libgmp.la, but it's not clear how best to do this. Putting a +# "check:" target is overridden by automake, and a "check-local:" runs +# too late (due to depth-first subdirectory processing). For now it's +# necessary to do "make && make check". +# +# MPF_OBJECTS etc +# +# Libtool needs all the .lo files passed to it if it's going to build +# both a static and shared library. If a convenience library like +# mpf/libmpf.la is passed then the resulting libgmp.a gets the PIC .lo +# objects rather than the non-PIC .o's. +# +# Unfortunately this leads to the big lists of objects below. Something +# like mpz/*.lo would probably work, but might risk missing something +# out or getting something extra. The source files for each .lo are +# listed in the Makefile.am's in the subdirectories. + + +# Libtool -version-info for libgmp.la and libmp.la. See (libtool)Versioning +# +# 1. No interfaces changed, only implementations (good): Increment REVISION. +# +# 2. Interfaces added, none removed (good): Increment CURRENT, increment +# AGE, set REVISION to 0. +# +# 3. Interfaces removed (BAD, breaks upward compatibility): Increment +# CURRENT, set AGE and REVISION to 0. +# +# Do this separately for libgmp and libmp, only do it just before a release. +# +# GMP -version-info +# release libgmp libmp +# 2.0.x - - +# 3.0 3:0:0 3:0:0 +# 3.0.1 3:1:0 3:0:0 +# 3.1 4:0:1 4:0:1 +# +# +# Starting at 3:0:0 is a slight abuse of the versioning system, but it +# ensures we're past soname libgmp.so.2, which is what has been used on +# Debian GNU/Linux packages of gmp 2. Pretend gmp 2 was 2:0:0, so the +# interface changes for gmp 3 mean 3:0:0 is right. + +LIBGMP_LT_CURRENT = 4 +LIBGMP_LT_REVISION = 0 +LIBGMP_LT_AGE = 1 + +LIBMP_LT_CURRENT = 4 +LIBMP_LT_REVISION = 0 +LIBMP_LT_AGE = 1 + + +AUTOMAKE_OPTIONS = gnu check-news no-dependencies ansi2knr + +SUBDIRS = mpn mpz mpq mpf mpbsd mpfr tests demos tune + +include_HEADERS = gmp.h $(MPBSD_HEADERS_OPTION) $(MPFR_HEADERS_OPTION) +EXTRA_HEADERS = mp.h + +lib_LTLIBRARIES = libgmp.la $(MPBSD_LTLIBRARIES_OPTION) + +EXTRA_DIST = .gdbinit gmp-impl.h longlong.h stack-alloc.h urandom.h doc macos + +DISTCLEANFILES = asm-syntax.h config.m4 @gmp_srclinks@ + + +MPF_OBJECTS = mpf/init.lo mpf/init2.lo mpf/set.lo mpf/set_ui.lo mpf/set_si.lo \ + mpf/set_str.lo mpf/set_d.lo mpf/set_z.lo mpf/iset.lo mpf/iset_ui.lo \ + mpf/iset_si.lo mpf/iset_str.lo mpf/iset_d.lo mpf/clear.lo mpf/get_str.lo \ + mpf/dump.lo mpf/size.lo mpf/eq.lo mpf/reldiff.lo mpf/sqrt.lo mpf/random2.lo \ + mpf/inp_str.lo mpf/out_str.lo mpf/add.lo mpf/add_ui.lo mpf/sub.lo \ + mpf/sub_ui.lo mpf/ui_sub.lo mpf/mul.lo mpf/mul_ui.lo mpf/div.lo \ + mpf/div_ui.lo mpf/cmp.lo mpf/cmp_ui.lo mpf/cmp_si.lo mpf/mul_2exp.lo \ + mpf/div_2exp.lo mpf/abs.lo mpf/neg.lo mpf/set_q.lo mpf/get_d.lo \ + mpf/set_dfl_prec.lo mpf/set_prc.lo mpf/set_prc_raw.lo mpf/get_prc.lo \ + mpf/ui_div.lo mpf/sqrt_ui.lo mpf/floor.lo mpf/ceil.lo mpf/trunc.lo \ + mpf/pow_ui.lo mpf/urandomb.lo mpf/swap.lo +MPZ_OBJECTS = mpz/abs.lo mpz/add.lo mpz/add_ui.lo mpz/addmul_ui.lo mpz/and.lo \ + mpz/array_init.lo mpz/bin_ui.lo mpz/bin_uiui.lo mpz/cdiv_q.lo \ + mpz/cdiv_q_ui.lo mpz/cdiv_qr.lo mpz/cdiv_qr_ui.lo mpz/cdiv_r.lo \ + mpz/cdiv_r_ui.lo mpz/cdiv_ui.lo mpz/clear.lo mpz/clrbit.lo mpz/cmp.lo \ + mpz/cmp_si.lo mpz/cmp_ui.lo mpz/cmpabs.lo mpz/cmpabs_ui.lo mpz/com.lo \ + mpz/divexact.lo mpz/dump.lo mpz/fac_ui.lo mpz/fdiv_q.lo mpz/fdiv_q_2exp.lo \ + mpz/fdiv_q_ui.lo mpz/fdiv_qr.lo mpz/fdiv_qr_ui.lo mpz/fdiv_r.lo \ + mpz/fdiv_r_2exp.lo mpz/fdiv_r_ui.lo mpz/fdiv_ui.lo mpz/fib_ui.lo \ + mpz/fits_sint_p.lo mpz/fits_slong_p.lo mpz/fits_sshort_p.lo \ + mpz/fits_uint_p.lo mpz/fits_ulong_p.lo mpz/fits_ushort_p.lo mpz/gcd.lo \ + mpz/gcd_ui.lo mpz/gcdext.lo mpz/get_d.lo mpz/get_si.lo mpz/get_str.lo \ + mpz/get_ui.lo mpz/getlimbn.lo mpz/hamdist.lo mpz/init.lo mpz/inp_raw.lo \ + mpz/inp_str.lo mpz/invert.lo mpz/ior.lo mpz/iset.lo mpz/iset_d.lo \ + mpz/iset_si.lo mpz/iset_str.lo mpz/iset_ui.lo mpz/jacobi.lo \ + mpz/kronsz.lo mpz/kronuz.lo mpz/kronzs.lo mpz/kronzu.lo \ + mpz/lcm.lo mpz/legendre.lo \ + mpz/mod.lo mpz/mul.lo mpz/mul_2exp.lo mpz/mul_si.lo mpz/mul_ui.lo \ + mpz/neg.lo mpz/nextprime.lo mpz/out_raw.lo mpz/out_str.lo mpz/perfpow.lo mpz/perfsqr.lo \ + mpz/popcount.lo mpz/pow_ui.lo mpz/powm.lo mpz/powm_ui.lo mpz/pprime_p.lo \ + mpz/random.lo mpz/random2.lo mpz/realloc.lo mpz/remove.lo mpz/root.lo \ + mpz/rrandomb.lo \ + mpz/scan0.lo mpz/scan1.lo mpz/set.lo mpz/set_d.lo mpz/set_f.lo mpz/set_q.lo \ + mpz/set_si.lo mpz/set_str.lo mpz/set_ui.lo mpz/setbit.lo mpz/size.lo \ + mpz/sizeinbase.lo mpz/sqrt.lo mpz/sqrtrem.lo mpz/sub.lo mpz/sub_ui.lo \ + mpz/swap.lo mpz/tdiv_ui.lo mpz/tdiv_q.lo mpz/tdiv_q_2exp.lo mpz/tdiv_q_ui.lo \ + mpz/tdiv_qr.lo mpz/tdiv_qr_ui.lo mpz/tdiv_r.lo mpz/tdiv_r_2exp.lo \ + mpz/tdiv_r_ui.lo mpz/tstbit.lo mpz/ui_pow_ui.lo mpz/urandomb.lo \ + mpz/urandomm.lo mpz/xor.lo +MPQ_OBJECTS = mpq/add.lo mpq/canonicalize.lo mpq/clear.lo mpq/cmp.lo \ + mpq/cmp_ui.lo mpq/div.lo mpq/get_d.lo mpq/get_den.lo mpq/get_num.lo \ + mpq/init.lo mpq/inv.lo mpq/mul.lo mpq/neg.lo mpq/out_str.lo \ + mpq/set.lo mpq/set_den.lo \ + mpq/set_num.lo mpq/set_si.lo mpq/set_ui.lo mpq/sub.lo mpq/equal.lo \ + mpq/set_z.lo mpq/set_d.lo mpq/swap.lo +MPN_OBJECTS = @mpn_objs_in_libgmp@ + +MPBSD_OBJECTS = mpbsd/add.lo mpbsd/tdiv_qr.lo mpbsd/move.lo mpbsd/powm.lo \ + mpbsd/sub.lo mpbsd/cmp.lo mpbsd/mfree.lo mpbsd/mtox.lo mpbsd/realloc.lo \ + mpbsd/gcd.lo mpbsd/itom.lo mpbsd/min.lo mpbsd/mul.lo mpbsd/mout.lo \ + mpbsd/pow_ui.lo mpbsd/sdiv.lo mpbsd/sqrtrem.lo mpbsd/xtom.lo + +# FIXME: Add mpfr/rnd_mode.lo when it's clean. +MPFR_OBJECTS = mpfr/add.lo mpfr/div_2exp.lo mpfr/neg.lo mpfr/set_dfl_prec.lo \ + mpfr/set_str_raw.lo mpfr/agm.lo mpfr/get_str.lo mpfr/print_raw.lo \ + mpfr/set_dfl_rnd.lo mpfr/sqrt.lo mpfr/clear.lo mpfr/init.lo \ + mpfr/set_f.lo mpfr/sub.lo mpfr/cmp.lo mpfr/mul.lo mpfr/round.lo \ + mpfr/set_prec.lo mpfr/cmp_ui.lo mpfr/mul_2exp.lo mpfr/set.lo mpfr/set_si.lo \ + mpfr/div.lo mpfr/mul_ui.lo mpfr/set_d.lo mpfr/pow.lo mpfr/out_str.lo \ + mpfr/pi.lo mpfr/set_z.lo mpfr/add_ulp.lo mpfr/log2.lo mpfr/random.lo \ + mpfr/log.lo mpfr/exp.lo mpfr/div_ui.lo mpfr/zeta.lo mpfr/karadiv.lo \ + mpfr/karasqrt.lo mpfr/print_rnd_mode.lo + + +if WANT_MPFR +MPFR_HEADERS_OPTION = mpfr/mpfr.h +MPFR_OBJECTS_OPTION = $(MPFR_OBJECTS) +MPFR_LIBADD_OPTION = -lm +endif +libgmp_la_SOURCES = assert.c compat.c errno.c memory.c mp_set_fns.c \ + mp_clz_tab.c mp_minv_tab.c \ + rand.c randclr.c randlc.c randlc2x.c randraw.c randsd.c \ + randsdui.c version.c stack-alloc.c mp_bpl.c extract-dbl.c insert-dbl.c +libgmp_la_DEPENDENCIES = \ + $(MPF_OBJECTS) $(MPZ_OBJECTS) $(MPN_OBJECTS) $(MPQ_OBJECTS) \ + $(MPFR_OBJECTS_OPTION) +libgmp_la_LIBADD = $(libgmp_la_DEPENDENCIES) $(MPFR_LIBADD_OPTION) +libgmp_la_LDFLAGS = \ + -version-info $(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) + + +if WANT_MPBSD +MPBSD_HEADERS_OPTION = mp.h +MPBSD_LTLIBRARIES_OPTION = libmp.la +endif +libmp_la_SOURCES = assert.c errno.c memory.c mp_bpl.c mp_clz_tab.c \ + mp_minv_tab.c mp_set_fns.c stack-alloc.c +libmp_la_DEPENDENCIES = $(MPBSD_OBJECTS) $(MPN_OBJECTS) \ + mpz/add.lo mpz/clear.lo mpz/cmp.lo mpz/init.lo mpz/mod.lo mpz/mul.lo \ + mpz/mul_2exp.lo mpz/realloc.lo mpz/set.lo mpz/set_ui.lo mpz/tdiv_r.lo \ + mpz/sub.lo +libmp_la_LIBADD = $(libmp_la_DEPENDENCIES) +libmp_la_LDFLAGS = \ + -version-info $(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE) + + +info_TEXINFOS = gmp.texi + + +# Don't ship CVS directories or emacs backups. +dist-hook: + -find $(distdir) \( -name CVS -type d \) -o -name "*.~*" \ + | xargs rm -rf diff --git a/ghc/rts/gmp/NEWS b/ghc/rts/gmp/NEWS index b61c840..f41af93 100644 --- a/ghc/rts/gmp/NEWS +++ b/ghc/rts/gmp/NEWS @@ -1,4 +1,71 @@ -NOTEWORTHY CHANGES IN GNU MP IN VERSION 2 +Changes between MP version 3.0 and 3.1 + +* Bug fixes. +* Improved `make check' running more tests. +* Tuned algorithm cutoff points for many machines. This will improve speed for + a lot of operations, in some cases by a large amount. +* Major speed improvments: Alpha 21264. +* Some speed improvments: Cray vector computers, AMD K6 and Athlon, Intel P5 + and Pentium Pro/II/III. +* The mpf_get_prec function now works as it did in GMP 2. +* New utilities for auto-tuning and speed measuring. +* Multiplication now optionally uses FFT for very large operands. (To enable + it, pass --enable-fft to configure.) +* Support for new systems: Solaris running on x86, FreeBSD 5, HP-UX 11, Cray + vector computers, Rhapsody, Nextstep/Openstep, MacOS. +* Support for shared libraries on 32-bit HPPA. +* New integer functions: mpz_mul_si, mpz_odd_p, mpz_even_p. +* New Kronecker symbol functions: mpz_kronecker_si, mpz_kronecker_ui, + mpz_si_kronecker, mpz_ui_kronecker. +* New rational functions: mpq_out_str, mpq_swap. +* New float functions: mpf_swap. +* New mpn functions: mpn_divexact_by3c, mpn_tdiv_qr. +* New EXPERIMENTAL function layer for accurate floating-point arithmetic, mpfr. + To try it, pass --enable-mpfr to configure. See the mpfr subdirectory for + more information; it is not documented in the main GMP manual. + +Changes between MP version 3.0 and 3.0.1 + +* Memory leaks in gmp_randinit and mpz_probab_prime_p fixed. +* Documentation for gmp_randinit fixed. Misc documentation errors fixed. + +Changes between MP version 2.0 and 3.0 + +* Source level compatibility with past releases (except mpn_gcd). +* Bug fixes. +* Much improved speed thanks to both host independent and host dependent + optimizations. +* Switch to autoconf/automake/libtool. +* Support for building libgmp as a shared library. +* Multiplication and squaring using 3-way Toom-Cook. +* Division using the Burnikel-Ziegler method. +* New functions computing binomial coefficients: mpz_bin_ui, mpz_bin_uiui. +* New function computing Fibonacci numbers: mpz_fib_ui. +* New random number generators: mpf_urandomb, mpz_rrandomb, mpz_urandomb, + mpz_urandomm, gmp_randclear, gmp_randinit, gmp_randinit_lc_2exp, gmp_randseed, + gmp_randseed_ui. +* New function for quickly extracting limbs: mpz_getlimbn. +* New functions performing integer size tests: mpz_fits_sint_p, + mpz_fits_slong_p, mpz_fits_sshort_p, mpz_fits_uint_p, mpz_fits_ulong_p, + mpz_fits_ushort_p. +* New mpf functions: mpf_ceil, mpf_floor, mpf_pow_ui, mpf_trunc. +* New mpq function: mpq_set_d. +* New mpz functions: mpz_addmul_ui, mpz_cmpabs, mpz_cmpabs_ui, mpz_lcm, + mpz_nextprime, mpz_perfect_power_p, mpz_remove, mpz_root, mpz_swap, + mpz_tdiv_ui, mpz_tstbit, mpz_xor. +* New mpn function: mpn_divexact_by3. +* New CPU support: DEC Alpha 21264, AMD K6 and Athlon, HPPA 2.0 and 64, + Intel Pentium Pro and Pentium-II/III, Sparc 64, PowerPC 64. +* Almost 10 times faster mpz_invert and mpn_gcdext. +* The interface of mpn_gcd has changed. +* Better support for MIPS R4x000 and R5000 under Irix 6. +* Improved support for SPARCv8 and SPARCv9 processors. + +Changes between MP version 2.0 and 2.0.2 + +* Many bug fixes. + +Changes between MP version 1.3.2 and 2.0 * Division routines in the mpz class have changed. There are three classes of functions, that rounds the quotient to -infinity, 0, and +infinity, @@ -38,7 +105,7 @@ NOTEWORTHY CHANGES IN GNU MP IN VERSION 2 * Uses GNU configure. This makes it possible to choose target architecture and CPU variant, and to compile into a separate object directory. * Carefully optimized assembly for important inner loops. Support for DEC - Alpha, Amd 29000, HPPA 1.0 and 1.1, Intel pentium and generic x86, Intel + Alpha, Amd 29000, HPPA 1.0 and 1.1, Intel Pentium and generic x86, Intel i960, Motorola MC68000, MC68020, MC88100, and MC88110, Motorola/IBM PowerPC, National NS32000, IBM POWER, MIPS R3000, R4000, SPARCv7, SuperSPARC, generic SPARCv8, and DEC VAX. Some support also for ARM, @@ -54,3 +121,11 @@ INCOMPATIBILITIES BETWEEN GMP 1 AND GMP 2 * mpz division functions round differently. * mpz mod functions now really compute mod. * mpz_powm and mpz_powm_ui now really use mod for reduction. + + + +---------------- +Local variables: +mode: text +fill-column: 76 +End: diff --git a/ghc/rts/gmp/README b/ghc/rts/gmp/README index 3afa677..177c97e 100644 --- a/ghc/rts/gmp/README +++ b/ghc/rts/gmp/README @@ -1,117 +1,50 @@ + THE GNU MP LIBRARY GNU MP is a library for arbitrary precision arithmetic, operating on signed -integers, rational numbers, and floating point numbers. It has a rich set -of functions, and the functions have a regular interface. - -GNU MP is designed to be as fast as possible, both for small operands and for -huge operands. The speed is achieved by using fullwords as the basic -arithmetic type, by using fast algorithms, by carefully optimized assembly -code for the most common inner loops for a lots of CPUs, and by a general -emphasis on speed (instead of simplicity or elegance). - -The speed of GNU MP is believed to be faster than any other similar library. -The advantage for GNU MP increases with the operand sizes for certain -operations, since GNU MP in many cases has asymptotically faster algorithms. - - - GETTING STARTED - -First, you have to configure and compiler GNU MP. Simply typing - - ./configure; make - -will normally do a reasonable job, but will not give optimal library -execution speed. So unless you're very unpatient, please read the detailed -instructions in the file INSTALL or in gmp.texi. - -Once you have compiled the library, you should write some small example, and -make sure you can compile them. A typical compilation command is this: - - gcc -g your-file.c -I libgmp.a -lm - -If you have installed the library, you can simply do: - - gcc -g your-file.c -lgmp -lm - -The -lm is normally not needed, since only a few functions in GNU MP use the -math library. - -Here is a sample program that declares 2 variables, initializes them as -required, and sets one of them from a signed integer, and the other from a -string of digits. It then prints the product of the two numbers in base 10. +integers, rational numbers, and floating point numbers. It has a rich set of +functions, and the functions have a regular interface. - #include - #include "gmp.h" +GNU MP is designed to be as fast as possible, both for small operands and huge +operands. The speed is achieved by using fullwords as the basic arithmetic +type, by using fast algorithms, with carefully optimized assembly code for the +most common inner loops for lots of CPUs, and by a general emphasis on speed +(instead of simplicity or elegance). - main () - { - mpz_t a, b, p; +GNU MP is believed to be faster than any other similar library. Its advantage +increases with operand sizes for certain operations, since GNU MP in many +cases has asymptotically faster algorithms. - mpz_init (a); /* initialize variables */ - mpz_init (b); - mpz_init (p); +GNU MP is free software and may be freely copied on the terms contained in the +files COPYING.LIB and COPYING (most of GNU MP is under the former, some under +the latter). - mpz_set_si (a, 756839); /* assign variables */ - mpz_set_str (b, "314159265358979323846", 0); - mpz_mul (p, a, b); /* generate product */ - mpz_out_str (stdout, 10, p); /* print number without newline */ - puts (""); /* print newline */ - - mpz_clear (a); /* clear out variables */ - mpz_clear (b); - mpz_clear (p); - - exit (0); - } - -This might look tedious, with all initializing and clearing. Fortunately -some of these operations can be combined, and other operations can often be -avoided. The example above would be written differently by an experienced -GNU MP user: - - #include - #include "gmp.h" - - main () - { - mpz_t b, p; - - mpz_init (p); - - mpz_init_set_str (b, "314159265358979323846", 0); - mpz_mul_ui (p, b, 756839); /* generate product */ - mpz_out_str (stdout, 10, p); /* print number without newline */ - puts (""); /* print newline */ - - exit (0); - } OVERVIEW OF GNU MP There are five classes of functions in GNU MP. - 1. Signed integer arithmetic functions, mpz_*. These functions are intended + 1. Signed integer arithmetic functions (mpz). These functions are intended to be easy to use, with their regular interface. The associated type is `mpz_t'. - 2. Rational arithmetic functions, mpq_*. For now, just a small set of + 2. Rational arithmetic functions (mpq). For now, just a small set of functions necessary for basic rational arithmetics. The associated type is `mpq_t'. - 3. Floating-point arithmetic functions, mpf_*. If the C type `double' + 3. Floating-point arithmetic functions (mpf). If the C type `double' doesn't give enough precision for your application, declare your variables as `mpf_t' instead, set the precision to any number desired, and call the functions in the mpf class for the arithmetic operations. 4. Positive-integer, hard-to-use, very low overhead functions are in the - mpn_* class. No memory management is performed. The caller must ensure + mpn class. No memory management is performed. The caller must ensure enough space is available for the results. The set of functions is not regular, nor is the calling interface. These functions accept input arguments in the form of pairs consisting of a pointer to the least - significant word, and a integral size telling how many limbs (= words) + significant word, and an integral size telling how many limbs (= words) the pointer points to. Almost all calculations, in the entire package, are made by calling these @@ -128,10 +61,24 @@ printed. How to do that, as well how to build the library, is described in the INSTALL file in this directory. + REPORTING BUGS If you find a bug in the library, please make sure to tell us about it! -Report bugs and propose modifications and enhancements to -bug-gmp@prep.ai.mit.edu. What information is needed in a good bug report is -described in the manual. +You should first check the GNU MP web pages at http://www.swox.com/gmp/, +under "Status of the current release". There will be patches for all known +serious bugs there. + +Report bugs to bug-gmp@gnu.org. What information is needed in a good bug +report is described in the manual. The same address can be used for +suggesting modifications and enhancements. + + + + +---------------- +Local variables: +mode: text +fill-column: 78 +End: diff --git a/ghc/rts/gmp/acconfig.h b/ghc/rts/gmp/acconfig.h new file mode 100644 index 0000000..dfb1b0b --- /dev/null +++ b/ghc/rts/gmp/acconfig.h @@ -0,0 +1,92 @@ +/* +Copyright (C) 2000 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The GNU MP Library 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 Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +MA 02111-1307, USA. +*/ + +@TOP@ + +/* Define if a limb is long long. */ +#undef _LONG_LONG_LIMB + +/* Define if we have native implementation of function. */ +#undef HAVE_NATIVE_ +#undef HAVE_NATIVE_mpn_add +#undef HAVE_NATIVE_mpn_add_1 +#undef HAVE_NATIVE_mpn_add_n +#undef HAVE_NATIVE_mpn_add_nc +#undef HAVE_NATIVE_mpn_addmul_1 +#undef HAVE_NATIVE_mpn_addmul_1c +#undef HAVE_NATIVE_mpn_addsub_n +#undef HAVE_NATIVE_mpn_addsub_nc +#undef HAVE_NATIVE_mpn_and_n +#undef HAVE_NATIVE_mpn_andn_n +#undef HAVE_NATIVE_mpn_bdivmod +#undef HAVE_NATIVE_mpn_cmp +#undef HAVE_NATIVE_mpn_com_n +#undef HAVE_NATIVE_mpn_copyd +#undef HAVE_NATIVE_mpn_copyi +#undef HAVE_NATIVE_mpn_divexact_by3c +#undef HAVE_NATIVE_mpn_divrem +#undef HAVE_NATIVE_mpn_divrem_1 +#undef HAVE_NATIVE_mpn_divrem_1c +#undef HAVE_NATIVE_mpn_divrem_2 +#undef HAVE_NATIVE_mpn_divrem_newton +#undef HAVE_NATIVE_mpn_divrem_classic +#undef HAVE_NATIVE_mpn_dump +#undef HAVE_NATIVE_mpn_gcd +#undef HAVE_NATIVE_mpn_gcd_1 +#undef HAVE_NATIVE_mpn_gcdext +#undef HAVE_NATIVE_mpn_get_str +#undef HAVE_NATIVE_mpn_hamdist +#undef HAVE_NATIVE_mpn_invert_limb +#undef HAVE_NATIVE_mpn_ior_n +#undef HAVE_NATIVE_mpn_iorn_n +#undef HAVE_NATIVE_mpn_lshift +#undef HAVE_NATIVE_mpn_mod_1 +#undef HAVE_NATIVE_mpn_mod_1c +#undef HAVE_NATIVE_mpn_mul +#undef HAVE_NATIVE_mpn_mul_1 +#undef HAVE_NATIVE_mpn_mul_1c +#undef HAVE_NATIVE_mpn_mul_basecase +#undef HAVE_NATIVE_mpn_mul_n +#undef HAVE_NATIVE_mpn_nand_n +#undef HAVE_NATIVE_mpn_nior_n +#undef HAVE_NATIVE_mpn_perfect_square_p +#undef HAVE_NATIVE_mpn_popcount +#undef HAVE_NATIVE_mpn_preinv_mod_1 +#undef HAVE_NATIVE_mpn_random2 +#undef HAVE_NATIVE_mpn_random +#undef HAVE_NATIVE_mpn_rawrandom +#undef HAVE_NATIVE_mpn_rshift +#undef HAVE_NATIVE_mpn_scan0 +#undef HAVE_NATIVE_mpn_scan1 +#undef HAVE_NATIVE_mpn_set_str +#undef HAVE_NATIVE_mpn_sqrtrem +#undef HAVE_NATIVE_mpn_sqr_basecase +#undef HAVE_NATIVE_mpn_sub +#undef HAVE_NATIVE_mpn_sub_1 +#undef HAVE_NATIVE_mpn_sub_n +#undef HAVE_NATIVE_mpn_sub_nc +#undef HAVE_NATIVE_mpn_submul_1 +#undef HAVE_NATIVE_mpn_submul_1c +#undef HAVE_NATIVE_mpn_udiv_w_sdiv +#undef HAVE_NATIVE_mpn_umul_ppmm +#undef HAVE_NATIVE_mpn_udiv_qrnnd +#undef HAVE_NATIVE_mpn_xor_n +#undef HAVE_NATIVE_mpn_xnor_n diff --git a/ghc/rts/gmp/acinclude.m4 b/ghc/rts/gmp/acinclude.m4 new file mode 100644 index 0000000..a02394a --- /dev/null +++ b/ghc/rts/gmp/acinclude.m4 @@ -0,0 +1,835 @@ +dnl GMP specific autoconf macros + + +dnl Copyright (C) 2000 Free Software Foundation, Inc. +dnl +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU Lesser General Public License as published +dnl by the Free Software Foundation; either version 2.1 of the License, or (at +dnl your option) any later version. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +dnl License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public License +dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +dnl MA 02111-1307, USA. + + +dnl GMP_HEADER_GETVAL(NAME,FILE) +dnl ---------------------------- +dnl Expand to the value of a "#define NAME" from the given FILE. +dnl The regexps here aren't very rugged, but are enough for gmp. +dnl /dev/null as a parameter prevents a hang if $2 is accidentally omitted. + +define(GMP_HEADER_GETVAL, +[patsubst(patsubst( +esyscmd([grep "^#define $1 " $2 /dev/null 2>/dev/null]), +[^.*$1[ ]+],[]), +[[ + ]*$],[])]) + + +dnl GMP_VERSION +dnl ----------- +dnl The gmp version number, extracted from the #defines in gmp.h. +dnl Two digits like 3.0 if patchlevel <= 0, or three digits like 3.0.1 if +dnl patchlevel > 0. + +define(GMP_VERSION, +[GMP_HEADER_GETVAL(__GNU_MP_VERSION,gmp.h)[]dnl +.GMP_HEADER_GETVAL(__GNU_MP_VERSION_MINOR,gmp.h)[]dnl +ifelse(m4_eval(GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp.h) > 0),1, +[.GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp.h)])]) + + +dnl GMP_PROG_M4() +dnl ------------- +dnl +dnl Find a working m4, either in $PATH or likely locations, and setup $M4 +dnl and an AC_SUBST accordingly. If $M4 is already set then it's a user +dnl choice and is accepted with no checks. GMP_PROG_M4 is like +dnl AC_PATH_PROG or AC_CHECK_PROG, but it tests each m4 found to see if +dnl it's good enough. +dnl +dnl See mpn/asm-defs.m4 for details on the known bad m4s. + +AC_DEFUN(GMP_PROG_M4, +[AC_CACHE_CHECK([for suitable m4], + gmp_cv_prog_m4, +[if test -n "$M4"; then + gmp_cv_prog_m4="$M4" +else + cat >conftest.m4 <<\EOF +dnl must protect this against being expanded during autoconf m4! +[define(dollarhash,``$][#'')dnl +ifelse(dollarhash(x),1,`define(t1,Y)', +``bad: $][# not supported (SunOS /usr/bin/m4) +'')dnl +ifelse(eval(89),89,`define(t2,Y)', +`bad: eval() doesnt support 8 or 9 in a constant (OpenBSD 2.6 m4) +')dnl +ifelse(t1`'t2,YY,`good +')dnl] +EOF + echo "trying m4" 1>&AC_FD_CC + gmp_tmp_val="`(m4 conftest.m4) 2>&AC_FD_CC`" + echo "$gmp_tmp_val" 1>&AC_FD_CC + if test "$gmp_tmp_val" = good; then + gmp_cv_prog_m4="m4" + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="$PATH:/usr/5bin" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + echo "trying $ac_dir/m4" 1>&AC_FD_CC + gmp_tmp_val="`($ac_dir/m4 conftest.m4) 2>&AC_FD_CC`" + echo "$gmp_tmp_val" 1>&AC_FD_CC + if test "$gmp_tmp_val" = good; then + gmp_cv_prog_m4="$ac_dir/m4" + break + fi + done + IFS="$ac_save_ifs" + if test -z "$gmp_cv_prog_m4"; then + AC_MSG_ERROR([No usable m4 in \$PATH or /usr/5bin (see config.log for reasons).]) + fi + fi + rm -f conftest.m4 +fi]) +M4="$gmp_cv_prog_m4" +AC_SUBST(M4) +]) + + +dnl GMP_PROG_CC_FIND([CC_LIST], [REQ_64BIT_CC]) +dnl Find first working compiler in CC_LIST. +dnl If REQ_64BIT_CC is "yes", the compiler is required to be able to +dnl produce 64-bit code. +dnl NOTE: If a compiler needs any special flags for producing 64-bit code, +dnl these have to be found in shell variable `gmp_cflags64_{cc}', where `{cc}' +dnl is the name of the compiler. +dnl Set CC to the name of the first working compiler. +dnl If a 64-bit compiler is found, set CC64 to the name of the compiler and +dnl CFLAGS64 to flags to use. +dnl This macro does not test if any of the compilers found is a GNU compiler. +dnl To do this, when you have finally made up your mind on which one to use, +dnl and set CC accordingly, invoke [GMP_PROG_CC_SELECT]. That macro will +dnl also make sure that your selection of CFLAGS is valid. +dnl +AC_DEFUN(GMP_PROG_CC_FIND, +[AC_BEFORE([$0], [CC_PROG_CPP]) +ifelse([$1], , gmp_cc_list="gcc cc", gmp_cc_list="[$1]") +ifelse([$2], , gmp_req_64bit_cc="no", gmp_req_64bit_cc="[$2]") + +CC32= +CC64= +for c in $gmp_cc_list; do + # Avoid cache hits. + unset CC + unset ac_cv_prog_CC + AC_CHECK_TOOL(CC, $c, $c) + if test -n "$CC"; then + eval c_flags=\$gmp_cflags_$c + GMP_PROG_CC_WORKS($CC, $c_flags, + gmp_prog_cc_works=yes, + gmp_prog_cc_works=no) + + if test "$gmp_prog_cc_works" != "yes"; then + continue + fi + + # Save first working compiler, whether 32- or 64-bit capable. + if test -z "$CC32"; then + CC32="$CC" + fi + if test "$gmp_req_64bit_cc" = "yes"; then + eval c_flags=\$gmp_cflags64_$c + + # Verify that the compiler works in 64-bit mode as well. + # /usr/ucb/cc on Solaris 7 can *compile* in 64-bit mode, but not link. + GMP_PROG_CC_WORKS($c, $c_flags, + gmp_prog_cc_works=yes, + gmp_prog_cc_works=no) + + if test "$gmp_prog_cc_works" = "yes"; then + GMP_CHECK_CC_64BIT($c, $c_flags) + if test "$gmp_cv_cc_64bit" = "yes"; then + test -z "$CC64" && CC64="$c" + test -z "$CFLAGS64" && CFLAGS64="$c_flags" + # We have CC64 so we're done. + break + fi + fi + else + # We have CC32, and we don't need a 64-bit compiler so we're done. + break + fi + fi +done +CC="$CC32" +])dnl + +dnl GMP_PROG_CC_SELECT +dnl Check that `CC' works with `CFLAGS'. Check if `CC' is a GNU compiler. +dnl Cache the result as `ac_cv_prog_CC'. +AC_DEFUN(GMP_PROG_CC_SELECT, +[AC_BEFORE([$0], [CC_PROG_CPP]) +AC_PROG_CC_WORKS +AC_PROG_CC_GNU + +if test "$ac_cv_prog_gcc" = "yes"; then + GCC=yes +else + GCC= +fi + +# Set CFLAGS if not already set. +if test -z "$CFLAGS"; then + CFLAGS="-g" + if test "$GCC" = "yes"; then + CFLAGS="$CFLAGS -O2" + fi +fi + +AC_SUBST(CC) +AC_CACHE_VAL(ac_cv_prog_CC, ac_cv_prog_CC="$CC") +AC_PROVIDE([AC_PROG_CC]) +])dnl + +dnl GMP_CHECK_CC_64BIT(cc, cflags64) +dnl Find out if `CC' can produce 64-bit code. +dnl Requires NM to be set to nm for target. +dnl FIXME: Cache result. +AC_DEFUN(GMP_CHECK_CC_64BIT, +[ + gmp_tmp_CC_save="$CC" + CC="[$1]" + AC_MSG_CHECKING([whether the C compiler ($CC) is 64-bit capable]) + if test -z "$NM"; then + echo; echo ["configure: $0: fatal: need nm"] + exit 1 + fi + gmp_tmp_CFLAGS_save="$CFLAGS" + CFLAGS="[$2]" + + case "$target" in + hppa2.0*-*-*) + # FIXME: If gcc is installed under another name than "gcc", we will + # test the wrong thing. + if test "$CC" != "gcc"; then + dnl Let compiler version A.10.32.30 or higher be ok. + dnl Bad compiler output: + dnl ccom: HP92453-01 G.10.32.05 HP C Compiler + dnl Good compiler output: + dnl ccom: HP92453-01 A.10.32.30 HP C Compiler + echo >conftest.c + gmp_tmp_vs=`$CC $CFLAGS -V -c -o conftest.o conftest.c 2>&1 | grep "^ccom:"` + rm conftest* + gmp_tmp_v1=`echo $gmp_tmp_vs | sed 's/.* .\.\(.*\)\..*\..* HP C.*/\1/'` + gmp_tmp_v2=`echo $gmp_tmp_vs | sed 's/.* .\..*\.\(.*\)\..* HP C.*/\1/'` + gmp_tmp_v3=`echo $gmp_tmp_vs | sed 's/.* .\..*\..*\.\(.*\) HP C.*/\1/'` + gmp_cv_cc_64bit=no + test -n "$gmp_tmp_v1" && test "$gmp_tmp_v1" -ge "10" \ + && test -n "$gmp_tmp_v2" && test "$gmp_tmp_v2" -ge "32" \ + && test -n "$gmp_tmp_v3" && test "$gmp_tmp_v3" -ge "30" \ + && gmp_cv_cc_64bit=yes + else # gcc + # FIXME: Compile a minimal file and determine if the resulting object + # file is an ELF file. If so, gcc can produce 64-bit code. + # Do we have file(1) for target? + gmp_cv_cc_64bit=no + fi + ;; + mips-sgi-irix6.*) + # We use `-n32' to cc and `-mabi=n32' to gcc, resulting in 64-bit + # arithmetic but not 64-bit pointers, so the general test for sizeof + # (void *) is not valid. + # Simply try to compile an empty main. If that succeeds return + # true. + AC_TRY_COMPILE( , , + gmp_cv_cc_64bit=yes, gmp_cv_cc_64bit=no, + gmp_cv_cc_64bit=no) + ;; + *-*-*) + # Allocate an array of size sizeof (void *) and use nm to determine its + # size. We depend on the first declared variable being put at address 0. + cat >conftest.c <)dnl + gmp_tmp_val=`$NM conftest.o | grep post | sed -e 's;[[][0-9][]]\(.*\);\1;' \ + -e 's;[^1-9]*\([0-9]*\).*;\1;'` + changequote([, ])dnl + if test "$gmp_tmp_val" = "8"; then + gmp_cv_cc_64bit=yes + else + gmp_cv_cc_64bit=no + fi + else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + gmp_cv_cc_64bit=no + fi + rm -f conftest* + ;; + esac + + CC="$gmp_tmp_CC_save" + CFLAGS="$gmp_tmp_CFLAGS_save" + AC_MSG_RESULT($gmp_cv_cc_64bit) +])dnl + +dnl GMP_INIT([M4-DEF-FILE]) +dnl +AC_DEFUN(GMP_INIT, +[ifelse([$1], , gmp_configm4=config.m4, gmp_configm4="[$1]") +gmp_tmpconfigm4=cnfm4.tmp +gmp_tmpconfigm4i=cnfm4i.tmp +gmp_tmpconfigm4p=cnfm4p.tmp +test -f $gmp_tmpconfigm4 && rm $gmp_tmpconfigm4 +test -f $gmp_tmpconfigm4i && rm $gmp_tmpconfigm4i +test -f $gmp_tmpconfigm4p && rm $gmp_tmpconfigm4p +])dnl + +dnl GMP_FINISH +dnl ---------- +dnl Create config.m4 from its accumulated parts. +dnl +dnl __CONFIG_M4_INCLUDED__ is used so that a second or subsequent include +dnl of config.m4 is harmless. +dnl +dnl A separate ifdef on the angle bracket quoted part ensures the quoting +dnl style there is respected. The basic defines from gmp_tmpconfigm4 are +dnl fully quoted but are still put under an ifdef in case any have been +dnl redefined by one of the m4 include files. +dnl +dnl Doing a big ifdef within asm-defs.m4 and/or other macro files wouldn't +dnl work, since it'd interpret parentheses and quotes in dnl comments, and +dnl having a whole file as a macro argument would overflow the string space +dnl on BSD m4. + +AC_DEFUN(GMP_FINISH, +[AC_REQUIRE([GMP_INIT]) +echo "creating $gmp_configm4" +echo ["dnl $gmp_configm4. Generated automatically by configure."] > $gmp_configm4 +if test -f $gmp_tmpconfigm4; then + echo ["changequote(<,>)dnl"] >> $gmp_configm4 + echo ["ifdef(<__CONFIG_M4_INCLUDED__>,,<"] >> $gmp_configm4 + cat $gmp_tmpconfigm4 >> $gmp_configm4 + echo [">)"] >> $gmp_configm4 + echo ["changequote(\`,')dnl"] >> $gmp_configm4 + rm $gmp_tmpconfigm4 +fi +echo ["ifdef(\`__CONFIG_M4_INCLUDED__',,\`"] >> $gmp_configm4 +if test -f $gmp_tmpconfigm4i; then + cat $gmp_tmpconfigm4i >> $gmp_configm4 + rm $gmp_tmpconfigm4i +fi +if test -f $gmp_tmpconfigm4p; then + cat $gmp_tmpconfigm4p >> $gmp_configm4 + rm $gmp_tmpconfigm4p +fi +echo ["')"] >> $gmp_configm4 +echo ["define(\`__CONFIG_M4_INCLUDED__')"] >> $gmp_configm4 +])dnl + +dnl GMP_INCLUDE(FILE) +AC_DEFUN(GMP_INCLUDE, +[AC_REQUIRE([GMP_INIT]) +echo ["include(\`$1')"] >> $gmp_tmpconfigm4i +])dnl + +dnl GMP_SINCLUDE(FILE) +AC_DEFUN(GMP_SINCLUDE, +[AC_REQUIRE([GMP_INIT]) +echo ["sinclude(\`$1')"] >> $gmp_tmpconfigm4i +])dnl + +dnl GMP_DEFINE(MACRO, DEFINITION [, LOCATION]) +dnl [ Define M4 macro MACRO as DEFINITION in temporary file. ] +dnl [ If LOCATION is `POST', the definition will appear after any ] +dnl [ include() directives inserted by GMP_INCLUDE/GMP_SINCLUDE. ] +dnl [ Mind the quoting! No shell variables will get expanded. ] +dnl [ Don't forget to invoke GMP_FINISH to create file config.m4. ] +dnl [ config.m4 uses `<' and '>' as quote characters for all defines. ] +AC_DEFUN(GMP_DEFINE, +[AC_REQUIRE([GMP_INIT]) +echo ['define(<$1>, <$2>)'] >> ifelse([$3], [POST], $gmp_tmpconfigm4p, $gmp_tmpconfigm4) +])dnl + +dnl GMP_DEFINE_RAW(STRING, [, LOCATION]) +dnl [ Put STRING in temporary file. ] +dnl [ If LOCATION is `POST', the definition will appear after any ] +dnl [ include() directives inserted by GMP_INCLUDE/GMP_SINCLUDE. ] +dnl [ Don't forget to invoke GMP_FINISH to create file config.m4. ] +AC_DEFUN(GMP_DEFINE_RAW, +[AC_REQUIRE([GMP_INIT]) +echo [$1] >> ifelse([$2], [POST], $gmp_tmpconfigm4p, $gmp_tmpconfigm4) +])dnl + +dnl GMP_CHECK_ASM_LABEL_SUFFIX +dnl Should a label have a colon or not? +AC_DEFUN(GMP_CHECK_ASM_LABEL_SUFFIX, +[AC_CACHE_CHECK([what assembly label suffix to use], + gmp_cv_check_asm_label_suffix, +[case "$target" in + *-*-hpux*) gmp_cv_check_asm_label_suffix=[""] ;; + *) gmp_cv_check_asm_label_suffix=[":"] ;; +esac +]) +echo ["define(, <\$][1$gmp_cv_check_asm_label_suffix>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Shamelessly borrowed from glibc. +AC_DEFUN(GMP_CHECK_ASM_UNDERSCORE, +[AC_CACHE_CHECK([if symbols are prefixed by underscore], + gmp_cv_check_asm_underscore, +[cat > conftest.$ac_ext </dev/null; then + gmp_cv_check_asm_underscore=yes + else + gmp_cv_check_asm_underscore=no + fi +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi +rm -f conftest* +]) +if test "$gmp_cv_check_asm_underscore" = "yes"; then + GMP_DEFINE(GSYM_PREFIX, [_]) + ifelse([$1], , :, [$1]) +else + GMP_DEFINE(GSYM_PREFIX, []) + ifelse([$2], , :, [$2]) +fi +])dnl + +dnl GMP_CHECK_ASM_ALIGN_LOG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Is parameter to `.align' logarithmic? +dnl Requires NM to be set to nm for target. +AC_DEFUN(GMP_CHECK_ASM_ALIGN_LOG, +[AC_REQUIRE([GMP_CHECK_ASM_GLOBL]) +AC_REQUIRE([GMP_CHECK_ASM_DATA]) +AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX]) +AC_CACHE_CHECK([if .align assembly directive is logarithmic], + gmp_cv_check_asm_align_log, +[if test -z "$NM"; then + echo; echo ["configure: $0: fatal: need nm"] + exit 1 +fi +cat > conftest.s <) + gmp_tmp_val=`$NM conftest.o | grep foo | sed -e 's;[[][0-9][]]\(.*\);\1;' \ + -e 's;[^1-9]*\([0-9]*\).*;\1;'` + changequote([, ])dnl + if test "$gmp_tmp_val" = "10" || test "$gmp_tmp_val" = "16"; then + gmp_cv_check_asm_align_log=yes + else + gmp_cv_check_asm_align_log=no + fi +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.s >&AC_FD_CC +fi +rm -f conftest* +]) +GMP_DEFINE_RAW(["define(,<$gmp_cv_check_asm_align_log>)"]) +if test "$gmp_cv_check_asm_align_log" = "yes"; then + ifelse([$1], , :, [$1]) +else + ifelse([$2], , :, [$2]) +fi +])dnl + + +dnl GMP_CHECK_ASM_ALIGN_FILL_0x90 +dnl ----------------------------- +dnl Determine whether a ",0x90" suffix works on a .align directive. +dnl This is only meant for use on x86, where 0x90 is a "nop". +dnl +dnl Old gas, eg. 1.92.3 - needs ",0x90" or else the fill is an invalid 0x00. +dnl New gas, eg. 2.91 - generates the good multibyte nop fills even when +dnl ",0x90" is given. +dnl Solaris 2.6 as - doesn't allow ",0x90", gives a fatal error. +dnl Solaris 2.8 as - gives a warning for ",0x90", no ill effect. +dnl +dnl Note that both solaris "as"s only care about ",0x90" if they actually +dnl have to use it to fill something, hence the .byte in the sample. It's +dnl only the second .align that provokes an error or warning. +dnl +dnl We prefer to suppress the warning from solaris 2.8 to stop anyone +dnl worrying something might be wrong. + +AC_DEFUN(GMP_CHECK_ASM_ALIGN_FILL_0x90, +[AC_CACHE_CHECK([if the .align directive accepts an 0x90 fill in .text], + gmp_cv_check_asm_align_fill_0x90, +[AC_REQUIRE([GMP_CHECK_ASM_TEXT]) +cat > conftest.s <&AC_FD_CC + if echo "$gmp_tmp_val" | grep "Warning: Fill parameter ignored for executable section"; then + echo "Supressing this warning by omitting 0x90" 1>&AC_FD_CC + gmp_cv_check_asm_align_fill_0x90=no + else + gmp_cv_check_asm_align_fill_0x90=yes + fi +else + echo "Non-zero exit code" 1>&AC_FD_CC + echo "$gmp_tmp_val" 1>&AC_FD_CC + gmp_cv_check_asm_align_fill_0x90=no +fi +rm -f conftest* +]) +GMP_DEFINE_RAW( +["define(,<$gmp_cv_check_asm_align_fill_0x90>)"]) +]) + + +dnl GMP_CHECK_ASM_TEXT +AC_DEFUN(GMP_CHECK_ASM_TEXT, +[AC_CACHE_CHECK([how to switch to text section], gmp_cv_check_asm_text, +[case "$target" in + *-*-aix*) + changequote({, }) + gmp_cv_check_asm_text={".csect .text[PR]"} + changequote([, ]) + ;; + *-*-hpux*) gmp_cv_check_asm_text=[".code"] ;; + *) gmp_cv_check_asm_text=[".text"] ;; +esac +]) +echo ["define(, <$gmp_cv_check_asm_text>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_DATA +dnl Can we say `.data'? +AC_DEFUN(GMP_CHECK_ASM_DATA, +[AC_CACHE_CHECK([how to switch to data section], gmp_cv_check_asm_data, +[case "$target" in + *-*-aix*) + changequote({, }) + gmp_cv_check_asm_data={".csect .data[RW]"} + changequote([, ]) + ;; + *) gmp_cv_check_asm_data=[".data"] ;; +esac +]) +echo ["define(, <$gmp_cv_check_asm_data>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_GLOBL +dnl Can we say `.global'? +AC_DEFUN(GMP_CHECK_ASM_GLOBL, +[AC_CACHE_CHECK([how to export a symbol], gmp_cv_check_asm_globl, +[case "$target" in + *-*-hpux*) gmp_cv_check_asm_globl=[".export"] ;; + *) gmp_cv_check_asm_globl=[".globl"] ;; +esac +]) +echo ["define(, <$gmp_cv_check_asm_globl>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_TYPE +dnl Can we say `.type'? +AC_DEFUN(GMP_CHECK_ASM_TYPE, +[AC_CACHE_CHECK([how the .type assembly directive should be used], +gmp_cv_check_asm_type, +[ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC" +for gmp_tmp_prefix in @ \# %; do + echo " .type sym,${gmp_tmp_prefix}function" > conftest.s + if AC_TRY_EVAL(ac_assemble); then + gmp_cv_check_asm_type="[.type \$][1,${gmp_tmp_prefix}\$][2]" + break + fi +done +if test -z "$gmp_cv_check_asm_type"; then + gmp_cv_check_asm_type="[dnl]" +fi +]) +echo ["define(, <$gmp_cv_check_asm_type>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_SIZE +dnl Can we say `.size'? +AC_DEFUN(GMP_CHECK_ASM_SIZE, +[AC_CACHE_CHECK([if the .size assembly directive works], gmp_cv_check_asm_size, +[ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC" +echo ' .size sym,1' > conftest.s +if AC_TRY_EVAL(ac_assemble); then + gmp_cv_check_asm_size="[.size \$][1,\$][2]" +else + gmp_cv_check_asm_size="[dnl]" +fi +]) +echo ["define(, <$gmp_cv_check_asm_size>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_LSYM_PREFIX +dnl What is the prefix for a local label? +dnl Requires NM to be set to nm for target. +AC_DEFUN(GMP_CHECK_ASM_LSYM_PREFIX, +[AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX]) +AC_CACHE_CHECK([what prefix to use for a local label], +gmp_cv_check_asm_lsym_prefix, +[if test -z "$NM"; then + echo; echo ["$0: fatal: need nm"] + exit 1 +fi +ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC" +gmp_cv_check_asm_lsym_prefix="L" +for gmp_tmp_pre in L .L $ L$; do + cat > conftest.s </dev/null 2>&1 + gmp_rc=$? + if test "$gmp_rc" != "0"; then + echo "configure: $NM failure, using default" + break + fi + if $NM conftest.o | grep gurkmacka >/dev/null; then true; else + gmp_cv_check_asm_lsym_prefix="$gmp_tmp_pre" + break + fi + else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.s >&AC_FD_CC + # Use default. + fi +done +rm -f conftest* +]) +echo ["define(, <${gmp_cv_check_asm_lsym_prefix}>)"] >> $gmp_tmpconfigm4 +]) + +dnl GMP_CHECK_ASM_W32 +dnl How to [define] a 32-bit word. +dnl Requires NM to be set to nm for target. +AC_DEFUN(GMP_CHECK_ASM_W32, +[AC_REQUIRE([GMP_CHECK_ASM_DATA]) +AC_REQUIRE([GMP_CHECK_ASM_GLOBL]) +AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX]) +AC_CACHE_CHECK([how to [define] a 32-bit word], + gmp_cv_check_asm_w32, +[if test -z "$NM"; then + echo; echo ["configure: $0: fatal: need nm"] + exit 1 +fi + +# FIXME: HPUX puts first symbol at 0x40000000, breaking our assumption +# that it's at 0x0. We'll have to declare another symbol before the +# .long/.word and look at the distance between the two symbols. The +# only problem is that the sed expression(s) barfs (on Solaris, for +# example) for the symbol with value 0. For now, HPUX uses .word. + +case "$target" in + *-*-hpux*) + gmp_cv_check_asm_w32=".word" + ;; + *-*-*) + ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC" + for gmp_tmp_op in .long .word; do + cat > conftest.s <) + gmp_tmp_val=`$NM conftest.o | grep foo | sed -e 's;[[][0-9][]]\(.*\);\1;' \ + -e 's;[^1-9]*\([0-9]*\).*;\1;'` + changequote([, ])dnl + if test "$gmp_tmp_val" = "4"; then + gmp_cv_check_asm_w32="$gmp_tmp_op" + break + fi + fi + done + ;; +esac + +if test -z "$gmp_cv_check_asm_w32"; then + echo; echo ["configure: $0: fatal: do not know how to define a 32-bit word"] + exit 1 +fi +rm -f conftest* +]) +echo ["define(, <$gmp_cv_check_asm_w32>)"] >> $gmp_tmpconfigm4 +]) + +dnl GMP_CHECK_ASM_MMX([ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]) +dnl Can we assemble MMX insns? +AC_DEFUN(GMP_CHECK_ASM_MMX, +[AC_REQUIRE([GMP_CHECK_ASM_TEXT]) +AC_CACHE_CHECK([if the assembler knows about MMX instructions], + gmp_cv_check_asm_mmx, +[cat > conftest.s < conftest.s <conftest.c </dev/null]), +[^.*$1[ ]+],[]), +[[ + ]*$],[])]) + + +dnl GMP_VERSION +dnl ----------- +dnl The gmp version number, extracted from the #defines in gmp.h. +dnl Two digits like 3.0 if patchlevel <= 0, or three digits like 3.0.1 if +dnl patchlevel > 0. + +define(GMP_VERSION, +[GMP_HEADER_GETVAL(__GNU_MP_VERSION,gmp.h)[]dnl +.GMP_HEADER_GETVAL(__GNU_MP_VERSION_MINOR,gmp.h)[]dnl +ifelse(m4_eval(GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp.h) > 0),1, +[.GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp.h)])]) + + +dnl GMP_PROG_M4() +dnl ------------- +dnl +dnl Find a working m4, either in $PATH or likely locations, and setup $M4 +dnl and an AC_SUBST accordingly. If $M4 is already set then it's a user +dnl choice and is accepted with no checks. GMP_PROG_M4 is like +dnl AC_PATH_PROG or AC_CHECK_PROG, but it tests each m4 found to see if +dnl it's good enough. +dnl +dnl See mpn/asm-defs.m4 for details on the known bad m4s. + +AC_DEFUN(GMP_PROG_M4, +[AC_CACHE_CHECK([for suitable m4], + gmp_cv_prog_m4, +[if test -n "$M4"; then + gmp_cv_prog_m4="$M4" +else + cat >conftest.m4 <<\EOF +dnl must protect this against being expanded during autoconf m4! +[define(dollarhash,``$][#'')dnl +ifelse(dollarhash(x),1,`define(t1,Y)', +``bad: $][# not supported (SunOS /usr/bin/m4) +'')dnl +ifelse(eval(89),89,`define(t2,Y)', +`bad: eval() doesnt support 8 or 9 in a constant (OpenBSD 2.6 m4) +')dnl +ifelse(t1`'t2,YY,`good +')dnl] +EOF + echo "trying m4" 1>&AC_FD_CC + gmp_tmp_val="`(m4 conftest.m4) 2>&AC_FD_CC`" + echo "$gmp_tmp_val" 1>&AC_FD_CC + if test "$gmp_tmp_val" = good; then + gmp_cv_prog_m4="m4" + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="$PATH:/usr/5bin" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + echo "trying $ac_dir/m4" 1>&AC_FD_CC + gmp_tmp_val="`($ac_dir/m4 conftest.m4) 2>&AC_FD_CC`" + echo "$gmp_tmp_val" 1>&AC_FD_CC + if test "$gmp_tmp_val" = good; then + gmp_cv_prog_m4="$ac_dir/m4" + break + fi + done + IFS="$ac_save_ifs" + if test -z "$gmp_cv_prog_m4"; then + AC_MSG_ERROR([No usable m4 in \$PATH or /usr/5bin (see config.log for reasons).]) + fi + fi + rm -f conftest.m4 +fi]) +M4="$gmp_cv_prog_m4" +AC_SUBST(M4) +]) + + +dnl GMP_PROG_CC_FIND([CC_LIST], [REQ_64BIT_CC]) +dnl Find first working compiler in CC_LIST. +dnl If REQ_64BIT_CC is "yes", the compiler is required to be able to +dnl produce 64-bit code. +dnl NOTE: If a compiler needs any special flags for producing 64-bit code, +dnl these have to be found in shell variable `gmp_cflags64_{cc}', where `{cc}' +dnl is the name of the compiler. +dnl Set CC to the name of the first working compiler. +dnl If a 64-bit compiler is found, set CC64 to the name of the compiler and +dnl CFLAGS64 to flags to use. +dnl This macro does not test if any of the compilers found is a GNU compiler. +dnl To do this, when you have finally made up your mind on which one to use, +dnl and set CC accordingly, invoke [GMP_PROG_CC_SELECT]. That macro will +dnl also make sure that your selection of CFLAGS is valid. +dnl +AC_DEFUN(GMP_PROG_CC_FIND, +[AC_BEFORE([$0], [CC_PROG_CPP]) +ifelse([$1], , gmp_cc_list="gcc cc", gmp_cc_list="[$1]") +ifelse([$2], , gmp_req_64bit_cc="no", gmp_req_64bit_cc="[$2]") + +CC32= +CC64= +for c in $gmp_cc_list; do + # Avoid cache hits. + unset CC + unset ac_cv_prog_CC + AC_CHECK_TOOL(CC, $c, $c) + if test -n "$CC"; then + eval c_flags=\$gmp_cflags_$c + GMP_PROG_CC_WORKS($CC, $c_flags, + gmp_prog_cc_works=yes, + gmp_prog_cc_works=no) + + if test "$gmp_prog_cc_works" != "yes"; then + continue + fi + + # Save first working compiler, whether 32- or 64-bit capable. + if test -z "$CC32"; then + CC32="$CC" + fi + if test "$gmp_req_64bit_cc" = "yes"; then + eval c_flags=\$gmp_cflags64_$c + + # Verify that the compiler works in 64-bit mode as well. + # /usr/ucb/cc on Solaris 7 can *compile* in 64-bit mode, but not link. + GMP_PROG_CC_WORKS($c, $c_flags, + gmp_prog_cc_works=yes, + gmp_prog_cc_works=no) + + if test "$gmp_prog_cc_works" = "yes"; then + GMP_CHECK_CC_64BIT($c, $c_flags) + if test "$gmp_cv_cc_64bit" = "yes"; then + test -z "$CC64" && CC64="$c" + test -z "$CFLAGS64" && CFLAGS64="$c_flags" + # We have CC64 so we're done. + break + fi + fi + else + # We have CC32, and we don't need a 64-bit compiler so we're done. + break + fi + fi +done +CC="$CC32" +])dnl + +dnl GMP_PROG_CC_SELECT +dnl Check that `CC' works with `CFLAGS'. Check if `CC' is a GNU compiler. +dnl Cache the result as `ac_cv_prog_CC'. +AC_DEFUN(GMP_PROG_CC_SELECT, +[AC_BEFORE([$0], [CC_PROG_CPP]) +AC_PROG_CC_WORKS +AC_PROG_CC_GNU + +if test "$ac_cv_prog_gcc" = "yes"; then + GCC=yes +else + GCC= +fi + +# Set CFLAGS if not already set. +if test -z "$CFLAGS"; then + CFLAGS="-g" + if test "$GCC" = "yes"; then + CFLAGS="$CFLAGS -O2" + fi +fi + +AC_SUBST(CC) +AC_CACHE_VAL(ac_cv_prog_CC, ac_cv_prog_CC="$CC") +AC_PROVIDE([AC_PROG_CC]) +])dnl + +dnl GMP_CHECK_CC_64BIT(cc, cflags64) +dnl Find out if `CC' can produce 64-bit code. +dnl Requires NM to be set to nm for target. +dnl FIXME: Cache result. +AC_DEFUN(GMP_CHECK_CC_64BIT, +[ + gmp_tmp_CC_save="$CC" + CC="[$1]" + AC_MSG_CHECKING([whether the C compiler ($CC) is 64-bit capable]) + if test -z "$NM"; then + echo; echo ["configure: $0: fatal: need nm"] + exit 1 + fi + gmp_tmp_CFLAGS_save="$CFLAGS" + CFLAGS="[$2]" + + case "$target" in + hppa2.0*-*-*) + # FIXME: If gcc is installed under another name than "gcc", we will + # test the wrong thing. + if test "$CC" != "gcc"; then + dnl Let compiler version A.10.32.30 or higher be ok. + dnl Bad compiler output: + dnl ccom: HP92453-01 G.10.32.05 HP C Compiler + dnl Good compiler output: + dnl ccom: HP92453-01 A.10.32.30 HP C Compiler + echo >conftest.c + gmp_tmp_vs=`$CC $CFLAGS -V -c -o conftest.o conftest.c 2>&1 | grep "^ccom:"` + rm conftest* + gmp_tmp_v1=`echo $gmp_tmp_vs | sed 's/.* .\.\(.*\)\..*\..* HP C.*/\1/'` + gmp_tmp_v2=`echo $gmp_tmp_vs | sed 's/.* .\..*\.\(.*\)\..* HP C.*/\1/'` + gmp_tmp_v3=`echo $gmp_tmp_vs | sed 's/.* .\..*\..*\.\(.*\) HP C.*/\1/'` + gmp_cv_cc_64bit=no + test -n "$gmp_tmp_v1" && test "$gmp_tmp_v1" -ge "10" \ + && test -n "$gmp_tmp_v2" && test "$gmp_tmp_v2" -ge "32" \ + && test -n "$gmp_tmp_v3" && test "$gmp_tmp_v3" -ge "30" \ + && gmp_cv_cc_64bit=yes + else # gcc + # FIXME: Compile a minimal file and determine if the resulting object + # file is an ELF file. If so, gcc can produce 64-bit code. + # Do we have file(1) for target? + gmp_cv_cc_64bit=no + fi + ;; + mips-sgi-irix6.*) + # We use `-n32' to cc and `-mabi=n32' to gcc, resulting in 64-bit + # arithmetic but not 64-bit pointers, so the general test for sizeof + # (void *) is not valid. + # Simply try to compile an empty main. If that succeeds return + # true. + AC_TRY_COMPILE( , , + gmp_cv_cc_64bit=yes, gmp_cv_cc_64bit=no, + gmp_cv_cc_64bit=no) + ;; + *-*-*) + # Allocate an array of size sizeof (void *) and use nm to determine its + # size. We depend on the first declared variable being put at address 0. + cat >conftest.c <)dnl + gmp_tmp_val=`$NM conftest.o | grep post | sed -e 's;[[][0-9][]]\(.*\);\1;' \ + -e 's;[^1-9]*\([0-9]*\).*;\1;'` + changequote([, ])dnl + if test "$gmp_tmp_val" = "8"; then + gmp_cv_cc_64bit=yes + else + gmp_cv_cc_64bit=no + fi + else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + gmp_cv_cc_64bit=no + fi + rm -f conftest* + ;; + esac + + CC="$gmp_tmp_CC_save" + CFLAGS="$gmp_tmp_CFLAGS_save" + AC_MSG_RESULT($gmp_cv_cc_64bit) +])dnl + +dnl GMP_INIT([M4-DEF-FILE]) +dnl +AC_DEFUN(GMP_INIT, +[ifelse([$1], , gmp_configm4=config.m4, gmp_configm4="[$1]") +gmp_tmpconfigm4=cnfm4.tmp +gmp_tmpconfigm4i=cnfm4i.tmp +gmp_tmpconfigm4p=cnfm4p.tmp +test -f $gmp_tmpconfigm4 && rm $gmp_tmpconfigm4 +test -f $gmp_tmpconfigm4i && rm $gmp_tmpconfigm4i +test -f $gmp_tmpconfigm4p && rm $gmp_tmpconfigm4p +])dnl + +dnl GMP_FINISH +dnl ---------- +dnl Create config.m4 from its accumulated parts. +dnl +dnl __CONFIG_M4_INCLUDED__ is used so that a second or subsequent include +dnl of config.m4 is harmless. +dnl +dnl A separate ifdef on the angle bracket quoted part ensures the quoting +dnl style there is respected. The basic defines from gmp_tmpconfigm4 are +dnl fully quoted but are still put under an ifdef in case any have been +dnl redefined by one of the m4 include files. +dnl +dnl Doing a big ifdef within asm-defs.m4 and/or other macro files wouldn't +dnl work, since it'd interpret parentheses and quotes in dnl comments, and +dnl having a whole file as a macro argument would overflow the string space +dnl on BSD m4. + +AC_DEFUN(GMP_FINISH, +[AC_REQUIRE([GMP_INIT]) +echo "creating $gmp_configm4" +echo ["dnl $gmp_configm4. Generated automatically by configure."] > $gmp_configm4 +if test -f $gmp_tmpconfigm4; then + echo ["changequote(<,>)dnl"] >> $gmp_configm4 + echo ["ifdef(<__CONFIG_M4_INCLUDED__>,,<"] >> $gmp_configm4 + cat $gmp_tmpconfigm4 >> $gmp_configm4 + echo [">)"] >> $gmp_configm4 + echo ["changequote(\`,')dnl"] >> $gmp_configm4 + rm $gmp_tmpconfigm4 +fi +echo ["ifdef(\`__CONFIG_M4_INCLUDED__',,\`"] >> $gmp_configm4 +if test -f $gmp_tmpconfigm4i; then + cat $gmp_tmpconfigm4i >> $gmp_configm4 + rm $gmp_tmpconfigm4i +fi +if test -f $gmp_tmpconfigm4p; then + cat $gmp_tmpconfigm4p >> $gmp_configm4 + rm $gmp_tmpconfigm4p +fi +echo ["')"] >> $gmp_configm4 +echo ["define(\`__CONFIG_M4_INCLUDED__')"] >> $gmp_configm4 +])dnl + +dnl GMP_INCLUDE(FILE) +AC_DEFUN(GMP_INCLUDE, +[AC_REQUIRE([GMP_INIT]) +echo ["include(\`$1')"] >> $gmp_tmpconfigm4i +])dnl + +dnl GMP_SINCLUDE(FILE) +AC_DEFUN(GMP_SINCLUDE, +[AC_REQUIRE([GMP_INIT]) +echo ["sinclude(\`$1')"] >> $gmp_tmpconfigm4i +])dnl + +dnl GMP_DEFINE(MACRO, DEFINITION [, LOCATION]) +dnl [ Define M4 macro MACRO as DEFINITION in temporary file. ] +dnl [ If LOCATION is `POST', the definition will appear after any ] +dnl [ include() directives inserted by GMP_INCLUDE/GMP_SINCLUDE. ] +dnl [ Mind the quoting! No shell variables will get expanded. ] +dnl [ Don't forget to invoke GMP_FINISH to create file config.m4. ] +dnl [ config.m4 uses `<' and '>' as quote characters for all defines. ] +AC_DEFUN(GMP_DEFINE, +[AC_REQUIRE([GMP_INIT]) +echo ['define(<$1>, <$2>)'] >> ifelse([$3], [POST], $gmp_tmpconfigm4p, $gmp_tmpconfigm4) +])dnl + +dnl GMP_DEFINE_RAW(STRING, [, LOCATION]) +dnl [ Put STRING in temporary file. ] +dnl [ If LOCATION is `POST', the definition will appear after any ] +dnl [ include() directives inserted by GMP_INCLUDE/GMP_SINCLUDE. ] +dnl [ Don't forget to invoke GMP_FINISH to create file config.m4. ] +AC_DEFUN(GMP_DEFINE_RAW, +[AC_REQUIRE([GMP_INIT]) +echo [$1] >> ifelse([$2], [POST], $gmp_tmpconfigm4p, $gmp_tmpconfigm4) +])dnl + +dnl GMP_CHECK_ASM_LABEL_SUFFIX +dnl Should a label have a colon or not? +AC_DEFUN(GMP_CHECK_ASM_LABEL_SUFFIX, +[AC_CACHE_CHECK([what assembly label suffix to use], + gmp_cv_check_asm_label_suffix, +[case "$target" in + *-*-hpux*) gmp_cv_check_asm_label_suffix=[""] ;; + *) gmp_cv_check_asm_label_suffix=[":"] ;; +esac +]) +echo ["define(, <\$][1$gmp_cv_check_asm_label_suffix>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Shamelessly borrowed from glibc. +AC_DEFUN(GMP_CHECK_ASM_UNDERSCORE, +[AC_CACHE_CHECK([if symbols are prefixed by underscore], + gmp_cv_check_asm_underscore, +[cat > conftest.$ac_ext </dev/null; then + gmp_cv_check_asm_underscore=yes + else + gmp_cv_check_asm_underscore=no + fi +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi +rm -f conftest* +]) +if test "$gmp_cv_check_asm_underscore" = "yes"; then + GMP_DEFINE(GSYM_PREFIX, [_]) + ifelse([$1], , :, [$1]) +else + GMP_DEFINE(GSYM_PREFIX, []) + ifelse([$2], , :, [$2]) +fi +])dnl + +dnl GMP_CHECK_ASM_ALIGN_LOG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Is parameter to `.align' logarithmic? +dnl Requires NM to be set to nm for target. +AC_DEFUN(GMP_CHECK_ASM_ALIGN_LOG, +[AC_REQUIRE([GMP_CHECK_ASM_GLOBL]) +AC_REQUIRE([GMP_CHECK_ASM_DATA]) +AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX]) +AC_CACHE_CHECK([if .align assembly directive is logarithmic], + gmp_cv_check_asm_align_log, +[if test -z "$NM"; then + echo; echo ["configure: $0: fatal: need nm"] + exit 1 +fi +cat > conftest.s <) + gmp_tmp_val=`$NM conftest.o | grep foo | sed -e 's;[[][0-9][]]\(.*\);\1;' \ + -e 's;[^1-9]*\([0-9]*\).*;\1;'` + changequote([, ])dnl + if test "$gmp_tmp_val" = "10" || test "$gmp_tmp_val" = "16"; then + gmp_cv_check_asm_align_log=yes + else + gmp_cv_check_asm_align_log=no + fi +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.s >&AC_FD_CC +fi +rm -f conftest* +]) +GMP_DEFINE_RAW(["define(,<$gmp_cv_check_asm_align_log>)"]) +if test "$gmp_cv_check_asm_align_log" = "yes"; then + ifelse([$1], , :, [$1]) +else + ifelse([$2], , :, [$2]) +fi +])dnl + + +dnl GMP_CHECK_ASM_ALIGN_FILL_0x90 +dnl ----------------------------- +dnl Determine whether a ",0x90" suffix works on a .align directive. +dnl This is only meant for use on x86, where 0x90 is a "nop". +dnl +dnl Old gas, eg. 1.92.3 - needs ",0x90" or else the fill is an invalid 0x00. +dnl New gas, eg. 2.91 - generates the good multibyte nop fills even when +dnl ",0x90" is given. +dnl Solaris 2.6 as - doesn't allow ",0x90", gives a fatal error. +dnl Solaris 2.8 as - gives a warning for ",0x90", no ill effect. +dnl +dnl Note that both solaris "as"s only care about ",0x90" if they actually +dnl have to use it to fill something, hence the .byte in the sample. It's +dnl only the second .align that provokes an error or warning. +dnl +dnl We prefer to suppress the warning from solaris 2.8 to stop anyone +dnl worrying something might be wrong. + +AC_DEFUN(GMP_CHECK_ASM_ALIGN_FILL_0x90, +[AC_CACHE_CHECK([if the .align directive accepts an 0x90 fill in .text], + gmp_cv_check_asm_align_fill_0x90, +[AC_REQUIRE([GMP_CHECK_ASM_TEXT]) +cat > conftest.s <&AC_FD_CC + if echo "$gmp_tmp_val" | grep "Warning: Fill parameter ignored for executable section"; then + echo "Supressing this warning by omitting 0x90" 1>&AC_FD_CC + gmp_cv_check_asm_align_fill_0x90=no + else + gmp_cv_check_asm_align_fill_0x90=yes + fi +else + echo "Non-zero exit code" 1>&AC_FD_CC + echo "$gmp_tmp_val" 1>&AC_FD_CC + gmp_cv_check_asm_align_fill_0x90=no +fi +rm -f conftest* +]) +GMP_DEFINE_RAW( +["define(,<$gmp_cv_check_asm_align_fill_0x90>)"]) +]) + + +dnl GMP_CHECK_ASM_TEXT +AC_DEFUN(GMP_CHECK_ASM_TEXT, +[AC_CACHE_CHECK([how to switch to text section], gmp_cv_check_asm_text, +[case "$target" in + *-*-aix*) + changequote({, }) + gmp_cv_check_asm_text={".csect .text[PR]"} + changequote([, ]) + ;; + *-*-hpux*) gmp_cv_check_asm_text=[".code"] ;; + *) gmp_cv_check_asm_text=[".text"] ;; +esac +]) +echo ["define(, <$gmp_cv_check_asm_text>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_DATA +dnl Can we say `.data'? +AC_DEFUN(GMP_CHECK_ASM_DATA, +[AC_CACHE_CHECK([how to switch to data section], gmp_cv_check_asm_data, +[case "$target" in + *-*-aix*) + changequote({, }) + gmp_cv_check_asm_data={".csect .data[RW]"} + changequote([, ]) + ;; + *) gmp_cv_check_asm_data=[".data"] ;; +esac +]) +echo ["define(, <$gmp_cv_check_asm_data>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_GLOBL +dnl Can we say `.global'? +AC_DEFUN(GMP_CHECK_ASM_GLOBL, +[AC_CACHE_CHECK([how to export a symbol], gmp_cv_check_asm_globl, +[case "$target" in + *-*-hpux*) gmp_cv_check_asm_globl=[".export"] ;; + *) gmp_cv_check_asm_globl=[".globl"] ;; +esac +]) +echo ["define(, <$gmp_cv_check_asm_globl>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_TYPE +dnl Can we say `.type'? +AC_DEFUN(GMP_CHECK_ASM_TYPE, +[AC_CACHE_CHECK([how the .type assembly directive should be used], +gmp_cv_check_asm_type, +[ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC" +for gmp_tmp_prefix in @ \# %; do + echo " .type sym,${gmp_tmp_prefix}function" > conftest.s + if AC_TRY_EVAL(ac_assemble); then + gmp_cv_check_asm_type="[.type \$][1,${gmp_tmp_prefix}\$][2]" + break + fi +done +if test -z "$gmp_cv_check_asm_type"; then + gmp_cv_check_asm_type="[dnl]" +fi +]) +echo ["define(, <$gmp_cv_check_asm_type>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_SIZE +dnl Can we say `.size'? +AC_DEFUN(GMP_CHECK_ASM_SIZE, +[AC_CACHE_CHECK([if the .size assembly directive works], gmp_cv_check_asm_size, +[ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC" +echo ' .size sym,1' > conftest.s +if AC_TRY_EVAL(ac_assemble); then + gmp_cv_check_asm_size="[.size \$][1,\$][2]" +else + gmp_cv_check_asm_size="[dnl]" +fi +]) +echo ["define(, <$gmp_cv_check_asm_size>)"] >> $gmp_tmpconfigm4 +])dnl + +dnl GMP_CHECK_ASM_LSYM_PREFIX +dnl What is the prefix for a local label? +dnl Requires NM to be set to nm for target. +AC_DEFUN(GMP_CHECK_ASM_LSYM_PREFIX, +[AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX]) +AC_CACHE_CHECK([what prefix to use for a local label], +gmp_cv_check_asm_lsym_prefix, +[if test -z "$NM"; then + echo; echo ["$0: fatal: need nm"] + exit 1 +fi +ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC" +gmp_cv_check_asm_lsym_prefix="L" +for gmp_tmp_pre in L .L $ L$; do + cat > conftest.s </dev/null 2>&1 + gmp_rc=$? + if test "$gmp_rc" != "0"; then + echo "configure: $NM failure, using default" + break + fi + if $NM conftest.o | grep gurkmacka >/dev/null; then true; else + gmp_cv_check_asm_lsym_prefix="$gmp_tmp_pre" + break + fi + else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.s >&AC_FD_CC + # Use default. + fi +done +rm -f conftest* +]) +echo ["define(, <${gmp_cv_check_asm_lsym_prefix}>)"] >> $gmp_tmpconfigm4 +]) + +dnl GMP_CHECK_ASM_W32 +dnl How to [define] a 32-bit word. +dnl Requires NM to be set to nm for target. +AC_DEFUN(GMP_CHECK_ASM_W32, +[AC_REQUIRE([GMP_CHECK_ASM_DATA]) +AC_REQUIRE([GMP_CHECK_ASM_GLOBL]) +AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX]) +AC_CACHE_CHECK([how to [define] a 32-bit word], + gmp_cv_check_asm_w32, +[if test -z "$NM"; then + echo; echo ["configure: $0: fatal: need nm"] + exit 1 +fi + +# FIXME: HPUX puts first symbol at 0x40000000, breaking our assumption +# that it's at 0x0. We'll have to declare another symbol before the +# .long/.word and look at the distance between the two symbols. The +# only problem is that the sed expression(s) barfs (on Solaris, for +# example) for the symbol with value 0. For now, HPUX uses .word. + +case "$target" in + *-*-hpux*) + gmp_cv_check_asm_w32=".word" + ;; + *-*-*) + ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC" + for gmp_tmp_op in .long .word; do + cat > conftest.s <) + gmp_tmp_val=`$NM conftest.o | grep foo | sed -e 's;[[][0-9][]]\(.*\);\1;' \ + -e 's;[^1-9]*\([0-9]*\).*;\1;'` + changequote([, ])dnl + if test "$gmp_tmp_val" = "4"; then + gmp_cv_check_asm_w32="$gmp_tmp_op" + break + fi + fi + done + ;; +esac + +if test -z "$gmp_cv_check_asm_w32"; then + echo; echo ["configure: $0: fatal: do not know how to define a 32-bit word"] + exit 1 +fi +rm -f conftest* +]) +echo ["define(, <$gmp_cv_check_asm_w32>)"] >> $gmp_tmpconfigm4 +]) + +dnl GMP_CHECK_ASM_MMX([ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]) +dnl Can we assemble MMX insns? +AC_DEFUN(GMP_CHECK_ASM_MMX, +[AC_REQUIRE([GMP_CHECK_ASM_TEXT]) +AC_CACHE_CHECK([if the assembler knows about MMX instructions], + gmp_cv_check_asm_mmx, +[cat > conftest.s < conftest.s <conftest.c < +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + +# Do all the work for Automake. 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. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# 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 ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $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 + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + + +# serial 40 AC_PROG_LIBTOOL +AC_DEFUN(AC_PROG_LIBTOOL, +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN(AC_LIBTOOL_SETUP, +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +dnl + +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$lt_target" in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_SHARED, [dnl +define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_STATIC, [dnl +define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl +define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AC_PROG_LD, +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. +changequote(,)dnl + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' +changequote([,])dnl + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(ac_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$ac_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN(AC_PROG_LD_GNU, +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi]) +]) + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AC_PROG_NM, +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(ac_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm +fi]) +NM="$ac_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN(AC_CHECK_LIBM, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case "$lt_target" in +*-*-beos* | *-*-cygwin*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library, adds --enable-ltdl-convenience to +# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor +# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed +# to be `${top_builddir}/libltdl'. Make sure you start DIR with +# '${top_builddir}/' (note the single quotes!) if your package is not +# flat, and, if you're not using automake, define top_builddir as +# appropriate in the Makefiles. +AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case "$enable_ltdl_convenience" in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la + INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library, and adds --enable-ltdl-install to +# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor +# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed +# to be `${top_builddir}/libltdl'. Make sure you start DIR with +# '${top_builddir}/' (note the single quotes!) if your package is not +# flat, and, if you're not using automake, define top_builddir as +# appropriate in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la + INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +dnl old names +AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl +AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl +AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl +AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl +AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl +AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl +AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + diff --git a/ghc/rts/gmp/ansi2knr.1 b/ghc/rts/gmp/ansi2knr.1 new file mode 100644 index 0000000..f9ee5a6 --- /dev/null +++ b/ghc/rts/gmp/ansi2knr.1 @@ -0,0 +1,36 @@ +.TH ANSI2KNR 1 "19 Jan 1996" +.SH NAME +ansi2knr \- convert ANSI C to Kernighan & Ritchie C +.SH SYNOPSIS +.I ansi2knr +[--varargs] input_file [output_file] +.SH DESCRIPTION +If no output_file is supplied, output goes to stdout. +.br +There are no error messages. +.sp +.I ansi2knr +recognizes function definitions by seeing a non-keyword identifier at the left +margin, followed by a left parenthesis, with a right parenthesis as the last +character on the line, and with a left brace as the first token on the +following line (ignoring possible intervening comments). It will recognize a +multi-line header provided that no intervening line ends with a left or right +brace or a semicolon. These algorithms ignore whitespace and comments, except +that the function name must be the first thing on the line. +.sp +The following constructs will confuse it: +.br + - Any other construct that starts at the left margin and follows the +above syntax (such as a macro or function call). +.br + - Some macros that tinker with the syntax of the function header. +.sp +The --varargs switch is obsolete, and is recognized only for +backwards compatibility. The present version of +.I ansi2knr +will always attempt to convert a ... argument to va_alist and va_dcl. +.SH AUTHOR +L. Peter Deutsch wrote the original ansi2knr and +continues to maintain the current version; most of the code in the current +version is his work. ansi2knr also includes contributions by Francois +Pinard and Jim Avera . diff --git a/ghc/rts/gmp/config.in b/ghc/rts/gmp/config.in new file mode 100644 index 0000000..8b2546e --- /dev/null +++ b/ghc/rts/gmp/config.in @@ -0,0 +1,162 @@ +/* config.in. Generated automatically from configure.in by autoheader. */ +/* +Copyright (C) 2000 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The GNU MP Library 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 Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library; see the file COPYING.LIB. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +MA 02111-1307, USA. +*/ + + +/* Define if a limb is long long. */ +#undef _LONG_LONG_LIMB + +/* Define if we have native implementation of function. */ +#undef HAVE_NATIVE_ +#undef HAVE_NATIVE_mpn_add +#undef HAVE_NATIVE_mpn_add_1 +#undef HAVE_NATIVE_mpn_add_n +#undef HAVE_NATIVE_mpn_add_nc +#undef HAVE_NATIVE_mpn_addmul_1 +#undef HAVE_NATIVE_mpn_addmul_1c +#undef HAVE_NATIVE_mpn_addsub_n +#undef HAVE_NATIVE_mpn_addsub_nc +#undef HAVE_NATIVE_mpn_and_n +#undef HAVE_NATIVE_mpn_andn_n +#undef HAVE_NATIVE_mpn_bdivmod +#undef HAVE_NATIVE_mpn_cmp +#undef HAVE_NATIVE_mpn_com_n +#undef HAVE_NATIVE_mpn_copyd +#undef HAVE_NATIVE_mpn_copyi +#undef HAVE_NATIVE_mpn_divexact_by3c +#undef HAVE_NATIVE_mpn_divrem +#undef HAVE_NATIVE_mpn_divrem_1 +#undef HAVE_NATIVE_mpn_divrem_1c +#undef HAVE_NATIVE_mpn_divrem_2 +#undef HAVE_NATIVE_mpn_divrem_newton +#undef HAVE_NATIVE_mpn_divrem_classic +#undef HAVE_NATIVE_mpn_dump +#undef HAVE_NATIVE_mpn_gcd +#undef HAVE_NATIVE_mpn_gcd_1 +#undef HAVE_NATIVE_mpn_gcdext +#undef HAVE_NATIVE_mpn_get_str +#undef HAVE_NATIVE_mpn_hamdist +#undef HAVE_NATIVE_mpn_invert_limb +#undef HAVE_NATIVE_mpn_ior_n +#undef HAVE_NATIVE_mpn_iorn_n +#undef HAVE_NATIVE_mpn_lshift +#undef HAVE_NATIVE_mpn_mod_1 +#undef HAVE_NATIVE_mpn_mod_1c +#undef HAVE_NATIVE_mpn_mul +#undef HAVE_NATIVE_mpn_mul_1 +#undef HAVE_NATIVE_mpn_mul_1c +#undef HAVE_NATIVE_mpn_mul_basecase +#undef HAVE_NATIVE_mpn_mul_n +#undef HAVE_NATIVE_mpn_nand_n +#undef HAVE_NATIVE_mpn_nior_n +#undef HAVE_NATIVE_mpn_perfect_square_p +#undef HAVE_NATIVE_mpn_popcount +#undef HAVE_NATIVE_mpn_preinv_mod_1 +#undef HAVE_NATIVE_mpn_random2 +#undef HAVE_NATIVE_mpn_random +#undef HAVE_NATIVE_mpn_rawrandom +#undef HAVE_NATIVE_mpn_rshift +#undef HAVE_NATIVE_mpn_scan0 +#undef HAVE_NATIVE_mpn_scan1 +#undef HAVE_NATIVE_mpn_set_str +#undef HAVE_NATIVE_mpn_sqrtrem +#undef HAVE_NATIVE_mpn_sqr_basecase +#undef HAVE_NATIVE_mpn_sub +#undef HAVE_NATIVE_mpn_sub_1 +#undef HAVE_NATIVE_mpn_sub_n +#undef HAVE_NATIVE_mpn_sub_nc +#undef HAVE_NATIVE_mpn_submul_1 +#undef HAVE_NATIVE_mpn_submul_1c +#undef HAVE_NATIVE_mpn_udiv_w_sdiv +#undef HAVE_NATIVE_mpn_umul_ppmm +#undef HAVE_NATIVE_mpn_udiv_qrnnd +#undef HAVE_NATIVE_mpn_xor_n +#undef HAVE_NATIVE_mpn_xnor_n + +/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. + */ +#undef HAVE_DECL_OPTARG + +/* ./configure --enable-assert option, to enable some ASSERT()s */ +#undef WANT_ASSERT + +/* Define if you have the header file. */ +#undef HAVE_SYS_SYSCTL_H + +/* Define if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Name of package */ +#undef PACKAGE + +/* Define if you have the `sysctlbyname' function. */ +#undef HAVE_SYSCTLBYNAME + +/* Define if the system has the type `void'. */ +#undef HAVE_VOID + +/* Define if you have the `popen' function. */ +#undef HAVE_POPEN + +/* ./configure --disable-alloca option, to use stack-alloc.c, not alloca */ +#undef USE_STACK_ALLOC + +/* Define if cpp supports the ANSI # stringizing operator. */ +#undef HAVE_STRINGIZE + +/* Define if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the `sysconf' function. */ +#undef HAVE_SYSCONF + +/* Define if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define if you have the `processor_info' function. */ +#undef HAVE_PROCESSOR_INFO + +/* Version number of package */ +#undef VERSION + +/* Define if you have the `getopt_long' function. */ +#undef HAVE_GETOPT_LONG + +/* Define if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if a speed_cyclecounter exists (for the tune programs) */ +#undef HAVE_SPEED_CYCLECOUNTER + +/* Define if mpn/tests has calling conventions checking for the CPU */ +#undef HAVE_CALLING_CONVENTIONS + +/* ./configure --enable-fft option, to enable FFTs for multiplication */ +#undef WANT_FFT + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H diff --git a/ghc/rts/gmp/mp.h b/ghc/rts/gmp/mp.h index 830b26b..774e6e5 100644 --- a/ghc/rts/gmp/mp.h +++ b/ghc/rts/gmp/mp.h @@ -1,28 +1,29 @@ /* mp.h -- Definitions for Berkeley compatible multiple precision functions. -Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1995, 1996, 2000 Free Software Foundation, +Inc. This file is part of the GNU MP Library. The GNU MP Library is free software; you can redistribute it and/or modify -it under the terms of the GNU Library General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at your +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU MP Library 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 Library General Public +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -You should have received a copy of the GNU Library General Public License +You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __MP_H__ -#ifndef __GNU_MP__ -#define __GNU_MP__ 2 +#ifndef __GNU_MP__ /* to allow inclusion of both gmp.h and mp.h */ +#define __GNU_MP__ 3 #define __need_size_t #include #undef __need_size_t @@ -65,76 +66,57 @@ typedef __gmp_const mp_limb_t * mp_srcptr; typedef int mp_size_t; typedef long int mp_exp_t; -#ifndef __MP_SMALL__ typedef struct { - mp_size_t _mp_alloc; /* Number of *limbs* allocated and pointed + int _mp_alloc; /* Number of *limbs* allocated and pointed to by the D field. */ - mp_size_t _mp_size; /* abs(SIZE) is the number of limbs - the last field points to. If SIZE - is negative this is a negative - number. */ - mp_limb_t *_mp_d; /* Pointer to the limbs. */ -} __mpz_struct; -#else -typedef struct -{ - short int _mp_alloc; /* Number of *limbs* allocated and pointed - to by the D field. */ - short int _mp_size; /* abs(SIZE) is the number of limbs + int _mp_size; /* abs(SIZE) is the number of limbs the last field points to. If SIZE is negative this is a negative number. */ mp_limb_t *_mp_d; /* Pointer to the limbs. */ } __mpz_struct; -#endif #endif /* __GNU_MP__ */ /* User-visible types. */ typedef __mpz_struct MINT; -#ifdef __STDC__ -void mp_set_memory_functions (void *(*) (size_t), - void *(*) (void *, size_t, size_t), - void (*) (void *, size_t)); -MINT *itom (signed short int); -MINT *xtom (const char *); -void move (const MINT *, MINT *); -void madd (const MINT *, const MINT *, MINT *); -void msub (const MINT *, const MINT *, MINT *); -void mult (const MINT *, const MINT *, MINT *); -void mdiv (const MINT *, const MINT *, MINT *, MINT *); -void sdiv (const MINT *, signed short int, MINT *, signed short int *); -void msqrt (const MINT *, MINT *, MINT *); -void pow (const MINT *, const MINT *, const MINT *, MINT *); -void rpow (const MINT *, signed short int, MINT *); -void gcd (const MINT *, const MINT *, MINT *); -int mcmp (const MINT *, const MINT *); -void min (MINT *); -void mout (const MINT *); -char *mtox (const MINT *); -void mfree (MINT *); +#ifndef _PROTO +#if (__STDC__-0) || defined (__cplusplus) +#define _PROTO(x) x #else +#define _PROTO(x) () +#endif +#endif + +#if defined (__cplusplus) +extern "C" { +#endif -void mp_set_memory_functions (); -MINT *itom (); -MINT *xtom (); -void move (); -void madd (); -void msub (); -void mult (); -void mdiv (); -void sdiv (); -void msqrt (); -void pow (); -void rpow (); -void gcd (); -int mcmp (); -void min (); -void mout (); -char *mtox (); -void mfree (); +void mp_set_memory_functions _PROTO ((void *(*) (size_t), + void *(*) (void *, size_t, size_t), + void (*) (void *, size_t))); +MINT *itom _PROTO ((signed short int)); +MINT *xtom _PROTO ((const char *)); +void move _PROTO ((const MINT *, MINT *)); +void madd _PROTO ((const MINT *, const MINT *, MINT *)); +void msub _PROTO ((const MINT *, const MINT *, MINT *)); +void mult _PROTO ((const MINT *, const MINT *, MINT *)); +void mdiv _PROTO ((const MINT *, const MINT *, MINT *, MINT *)); +void sdiv _PROTO ((const MINT *, signed short int, MINT *, signed short int *)); +void msqrt _PROTO ((const MINT *, MINT *, MINT *)); +void pow _PROTO ((const MINT *, const MINT *, const MINT *, MINT *)); +void rpow _PROTO ((const MINT *, signed short int, MINT *)); +void gcd _PROTO ((const MINT *, const MINT *, MINT *)); +int mcmp _PROTO ((const MINT *, const MINT *)); +void min _PROTO ((MINT *)); +void mout _PROTO ((const MINT *)); +char *mtox _PROTO ((const MINT *)); +void mfree _PROTO ((MINT *)); + +#if defined (__cplusplus) +} #endif #define __MP_H__ diff --git a/ghc/rts/gmp/stamp-h.in b/ghc/rts/gmp/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/ghc/rts/gmp/stamp-h.in @@ -0,0 +1 @@ +timestamp -- 1.7.10.4