Merge pull request #278 from eschnett/eschnett/hdf5-variants

Enable several variants for HDF5
This commit is contained in:
Todd Gamblin 2016-01-06 23:50:40 -08:00
commit dd04b6a873

View File

@ -10,12 +10,15 @@ class Hdf5(Package):
url = "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8.13/src/hdf5-1.8.13.tar.gz"
list_url = "http://www.hdfgroup.org/ftp/HDF5/releases"
list_depth = 3
version('1.8.16', 'b8ed9a36ae142317f88b0c7ef4b9c618')
version('1.8.15', '03cccb5b33dbe975fdcd8ae9dc021f24')
version('1.8.13', 'c03426e9e77d7766944654280b467289')
variant('cxx', default=True, description='Enable C++ support')
variant('fortran', default=True, description='Enable Fortran support')
variant('mpi', default=False, description='Enable MPI support')
variant('threadsafe', default=False, description='Enable multithreading')
depends_on("mpi", when='+mpi')
depends_on("zlib")
@ -23,11 +26,36 @@ class Hdf5(Package):
# TODO: currently hard-coded to use OpenMPI
def install(self, spec, prefix):
extra_args = []
if '+cxx' in spec:
extra_args.extend([
'--enable-cxx'
])
if '+fortran' in spec:
extra_args.extend([
'--enable-fortran',
'--enable-fortran2003'
])
if '+mpi' in spec:
# The HDF5 configure script warns if cxx and mpi are enabled
# together. There doesn't seem to be a real reason for this, except
# that parts of the MPI interface are not accessible via the C++
# interface. Since they are still accessible via the C interface,
# this is not actually a problem.
extra_args.extend([
"--enable-parallel",
"--enable-unsupported",
"CC=%s" % spec['mpi'].prefix.bin + "/mpicc",
"CXX=%s" % spec['mpi'].prefix.bin + "/mpic++",
"FC=%s" % spec['mpi'].prefix.bin + "/mpifort",
])
if '+threads' in spec:
if '+cxx' in spec or '+fortran' in spec:
die("Cannot use variant +threads with either +cxx or +fortran")
extra_args.extend([
'--enable-threadsafe',
'--disable-hl',
'CPPFLAGS=-DHDatexit=""',
'CFLAGS=-DHDatexit=""'
])
configure(