setlocale-null: Remove need for -lpthread on musl libc, *BSD, Haiku.
commit6be2862414da45975b8cbc33acc5387b012f3354
authorBruno Haible <bruno@clisp.org>
Mon, 16 Dec 2019 09:38:37 +0000 (16 10:38 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 16 Dec 2019 09:44:58 +0000 (16 10:44 +0100)
tree314f7a5917195baa3cb4de3efb547eb18d16803c
parentecb700c1c897e01f1c97f2f23c12ecb0d3658eba
setlocale-null: Remove need for -lpthread on musl libc, *BSD, Haiku.

Reported by Arnold Robbins <arnold@skeeve.com>.

* lib/setlocale_null.c (c11_threads_in_use, pthread_in_use): New macros,
copied from lib/glthread/lock.h.
(pthread_mutex_lock, pthread_mutex_unlock): Mark as weak.
(setlocale_null_with_lock): If pthread_in_use() is false, use
setlocale_null_unlocked directly.
* m4/threadlib.m4 (gl_WEAK_SYMBOLS): New macro, extracted from
gl_THREADLIB_BODY. Define HAVE_WEAK_SYMBOLS.
(gl_THREADLIB_BODY): Invoke gl_WEAK_SYMBOLS.
* m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Invoke gl_WEAK_SYMBOLS.
Set LIB_SETLOCALE_NULL to empty if weak symbols are supported.
* m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Add comment.
ChangeLog
lib/setlocale_null.c
m4/duplocale.m4
m4/setlocale_null.m4
m4/threadlib.m4