| 1 |
# pthread-once.m4 |
| 2 |
# serial 3 |
| 3 |
dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
AC_DEFUN([gl_PTHREAD_ONCE], |
| 10 |
[ |
| 11 |
AC_REQUIRE([gl_PTHREAD_H]) |
| 12 |
AC_REQUIRE([AC_CANONICAL_HOST]) |
| 13 |
|
| 14 |
if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ |
| 15 |
&& test $gl_threads_api = windows; then |
| 16 |
dnl Choose function names that don't conflict with the mingw-w64 winpthreads |
| 17 |
dnl library. |
| 18 |
REPLACE_PTHREAD_ONCE=1 |
| 19 |
else |
| 20 |
if test $HAVE_PTHREAD_H = 0; then |
| 21 |
HAVE_PTHREAD_ONCE=0 |
| 22 |
else |
| 23 |
dnl Work around Cygwin 3.5.3 bug. |
| 24 |
AC_CACHE_CHECK([whether pthread_once works], |
| 25 |
[gl_cv_func_pthread_once_works], |
| 26 |
[case "$host_os" in |
| 27 |
cygwin*) gl_cv_func_pthread_once_works="guessing no" ;; |
| 28 |
*) gl_cv_func_pthread_once_works="yes" ;; |
| 29 |
esac |
| 30 |
]) |
| 31 |
case "$gl_cv_func_pthread_once_works" in |
| 32 |
*yes) ;; |
| 33 |
*) REPLACE_PTHREAD_ONCE=1 ;; |
| 34 |
esac |
| 35 |
fi |
| 36 |
fi |
| 37 |
]) |