зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1181441 - Configure check for no-tls rust toolchain. r=ted
By default the rust standard library uses linker-assisted thread-local storage, which isn't supported on MacOS X 10.6. If we're targetting that version make sure we can link code built with $RUSTC. If so it's presumedly been built with alternate support.
This commit is contained in:
Родитель
6d417481e6
Коммит
fb7a70ca1a
30
configure.in
30
configure.in
|
@ -476,17 +476,37 @@ dnl Special MacOS X checks
|
|||
dnl ========================================================
|
||||
|
||||
if test -n "$MACOSX_DEPLOYMENT_TARGET" -a -n "$MOZ_RUST"; then
|
||||
AC_MSG_CHECKING([MacOS X compatibility with rust])
|
||||
# rustc doesn't support MacOS X 10.6 or earlier.
|
||||
AC_MSG_CHECKING([rustc compatibility with MacOS X])
|
||||
# Stock rustc doesn't support MacOS X 10.6 or earlier.
|
||||
# https://github.com/rust-lang/rust/issues/25342
|
||||
_MACOSX_TARGET_MINOR=`echo "$MACOSX_DEPLOYMENT_TARGET" | cut -d. -f2`
|
||||
if test "$_MACOSX_TARGET_MINOR" -lt 7; then
|
||||
AC_MSG_ERROR([rustc does not support MacOS X $MACOSX_DEPLOYMENT_TARGET
|
||||
Add 'ac_add_options --enable-macos-target=10.7' (or later)
|
||||
to mozconfig, or disable rust support.])
|
||||
dnl Test C linkage against rust code to see if the rust
|
||||
dnl toolchain output is compatible.
|
||||
cat > conftest.rs <<EOF
|
||||
[#[no_mangle]]
|
||||
pub extern fn rusty_answer() -> u8 { 42 }
|
||||
EOF
|
||||
ac_try="$RUSTC --crate-type staticlib -o conftest.a conftest.rs >/dev/null"
|
||||
AC_TRY_EVAL(ac_try)
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="$LDFLAGS conftest.a -lpthread -lm"
|
||||
AC_TRY_LINK_FUNC([rusty_answer], [
|
||||
AC_MSG_RESULT([$MACOSX_DEPLOYMENT_TARGET is ok with this rustc])
|
||||
], [
|
||||
AC_MSG_RESULT([cannot link on $MACOSX_DEPLOYMENT_TARGET])
|
||||
MOZ_RUST=
|
||||
])
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
rm -rf conftest*
|
||||
else
|
||||
AC_MSG_RESULT([$MACOSX_DEPLOYMENT_TARGET is ok])
|
||||
fi
|
||||
if test -z "$MOZ_RUST"; then
|
||||
AC_MSG_ERROR([rustc does not support MacOS X $MACOSX_DEPLOYMENT_TARGET
|
||||
Add 'ac_add_options --enable-macos-target=10.7' (or later)
|
||||
to mozconfig, disable rust support, or use an alternate toolchain.])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
|
|
Загрузка…
Ссылка в новой задаче