aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@ba58616d-3abc-4c77-8745-3ba8ad4a582f>2013-04-22 14:41:49 +0000
committerknarf <knarf@ba58616d-3abc-4c77-8745-3ba8ad4a582f>2013-04-22 14:41:49 +0000
commitb8f18232a69eaa8ed0ce584e70ca27ded3861b8d (patch)
treeea3f2f1ef58768b0f2f3bf4417a77462e51e4671
parent7ccc5b61508033d44083ab3a76039e95f6703385 (diff)
make configure look harder for installed libjpeg
git-svn-id: http://svn.cactuscode.org/projects/ExternalLibraries/libjpeg/trunk@28 ba58616d-3abc-4c77-8745-3ba8ad4a582f
-rwxr-xr-xconfigure.sh39
1 files changed, 32 insertions, 7 deletions
diff --git a/configure.sh b/configure.sh
index d014575..072e0fd 100755
--- a/configure.sh
+++ b/configure.sh
@@ -10,21 +10,46 @@ if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then
fi
set -e # Abort on errors
-if [ -z "${LIBJPEG_DIR}" ]; then
+
+################################################################################
+# Search
+################################################################################
+
+if [ -z "${LIBJPEG_DIR}" \
+ -o "$(echo "${LIBJPEG_DIR}" | tr '[a-z]' '[A-Z]')" = 'NO_BUILD' ]
+then
echo "BEGIN MESSAGE"
echo "LIBJPEG selected, but LIBJPEG_DIR not set. Checking some places..."
echo "END MESSAGE"
- FILES="include/jpeglib.h"
- DIRS="/usr /usr/local ${HOME}"
+ DIRS="/usr /usr/local /usr/local/packages /usr/local/apps /opt/local ${HOME} c:/packages"
for dir in $DIRS; do
- LIBJPEG_DIR="$dir"
- for file in $FILES; do
- if [ ! -r "$dir/$file" ]; then
- unset LIBJPEG_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/x86_64-linux-gnu lib lib/i386-linux-gnu; do
+ FILES="include/jpeglib.h $libdir/libjpeg.$libext"
+ # assume this is the one and check all needed files
+ LIBJPEG_DIR="$dir"
+ for file in $FILES; do
+ # discard this directory if one file was not found
+ if [ ! -r "$dir/$file" ]; then
+ echo "$dir/$file"
+ unset LIBJPEG_DIR
+ break
+ fi
+ done
+ # don't look further if all files have been found
+ if [ -n "$LIBJPEG_DIR" ]; then
+ break
+ fi
+ done
+ # don't look further if all files have been found
+ if [ -n "$LIBJPEG_DIR" ]; then
break
fi
done
+ # don't look further if all files have been found
if [ -n "$LIBJPEG_DIR" ]; then
break
fi