Subversion r152931 (Git commit
0046b1a727f73f0848733e28219069426b2dc218)
"Fix libgomp without --enable-languages=fortran", and its follow-up
Subversion r156232 (Git commit
d0709b6aeec6b00e71011502fa311751fc138147)
"configure.ac: Test for executability of GFORTRAN",
Subversion r156264 (Git commit
2122aa973ed2c829caee5b010a60ad01922a3650)
"configure.ac: Test for executability of _the first word_ of GFORTRAN"
fixed the libgomp target library build in case that
'--enable-languages=fortran' was not in effect: in that case, disable
libgomp/Fortran support.
These changes certainly do the right thing in GCC configurations where
'$GFORTRAN' would be expected to be "just compiled" (built with the GCC
top-level build system). However, in case that it's "pre-installed"
(provided
externally, as determined by the GCC top-level build system), these
changes
didn't work, and instead kept libgomp/Fortran support disabled, instead
of
enabling it. "Pre-installed" 'GFORTRAN="x86_64-w64-mingw32-gfortran
[...]"' is
not accepted by the current 'test -x [...]' check, for instance, as
discussed
in "libgomp: Fix gfortran detection when program is found via PATH",
<https://inbox.sourceware.org/[email protected]>
<https://forge.sourceware.org/gcc/gcc/pulls/172>,
<https://inbox.sourceware.org/bmm.hj9f44xa6a.gcc.gcc-test.peter0x44.172....@forge-stage.sourceware.org>.
That proposed "libgomp: Fix gfortran detection when program is found
via PATH"
patch has the issue that it picks up the "gfortran [...] found via
PATH" also
in the case when GCC is configured without '--enable-languages=fortran'
in
effect, and it then still builds and installs the libgomp/Fortran
support files
in GCC configurations without Fortran support enabled.
Instead of "libgomp: Fix gfortran detection when program is found via
PATH" as
proposed, we may revise libgomp/Fortran support conditionals generally,
and
handle that in a conceptually simpler way: revert the three
aforementioned
commits (in other words: simply again assign 'FC="$GFORTRAN"' (like
'libgfortran/configure.ac' also is doing), and conditionalize
'USE_FORTRAN' on
whether '--enable-languages=fortran' is in effect. In other words: in
case
that '--enable-languages=fortran' is in effect, assume that the
'GFORTRAN=[...]' passed to the libgomp build is functional -- no matter
where
it's coming from: "just compiled" or "pre-installed".
PR libgomp/41418
libgomp/
* configure.ac (FC): Revert ealier changes; just set to '"$GFORTRAN"'.
(USE_FORTRAN): Conditionalize on '--enable-languages=fortran' being in
effect.
* configure: Regenerate.
Reported-by: Peter Damianov <[email protected]>
---
libgomp/configure | 50 +++++++++++++++++++++-----------------------
libgomp/configure.ac | 24 ++++++++++-----------
2 files changed, 35 insertions(+), 39 deletions(-)
diff --git a/libgomp/configure b/libgomp/configure
index 2f395a883f2..6ff3899df15 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -649,8 +649,6 @@ OMP_NEST_LOCK_SIZE
OMP_LOCK_ALIGN
OMP_LOCK_SIZE
INTPTR_T_KIND
-USE_FORTRAN_FALSE
-USE_FORTRAN_TRUE
link_gomp
tmake_file
XLDFLAGS
@@ -677,6 +675,8 @@ offload_targets
offload_plugins
DL_LIBS
libtool_VERSION
+USE_FORTRAN_FALSE
+USE_FORTRAN_TRUE
ac_ct_FC
FCFLAGS
FC
@@ -12265,17 +12265,7 @@ 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)
-case `echo $GFORTRAN` in
- -* | no* )
- FC=no ;;
- *)
- set dummy $GFORTRAN; ac_word=$2
- if test -x "$ac_word"; then
- FC="$GFORTRAN"
- else
- FC=no
- fi ;;
-esac
+FC="$GFORTRAN"
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'
@@ -15241,6 +15231,23 @@ 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
+ USE_FORTRAN_TRUE=
+ USE_FORTRAN_FALSE='#'
+else
+ USE_FORTRAN_TRUE='#'
+ USE_FORTRAN_FALSE=
+fi
+
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
@@ -17351,15 +17358,6 @@ else
fi
- if test "$ac_cv_fc_compiler_gnu" = yes; then
- USE_FORTRAN_TRUE=
- USE_FORTRAN_FALSE='#'
-else
- USE_FORTRAN_TRUE='#'
- USE_FORTRAN_FALSE=
-fi
-
-
# ??? 2006-01-24: Paulo committed to asking autoconf folk to document
# and export AC_COMPUTE_INT. If that happens, then we'll need to
remove
# the underscore here and update the PREREQ. If it doesn't, then
we'll
@@ -17646,6 +17644,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test
-z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally."
"$LINENO" 5
fi
+if test -z "${USE_FORTRAN_TRUE}" && test -z "${USE_FORTRAN_FALSE}";
then
+ as_fn_error $? "conditional \"USE_FORTRAN\" was never defined.
+Usually this means the macro was only invoked conditionally."
"$LINENO" 5
+fi
if test -z "${PLUGIN_NVPTX_TRUE}" && test -z "${PLUGIN_NVPTX_FALSE}";
then
as_fn_error $? "conditional \"PLUGIN_NVPTX\" was never defined.
Usually this means the macro was only invoked conditionally."
"$LINENO" 5
@@ -17666,10 +17668,6 @@ if test -z
"${LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE}" && test -z "${LIBGOMP_BUI
as_fn_error $? "conditional \"LIBGOMP_BUILD_VERSIONED_SHLIB_SUN\"
was never defined.
Usually this means the macro was only invoked conditionally."
"$LINENO" 5
fi
-if test -z "${USE_FORTRAN_TRUE}" && test -z "${USE_FORTRAN_FALSE}";
then
- as_fn_error $? "conditional \"USE_FORTRAN\" was never defined.
-Usually this means the macro was only invoked conditionally."
"$LINENO" 5
-fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 057debe9214..9ebac1fc336 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -159,20 +159,20 @@ 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)
-case `echo $GFORTRAN` in
- -* | no* )
- FC=no ;;
- *)
- set dummy $GFORTRAN; ac_word=$2
- if test -x "$ac_word"; then
- FC="$GFORTRAN"
- else
- FC=no
- fi ;;
-esac
+FC="$GFORTRAN"
AC_PROG_FC(gfortran)
FCFLAGS="$FCFLAGS -Wall -L../libgfortran"
+case ,${enable_languages}, in
+ *,fortran,* )
+ use_fortran=true
+ ;;
+ * )
+ use_fortran=false
+ ;;
+esac
+AM_CONDITIONAL([USE_FORTRAN], ["$use_fortran"])
+
# For libtool versioning info, format is CURRENT:REVISION:AGE
libtool_VERSION=1:0:0
AC_SUBST(libtool_VERSION)
@@ -427,8 +427,6 @@ else
fi
AC_SUBST(link_gomp)
-AM_CONDITIONAL([USE_FORTRAN], [test "$ac_cv_fc_compiler_gnu" = yes])
-
# ??? 2006-01-24: Paulo committed to asking autoconf folk to document
# and export AC_COMPUTE_INT. If that happens, then we'll need to
remove
# the underscore here and update the PREREQ. If it doesn't, then
we'll