mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Auto-enable YJIT build when rustc >= 1.58.0 present (#6662)
* Auto-enable YJIT build when rustc >= 1.58.0 present * Try different incantation to have rustc output to stdout only * Add comment, remove whitespace * Try to detect if we are on a platform on which YJIT is supported
This commit is contained in:
parent
6d83590157
commit
dd4ae9a475
Notes:
git
2022-11-04 21:02:32 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>
1 changed files with 33 additions and 4 deletions
33
configure.ac
33
configure.ac
|
@ -3733,10 +3733,40 @@ AS_IF([test x"$MJIT_SUPPORT" = "xyes"],
|
|||
|
||||
AC_SUBST(MJIT_SUPPORT)
|
||||
|
||||
AC_CHECK_TOOL(RUSTC, [rustc], [no])
|
||||
|
||||
dnl check if we can build YJIT on this target platform
|
||||
AS_CASE(["$target_cpu-$target_os"],
|
||||
[arm64-darwin*|aarch64-darwin*|x86_64-darwin*], [
|
||||
YJIT_TARGET_OK=yes
|
||||
],
|
||||
[arm64-*linux*|aarch64-*linux*|x86_64-*linux*], [
|
||||
YJIT_TARGET_OK=yes
|
||||
],
|
||||
[arm64-*bsd*|aarch64-*bsd*|x86_64-*bsd*], [
|
||||
YJIT_TARGET_OK=yes
|
||||
],
|
||||
[YJIT_TARGET_OK=no]
|
||||
)
|
||||
|
||||
dnl build YJIT in release mode if rustc >= 1.58.0 is present and we are on a supported platform
|
||||
AC_ARG_ENABLE(yjit,
|
||||
AS_HELP_STRING([--enable-yjit],
|
||||
[enable experimental in-process JIT compiler that requires Rust build tools [default=no]]),
|
||||
[YJIT_SUPPORT=$enableval], [YJIT_SUPPORT=no])
|
||||
[YJIT_SUPPORT=$enableval],
|
||||
[
|
||||
AS_IF([test x"$RUSTC" != "xno"],
|
||||
AS_IF([ echo "fn main() { let x = 1; format!(\"{x}\"); }" | rustc - --emit asm=/dev/null ],
|
||||
AS_IF([test x"$YJIT_TARGET_OK" != "xno"],
|
||||
[YJIT_SUPPORT=yes],
|
||||
[YJIT_SUPPORT=no]
|
||||
),
|
||||
[YJIT_SUPPORT=no]
|
||||
),
|
||||
[YJIT_SUPPORT=no]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
CARGO=
|
||||
CARGO_BUILD_ARGS=
|
||||
|
@ -3784,7 +3814,6 @@ AS_CASE(["${YJIT_SUPPORT}"],
|
|||
AC_DEFINE(USE_YJIT, 1)
|
||||
], [AC_DEFINE(USE_YJIT, 0)])
|
||||
|
||||
|
||||
dnl These variables end up in ::RbConfig::CONFIG
|
||||
AC_SUBST(YJIT_SUPPORT)dnl what flavor of YJIT the Ruby build includes
|
||||
AC_SUBST(RUSTC)dnl Rust compiler command
|
||||
|
|
Loading…
Reference in a new issue