From 7c3fd696f1d8f2c873323e58e12915ebbdd74ed6 Mon Sep 17 00:00:00 2001 From: knarf Date: Tue, 8 May 2012 15:18:32 +0000 Subject: make sure to find a system zlib - similar to hdf5 detection git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/zlib/trunk@11 d47fded2-66c1-406f-af09-4fc0800f9c6b --- zlib.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/zlib.sh b/zlib.sh index ad2ab19..629edd5 100644 --- a/zlib.sh +++ b/zlib.sh @@ -21,16 +21,34 @@ if [ -z "${ZLIB_DIR}" ]; then echo "zlib selected, but ZLIB_DIR not set. Checking some places..." echo "END MESSAGE" - FILES="include/zlib.h lib/libz.a" - DIRS="/usr /usr/local /usr/local/zlib /usr/local/packages/zlib /usr/local/apps/zlib /opt/local ${HOME} ${HOME}/zlib c:/packages/zlib" + DIRS="/usr /usr/local /usr/local/packages /usr/local/apps /opt/local ${HOME} c:/packages" + # look into each directory for dir in $DIRS; do - ZLIB_DIR="$dir" - for file in $FILES; do - if [ ! -r "$dir/$file" ]; then - unset ZLIB_DIR + # 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/zlib.h $libdir/libz.$libext" + # assume this is the one and check all needed files + ZLIB_DIR="$dir" + for file in $FILES; do + # discard this directory if one file was not found + if [ ! -r "$dir/$file" ]; then + unset ZLIB_DIR + break + fi + done + # don't look further if all files have been found + if [ -n "$ZLIB_DIR" ]; then + break + fi + done + # don't look further if all files have been found + if [ -n "$ZLIB_DIR" ]; then break fi done + # don't look further if all files have been found if [ -n "$ZLIB_DIR" ]; then break fi -- cgit v1.2.3