Debian Codegraph @

m4/lock.m4

raw
1 # lock.m4
2 # serial 14
3 dnl Copyright (C) 2005-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 dnl From Bruno Haible.
10
11 AC_DEFUN([gl_LOCK],
12 [
13 AC_REQUIRE([gl_THREADLIB])
14 if test "$gl_threads_api" = posix; then
15 # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the
16 # pthread_rwlock_* functions.
17 has_rwlock=false
18 AC_CHECK_TYPE([pthread_rwlock_t],
19 [has_rwlock=true
20 AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1],
21 [Define if the POSIX multithreading library has read/write locks.])],
22 [],
23 [#include <pthread.h>])
24 if $has_rwlock; then
25 gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER
26 fi
27 # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
28 AC_COMPILE_IFELSE([
29 AC_LANG_PROGRAM(
30 [[#include <pthread.h>]],
31 [[
32 #if __FreeBSD__ == 4
33 error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
34 #elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \
35 && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070)
36 error "No, in Mac OS X < 10.7 recursive mutexes actually don't work."
37 #else
38 int x = (int)PTHREAD_MUTEX_RECURSIVE;
39 return !x;
40 #endif
41 ]])],
42 [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1],
43 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
44 fi
45 gl_PREREQ_LOCK
46 ])
47
48 # Prerequisites of lib/glthread/lock.c.
49 AC_DEFUN([gl_PREREQ_LOCK], [:])