$NetBSD: patch-aa,v 1.14 2022/07/26 02:19:03 gutteridge Exp $

Include pthread.h as thread stubs might be macros like on NetBSD.

Define conditional for cross-compiling support.

Indicate whether the thread safety constructor is enabled. (This can cause
issues with X clients that aren't coded correctly.)
https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/149

--- configure.ac.orig	2022-06-09 01:06:45.000000000 +0000
+++ configure.ac
@@ -222,7 +222,7 @@ xyes)
 	;;
 esac
 
-AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"])
+AC_CHECK_DECLS([pthread_self], [thrstubs="no"], [thrstubs="yes"], [[#include <pthread.h>]])
 AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes)
 
 # XXX incomplete, please fill this in
@@ -231,12 +231,12 @@ if test x$xthreads = xyes ; then
     linux*|gnu*|k*bsd*-gnu)
         XTHREADLIB=-lpthread ;;
     netbsd*)
-	XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS"
-	XTHREADLIB="-lpthread" ;;
+	XTHREAD_CFLAGS="-D_REENTRANT"
+	XTHREADLIB="-pthread" ;;
     freebsd*)
         XTHREAD_CFLAGS="-D_THREAD_SAFE"
         XTHREADLIB="-pthread" ;;
-    dragonfly*|openbsd*)
+    dragonfly*|openbsd*|mirbsd*)
         XTHREADLIB="-pthread" ;;
     solaris*)
 	XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;;
@@ -437,6 +437,7 @@ echo " Loadable i18n module support:
 echo " Loadable xcursor library support:        "$XLIB_LOADABLE_XCURSOR
 echo " Threading support:                       "$xthreads
 echo " Use Threads safe API:                    "$mtsafeapi
+echo " Use thread safety constructor:           "$USE_THREAD_SAFETY_CONSTRUCTOR
 echo " Threads stubs in libX11:                 "$thrstubs
 echo " XCMS:                                    "$XCMS
 echo " Internationalization support:            "$XLOCALE
