Home | History | Annotate | Line # | Download | only in dist
INSTALL revision 1.1
      1  1.1  mrg Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
      2  1.1  mrg Contributed by the Arenaire and Cacao projects, INRIA.
      3  1.1  mrg 
      4  1.1  mrg This file is part of the GNU MPFR Library.
      5  1.1  mrg 
      6  1.1  mrg The GNU MPFR Library is free software; you can redistribute it and/or modify
      7  1.1  mrg it under the terms of the GNU Lesser General Public License as published by
      8  1.1  mrg the Free Software Foundation; either version 3 of the License, or (at your
      9  1.1  mrg option) any later version.
     10  1.1  mrg 
     11  1.1  mrg The GNU MPFR Library is distributed in the hope that it will be useful, but
     12  1.1  mrg WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     13  1.1  mrg or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
     14  1.1  mrg License for more details.
     15  1.1  mrg 
     16  1.1  mrg You should have received a copy of the GNU Lesser General Public License
     17  1.1  mrg along with the GNU MPFR Library; see the file COPYING.LESSER.  If not, see
     18  1.1  mrg http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
     19  1.1  mrg 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
     20  1.1  mrg 
     21  1.1  mrg 
     22  1.1  mrg 
     23  1.1  mrg                         Installing GNU MPFR
     24  1.1  mrg                         ===================
     25  1.1  mrg 
     26  1.1  mrg Note: In case of problem, please read this INSTALL file carefully before
     27  1.1  mrg reporting a bug, in particular Section "In case of problem" below. Some
     28  1.1  mrg problems are due to bad configuration on the user side (not specific to
     29  1.1  mrg MPFR).
     30  1.1  mrg 
     31  1.1  mrg 0. You first need to install GMP. See <http://www.gnu.org/software/gmp/>.
     32  1.1  mrg    MPFR requires GMP version 4.1 or later.
     33  1.1  mrg 
     34  1.1  mrg 1. Extract the files from the archive.
     35  1.1  mrg 
     36  1.1  mrg 2. It is strongly advised to apply the latest patches (if this has
     37  1.1  mrg    not been done yet), e.g.
     38  1.1  mrg      wget http://www.mpfr.org/mpfr-3.0.1/allpatches
     39  1.1  mrg      patch -N -Z -p1 < allpatches
     40  1.1  mrg    or
     41  1.1  mrg      curl http://www.mpfr.org/mpfr-3.0.1/allpatches | patch -N -Z -p1
     42  1.1  mrg 
     43  1.1  mrg    (Those instructions are for the GNU patch command, for example
     44  1.1  mrg     /usr/bin/gpatch on Solaris.)
     45  1.1  mrg 
     46  1.1  mrg 3. In the MPFR directory, to detect your system, type:
     47  1.1  mrg      ./configure
     48  1.1  mrg    possibly with options (see below, in particular if this step or
     49  1.1  mrg    one of the following fails).
     50  1.1  mrg    Note: paths provided in configure options must always be absolute
     51  1.1  mrg    (relative paths are not supported).
     52  1.1  mrg 
     53  1.1  mrg 4. To build the library, type:
     54  1.1  mrg      make
     55  1.1  mrg 
     56  1.1  mrg    [optional] if you want to tune MPFR for your specific architecture, see
     57  1.1  mrg    the section "Tuning MPFR" below. Note that for most common architectures,
     58  1.1  mrg    MPFR includes some default tuning parameters which should be near from
     59  1.1  mrg    optimal.
     60  1.1  mrg 
     61  1.1  mrg 5. To check the built library (runs the test files), type:
     62  1.1  mrg      make check
     63  1.1  mrg 
     64  1.1  mrg 6. To install it (default "/usr/local" | see "--prefix" option), type:
     65  1.1  mrg      make install
     66  1.1  mrg 
     67  1.1  mrg If you installed MPFR (header and library) in directories that are
     68  1.1  mrg not searched by default by the compiler and/or linking tools, then,
     69  1.1  mrg like with other libraries, you may need to set up some environment
     70  1.1  mrg variables such as C_INCLUDE_PATH (to find the header mpfr.h),
     71  1.1  mrg LIBRARY_PATH (to find the library), and if the shared library has
     72  1.1  mrg been installed, LD_LIBRARY_PATH (before execution) or LD_RUN_PATH
     73  1.1  mrg (before linking); this list is not exhaustive and some environment
     74  1.1  mrg variables may be specific to your system. "make install" gives some
     75  1.1  mrg instructions; please read them. You can also find more information
     76  1.1  mrg in the manuals of your compiler and linker. The MPFR FAQ may also
     77  1.1  mrg give some information.
     78  1.1  mrg 
     79  1.1  mrg Remember that if you have several MPFR (or GMP) versions installed
     80  1.1  mrg (e.g., one with the system, and one, newer, by you), you will not
     81  1.1  mrg necessarily get a compilation/linking error if a wrong library is
     82  1.1  mrg used (e.g., because LD_LIBRARY_PATH has not been set correctly).
     83  1.1  mrg But unexpected results may occur.
     84  1.1  mrg 
     85  1.1  mrg Under Mac OS X, if the shared library was not installed and you use
     86  1.1  mrg Apple's linker (this is the default), you will also need to provide
     87  1.1  mrg the -search_paths_first linker flag ("-Wl,-search_paths_first" when
     88  1.1  mrg you link via gcc) to make sure that the right library is selected,
     89  1.1  mrg as by default, Apple's linker selects a shared library preferably,
     90  1.1  mrg even when it is farther in the library paths. We recall that if a
     91  1.1  mrg wrong library is selected due to this behavior, unexpected results
     92  1.1  mrg may occur.
     93  1.1  mrg 
     94  1.1  mrg 
     95  1.1  mrg Building the documentation
     96  1.1  mrg ==========================
     97  1.1  mrg 
     98  1.1  mrg To build the documentation in various formats, you may first need to
     99  1.1  mrg install recent versions of some utilities such as texinfo.
    100  1.1  mrg 
    101  1.1  mrg * Type "make info" to produce the documentation in the info format.
    102  1.1  mrg 
    103  1.1  mrg * Type "make pdf" to produce the documentation in the PDF format.
    104  1.1  mrg 
    105  1.1  mrg * Type "make dvi" to produce the documentation in the DVI format.
    106  1.1  mrg 
    107  1.1  mrg * Type "make ps" to produce the documentation in the Postscript format.
    108  1.1  mrg 
    109  1.1  mrg * Type "make html" to produce the documentation in the HTML format
    110  1.1  mrg   (in several pages); if you want only one output HTML file, then
    111  1.1  mrg   type "makeinfo --html --no-split mpfr.texi" instead.
    112  1.1  mrg 
    113  1.1  mrg 
    114  1.1  mrg Building MPFR with internal GMP header files
    115  1.1  mrg ============================================
    116  1.1  mrg 
    117  1.1  mrg MPFR built with internal GMP header files is a bit faster, so you may want
    118  1.1  mrg to build it with them. Just do this in step 1:
    119  1.1  mrg 
    120  1.1  mrg   ./configure --with-gmp-build=GMPBUILD
    121  1.1  mrg 
    122  1.1  mrg where GMPBUILD is the GMP build directory. The needed header files are:
    123  1.1  mrg gmp-impl.h, longlong.h and all the necessary headers to use them.
    124  1.1  mrg 
    125  1.1  mrg As gmp-impl.h and longlong.h are only in the GMP source directory,
    126  1.1  mrg you first need to copy these files to the build directory if it is
    127  1.1  mrg different (there may be other workarounds, such as setting $CPPFLAGS
    128  1.1  mrg to search the GMP source directory).
    129  1.1  mrg 
    130  1.1  mrg Warning: the library obtained in this way may use some internal GMP
    131  1.1  mrg symbols, and thus dynamically linking your software with a different
    132  1.1  mrg version of GMP might fail, even though it is declared as compatible
    133  1.1  mrg by Libtool's versioning system.
    134  1.1  mrg 
    135  1.1  mrg 
    136  1.1  mrg Tuning MPFR
    137  1.1  mrg ===========
    138  1.1  mrg 
    139  1.1  mrg For this, you need to build MPFR with a GMP build directory (see above).
    140  1.1  mrg In the GMP build directory, you also need to go into the "tune" subdirectory
    141  1.1  mrg and type "make speed". This will build the GMP speed library, which is used
    142  1.1  mrg by the MPFR tuning mechanism.
    143  1.1  mrg 
    144  1.1  mrg Then go back to the MPFR build directory, and type "make tune". This will
    145  1.1  mrg build an optimized file "mparam.h" for your specific architecture.
    146  1.1  mrg 
    147  1.1  mrg 
    148  1.1  mrg ./configure options
    149  1.1  mrg ===================
    150  1.1  mrg 
    151  1.1  mrg --prefix=DIR            installs MPFR headers and library in DIR/include and
    152  1.1  mrg                         DIR/lib respectively (the default is "/usr/local").
    153  1.1  mrg 
    154  1.1  mrg --with-gmp-include=DIR  assumes that DIR contains gmp.h
    155  1.1  mrg --with-gmp-lib=DIR      assumes that DIR contains the GMP library
    156  1.1  mrg --with-gmp=DIR          assumes that DIR is where you have installed GMP.
    157  1.1  mrg                         same as --with-gmp-lib=DIR/lib
    158  1.1  mrg                         and     --with-gmp-include=DIR/include
    159  1.1  mrg                         (use either --with-gmp alone or one or both of
    160  1.1  mrg                         --with-gmp-lib/--with-gmp-include)
    161  1.1  mrg                         Warning! Do not use these options if you have
    162  1.1  mrg                         CPPFLAGS and/or LDFLAGS containing a -I or -L
    163  1.1  mrg                         option with a directory that contains a GMP
    164  1.1  mrg                         header or library file, as these options just
    165  1.1  mrg                         add -I and -L options to CPPFLAGS and LDFLAGS
    166  1.1  mrg                         *after* the ones that are currently declared,
    167  1.1  mrg                         so that DIR will have a lower precedence. Also,
    168  1.1  mrg                         this may not work if DIR is a system directory.
    169  1.1  mrg 
    170  1.1  mrg --with-gmp-build=DIR    assumes that DIR contains the GMP build directory,
    171  1.1  mrg                         and enables the use of GMP internals (see above).
    172  1.1  mrg                         Warning! This option and the group of options
    173  1.1  mrg                         --with-gmp are mutually exclusive.
    174  1.1  mrg 
    175  1.1  mrg --enable-assert         build MPFR with assertions.
    176  1.1  mrg 
    177  1.1  mrg --enable-thread-safe    build MPFR as thread safe, using compiler-level
    178  1.1  mrg                         Thread Local Storage (TLS). Note: TLS support is
    179  1.1  mrg                         roughly tested by configure. If configure detects
    180  1.1  mrg                         that TLS does not work (because of the compiler,
    181  1.1  mrg                         linker or system libraries), it will output an
    182  1.1  mrg                         error message, telling you to build MPFR without
    183  1.1  mrg                         thread safe. For instance, though Mac OS X uses
    184  1.1  mrg                         GCC, it may not currently support GCC's __thread
    185  1.1  mrg                         storage class.
    186  1.1  mrg 
    187  1.1  mrg Note: By default, the configure script tries to set CC/CFLAGS to GMP's
    188  1.1  mrg ones (this feature needs GMP 4.3.0 or later, or the --with-gmp-build
    189  1.1  mrg option). However this is not guaranteed to work as the configure script
    190  1.1  mrg does some compiler tests earlier, and the change may be too late. Also,
    191  1.1  mrg the values obtained from GMP may be incorrect if GMP has been built
    192  1.1  mrg on a different machine. In such a case, the user may need to specify
    193  1.1  mrg CC/CFLAGS as explained below.
    194  1.1  mrg 
    195  1.1  mrg Run "./configure --help" to see the other options (autoconf default options).
    196  1.1  mrg 
    197  1.1  mrg 
    198  1.1  mrg In case of problem
    199  1.1  mrg ==================
    200  1.1  mrg 
    201  1.1  mrg First, look for any warning message in the configure output.
    202  1.1  mrg 
    203  1.1  mrg Several documents may help you to solve the problem:
    204  1.1  mrg   * this INSTALL file, in particular information given below;
    205  1.1  mrg   * the FAQ (either the FAQ.html file distributed with MPFR, or the
    206  1.1  mrg     on-line version <http://www.mpfr.org/faq.html>, which may be more
    207  1.1  mrg     up-to-date);
    208  1.1  mrg   * the MPFR web page for this version <http://www.mpfr.org/mpfr-3.0.1/>,
    209  1.1  mrg     which lists bugs found in this version and provides some patches.
    210  1.1  mrg 
    211  1.1  mrg If the "configure" fails, please check that the C compiler and its
    212  1.1  mrg options are the same as those for the GMP build (specially the ABI).
    213  1.1  mrg You can see the latter with the following command:
    214  1.1  mrg 
    215  1.1  mrg   grep "^CC\|^CFLAGS" GMPBUILD/Makefile
    216  1.1  mrg 
    217  1.1  mrg if the GMP build directory is available. Then type:
    218  1.1  mrg 
    219  1.1  mrg   ./configure <configure options> CC=<C compiler> CFLAGS="<compiler options>"
    220  1.1  mrg 
    221  1.1  mrg (quotes are needed when there are spaces or other special characters
    222  1.1  mrg in the CC/CFLAGS value) and continue the install. On some platforms,
    223  1.1  mrg you should provide further options to match those used by GMP, or set
    224  1.1  mrg some environment variables. For instance, see the "Notes on AIX/PowerPC"
    225  1.1  mrg section below.
    226  1.1  mrg 
    227  1.1  mrg Warning! Do NOT use optimization options that can change the semantics
    228  1.1  mrg of math operations, such as GCC's -ffast-math or Sun CC's -fast.
    229  1.1  mrg Otherwise conversions from/to double's may be incorrect on infinities,
    230  1.1  mrg NaN's and signed zeros. Since native FP arithmetic is used in a few
    231  1.1  mrg places only, such options would not make MPFR faster anyway.
    232  1.1  mrg 
    233  1.1  mrg On some platforms, try with "gmake" (GNU make) instead of "make".
    234  1.1  mrg Problems have been reported with the Tru64 make.
    235  1.1  mrg 
    236  1.1  mrg If the configure script reports that gmp.h version and libgmp version
    237  1.1  mrg are different, or if the build was OK, but the tests failed to link
    238  1.1  mrg with GMP or gave an error like
    239  1.1  mrg 
    240  1.1  mrg   undefined reference to `__gmp_get_memory_functions'
    241  1.1  mrg 
    242  1.1  mrg meaning that the GMP library was not found or a wrong GMP library was
    243  1.1  mrg selected by the linker, then your library search paths are probably
    244  1.1  mrg not correctly set (some paths are missing or they are specified in an
    245  1.1  mrg incorrect order).
    246  1.1  mrg 
    247  1.1  mrg Such problems commonly occur under some GNU/Linux machines, where the
    248  1.1  mrg default header and library search paths may be inconsistent: GCC is
    249  1.1  mrg configured to search /usr/local/include and /usr/local/lib by default,
    250  1.1  mrg while the dynamic linker ignores /usr/local/lib. If you have a GMP
    251  1.1  mrg version installed in /usr (provided by the OS vendor) and a new one
    252  1.1  mrg installed in /usr/local, then the header of the new GMP version and
    253  1.1  mrg the library of the old GMP version will be used! The best solution
    254  1.1  mrg is to make sure that the dynamic linker configuration is consistent
    255  1.1  mrg with GCC's behavior, for instance by having /usr/local/lib in
    256  1.1  mrg /etc/ld.so.conf or in some file from /etc/ld.so.conf.d (as Debian
    257  1.1  mrg did: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=395177). See
    258  1.1  mrg also http://gcc.gnu.org/ml/gcc-help/2010-01/msg00171.html for more
    259  1.1  mrg information. Alternatively you can use:
    260  1.1  mrg   * environment variables. This may sometimes be necessary. If DIR
    261  1.1  mrg     is the installation directory of GMP, add DIR/include to your
    262  1.1  mrg     CPATH or C_INCLUDE_PATH (for compilers other than GCC, please
    263  1.1  mrg     check the manual of your compiler), and add DIR/lib to your
    264  1.1  mrg     LIBRARY_PATH and LD_LIBRARY_PATH (and/or LD_RUN_PATH);
    265  1.1  mrg   * --with-gmp* configure options (described above), e.g.
    266  1.1  mrg     --with-gmp=/opt/local (to use /opt/local/include for headers and
    267  1.1  mrg     /opt/local/lib for libraries), but other software that uses GMP
    268  1.1  mrg     and/or MPFR will need correct paths too, and environment variables
    269  1.1  mrg     allow one to set such search paths in a global way.
    270  1.1  mrg     Note about "--with-gmp=/usr/local". This option may appear to
    271  1.1  mrg     solve the above inconsistency problem, but does not work as you
    272  1.1  mrg     expect. Indeed it affects the library search path, in particular,
    273  1.1  mrg     the one used by the dynamic linker (thus adding the missing
    274  1.1  mrg     /usr/local/lib directory as wanted), but since /usr/local/include
    275  1.1  mrg     is a "standard system include directory" for GCC, the include
    276  1.1  mrg     search patch is not changed; this is often not a problem in this
    277  1.1  mrg     particular case because usually, /usr/local/include is already
    278  1.1  mrg     last in the include search patch, but this may fail under some
    279  1.1  mrg     occasions and may trigger obscure errors.
    280  1.1  mrg 
    281  1.1  mrg For instance, under Unix, where paths are separated by a colon:
    282  1.1  mrg 
    283  1.1  mrg   * With POSIX sh-compatible shells (e.g. sh, ksh, bash, zsh):
    284  1.1  mrg     export C_INCLUDE_PATH="/usr/local/include:/other/path/include"
    285  1.1  mrg     export LIBRARY_PATH="/usr/local/lib:/other/path/lib"
    286  1.1  mrg     export LD_LIBRARY_PATH="$LIBRARY_PATH"
    287  1.1  mrg 
    288  1.1  mrg   * With csh or tcsh:
    289  1.1  mrg     setenv C_INCLUDE_PATH "/usr/local/include:/other/path/include"
    290  1.1  mrg     setenv LIBRARY_PATH "/usr/local/lib:/other/path/lib"
    291  1.1  mrg     setenv LD_LIBRARY_PATH "$LIBRARY_PATH"
    292  1.1  mrg 
    293  1.1  mrg If you can't solve your problem, you should contact us at <mpfr (a] loria.fr>,
    294  1.1  mrg indicating the machine and operating system used (uname -a), the compiler
    295  1.1  mrg and version used (gcc -v if you use gcc), the configure options used if
    296  1.1  mrg any (including variables such as CC and CFLAGS), the version of GMP and
    297  1.1  mrg MPFR used, and a description of the problem encountered. Please send us
    298  1.1  mrg also the log of the "configure" (config.log).
    299  1.1  mrg 
    300  1.1  mrg Note that even if you can build MPFR with a C++ compiler, you can't run
    301  1.1  mrg the test suite: C and C++ are not the same language! You should use a C
    302  1.1  mrg compiler instead.
    303  1.1  mrg 
    304  1.1  mrg 
    305  1.1  mrg Notes on Mac OS X
    306  1.1  mrg =================
    307  1.1  mrg 
    308  1.1  mrg If you get an error of the form
    309  1.1  mrg 
    310  1.1  mrg   ld: pointer in read-only segment not allowed in slidable image...
    311  1.1  mrg 
    312  1.1  mrg this can mean that the link is done against a static (GMP) library.
    313  1.1  mrg In such a case, you should configure MPFR with --disable-shared to
    314  1.1  mrg disable the build of the shared library.
    315  1.1  mrg 
    316  1.1  mrg 
    317  1.1  mrg Notes on FreeBSD 4.3
    318  1.1  mrg ====================
    319  1.1  mrg 
    320  1.1  mrg FreeBSD 4.3 is provided with an incorrect <float.h> header file, and
    321  1.1  mrg MPFR tests related to long double's may fail. If you cannot upgrade
    322  1.1  mrg the system, you can still use MPFR with FreeBSD 4.3, but you should
    323  1.1  mrg not use conversions with the long double type.
    324  1.1  mrg 
    325  1.1  mrg 
    326  1.1  mrg Notes on AIX/PowerPC
    327  1.1  mrg ====================
    328  1.1  mrg 
    329  1.1  mrg The following has been tested on AIX 5.3 (powerpc-ibm-aix5.3.0.0) with
    330  1.1  mrg gcc 3.3.2 and GMP 4.2.1.
    331  1.1  mrg 
    332  1.1  mrg If GMP was built with the 64-bit ABI, before building and testing MPFR,
    333  1.1  mrg you should set the OBJECT_MODE environment variable to 64, e.g., with:
    334  1.1  mrg 
    335  1.1  mrg   export OBJECT_MODE=64
    336  1.1  mrg 
    337  1.1  mrg (in a sh-compatible shell). But you should also provide a correct CFLAGS
    338  1.1  mrg value to the "configure" script: using --with-gmp-build is not sufficient
    339  1.1  mrg due to the early compiler tests, as gcc will not compile any program if
    340  1.1  mrg OBJECT_MODE is 64 and the -maix64 option is not provided.
    341  1.1  mrg 
    342  1.1  mrg 
    343  1.1  mrg Notes on 32-bit Windows Applications (win32)
    344  1.1  mrg ============================================
    345  1.1  mrg 
    346  1.1  mrg 1 - We advise to use MinGW (http://www.mingw.org/), which is simpler and
    347  1.1  mrg     less demanding than Cygwin. Contrary to Cygwin, it also provides native
    348  1.1  mrg     Windows code. The binaries compiled with Cygwin require a dynamic
    349  1.1  mrg     library (cygwin.dll) to work; there is a Cygwin option -mno-cygwin to
    350  1.1  mrg     build native code, but it may require some non-portable tricks.
    351  1.1  mrg 
    352  1.1  mrg 2 - If you just want to make a binary with gcc, there is nothing to do:
    353  1.1  mrg     GMP, MPFR and the program compile exactly as under Linux.
    354  1.1  mrg     But if you want to generate a library for MinGW from a Cygwin
    355  1.1  mrg     environment, you may need the -mno-cygwin gcc option (otherwise
    356  1.1  mrg     a typical error is _P_WAIT being undeclared).
    357  1.1  mrg 
    358  1.1  mrg 3 - If you want to make libraries to work under another Windows compiler
    359  1.1  mrg     like Visual C / C++, you have two options.  Since the unix-like *.a
    360  1.1  mrg     library files are compatible with Windows *.lib files, you can simply
    361  1.1  mrg     rename all *.a libraries to *.lib.  The second option is to build
    362  1.1  mrg     MPFR with the Microsoft Visual Studio compiler to produce Windows
    363  1.1  mrg     libraries directly (Visual Studio build projects for MPFR are
    364  1.1  mrg     available at http://fp.gladman.plus.com/computing/gmp4win.htm).
    365  1.1  mrg 
    366  1.1  mrg     With gmp-4.1.3, the only remaining problem seems to be the "alloca" calls
    367  1.1  mrg     in GMP. Configuring GMP and MPFR with --enable-alloca=malloc-reentrant
    368  1.1  mrg     should work (if you build MPFR with GMP internal files).
    369  1.1  mrg 
    370  1.1  mrg     Or you could add the library
    371  1.1  mrg      "$MINGWIN$/lib/gcc-lib/mingw32/$VERSION$/libgcc.a"
    372  1.1  mrg     to your project: it contains all the extra-functions needed by a program
    373  1.1  mrg     compiled by gcc (division of 64-bit integer, bcopy, alloca...).
    374  1.1  mrg     Of course, include it if and only if your compiler is not gcc.
    375  1.1  mrg 
    376  1.1  mrg 4 - On Windows32 / MinGW, if all the tests fail, try to run the test suite
    377  1.1  mrg     with "make check EXEEXT=".
    378  1.1  mrg 
    379  1.1  mrg 5 - To avoid using the Microsoft runtime (which might not be conform to ISO C),
    380  1.1  mrg     you can use the MinGW runtime package (which is an integral part of MinGW).
    381  1.1  mrg     For example, with MinGW versions 3.15 and later you can get an
    382  1.1  mrg     ISO-compliant printf() if you compile your application with either
    383  1.1  mrg     '-ansi', '-posix' or '-D__USE_MINGW_ANSI_STDIO'. For example, you can
    384  1.1  mrg     compile and test MPFR with CC="gcc -D__USE_MINGW_ANSI_STDIO".
    385  1.1  mrg 
    386  1.1  mrg     For example under Win32, the following problem has been experienced with
    387  1.1  mrg     MPFR 2.4.0 RC1 and the MSVC runtime (msvcrt.dll):
    388  1.1  mrg 
    389  1.1  mrg        Error in mpfr_vsprintf (s, "%.*Zi, %R*e, %Lf%n", ...);
    390  1.1  mrg        expected: "00000010610209857723, -1.2345678875e+07, 0.032258"
    391  1.1  mrg        got:      "00000010610209857723, -1.2345678875e+07, -0.000000"
    392  1.1  mrg        FAIL: tsprintf.exe
    393  1.1  mrg 
    394  1.1  mrg     This error is due to the MSVC runtime not supporting the L length modifier
    395  1.1  mrg     for formatted output (e.g. printf with %Lf). You can check this with the
    396  1.1  mrg     following program:
    397  1.1  mrg 
    398  1.1  mrg        #include <stdio.h>
    399  1.1  mrg        int main (void)
    400  1.1  mrg        {
    401  1.1  mrg          long double d = 1. / 31.;
    402  1.1  mrg          printf ("%Lf\n", d);
    403  1.1  mrg          return 0;
    404  1.1  mrg        }
    405  1.1  mrg 
    406  1.1  mrg     The expected output is 0.032258.
    407  1.1  mrg 
    408  1.1  mrg     Note: The L modifier has been standard for a long time (it was added
    409  1.1  mrg     in ISO C89).
    410  1.1  mrg 
    411  1.1  mrg 
    412  1.1  mrg Notes on 64-bit Windows Applications (x64)
    413  1.1  mrg ==========================================
    414  1.1  mrg 
    415  1.1  mrg [See the Notes on 32-bit Windows Applications, which might be relevant here,
    416  1.1  mrg  in particular when running a 64-bit operating system]
    417  1.1  mrg 
    418  1.1  mrg Cygwin and MinGW do not yet offer support for native Windows 64 builds but
    419  1.1  mrg the 32-bit version of MPFR can be used to build 32-bit applications that
    420  1.1  mrg will run on 64-bit Windows systems (see above). MPFR can be built as a native
    421  1.1  mrg 64-bit static or DLL library for Windows 64 using the Visual Studio build
    422  1.1  mrg projects at http://fp.gladman.plus.com/computing/gmp4win.htm.
    423