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

See patch-aa.

--- configure.orig	Wed Jul 27 08:46:21 2011
+++ configure
@@ -14431,43 +14431,18 @@ $as_echo "#define XUSE_MTSAFE_API 1" >>c
 	;;
 esac
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lc" >&5
-$as_echo_n "checking for pthread_self in -lc... " >&6; }
-if test "${ac_cv_lib_c_pthread_self+set}" = set; then :
-  $as_echo_n "(cached) " >&6
+ac_fn_c_check_decl "$LINENO" "pthread_self" "ac_cv_have_decl_pthread_self" "#include <pthread.h>
+"
+if test "x$ac_cv_have_decl_pthread_self" = x""yes; then :
+  ac_have_decl=1
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  ac_have_decl=0
+fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char pthread_self ();
-int
-main ()
-{
-return pthread_self ();
-  ;
-  return 0;
-}
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PTHREAD_SELF $ac_have_decl
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_c_pthread_self=yes
-else
-  ac_cv_lib_c_pthread_self=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_pthread_self" >&5
-$as_echo "$ac_cv_lib_c_pthread_self" >&6; }
-if test "x$ac_cv_lib_c_pthread_self" = x""yes; then :
+if test $ac_have_decl = 1; then :
   thrstubs="no"
 else
   thrstubs="yes"
@@ -14487,12 +14462,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" ;;
