$NetBSD: patch-ac,v 1.11 2006/05/15 19:01:23 ghen Exp $

--- libraries/libldap_r/thr_posix.c.orig	2006-05-13 11:47:50.000000000 +0200
+++ libraries/libldap_r/thr_posix.c
@@ -19,6 +19,7 @@
 #if defined( HAVE_PTHREADS )
 
 #include <ac/errno.h>
+#include <ac/unistd.h>
 
 #ifdef REPLACE_BROKEN_YIELD
 #ifndef HAVE_NANOSLEEP
@@ -146,9 +147,11 @@ ldap_pvt_thread_create( ldap_pvt_thread_
 #endif
 
 #ifdef LDAP_PVT_THREAD_SET_STACK_SIZE
+#if defined(_POSIX_THREAD_ATTR_STACKSIZE)
 	/* this should be tunable */
 	pthread_attr_setstacksize( &attr, LDAP_PVT_THREAD_STACK_SIZE );
 #endif
+#endif
 
 #if HAVE_PTHREADS > 5
 	detach = detach ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE;
