diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index cbc53231d8..2222b8aa8e 100644 --- a/configure.ac +++ b/configure.ac @@ -3749,6 +3749,47 @@ AS_IF([test x"$MJIT_SUPPORT" = "xyes"], AC_SUBST(MJIT_SUPPORT) +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]) + +CARGO= +CARGO_BUILD_ARGS= +YJIT_LIBS= +AS_CASE(["${YJIT_SUPPORT}"], +[yes|dev], [ + AS_IF([test x"$enable_jit_support" = "xno"], + AC_MSG_ERROR([--disable-jit-support but --enable-yjit. YJIT requires JIT support]) + ) + AC_CHECK_TOOL(RUSTC, [rustc], [no]) + AS_IF([test x"$RUSTC" = "xno"], + AC_MSG_ERROR([rustc is required. Installation instructions available at https://www.rust-lang.org/tools/install]) + ) + AS_IF([test x"$YJIT_SUPPORT" = "xyes"], + [rb_rust_target_subdir=release + CARGO_BUILD_ARGS='--release'], + [rb_rust_target_subdir=debug + CARGO_BUILD_ARGS='--features stats,disasm,asm_comments' + AC_CHECK_TOOL(CARGO, [cargo], [no]) + AS_IF([test x"$CARGO" = "xno"], + AC_MSG_ERROR([cargo is required. Installation instructions available at https://www.rust-lang.org/tools/install]) + ) + AC_DEFINE(RUBY_DEBUG, 1)]) + YJIT_LIBS="yjit/target/${rb_rust_target_subdir}/libyjit.a" + YJIT_OBJ='yjit.$(OBJEXT)' + 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 +AC_SUBST(CARGO)dnl Cargo command for Rust builds +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 + AC_ARG_ENABLE(install-static-library, AS_HELP_STRING([--disable-install-static-library], [do not install static ruby library]), [INSTALL_STATIC_LIBRARY=$enableval @@ -4401,6 +4442,7 @@ config_summary "warnflags" "$warnflags" config_summary "strip command" "$STRIP" config_summary "install doc" "$DOCTARGETS" config_summary "JIT support" "$MJIT_SUPPORT" +config_summary "YJIT support" "$YJIT_SUPPORT" config_summary "man page type" "$MANTYPE" config_summary "search path" "$search_path" config_summary "static-linked-ext" ${EXTSTATIC:+"yes"} |