]> granicus.if.org Git - postgresql/blobdiff - src/tools/thread/thread_test.c
Do thread testing from configure in a much cleaner fashion.
[postgresql] / src / tools / thread / thread_test.c
index 37b3200c13652d4097031aab6bc6ccaedfa93ce9..f0b7d62e4fb7ecf3ea186bf291b5db45e4976f87 100644 (file)
@@ -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.28 2004/04/27 18:40:50 momjian Exp $
+ *     $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.29 2004/04/27 19:51:12 momjian Exp $
  *
  *     This program tests to see if your standard libc functions use
  *     pthread_setspecific()/pthread_getspecific() to be thread-safe.
  *-------------------------------------------------------------------------
  */
 
+#ifndef IN_CONFIGURE
 #include "postgres.h"
+#else
+/* From src/include/c.h" */
+#ifndef bool
+typedef char bool;
+#endif
+
+#ifndef true
+#define true   ((bool) 1)
+#endif
+
+#ifndef false
+#define false  ((bool) 0)
+#endif
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -32,7 +47,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#ifndef ENABLE_THREAD_SAFETY
+#if !defined(ENABLE_THREAD_SAFETY) && !defined(IN_CONFIGURE)
 int
 main(int argc, char *argv[])
 {
@@ -96,6 +111,12 @@ main(int argc, char *argv[])
                return 1;
        }
 
+#ifdef IN_CONFIGURE
+       /* Send stdout to 'config.log' */
+       close(1);
+       dup(5);
+#endif
+       
        /* Make temp filenames, might not have strdup() */
        temp_filename_1 = malloc(strlen(TEMP_FILENAME_1) + 1);
        strcpy(temp_filename_1, TEMP_FILENAME_1);
@@ -339,5 +360,4 @@ func_call_2(void)
        pthread_mutex_lock(&init_mutex);        /* wait for parent to test */
        pthread_mutex_unlock(&init_mutex);
 }
-#endif /* !ENABLE_THREAD_SAFETY */
-
+#endif /* !ENABLE_THREAD_SAFETY && !IN_CONFIGURE */