summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/netcdf-fortran/package.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/netcdf-fortran/package.py b/var/spack/repos/builtin/packages/netcdf-fortran/package.py
index c30bf0b684..dbd4fd8e08 100644
--- a/var/spack/repos/builtin/packages/netcdf-fortran/package.py
+++ b/var/spack/repos/builtin/packages/netcdf-fortran/package.py
@@ -40,6 +40,12 @@ class NetcdfFortran(AutotoolsPackage):
depends_on("netcdf-c@4.7.4:", when="@4.5.3:") # nc_def_var_szip required
depends_on("doxygen", when="+doc", type="build")
+ # We need to use MPI wrappers when building against static MPI-enabled NetCDF and/or HDF5:
+ with when("^netcdf-c~shared"):
+ depends_on("mpi", when="^netcdf-c+mpi")
+ depends_on("mpi", when="^netcdf-c+parallel-netcdf")
+ depends_on("mpi", when="^hdf5+mpi~shared")
+
# Enable 'make check' for NAG, which is too strict.
patch("nag_testing.patch", when="@4.4.5%nag")
@@ -129,6 +135,12 @@ class NetcdfFortran(AutotoolsPackage):
# configuration failure, we set the following cache variable:
config_args.append("ac_cv_func_MPI_File_open=yes")
+ if "~shared" in netcdf_c_spec:
+ nc_config = which("nc-config")
+ config_args.append("LIBS={0}".format(nc_config("--libs", output=str).strip()))
+ if any(s in netcdf_c_spec for s in ["+mpi", "+parallel-netcdf", "^hdf5+mpi~shared"]):
+ config_args.append("CC=%s" % self.spec["mpi"].mpicc)
+
return config_args
def check(self):