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

Commit

Permalink
Changed a bit how SAGE_SPKG_CONFIGURE works:
Browse files Browse the repository at this point in the history
Now, instead of being a macro that directly subsitutes the individual spkg checks,
it's actually a higher-order macro that defines macros named SAGE_SPKG_CONFIGURE_<PKGNAME>.

All of these macros are included in m4/sage_spkg_configures.ac so that they all get expanded,
but the advantage of this is that individual packages' SAGE_SPKG_CONFIGURE can use
AC_REQUIRE to ensure that other packages are configured as a prerequisite.

This in gfortran to ensure that gcc is always configured first.  Then we can disable
gfortran if gcc is going to be installed.
  • Loading branch information
embray committed Nov 7, 2018
1 parent 8d01c6e commit cf6367a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 20 deletions.
5 changes: 5 additions & 0 deletions bootstrap
Expand Up @@ -30,9 +30,14 @@ CONFVERSION=`cat $PKG/package-version.txt`

bootstrap () {
rm -f m4/sage_spkg_configures.m4
spkg_configures=""
for filename in $(find build/pkgs/ -type f -name spkg-configure.m4); do
pkgname="$(echo $filename | cut -d/ -f3)"
echo "m4_sinclude([$filename])" >> m4/sage_spkg_configures.m4
spkg_configures="$spkg_configures
SAGE_SPKG_CONFIGURE_$(echo ${pkgname} | tr '[a-z]' '[A-Z]')"
done
echo "$spkg_configures" >> m4/sage_spkg_configures.m4

aclocal -I m4 && \
automake --add-missing --copy build/make/Makefile-auto && \
Expand Down
47 changes: 27 additions & 20 deletions build/pkgs/gfortran/spkg-configure.m4
@@ -1,26 +1,33 @@
SAGE_SPKG_CONFIGURE([gfortran], [
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([SAGE_SPKG_CONFIGURE_GCC])
# Check that the Fortran compiler accepts free-format source code
# (as opposed to the older fixed-format style from Fortran 77).
# 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.
if test -z "$FC"; then
sage_spkg_install_gfortran=yes
SAGE_MUST_INSTALL_GCC([a Fortran compiler is missing])
fi
# Special case: If we are already installing gcc then don't install
# gfortran since it's included
if test "x$sage_spkg_install_gcc" = "xyes"; then
sage_spkg_install_gfortran=no
else
# Check that the Fortran compiler accepts free-format source code (as
# opposed to the older fixed-format style from Fortran 77).
# 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.
if test -z "$FC"; then
sage_spkg_install_gfortran=yes
SAGE_MUST_INSTALL_GCC([a Fortran compiler is missing])
fi
# see http://www.gnu.org/software/hello/manual/autoconf/Fortran-Compiler.html
AC_FC_FREEFORM([], [
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_spkg_install_gfortran=yes
])
# see http://www.gnu.org/software/hello/manual/autoconf/Fortran-Compiler.html
AC_FC_FREEFORM([], [
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_spkg_install_gfortran=yes
])
# Check compiler versions
if test x$GFC != xyes; then
sage_spkg_install_gfortran=yes
# Check compiler versions
if test x$GFC != xyes; then
sage_spkg_install_gfortran=yes
fi
fi
])
4 changes: 4 additions & 0 deletions m4/sage_spkg_configure.m4
Expand Up @@ -27,9 +27,11 @@
# sage_spkg_install_<packagename>="no".
#
AC_DEFUN([SAGE_SPKG_CONFIGURE], [
AC_DEFUN_ONCE([SAGE_SPKG_CONFIGURE_]m4_toupper($1), [
m4_pushdef([SPKG_NAME], [$1])
m4_pushdef([SPKG_INSTALL_VAR], [sage_spkg_install_]SPKG_NAME)
m4_pushdef([SPKG_REQUIRE_VAR], [sage_require_]SPKG_NAME)
# BEGIN SAGE_SPKG_CONFIGURE_]m4_toupper($1)[
m4_ifval(
[$2],
[AS_VAR_SET_IF(SPKG_INSTALL_VAR, [], SPKG_INSTALL_VAR[=no])],
Expand All @@ -40,7 +42,9 @@ $3
],
[AS_VAR_SET_IF(SPKG_REQUIRE_VAR, [], SPKG_REQUIRE_VAR[=yes])])
AS_VAR_IF(SPKG_REQUIRE_VAR, [yes], [$2], SPKG_INSTALL_VAR[=no])
# END SAGE_SPKG_CONFIGURE_]m4_toupper($1)[
m4_popdef([SPKG_REQUIRE_VAR])
m4_popdef([SPKG_INSTALL_VAR])
m4_popdef([SPKG_NAME])
])
])

0 comments on commit cf6367a

Please sign in to comment.