From 85f51dea1cde7e5f4e5d8a5c8d73d9ffb1559a4b Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Fri, 19 Dec 2003 23:29:15 +0000
Subject: [PATCH] Supress ecpg thread test if configure didn't enable threads. 
 Fix tools/thread to run even if configure didn't enable threads because this
 test is used before enabling threads for the OS.

---
 src/Makefile.global.in            | 4 ++--
 src/interfaces/ecpg/test/Makefile | 7 +++++--
 src/tools/thread/thread_test.c    | 5 +----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 39faac0a303..68c3bf80788 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1,5 +1,5 @@
 # -*-makefile-*-
-# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.171 2003/11/29 19:51:39 pgsql Exp $
+# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.172 2003/12/19 23:29:15 momjian Exp $
 
 #------------------------------------------------------------------------------
 # All PostgreSQL makefiles include this file and use the variables it sets,
@@ -121,7 +121,6 @@ localedir := @localedir@
 #
 # Records the choice of the various --enable-xxx and --with-xxx options.
 
-with_threads	= @with_threads@
 with_java	= @with_java@
 with_perl	= @with_perl@
 with_python	= @with_python@
@@ -131,6 +130,7 @@ enable_shared	= @enable_shared@
 enable_rpath	= @enable_rpath@
 enable_nls	= @enable_nls@
 enable_debug	= @enable_debug@
+enable_thread_safety	= @enable_thread_safety@
 
 python_includespec	= @python_includespec@
 python_libspec		= @python_libspec@
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index efde4c09282..896f590f121 100644
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.42 2003/11/29 19:52:09 pgsql Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/test/Makefile,v 1.43 2003/12/19 23:29:15 momjian Exp $
 
 subdir = src/interfaces/ecpg/test
 top_builddir = ../../../..
@@ -8,7 +8,10 @@ override CPPFLAGS := -I$(srcdir)/../include -I$(libpq_srcdir) $(CPPFLAGS) $(THRE
 
 ECPG = ../preproc/ecpg -I$(srcdir)/../include
 
-TESTS = test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100 test_init testdynalloc num_test dt_test test_informix test_thread
+TESTS = test1 test2 test3 test4 perftest dyntest dyntest2 test_notice test_code100 test_init testdynalloc num_test dt_test test_informix
+ifeq ($(enable_thread_safety), yes)
+TESTS += test_thread
+endif
 
 all: $(TESTS)
 
diff --git a/src/tools/thread/thread_test.c b/src/tools/thread/thread_test.c
index 095961cb874..654bb155f5c 100644
--- a/src/tools/thread/thread_test.c
+++ b/src/tools/thread/thread_test.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.5 2003/11/29 19:52:14 pgsql Exp $
+ *	$PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.6 2003/12/19 23:29:15 momjian Exp $
  *
  *	This program tests to see if your standard libc functions use
  *	pthread_setspecific()/pthread_getspecific() to be thread-safe.
@@ -20,10 +20,7 @@
  *-------------------------------------------------------------------------
  */
 
-
-#ifdef ENABLE_THREAD_SAFETY
 #include <pthread.h>
-#endif
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
-- 
GitLab