https://gcc.gnu.org/g:8af16e478ed0af172ffa1a088f2d4d3bb558daff

commit r17-5254-g8af16e478ed0af172ffa1a088f2d4d3bb558daff
Author: Thomas Schwinge <[email protected]>
Date:   Tue Oct 13 16:36:00 2026 +0200

    libgomp: Revise libgomp/Fortran support conditionals: 'FC=no' case
    
    As of commit e5efa9eff99da897f0bbd69455d8f7856985b2db
    "libgomp: Revise libgomp/Fortran support conditionals", we've got 'FC' set 
to
    '$GFORTRAN' also in case that '--enable-languages=fortran' isn't in effect.
    Explicitly set 'FC=no' in this case, so that we don't confuse libtool.
    
            PR libgomp/41418
            libgomp/
            * configure.ac (FC): Set to 'no' if '--enable-languages=fortran'
            isn't in effect.
            * configure: Regenerate.
    
    Reported-by: LIU Hao <[email protected]>

Diff:
---
 libgomp/configure    | 22 ++++++++++++----------
 libgomp/configure.ac | 20 +++++++++++---------
 2 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/libgomp/configure b/libgomp/configure
index 6ff3899df153..e9ca90a1b71b 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -12265,7 +12265,17 @@ FCFLAGS="$FCFLAGS -L."
 # We need gfortran to compile parts of the library
 # We can't use AC_PROG_FC because it expects a fully working gfortran.
 #AC_PROG_FC(gfortran)
-FC="$GFORTRAN"
+# If '--enable-languages=fortran' isn't in effect, the 'GFORTRAN' passed by
+# the top-level build system isn't functional (executable doesn't exist).
+# Catch this case here, and set 'FC=no', so that we don't confuse libtool.
+case ,${enable_languages}, in
+  *,fortran,* )
+    FC=$GFORTRAN
+    ;;
+  * )
+    FC=no
+    ;;
+esac
 ac_ext=${ac_fc_srcext-f}
 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext 
conftest.$ac_ext $LIBS >&5'
@@ -15231,15 +15241,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 FCFLAGS="$FCFLAGS -Wall -L../libgfortran"
 
-case ,${enable_languages}, in
-  *,fortran,* )
-   use_fortran=true
-   ;;
-  * )
-   use_fortran=false
-   ;;
-esac
- if "$use_fortran"; then
+ if test "$ac_cv_fc_compiler_gnu" = yes; then
   USE_FORTRAN_TRUE=
   USE_FORTRAN_FALSE='#'
 else
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 9ebac1fc3365..744f9a357ec4 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -159,19 +159,21 @@ FCFLAGS="$FCFLAGS -L."
 # We need gfortran to compile parts of the library
 # We can't use AC_PROG_FC because it expects a fully working gfortran.
 #AC_PROG_FC(gfortran)
-FC="$GFORTRAN"
-AC_PROG_FC(gfortran)
-FCFLAGS="$FCFLAGS -Wall -L../libgfortran"
-
+# If '--enable-languages=fortran' isn't in effect, the 'GFORTRAN' passed by
+# the top-level build system isn't functional (executable doesn't exist).
+# Catch this case here, and set 'FC=no', so that we don't confuse libtool.
 case ,${enable_languages}, in
   *,fortran,* )
-   use_fortran=true
-   ;;
+    FC=$GFORTRAN
+    ;;
   * )
-   use_fortran=false
-   ;;
+    FC=no
+    ;;
 esac
-AM_CONDITIONAL([USE_FORTRAN], ["$use_fortran"])
+AC_PROG_FC(gfortran)
+FCFLAGS="$FCFLAGS -Wall -L../libgfortran"
+
+AM_CONDITIONAL([USE_FORTRAN], [test "$ac_cv_fc_compiler_gnu" = yes])
 
 # For libtool versioning info, format is CURRENT:REVISION:AGE
 libtool_VERSION=1:0:0

Reply via email to