[前][次][番号順一覧][スレッド一覧]

ruby-changes:74373

From: Nobuyoshi <ko1@a...>
Date: Sun, 6 Nov 2022 22:06:26 +0900 (JST)
Subject: [ruby-changes:74373] fc842c9ccc (master): Check `rustc` with the target

https://git.ruby-lang.org/ruby.git/commit/?id=fc842c9ccc

From fc842c9ccc2059e20ec6487b6678e6b71cbd77e1 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 6 Nov 2022 19:32:50 +0900
Subject: Check `rustc` with the target

---
 configure.ac | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8c176db836..85e1359f5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3736,17 +3736,28 @@ AC_SUBST(MJIT_SUPPORT) https://github.com/ruby/ruby/blob/trunk/configure.ac#L3736
 AC_CHECK_PROG(RUSTC, [rustc], [rustc], [no]) dnl no ac_tool_prefix
 
 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
+AS_CASE(["$target_cpu"],
+    [arm64|aarch64], [
+        YJIT_TARGET=aarch64
+    ],
+    [x86_64], [
+        YJIT_TARGET="$target_cpu"
+    ],
+    [YJIT_TARGET=]
+)
+AS_CASE(["$YJIT_TARGET:$target_os"],
+    [:*], [ # unsupported CPU
+    ],
+    [darwin*], [
+        YJIT_TARGET=${YJIT_TARGET}-apple-darwin
     ],
-    [arm64-*linux*|aarch64-*linux*|x86_64-*linux*], [
-        YJIT_TARGET_OK=yes
+    [linux-android], [ # no target_vendor
+        YJIT_TARGET=${YJIT_TARGET}-${target_os}
     ],
-    [arm64-*bsd*|aarch64-*bsd*|x86_64-*bsd*], [
-        YJIT_TARGET_OK=yes
+    [*linux*], [
+        YJIT_TARGET=${YJIT_TARGET}-${target_vendor}-${target_os}
     ],
-    [YJIT_TARGET_OK=no]
+    [YJIT_TARGET=]
 )
 
 dnl build YJIT in release mode if rustc >= 1.58.0 is present and we are on a supported platform
@@ -3754,12 +3765,12 @@ AC_ARG_ENABLE(yjit, https://github.com/ruby/ruby/blob/trunk/configure.ac#L3765
     AS_HELP_STRING([--enable-yjit],
     [enable experimental in-process JIT compiler that requires Rust build tools [default=no]]),
     [YJIT_SUPPORT=$enableval],
-    [AS_CASE(["$enable_jit_support:$YJIT_TARGET_OK:$RUSTC"],
-        [no:*|yes:no:*|yes:yes:no], [
+    [AS_CASE(["$enable_jit_support:$YJIT_TARGET:$RUSTC"],
+        [no:*|yes::*|yes:*:no], [
             YJIT_SUPPORT=no
         ],
         [yes:yes:*], [
-            AS_IF([ echo "fn main() { let x = 1; format!(\"{x}\"); }" | $RUSTC - --emit asm=/dev/null ],
+            AS_IF([ echo "fn main() { let x = 1; format!(\"{x}\"); }" | $RUSTC - --target=$YJIT_TARGET --emit asm=/dev/null ],
                 [YJIT_SUPPORT=yes],
                 [YJIT_SUPPORT=no]
             )
@@ -3772,7 +3783,6 @@ AC_ARG_ENABLE(yjit, https://github.com/ruby/ruby/blob/trunk/configure.ac#L3783
 CARGO=
 CARGO_BUILD_ARGS=
 YJIT_LIBS=
-AS_IF([test "$cross_compiling" = yes], [YJIT_SUPPORT=no])
 AS_CASE(["${YJIT_SUPPORT}"],
 [yes|dev|stats|dev_nodebug], [
     AS_IF([test x"$enable_jit_support" = "xno"],
-- 
cgit v1.2.3


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]