From 77194ea1bc16d0bc58148759a6560dff8c1eabec Mon Sep 17 00:00:00 2001 From: knarf Date: Tue, 1 May 2012 15:42:05 +0000 Subject: let HDF5 look for libraries also in lib64, plus honor .so and .dylib libraries git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/HDF5/trunk@52 fb53df36-e548-4a1e-8150-ab98cbd5e786 --- HDF5.sh | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/HDF5.sh b/HDF5.sh index 6eaa6c3..9eed71e 100644 --- a/HDF5.sh +++ b/HDF5.sh @@ -54,16 +54,34 @@ then echo "HDF5 selected, but HDF5_DIR not set. Checking some places..." echo "END MESSAGE" - FILES="include/hdf5.h $(for lib in ${HDF5_CXX_LIBS} ${HDF5_FORTRAN_LIBS} ${HDF5_C_LIBS}; do echo lib/lib${lib}.a; done)" DIRS="/usr /usr/local /usr/local/hdf5 /usr/local/packages/hdf5 /usr/local/apps/hdf5 /opt/local ${HOME} ${HOME}/hdf5 c:/packages/hdf5" + # look into each directory for dir in $DIRS; do - HDF5_DIR="$dir" - for file in $FILES; do - if [ ! -r "$dir/$file" ]; then - unset HDF5_DIR - break - fi + # libraries might have different file extensions + for libext in a so dylib; do + # libraries can be in /lib or /lib64 + for libdir in lib64 lib; do + FILES="include/hdf5.h $(for lib in ${HDF5_CXX_LIBS} ${HDF5_FORTRAN_LIBS} ${HDF5_C_LIBS}; do echo $libdir/lib${lib}.${libext}; done)" + # assume this is the one and check all needed files + HDF5_DIR="$dir" + for file in $FILES; do + # discard this directory if one file was not found + if [ ! -r "$dir/$file" ]; then + unset HDF5_DIR + break + fi + done + # don't look further if all files have been found + if [ -n "$HDF5_DIR" ]; then + break + fi + done + # don't look further if all files have been found + if [ -n "$HDF5_DIR" ]; then + break + fi done + # don't look further if all files have been found if [ -n "$HDF5_DIR" ]; then break fi -- cgit v1.2.3