diff mbox series

[pach,power-ieee128,committed] Generate config.h macros for ieee128 functions

Message ID ef009ff7-77a3-985a-901a-13236c6787e0@netcologne.de
State New
Headers show
Series [pach,power-ieee128,committed] Generate config.h macros for ieee128 functions | expand

Commit Message

Thomas Koenig Dec. 12, 2021, 12:01 p.m. UTC
Pushed to the branch.

Generate config.h macros for IEEE128 math functions.

libgfortran/ChangeLog:

	* acinclude.m4 (LIBGFOR_CHECK_MATH_IEEE128): New macro.
	* configure.ac: Use it.
	* config.h.in: Regenerate.
	* configure: Regenerate.
diff mbox series

Patch

diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 184eb7fd926..a306fcbebd3 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -719,6 +719,7 @@  pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index 5b0c094e716..bf4cc782ec2 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -510,3 +510,26 @@  AC_DEFUN([LIBGFOR_CHECK_AVX128], [
 	[AM_CONDITIONAL([HAVE_AVX128],false)])
   CFLAGS="$ac_save_CFLAGS"
 ])
+
+AC_DEFUN([LIBGFOR_CHECK_MATH_IEEE128],
+[
+  AC_REQUIRE([GCC_CHECK_LIBM])
+  AC_REQUIRE([GCC_CHECK_MATH_HEADERS])
+  AC_CACHE_CHECK([for $1], [gcc_cv_math_func_$1],
+		 [AC_LINK_IFELSE([AC_LANG_SOURCE([
+__float128 $1 (__float128);
+__float128 (*ptr)(__float128) = $1;
+
+int
+main ()
+{
+  return 0;
+}
+])],
+[gcc_cv_math_func_$1=yes],
+[gcc_cv_math_func_$1=no])])
+  if test $gcc_cv_math_func_$1 = yes; then
+    AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1),[1],
+                       [Define to 1 if you have the `$1' function.])
+  fi
+])
diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in
index 2d58188e50c..02dcf49c49a 100644
--- a/libgfortran/config.h.in
+++ b/libgfortran/config.h.in
@@ -888,9 +888,75 @@ 
 /* Define to 1 if you have the `ynl' function. */
 #undef HAVE_YNL
 
+/* Define to 1 if you have the `__acoshieee128' function. */
+#undef HAVE___ACOSHIEEE128
+
+/* Define to 1 if you have the `__acosieee128' function. */
+#undef HAVE___ACOSIEEE128
+
+/* Define to 1 if you have the `__asinhieee128' function. */
+#undef HAVE___ASINHIEEE128
+
+/* Define to 1 if you have the `__asinieee128' function. */
+#undef HAVE___ASINIEEE128
+
+/* Define to 1 if you have the `__atan2ieee128' function. */
+#undef HAVE___ATAN2IEEE128
+
+/* Define to 1 if you have the `__atanhieee128' function. */
+#undef HAVE___ATANHIEEE128
+
+/* Define to 1 if you have the `__atanieee128' function. */
+#undef HAVE___ATANIEEE128
+
+/* Define to 1 if you have the `__coshieee128' function. */
+#undef HAVE___COSHIEEE128
+
+/* Define to 1 if you have the `__cosieee128' function. */
+#undef HAVE___COSIEEE128
+
+/* Define to 1 if you have the `__erfieee128' function. */
+#undef HAVE___ERFIEEE128
+
+/* Define to 1 if you have the `__expieee128' function. */
+#undef HAVE___EXPIEEE128
+
+/* Define to 1 if you have the `__fabsieee128' function. */
+#undef HAVE___FABSIEEE128
+
+/* Define to 1 if you have the `__jnieee128' function. */
+#undef HAVE___JNIEEE128
+
+/* Define to 1 if you have the `__log10ieee128' function. */
+#undef HAVE___LOG10IEEE128
+
+/* Define to 1 if you have the `__logieee128' function. */
+#undef HAVE___LOGIEEE128
+
+/* Define to 1 if you have the `__powieee128' function. */
+#undef HAVE___POWIEEE128
+
 /* Define to 1 if you have the `__secure_getenv' function. */
 #undef HAVE___SECURE_GETENV
 
+/* Define to 1 if you have the `__sinhieee128' function. */
+#undef HAVE___SINHIEEE128
+
+/* Define to 1 if you have the `__sinieee128' function. */
+#undef HAVE___SINIEEE128
+
+/* Define to 1 if you have the `__sqrtieee128' function. */
+#undef HAVE___SQRTIEEE128
+
+/* Define to 1 if you have the `__tanhieee128' function. */
+#undef HAVE___TANHIEEE128
+
+/* Define to 1 if you have the `__tanieee128' function. */
+#undef HAVE___TANIEEE128
+
+/* Define to 1 if you have the `__ynieee128' function. */
+#undef HAVE___YNIEEE128
+
 /* Define to the sub-directory in which libtool stores uninstalled libraries.
    */
 #undef LT_OBJDIR
diff --git a/libgfortran/configure b/libgfortran/configure
index 090c8dd3d76..845d4fec5a1 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -6028,7 +6028,6 @@  if ac_fn_c_try_cpp "$LINENO"; then :
   AM_FCFLAGS="$AM_FCFLAGS -mabi=ibmlongdouble";
 	 AM_CFLAGS="$AM_CFLAGS -mabi=ibmlongdouble";
 	 CFLAGS="$CFLAGS -mabi=ibmlongdouble";
-	 echo "Juhu!";
 	 have_real_17=yes
 fi
 rm -f conftest.err conftest.i conftest.$ac_ext
@@ -6045,6 +6044,7 @@  else
   HAVE_REAL_17_FALSE=
 fi
 
+
 # Add CET specific flags if CET is enabled
  # Check whether --enable-cet was given.
 if test "${enable_cet+set}" = set; then :
@@ -25846,6 +25846,935 @@  _ACEOF
   fi
 
 
+# For POWER, check the ieee128 math functions
+
+if test "x$have_real_17" = "xyes"; then
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __acoshieee128" >&5
+$as_echo_n "checking for __acoshieee128... " >&6; }
+if ${gcc_cv_math_func___acoshieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __acoshieee128 (__float128);
+__float128 (*ptr)(__float128) = __acoshieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___acoshieee128=yes
+else
+  gcc_cv_math_func___acoshieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___acoshieee128" >&5
+$as_echo "$gcc_cv_math_func___acoshieee128" >&6; }
+  if test $gcc_cv_math_func___acoshieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___ACOSHIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __acosieee128" >&5
+$as_echo_n "checking for __acosieee128... " >&6; }
+if ${gcc_cv_math_func___acosieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __acosieee128 (__float128);
+__float128 (*ptr)(__float128) = __acosieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___acosieee128=yes
+else
+  gcc_cv_math_func___acosieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___acosieee128" >&5
+$as_echo "$gcc_cv_math_func___acosieee128" >&6; }
+  if test $gcc_cv_math_func___acosieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___ACOSIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __asinhieee128" >&5
+$as_echo_n "checking for __asinhieee128... " >&6; }
+if ${gcc_cv_math_func___asinhieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __asinhieee128 (__float128);
+__float128 (*ptr)(__float128) = __asinhieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___asinhieee128=yes
+else
+  gcc_cv_math_func___asinhieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___asinhieee128" >&5
+$as_echo "$gcc_cv_math_func___asinhieee128" >&6; }
+  if test $gcc_cv_math_func___asinhieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___ASINHIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __asinieee128" >&5
+$as_echo_n "checking for __asinieee128... " >&6; }
+if ${gcc_cv_math_func___asinieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __asinieee128 (__float128);
+__float128 (*ptr)(__float128) = __asinieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___asinieee128=yes
+else
+  gcc_cv_math_func___asinieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___asinieee128" >&5
+$as_echo "$gcc_cv_math_func___asinieee128" >&6; }
+  if test $gcc_cv_math_func___asinieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___ASINIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atan2ieee128" >&5
+$as_echo_n "checking for __atan2ieee128... " >&6; }
+if ${gcc_cv_math_func___atan2ieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __atan2ieee128 (__float128);
+__float128 (*ptr)(__float128) = __atan2ieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___atan2ieee128=yes
+else
+  gcc_cv_math_func___atan2ieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___atan2ieee128" >&5
+$as_echo "$gcc_cv_math_func___atan2ieee128" >&6; }
+  if test $gcc_cv_math_func___atan2ieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___ATAN2IEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atanhieee128" >&5
+$as_echo_n "checking for __atanhieee128... " >&6; }
+if ${gcc_cv_math_func___atanhieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __atanhieee128 (__float128);
+__float128 (*ptr)(__float128) = __atanhieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___atanhieee128=yes
+else
+  gcc_cv_math_func___atanhieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___atanhieee128" >&5
+$as_echo "$gcc_cv_math_func___atanhieee128" >&6; }
+  if test $gcc_cv_math_func___atanhieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___ATANHIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atanieee128" >&5
+$as_echo_n "checking for __atanieee128... " >&6; }
+if ${gcc_cv_math_func___atanieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __atanieee128 (__float128);
+__float128 (*ptr)(__float128) = __atanieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___atanieee128=yes
+else
+  gcc_cv_math_func___atanieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___atanieee128" >&5
+$as_echo "$gcc_cv_math_func___atanieee128" >&6; }
+  if test $gcc_cv_math_func___atanieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___ATANIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __coshieee128" >&5
+$as_echo_n "checking for __coshieee128... " >&6; }
+if ${gcc_cv_math_func___coshieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __coshieee128 (__float128);
+__float128 (*ptr)(__float128) = __coshieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___coshieee128=yes
+else
+  gcc_cv_math_func___coshieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___coshieee128" >&5
+$as_echo "$gcc_cv_math_func___coshieee128" >&6; }
+  if test $gcc_cv_math_func___coshieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___COSHIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cosieee128" >&5
+$as_echo_n "checking for __cosieee128... " >&6; }
+if ${gcc_cv_math_func___cosieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __cosieee128 (__float128);
+__float128 (*ptr)(__float128) = __cosieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___cosieee128=yes
+else
+  gcc_cv_math_func___cosieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___cosieee128" >&5
+$as_echo "$gcc_cv_math_func___cosieee128" >&6; }
+  if test $gcc_cv_math_func___cosieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___COSIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __erfieee128" >&5
+$as_echo_n "checking for __erfieee128... " >&6; }
+if ${gcc_cv_math_func___erfieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __erfieee128 (__float128);
+__float128 (*ptr)(__float128) = __erfieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___erfieee128=yes
+else
+  gcc_cv_math_func___erfieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___erfieee128" >&5
+$as_echo "$gcc_cv_math_func___erfieee128" >&6; }
+  if test $gcc_cv_math_func___erfieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___ERFIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __expieee128" >&5
+$as_echo_n "checking for __expieee128... " >&6; }
+if ${gcc_cv_math_func___expieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __expieee128 (__float128);
+__float128 (*ptr)(__float128) = __expieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___expieee128=yes
+else
+  gcc_cv_math_func___expieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___expieee128" >&5
+$as_echo "$gcc_cv_math_func___expieee128" >&6; }
+  if test $gcc_cv_math_func___expieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___EXPIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __fabsieee128" >&5
+$as_echo_n "checking for __fabsieee128... " >&6; }
+if ${gcc_cv_math_func___fabsieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __fabsieee128 (__float128);
+__float128 (*ptr)(__float128) = __fabsieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___fabsieee128=yes
+else
+  gcc_cv_math_func___fabsieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___fabsieee128" >&5
+$as_echo "$gcc_cv_math_func___fabsieee128" >&6; }
+  if test $gcc_cv_math_func___fabsieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___FABSIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __jnieee128" >&5
+$as_echo_n "checking for __jnieee128... " >&6; }
+if ${gcc_cv_math_func___jnieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __jnieee128 (__float128);
+__float128 (*ptr)(__float128) = __jnieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___jnieee128=yes
+else
+  gcc_cv_math_func___jnieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___jnieee128" >&5
+$as_echo "$gcc_cv_math_func___jnieee128" >&6; }
+  if test $gcc_cv_math_func___jnieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___JNIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __log10ieee128" >&5
+$as_echo_n "checking for __log10ieee128... " >&6; }
+if ${gcc_cv_math_func___log10ieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __log10ieee128 (__float128);
+__float128 (*ptr)(__float128) = __log10ieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___log10ieee128=yes
+else
+  gcc_cv_math_func___log10ieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___log10ieee128" >&5
+$as_echo "$gcc_cv_math_func___log10ieee128" >&6; }
+  if test $gcc_cv_math_func___log10ieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___LOG10IEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __logieee128" >&5
+$as_echo_n "checking for __logieee128... " >&6; }
+if ${gcc_cv_math_func___logieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __logieee128 (__float128);
+__float128 (*ptr)(__float128) = __logieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___logieee128=yes
+else
+  gcc_cv_math_func___logieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___logieee128" >&5
+$as_echo "$gcc_cv_math_func___logieee128" >&6; }
+  if test $gcc_cv_math_func___logieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___LOGIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __powieee128" >&5
+$as_echo_n "checking for __powieee128... " >&6; }
+if ${gcc_cv_math_func___powieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __powieee128 (__float128);
+__float128 (*ptr)(__float128) = __powieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___powieee128=yes
+else
+  gcc_cv_math_func___powieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___powieee128" >&5
+$as_echo "$gcc_cv_math_func___powieee128" >&6; }
+  if test $gcc_cv_math_func___powieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___POWIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sinhieee128" >&5
+$as_echo_n "checking for __sinhieee128... " >&6; }
+if ${gcc_cv_math_func___sinhieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __sinhieee128 (__float128);
+__float128 (*ptr)(__float128) = __sinhieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___sinhieee128=yes
+else
+  gcc_cv_math_func___sinhieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___sinhieee128" >&5
+$as_echo "$gcc_cv_math_func___sinhieee128" >&6; }
+  if test $gcc_cv_math_func___sinhieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___SINHIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sinieee128" >&5
+$as_echo_n "checking for __sinieee128... " >&6; }
+if ${gcc_cv_math_func___sinieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __sinieee128 (__float128);
+__float128 (*ptr)(__float128) = __sinieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___sinieee128=yes
+else
+  gcc_cv_math_func___sinieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___sinieee128" >&5
+$as_echo "$gcc_cv_math_func___sinieee128" >&6; }
+  if test $gcc_cv_math_func___sinieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___SINIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sqrtieee128" >&5
+$as_echo_n "checking for __sqrtieee128... " >&6; }
+if ${gcc_cv_math_func___sqrtieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __sqrtieee128 (__float128);
+__float128 (*ptr)(__float128) = __sqrtieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___sqrtieee128=yes
+else
+  gcc_cv_math_func___sqrtieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___sqrtieee128" >&5
+$as_echo "$gcc_cv_math_func___sqrtieee128" >&6; }
+  if test $gcc_cv_math_func___sqrtieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___SQRTIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __tanhieee128" >&5
+$as_echo_n "checking for __tanhieee128... " >&6; }
+if ${gcc_cv_math_func___tanhieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __tanhieee128 (__float128);
+__float128 (*ptr)(__float128) = __tanhieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___tanhieee128=yes
+else
+  gcc_cv_math_func___tanhieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___tanhieee128" >&5
+$as_echo "$gcc_cv_math_func___tanhieee128" >&6; }
+  if test $gcc_cv_math_func___tanhieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___TANHIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __tanieee128" >&5
+$as_echo_n "checking for __tanieee128... " >&6; }
+if ${gcc_cv_math_func___tanieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __tanieee128 (__float128);
+__float128 (*ptr)(__float128) = __tanieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___tanieee128=yes
+else
+  gcc_cv_math_func___tanieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___tanieee128" >&5
+$as_echo "$gcc_cv_math_func___tanieee128" >&6; }
+  if test $gcc_cv_math_func___tanieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___TANIEEE128 1
+_ACEOF
+
+  fi
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __ynieee128" >&5
+$as_echo_n "checking for __ynieee128... " >&6; }
+if ${gcc_cv_math_func___ynieee128+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test x$gcc_no_link = xyes; then
+  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+__float128 __ynieee128 (__float128);
+__float128 (*ptr)(__float128) = __ynieee128;
+
+int
+main ()
+{
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gcc_cv_math_func___ynieee128=yes
+else
+  gcc_cv_math_func___ynieee128=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_math_func___ynieee128" >&5
+$as_echo "$gcc_cv_math_func___ynieee128" >&6; }
+  if test $gcc_cv_math_func___ynieee128 = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE___YNIEEE128 1
+_ACEOF
+
+  fi
+
+fi
+
 # On AIX, clog is present in libm as __clog
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __clog in -lm" >&5
 $as_echo_n "checking for __clog in -lm... " >&6; }
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 4fa020c3261..39f38bac4ba 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -166,7 +166,6 @@  if test "x$GCC" = "xyes"; then
         [AM_FCFLAGS="$AM_FCFLAGS -mabi=ibmlongdouble";
 	 AM_CFLAGS="$AM_CFLAGS -mabi=ibmlongdouble";
 	 CFLAGS="$CFLAGS -mabi=ibmlongdouble";
-	 echo "Juhu!";
 	 have_real_17=yes])
       ;;
     *)
@@ -174,6 +173,7 @@  if test "x$GCC" = "xyes"; then
   esac
 fi
 AM_CONDITIONAL([HAVE_REAL_17], [test "x$have_real_17" != xno])
+
 # Add CET specific flags if CET is enabled
 GCC_CET_FLAGS(CET_FLAGS)
 AM_FCFLAGS="$AM_FCFLAGS $CET_FLAGS"
@@ -544,6 +544,33 @@  GCC_CHECK_MATH_FUNC([catanhf])
 GCC_CHECK_MATH_FUNC([catanhl])
 GCC_CHECK_MATH_FUNC([catanl])
 
+# For POWER, check the ieee128 math functions
+
+if test "x$have_real_17" = "xyes"; then
+LIBGFOR_CHECK_MATH_IEEE128([__acoshieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__acosieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__asinhieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__asinieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__atan2ieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__atanhieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__atanieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__coshieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__cosieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__erfieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__expieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__fabsieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__jnieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__log10ieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__logieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__powieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__sinhieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__sinieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__sqrtieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__tanhieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__tanieee128])
+LIBGFOR_CHECK_MATH_IEEE128([__ynieee128])
+fi
+
 # On AIX, clog is present in libm as __clog
 AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])