From d6f0cb04611737055d5caf91a5b0a9a5874d9952 Mon Sep 17 00:00:00 2001 From: "David M. Rogers" Date: Fri, 30 Oct 2020 15:55:21 -0400 Subject: Patched hypre to better add flags based on compiler. (#19498) * Patched hypre to better add flags based on compiler. * Update package.py This file seems to have lots of edits, so the patch may succeed with offsets. Has anyone checked with spack patch to be sure it'll work with versions 2.15 - 2.20? --- .../builtin/packages/hypre/detect-compiler.patch | 116 +++++++++++++++++++++ var/spack/repos/builtin/packages/hypre/package.py | 2 + 2 files changed, 118 insertions(+) create mode 100644 var/spack/repos/builtin/packages/hypre/detect-compiler.patch diff --git a/var/spack/repos/builtin/packages/hypre/detect-compiler.patch b/var/spack/repos/builtin/packages/hypre/detect-compiler.patch new file mode 100644 index 0000000000..a4f3b3cb89 --- /dev/null +++ b/var/spack/repos/builtin/packages/hypre/detect-compiler.patch @@ -0,0 +1,116 @@ +diff --git a/src/config/hypre_macros_misc.m4 b/src/config/hypre_macros_misc.m4 +index 2b9b19c92..14319b509 100644 +--- a/src/config/hypre_macros_misc.m4 ++++ b/src/config/hypre_macros_misc.m4 +@@ -98,7 +98,7 @@ AC_DEFUN([AC_HYPRE_OPTIMIZATION_FLAGS], + + if test "x${hypre_user_chose_cflags}" = "xno" + then +- case "${CC}" in ++ case `basename "${CC}"` in + gcc|mpigcc|mpicc) + CFLAGS="-O2" + if test "$hypre_using_openmp" = "yes" ; then +@@ -138,7 +138,7 @@ fi + + if test "x${hypre_user_chose_cxxflags}" = "xno" + then +- case "${CXX}" in ++ case `basename "${CXX}"` in + g++|gCC|mpig++|mpicxx|mpic++|mpiCC) + CXXFLAGS="-O2" + if test "$hypre_using_openmp" = "yes" ; then +@@ -174,7 +174,7 @@ fi + + if test "x${hypre_user_chose_fflags}" = "xno" + then +- case "${FC}" in ++ case `basename "${FC}"` in + g77|gfortran|mpigfortran|mpif77) + FFLAGS="-O2" + if test "$hypre_using_openmp" = "yes" ; then +@@ -218,7 +218,7 @@ AC_DEFUN([AC_HYPRE_DEBUG_FLAGS], + + if test "x${hypre_user_chose_cflags}" = "xno" + then +- case "${CC}" in ++ case `basename "${CC}"` in + gcc|mpigcc|mpicc) + CFLAGS="-g -Wall" + if test "$hypre_using_openmp" = "yes" ; then +@@ -258,7 +258,7 @@ fi + + if test "x${hypre_user_chose_cxxflags}" = "xno" + then +- case "${CXX}" in ++ case `basename "${CXX}"` in + g++|gCC|mpig++|mpicxx|mpic++|mpiCC) + CXXFLAGS="-g -Wall" + if test "$hypre_using_openmp" = "yes" ; then +@@ -294,7 +294,7 @@ fi + + if test "x${hypre_user_chose_fflags}" = "xno" + then +- case "${FC}" in ++ case `basename "${FC}"` in + g77|gfortran|mpigfortran|mpif77) + FFLAGS="-g -Wall" + if test "$hypre_using_openmp" = "yes" ; then +diff --git a/src/configure b/src/configure +index dd7555b10..696b41132 100755 +--- a/src/configure ++++ b/src/configure +@@ -7765,7 +7765,7 @@ then + + if test "x${hypre_user_chose_cflags}" = "xno" + then +- case "${CC}" in ++ case `basename "${CC}"` in + gcc|mpigcc|mpicc) + CFLAGS="-g -Wall" + if test "$hypre_using_openmp" = "yes" ; then +@@ -7805,7 +7805,7 @@ fi + + if test "x${hypre_user_chose_cxxflags}" = "xno" + then +- case "${CXX}" in ++ case `basename "${CXX}"` in + g++|gCC|mpig++|mpicxx|mpic++|mpiCC) + CXXFLAGS="-g -Wall" + if test "$hypre_using_openmp" = "yes" ; then +@@ -7841,7 +7841,7 @@ fi + + if test "x${hypre_user_chose_fflags}" = "xno" + then +- case "${FC}" in ++ case `basename "${FC}"` in + g77|gfortran|mpigfortran|mpif77) + FFLAGS="-g -Wall" + if test "$hypre_using_openmp" = "yes" ; then +@@ -7881,7 +7881,7 @@ else + + if test "x${hypre_user_chose_cflags}" = "xno" + then +- case "${CC}" in ++ case `basename "${CC}"` in + gcc|mpigcc|mpicc) + CFLAGS="-O2" + if test "$hypre_using_openmp" = "yes" ; then +@@ -7921,7 +7921,7 @@ fi + + if test "x${hypre_user_chose_cxxflags}" = "xno" + then +- case "${CXX}" in ++ case `basename "${CXX}"` in + g++|gCC|mpig++|mpicxx|mpic++|mpiCC) + CXXFLAGS="-O2" + if test "$hypre_using_openmp" = "yes" ; then +@@ -7957,7 +7957,7 @@ fi + + if test "x${hypre_user_chose_fflags}" = "xno" + then +- case "${FC}" in ++ case `basename "${FC}"` in + g77|gfortran|mpigfortran|mpif77) + FFLAGS="-O2" + if test "$hypre_using_openmp" = "yes" ; then diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index 8c0347fef9..da2b8a03ee 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -68,6 +68,8 @@ class Hypre(Package): patch('superlu-dist-link-2.15.0.patch', when='+superlu-dist @2.15:2.16.0') patch('superlu-dist-link-2.14.0.patch', when='+superlu-dist @:2.14.0') patch('hypre21800-compat.patch', when='@2.18.0') + # Patch to get config flags right + patch('detect-compiler.patch', when='@2.15.0:2.20.0') depends_on("mpi", when='+mpi') depends_on("blas") -- cgit v1.2.3-70-g09d2