diff --git a/aclocal.m4 b/aclocal.m4 index 981827252e9..d68a568e838 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -34,6 +34,7 @@ builtin(include, build/autoconf/clang-plugin.m4)dnl builtin(include, build/autoconf/alloc.m4)dnl builtin(include, build/autoconf/ios.m4)dnl builtin(include, build/autoconf/jemalloc.m4)dnl +builtin(include, build/autoconf/rust.m4)dnl MOZ_PROG_CHECKMSYS() diff --git a/build/autoconf/rust.m4 b/build/autoconf/rust.m4 new file mode 100644 index 00000000000..90b44c81103 --- /dev/null +++ b/build/autoconf/rust.m4 @@ -0,0 +1,35 @@ +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; then + AC_MSG_ERROR([Rust compiler ${RUSTC_VERSION} is too old. + To compile Rust language sources please install at least + version 1.0 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) +]) diff --git a/configure.in b/configure.in index 69dcd7eacf4..cace43e8fd1 100644 --- a/configure.in +++ b/configure.in @@ -414,35 +414,7 @@ MOZ_TOOL_VARIABLES MOZ_CHECK_COMPILER_WRAPPER -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; then - AC_MSG_ERROR([Rust compiler ${RUSTC_VERSION} is too old. - To compile Rust language sources please install at least - version 1.0 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) +MOZ_RUST_SUPPORT dnl ======================================================== dnl Check for MacOS deployment target version diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4 index c1866103f2d..8bf127d2b7c 100644 --- a/js/src/aclocal.m4 +++ b/js/src/aclocal.m4 @@ -33,6 +33,7 @@ builtin(include, ../../build/autoconf/clang-plugin.m4)dnl builtin(include, ../../build/autoconf/alloc.m4)dnl builtin(include, ../../build/autoconf/jemalloc.m4)dnl builtin(include, ../../build/autoconf/ios.m4)dnl +builtin(include, ../../build/autoconf/rust.m4)dnl define([__MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE])) define([AC_INIT_PREPARE], diff --git a/js/src/configure.in b/js/src/configure.in index 0ced79ae5cc..99c6ada69b9 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -305,6 +305,8 @@ MOZ_TOOL_VARIABLES MOZ_CHECK_COMPILER_WRAPPER +MOZ_RUST_SUPPORT + dnl Special win32 checks dnl ========================================================