$NetBSD: patch-aa,v 1.9 2011/09/15 19:50:14 bsiegert Exp $

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

Define conditional for cross-compiling support.

Also, don't look for keysmydef.h, as this could break cross
builds (from GIT).

--- configure.ac.orig	Wed Aug 11 23:23:48 2010
+++ configure.ac
@@ -315,7 +315,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)
 
 dnl XXX incomplete, please fill this in
@@ -324,12 +324,12 @@ if test x$xthreads = xyes ; then
     linux*|openbsd*|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*)
+    dragonfly*|mirbsd*)
         XTHREADLIB="-pthread" ;;
     solaris*)
 	XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;;
