summaryrefslogtreecommitdiff
path: root/textproc/libxml2/patches/patch-threads.c
blob: 16c2ed343fcb118746b0912a962ab3251f58d481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$NetBSD: patch-threads.c,v 1.4 2013/05/26 09:22:14 adam Exp $

* Treat OpenBSD and MirBSD same as Linux to avoid linking with libpthread
* NetBSD<4.99.36 and FreeBSD<7.0 lack pthread_equal() stub function in libc
* pthread_once_t cast needed to avoid compilation error

--- threads.c.orig	2010-10-15 17:28:30.000000000 +0000
+++ threads.c
@@ -42,13 +42,17 @@
 #include <note.h>
 #endif
 
+#if defined(__NetBSD__)
+#include <sys/param.h>
+#endif
+
 /* #define DEBUG_THREADS */
 
 #ifdef HAVE_PTHREAD_H
 
 static int libxml_is_threaded = -1;
 #ifdef __GNUC__
-#ifdef linux
+#if defined(linux) || defined(__OpenBSD__) || defined(__MirBSD__)
 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
 extern int pthread_once (pthread_once_t *__once_control,
                          void (*__init_routine) (void))
@@ -90,6 +94,10 @@ extern int pthread_cond_signal ()
 #endif
 #endif /* linux */
 #endif /* __GNUC__ */
+#if (defined(__NetBSD__) && __NetBSD_Version__ < 499003600) || (defined(__FreeBSD__) && __FreeBSD_version < 700000)
+extern int pthread_equal ()
+	   __attribute((weak));
+#endif /* NetBSD-4, FreeBSD-6 */
 #endif /* HAVE_PTHREAD_H */
 
 /*