X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Ffrexpl.m4;h=e2722910c1219eefaa88de50f393c32e94d7046f;hb=cd56634a4a8179fd5a4419fbb3e27211b042ab1c;hp=2e8c68136dc7d0b03f54273ba9b4f41caca9fcac;hpb=6195fa324fac1442ba68395a30f32110997959dd;p=gnulib.git diff --git a/m4/frexpl.m4 b/m4/frexpl.m4 index 2e8c68136..e2722910c 100644 --- a/m4/frexpl.m4 +++ b/m4/frexpl.m4 @@ -1,5 +1,5 @@ -# frexpl.m4 serial 15 -dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. +# frexpl.m4 serial 20 +dnl Copyright (C) 2007-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,9 +7,15 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FREXPL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) + + dnl Persuade glibc to declare frexpl(). + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + dnl Check whether it's declared. - dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in . - AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include ]) + dnl Mac OS X 10.3 has frexpl() in libc but doesn't declare it in . + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include ]]) + FREXPL_LIBM= if test $HAVE_DECL_FREXPL = 1; then gl_CHECK_FREXPL_NO_LIBM @@ -40,7 +46,7 @@ AC_DEFUN([gl_FUNC_FREXPL], LIBS="$save_LIBS" case "$gl_cv_func_frexpl_works" in *yes) gl_func_frexpl=yes ;; - *) gl_func_frexpl=no; REPLACE_FREXPL=1; FREXPL_LIBM= ;; + *) gl_func_frexpl=no; REPLACE_FREXPL=1 ;; esac else gl_func_frexpl=no @@ -50,15 +56,25 @@ AC_DEFUN([gl_FUNC_FREXPL], [Define if the frexpl() function is available.]) fi fi + if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then + dnl Find libraries needed to link lib/frexpl.c. + if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then + AC_REQUIRE([gl_FUNC_FREXP]) + FREXPL_LIBM="$FREXP_LIBM" + else + FREXPL_LIBM= + fi + fi AC_SUBST([FREXPL_LIBM]) ]) AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) dnl Check whether it's declared. - dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in . - AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include ]) + dnl Mac OS X 10.3 has frexpl() in libc but doesn't declare it in . + AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include ]]) if test $HAVE_DECL_FREXPL = 1; then gl_CHECK_FREXPL_NO_LIBM if test $gl_cv_func_frexpl_no_libm = yes; then @@ -97,8 +113,8 @@ AC_DEFUN([gl_CHECK_FREXPL_NO_LIBM], ]) dnl Test whether frexpl() works on finite numbers (this fails on -dnl MacOS X 10.4/PowerPC, on AIX 5.1, and on BeOS), on denormalized numbers -dnl (this fails on MacOS X 10.5/i386), and also on infinite numbers (this +dnl Mac OS X 10.4/PowerPC, on AIX 5.1, and on BeOS), on denormalized numbers +dnl (this fails on Mac OS X 10.5/i386), and also on infinite numbers (this dnl fails e.g. on IRIX 6.5 and mingw). AC_DEFUN([gl_FUNC_FREXPL_WORKS], [ @@ -115,6 +131,20 @@ AC_DEFUN([gl_FUNC_FREXPL_WORKS], # undef LDBL_MIN_EXP # define LDBL_MIN_EXP (-16381) #endif +#if defined __i386__ && defined __FreeBSD__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP (-16381) +#endif +#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG == 106) && defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +#endif +#if defined __sgi && (LDBL_MANT_DIG >= 106) +# if defined __GNUC__ +# undef LDBL_MIN_EXP +# define LDBL_MIN_EXP DBL_MIN_EXP +# endif +#endif extern #ifdef __cplusplus "C" @@ -132,7 +162,7 @@ int main() if (exp != 5) result |= 1; } - /* Test on finite numbers that fails on MacOS X 10.4, because its frexpl + /* Test on finite numbers that fails on Mac OS X 10.4, because its frexpl function returns an invalid (incorrectly normalized) value: it returns y = { 0x3fe028f5, 0xc28f5c28, 0x3c9eb851, 0xeb851eb8 } but the correct result is @@ -171,7 +201,7 @@ int main() int exp; long double y = frexpl (x, &exp); /* On machines with IEEE854 arithmetic: x = 1.68105e-4932, - exp = -16382, y = 0.5. On MacOS X 10.5: exp = -16384, y = 0.5. */ + exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */ if (exp != LDBL_MIN_EXP - 1) result |= 8; }