2015-09-18 23:55:29 +03:00
|
|
|
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`
|
2016-01-13 20:18:08 +03:00
|
|
|
AC_MSG_RESULT([${_RUSTC_MAJOR_VERSION}.${_RUSTC_MINOR_VERSION}.${_RUSTC_PATCH_VERSION} ($RUSTC_VERSION)])
|
2015-09-18 23:55:29 +03:00
|
|
|
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 \
|
2015-11-09 21:53:00 +03:00
|
|
|
"$_RUSTC_MAJOR_VERSION" -lt 1 -o \
|
2015-10-05 23:31:44 +03:00
|
|
|
\( "$_RUSTC_MAJOR_VERSION" -eq 1 -a "$_RUSTC_MINOR_VERSION" -lt 5 \); then
|
2015-09-18 23:55:29 +03:00
|
|
|
AC_MSG_ERROR([Rust compiler ${RUSTC_VERSION} is too old.
|
|
|
|
To compile Rust language sources please install at least
|
2015-10-05 23:31:44 +03:00
|
|
|
version 1.5 of the 'rustc' toolchain and make sure it is
|
2015-09-18 23:55:29 +03:00
|
|
|
first in your path.
|
|
|
|
You can verify this by typing 'rustc --version'.])
|
|
|
|
fi
|
|
|
|
AC_SUBST(MOZ_RUST)
|
|
|
|
])
|