From ddeb3db8722f5c8bba90179c299899f409124285 Mon Sep 17 00:00:00 2001 From: Gioele Barabucci Date: Thu, 7 Aug 2014 14:00:35 +0200 Subject: [PATCH] Use system rustc if configured with --enable-local-rust This commit makes the configuration system autodetect a rustc that is already installed and use that instead of downloading a snapshot. --- configure | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/configure b/configure index e08e28e0aece..636d50276ff5 100755 --- a/configure +++ b/configure @@ -557,13 +557,21 @@ fi if [ ! -z "$CFG_ENABLE_LOCAL_RUST" ] then - if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} ] + system_rustc=$(which rustc) + if [ -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} ] then - err "no local rust to use" + : # everything already configured + elif [ -n "$system_rustc" ] + then + # we assume that rustc is in a /bin directory + CFG_LOCAL_RUST_ROOT=${system_rustc%/bin/rustc} else - LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} --version` - step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV" + err "no local rust to use" fi + + LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} --version` + step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV" + putvar CFG_LOCAL_RUST_ROOT fi # Force freebsd to build with clang; gcc doesn't like us there