aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/acinclude.m4
diff options
context:
space:
mode:
authorSteve Ellcey <sje@cup.hp.com>2005-09-27 21:12:52 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2005-09-27 21:12:52 +0000
commit118ea208fa6de41756b9d1cce052e0bd64c681c2 (patch)
treeb153488273b3833bfdf44f1f0c3ac72e033b31c2 /libgfortran/acinclude.m4
parentca7a5aec06cbaa6683aedc8ebb6273e5d0e64fc6 (diff)
downloadgcc-118ea208fa6de41756b9d1cce052e0bd64c681c2.zip
gcc-118ea208fa6de41756b9d1cce052e0bd64c681c2.tar.gz
gcc-118ea208fa6de41756b9d1cce052e0bd64c681c2.tar.bz2
re PR target/23552 (FAIL: gfortran.dg/large_real_kind_1.f90)
PR target/23552 * acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE): New. (LIBGFOR_CHECK_FOR_BROKEN_ISNAN): New. (LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY): New. * configure.ac (LIBGFOR_CHECK_FOR_BROKEN_ISFINITE): Add use. (LIBGFOR_CHECK_FOR_BROKEN_ISNAN): Add use. (LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY): Add use. * configure: Regenerate. * config.h.in: Regenerate. * libgfortan.h (isfinite): undef if broken, set if needed. (isnan): undef if broken, set if needed. (fpclassify): undef if broken, set if needed. * io/write.c: Remove TODO comment about working isfinite. * intrinsics/c99_functions.c (round): Use isfinite instead of fpclassify. * intrinsics/c99_functions.c (roundf): Ditto. From-SVN: r104710
Diffstat (limited to 'libgfortran/acinclude.m4')
-rw-r--r--libgfortran/acinclude.m4119
1 files changed, 119 insertions, 0 deletions
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index f9fcca6..dbf25f3 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -230,3 +230,122 @@ esac])])
if test x"$have_crlf" = xyes; then
AC_DEFINE(HAVE_CRLF, 1, [Define if CRLF is line terminator.])
fi])
+
+dnl Check whether isfinite is broken.
+dnl The most common problem is that it does not work on long doubles.
+AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_ISFINITE], [
+ AC_CACHE_CHECK([whether isfinite is broken],
+ have_broken_isfinite, [
+ libgfor_check_for_broken_isfinite_save_LIBS=$LIBS
+ LIBS="$LIBS -lm"
+ AC_TRY_RUN([
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+#include <float.h>
+int main ()
+{
+#ifdef isfinite
+#ifdef LDBL_MAX
+ if (!isfinite(LDBL_MAX)) return 1;
+#endif
+#ifdef DBL_MAX
+ if (!isfinite(DBL_MAX)) return 1;
+#endif
+#endif
+return 0;
+}], have_broken_isfinite=no, have_broken_isfinite=yes, [
+case "${target}" in
+ hppa*-*-hpux*) have_broken_isfinite=yes ;;
+ *) have_broken_isfinite=no ;;
+esac])]
+ LIBS=$libgfor_check_for_broken_isfinite_save_LIBS)
+if test x"$have_broken_isfinite" = xyes; then
+ AC_DEFINE(HAVE_BROKEN_ISFINITE, 1, [Define if isfinite is broken.])
+fi])
+
+dnl Check whether isnan is broken.
+dnl The most common problem is that it does not work on long doubles.
+AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_ISNAN], [
+ AC_CACHE_CHECK([whether isnan is broken],
+ have_broken_isnan, [
+ libgfor_check_for_broken_isnan_save_LIBS=$LIBS
+ LIBS="$LIBS -lm"
+ AC_TRY_RUN([
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+#include <float.h>
+int main ()
+{
+#ifdef isnan
+#ifdef LDBL_MAX
+ {
+ long double x;
+ x = __builtin_nanl ("");
+ if (!isnan(x)) return 1;
+ if (isnan(LDBL_MAX)) return 1;
+#ifdef NAN
+ x = (long double) NAN;
+ if (!isnan(x)) return 1;
+#endif
+ }
+#endif
+#ifdef DBL_MAX
+ {
+ double y;
+ y = __builtin_nan ("");
+ if (!isnan(y)) return 1;
+ if (isnan(DBL_MAX)) return 1;
+#ifdef NAN
+ y = (double) NAN;
+ if (!isnan(y)) return 1;
+#endif
+ }
+#endif
+#endif
+return 0;
+}], have_broken_isnan=no, have_broken_isnan=yes, [
+case "${target}" in
+ hppa*-*-hpux*) have_broken_isnan=yes ;;
+ *) have_broken_isnan=no ;;
+esac])]
+ LIBS=$libgfor_check_for_broken_isnan_save_LIBS)
+if test x"$have_broken_isnan" = xyes; then
+ AC_DEFINE(HAVE_BROKEN_ISNAN, 1, [Define if isnan is broken.])
+fi])
+
+dnl Check whether fpclassify is broken.
+dnl The most common problem is that it does not work on long doubles.
+AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY], [
+ AC_CACHE_CHECK([whether fpclassify is broken],
+ have_broken_fpclassify, [
+ libgfor_check_for_broken_fpclassify_save_LIBS=$LIBS
+ LIBS="$LIBS -lm"
+ AC_TRY_RUN([
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+#include <float.h>
+int main ()
+{
+#ifdef fpclassify
+#ifdef LDBL_MAX
+ if (fpclassify(LDBL_MAX) == FP_NAN
+ || fpclassify(LDBL_MAX) == FP_INFINITE) return 1;
+#endif
+#ifdef DBL_MAX
+ if (fpclassify(DBL_MAX) == FP_NAN
+ || fpclassify(DBL_MAX) == FP_INFINITE) return 1;
+#endif
+#endif
+return 0;
+}], have_broken_fpclassify=no, have_broken_fpclassify=yes, [
+case "${target}" in
+ hppa*-*-hpux*) have_broken_fpclassify=yes ;;
+ *) have_broken_fpclassify=no ;;
+esac])]
+ LIBS=$libgfor_check_for_broken_fpclassify_save_LIBS)
+if test x"$have_broken_fpclassify" = xyes; then
+ AC_DEFINE(HAVE_BROKEN_FPCLASSIFY, 1, [Define if fpclassify is broken.])
+fi])