wine_pthread_init_thread: retrieve the stack info on Darwin.
diff --git a/configure b/configure
index e3083ff..9e8591c 100755
--- a/configure
+++ b/configure
@@ -11133,7 +11133,13 @@
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LIBPTHREAD"
-for ac_func in pthread_getattr_np
+
+
+for ac_func in \
+ pthread_getattr_np \
+ pthread_get_stackaddr_np \
+ pthread_get_stacksize_np \
+
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
diff --git a/configure.ac b/configure.ac
index 9e0a42f..2a2619e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -548,10 +548,14 @@
AC_CHECK_TYPES([pthread_rwlock_t, pthread_rwlockattr_t],,,[#define _GNU_SOURCE
#include <pthread.h>])
-dnl **** Check for pthread_getattr_np ****
+dnl **** Check for pthread functions ****
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LIBPTHREAD"
-AC_CHECK_FUNCS(pthread_getattr_np)
+AC_CHECK_FUNCS(\
+ pthread_getattr_np \
+ pthread_get_stackaddr_np \
+ pthread_get_stacksize_np \
+)
LIBS="$ac_save_LIBS"
dnl **** Check for Open Sound System ****
diff --git a/include/config.h.in b/include/config.h.in
index 9e5302a..feb1905 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -449,6 +449,12 @@
/* Define to 1 if you have the `pthread_getattr_np' function. */
#undef HAVE_PTHREAD_GETATTR_NP
+/* Define to 1 if you have the `pthread_get_stackaddr_np' function. */
+#undef HAVE_PTHREAD_GET_STACKADDR_NP
+
+/* Define to 1 if you have the `pthread_get_stacksize_np' function. */
+#undef HAVE_PTHREAD_GET_STACKSIZE_NP
+
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
diff --git a/loader/pthread.c b/loader/pthread.c
index af3386f..148438b 100644
--- a/loader/pthread.c
+++ b/loader/pthread.c
@@ -69,6 +69,9 @@
pthread_attr_t attr;
pthread_getattr_np( pthread_self(), &attr );
pthread_attr_getstack( &attr, &info->stack_base, &info->stack_size );
+#elif defined(HAVE_PTHREAD_GET_STACKSIZE_NP) && defined(HAVE_PTHREAD_GET_STACKADDR_NP)
+ info->stack_size = pthread_get_stacksize_np(pthread_self());
+ info->stack_base = pthread_get_stackaddr_np(pthread_self());
#else
/* assume that the stack allocation is page aligned */
char dummy;