Do the Windows oldnames workaround through the C++ GNULIB_NAMESPACE.
[gnulib.git] / m4 / pthread-spin.m4
blobdc92f7bfa8e6ed817e52e45529607cd69d1542a1
1 # pthread-spin.m4 serial 2
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_PTHREAD_SPIN],
9   AC_REQUIRE([gl_PTHREAD_H])
10   AC_REQUIRE([AC_CANONICAL_HOST])
12   if { case "$host_os" in mingw*) true;; *) false;; esac; } \
13      && test $gl_threads_api = windows; then
14     dnl Choose function names that don't conflict with the mingw-w64 winpthreads
15     dnl library.
16     REPLACE_PTHREAD_SPIN_INIT=1
17     REPLACE_PTHREAD_SPIN_LOCK=1
18     REPLACE_PTHREAD_SPIN_TRYLOCK=1
19     REPLACE_PTHREAD_SPIN_UNLOCK=1
20     REPLACE_PTHREAD_SPIN_DESTROY=1
21   else
22     if test $HAVE_PTHREAD_H = 0 || test $HAVE_PTHREAD_SPINLOCK_T = 0; then
23       HAVE_PTHREAD_SPIN_INIT=0
24       HAVE_PTHREAD_SPIN_LOCK=0
25       HAVE_PTHREAD_SPIN_TRYLOCK=0
26       HAVE_PTHREAD_SPIN_UNLOCK=0
27       HAVE_PTHREAD_SPIN_DESTROY=0
28     fi
29   fi