gecko-dev/build/autoconf/rust.m4
Nathan Froyd 2792f8ec0b Bug 1208566 - require Rust 1.5 for --enable-rust builds; r=mshal
Rust 1.5 features fine-grained dependency tracking that we need for
proper incremental builds.  As a side effect, it also features choosing
between the builtin-to-Rust jemalloc and the system allocator, which
Gecko needs for interoperation.  (Gecko needs to make Rust use the
system allocator, which then gets redirected into Gecko's copy of
jemalloc if necessary.)  It's not great to require an unstable Rust
target here, but we need to upgrade at some point anyway, so we might as
well make people aware of the upgrade requirement sooner rather than
later.
2015-12-17 12:14:19 -08:00

37 lines
1.7 KiB
Plaintext

dnl This Source Code Form is subject to the terms of the Mozilla Public
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
AC_DEFUN([MOZ_RUST_SUPPORT], [
MOZ_PATH_PROG(RUSTC, rustc)
if test -n "$RUSTC"; then
AC_MSG_CHECKING([rustc version])
RUSTC_VERSION=`$RUSTC --version | cut -d ' ' -f 2`
# Parse out semversion elements.
_RUSTC_MAJOR_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 1`
_RUSTC_MINOR_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 2`
_RUSTC_EXTRA_VERSION=`echo ${RUSTC_VERSION} | cut -d . -f 3 | cut -d + -f 1`
_RUSTC_PATCH_VERSION=`echo ${_RUSTC_EXTRA_VERSION} | cut -d '-' -f 1`
AC_MSG_RESULT([$RUSTC_VERSION (v${_RUSTC_MAJOR_VERSION}.${_RUSTC_MINOR_VERSION}.${_RUSTC_PATCH_VERSION})])
fi
MOZ_ARG_ENABLE_BOOL([rust],
[ --enable-rust Include Rust language sources],
[MOZ_RUST=1],
[MOZ_RUST= ])
if test -z "$RUSTC" -a -n "$MOZ_RUST"; then
AC_MSG_ERROR([Rust compiler not found.
To compile rust language sources, you must have 'rustc' in your path.
See http://www.rust-lang.org/ for more information.])
fi
if test -n "$MOZ_RUST" && test -z "$_RUSTC_MAJOR_VERSION" -o \
"$_RUSTC_MAJOR_VERSION" -lt 1 -o \
\( "$_RUSTC_MAJOR_VERSION" -eq 1 -a "$_RUSTC_MINOR_VERSION" -lt 5 \); then
AC_MSG_ERROR([Rust compiler ${RUSTC_VERSION} is too old.
To compile Rust language sources please install at least
version 1.5 of the 'rustc' toolchain and make sure it is
first in your path.
You can verify this by typing 'rustc --version'.])
fi
AC_SUBST(MOZ_RUST)
])