Branch
Hash :
d941c98d
Author :
Date :
2025-09-21T02:11:03
pthread-once: Reduce link dependencies. Linking with -lpthread is not needed on musl libc, macOS, NetBSD, Solaris, Cygwin, Haiku, Android. Reported by Michael Osipov <michael.osipov@innomotics.com> and Tijl Coosemans <tijl@FreeBSD.org> in <https://lists.gnu.org/archive/html/bug-gettext/2025-09/msg00019.html>. * m4/pthread-once.m4 (gl_PTHREAD_ONCE): Require gl_PTHREADLIB. Set PTHREAD_ONCE_LIB. * modules/pthread-once (Link): Link with $(PTHREAD_ONCE_LIB) instead of $(LIBPMULTITHREAD). * modules/pthread-once-tests (Makefile.am): Update accordingly.
Files:
tests/test-pthread-once1.c
tests/test-pthread-once2.c
tests/macros.h
Depends-on:
pthread-thread
pthread-mutex
pthread-rwlock
sched_yield
configure.ac:
AC_CHECK_DECLS_ONCE([alarm])
Makefile.am:
TESTS += test-pthread-once1 test-pthread-once2
check_PROGRAMS += test-pthread-once1 test-pthread-once2
test_pthread_once1_LDADD = $(LDADD) @PTHREAD_ONCE_LIB@
test_pthread_once2_LDADD = $(LDADD) @LIBPMULTITHREAD@ @SCHED_YIELD_LIB@