summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Heimpold <mhei@heimpold.de>2014-12-22 11:12:12 +0800
committerDaniel Veillard <veillard@redhat.com>2014-12-22 11:12:12 +0800
commitfff8a6b87e05200a0ad0af6f86c2e859c7de9172 (patch)
tree4f45b3284684e7567afa87ef243c8d742a2ec874
parentf54d6a929af2a570396f0595a0e29064c908c12e (diff)
downloadlibxml2-fff8a6b87e05200a0ad0af6f86c2e859c7de9172.tar.gz
threads: use forward declarations only for glibc
Fixes bug #704908 The declarations of pthread functions, used to generate weak references to them, fail to suppress macros. Thus, if any pthread function has been provided as a macro, compiling threads.c will fail. This breaks on musl libc, which defines pthread_equal as a macro (in addition to providing the function, as required). Prevent the declarations for e.g. musl libc by refining the condition. The idea for this solution was borrowed from the alpine linux guys, see http://git.alpinelinux.org/cgit/aports/tree/main/libxml2/libxml2-pthread.patch Signed-off-by: Michael Heimpold <mhei@heimpold.de>
-rw-r--r--threads.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/threads.c b/threads.c
index 8921204b..78006a2b 100644
--- a/threads.c
+++ b/threads.c
@@ -47,7 +47,7 @@
#ifdef HAVE_PTHREAD_H
static int libxml_is_threaded = -1;
-#ifdef __GNUC__
+#if defined(__GNUC__) && defined(__GLIBC__)
#ifdef linux
#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
extern int pthread_once (pthread_once_t *__once_control,
@@ -89,7 +89,7 @@ extern int pthread_cond_signal ()
__attribute((weak));
#endif
#endif /* linux */
-#endif /* __GNUC__ */
+#endif /* defined(__GNUC__) && defined(__GLIBC__) */
#endif /* HAVE_PTHREAD_H */
/*