Skip to content

Commit

Permalink
Split thread-model config into another ac file
Browse files Browse the repository at this point in the history
This is a first step to allow the thread-model implementation to be
switched by configure's option
  • Loading branch information
kateinoigakukun authored and mame committed Oct 30, 2021
1 parent 6c812c6 commit ccda26e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
11 changes: 2 additions & 9 deletions configure.ac
Expand Up @@ -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
Expand Down Expand Up @@ -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 |
Expand Down Expand Up @@ -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=''
Expand All @@ -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]),
Expand Down
19 changes: 19 additions & 0 deletions 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

0 comments on commit ccda26e

Please sign in to comment.