xref: /netbsd-src/external/lgpl3/mpfr/dist/INSTALL (revision 4439cfd0acf9c7dc90625e5cd83b2317a9ab8967)
1Copyright 1999-2023 Free Software Foundation, Inc.
2Contributed by the AriC and Caramba projects, INRIA.
3
4This file is part of the GNU MPFR Library.
5
6The GNU MPFR Library is free software; you can redistribute it and/or modify
7it under the terms of the GNU Lesser General Public License as published by
8the Free Software Foundation; either version 3 of the License, or (at your
9option) any later version.
10
11The GNU MPFR Library is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14License for more details.
15
16You should have received a copy of the GNU Lesser General Public License
17along with the GNU MPFR Library; see the file COPYING.LESSER.  If not, see
18https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
1951 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20
21
22
23                        Installing GNU MPFR
24                        ===================
25
26Note: In case of problem, please read this INSTALL file carefully before
27reporting a bug, in particular Section "In case of problem" below. Some
28problems are due to bad configuration on the user side (not specific to
29MPFR).
30
310. You first need to install GMP. See <https://gmplib.org/>.
32   MPFR requires GMP version 5.0.0 or later.
33   You need a C compiler, preferably GCC, but any reasonable compiler should
34   work (C++ compilers should work too, under the condition that they do not
35   break type punning via union).
36   And you need the standard Unix "make" command, plus some other standard
37   Unix utility commands.
38
391. Extract the files from the archive.
40
412. It is strongly advised to apply the latest patches if this has
42   not been done yet and if patches are available. You can check
43   on the release page:
44
45     https://www.mpfr.org/mpfr-4.2.1/
46
47   which may have additional information. The patches can be applied
48   with commands like:
49
50     wget --no-config https://www.mpfr.org/mpfr-4.2.1/allpatches
51     patch -N -Z -p1 < allpatches
52
53   or
54
55     curl https://www.mpfr.org/mpfr-4.2.1/allpatches | patch -N -Z -p1
56
57   (Those instructions are for the GNU patch command, for example
58   /usr/bin/gpatch on Solaris.)
59
603. In the MPFR directory, to detect your system, type:
61     ./configure
62   possibly with options (see below, in particular if this step or
63   one of the following fails). You should also check whether WARNING
64   lines have been output (such a problem may cause a failure in one
65   of the following steps).
66   Note: paths provided in configure options must always be absolute
67   (relative paths are not supported).
68
694. To build the library, type:
70     make
71
72   [optional] if you want to tune MPFR for your specific architecture, see
73   the section "Tuning MPFR" below. Note that for most common architectures,
74   MPFR includes some default tuning parameters which should be near from
75   optimal.
76
775. To check the built library (runs the test files), type:
78     make check
79
80   Note: If any test fails, information about this failure can be found in
81   the tests/test-suite.log file; you should provide this file in your bug
82   reports (in addition to other useful information, as mentioned later).
83   If you want the contents of this file to be automatically output in case
84   of failure, you can set the VERBOSE environment variable to 1 before
85   running "make check", for instance by typing:
86     VERBOSE=1 make check
87
886. [Optional / experimental] Binary distributions may also want to run:
89     make check-gmp-symbols
90
91   This will check that MPFR does not use GMP internal symbols, which
92   could yield failures in case of GMP upgrade without a MPFR rebuild.
93   But note that this is a heuristic and might give false positives or
94   false negatives. Please report any problem to the MPFR developers.
95   End users may also be interested in this check, unless they have
96   allowed GMP internals with configure options (see below).
97
987. To install it (default "/usr/local" | see "--prefix" option), type:
99     make install
100
101If you installed MPFR (header and library) in directories that are
102not searched by default by the compiler and/or linking tools, then,
103like with other libraries, you may need to set up some environment
104variables such as C_INCLUDE_PATH (to find the header mpfr.h),
105LIBRARY_PATH (to find the library), and if the shared library has
106been installed, LD_LIBRARY_PATH (before execution) or LD_RUN_PATH
107(before linking); this list is not exhaustive and some environment
108variables may be specific to your system. "make install" gives some
109instructions; please read them. You can also find more information
110in the manuals of your compiler and linker. The MPFR FAQ may also
111give some information.
112
113Remember that if you have several MPFR (or GMP) versions installed
114(e.g., one with the system, and one, newer, by you), you will not
115necessarily get a compilation/linking error if a wrong library is
116used (e.g., because LD_LIBRARY_PATH has not been set correctly).
117But unexpected results may occur.
118
119Under Mac OS X, if the shared library was not installed and you use
120Apple's linker (this is the default), you will also need to provide
121the -search_paths_first linker flag ("-Wl,-search_paths_first" when
122you link via gcc) to make sure that the right library is selected,
123as by default, Apple's linker selects a shared library preferably,
124even when it is farther in the library paths. We recall that if a
125wrong library is selected due to this behavior, unexpected results
126may occur.
127
128
129Building the documentation
130==========================
131
132To build the documentation in various formats, you may first need to
133install recent versions of some utilities such as texinfo.
134
135* Type "make info" to produce the documentation in the info format.
136
137* Type "make pdf" to produce the documentation in the PDF format.
138
139* Type "make dvi" to produce the documentation in the DVI format.
140
141* Type "make ps" to produce the documentation in the PostScript format.
142
143* Type "make html" to produce the documentation in the HTML format
144  (in several pages); if you want only one output HTML file, then
145  type "makeinfo --html --no-split mpfr.texi" from the doc directory
146  instead.
147
148
149Building MPFR with internal GMP header files
150============================================
151
152MPFR built with internal GMP header files is a bit faster, so you may want
153to build it with them. Just do this in step 1:
154
155  ./configure --with-gmp-build=GMPBUILD
156
157where GMPBUILD is the GMP build directory. The needed header files are:
158gmp-impl.h, longlong.h and all the necessary headers to use them, which
159may be located either in the GMP source directory or in the GMP build
160directory, in case they are different (MPFR takes care of that, as of
161MPFR 3.1.0).
162
163Warning: the library obtained in this way may use some internal GMP
164symbols, and thus dynamically linking your software with a different
165version of GMP might fail, even though it is declared as compatible
166by Libtool's versioning system.
167
168
169Tuning MPFR
170===========
171
172[For the current GMP version (6.1.0), a Unix-like OS is required.]
173
174For this, you need to build MPFR with a GMP build directory (see above).
175In the GMP build directory, you also need to go into the "tune" subdirectory
176and type "make speed". This will build the GMP speed library, which is used
177by the MPFR tuning mechanism.
178
179Then go back to the MPFR build directory, go into the "tune" subdirectory and
180type "make tune". This will build an optimized file "mparam.h" for your
181specific architecture.
182
183
184./configure options
185===================
186
187--prefix=DIR            installs MPFR headers and library in DIR/include and
188                        DIR/lib respectively (the default is "/usr/local").
189
190--with-gmp-include=DIR  assumes that DIR contains gmp.h
191--with-gmp-lib=DIR      assumes that DIR contains the GMP library
192--with-gmp=DIR          assumes that DIR is where you have installed GMP.
193                        same as --with-gmp-lib=DIR/lib
194                        and     --with-gmp-include=DIR/include
195                        (use either --with-gmp alone or one or both of
196                        --with-gmp-lib/--with-gmp-include)
197                        Warning! Do not use these options if you have
198                        CPPFLAGS and/or LDFLAGS containing a -I or -L
199                        option with a directory that contains a GMP
200                        header or library file, as these options just
201                        add -I and -L options to CPPFLAGS and LDFLAGS
202                        *after* the ones that are currently declared,
203                        so that DIR will have a lower precedence. Also,
204                        this may not work if DIR is a system directory
205                        (typically /usr or /usr/local); see below.
206
207--with-gmp-build=DIR    assumes that DIR contains the GMP build directory,
208                        and enables the use of GMP internals (see above).
209                        Warning! This option and the group of options
210                        --with-gmp are mutually exclusive.
211
212--enable-assert         build MPFR with assertions.
213
214--enable-thread-safe    build MPFR as thread safe, using compiler-level
215                        Thread-Local Storage (TLS). Note: TLS support is
216                        roughly tested by configure. If configure detects
217                        that TLS does not work (because of the compiler,
218                        linker or system libraries), it will output an
219                        error message, telling you to build MPFR without
220                        thread safe. For instance, though Mac OS X uses
221                        GCC, it may not currently support GCC's __thread
222                        storage class.
223
224--disable-thread-safe   build MPFR without TLS. By default, TLS support
225                        is detected automatically, and MPFR is built as
226                        thread safe if supported. However, this detection
227                        is only a heuristic: TLS can be detected as
228                        supported while its support is incomplete or
229                        buggy (MPFR tests may fail). In such a case,
230                        this option is useful.
231
232--enable-decimal-float  build conversion functions from/to decimal floats.
233                        Note that detection by the configure script is
234                        limited in case of cross-compilation.
235                        Accepted arguments:
236                   yes  Decimal support is requested and the configure
237                        script fails if it detects that decimals do not
238                        work.
239                        The encoding (BID or DPD) will automatically be
240                        detected at configure time or at compile time if
241                        possible (if not, generic code will be used).
242                    no  Decimal support is explicitly disabled.
243                  auto  Decimal support is enabled if the configure script
244                        detects that it works. This is the default when
245                        --{enable,disable}-decimal-float is not given.
246                   bid  Decimal support is requested and the encoding is
247                        assumed to be BID (some check may be done).
248                   dpd  Decimal support is requested and the encoding is
249                        assumed to be DPD (some check may be done).
250               generic  Decimal support is requested and the generic code
251                        is used (mainly for developers).
252
253--enable-gmp-internals  allows the MPFR build to use GMP's undocumented
254                        functions (not from the public API). Note that
255                        library versioning is not guaranteed to work if
256                        this option is used. Thus it must not be used in
257                        binary distributions.
258
259--with-sysroot=DIR      Search for dependent libraries within DIR (which
260                        may be useful in cross-compilation). If you use
261                        this option, you need to have Libtool 2.4+ on
262                        the target system. See Libtool 2.4+'s NEWS file.
263
264Note: By default, the configure script tries to set CC / CFLAGS to GMP's
265ones from gmp.h (__GMP_CC / __GMP_CFLAGS) in order to ensure that MPFR is
266built with the same ABI as GMP. The reason is that when GMP is built, it
267may set CC / CFLAGS to select an ABI that is not the default one in order
268to have a better performance. The -pedantic option in GMP's CFLAGS, when
269present (which is the case by default), is removed, because the MPFR
270build system uses some C extensions (when this script detects that they
271are supported) and -pedantic yields too many useless warnings. However,
272this setting from GMP is not guaranteed to work as the configure script
273does some compiler tests earlier, and a conflict may arise. Also, the
274values obtained from GMP may be incorrect for the MPFR build if GMP has
275been built on a different machine; in such a case, the user may need to
276specify CC / CFLAGS, as explained below.
277
278Moreover, even without --with-gmp-build and --enable-gmp-internals,
279MPFR might use some GMP internals by mistake. This would be a bug,
280which should be reported to the MPFR developers.
281
282Run "./configure --help" to see the other options (default options
283from Autoconf and Automake).
284
285
286If 'gmp.h' and 'libgmp' do not match
287====================================
288
289Under some circumstances, the configure script may output a message
290saying:
291
292  'gmp.h' and 'libgmp' seem to have different versions or
293  we cannot run a program linked with GMP (if you cannot
294  see the version numbers above). [...]
295
296Even though the configure script does not fail in such a case, this
297message most often indicates a real error, which needs to be avoided.
298Possible causes are:
299
300* The wanted GMP library does not have the same ABI as the one chosen
301  to build MPFR. The consequences may be:
302
303    - A different GMP library (with the correct ABI) has been found,
304      but does not have the same version as 'gmp.h'.
305
306    - No other GMP libraries have been found (in this case, no version
307      numbers should be printed above the warning message).
308
309  This is incorrect and one of the following steps (make, make check)
310  will probably fail. GMP (actually gmp.h) now provides CC and CFLAGS
311  information to select the correct ABI, so that this problem should
312  no longer occur; but if GMP was provided by a binary package, such
313  information may not be valid. See the
314
315    checking for CC and CFLAGS in gmp.h...
316
317  line in the configure output (about the 11th line) and the following
318  few ones for more information. You may need to reinstall GMP or to
319  provide your own CC and/or CFLAGS. See also the remaining of this
320  INSTALL file.
321
322* A configure option like --with-gmp or --with-gmp-include was used
323  with a system include directory, e.g. one of the following:
324
325    --with-gmp=/usr
326    --with-gmp=/usr/local
327    --with-gmp-include=/usr/include
328    --with-gmp-include=/usr/local/include
329
330  GCC (and possibly other compilers) will ignore such a directive for
331  include directories (but this rule is not applied for the library
332  itself!). This means that the library search paths will be reordered
333  as declared, but the specified include directory will still be near
334  the end of the include search paths (thus with a low precedence).
335  This is not a problem if only one GMP version is installed, but
336  otherwise, a wrong gmp.h may be chosen, so that the versions of
337  gmp.h and libgmp may not match. The suggestions are the following:
338
339    - If you want to use the GMP version under /usr, then you should
340      uninstall all the other GMP versions (header and library files)
341      that may be seen in the search paths, in particular those under
342      /usr/local.
343
344    - If you want to use the GMP version under /usr/local, then you
345      should uninstall all the other GMP versions (header and library
346      files) that may be seen in the search paths, but *NOT* the one
347      under /usr (the version under /usr is provided by the OS vendor,
348      and changing/removing anything related to it may break your
349      system, and /usr should have a lower precedence than /usr/local
350      anyway).
351
352  To find where GMP versions have been installed:
353
354    $ locate libgmp  (if you have a locate database)
355
356  and if the compiler is GCC:
357
358    $ gcc -print-file-name=libgmp.so     (under most systems)
359    $ gcc -print-file-name=libgmp.dylib  (under Mac OS X)
360
361  and if this does not work, you may try:
362
363    $ gcc -print-search-dirs
364
365* An official GCC version was used under Debian GNU/Linux. Problems
366  may come from the fact that Debian chose a different convention
367  for library search paths concerning 32-bit and 64-bit libraries.
368  A possible problem can be, for instance:
369
370  [Debian's GCC, correct library path]
371  $ gcc -print-file-name=libgmp.so
372  /home/vlefevre/gmp/athlon64/lib/../lib/libgmp.so
373
374  [Official GCC, incorrect library path]
375  $ gcc-4.3.1 -print-file-name=libgmp.so
376  /usr/lib/../lib64/libgmp.so
377
378  The solution: use a GCC provided by Debian or add symbolic links
379  such as lib64 -> lib (on 64-bit machines) for your library paths.
380
381* The problem may also be temporary and only due to the fact that
382  libtool could not be used at this time. This is unlikely, though.
383
384
385In case of problem
386==================
387
388First, look for any warning message in the configure output.
389
390Several documents may help you to solve the problem:
391  * this INSTALL file, in particular information given below;
392  * the FAQ (either the FAQ.html file distributed with MPFR, or the
393    on-line version <https://www.mpfr.org/faq.html>, which may be more
394    up-to-date);
395  * the MPFR web page for this version <https://www.mpfr.org/mpfr-4.2.1/>,
396    which lists bugs found in this version and provides some patches.
397
398If the "configure" fails, please check that the C compiler and its
399options are the same as those for the GMP build (specially the ABI).
400You can see the latter with the following command:
401
402  grep "^CC\|^CFLAGS" GMPBUILD/Makefile
403
404if the GMP build directory is available. Then type:
405
406  ./configure <configure options> CC=<C compiler> CFLAGS="<compiler options>"
407
408(quotes are needed when there are spaces or other special characters
409in the CC/CFLAGS value) and continue the install. On some platforms,
410you should provide further options to match those used by GMP, or set
411some environment variables. For instance, see the "Notes on AIX/PowerPC"
412section below.
413
414Warning! Do NOT use optimization options that can change the semantics
415of math operations, such as GCC's -ffast-math or Sun CC's -fast.
416Otherwise conversions from/to double's may be incorrect on infinities,
417NaN's and signed zeros. Since native FP arithmetic is used in a few
418places only, such options would not make MPFR faster anyway.
419
420If some "make check" tests fail, you can try the --disable-thread-safe
421configure option (see the configure options above): it has been reported
422that some platforms have buggy TLS support. Before trying this option,
423you may want to check in the configure output whether MPFR was built
424with TLS support; if yes, you will have a line:
425  checking for TLS support... yes
426Alternatively "grep MPFR_USE_THREAD_SAFE config.log" will show that
427MPFR_USE_THREAD_SAFE is defined to 1. If it is "no" (or the variable
428is not defined), the --disable-thread-safe option would be useless.
429
430Some tests failure may be due to other compiler bugs, in particular
431in optimization code. You can try to build MPFR without compiler
432optimizations by giving -O0 (letter O, digit 0) in CFLAGS. If the
433MPFR tests no longer fail, this was probably due to a compiler bug,
434though we cannot exclude a bug in MPFR. You may want to contact us
435(see below), possibly after looking at:
436  https://members.loria.fr/PZimmermann/software/compilerbugs.html
437
438On some platforms, try with "gmake" (GNU make) instead of "make".
439Problems have been reported with the Tru64 make.
440
441If the configure script reports that gmp.h version and libgmp version
442are different, or if the build was OK, but the tests failed to link
443with GMP or gave an error like
444
445  undefined reference to `__gmp_get_memory_functions'
446
447meaning that the GMP library was not found or a wrong GMP library was
448selected by the linker, then your library search paths are probably
449not correctly set (some paths are missing or they are specified in an
450incorrect order).
451
452Such problems commonly occur under some GNU/Linux machines, where the
453default header and library search paths may be inconsistent: GCC is
454configured to search /usr/local/include and /usr/local/lib by default,
455while the dynamic linker ignores /usr/local/lib. If you have a GMP
456version installed in /usr (provided by the OS vendor) and a new one
457installed in /usr/local, then the header of the new GMP version and
458the library of the old GMP version will be used! The best solution
459is to make sure that the dynamic linker configuration is consistent
460with GCC's behavior, for instance by having /usr/local/lib in
461/etc/ld.so.conf or in some file from /etc/ld.so.conf.d (as Debian
462did: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=395177). See
463also https://gcc.gnu.org/legacy-ml/gcc-help/2010-01/msg00171.html for
464more information. Alternatively you can use:
465  * environment variables. This may sometimes be necessary. If DIR
466    is the installation directory of GMP, add DIR/include to your
467    CPATH or C_INCLUDE_PATH (for compilers other than GCC, please
468    check the manual of your compiler), and add DIR/lib to your
469    LIBRARY_PATH and LD_LIBRARY_PATH (and/or LD_RUN_PATH);
470  * --with-gmp* configure options (described above), e.g.
471    --with-gmp=/opt/local (to use /opt/local/include for headers and
472    /opt/local/lib for libraries), but other software that uses GMP
473    and/or MPFR will need correct paths too, and environment variables
474    allow one to set such search paths in a global way.
475    Note about "--with-gmp=/usr/local". This option may appear to
476    solve the above inconsistency problem, but does not work as you
477    expect. Indeed it affects the library search path, in particular,
478    the one used by the dynamic linker (thus adding the missing
479    /usr/local/lib directory as wanted), but since /usr/local/include
480    is a "standard system include directory" for GCC, the include
481    search patch is not changed; this is often not a problem in this
482    particular case because usually, /usr/local/include is already
483    last in the include search patch, but this may fail under some
484    occasions and may trigger obscure errors.
485
486For instance, under Unix, where paths are separated by a colon:
487
488  * With POSIX sh-compatible shells (e.g. sh, ksh, bash, zsh):
489    export C_INCLUDE_PATH="/usr/local/include:/other/path/include"
490    export LIBRARY_PATH="/usr/local/lib:/other/path/lib"
491    export LD_LIBRARY_PATH="$LIBRARY_PATH"
492
493  * With csh or tcsh:
494    setenv C_INCLUDE_PATH "/usr/local/include:/other/path/include"
495    setenv LIBRARY_PATH "/usr/local/lib:/other/path/lib"
496    setenv LD_LIBRARY_PATH "$LIBRARY_PATH"
497
498If almost all the tests fail and the messages in the test-suite.log file
499(or in the output, when running individual tests from the command line)
500start with a line of the form:
501
502  Incorrect MPFR version! (xxx header vs yyy library)
503
504then this means that an installed MPFR version is tested instead of the
505one that has just been built. This is probably not a bug in MPFR, but a
506problem caused by the user or system configuration (particular options,
507environment variables, etc.) or a bug in the toolchain. In particular,
508if LD_LIBRARY_PATH overrides the run path (set up by libtool) and an
509installed ABI-compatible version of MPFR is in a directory listed in
510the LD_LIBRARY_PATH search path, then this will break. An example with
511GNU ld:
512
513  https://sourceware.org/bugzilla/show_bug.cgi?id=21476
514
515If you can't solve your problem, you should contact us via the MPFR
516mailing-list <mpfr@inria.fr>, indicating the machine and operating system
517used (uname -a), the compiler and version used (gcc -v if you use gcc),
518the configure options used if any (including variables such as CC and
519CFLAGS), the version of GMP and MPFR used, and a description of the
520problem encountered, in particular the tests/test-suite.log file if
521"make check" failed. Please send us also the log of the "configure"
522(config.log).
523
524
525Notes about ABI
526===============
527
528On 64-bit computers, it may happen that the default ABI (Application Binary
529Interface) chosen by MPFR does not correspond to the default one chosen by
530the compiler.
531
532In particular, this kind of message may indicate the problem:
533/usr/bin/ld: skipping incompatible mpfr/src/.libs/libmpfr.a when searching for -lmpfr
534
535In fact, since MPFR relies on GMP, it uses the same ABI as GMP.
536To be sure that your program compiles and links correctly, use the same
537compiler flags as MPFR does (look for CFLAGS in config.log).
538
539You might also recompile GMP with a different ABI, with for example
540./configure ABI=32.
541
542
543Notes on Mac OS X
544=================
545
546If you get an error of the form
547
548  ld: pointer in read-only segment not allowed in slidable image...
549
550this can mean that the link is done against a static (GMP) library.
551In such a case, you should configure MPFR with --disable-shared to
552disable the build of the shared library.
553
554
555Notes on FreeBSD 4.3
556====================
557
558FreeBSD 4.3 is provided with an incorrect <float.h> header file, and
559MPFR tests related to long double's may fail. If you cannot upgrade
560the system, you can still use MPFR with FreeBSD 4.3, but you should
561not use conversions with the long double type.
562
563
564Notes on AIX/PowerPC
565====================
566
567The following has been tested on AIX 7.1.3 (gcc111.fsffrance.org)
568with gcc 4.8.1 and GMP 6.1.0.
569
570If GMP was built with the 64-bit ABI, before building and testing MPFR,
571you should set the OBJECT_MODE environment variable to 64, e.g., with:
572
573  export OBJECT_MODE=64
574
575(in a sh-compatible shell). Alternatively add the following to the configure
576line: AR="ar -X64" NM="nm -B -X64".
577
578
579Notes on Solaris
580================
581
582Do not put a -R<dir> option in the LD_OPTIONS environment variable, at least
583if the directory <dir> can contain an MPFR library. Otherwise this MPFR
584library may be chosen for the tests (make check) instead of the one that has
585just been built, in which case, either you will get errors due to unmatched
586versions or this problem may remain undetected. The reason is that this
587option will appear before the -R options added by libtool, such as the one
588to the src/.libs directory containing the MPFR library that has just been
589built, and will have the precedence.
590
591
592MPFR for use with Windows Applications
593======================================
594
595There are several ways of building MPFR on Windows, the most appropriate
596approach depending on how you intend to use the resulting libraries.
597
598a. Using MinGW
599==============
600
6011 - We advise to use Mingw-w64 (https://www.mingw-w64.org/), which is
602    simpler and less demanding than Cygwin. Contrary to Cygwin, it also
603    provides native Windows code.
604
605    If you also use MSYS, you should use "make" for MSYS instead of
606    the "make" utility from Mingw-w64 or from GCC, which causes the
607    following error:
608
609      libtool: warning: libobj name 'extract.Tpo -c -o extract.lo extract.lo'
610      may not contain shell special characters.
611      rm: unknown option -- c
612
613    References about this issue and solution:
614      https://sourceforge.net/p/msys2/tickets/223/
615      https://sympa.inria.fr/sympa/arc/mpfr/2016-07/msg00009.html
616
6172 - If you just want to make a binary with gcc, there is nothing to do:
618    GMP, MPFR and the program compile exactly as under Linux. (It is
619    recommended to pass --build=xxx-yyy-mingw64 to the GMP configure command,
620    or --build=xxx with xxx containing mingw.)
621
6223 - To avoid using the Microsoft runtime (which might not be conform to ISO C),
623    you can use the MinGW runtime package (which is an integral part of MinGW).
624
625    With MinGW version v8.0.0 and later, the formatted output functions
626    (printf, etc.) are ISO/POSIX-conforming by default; however, this is
627    no longer true if -std=c89 is used at build time. Conversely, with
628    earlier MinGW versions, it is possible to get conforming functions
629    with either '-ansi', '-posix' or '-D__USE_MINGW_ANSI_STDIO'. Note
630    that if there is a conformity mismatch between the options used for
631    the GMP build (from which the MPFR build gets the output) and those
632    used for the MPFR tests, the tsprintf test may fail with one of the
633    errors below. Be careful that a non-conforming output may yield a
634    buffer overflow.
635
636    The following applies to old MinGW versions, and may be discouraged
637    with recent MinGW versions.
638
639    In order to have the MPFR formatted output functions based on an
640    ISO-conforming printf(), you need to compile GMP (not MPFR) with
641    CC="gcc -D__USE_MINGW_ANSI_STDIO" (since the standard printf modifiers
642    %e, %Ld and %td are passed to GMP).
643
644    To avoid failures of some of the printf-related tests, MPFR needs to
645    be compiled with the same __USE_MINGW_ANSI_STDIO as with GMP, i.e.
646    this macro should be defined for both or undefined for both; this
647    should be the case by default, unless CC or CFLAGS has been redefined.
648    For instance, if __USE_MINGW_ANSI_STDIO is defined in GMP but not in
649    MPFR, the following error may occur:
650
651      Error in mpfr_vsprintf (s, "%e", ...);
652      expected: "-1.250000e+000"
653      got:      "-1.250000e+00"
654      FAIL tsprintf.exe (exit status: 1)
655
656    and in the opposite case:
657
658      Error in mpfr_vsprintf (s, "%e", ...);
659      expected: "-1.250000e+00"
660      got:      "-1.250000e+000"
661      FAIL tsprintf.exe (exit status: 1)
662
663    Note with old GMP versions: Other issues could arise due to the fact
664    that the C functions vsnprintf and vsprintf both used internally in
665    old GMP versions do not produce the same output:
666
667      https://sympa.inria.fr/sympa/arc/mpfr/2016-03/msg00045.html
668      https://sympa.inria.fr/sympa/arc/mpfr/2016-03/msg00051.html
669      https://sympa.inria.fr/sympa/arc/mpfr/2016-03/msg00053.html
670
671    If __USE_MINGW_ANSI_STDIO has not been defined when building GMP,
672    then the length modifiers j, L and t are not supported with the GMP
673    formatted output functions, and as a consequence, also with MPFR.
674    This is automatically detected by the configure script, except when
675    cross-compiling (e.g. under Linux), in which case some macros need
676    to be defined explicitly, e.g. with
677
678      "CPPFLAGS=-DNPRINTF_J -DNPRINTF_L -DNPRINTF_T"
679
680    in order to avoid potential issues with the MPFR library and failures
681    in the test suite (the corresponding tests are disabled explicitly).
682
683b. Using Cygwin
684===============
685
686This build should be similar to that for MinGW except that the resulting
687library depends on the Cygwin DLL and cannot therefore be used with
688Visual Studio as with MinGW. Indeed, the binaries compiled with Cygwin
689require a dynamic library (cygwin.dll) to work; there is a Cygwin option
690-mno-cygwin to build native code, but it may require some non-portable tricks.
691
692In case of failure, you may need to pass LDFLAGS='-shared-libgcc' at the
693end of the configure line due to a bug in GCC. Otherwise, if threading
694support is not needed, you can configure MPFR with --disable-thread-safe.
695
696c. Using Microsoft Visual C++ and Intel C++ Compilers
697=====================================================
698
699Static and dynamic MPFR libraries for the 32- and 64-bit versions of
700Windows can be built with Microsoft Visual Studio 2015 using the
701Microsoft Visual C++ compiler, see:
702
703  https://visualstudio.microsoft.com/
704
705The Intel C++ compiler provided as a part of Intel Parallel Studio XE
706can also be used:
707
708  https://software.intel.com/en-us/parallel-studio-xe
709
710The relevant build projects are available here:
711
712  https://github.com/BrianGladman
713
714d. Using the CompCert compiler
715==============================
716
717[Tested with CompCert 3.10 and MPFR master-11992-f75b0c388 on x86_64-linux]
718
719CompCert (https://compcert.org/) is a formally verified compiler.
720To compile MPFR with CompCert:
721
722$ ./configure --disable-shared CC=ccomp CFLAGS="-flongdouble -fstruct-passing"
723
724You also need to unset LD_LIBRARY_PATH, and/or you might need to change
725wl="" into wl="-Wl," in the libtool file (after running configure).
726
727All tests (make check) should pass (tget_set_d64, tget_set_d128 and
728tset_float128 are skipped, since CompCert does not support _Decimal64,
729_Decimal128 nor _Float128).
730
731e. Using the Intel OneApi compiler
732==================================
733
734When using the Intel OneApi compiler (icx), one should add -fp-model=strict
735to CFLAGS so that the conversion routines from/to native floating-point
736types (float, double, ...) work properly. Otherwise some tests will fail.
737