Skip to content

Commit 1aa75ce

Browse files
committed
configure: Fix detection of 32-bit Linux userspace
The variable '$SHELL' is not actually defined by 'sh'.
1 parent b0aad7d commit 1aa75ce

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

configure

+12-3
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,19 @@ esac
479479
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
480480
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]
481481
then
482-
file -L "$SHELL" | grep -q "x86[_-]64"
483-
if [ $? != 0 ]; then
484-
CFG_CPUTYPE=i686
482+
# $SHELL does not exist in standard 'sh', so probably only exists
483+
# if configure is running in an interactive bash shell. /usr/bin/env
484+
# exists *everywhere*.
485+
BIN_TO_PROBE="$SHELL"
486+
if [ -z "$BIN_TO_PROBE" -a -e "/usr/bin/env" ]; then
487+
BIN_TO_PROBE="/usr/bin/env"
485488
fi
489+
if [ -n "$BIN_TO_PROBE" ]; then
490+
file -L "$BIN_TO_PROBE" | grep -q "x86[_-]64"
491+
if [ $? != 0 ]; then
492+
CFG_CPUTYPE=i686
493+
fi
494+
fi
486495
fi
487496

488497

0 commit comments

Comments
 (0)