#!/usr/bin/env modbuild

SOURCE_URL="https://support.hdfgroup.org/ftp/HDF5/current${V_MAJOR}${V_MINOR}/src/hdf5-$V.tar.bz2"

pbuild::configure() {
	declare -a config_args=()
	export CC=$MPICC
	export CXX=$MPICXX

	case "${COMPILER}" in
		clang-macos )
			# we do not have Fortran in Xcode
			;;
		* )
			F77=$MPIF77
			F90=$MPIF90
			FC=$MPIFC
			FORTRAN=$MPIFORTRAN
			config_args+=( "--enable-fortran" )
			;;
	esac

	config_args+=( "--enable-shared" )
	config_args+=( "--enable-parallel" )
	config_args+=( "--enable-cxx" )
	config_args+=( "--enable-unsupported" )
	#config_args+=( "--enable-threadsafe" )
	config_args+=( "--with-pic" )

	"${MODULE_SRCDIR}"/configure \
		--prefix="${PREFIX}" \
		"${config_args[@]}" \
		|| exit 1
}


pbuild::add_to_group 'MPI'
pbuild::set_docfiles \
		ACKNOWLEDGMENTS \
		COPYING \
		MANIFEST \
		README.txt
pbuild::make_all

