lock.m4 1.4 KB

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