]> granicus.if.org Git - postgresql/blobdiff - configure
Do thread testing from configure in a much cleaner fashion.
[postgresql] / configure
index bb9ea95243d7d504bfb4dd450aef612d9f628455..24fa0328d4431c2803ecb705afb4683be75b5ab9 100755 (executable)
--- a/configure
+++ b/configure
 done
 
 
+# Thread testing
+
+# We have to run the thread test near the end so we have all our symbols
+# defined.  Cross compiling throws a warning.
+#
+if test "$enable_thread_safety" = 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
+
+_CFLAGS="$CFLAGS"
+_LIBS="$LIBS"
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS -DIN_CONFIGURE"
+LIBS="$LIBS $PTHREAD_LIBS"
+if test "$cross_compiling" = yes; then
+  echo "$as_me:$LINENO: result: maybe" >&5
+echo "${ECHO_T}maybe" >&6
+  { echo "$as_me:$LINENO: WARNING:
+*** Skipping thread test program because of cross-compile build.
+*** Run the program in 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 src/tools/thread on the target matchine.
+" >&2;}
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include "src/tools/thread/thread_test.c"
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  { { echo "$as_me:$LINENO: error: Thread test program failed.  Your platform is not thread-safe.  See 'config.log" >&5
+echo "$as_me: error: Thread test program failed.  Your platform is not thread-safe.  See 'config.log" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+CFLAGS="$_CFLAGS"
+LIBS="$_LIBS"
+fi
 
 # prepare build tree if outside source tree
 # Note 1: test -ef might not exist, but it's more reliable than `pwd`.
@@ -19112,105 +19171,3 @@ if test "$no_create" != yes; then
   $ac_cs_success || { (exit 1); exit 1; }
 fi
 
-
-# Check for gmake.
-for ac_prog in gmake make
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_MAKE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$MAKE"; then
-  ac_cv_prog_MAKE="$MAKE" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_MAKE="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-fi
-fi
-MAKE=$ac_cv_prog_MAKE
-if test -n "$MAKE"; then
-  echo "$as_me:$LINENO: result: $MAKE" >&5
-echo "${ECHO_T}$MAKE" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$MAKE" && break
-done
-
-if ! $MAKE -v | grep 'GNU Make' >/dev/null
-then   rm -f $srcdir/src/Makefile.global
-       echo "$as_me:$LINENO: checking Can not find GNU Make.  It is required." >&5
-echo $ECHO_N "checking Can not find GNU Make.  It is required.... $ECHO_C" >&6
-fi
-
-# Thread testing
-
-# 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
-#
-# 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).
-#
-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
-if ! $MAKE -C src/tools/thread clean >&5
-then   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; }; }
-fi
-if ! $MAKE -C src/tools/thread >&5
-then   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; }; }
-fi
-if ! src/tools/thread/thread_test >&5
-then   rm -f src/Makefile.global
-       echo "no"
-       echo
-       src/tools/thread/thread_test
-       echo
-       { { echo "$as_me:$LINENO: error: Thread test program failed.  Your platform is not thread-safe." >&5
-echo "$as_me: error: Thread test program failed.  Your platform is not thread-safe." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if ! $MAKE -C src/tools/thread clean >&5
-then   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; }; }
-fi
-echo "yes"
-else
-{ echo "$as_me:$LINENO: WARNING:
-*** Skipping thread test program because of cross-compile build.
-*** Run the program in 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 src/tools/thread on the target matchine.
-" >&2;}
-fi
-fi