diff --git a/configure b/configure index c9d384ecfe3b2..7b3f710fc7276 100755 --- a/configure +++ b/configure @@ -384,207 +384,6 @@ need_cmd sed need_cmd file need_cmd make -msg "inspecting environment" - -CFG_OSTYPE=$(uname -s) -CFG_CPUTYPE=$(uname -m) - -if [ $CFG_OSTYPE = Darwin -a $CFG_CPUTYPE = i386 ] -then - # Darwin's `uname -s` lies and always returns i386. We have to use sysctl - # instead. - if sysctl hw.optional.x86_64 | grep -q ': 1' - then - CFG_CPUTYPE=x86_64 - fi -fi - -# The goal here is to come up with the same triple as LLVM would, -# at least for the subset of platforms we're willing to target. - -case $CFG_OSTYPE in - - Linux) - CFG_OSTYPE=unknown-linux-gnu - ;; - - FreeBSD) - CFG_OSTYPE=unknown-freebsd - ;; - - DragonFly) - CFG_OSTYPE=unknown-dragonfly - ;; - - Bitrig) - CFG_OSTYPE=unknown-bitrig - ;; - - OpenBSD) - CFG_OSTYPE=unknown-openbsd - ;; - - NetBSD) - CFG_OSTYPE=unknown-netbsd - ;; - - Darwin) - CFG_OSTYPE=apple-darwin - ;; - - SunOS) - CFG_OSTYPE=sun-solaris - CFG_CPUTYPE=$(isainfo -n) - ;; - - Haiku) - CFG_OSTYPE=unknown-haiku - ;; - - MINGW*) - # msys' `uname` does not print gcc configuration, but prints msys - # configuration. so we cannot believe `uname -m`: - # msys1 is always i686 and msys2 is always x86_64. - # instead, msys defines $MSYSTEM which is MINGW32 on i686 and - # MINGW64 on x86_64. - CFG_CPUTYPE=i686 - CFG_OSTYPE=pc-windows-gnu - if [ "$MSYSTEM" = MINGW64 ] - then - CFG_CPUTYPE=x86_64 - fi - ;; - - MSYS*) - CFG_OSTYPE=pc-windows-gnu - ;; - -# Thad's Cygwin identifiers below - -# Vista 32 bit - CYGWIN_NT-6.0) - CFG_OSTYPE=pc-windows-gnu - CFG_CPUTYPE=i686 - ;; - -# Vista 64 bit - CYGWIN_NT-6.0-WOW64) - CFG_OSTYPE=pc-windows-gnu - CFG_CPUTYPE=x86_64 - ;; - -# Win 7 32 bit - CYGWIN_NT-6.1) - CFG_OSTYPE=pc-windows-gnu - CFG_CPUTYPE=i686 - ;; - -# Win 7 64 bit - CYGWIN_NT-6.1-WOW64) - CFG_OSTYPE=pc-windows-gnu - CFG_CPUTYPE=x86_64 - ;; - -# Win 8 # uname -s on 64-bit cygwin does not contain WOW64, so simply use uname -m to detect arch (works in my install) - CYGWIN_NT-6.3) - CFG_OSTYPE=pc-windows-gnu - ;; -# We do not detect other OS such as XP/2003 using 64 bit using uname. -# If we want to in the future, we will need to use Cygwin - Chuck's csih helper in /usr/lib/csih/winProductName.exe or alternative. - *) - err "unknown OS type: $CFG_OSTYPE" - ;; -esac - - -case $CFG_CPUTYPE in - - i386 | i486 | i686 | i786 | x86) - CFG_CPUTYPE=i686 - ;; - - xscale | arm) - CFG_CPUTYPE=arm - ;; - - armv6l) - CFG_CPUTYPE=arm - CFG_OSTYPE="${CFG_OSTYPE}eabihf" - ;; - - armv7l) - CFG_CPUTYPE=armv7 - CFG_OSTYPE="${CFG_OSTYPE}eabihf" - ;; - - aarch64 | arm64) - CFG_CPUTYPE=aarch64 - ;; - - powerpc | ppc) - CFG_CPUTYPE=powerpc - ;; - - powerpc64 | ppc64) - CFG_CPUTYPE=powerpc64 - ;; - - powerpc64le | ppc64le) - CFG_CPUTYPE=powerpc64le - ;; - - s390x) - CFG_CPUTYPE=s390x - ;; - - x86_64 | x86-64 | x64 | amd64) - CFG_CPUTYPE=x86_64 - ;; - - mips | mips64) - if [ "$CFG_CPUTYPE" = "mips64" ]; then - CFG_OSTYPE="${CFG_OSTYPE}abi64" - fi - ENDIAN=$(printf '\1' | od -dAn) - if [ "$ENDIAN" -eq 1 ]; then - CFG_CPUTYPE="${CFG_CPUTYPE}el" - elif [ "$ENDIAN" -ne 256 ]; then - err "unknown endianness: $ENDIAN (expecting 1 for little or 256 for big)" - fi - ;; - - BePC) - CFG_CPUTYPE=i686 - ;; - - *) - err "unknown CPU type: $CFG_CPUTYPE" -esac - -# 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 ] -then - # $SHELL does not exist in standard 'sh', so probably only exists - # if configure is running in an interactive bash shell. /usr/bin/env - # exists *everywhere*. - BIN_TO_PROBE="$SHELL" - 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 -fi - - -DEFAULT_BUILD="${CFG_CPUTYPE}-${CFG_OSTYPE}" - CFG_SRC_DIR="$(abs_path $(dirname $0))/" CFG_SRC_DIR_RELATIVE="$(dirname $0)/" CFG_BUILD_DIR="$(pwd)/" @@ -672,7 +471,7 @@ valopt infodir "${CFG_PREFIX}/share/info" "install additional info" valopt llvm-root "" "set LLVM root" valopt python "" "set path to python" valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located" -valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple" +valopt build "" "GNUs ./configure syntax LLVM build triple" valopt android-cross-path "" "Android NDK standalone path (deprecated)" valopt i686-linux-android-ndk "" "i686-linux-android NDK standalone path" valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path" diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index c1ee0c29ac981..40cd084c754e9 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -295,8 +295,10 @@ def get_toml(self, key): def get_mk(self, key): for line in iter(self.config_mk.splitlines()): - if line.startswith(key): - return line[line.find(':=') + 2:].strip() + if line.startswith(key + ' :='): + var = line[line.find(':=') + 2:].strip() + if var != '': + return var return None def cargo(self): @@ -437,6 +439,8 @@ def build_triple(self): sys.exit(err) elif ostype == 'Darwin': ostype = 'apple-darwin' + elif ostype == 'Haiku': + ostype = 'unknown-haiku' elif ostype.startswith('MINGW'): # msys' `uname` does not print gcc configuration, but prints msys # configuration. so we cannot believe `uname -m`: @@ -464,9 +468,12 @@ def build_triple(self): cputype = 'i686' elif cputype in {'xscale', 'arm'}: cputype = 'arm' - elif cputype == 'armv7l': + elif cputype == 'armv6l': cputype = 'arm' ostype += 'eabihf' + elif cputype == 'armv7l': + cputype = 'armv7' + ostype += 'eabihf' elif cputype == 'aarch64': cputype = 'aarch64' elif cputype == 'arm64': @@ -487,12 +494,20 @@ def build_triple(self): raise ValueError('unknown byteorder: ' + sys.byteorder) # only the n64 ABI is supported, indicate it ostype += 'abi64' - elif cputype in {'powerpc', 'ppc', 'ppc64'}: + elif cputype in {'powerpc', 'ppc'}: cputype = 'powerpc' + elif cputype in {'powerpc64', 'ppc64'}: + cputype = 'powerpc64' + elif cputype in {'powerpc64le', 'ppc64le'}: + cputype = 'powerpc64le' elif cputype == 'sparcv9': pass elif cputype in {'amd64', 'x86_64', 'x86-64', 'x64'}: cputype = 'x86_64' + elif cputype == 's390x': + cputype = 's390x' + elif cputype == 'BePC': + cputype = 'i686' else: err = "unknown cpu type: " + cputype if self.verbose: diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 8308dc3202fff..dfcbe3da76dd1 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -456,12 +456,12 @@ impl Config { } match key { - "CFG_BUILD" => self.build = value.to_string(), - "CFG_HOST" => { + "CFG_BUILD" if value.len() > 0 => self.build = value.to_string(), + "CFG_HOST" if value.len() > 0 => { self.host = value.split(" ").map(|s| s.to_string()) .collect(); } - "CFG_TARGET" => { + "CFG_TARGET" if value.len() > 0 => { self.target = value.split(" ").map(|s| s.to_string()) .collect(); }