Skip to content

Commit 00e6667

Browse files
nodakaiNODA, Kai
authored and
NODA, Kai
committed
configure: test $SHELL's permission
On some weird setup where $SHELL is a relative path (can happen under GNU Screen,) `file -L "$BIN_TO_PROBE"` fails and $CFG_CPUTYPE is wrongly set to i686. We should not only check its string value but also permission on filesystem.
1 parent 439e184 commit 00e6667

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

configure

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,18 @@ then
521521
# if configure is running in an interactive bash shell. /usr/bin/env
522522
# exists *everywhere*.
523523
BIN_TO_PROBE="$SHELL"
524-
if [ -z "$BIN_TO_PROBE" -a -e "/usr/bin/env" ]; then
525-
BIN_TO_PROBE="/usr/bin/env"
524+
if [ ! -r "$BIN_TO_PROBE" ]; then
525+
if [ -r "/usr/bin/env" ]; then
526+
BIN_TO_PROBE="/usr/bin/env"
527+
else
528+
warn "Cannot check if the userland is i686 or x86_64"
529+
fi
530+
fi
531+
file -L "$BIN_TO_PROBE" | grep -q "x86[_-]64"
532+
if [ $? != 0 ]; then
533+
msg "i686 userland on x86_64 Linux kernel"
534+
CFG_CPUTYPE=i686
526535
fi
527-
if [ -n "$BIN_TO_PROBE" ]; then
528-
file -L "$BIN_TO_PROBE" | grep -q "x86[_-]64"
529-
if [ $? != 0 ]; then
530-
CFG_CPUTYPE=i686
531-
fi
532-
fi
533536
fi
534537

535538

0 commit comments

Comments
 (0)