OSDN Git Service

Hook thread_test program run at the end of configure run.
authorBruce Momjian <bruce@momjian.us>
Fri, 23 Apr 2004 23:58:12 +0000 (23:58 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 23 Apr 2004 23:58:12 +0000 (23:58 +0000)
Add test for cross-compiles that they have to run the thread_test
program on the target machine.

configure
configure.in
src/tools/thread/thread_test.c

index 9f1df1e..884fdfa 100755 (executable)
--- a/configure
+++ b/configure
@@ -19111,3 +19111,49 @@ if test "$no_create" != yes; then
   $ac_cs_success || { (exit 1); exit 1; }
 fi
 
+
+#
+# We have to run the thread test here because it is an external program
+# that has to be runable separately for cross-compiling.
+#
+if test "$enable_thread_safety" = yes; then
+if test cross_compiling != yes; then
+echo "$as_me:$LINENO: checking thread safety of required library functions." >&5
+echo $ECHO_N "checking thread safety of required library functions.... $ECHO_C" >&6
+#
+# Clean, compile, run, and clean thread test directory.
+# If test fails for any reason, remove Makefile.global so the user can't
+# compile (to simulate a configure failure).
+#
+gmake -C $srcdir/src/tools/thread clean >&5 ||
+       ( rm -f src/Makefile.global
+         { { echo "$as_me:$LINENO: error: Can not clean thread test directory." >&5
+echo "$as_me: error: Can not clean thread test directory." >&2;}
+   { (exit 1); exit 1; }; })
+gmake -C $srcdir/src/tools/thread >&5 ||
+       ( rm -f src/Makefile.global
+         { { echo "$as_me:$LINENO: error: Can not build thread test proram." >&5
+echo "$as_me: error: Can not build thread test proram." >&2;}
+   { (exit 1); exit 1; }; })
+$srcdir/src/tools/thread/thread_test >&5 ||
+       ( rm -f src/Makefile.global
+         { { echo "$as_me:$LINENO: error: Thread test program failed." >&5
+echo "$as_me: error: Thread test program failed." >&2;}
+   { (exit 1); exit 1; }; })
+gmake -C $srcdir/src/tools/thread clean >&5 ||
+       ( rm -f src/Makefile.global
+         { { echo "$as_me:$LINENO: error: Can not clean thread test directory." >&5
+echo "$as_me: error: Can not clean thread test directory." >&2;}
+   { (exit 1); exit 1; }; })
+echo "yes"
+else
+{ echo "$as_me:$LINENO: WARNING:
+*** Skipping thread test program because of cross-compile build.
+*** Run the program in $srcdir/src/tools/thread on the target matchine.
+" >&5
+echo "$as_me: WARNING:
+*** Skipping thread test program because of cross-compile build.
+*** Run the program in $srcdir/src/tools/thread on the target matchine.
+" >&2;}
+fi
+fi
index 3aadce2..bcf4cb6 100644 (file)
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.324 2004/04/23 18:15:53 momjian Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.325 2004/04/23 23:58:07 momjian Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -1213,3 +1213,36 @@ echo >src/include/stamp-h
 ])
 
 AC_OUTPUT
+
+#
+# We have to run the thread test here because it is an external program
+# that has to be runable separately for cross-compiling.
+#
+if test "$enable_thread_safety" = yes; then
+if test cross_compiling != yes; then
+AC_MSG_CHECKING([thread safety of required library functions.])
+#
+# Clean, compile, run, and clean thread test directory.
+# If test fails for any reason, remove Makefile.global so the user can't
+# compile (to simulate a configure failure).
+#
+gmake -C $srcdir/src/tools/thread clean >&5 ||
+       ( rm -f src/Makefile.global
+         AC_MSG_ERROR([Can not clean thread test directory.]))
+gmake -C $srcdir/src/tools/thread >&5 ||
+       ( rm -f src/Makefile.global
+         AC_MSG_ERROR([Can not build thread test proram.]))
+$srcdir/src/tools/thread/thread_test >&5 ||
+       ( rm -f src/Makefile.global
+         AC_MSG_ERROR([Thread test program failed.]))
+gmake -C $srcdir/src/tools/thread clean >&5 ||
+       ( rm -f src/Makefile.global
+         AC_MSG_ERROR([Can not clean thread test directory.]))
+echo "yes"
+else
+AC_MSG_WARN([
+*** Skipping thread test program because of cross-compile build.
+*** Run the program in $srcdir/src/tools/thread on the target matchine.
+])
+fi
+fi
index 5c68df6..3f59419 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.22 2004/04/23 22:21:49 momjian Exp $
+ *     $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.23 2004/04/23 23:58:12 momjian Exp $
  *
  *     This program tests to see if your standard libc functions use
  *     pthread_setspecific()/pthread_getspecific() to be thread-safe.
@@ -109,7 +109,7 @@ main(int argc, char *argv[])
                sched_yield();                  /* if this is a portability problem,
                                                                 * remove it */
 
-       fprintf(stderr, "Your errno is thread-safe.\n");
+       printf("Your errno is thread-safe.\n");
 
 #ifndef HAVE_STRERROR_R
        if (strerror_p1 != strerror_p2)