frexpl: Fix a C++ test error on Solaris 8 and Cygwin.
authorBruno Haible <bruno@clisp.org>
Sun, 4 Apr 2010 20:13:20 +0000 (22:13 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Apr 2010 20:13:20 +0000 (22:13 +0200)
ChangeLog
doc/posix-functions/frexpl.texi
m4/frexpl.m4

index 376ac9b..53c2a1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-04-04  Bruno Haible  <bruno@clisp.org>
 
+       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  <bruno@clisp.org>
+
        math: Fix some C++ test errors on Solaris 8 and Cygwin.
        * lib/math.in.h (cosl, logl, sinl): Use simpler idiom.
 
index 38cee7b..19b7468 100644 (file)
@@ -12,6 +12,9 @@ Portability problems fixed by Gnulib:
 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
index 0fbc893..8016520 100644 (file)
@@ -7,54 +7,56 @@ dnl with or without modifications, as long as this notice is preserved.
 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 <math.h>.
+  AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>])
   FREXPL_LIBM=
-  AC_CACHE_CHECK([whether frexpl() can be used without linking with libm],
-    [gl_cv_func_frexpl_no_libm],
-    [
-      AC_TRY_LINK([#include <math.h>
-                   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 <math.h>
                      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 <math.h>
+                       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 <math.h>.
-    AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>])
-  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],
 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 <math.h>
-                   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 <math.h>.
+  AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>])
+  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 <math.h>
+                     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 <math.h>.
-    AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>])
-  else
-    HAVE_DECL_FREXPL=0
+  if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; then
     AC_LIBOBJ([frexpl])
   fi
 ])