diff --git a/tamer/Makefile.am b/tamer/Makefile.am index cefde6f8..e9e090c6 100644 --- a/tamer/Makefile.am +++ b/tamer/Makefile.am @@ -18,6 +18,13 @@ # along with this program. If not, see . ## +# `Makefile.am` is processed by Automake into `Makefile.in`, which is then +# processed by Autoconf into the final `Makefile`. +# +# The `@`-delimited variables are defined dynamically in `configure.ac`, +# which is processed by Autoconf into `configure`; they are populated based +# on the environment in which the `configure` script is invoked. + .DELETE_ON_ERROR: .PHONY: all fix fmt check-fmt bench @@ -30,27 +37,27 @@ all: bin doc .PHONY: bin bin: - @CARGO@ build $(CARGO_BUILD_FLAGS) @FEATURES@ + @CARGO@ +@RUST_TC@ build $(CARGO_BUILD_FLAGS) @FEATURES@ doc: html html-am: - @CARGO@ test --doc @FEATURES@ - @CARGO@ @CARGO_DOC_FLAGS@ doc --document-private-items @FEATURES@ + @CARGO@ +@RUST_TC@ test --doc @FEATURES@ + @CARGO@ +@RUST_TC@ @CARGO_DOC_FLAGS@ doc --document-private-items @FEATURES@ # note that 'cargo check' is something else; see 'cargo --help' test: check check-am: check-fmt - @CARGO@ test @FEATURES@ + @CARGO@ +@RUST_TC@ test @FEATURES@ check-fmt: - @CARGO@ fmt -- --check + @CARGO@ +@RUST_TC@ fmt -- --check bench: - @CARGO@ @CARGO_BENCH_PRE_FLAGS@ bench $(CARGO_BENCH_FLAGS) @FEATURES@ + @CARGO@ +@RUST_TC@ @CARGO_BENCH_PRE_FLAGS@ bench $(CARGO_BENCH_FLAGS) @FEATURES@ fix: fmt fmt: - @CARGO@ fmt + @CARGO@ +@RUST_TC@ fmt clean-am: - @CARGO@ clean + @CARGO@ +@RUST_TC@ clean diff --git a/tamer/configure.ac b/tamer/configure.ac index a506bb98..42d1db6f 100644 --- a/tamer/configure.ac +++ b/tamer/configure.ac @@ -43,13 +43,18 @@ AC_SUBST(SUFFIX, m4_argn(4, ver_split)) AC_ARG_VAR([CARGO], [Rust Cargo executable]) AC_CHECK_PROGS(CARGO, [cargo]) +# Rust toolchain (stable/nightly) is hard-coded for now, since decisions +# regarding whether to use it are nuanced. +AC_SUBST([RUST_TC], nightly) + test -n "$CARGO" || AC_MSG_ERROR([cargo not found]) -rustc_ver_req=1.54.0 +# This is a nightly version at the time of writing +rustc_ver_req=1.57.0 AC_CHECK_PROGS(RUSTC, [rustc]) -AC_MSG_CHECKING([rustc version >= $rustc_ver_req]) -rustc_version=$("$RUSTC" --version | cut -d' ' -f2) +AC_MSG_CHECKING([rustc $RUST_TC version >= $rustc_ver_req]) +rustc_version=$("$RUSTC" "+$RUST_TC" --version | cut -d' ' -f2) AX_COMPARE_VERSION([$rustc_version], [ge], [$rustc_ver_req], [AC_MSG_RESULT([yes ($rustc_version)])], [AC_MSG_RESULT([no ($rustc_version)]) @@ -66,30 +71,30 @@ AC_SUBST([CARGO_DOC_FLAGS], []) # it's still an unstable feature and we'll need to use nightly. We don't # check for nightly here, though---if it's missing, then cargo will tell the # user what to do. -AC_MSG_CHECKING([`test` feature support]) -AS_IF(["$RUSTC" --crate-type lib build_aux/bench_check.rs &>/dev/null], +AC_MSG_CHECKING([`test` feature support on $RUST_TC]) +AS_IF(["$RUSTC" "+$RUST_TC" --crate-type lib build-aux/bench_check.rs &>/dev/null], [AC_MSG_RESULT(available)], [AC_MSG_RESULT([no (nightly required)]) AC_SUBST([CARGO_BENCH_PRE_FLAGS], [+nightly])]) # Cargo commands may be available but not necessarily installed for the # active toolchain. Let's check that. -AC_MSG_CHECKING([whether cargo-fmt is available for active toolchain]) -AS_IF([cargo fmt --help &>/dev/null], +AC_MSG_CHECKING([whether cargo-fmt is available on $RUST_TC]) +AS_IF([cargo "+$RUST_TC" fmt --help &>/dev/null], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) - cargo fmt --help # run again so user can see output - AC_MSG_ERROR([missing cargo-fmt for active toolchain])]) + cargo "+$RUST_TC" fmt --help # run again so user can see output + AC_MSG_ERROR([missing cargo-fmt on $RUST_TC])]) # Cargo commands may be available but not necessarily installed for the # active toolchain. Let's check that. -AC_MSG_CHECKING([whether cargo-doc is available for toolchain]) -AS_IF([cargo $CARGO_DOC_FLAGS doc --help &>/dev/null], +AC_MSG_CHECKING([whether cargo-doc is available on $RUST_TC]) +AS_IF([cargo "+$RUST_TC" $CARGO_DOC_FLAGS doc --help &>/dev/null], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) # run again so user can see output - cargo $CARGO_DOC_FLAGS doc --help 2>&1 | sed 's/^.*: //' - AC_MSG_WARN([missing cargo-doc for toolchain]) + cargo "+$RUST_TC" $CARGO_DOC_FLAGS doc --help 2>&1 | sed 's/^.*: //' + AC_MSG_WARN([missing cargo-doc on $RUST_TC]) AC_MSG_WARN([`make html` will not work])]) AC_ARG_VAR([FEATURES],