1dnl Process this file with autoconf to produce a configure script.
2
3AC_COPYRIGHT([
4Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
5Contributed by the AriC and Caramel projects, INRIA.
6
7This file is part of the GNU MPFR Library.
8
9The GNU MPFR Library is free software; you can redistribute it and/or modify
10it under the terms of the GNU Lesser General Public License as published
11by the Free Software Foundation; either version 3 of the License, or (at
12your option) any later version.
13
14The GNU MPFR Library is distributed in the hope that it will be useful, but
15WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17License for more details.
18
19You should have received a copy of the GNU Lesser General Public License
20along with the GNU MPFR Library; see the file COPYING.LESSER.  If not, see
21http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
2251 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
23])
24
25dnl Add check-news when it checks for more than 15 lines
26AC_INIT([MPFR],[3.1.2])
27
28AM_INIT_AUTOMAKE([1.11 no-define dist-bzip2 dist-xz dist-zip])
29AM_MAINTAINER_MODE(enable)
30
31AC_CONFIG_MACRO_DIR([m4])
32
33dnl FIXME: The AC_ARG_ENABLE(decimal-float...) part does things too
34dnl early, even when this option is not used. In particular, it must
35dnl be put after AC_PROG_CC; another problem is that the GMP CFLAGS
36dnl and CC check may modify the compiler.
37
38test_CFLAGS=${CFLAGS+set}
39
40AC_CANONICAL_HOST
41
42AC_PROG_EGREP
43AC_PROG_SED
44
45dnl To use a separate config header.
46dnl There is still some problem with GMP's HAVE_CONFIG
47dnl AC_CONFIG_HEADERS([mpfrconf.h:mpfrconf.in])
48
49dnl Extra arguments to configure
50unset gmp_lib_path GMP_CFLAGS GMP_CC
51AC_ARG_WITH(gmp_include,
52   [  --with-gmp-include=DIR  GMP include directory ],
53   CPPFLAGS="$CPPFLAGS -I$withval")
54AC_ARG_WITH(gmp_lib,
55   [  --with-gmp-lib=DIR      GMP lib directory ], [
56   LDFLAGS="$LDFLAGS -L$withval"
57   gmp_lib_path="$withval"
58  ])
59AC_ARG_WITH(gmp,
60   [  --with-gmp=DIR          GMP install directory ], [
61   if test -z "$with_gmp_lib" && test -z "$with_gmp_include" ; then
62      CPPFLAGS="$CPPFLAGS -I$withval/include"
63      LDFLAGS="$LDFLAGS -L$withval/lib"
64      gmp_lib_path="$withval/lib"
65   else
66      AC_MSG_FAILURE([Do not use --with-gmp and --with-gmp-include/--with-gmp-lib options simultaneously.])
67   fi
68  ])
69
70AC_ARG_WITH(gmp_build,
71   [  --with-gmp-build=DIR    GMP build directory (please read INSTALL file)],
72   [
73   if test -z "$gmp_lib_path" && test -z "$with_gmp_include" ; then
74      CPPFLAGS="$CPPFLAGS -I$withval -I$withval/tune"
75      LDFLAGS="$LDFLAGS -L$withval -L$withval/.libs -L$withval/tune"
76      gmp_lib_path="$withval$PATH_SEPARATOR$withval/.libs$PATH_SEPARATOR$withval/tune"
77      if test -r $withval/Makefile ; then
78         GMP_CFLAGS=`$SED -n 's/^CFLAGS = //p' $withval/Makefile`
79         GMP_CC=`$SED -n 's/^CC = //p' $withval/Makefile`
80         GMP_SOURCE=`$SED -n 's/^srcdir = *//p' $withval/Makefile`
81         case "$GMP_SOURCE" in
82           .)  GMP_SOURCE="" ;;
83           /*) ;;
84           ?*) GMP_SOURCE="$withval/$GMP_SOURCE" ;;
85         esac
86         if test -d "$GMP_SOURCE" ; then
87            CPPFLAGS="$CPPFLAGS -I$GMP_SOURCE -I$GMP_SOURCE/tune"
88         fi
89      fi
90      use_gmp_build=yes
91   else
92      AC_MSG_FAILURE([Do not use --with-gmp-build and other --with-gmp options simultaneously.])
93   fi
94   ])
95
96AC_ARG_WITH(mulhigh_size,
97   [  --with-mulhigh-size=NUM internal threshold table for mulhigh],
98   AC_DEFINE_UNQUOTED([MPFR_MULHIGH_SIZE],$withval, [Mulhigh size]))
99
100AC_ARG_ENABLE(gmp-internals,
101   [  --enable-gmp-internals  enable use of GMP undocumented functions [[default=no]]],
102   [ case $enableval in
103      yes) AC_DEFINE([WANT_GMP_INTERNALS],1,[Want GMP internals]) ;;
104      no)  ;;
105      *) AC_MSG_ERROR([bad value for --enable-gmp-internals: yes or no]) ;;
106     esac])
107
108AC_ARG_ENABLE(assert,
109   [  --enable-assert         enable ASSERT checking [[default=no]]],
110   [ case $enableval in
111      yes) AC_DEFINE([WANT_ASSERT],1,[Want assertion]) ;;
112      no)  ;;
113      full) AC_DEFINE([WANT_ASSERT],2,[Want assertion]) ;;
114      *) AC_MSG_ERROR([bad value for --enable-assert: yes, no or full]) ;;
115     esac])
116AC_ARG_ENABLE(logging,
117   [  --enable-logging        enable MPFR logging (the system must support it)
118                          [[default=no]]],
119   [ case $enableval in
120      yes) AC_DEFINE([MPFR_USE_LOGGING],1,[Log what MPFR does]) ;;
121      no)  ;;
122      *)   AC_MSG_ERROR([bad value for --enable-logging: yes or no]) ;;
123     esac])
124AC_ARG_ENABLE(thread-safe,
125   [  --disable-thread-safe   explicitly disable TLS support
126  --enable-thread-safe    build MPFR as thread safe, i.e. with TLS support
127                          (the system must support it) [[default=autodetect]]],
128   [ case $enableval in
129      yes) ;;
130      no)  ;;
131      *)   AC_MSG_ERROR([bad value for --enable-thread-safe: yes or no]) ;;
132     esac])
133AC_ARG_ENABLE(warnings,
134   [  --enable-warnings       allow MPFR to output warnings to stderr [[default=no]]],
135   [ case $enableval in
136      yes) AC_DEFINE([MPFR_USE_WARNINGS],1,[Allow MPFR to output warnings to stderr]) ;;
137      no)  ;;
138      *)   AC_MSG_ERROR([bad value for --enable-warnings: yes or no]) ;;
139     esac])
140
141AC_ARG_ENABLE(tests-timeout,
142   [  --enable-tests-timeout=NUM    enable timeout (NUM seconds) for test programs
143                          (NUM <= 9999) [[default=no]]; if enabled, env variable
144                          $MPFR_TESTS_TIMEOUT overrides NUM (0: no timeout).],
145   [ case $enableval in
146      no)   ;;
147      yes)  AC_DEFINE([MPFR_TESTS_TIMEOUT], 0, [timeout limit]) ;;
148      [[0-9]]|[[0-9]][[0-9]]|[[0-9]][[0-9]][[0-9]]|[[0-9]][[0-9]][[0-9]][[0-9]])
149       AC_DEFINE_UNQUOTED([MPFR_TESTS_TIMEOUT], $enableval, [timeout limit]) ;;
150      *)    AC_MSG_ERROR([bad value for --enable-tests-timeout]) ;;
151     esac])
152
153
154dnl
155dnl Setup CC and CFLAGS
156dnl
157
158dnl Check if user request its CC and CFLAGS
159if test -n "$CFLAGS" || test -n "$CC" ; then
160 user_redefine_cc=yes
161fi
162
163dnl ********************************************************************
164dnl Check for CC and CFLAGS in gmp.h
165
166if test -z "$user_redefine_cc" && test "$cross_compiling" != yes ; then
167
168dnl We need to guess the C preprocessor instead of using AC_PROG_CPP,
169dnl since AC_PROG_CPP implies AC_PROG_CC, which chooses a compiler
170dnl (before we have the chance to get it from gmp.h) and does some
171dnl checking related to this compiler (such as dependency tracking
172dnl options); if the compiler changes due to __GMP_CC in gmp.h, one
173dnl would have incorrect settings.
174dnl FIXME: Move this in aclocal ?
175if test -z "$GMP_CC$GMP_CFLAGS" ; then
176   AC_MSG_CHECKING(for CC and CFLAGS in gmp.h)
177   GMP_CC=__GMP_CC
178   GMP_CFLAGS=__GMP_CFLAGS
179   for cpp in /lib/cpp gcc cc c99
180   do
181     test $cpp = /lib/cpp || cpp="$cpp -E"
182     echo foo > conftest.c
183     if $cpp $CPPFLAGS conftest.c > /dev/null 2> /dev/null ; then
184       # Get CC
185       echo "#include \"gmp.h\"" >  conftest.c
186       echo "MPFR_OPTION __GMP_CC"           >> conftest.c
187       GMP_CC=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'`
188       # Get CFLAGS
189       echo "#include \"gmp.h\"" >  conftest.c
190       echo "MPFR_OPTION __GMP_CFLAGS"           >> conftest.c
191       unset rmpedantic
192       [test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;']
193       GMP_CFLAGS=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'`
194       break
195     fi
196   done
197   rm -f conftest*
198   if test "x$GMP_CC" = "x__GMP_CC" || test "x$GMP_CFLAGS" = "x__GMP_CFLAGS" ; then
199      AC_MSG_RESULT(no)
200      GMP_CFLAGS=
201      GMP_CC=
202   else
203      AC_MSG_RESULT(yes [CC=$GMP_CC CFLAGS=$GMP_CFLAGS])
204   fi
205fi
206
207dnl But these variables may be invalid, so we must check them first.
208dnl Note: we do not use AC_RUN_IFELSE, as it implies AC_PROG_CC.
209if test -n "$GMP_CC$GMP_CFLAGS" ; then
210   AC_MSG_CHECKING(for CC=$GMP_CC and CFLAGS=$GMP_CFLAGS)
211   echo "int main (void) { return 0; }" > conftest.c
212   if $GMP_CC $GMP_CFLAGS -o conftest conftest.c 2> /dev/null ; then
213     AC_MSG_RESULT(yes)
214     CFLAGS=$GMP_CFLAGS
215     CC=$GMP_CC
216   else
217     AC_MSG_RESULT(no)
218   fi
219   rm -f conftest*
220fi
221
222fi
223
224dnl ********************************************************************
225
226AC_PROG_CC
227AC_PROG_CPP
228AC_LANG(C)
229
230AC_ARG_ENABLE(decimal-float,
231   [  --enable-decimal-float  build conversion functions from/to decimal floats
232                          [[default=no]]],
233   [ case $enableval in
234      yes) AC_DEFINE([MPFR_WANT_DECIMAL_FLOATS],1,
235              [Build decimal float functions])
236           AC_MSG_CHECKING(if compiler knows _Decimal64)
237           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[_Decimal64 x;]])],
238              [AC_MSG_RESULT(yes)
239               if test "$use_gmp_build" != yes ; then
240                  AC_MSG_ERROR([decimal float support requires --with-gmp-build])
241               fi
242               AC_MSG_CHECKING(if _GMP_IEEE_FLOATS is defined)
243               AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
244#include "gmp.h"
245#include "gmp-impl.h"
246#ifndef _GMP_IEEE_FLOATS
247#error "_GMP_IEEE_FLOATS is not defined"
248#endif]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)
249                  AC_MSG_ERROR([decimal float support requires _GMP_IEEE_FLOATS])])
250              ],
251              [AC_MSG_ERROR([Compiler doesn't know _Decimal64; try GCC >= 4.2, configured with --enable-decimal-float]
252           )])
253           AC_MSG_CHECKING(decimal float format)
254           AC_RUN_IFELSE([AC_LANG_PROGRAM([[
255#include <stdlib.h>
256]], [[
257union { double d; _Decimal64 d64; } y;
258y.d64 = 1234567890123456.0dd;
259return y.d == 0.14894469406741037E-123 ? 0 :
260       y.d == 0.59075095508629822E-68  ? 1 : 2;
261]])], [AC_MSG_RESULT(DPD)
262       AC_DEFINE([DPD_FORMAT],1,[])],
263      [if test "$?" != 1 ; then
264          AC_MSG_FAILURE(neither DPD nor BID)
265       fi
266       AC_MSG_RESULT(BID)],
267      [AC_MSG_RESULT(assuming DPD)
268       AC_DEFINE([DPD_FORMAT],1,[])])
269           ;;
270      no)  ;;
271      *)   AC_MSG_ERROR([bad value for --enable-decimal-float: yes or no]) ;;
272     esac])
273
274dnl Check if compiler is ICC, and if such a case, disable GCC
275dnl And add some specific flags.
276dnl Don't add Warnings Flags (Otherwise you'll get more than 20000 warnings).
277dnl Add -long_double flags? Don't use -pc64 !
278dnl Notes (VL):
279dnl   * With icc 10.1 20080212 on itanium, the __ICC macro is not defined,
280dnl     even when the -icc option is used (contrary to what is documented
281dnl     on the icc man page).
282dnl   * When ICC is correctly detected (__ICC macro defined), unsetting
283dnl     the GCC variable confuses libtool. See:
284dnl       http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485421
285dnl   * If need be, the gcc predefined macros __GNUC_* can be disabled
286dnl     thanks to the -no-gcc option.
287AC_MSG_CHECKING(for ICC)
288AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
289#if !defined(__ICC)
290# error "ICC Not Found"
291error
292#endif
293]], [[]])],[
294 AC_MSG_RESULT(yes)
295 CFLAGS="-fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS"
296],[AC_MSG_RESULT(no)])
297
298dnl If compiler is gcc, then use some specific flags.
299dnl But don't touch user other flags.
300if test "$test_CFLAGS" != set && test -n "$GCC"; then
301  CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith $CFLAGS"
302fi
303
304AM_PROG_CC_C_O
305
306case $host in
307  *-apple-darwin*)
308dnl This allows to take the first GMP library in the library paths,
309dnl whether it is dynamic or static. This behavior is more sensible,
310dnl in particular because it is the only way to link with a version
311dnl only available in static form when another version is available
312dnl in dynamic, and also for consistency, because the compiler will
313dnl take the first gmp.h found in the include paths (so, we need to
314dnl take a library that corresponds to this header file). This is a
315dnl common problem with darwin.
316    MPFR_LD_SEARCH_PATHS_FIRST ;;
317esac
318
319AC_C_CONST
320AC_C_VOLATILE
321MPFR_CONFIGS
322
323# (Based on GMP 5.1)
324# clock_gettime is in librt on *-*-osf5.1 and on glibc < 2.17, so add -lrt to
325# TUNE_LIBS if needed (e.g. if clock_gettime is not already in the C library).
326# On linux (tested on x86_32, 2.6.26), clock_getres reports ns accuracy,
327# while in a quick test on osf, clock_getres said only 1 millisecond.
328old_LIBS="$LIBS"
329AC_SEARCH_LIBS(clock_gettime, rt, [
330  AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define to 1 if you have the `clock_gettime' function])])
331TUNE_LIBS="$LIBS"
332LIBS="$old_LIBS"
333AC_SUBST(TUNE_LIBS)
334
335dnl
336dnl Setup GMP detection
337dnl
338
339dnl Check GMP Header
340AC_MSG_CHECKING(for gmp.h)
341AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
342#include "gmp.h"
343]])],[AC_MSG_RESULT(yes)],[
344 AC_MSG_RESULT(no)
345 AC_MSG_ERROR([gmp.h can't be found, or is unusable.])
346])
347
348dnl Configs for Windows DLLs.
349dnl libtool requires "-no-undefined" for win32 dll
350dnl It also disables the tests involving the linking with LIBGMP if DLL
351dnl
352dnl "-Wl,output-def" is used to get a .def file for use by MS lib to make
353dnl a .lib import library, described in the manual.
354dnl
355dnl Incidentally, libtool does generate an import library libmpfr.dll.a,
356dnl but it's "ar" format and cannot be used by the MS linker.  There
357dnl doesn't seem to be any GNU tool for generating or converting to .lib.
358AC_SUBST(MPFR_LDFLAGS)
359AC_SUBST(LIBMPFR_LDFLAGS)
360AC_LIBTOOL_WIN32_DLL
361case $host in
362  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
363   AC_MSG_CHECKING(for DLL/static GMP)
364   if test "$enable_shared" = yes; then
365     MPFR_LDFLAGS="$MPFR_LDFLAGS -no-undefined"
366     LIBMPFR_LDFLAGS="$LIBMPFR_LDFLAGS -Wl,--output-def,.libs/libmpfr-4.dll.def"
367     dont_link_with_gmp="yes"
368     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
369#include "gmp.h"
370#if !__GMP_LIBGMP_DLL
371# error "Dead man"
372error
373#endif
374     ]], [[]])],[AC_MSG_RESULT(DLL)],[
375  AC_MSG_RESULT(static)
376  AC_MSG_ERROR([gmp.h isn't a DLL: use --enable-static --disable-shared]) ])
377   else
378     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
379#include "gmp.h"
380#if __GMP_LIBGMP_DLL
381# error "Dead man"
382error
383#endif
384     ]], [[]])],[AC_MSG_RESULT(static)],[
385  AC_MSG_RESULT(DLL)
386  AC_MSG_ERROR([gmp.h is a DLL: use --disable-static --enable-shared]) ])
387  fi
388  ;;
389esac
390dnl Finally set up LibTool
391AC_PROG_LIBTOOL
392
393
394dnl
395dnl For mpfr-longlong.h - TODO: should be replaced (see acinclude.m4).
396dnl
397
398GMP_C_ATTRIBUTE_MODE
399
400
401dnl
402dnl Setup GMP detection (continued)
403dnl
404
405dnl Check minimal GMP version
406dnl We only guarantee that with a *functional* and recent enough GMP version,
407dnl MPFR will compile; we do not guarantee that GMP will compile.
408dnl In particular fat builds are broken in GMP 4.3.2 and GMP 5.0.0
409dnl (at least on 64-bit Core 2 under Linux),
410dnl see http://gmplib.org/list-archives/gmp-bugs/2011-August/002345.html.
411AC_MSG_CHECKING(for recent GMP)
412AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
413#include "gmp.h"
414#if (__GNU_MP_VERSION*100+__GNU_MP_VERSION_MINOR*10 < 410)
415# error "min GMP version is 4.1.0"
416error
417#endif
418]])],[AC_MSG_RESULT(yes)],[
419 AC_MSG_RESULT(no)
420 AC_MSG_ERROR([GMP 4.1.0 min required])
421])
422
423dnl Check if we can use internal header files of GMP (only --with-gmp-build)
424if test "$use_gmp_build" = yes ; then
425   AC_MSG_CHECKING(for gmp internal files)
426   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
427   #include "gmp.h"
428   #include "gmp-impl.h"
429   #include "longlong.h"
430   ]])],[
431     AC_MSG_RESULT(yes)
432     AC_DEFINE([MPFR_HAVE_GMP_IMPL],1,[Use GMP Internal Files])
433   ],[
434     AC_MSG_ERROR([header files gmp-impl.h and longlong.h not found])
435   ])
436fi
437
438dnl Check for valid GMP_NUMB_BITS and BYTES_PER_MP_LIMB
439dnl This test doesn't need to link with libgmp (at least it shouldn't).
440if test "$use_gmp_build" = yes ; then
441  AC_MSG_CHECKING(for valid GMP_NUMB_BITS)
442  AC_RUN_IFELSE([AC_LANG_PROGRAM([[
443#include <limits.h>
444#include "gmp.h"
445#include "gmp-impl.h"
446]], [[
447  return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
448         && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1;
449]])], [AC_MSG_RESULT(yes)], [
450       AC_MSG_RESULT(no)
451       AC_MSG_ERROR([GMP_NUMB_BITS is incorrect.
452You probably need to change some of the GMP or MPFR compile options.])],
453       [AC_MSG_RESULT([can't test])])
454fi
455
456
457dnl We really need to link using libtool. But it is impossible with the current
458dnl libtool.
459dnl The practical problems appear only under MS Windows since the library name
460dnl is libgmp-3 (due to libtool versionning). The best solution
461dnl is to believe it works under MS-Windows.
462if test "$dont_link_with_gmp" = yes ; then
463LIBS="-lgmp $LIBS"
464else
465
466dnl Check if we can link with GMP
467AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"],
468 [AC_MSG_ERROR(libgmp not found or uses a different ABI (including static vs shared).
469Please read the INSTALL file -- see "In case of problem".)])
470
471dnl Check for corresponding 'gmp.h' and libgmp.a
472AC_MSG_CHECKING(if gmp.h version and libgmp version are the same)
473dnl We do not set LD_LIBRARY_PATH, as it is not possible to set it just
474dnl before the test program is run, and we do not want to affect other
475dnl programs (such as the compiler), because the behavior could be
476dnl incorrect and even have security implications.
477saved_LD_RUN_PATH="$LD_RUN_PATH"
478LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path"
479export LD_RUN_PATH
480AC_RUN_IFELSE([AC_LANG_PROGRAM([[
481#include <stdio.h>
482#include <string.h>
483#include "gmp.h"
484]], [[
485  char buffer[100];
486  sprintf (buffer, "%d.%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR,
487           __GNU_MP_VERSION_PATCHLEVEL);
488  printf ("(%s/%s) ", buffer, gmp_version);
489  if (strcmp (buffer, gmp_version) == 0)
490    return 0;
491  if (__GNU_MP_VERSION_PATCHLEVEL != 0)
492    return 1;
493  sprintf (buffer, "%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR);
494  return (strcmp (buffer, gmp_version) != 0) ? 1 : 0;
495]])],
496   [AC_MSG_RESULT(yes)
497    MPFR_CHECK_PRINTF_SPEC],
498   [AC_MSG_RESULT(no)
499    AC_MSG_WARN([==========================================================])
500    AC_MSG_WARN(['gmp.h' and 'libgmp' seem to have different versions or])
501    AC_MSG_WARN([we cannot run a program linked with GMP (if you cannot])
502    AC_MSG_WARN([see the version numbers above). A cause may be different])
503    AC_MSG_WARN([GMP versions with different ABI's or the use of --with-gmp])
504    AC_MSG_WARN([or --with-gmp-include with a system include directory])
505    AC_MSG_WARN([(such as /usr/include or /usr/local/include).])
506    AC_MSG_WARN([However since we can't use 'libtool' inside the configure,])
507    AC_MSG_WARN([we can't be sure. See 'config.log' for details.])
508    AC_MSG_WARN([==========================================================])
509    ],AC_MSG_RESULT([can not test])
510)
511LD_RUN_PATH="$saved_LD_RUN_PATH"
512
513dnl Warning! __gmpn_rootrem is an internal GMP symbol; thus its behavior
514dnl may change or this symbol may be removed in the future (without being
515dnl handled by the library versioning system, which is even worse, as this
516dnl can mean undetected incompatibilities in case of GMP library upgrade,
517dnl without rebuilding MPFR). So, this symbol must not be used, unless
518dnl WANT_GMP_INTERNALS is defined. Only the GMP public API should be used
519dnl by default, in particular by binary distributions. Moreover the check
520dnl below may yield an incorrect result as libtool isn't used in configure
521dnl (see above).
522dnl Same for __gmpn_sbpi1_divappr_q.
523AC_CHECK_FUNCS([__gmpn_rootrem __gmpn_sbpi1_divappr_q])
524
525dnl End of tests which need to link with GMP.
526fi
527
528dnl Remove also many MACROS (AC_DEFINE) which are unused by MPFR
529dnl and polluate (and slow down because libtool has to parse them) the build.
530if test -f confdefs.h; then
531  $SED '/#define PACKAGE_/d' <confdefs.h >confdefs.tmp
532  $SED '/#define HAVE_STRING/d' <confdefs.tmp >confdefs.h
533  $SED '/#define HAVE_ALLOCA /d' <confdefs.h >confdefs.tmp
534  $SED '/#define HAVE_DLFCN_H/d' <confdefs.tmp >confdefs.h
535  $SED '/#define HAVE_MEM/d' <confdefs.h >confdefs.tmp
536  $SED '/#define STDC_HEADERS/d' <confdefs.tmp >confdefs.h
537  $SED '/#define HAVE_STRTOL/d' <confdefs.h >confdefs.tmp
538  $SED '/#define HAVE_STDLIB_H/d' <confdefs.tmp >confdefs.h
539  $SED '/#define HAVE_UNISTD_H/d' <confdefs.h >confdefs.tmp
540  $SED '/#define HAVE_STDC_HEADERS/d' <confdefs.tmp >confdefs.h
541  $SED '/#define HAVE_LONG_DOUBLE/d' <confdefs.h >confdefs.tmp
542  $SED '/#define HAVE_SYS_STAT_H/d' <confdefs.tmp >confdefs.h
543  $SED '/#define HAVE_SYS_TYPES_H/d' <confdefs.h >confdefs.tmp
544  $SED '/#define PROTOTYPES/d' <confdefs.tmp >confdefs.h
545  $SED '/#define __PROTOTYPES/d' <confdefs.h >confdefs.tmp
546
547  mv confdefs.tmp confdefs.h
548fi
549
550if $EGREP -q -e '-dev$' $srcdir/VERSION; then
551  AC_SUBST([DATAFILES])dnl
552  DATAFILES=`echo \`$SED -n \
553    's/^ *data_check *("\(data\/[[^"]]*\)".*/tests\/\1/p' \
554    $srcdir/tests/*.c\``
555fi
556
557dnl Output
558AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in])
559AC_OUTPUT
560
561dnl NEWS README AUTHORS Changelog
562