aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@d47fded2-66c1-406f-af09-4fc0800f9c6b>2012-05-08 15:18:32 +0000
committerknarf <knarf@d47fded2-66c1-406f-af09-4fc0800f9c6b>2012-05-08 15:18:32 +0000
commit7c3fd696f1d8f2c873323e58e12915ebbdd74ed6 (patch)
tree665ccb2cebd6d652ab7eb4589acd5cac9ee00110
parent100a64312c61ac16c974b79b7efd7e6cc40ca53a (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.sh30
1 files 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