1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/m4/ruby_thread.m4
Yuta Saito 420622b5a7 [wasm] add no thread variant for freestanding environment
This implementation does nothing around preemptive context switching
because there is no native thread.
2022-01-19 11:19:06 +09:00

37 lines
1.1 KiB
Text

dnl -*- Autoconf -*-
AC_DEFUN([RUBY_THREAD], [
AC_ARG_WITH(thread,
AS_HELP_STRING([--with-thread=IMPLEMENTATION], [specify the thread implementation to use]),
[THREAD_MODEL=$withval], [
THREAD_MODEL=
AS_CASE(["$target_os"],
[mingw*], [
THREAD_MODEL=win32
],
[wasi*], [
THREAD_MODEL=none
],
[
AS_IF([test "$rb_with_pthread" = "yes"], [
THREAD_MODEL=pthread
])
]
)
])
AS_CASE(["$THREAD_MODEL"],
[pthread], [AC_CHECK_HEADERS(pthread.h)],
[win32], [],
[none], [],
[""], [AC_MSG_ERROR(thread model is missing)],
[AC_MSG_ERROR(unknown thread model $THREAD_MODEL)])
THREAD_IMPL_H=thread_$THREAD_MODEL.h
AS_IF([test ! -f "$srcdir/$THREAD_IMPL_H"],
[AC_MSG_ERROR('$srcdir/$THREAD_IMPL_H' must exist)])
THREAD_IMPL_SRC=thread_$THREAD_MODEL.c
AS_IF([test ! -f "$srcdir/$THREAD_IMPL_SRC"],
[AC_MSG_ERROR('$srcdir/$THREAD_IMPL_SRC' must exist)])
AC_DEFINE_UNQUOTED(THREAD_IMPL_H, ["$THREAD_IMPL_H"])
AC_DEFINE_UNQUOTED(THREAD_IMPL_SRC, ["$THREAD_IMPL_SRC"])
])dnl