lock.m4 1.2 KB
Newer Older
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
1 2
# lock.m4 serial 10 (gettext-0.18)
dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
3 4 5 6 7 8
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl From Bruno Haible.

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
9
AC_DEFUN([gl_LOCK],
10
[
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
11 12 13 14 15 16 17 18 19 20 21 22
  AC_REQUIRE([gl_THREADLIB])
  if test "$gl_threads_api" = posix; then
    # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the
    # pthread_rwlock_* functions.
    AC_CHECK_TYPE([pthread_rwlock_t],
      [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1],
         [Define if the POSIX multithreading library has read/write locks.])],
      [],
      [#include <pthread.h>])
    # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
    AC_TRY_COMPILE([#include <pthread.h>],
      [#if __FreeBSD__ == 4
23 24 25 26 27
error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
#else
int x = (int)PTHREAD_MUTEX_RECURSIVE;
return !x;
#endif],
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
28 29
      [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1],
         [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
30 31 32 33 34 35 36 37
  fi
  gl_PREREQ_LOCK
])

# Prerequisites of lib/lock.c.
AC_DEFUN([gl_PREREQ_LOCK], [
  AC_REQUIRE([AC_C_INLINE])
])