From 00e6667b9809ae6f573ef65bc3a29f1d5a874ce5 Mon Sep 17 00:00:00 2001 From: Kai Noda Date: Mon, 7 Dec 2015 11:19:03 +0800 Subject: [PATCH] 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. --- configure | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 6e2d3060bc3c..c9ee418fd284 100755 --- a/configure +++ b/configure @@ -521,15 +521,18 @@ then # if configure is running in an interactive bash shell. /usr/bin/env # exists *everywhere*. BIN_TO_PROBE="$SHELL" - if [ -z "$BIN_TO_PROBE" -a -e "/usr/bin/env" ]; then - BIN_TO_PROBE="/usr/bin/env" + if [ ! -r "$BIN_TO_PROBE" ]; then + if [ -r "/usr/bin/env" ]; then + BIN_TO_PROBE="/usr/bin/env" + else + warn "Cannot check if the userland is i686 or x86_64" + fi + fi + file -L "$BIN_TO_PROBE" | grep -q "x86[_-]64" + if [ $? != 0 ]; then + msg "i686 userland on x86_64 Linux kernel" + CFG_CPUTYPE=i686 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