From d080252b4c13c59fbcf7bcfd14722f84eeb2c80d Mon Sep 17 00:00:00 2001 From: hinder Date: Fri, 24 Jun 2011 08:29:30 +0000 Subject: Let user enable/disable C++ and Fortran support Expose two new configuration variables (which default to yes): HDF5_ENABLE_CXX and HDF5_ENABLE_FORTRAN setting them to no allows users to avoid building/linking against the respective interfaces to hdf5. This is useful when eg. one does not need them and would like to link against a cluster supplied version of hdf5 (or if one cannot use the Fortran modules due to differing compiler versions). This is related to the discussion in http://lists.einsteintoolkit.org/pipermail/users/2011-March/000928.html although it does not provide any early warning. Patch by Roland Haas git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/HDF5/trunk@38 fb53df36-e548-4a1e-8150-ab98cbd5e786 --- HDF5.sh | 31 ++++++++++++++++++++++++------- configuration.ccl | 2 +- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/HDF5.sh b/HDF5.sh index 721cadf..b1f2462 100644 --- a/HDF5.sh +++ b/HDF5.sh @@ -23,6 +23,21 @@ fi +################################################################################ +# Decide which libraries to link with +################################################################################ + +# Set up names of the Fortran and C++ libraries based on user settable variables +# Assign default values to variables +if [ "${HDF5_ENABLE_CXX:=yes}" = 'yes' ]; then + HDF5_CXX_LIBS="hdf5_cpp hdf5_hl_cpp" +fi +if [ "${HDF5_ENABLE_FORTRAN:=yes}" = 'yes' ]; then + HDF5_FORTRAN_LIBS=$(if [ "${F90}" != "none" ]; then echo 'hdf5_fortran'; fi) +fi + + + ################################################################################ # Search ################################################################################ @@ -129,7 +144,7 @@ if [ -z "${HDF5_DIR}" -o "${HDF5_DIR}" = 'BUILD' ]; then echo "HDF5: Configuring..." cd ${NAME} - ./configure --prefix=${HDF5_DIR} --with-zlib=${ZLIB_DIR} --enable-cxx $(if [ -n "${FC}" ]; then echo '' '--enable-fortran'; fi) + ./configure --prefix=${HDF5_DIR} --with-zlib=${ZLIB_DIR} --enable-cxx=${HDF5_ENABLE_CXX} $(if [ -n "${FC}" ]; then echo '' "--enable-fortran=${HDF5_ENABLE_FORTRAN}"; fi) echo "HDF5: Building..." ${MAKE} @@ -170,7 +185,7 @@ else HDF5_INC_DIRS="${HDF5_DIR}/include ${HDF5_DIR}/lib" HDF5_LIB_DIRS="${HDF5_DIR}/lib" fi -HDF5_LIBS='hdf5_hl_cpp hdf5_hl hdf5_cpp hdf5_fortran hdf5' +HDF5_LIBS="hdf5_hl ${HDF5_CXX_LIBS} ${HDF5_FORTRAN_LIBS} hdf5" @@ -233,11 +248,13 @@ fi # Pass options to Cactus echo "BEGIN MAKE_DEFINITION" -echo "HAVE_HDF5 = 1" -echo "HDF5_DIR = ${HDF5_DIR}" -echo "HDF5_INC_DIRS = ${HDF5_INC_DIRS}" -echo "HDF5_LIB_DIRS = ${HDF5_LIB_DIRS}" -echo "HDF5_LIBS = ${HDF5_LIBS}" +echo "HAVE_HDF5 = 1" +echo "HDF5_DIR = ${HDF5_DIR}" +echo "HDF5_ENABLE_CXX = ${HDF5_ENABLE_CXX}" +echo "HDF5_ENABLE_FORTRAN = ${HDF5_ENABLE_FORTRAN}" +echo "HDF5_INC_DIRS = ${HDF5_INC_DIRS}" +echo "HDF5_LIB_DIRS = ${HDF5_LIB_DIRS}" +echo "HDF5_LIBS = ${HDF5_LIBS}" echo "END MAKE_DEFINITION" echo 'INCLUDE_DIRECTORY $(HDF5_INC_DIRS)' diff --git a/configuration.ccl b/configuration.ccl index 9c1eb0e..9660de8 100644 --- a/configuration.ccl +++ b/configuration.ccl @@ -4,7 +4,7 @@ PROVIDES HDF5 { SCRIPT HDF5.sh LANG bash - OPTIONS HDF5 HDF5_DIR ZLIB_DIR LIBSZ_DIR LIBZ_DIR + OPTIONS HDF5 HDF5_DIR HDF5_ENABLE_CXX HDF5_ENABLE_FORTRAN ZLIB_DIR LIBSZ_DIR LIBZ_DIR } REQUIRES HDF5 -- cgit v1.2.3