From ccda26efe7c6acf7edd1262dd2826b8c7008ff75 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 28 Oct 2021 15:48:45 +0900 Subject: [PATCH] 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 490fe5d94a..a205064cea 100644 --- a/configure.ac +++ b/configure.ac @@ -37,6 +37,7 @@ m4_include([tool/m4/ruby_replace_type.m4])dnl 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, [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"], 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"], 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 0000000000..92d80421f1 --- /dev/null +++ b/tool/m4/ruby_thread.m4 @@ -0,0 +1,19 @@ +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