From 96c91e7ff3c06585d520e321ed4a75901d4dbf9e Mon Sep 17 00:00:00 2001 From: schnetter Date: Sat, 13 Feb 2010 22:48:27 +0000 Subject: Handle libsz and zlib git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/HDF5/trunk@7 fb53df36-e548-4a1e-8150-ab98cbd5e786 --- HDF5.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/HDF5.sh b/HDF5.sh index 793ca75..b77e2a4 100644 --- a/HDF5.sh +++ b/HDF5.sh @@ -29,7 +29,9 @@ unset MAKEFLAGS set -x # Output commands set -e # Abort on errors cd ${INSTALL_DIR} - if [ -e done-${NAME} -a done-${NAME} -nt ${SRCDIR}/dist/${NAME}.tar.gz ]; then + if [ -e done-${NAME} -a done-${NAME} -nt ${SRCDIR}/dist/${NAME}.tar.gz \ + -a done-${NAME} -nt ${SRCDIR}/HDF5.sh ] + then echo "HDF5: The enclosed HDF5 library has already been built; doing nothing" else echo "HDF5: Building enclosed HDF5 library" @@ -71,7 +73,7 @@ fi ################################################################################ -# Configure Cactus +# Check for additional libraries ################################################################################ # Set options @@ -79,6 +81,58 @@ HDF5_INC_DIRS="${HDF5_DIR}/include" HDF5_LIB_DIRS="${HDF5_DIR}/lib" HDF5_LIBS='hdf5' + + +# Check whether we are running on Windows +if perl -we 'exit (`uname` =~ /^CYGWIN/)'; then + is_windows=0 +else + is_windows=1 +fi + +# Check whether we are running on MacOS +if perl -we 'exit (`uname` =~ /^Darwin/)'; then + is_macos=0 +else + is_macos=1 +fi + + + +# Check whether we have to link with libsz.a +if grep -qe '#define H5_HAVE_LIBSZ 1' ${HDF5_DIR}/include/H5pubconf.h 2> /dev/null; then + test_szlib=0 +else + test_szlib=1 +fi +if [ $test_szlib -eq 0 ]; then + if [ $is_windows -eq 0 ]; then + HDF5_LIBS="$HDF5_LIBS sz" + else + HDF5_LIBS="$HDF5_LIBS szlib" + fi +fi + +# Check whether we have to link with libz.a +if grep -qe '#define H5_HAVE_LIBZ 1' ${HDF5_DIR}/include/H5pubconf.h 2> /dev/null; then + test_zlib=0 +else + test_zlib=1 +fi +if [ $test_zlib -eq 0 ]; then + if [ $is_windows -eq 0 ]; then + HDF5_LIBS="$HDF5_LIBS z" + else + HDF5_LIBS="$HDF5_LIBS zlib" + fi +fi + + + +################################################################################ +# Configure Cactus +################################################################################ + # Pass options to Cactus echo "BEGIN MAKE_DEFINITION" echo "HAVE_HDF5 = 1" -- cgit v1.2.3