Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
keep FCFLAGS during gfortran configure
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Dec 3, 2020
1 parent 94326db commit 87dae61
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
8 changes: 4 additions & 4 deletions build/bin/sage-build-env-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ if [ "x$SAGE_DEBUG" == "x" ]; then
fi

# The configured compilation flags.
export CONFIGURED_CFLAGS="@CONFIGURED_CFLAGS@"
export CONFIGURED_CXXFLAGS="@CONFIGURED_CXXFLAGS@"
export CONFIGURED_FCFLAGS="@CONFIGURED_FCFLAGS@"
export CONFIGURED_F77FLAGS="@CONFIGURED_F77FLAGS@"
export CONFIGURED_CFLAGS="@CFLAGS@"
export CONFIGURED_CXXFLAGS="@CXXFLAGS@"
export CONFIGURED_FCFLAGS="@FCFLAGS@"
export CONFIGURED_F77FLAGS="@F77FLAGS@"

# This is usually blank if the system GMP is used, or $SAGE_LOCAL otherwise
export SAGE_GMP_PREFIX="@SAGE_GMP_PREFIX@"
Expand Down
17 changes: 17 additions & 0 deletions build/pkgs/gfortran/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ AC_DEFUN([SAGE_MUST_INSTALL_GFORTRAN], [
fi
])

dnl This macro saves current FCFLAGS for later use.
AC_DEFUN([SAGE_SAVE_FCFLAGS], [
sage_saved_fcflags=$FCFLAGS
])

dnl This macro restores saved FCFLAGS.
AC_DEFUN([SAGE_RESTORE_FCFLAGS], [
FCFLAGS=$sage_saved_fcflags
])


SAGE_SPKG_CONFIGURE([gfortran], [
AC_REQUIRE([SAGE_SPKG_CONFIGURE_GCC])
Expand All @@ -40,12 +50,19 @@ SAGE_SPKG_CONFIGURE([gfortran], [
# This helps verify the compiler works too, so if some idiot sets FC to
# /usr/bin/ls, we will at least know it's not a working Fortran
# compiler.
AC_REQUIRE([SAGE_SAVE_FCFLAGS])
AC_FC_FREEFORM([SAGE_HAVE_FC_FREEFORM=yes], [
AC_MSG_NOTICE([Your Fortran compiler does not accept free-format source code])
AC_MSG_NOTICE([which means the compiler is either seriously broken, or])
AC_MSG_NOTICE([is too old to build Sage.])
SAGE_HAVE_FC_FREEFORM=no])
# AC_FC_FREEFORM may have added flags.
# However, it is up to the individual package how they invoke the
# Fortran compiler.
# We only check here, whether the compiler is suitable.
AC_REQUIRE([SAGE_RESTORE_FCFLAGS])
AS_VAR_IF(SAGE_HAVE_FC_FREEFORM, [no], [
AS_VAR_SET(sage_spkg_install_gfortran, [yes])
])
Expand Down
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ AX_PROG_PERL_VERSION([5.8.0],[],[
###############################################################################

# Save compiler flags as configured by the user.
AC_SUBST(CONFIGURED_CFLAGS, "$CFLAGS")
AC_SUBST(CONFIGURED_CXXFLAGS, "$CXXFLAGS")
AC_SUBST(CONFIGURED_FCFLAGS, "$FCFLAGS")
AC_SUBST(CONFIGURED_F77FLAGS, "$F77FLAGS")
AC_SUBST(CFLAGS, "$CFLAGS")
AC_SUBST(CXXFLAGS, "$CXXFLAGS")
AC_SUBST(FCFLAGS, "$FCFLAGS")
AC_SUBST(F77FLAGS, "$F77FLAGS")

SAGE_CHECK_CONDA_COMPILERS

Expand Down

0 comments on commit 87dae61

Please sign in to comment.