You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.4 KiB

  1. From e3e04d254fb6bac49a285775b729e28b0500476c Mon Sep 17 00:00:00 2001
  2. From: Michael Heimpold <mhei@heimpold.de>
  3. Date: Sun, 21 Dec 2014 01:03:49 +0100
  4. Subject: [PATCH] threads: use forward declarations only for glibc (fixes
  5. #704908)
  6. The declarations of pthread functions, used to generate weak references
  7. to them, fail to suppress macros. Thus, if any pthread function has
  8. been provided as a macro, compiling threads.c will fail.
  9. This breaks on musl libc, which defines pthread_equal as a macro (in
  10. addition to providing the function, as required).
  11. Prevent the declarations for e.g. musl libc by refining the condition.
  12. The idea for this solution was borrowed from the alpine linux guys, see
  13. http://git.alpinelinux.org/cgit/aports/tree/main/libxml2/libxml2-pthread.patch
  14. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
  15. ---
  16. threads.c | 4 ++--
  17. 1 file changed, 2 insertions(+), 2 deletions(-)
  18. --- a/threads.c
  19. +++ b/threads.c
  20. @@ -47,7 +47,7 @@
  21. #ifdef HAVE_PTHREAD_H
  22. static int libxml_is_threaded = -1;
  23. -#ifdef __GNUC__
  24. +#if defined(__GNUC__) && defined(__GLIBC__)
  25. #ifdef linux
  26. #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
  27. extern int pthread_once (pthread_once_t *__once_control,
  28. @@ -89,7 +89,7 @@ extern int pthread_cond_signal ()
  29. __attribute((weak));
  30. #endif
  31. #endif /* linux */
  32. -#endif /* __GNUC__ */
  33. +#endif /* defined(__GNUC__) && defined(__GLIBC__) */
  34. #endif /* HAVE_PTHREAD_H */
  35. /*