From eec1377ee8f36bb1c60fe445b7bcad67e9ec76e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Sat, 2 Nov 1996 22:22:59 -0800
Subject: [PATCH] --without-threads added

Rev: src/README:1.3
Rev: src/configure.in:1.12
Rev: src/machine.h.in:1.10
---
 src/README       |  4 +++-
 src/configure.in | 10 ++++++++++
 src/machine.h.in |  1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/README b/src/README
index 0762833600..c1a4905c7e 100644
--- a/src/README
+++ b/src/README
@@ -10,6 +10,7 @@ This is what you need to do to install Pike:
   --without-gmp       compile without gmp support
   --without-readline  compile without readline support
   --without-debug     compile without runtime debugging
+  --without-threads   compile without threads support
 
    You might also want to set the following environment variables:
    CFLAGS     Put extra flags for your C compiler here.
@@ -60,7 +61,8 @@ What to do when it doesn't work:
 
 5) Your gmp/readline/gdbm libraries might not be working or incorrectly 
    installed, start over by running configure with the approperiate
-   --without-xxx arguments.
+   --without-xxx arguments. Also note that threads might give problems
+   with I/O and signals. If so you need to run configure --without-threads.
 
 6) Try a different compiler, malloc, compiler-compiler and/or make.
    (if you have any other)
diff --git a/src/configure.in b/src/configure.in
index 7b0c0478c3..c54f3d5da3 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -13,6 +13,7 @@ AC_ARG_WITH(gdbm,    [  --without-gdbm         no GNU database manager support ]
 AC_ARG_WITH(gmp,     [  --without-gmp          no Support bignums])
 AC_ARG_WITH(readline,[  --without-readline     no support for command line editing])
 AC_ARG_WITH(debug,   [  --without-debug        disable run time self tests],[],[with_debug=yes])
+AC_ARG_WITH(threads, [  --without-threads      no threads support],[],[with_threads=yes])
 
 if test x$with_debug = xyes ; then
   AC_DEFINE(DEBUG)
@@ -294,6 +295,8 @@ AC_CHECK_LIB(crypt, crypt)
 
 ########################################################################
 
+if test x$with_threads = xyes ; then
+
 AC_MSG_CHECKING(posix threads)
 
 OLDLIBS="$LIBS"
@@ -311,6 +314,10 @@ esac
 AC_CACHE_VAL(pike_cv_posix_threads,
 [
 AC_TRY_RUN([
+#define _REENTRANT
+#define _THREAD_SAFE
+#define _MIT_POSIX_THREADS
+
 #include <pthread.h>
 
 void *foo(void *bar) { return ; }
@@ -332,11 +339,14 @@ if test $pike_cv_posix_threads = yes ; then
   AC_MSG_RESULT(yes)
   AC_DEFINE(_REENTRANT)
   AC_DEFINE(_THREAD_SAFE)
+  AC_DEFINE(_MIT_POSIX_THREADS)
 else
   AC_MSG_RESULT(no)
   LIBS="$OLDLIBS"
 fi
 
+fi
+
 ########################################################################
 
 AC_FUNC_MEMCMP
diff --git a/src/machine.h.in b/src/machine.h.in
index 42435a736a..46567089dd 100644
--- a/src/machine.h.in
+++ b/src/machine.h.in
@@ -337,6 +337,7 @@
 /* Define this if you are going to use threads */
 #undef _REENTRANT
 #undef _THREAD_SAFE
+#undef _MIT_POSIX_THREADS
 
 /* Define this if you have dlopen() */
 #undef HAVE_DLOPEN
-- 
GitLab