+2023-11-08 Bruno Haible <bruno@clisp.org>
+
+ pthread-rwlock: Port to Mac OS X 10.4.
+ Reported by Sevan Janiyan <venture37@geeklan.co.uk>.
+ * m4/pthread-rwlock.m4 (gl_PTHREAD_RWLOCK): On macOS, test for the
+ presence of PTHREAD_RWLOCK_INITIALIZER. If it is not defined, don't
+ attempt to use pthread_rwlock_init.
+
2023-10-24 Paul Eggert <eggert@cs.ucla.edu>
tests/unistr/u16-chr-tests: pacify -Wcast-align
-# pthread-rwlock.m4 serial 2
+# pthread-rwlock.m4 serial 2.1
dnl Copyright (C) 2019-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
HAVE_PTHREAD_RWLOCK_UNLOCK=0
HAVE_PTHREAD_RWLOCK_DESTROY=0
else
+ dnl On Mac OS X 10.4, the pthread_rwlock_* functions exist but are not
+ dnl usable because PTHREAD_RWLOCK_INITIALIZER is not defined.
dnl On Android 4.3, the pthread_rwlock_* functions are declared in
dnl <pthread.h> but don't exist in libc.
AC_CACHE_CHECK([for pthread_rwlock_init],
[gl_cv_func_pthread_rwlock_init],
- [saved_LIBS="$LIBS"
- LIBS="$LIBS $LIBPMULTITHREAD"
- AC_LINK_IFELSE(
- [AC_LANG_SOURCE(
- [[extern
- #ifdef __cplusplus
- "C"
- #endif
- int pthread_rwlock_init (void);
- int main ()
- {
- return pthread_rwlock_init ();
- }
- ]])],
- [gl_cv_func_pthread_rwlock_init=yes],
- [gl_cv_func_pthread_rwlock_init=no])
- LIBS="$saved_LIBS"
+ [case "$host_os" in
+ darwin*)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#include <pthread.h>
+ pthread_rwlock_t l = PTHREAD_RWLOCK_INITIALIZER;
+ ]])],
+ [gl_cv_func_pthread_rwlock_init=yes],
+ [gl_cv_func_pthread_rwlock_init=no])
+ ;;
+ *)
+ saved_LIBS="$LIBS"
+ LIBS="$LIBS $LIBPMULTITHREAD"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(
+ [[extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ int pthread_rwlock_init (void);
+ int main ()
+ {
+ return pthread_rwlock_init ();
+ }
+ ]])],
+ [gl_cv_func_pthread_rwlock_init=yes],
+ [gl_cv_func_pthread_rwlock_init=no])
+ LIBS="$saved_LIBS"
+ ;;
+ esac
])
if test $gl_cv_func_pthread_rwlock_init = no; then
REPLACE_PTHREAD_RWLOCK_INIT=1