diff --git a/src/configure.in b/src/configure.in
index ef6caa3cc0106dfeea04efdf2cf006f0bcadffa5..e0d3c1a322c9da798312cb73529ad56301706f0b 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.21 1996/11/18 23:09:40 hubbe Exp $
+# $Id: configure.in,v 1.22 1996/11/19 10:04:30 neotron Exp $
 
 AC_INIT(interpret.c)
 
@@ -374,6 +374,7 @@ if test $pike_cv_posix_threads = yes ; then
   AC_DEFINE(_REENTRANT)
   AC_DEFINE(_THREAD_SAFE)
   AC_DEFINE(_MIT_POSIX_THREADS)
+  AC_CHECK_FUNCS(pthread_attr_setstacksize)
 else
   AC_MSG_RESULT(no)
   LIBS="$OLDLIBS"
diff --git a/src/machine.h.in b/src/machine.h.in
index 46567089dd6d6edb4bedc685e9c7845b3e062a2c..496bc84a412ff1af1e27c920f57366445682570f 100644
--- a/src/machine.h.in
+++ b/src/machine.h.in
@@ -339,6 +339,10 @@
 #undef _THREAD_SAFE
 #undef _MIT_POSIX_THREADS
 
+/* Define this if you have pthread_attr_setstacksize() */
+#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
+
+
 /* Define this if you have dlopen() */
 #undef HAVE_DLOPEN
 
diff --git a/src/threads.c b/src/threads.c
index f683cbe6cb61a1db95d698dc4b410c19ec5721cf..9e6c59d973ae4b163493c5d13dcc3bb8daadac03 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: threads.c,v 1.11 1996/11/17 01:57:49 hubbe Exp $");
+RCSID("$Id: threads.c,v 1.12 1996/11/19 10:04:29 neotron Exp $");
 
 int num_threads = 1;
 int threads_disabled = 0;
@@ -124,7 +124,9 @@ void th_init()
 {
   mt_lock( & interpreter_lock);
   pthread_attr_init(&pattr);
+#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
   pthread_attr_setstacksize(&pattr, 2 * 1024 * 1204);
+#endif
   pthread_attr_setdetachstate(&pattr, PTHREAD_CREATE_DETACHED);
 
   add_efun("thread_create",f_thread_create,"function(mixed ...:int)",OPT_SIDE_EFFECT);