aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-03-07 22:43:37 -0800
committerGitHub <noreply@github.com>2023-03-07 22:43:37 -0800
commit6d91df08b53d0b17fa8cd949a3c6b42164c46c8d (patch)
tree8aea38651881189841c537dd8c8ca097a850f351 /configure.ac
parent0bf4cd8e1c3178345a63ce5b9d80d02781d93497 (diff)
downloadruby-6d91df08b53d0b17fa8cd949a3c6b42164c46c8d.tar.gz
Allow enabling YJIT and RJIT independently (#7474)
We used to require MJIT is supported when YJIT is supported. However, now that RJIT dropped some platforms that YJIT supports, it no longer makes sense. We should be able to enable only YJIT, and vice versa.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac79
1 files changed, 55 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index d576e22cea..f79c900099 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3725,16 +3725,6 @@ AC_SUBST(CAPITARGET)
AS_CASE(["$RDOCTARGET:$CAPITARGET"],[nodoc:nodoc],[INSTALLDOC=nodoc],[INSTALLDOC=all])
AC_SUBST(INSTALLDOC)
-AC_ARG_ENABLE(jit-support,
- AS_HELP_STRING([--disable-jit-support], [disable JIT features]),
- [RJIT_SUPPORT=$enableval],
- [AS_CASE(["$target_os"],
- [wasi | mingw* | solaris*], [RJIT_SUPPORT=no],
- [RJIT_SUPPORT=yes]
- )])
-
-AC_SUBST(RJIT_SUPPORT)
-
AC_CHECK_PROG(RUSTC, [rustc], [rustc], [no]) dnl no ac_tool_prefix
dnl check if rustc is recent enough to build YJIT (rustc >= 1.58.0)
@@ -3780,8 +3770,8 @@ AC_ARG_ENABLE(yjit,
AS_HELP_STRING([--enable-yjit],
[enable in-process JIT compiler that requires Rust build tools. enabled by default on supported platforms if rustc 1.58.0+ is available]),
[YJIT_SUPPORT=$enableval],
- [AS_CASE(["$enable_jit_support:$YJIT_TARGET_OK:$YJIT_RUSTC_OK"],
- [yes:yes:yes|:yes:yes], [
+ [AS_CASE(["$YJIT_TARGET_OK:$YJIT_RUSTC_OK"],
+ [yes:yes], [
YJIT_SUPPORT=yes
],
[YJIT_SUPPORT=no]
@@ -3793,9 +3783,6 @@ CARGO_BUILD_ARGS=
YJIT_LIBS=
AS_CASE(["${YJIT_SUPPORT}"],
[yes|dev|stats|dev_nodebug], [
- AS_IF([test x"$enable_jit_support" = "xno"],
- AC_MSG_ERROR([--disable-jit-support but --enable-yjit. YJIT requires JIT support])
- )
AS_IF([test x"$RUSTC" = "xno"],
AC_MSG_ERROR([rustc is required. Installation instructions available at https://www.rust-lang.org/tools/install])
)
@@ -3835,16 +3822,8 @@ AS_CASE(["${YJIT_SUPPORT}"],
AC_DEFINE_UNQUOTED(YJIT_SUPPORT, [$YJIT_SUPPORT])
])
AC_DEFINE(USE_YJIT, 1)
- AC_DEFINE(USE_RJIT, 1)
], [
AC_DEFINE(USE_YJIT, 0)
- AC_DEFINE(USE_RJIT, 0)
-])
-
-# If YJIT links capstone, libcapstone stops working on the C side.
-# capstone should be linked for RJIT only when YJIT doesn't.
-AS_IF([test x"$RJIT_SUPPORT" = "xyes" -a -z "$CARGO_BUILD_ARGS" ], [
- AC_CHECK_LIB([capstone], [cs_disasm])
])
dnl These variables end up in ::RbConfig::CONFIG
@@ -3855,6 +3834,58 @@ AC_SUBST(CARGO_BUILD_ARGS)dnl for selecting Rust build profiles
AC_SUBST(YJIT_LIBS)dnl for optionally building the Rust parts of YJIT
AC_SUBST(YJIT_OBJ)dnl for optionally building the C parts of YJIT
+dnl Currently, RJIT only supports Unix x86_64 platforms.
+RJIT_TARGET_OK=no
+AS_IF([test "$cross_compiling" = no],
+ AS_CASE(["$target_cpu-$target_os"],
+ [*android*], [
+ RJIT_TARGET_OK=no
+ ],
+ [x86_64-darwin*], [
+ RJIT_TARGET_OK=yes
+ ],
+ [x86_64-*linux*], [
+ RJIT_TARGET_OK=yes
+ ],
+ [x86_64-*bsd*], [
+ RJIT_TARGET_OK=yes
+ ]
+ )
+)
+
+dnl Build RJIT on Unix x86_64 platforms or if --enable-rjit is specified.
+AC_ARG_ENABLE(rjit,
+ AS_HELP_STRING([--enable-rjit],
+ [enable pure-Ruby JIT compiler. enabled by default on Unix x86_64 platforms]),
+ [RJIT_SUPPORT=$enableval],
+ [AS_CASE(["$YJIT_TARGET_OK"],
+ [yes], [RJIT_SUPPORT=yes],
+ [RJIT_SUPPORT=no]
+ )]
+)
+
+AS_CASE(["${RJIT_SUPPORT}"],
+[yes|dev], [
+ AS_CASE(["${RJIT_SUPPORT}"],
+ [dev], [
+ # Link libcapstone for --rjit-dump-disasm. If YJIT links libcapstone
+ # with cargo, linking libcapstone here doesn't work. It should be
+ # linked for RJIT only when YJIT doesn't.
+ AS_IF([test -z "$CARGO_BUILD_ARGS"], [
+ AC_CHECK_LIB([capstone], [cs_disasm])
+ ])
+
+ # Enable RJIT_STATS (vm_insns_count of --rjit-stats)
+ AC_DEFINE(RUBY_DEBUG, 1)
+ ])
+
+ AC_DEFINE(USE_RJIT, 1)
+], [
+ AC_DEFINE(USE_RJIT, 0)
+])
+
+AC_SUBST(RJIT_SUPPORT)
+
AC_ARG_ENABLE(install-static-library,
AS_HELP_STRING([--disable-install-static-library], [do not install static ruby library]),
[INSTALL_STATIC_LIBRARY=$enableval
@@ -4541,8 +4572,8 @@ config_summary "debugflags" "$debugflags"
config_summary "warnflags" "$warnflags"
config_summary "strip command" "$STRIP"
config_summary "install doc" "$DOCTARGETS"
-config_summary "RJIT support" "$RJIT_SUPPORT"
config_summary "YJIT support" "$YJIT_SUPPORT"
+config_summary "RJIT support" "$RJIT_SUPPORT"
config_summary "man page type" "$MANTYPE"
config_summary "search path" "$search_path"
config_summary "static-linked-ext" ${EXTSTATIC:+"yes"}