diff options
author | knarf <knarf@d47fded2-66c1-406f-af09-4fc0800f9c6b> | 2012-05-08 15:18:32 +0000 |
---|---|---|
committer | knarf <knarf@d47fded2-66c1-406f-af09-4fc0800f9c6b> | 2012-05-08 15:18:32 +0000 |
commit | 7c3fd696f1d8f2c873323e58e12915ebbdd74ed6 (patch) | |
tree | 665ccb2cebd6d652ab7eb4589acd5cac9ee00110 | |
parent | 100a64312c61ac16c974b79b7efd7e6cc40ca53a (diff) |
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
-rw-r--r-- | zlib.sh | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -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 |