configure: Fix detection of 32-bit Linux userspace

The variable '$SHELL' is not actually defined by 'sh'.
This commit is contained in:
Brian Anderson 2015-03-23 14:27:09 -07:00
parent b0aad7dd4f
commit 1aa75cea1d

15
configure vendored
View File

@ -479,10 +479,19 @@ esac
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation # Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ] if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]
then then
file -L "$SHELL" | grep -q "x86[_-]64" # $SHELL does not exist in standard 'sh', so probably only exists
if [ $? != 0 ]; then # if configure is running in an interactive bash shell. /usr/bin/env
CFG_CPUTYPE=i686 # exists *everywhere*.
BIN_TO_PROBE="$SHELL"
if [ -z "$BIN_TO_PROBE" -a -e "/usr/bin/env" ]; then
BIN_TO_PROBE="/usr/bin/env"
fi fi
if [ -n "$BIN_TO_PROBE" ]; then
file -L "$BIN_TO_PROBE" | grep -q "x86[_-]64"
if [ $? != 0 ]; then
CFG_CPUTYPE=i686
fi
fi
fi fi