2021-10-28 02:48:45 -04:00
|
|
|
dnl -*- Autoconf -*-
|
|
|
|
AC_DEFUN([RUBY_THREAD], [
|
2021-10-28 08:08:35 -04:00
|
|
|
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
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AS_IF([test "$rb_with_pthread" = "yes"], [
|
|
|
|
THREAD_MODEL=pthread
|
|
|
|
])
|
|
|
|
]
|
|
|
|
)
|
|
|
|
])
|
2021-10-28 02:48:45 -04:00
|
|
|
|
|
|
|
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)])
|
2021-10-28 02:51:40 -04:00
|
|
|
|
|
|
|
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"])
|
2021-10-28 02:48:45 -04:00
|
|
|
])dnl
|