# HG changeset patch # User Bruno Haible # Date 1270412000 -7200 # Node ID 399957a9c4120d91e5c389a6e69488c8e9e7c0e4 # Parent 0ac4252326261815cd1f5bc7cb52b749c835646c frexpl: Fix a C++ test error on Solaris 8 and Cygwin. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-04-04 Bruno Haible + + frexpl: Fix a C++ test error on Solaris 8 and Cygwin. + * m4/frexpl.m4 (gl_FUNC_FREXPL, gl_FUNC_FREXPL_NO_LIBM): When the + function is not declared, set HAVE_DECL_FREXPL to 0, instead of setting + REPLACE_FREXPL to 1. + * doc/posix-functions/frexpl.texi: Update documentation. + 2010-04-04 Bruno Haible math: Fix some C++ test errors on Solaris 8 and Cygwin. diff --git a/doc/posix-functions/frexpl.texi b/doc/posix-functions/frexpl.texi --- a/doc/posix-functions/frexpl.texi +++ b/doc/posix-functions/frexpl.texi @@ -12,6 +12,9 @@ This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5. @item +This function is not declared on some platforms: +MacOS X 10.3. +@item This function does not work on finite numbers on some platforms: MacOS X 10.4/PowerPC, AIX 5.1, BeOS. @item diff --git a/m4/frexpl.m4 b/m4/frexpl.m4 --- a/m4/frexpl.m4 +++ b/m4/frexpl.m4 @@ -7,54 +7,56 @@ AC_DEFUN([gl_FUNC_FREXPL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + 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 ]) FREXPL_LIBM= - AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], - [gl_cv_func_frexpl_no_libm], - [ - AC_TRY_LINK([#include - long double x;], - [int e; return frexpl (x, &e) > 0;], - [gl_cv_func_frexpl_no_libm=yes], - [gl_cv_func_frexpl_no_libm=no]) - ]) - if test $gl_cv_func_frexpl_no_libm = no; then - AC_CACHE_CHECK([whether frexpl() can be used with libm], - [gl_cv_func_frexpl_in_libm], + if test $HAVE_DECL_FREXPL = 1; then + AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], + [gl_cv_func_frexpl_no_libm], [ - save_LIBS="$LIBS" - LIBS="$LIBS -lm" AC_TRY_LINK([#include long double x;], [int e; return frexpl (x, &e) > 0;], - [gl_cv_func_frexpl_in_libm=yes], - [gl_cv_func_frexpl_in_libm=no]) - LIBS="$save_LIBS" + [gl_cv_func_frexpl_no_libm=yes], + [gl_cv_func_frexpl_no_libm=no]) ]) - if test $gl_cv_func_frexpl_in_libm = yes; then - FREXPL_LIBM=-lm + if test $gl_cv_func_frexpl_no_libm = no; then + AC_CACHE_CHECK([whether frexpl() can be used with libm], + [gl_cv_func_frexpl_in_libm], + [ + save_LIBS="$LIBS" + LIBS="$LIBS -lm" + AC_TRY_LINK([#include + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_in_libm=yes], + [gl_cv_func_frexpl_in_libm=no]) + LIBS="$save_LIBS" + ]) + if test $gl_cv_func_frexpl_in_libm = yes; then + FREXPL_LIBM=-lm + fi + fi + if test $gl_cv_func_frexpl_no_libm = yes \ + || test $gl_cv_func_frexpl_in_libm = yes; then + save_LIBS="$LIBS" + LIBS="$LIBS $FREXPL_LIBM" + gl_FUNC_FREXPL_WORKS + LIBS="$save_LIBS" + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl=yes ;; + *) gl_func_frexpl=no; REPLACE_FREXPL=1; FREXPL_LIBM= ;; + esac + else + gl_func_frexpl=no + fi + if test $gl_func_frexpl = yes; then + AC_DEFINE([HAVE_FREXPL], [1], + [Define if the frexpl() function is available.]) fi fi - if test $gl_cv_func_frexpl_no_libm = yes \ - || test $gl_cv_func_frexpl_in_libm = yes; then - save_LIBS="$LIBS" - LIBS="$LIBS $FREXPL_LIBM" - gl_FUNC_FREXPL_WORKS - LIBS="$save_LIBS" - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl=yes ;; - *) gl_func_frexpl=no; REPLACE_FREXPL=1; FREXPL_LIBM= ;; - esac - else - gl_func_frexpl=no - fi - if test $gl_func_frexpl = yes; then - AC_DEFINE([HAVE_FREXPL], [1], - [Define if the frexpl() function is available.]) - dnl Also 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 ]) - else - HAVE_DECL_FREXPL=0 + if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then AC_LIBOBJ([frexpl]) fi AC_SUBST([FREXPL_LIBM]) @@ -63,34 +65,36 @@ AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) - AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], - [gl_cv_func_frexpl_no_libm], - [ - AC_TRY_LINK([#include - long double x;], - [int e; return frexpl (x, &e) > 0;], - [gl_cv_func_frexpl_no_libm=yes], - [gl_cv_func_frexpl_no_libm=no]) - ]) - if test $gl_cv_func_frexpl_no_libm = yes; then - gl_FUNC_FREXPL_WORKS - case "$gl_cv_func_frexpl_works" in - *yes) gl_func_frexpl_no_libm=yes ;; - *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; - esac - else - gl_func_frexpl_no_libm=no - dnl Set REPLACE_FREXPL here because the system may have frexpl in libm. - REPLACE_FREXPL=1 + 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 ]) + if test $HAVE_DECL_FREXPL = 1; then + AC_CACHE_CHECK([whether frexpl() can be used without linking with libm], + [gl_cv_func_frexpl_no_libm], + [ + AC_TRY_LINK([#include + long double x;], + [int e; return frexpl (x, &e) > 0;], + [gl_cv_func_frexpl_no_libm=yes], + [gl_cv_func_frexpl_no_libm=no]) + ]) + if test $gl_cv_func_frexpl_no_libm = yes; then + gl_FUNC_FREXPL_WORKS + case "$gl_cv_func_frexpl_works" in + *yes) gl_func_frexpl_no_libm=yes ;; + *) gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;; + esac + else + gl_func_frexpl_no_libm=no + dnl Set REPLACE_FREXPL here because the system may have frexpl in libm. + REPLACE_FREXPL=1 + fi + if test $gl_func_frexpl_no_libm = yes; then + AC_DEFINE([HAVE_FREXPL_IN_LIBC], [1], + [Define if the frexpl() function is available in libc.]) + fi fi - if test $gl_func_frexpl_no_libm = yes; then - AC_DEFINE([HAVE_FREXPL_IN_LIBC], [1], - [Define if the frexpl() function is available in libc.]) - dnl Also 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 ]) - else - HAVE_DECL_FREXPL=0 + if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; then AC_LIBOBJ([frexpl]) fi ])