Bump to version 3.1.2
[platform/upstream/mpfr.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_COPYRIGHT([
4 Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
5 Contributed by the AriC and Caramel projects, INRIA.
6
7 This file is part of the GNU MPFR Library.
8
9 The GNU MPFR Library is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published
11 by the Free Software Foundation; either version 3 of the License, or (at
12 your option) any later version.
13
14 The GNU MPFR Library is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17 License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with the GNU MPFR Library; see the file COPYING.LESSER.  If not, see
21 http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
22 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
23 ])
24
25 dnl Add check-news when it checks for more than 15 lines
26 AC_INIT([MPFR],[3.1.2])
27
28 AM_INIT_AUTOMAKE([1.11 no-define dist-bzip2 dist-xz dist-zip])
29 AM_MAINTAINER_MODE(enable)
30
31 AC_CONFIG_MACRO_DIR([m4])
32
33 dnl FIXME: The AC_ARG_ENABLE(decimal-float...) part does things too
34 dnl early, even when this option is not used. In particular, it must
35 dnl be put after AC_PROG_CC; another problem is that the GMP CFLAGS
36 dnl and CC check may modify the compiler.
37
38 test_CFLAGS=${CFLAGS+set}
39
40 AC_CANONICAL_HOST
41
42 AC_PROG_EGREP
43 AC_PROG_SED
44
45 dnl To use a separate config header.
46 dnl There is still some problem with GMP's HAVE_CONFIG
47 dnl AC_CONFIG_HEADERS([mpfrconf.h:mpfrconf.in])
48
49 dnl Extra arguments to configure
50 unset gmp_lib_path GMP_CFLAGS GMP_CC
51 AC_ARG_WITH(gmp_include,
52    [  --with-gmp-include=DIR  GMP include directory ],
53    CPPFLAGS="$CPPFLAGS -I$withval")
54 AC_ARG_WITH(gmp_lib,
55    [  --with-gmp-lib=DIR      GMP lib directory ], [
56    LDFLAGS="$LDFLAGS -L$withval"
57    gmp_lib_path="$withval"
58   ])
59 AC_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
70 AC_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
96 AC_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
100 AC_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
108 AC_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])
116 AC_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])
124 AC_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])
133 AC_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
141 AC_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
154 dnl
155 dnl Setup CC and CFLAGS
156 dnl
157
158 dnl Check if user request its CC and CFLAGS
159 if test -n "$CFLAGS" || test -n "$CC" ; then
160  user_redefine_cc=yes
161 fi
162
163 dnl ********************************************************************
164 dnl Check for CC and CFLAGS in gmp.h
165
166 if test -z "$user_redefine_cc" && test "$cross_compiling" != yes ; then
167
168 dnl We need to guess the C preprocessor instead of using AC_PROG_CPP,
169 dnl since AC_PROG_CPP implies AC_PROG_CC, which chooses a compiler
170 dnl (before we have the chance to get it from gmp.h) and does some
171 dnl checking related to this compiler (such as dependency tracking
172 dnl options); if the compiler changes due to __GMP_CC in gmp.h, one
173 dnl would have incorrect settings.
174 dnl FIXME: Move this in aclocal ?
175 if 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
205 fi
206
207 dnl But these variables may be invalid, so we must check them first.
208 dnl Note: we do not use AC_RUN_IFELSE, as it implies AC_PROG_CC.
209 if 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*
220 fi
221
222 fi
223
224 dnl ********************************************************************
225
226 AC_PROG_CC
227 AC_PROG_CPP
228 AC_LANG(C)
229
230 AC_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 ]], [[
257 union { double d; _Decimal64 d64; } y;
258 y.d64 = 1234567890123456.0dd;
259 return 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
274 dnl Check if compiler is ICC, and if such a case, disable GCC
275 dnl And add some specific flags.
276 dnl Don't add Warnings Flags (Otherwise you'll get more than 20000 warnings).
277 dnl Add -long_double flags? Don't use -pc64 !
278 dnl Notes (VL):
279 dnl   * With icc 10.1 20080212 on itanium, the __ICC macro is not defined,
280 dnl     even when the -icc option is used (contrary to what is documented
281 dnl     on the icc man page).
282 dnl   * When ICC is correctly detected (__ICC macro defined), unsetting
283 dnl     the GCC variable confuses libtool. See:
284 dnl       http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485421
285 dnl   * If need be, the gcc predefined macros __GNUC_* can be disabled
286 dnl     thanks to the -no-gcc option.
287 AC_MSG_CHECKING(for ICC)
288 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
289 #if !defined(__ICC)
290 # error "ICC Not Found"
291 error
292 #endif
293 ]], [[]])],[
294  AC_MSG_RESULT(yes)
295  CFLAGS="-fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS"
296 ],[AC_MSG_RESULT(no)])
297
298 dnl If compiler is gcc, then use some specific flags.
299 dnl But don't touch user other flags.
300 if test "$test_CFLAGS" != set && test -n "$GCC"; then
301   CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith $CFLAGS"
302 fi
303
304 AM_PROG_CC_C_O
305
306 case $host in
307   *-apple-darwin*)
308 dnl This allows to take the first GMP library in the library paths,
309 dnl whether it is dynamic or static. This behavior is more sensible,
310 dnl in particular because it is the only way to link with a version
311 dnl only available in static form when another version is available
312 dnl in dynamic, and also for consistency, because the compiler will
313 dnl take the first gmp.h found in the include paths (so, we need to
314 dnl take a library that corresponds to this header file). This is a
315 dnl common problem with darwin.
316     MPFR_LD_SEARCH_PATHS_FIRST ;;
317 esac
318
319 AC_C_CONST
320 AC_C_VOLATILE
321 MPFR_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.
328 old_LIBS="$LIBS"
329 AC_SEARCH_LIBS(clock_gettime, rt, [
330   AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define to 1 if you have the `clock_gettime' function])])
331 TUNE_LIBS="$LIBS"
332 LIBS="$old_LIBS"
333 AC_SUBST(TUNE_LIBS)
334
335 dnl
336 dnl Setup GMP detection
337 dnl
338
339 dnl Check GMP Header
340 AC_MSG_CHECKING(for gmp.h)
341 AC_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
348 dnl Configs for Windows DLLs.
349 dnl libtool requires "-no-undefined" for win32 dll
350 dnl It also disables the tests involving the linking with LIBGMP if DLL
351 dnl
352 dnl "-Wl,output-def" is used to get a .def file for use by MS lib to make
353 dnl a .lib import library, described in the manual.
354 dnl
355 dnl Incidentally, libtool does generate an import library libmpfr.dll.a,
356 dnl but it's "ar" format and cannot be used by the MS linker.  There
357 dnl doesn't seem to be any GNU tool for generating or converting to .lib.
358 AC_SUBST(MPFR_LDFLAGS)
359 AC_SUBST(LIBMPFR_LDFLAGS)
360 AC_LIBTOOL_WIN32_DLL
361 case $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"
372 error
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"
382 error
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   ;;
389 esac
390 dnl Finally set up LibTool
391 AC_PROG_LIBTOOL
392
393
394 dnl
395 dnl For mpfr-longlong.h - TODO: should be replaced (see acinclude.m4).
396 dnl
397
398 GMP_C_ATTRIBUTE_MODE
399
400
401 dnl
402 dnl Setup GMP detection (continued)
403 dnl
404
405 dnl Check minimal GMP version
406 dnl We only guarantee that with a *functional* and recent enough GMP version,
407 dnl MPFR will compile; we do not guarantee that GMP will compile.
408 dnl In particular fat builds are broken in GMP 4.3.2 and GMP 5.0.0
409 dnl (at least on 64-bit Core 2 under Linux),
410 dnl see http://gmplib.org/list-archives/gmp-bugs/2011-August/002345.html.
411 AC_MSG_CHECKING(for recent GMP)
412 AC_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"
416 error
417 #endif
418 ]])],[AC_MSG_RESULT(yes)],[
419  AC_MSG_RESULT(no)
420  AC_MSG_ERROR([GMP 4.1.0 min required])
421 ])
422
423 dnl Check if we can use internal header files of GMP (only --with-gmp-build)
424 if 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    ])
436 fi
437
438 dnl Check for valid GMP_NUMB_BITS and BYTES_PER_MP_LIMB
439 dnl This test doesn't need to link with libgmp (at least it shouldn't).
440 if 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.
452 You probably need to change some of the GMP or MPFR compile options.])],
453        [AC_MSG_RESULT([can't test])])
454 fi
455
456
457 dnl We really need to link using libtool. But it is impossible with the current
458 dnl libtool.
459 dnl The practical problems appear only under MS Windows since the library name
460 dnl is libgmp-3 (due to libtool versionning). The best solution
461 dnl is to believe it works under MS-Windows.
462 if test "$dont_link_with_gmp" = yes ; then
463 LIBS="-lgmp $LIBS"
464 else
465
466 dnl Check if we can link with GMP
467 AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"],
468  [AC_MSG_ERROR(libgmp not found or uses a different ABI (including static vs shared).
469 Please read the INSTALL file -- see "In case of problem".)])
470
471 dnl Check for corresponding 'gmp.h' and libgmp.a
472 AC_MSG_CHECKING(if gmp.h version and libgmp version are the same)
473 dnl We do not set LD_LIBRARY_PATH, as it is not possible to set it just
474 dnl before the test program is run, and we do not want to affect other
475 dnl programs (such as the compiler), because the behavior could be
476 dnl incorrect and even have security implications.
477 saved_LD_RUN_PATH="$LD_RUN_PATH"
478 LD_RUN_PATH="${LD_RUN_PATH:+$LD_RUN_PATH$PATH_SEPARATOR}$gmp_lib_path"
479 export LD_RUN_PATH
480 AC_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 )
511 LD_RUN_PATH="$saved_LD_RUN_PATH"
512
513 dnl Warning! __gmpn_rootrem is an internal GMP symbol; thus its behavior
514 dnl may change or this symbol may be removed in the future (without being
515 dnl handled by the library versioning system, which is even worse, as this
516 dnl can mean undetected incompatibilities in case of GMP library upgrade,
517 dnl without rebuilding MPFR). So, this symbol must not be used, unless
518 dnl WANT_GMP_INTERNALS is defined. Only the GMP public API should be used
519 dnl by default, in particular by binary distributions. Moreover the check
520 dnl below may yield an incorrect result as libtool isn't used in configure
521 dnl (see above).
522 dnl Same for __gmpn_sbpi1_divappr_q.
523 AC_CHECK_FUNCS([__gmpn_rootrem __gmpn_sbpi1_divappr_q])
524
525 dnl End of tests which need to link with GMP.
526 fi
527
528 dnl Remove also many MACROS (AC_DEFINE) which are unused by MPFR
529 dnl and polluate (and slow down because libtool has to parse them) the build.
530 if 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
548 fi
549
550 if $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\``
555 fi
556
557 dnl Output
558 AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile tests/Makefile tune/Makefile src/mparam.h:src/mparam_h.in])
559 AC_OUTPUT
560
561 dnl NEWS README AUTHORS Changelog