Skip to content

Commit 1272a83

Browse files
committed
auto merge of #16321 : gioele/rust/use-local-rust, r=brson
This commit makes the configuration system autodetect a `rustc` that is already installed and use that instead of downloading a snapshot.
2 parents c5b8d89 + ddeb3db commit 1272a83

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

configure

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,21 @@ fi
557557

558558
if [ ! -z "$CFG_ENABLE_LOCAL_RUST" ]
559559
then
560-
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} ]
560+
system_rustc=$(which rustc)
561+
if [ -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} ]
561562
then
562-
err "no local rust to use"
563+
: # everything already configured
564+
elif [ -n "$system_rustc" ]
565+
then
566+
# we assume that rustc is in a /bin directory
567+
CFG_LOCAL_RUST_ROOT=${system_rustc%/bin/rustc}
563568
else
564-
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} --version`
565-
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV"
569+
err "no local rust to use"
566570
fi
571+
572+
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} --version`
573+
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV"
574+
putvar CFG_LOCAL_RUST_ROOT
567575
fi
568576

569577
# Force freebsd to build with clang; gcc doesn't like us there

0 commit comments

Comments
 (0)