2 dnl Copyright (C) 2019-2020 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_THRD_JOIN],
9 AC_REQUIRE([gl_THREADS_H])
10 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12 if test $ac_cv_header_threads_h = yes; then
13 if test $BROKEN_THRD_START_T = 1; then
15 REPLACE_THRD_CURRENT=1
19 AC_DEFINE([BROKEN_THRD_START_T], [1],
20 [Define if the thrd_start_t type is not as described in ISO C 11.])
23 dnl On Solaris 11.4, thrd_join crashes when the second argument is NULL.
24 AC_CACHE_CHECK([whether thrd_join works],
25 [gl_cv_func_thrd_join_works],
27 LIBS="$LIBS $LIBSTDTHREAD"
32 static int func (void *arg)
38 if (thrd_create (&thread, func, NULL) != thrd_success)
40 if (thrd_join (thread, NULL) != thrd_success)
44 [gl_cv_func_thrd_join_works=yes],
45 [gl_cv_func_thrd_join_works=no],
47 # Only Solaris is known to be broken.
48 solaris*) gl_cv_func_thrd_join_works="guessing no" ;;
49 *) gl_cv_func_thrd_join_works="guessing yes" ;;
54 case "$gl_cv_func_thrd_join_works" in
58 AC_DEFINE([BROKEN_THRD_JOIN], [1],
59 [Define if the thrd_join function does not behave as in ISO C 11.])