Skip to content

Commit f6646ef

Browse files
committed
Hook thread_test program run at the end of configure run.
Add test for cross-compiles that they have to run the thread_test program on the target machine.
1 parent 95178c8 commit f6646ef

File tree

3 files changed

+82
-3
lines changed

3 files changed

+82
-3
lines changed

configure

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19111,3 +19111,49 @@ if test "$no_create" != yes; then
1911119111
$ac_cs_success || { (exit 1); exit 1; }
1911219112
fi
1911319113

19114+
19115+
#
19116+
# We have to run the thread test here because it is an external program
19117+
# that has to be runable separately for cross-compiling.
19118+
#
19119+
if test "$enable_thread_safety" = yes; then
19120+
if test cross_compiling != yes; then
19121+
echo "$as_me:$LINENO: checking thread safety of required library functions." >&5
19122+
echo $ECHO_N "checking thread safety of required library functions.... $ECHO_C" >&6
19123+
#
19124+
# Clean, compile, run, and clean thread test directory.
19125+
# If test fails for any reason, remove Makefile.global so the user can't
19126+
# compile (to simulate a configure failure).
19127+
#
19128+
gmake -C $srcdir/src/tools/thread clean >&5 ||
19129+
( rm -f src/Makefile.global
19130+
{ { echo "$as_me:$LINENO: error: Can not clean thread test directory." >&5
19131+
echo "$as_me: error: Can not clean thread test directory." >&2;}
19132+
{ (exit 1); exit 1; }; })
19133+
gmake -C $srcdir/src/tools/thread >&5 ||
19134+
( rm -f src/Makefile.global
19135+
{ { echo "$as_me:$LINENO: error: Can not build thread test proram." >&5
19136+
echo "$as_me: error: Can not build thread test proram." >&2;}
19137+
{ (exit 1); exit 1; }; })
19138+
$srcdir/src/tools/thread/thread_test >&5 ||
19139+
( rm -f src/Makefile.global
19140+
{ { echo "$as_me:$LINENO: error: Thread test program failed." >&5
19141+
echo "$as_me: error: Thread test program failed." >&2;}
19142+
{ (exit 1); exit 1; }; })
19143+
gmake -C $srcdir/src/tools/thread clean >&5 ||
19144+
( rm -f src/Makefile.global
19145+
{ { echo "$as_me:$LINENO: error: Can not clean thread test directory." >&5
19146+
echo "$as_me: error: Can not clean thread test directory." >&2;}
19147+
{ (exit 1); exit 1; }; })
19148+
echo "yes"
19149+
else
19150+
{ echo "$as_me:$LINENO: WARNING:
19151+
*** Skipping thread test program because of cross-compile build.
19152+
*** Run the program in $srcdir/src/tools/thread on the target matchine.
19153+
" >&5
19154+
echo "$as_me: WARNING:
19155+
*** Skipping thread test program because of cross-compile build.
19156+
*** Run the program in $srcdir/src/tools/thread on the target matchine.
19157+
" >&2;}
19158+
fi
19159+
fi

configure.in

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.324 2004/04/23 18:15:53 momjian Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.325 2004/04/23 23:58:07 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1213,3 +1213,36 @@ echo >src/include/stamp-h
12131213
])
12141214

12151215
AC_OUTPUT
1216+
1217+
#
1218+
# We have to run the thread test here because it is an external program
1219+
# that has to be runable separately for cross-compiling.
1220+
#
1221+
if test "$enable_thread_safety" = yes; then
1222+
if test cross_compiling != yes; then
1223+
AC_MSG_CHECKING([thread safety of required library functions.])
1224+
#
1225+
# Clean, compile, run, and clean thread test directory.
1226+
# If test fails for any reason, remove Makefile.global so the user can't
1227+
# compile (to simulate a configure failure).
1228+
#
1229+
gmake -C $srcdir/src/tools/thread clean >&5 ||
1230+
( rm -f src/Makefile.global
1231+
AC_MSG_ERROR([Can not clean thread test directory.]))
1232+
gmake -C $srcdir/src/tools/thread >&5 ||
1233+
( rm -f src/Makefile.global
1234+
AC_MSG_ERROR([Can not build thread test proram.]))
1235+
$srcdir/src/tools/thread/thread_test >&5 ||
1236+
( rm -f src/Makefile.global
1237+
AC_MSG_ERROR([Thread test program failed.]))
1238+
gmake -C $srcdir/src/tools/thread clean >&5 ||
1239+
( rm -f src/Makefile.global
1240+
AC_MSG_ERROR([Can not clean thread test directory.]))
1241+
echo "yes"
1242+
else
1243+
AC_MSG_WARN([
1244+
*** Skipping thread test program because of cross-compile build.
1245+
*** Run the program in $srcdir/src/tools/thread on the target matchine.
1246+
])
1247+
fi
1248+
fi

src/tools/thread/thread_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.22 2004/04/23 22:21:49 momjian Exp $
9+
* $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.23 2004/04/23 23:58:12 momjian Exp $
1010
*
1111
* This program tests to see if your standard libc functions use
1212
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
@@ -109,7 +109,7 @@ main(int argc, char *argv[])
109109
sched_yield(); /* if this is a portability problem,
110110
* remove it */
111111

112-
fprintf(stderr, "Your errno is thread-safe.\n");
112+
printf("Your errno is thread-safe.\n");
113113

114114
#ifndef HAVE_STRERROR_R
115115
if (strerror_p1 != strerror_p2)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy