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

ruby-changes:69531

From: Yuta <ko1@a...>
Date: Sat, 30 Oct 2021 10:18:43 +0900 (JST)
Subject: [ruby-changes:69531] ccda26efe7 (master): Split thread-model config into another ac file

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

From ccda26efe7c6acf7edd1262dd2826b8c7008ff75 Mon Sep 17 00:00:00 2001
From: Yuta Saito <kateinoigakukun@g...>
Date: Thu, 28 Oct 2021 15:48:45 +0900
Subject: Split thread-model config into another ac file

This is a first step to allow the thread-model implementation to be
switched by configure's option
---
 configure.ac           | 11 ++---------
 tool/m4/ruby_thread.m4 | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 9 deletions(-)
 create mode 100644 tool/m4/ruby_thread.m4

diff --git a/configure.ac b/configure.ac
index 490fe5d94aa..a205064cea1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,7 @@ m4_include([tool/m4/ruby_replace_type.m4])dnl https://github.com/ruby/ruby/blob/trunk/configure.ac#L37
 m4_include([tool/m4/ruby_rm_recursive.m4])dnl
 m4_include([tool/m4/ruby_setjmp_type.m4])dnl
 m4_include([tool/m4/ruby_stack_grow_direction.m4])dnl
+m4_include([tool/m4/ruby_thread.m4])dnl
 m4_include([tool/m4/ruby_try_cflags.m4])dnl
 m4_include([tool/m4/ruby_try_cxxflags.m4])dnl
 m4_include([tool/m4/ruby_try_ldflags.m4])dnl
@@ -3697,9 +3698,6 @@ AC_ARG_ENABLE(install-static-library, https://github.com/ruby/ruby/blob/trunk/configure.ac#L3698
 	    [INSTALL_STATIC_LIBRARY=yes]))
 AC_SUBST(INSTALL_STATIC_LIBRARY)
 
-AS_IF([test "$rb_with_pthread" = "yes"], [
-    THREAD_MODEL=pthread
-])
 AC_CACHE_CHECK([for prefix of external symbols], rb_cv_symbol_prefix, [
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[extern void conftest_external(void) {}]], [[]])],[
 	rb_cv_symbol_prefix=`$NM conftest.$ac_objext |
@@ -3773,7 +3771,6 @@ AS_CASE(["$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L3771
 	    COMMON_LIBS=m
 #	    COMMON_MACROS="WIN32_LEAN_AND_MEAN="
 	    COMMON_HEADERS="winsock2.h windows.h"
-	    THREAD_MODEL=win32
 	    PLATFORM_DIR=win32
 	    ])
 	LIBRUBY_ALIASES=''
@@ -3795,11 +3792,7 @@ AS_CASE(["$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L3792
 
 MINIOBJS="$MINIDLNOBJ"
 
-AS_CASE(["$THREAD_MODEL"],
-[pthread], [AC_CHECK_HEADERS(pthread.h)],
-[win32],   [],
-[""],      [AC_MSG_ERROR(thread model is missing)],
-           [AC_MSG_ERROR(unknown thread model $THREAD_MODEL)])
+RUBY_THREAD
 
 AC_ARG_ENABLE(debug-env,
        AS_HELP_STRING([--enable-debug-env], [enable RUBY_DEBUG environment variable]),
diff --git a/tool/m4/ruby_thread.m4 b/tool/m4/ruby_thread.m4
new file mode 100644
index 00000000000..92d80421f14
--- /dev/null
+++ b/tool/m4/ruby_thread.m4
@@ -0,0 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/tool/m4/ruby_thread.m4#L1
+dnl -*- Autoconf -*-
+AC_DEFUN([RUBY_THREAD], [
+AS_CASE(["$target_os"],
+    [mingw*], [
+        THREAD_MODEL=win32
+    ],
+    [
+        AS_IF([test "$rb_with_pthread" = "yes"], [
+            THREAD_MODEL=pthread
+        ])
+    ]
+)
+
+AS_CASE(["$THREAD_MODEL"],
+[pthread], [AC_CHECK_HEADERS(pthread.h)],
+[win32],   [],
+[""],      [AC_MSG_ERROR(thread model is missing)],
+           [AC_MSG_ERROR(unknown thread model $THREAD_MODEL)])
+])dnl
-- 
cgit v1.2.1


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

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