about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKai Noda <nodakai@gmail.com>2015-12-07 11:19:03 +0800
committerNODA, Kai <Kai.Noda@Squarepoint-Capital.com>2015-12-22 16:25:47 +0800
commit00e6667b9809ae6f573ef65bc3a29f1d5a874ce5 (patch)
treefb6a5e266758101917f9b55a6b1205f394333937
parent439e1843b9f53a2ad9e83861f47f95227737e998 (diff)
downloadrust-00e6667b9809ae6f573ef65bc3a29f1d5a874ce5.tar.gz
rust-00e6667b9809ae6f573ef65bc3a29f1d5a874ce5.zip
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.
-rwxr-xr-xconfigure19
1 files changed, 11 insertions, 8 deletions
diff --git a/configure b/configure
index 6e2d3060bc3..c9ee418fd28 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