https://gcc.gnu.org/g:e405c7583045f798f26b80432bdf418514efcbaa

commit e405c7583045f798f26b80432bdf418514efcbaa
Author: Michael Meissner <meiss...@linux.ibm.com>
Date:   Wed Jul 3 23:42:52 2024 -0400

    Do not build IEEE 128-bit libgfortran support if VSX is not available.
    
    2024-07-03  Michael Meissner  <meiss...@linux.ibm.com>
    
    libgfortran/
    
            * configure.ac (powerpc64le*-linux*): Check to see that the compiler
            uses VSX before enabling IEEE 128-bit support.
            * configure: Regenerate.
            * kinds-override.h (GFC_REAL_17): Add check for __VSX__.
            * libgfortran.h (POWER_IEEE128): Likewise.

Diff:
---
 libgfortran/configure        | 7 +++++--
 libgfortran/configure.ac     | 3 +++
 libgfortran/kinds-override.h | 2 +-
 libgfortran/libgfortran.h    | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libgfortran/configure b/libgfortran/configure
index 11a1bc5f070..2708e5c7eca 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -5981,6 +5981,9 @@ if test "x$GCC" = "xyes"; then
 #if __SIZEOF_LONG_DOUBLE__ != 16
                           #error long double is double
                           #endif
+                          #if !defined(__VSX__)
+                          #error VSX is not available
+                          #endif
 int
 main ()
 {
@@ -12847,7 +12850,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12850 "configure"
+#line 12853 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12953,7 +12956,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12956 "configure"
+#line 12959 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index cca1ea0ea97..cfaeb9717ab 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -148,6 +148,9 @@ if test "x$GCC" = "xyes"; then
       AC_PREPROC_IFELSE(
         [AC_LANG_PROGRAM([[#if __SIZEOF_LONG_DOUBLE__ != 16
                           #error long double is double
+                          #endif
+                          #if !defined(__VSX__)
+                          #error VSX is not available
                           #endif]],
                          [[(void) 0;]])],
         [AM_FCFLAGS="$AM_FCFLAGS -mabi=ibmlongdouble -mno-gnu-attribute";
diff --git a/libgfortran/kinds-override.h b/libgfortran/kinds-override.h
index f6b4956c5ca..51f440e5323 100644
--- a/libgfortran/kinds-override.h
+++ b/libgfortran/kinds-override.h
@@ -30,7 +30,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 #endif
 
 /* Keep these conditions on one line so grep can filter it out.  */
-#if defined(__powerpc64__)  && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__  && 
__SIZEOF_LONG_DOUBLE__ == 16
+#if defined(__powerpc64__)  && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__  && 
__SIZEOF_LONG_DOUBLE__ == 16 && defined(__VSX__)
 typedef _Float128 GFC_REAL_17;
 typedef _Complex _Float128 GFC_COMPLEX_17;
 #define HAVE_GFC_REAL_17
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 5c59ec26e16..23660335243 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -104,7 +104,7 @@ typedef off_t gfc_offset;
 #endif
 
 #if defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ \
-    && defined __GLIBC_PREREQ
+    && defined __GLIBC_PREREQ && defined(__VSX__)
 #if __GLIBC_PREREQ (2, 32)
 #define POWER_IEEE128 1
 #endif

Reply via email to