Commit d5e913a8 authored by Tom Lane's avatar Tom Lane

Remove configure-time thread safety checking (thread_test.c).

This testing was useful when it was written, nigh twenty years ago,
but it seems fairly pointless for any platform built in the last
dozen or more years.  (Compare also the comments at 8a212118.)
Also we now have reports that the test program itself fails under
ThreadSanitizer.  Rather than invest effort in fixing it, let's
just drop it, and assume that the few people who still care
already know they need to use --disable-thread-safety.

Back-patch into v14, for consistency with 8a212118.

Discussion: https://postgr.es/m/CADhDkKzPSiNvA3Hyq+wSR_icuPmazG0cFe=YnC3U-CFcYLc8Xw@mail.gmail.com
parent 81322fc4
This diff is collapsed.
...@@ -11934,10 +11934,10 @@ if test "$ac_res" != no; then : ...@@ -11934,10 +11934,10 @@ if test "$ac_res" != no; then :
fi fi
# Required for thread_test.c on Solaris # Cygwin:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shmget" >&5
$as_echo_n "checking for library containing sched_yield... " >&6; } $as_echo_n "checking for library containing shmget... " >&6; }
if ${ac_cv_search_sched_yield+:} false; then : if ${ac_cv_search_shmget+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ac_func_search_save_LIBS=$LIBS ac_func_search_save_LIBS=$LIBS
...@@ -11950,16 +11950,16 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ...@@ -11950,16 +11950,16 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
char sched_yield (); char shmget ();
int int
main () main ()
{ {
return sched_yield (); return shmget ();
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
for ac_lib in '' rt; do for ac_lib in '' cygipc; do
if test -z "$ac_lib"; then if test -z "$ac_lib"; then
ac_res="none required" ac_res="none required"
else else
...@@ -11967,35 +11967,34 @@ for ac_lib in '' rt; do ...@@ -11967,35 +11967,34 @@ for ac_lib in '' rt; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS" LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi fi
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_sched_yield=$ac_res ac_cv_search_shmget=$ac_res
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest$ac_exeext
if ${ac_cv_search_sched_yield+:} false; then : if ${ac_cv_search_shmget+:} false; then :
break break
fi fi
done done
if ${ac_cv_search_sched_yield+:} false; then : if ${ac_cv_search_shmget+:} false; then :
else else
ac_cv_search_sched_yield=no ac_cv_search_shmget=no
fi fi
rm conftest.$ac_ext rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS LIBS=$ac_func_search_save_LIBS
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sched_yield" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shmget" >&5
$as_echo "$ac_cv_search_sched_yield" >&6; } $as_echo "$ac_cv_search_shmget" >&6; }
ac_res=$ac_cv_search_sched_yield ac_res=$ac_cv_search_shmget
if test "$ac_res" != no; then : if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi fi
# Required for thread_test.c on Solaris 2.5: # *BSD:
# Other ports use it too (HP-UX) so test unconditionally { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace_symbols" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname_r" >&5 $as_echo_n "checking for library containing backtrace_symbols... " >&6; }
$as_echo_n "checking for library containing gethostbyname_r... " >&6; } if ${ac_cv_search_backtrace_symbols+:} false; then :
if ${ac_cv_search_gethostbyname_r+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ac_func_search_save_LIBS=$LIBS ac_func_search_save_LIBS=$LIBS
...@@ -12008,16 +12007,16 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ...@@ -12008,16 +12007,16 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
char gethostbyname_r (); char backtrace_symbols ();
int int
main () main ()
{ {
return gethostbyname_r (); return backtrace_symbols ();
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
for ac_lib in '' nsl; do for ac_lib in '' execinfo; do
if test -z "$ac_lib"; then if test -z "$ac_lib"; then
ac_res="none required" ac_res="none required"
else else
...@@ -12025,91 +12024,35 @@ for ac_lib in '' nsl; do ...@@ -12025,91 +12024,35 @@ for ac_lib in '' nsl; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS" LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi fi
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_gethostbyname_r=$ac_res ac_cv_search_backtrace_symbols=$ac_res
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest$ac_exeext
if ${ac_cv_search_gethostbyname_r+:} false; then : if ${ac_cv_search_backtrace_symbols+:} false; then :
break break
fi fi
done done
if ${ac_cv_search_gethostbyname_r+:} false; then : if ${ac_cv_search_backtrace_symbols+:} false; then :
else else
ac_cv_search_gethostbyname_r=no ac_cv_search_backtrace_symbols=no
fi fi
rm conftest.$ac_ext rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS LIBS=$ac_func_search_save_LIBS
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname_r" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace_symbols" >&5
$as_echo "$ac_cv_search_gethostbyname_r" >&6; } $as_echo "$ac_cv_search_backtrace_symbols" >&6; }
ac_res=$ac_cv_search_gethostbyname_r ac_res=$ac_cv_search_backtrace_symbols
if test "$ac_res" != no; then : if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi fi
# Cygwin:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing shmget" >&5
$as_echo_n "checking for library containing shmget... " >&6; }
if ${ac_cv_search_shmget+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error. if test "$enable_thread_safety" = yes; then
Use char because int might match the return type of a GCC { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname_r" >&5
builtin and then its argument prototype would still apply. */ $as_echo_n "checking for library containing gethostbyname_r... " >&6; }
#ifdef __cplusplus if ${ac_cv_search_gethostbyname_r+:} false; then :
extern "C"
#endif
char shmget ();
int
main ()
{
return shmget ();
;
return 0;
}
_ACEOF
for ac_lib in '' cygipc; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_shmget=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_shmget+:} false; then :
break
fi
done
if ${ac_cv_search_shmget+:} false; then :
else
ac_cv_search_shmget=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_shmget" >&5
$as_echo "$ac_cv_search_shmget" >&6; }
ac_res=$ac_cv_search_shmget
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
# *BSD:
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace_symbols" >&5
$as_echo_n "checking for library containing backtrace_symbols... " >&6; }
if ${ac_cv_search_backtrace_symbols+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ac_func_search_save_LIBS=$LIBS ac_func_search_save_LIBS=$LIBS
...@@ -12122,16 +12065,16 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ...@@ -12122,16 +12065,16 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
char backtrace_symbols (); char gethostbyname_r ();
int int
main () main ()
{ {
return backtrace_symbols (); return gethostbyname_r ();
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
for ac_lib in '' execinfo; do for ac_lib in '' nsl; do
if test -z "$ac_lib"; then if test -z "$ac_lib"; then
ac_res="none required" ac_res="none required"
else else
...@@ -12139,32 +12082,30 @@ for ac_lib in '' execinfo; do ...@@ -12139,32 +12082,30 @@ for ac_lib in '' execinfo; do
LIBS="-l$ac_lib $ac_func_search_save_LIBS" LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi fi
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_backtrace_symbols=$ac_res ac_cv_search_gethostbyname_r=$ac_res
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest$ac_exeext
if ${ac_cv_search_backtrace_symbols+:} false; then : if ${ac_cv_search_gethostbyname_r+:} false; then :
break break
fi fi
done done
if ${ac_cv_search_backtrace_symbols+:} false; then : if ${ac_cv_search_gethostbyname_r+:} false; then :
else else
ac_cv_search_backtrace_symbols=no ac_cv_search_gethostbyname_r=no
fi fi
rm conftest.$ac_ext rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS LIBS=$ac_func_search_save_LIBS
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace_symbols" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname_r" >&5
$as_echo "$ac_cv_search_backtrace_symbols" >&6; } $as_echo "$ac_cv_search_gethostbyname_r" >&6; }
ac_res=$ac_cv_search_backtrace_symbols ac_res=$ac_cv_search_gethostbyname_r
if test "$ac_res" != no; then : if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi fi
if test "$enable_thread_safety" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_barrier_wait" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_barrier_wait" >&5
$as_echo_n "checking for library containing pthread_barrier_wait... " >&6; } $as_echo_n "checking for library containing pthread_barrier_wait... " >&6; }
if ${ac_cv_search_pthread_barrier_wait+:} false; then : if ${ac_cv_search_pthread_barrier_wait+:} false; then :
...@@ -19393,57 +19334,6 @@ fi ...@@ -19393,57 +19334,6 @@ fi
fi fi
fi fi
# 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
if test "$PORTNAME" != "win32"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking thread safety of required library functions" >&5
$as_echo_n "checking thread safety of required library functions... " >&6; }
_CFLAGS="$CFLAGS"
_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$LIBS $PTHREAD_LIBS"
if test "$cross_compiling" = yes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: maybe" >&5
$as_echo "maybe" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** Skipping thread test program because of cross-compile build.
" >&5
$as_echo "$as_me: WARNING:
*** Skipping thread test program because of cross-compile build.
" >&2;}
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "$srcdir/config/thread_test.c"
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "thread test program failed
This platform is not thread-safe. Check the file 'config.log' for the
exact reason, or use --disable-thread-safety to disable thread safety." "$LINENO" 5
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
CFLAGS="$_CFLAGS"
LIBS="$_LIBS"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** skipping thread test on Win32" >&5
$as_echo "$as_me: WARNING: *** skipping thread test on Win32" >&2;}
fi
fi
# If compiler will take -Wl,--as-needed (or various platform-specific # If compiler will take -Wl,--as-needed (or various platform-specific
# spellings thereof) then add that to LDFLAGS. This is much easier than # spellings thereof) then add that to LDFLAGS. This is much easier than
# trying to filter LIBS to the minimum for each executable. # trying to filter LIBS to the minimum for each executable.
......
...@@ -1173,17 +1173,13 @@ AC_SEARCH_LIBS(shm_unlink, rt) ...@@ -1173,17 +1173,13 @@ AC_SEARCH_LIBS(shm_unlink, rt)
AC_SEARCH_LIBS(clock_gettime, [rt posix4]) AC_SEARCH_LIBS(clock_gettime, [rt posix4])
# Solaris: # Solaris:
AC_SEARCH_LIBS(fdatasync, [rt posix4]) AC_SEARCH_LIBS(fdatasync, [rt posix4])
# Required for thread_test.c on Solaris
AC_SEARCH_LIBS(sched_yield, rt)
# Required for thread_test.c on Solaris 2.5:
# Other ports use it too (HP-UX) so test unconditionally
AC_SEARCH_LIBS(gethostbyname_r, nsl)
# Cygwin: # Cygwin:
AC_SEARCH_LIBS(shmget, cygipc) AC_SEARCH_LIBS(shmget, cygipc)
# *BSD: # *BSD:
AC_SEARCH_LIBS(backtrace_symbols, execinfo) AC_SEARCH_LIBS(backtrace_symbols, execinfo)
if test "$enable_thread_safety" = yes; then if test "$enable_thread_safety" = yes; then
AC_SEARCH_LIBS(gethostbyname_r, nsl)
AC_SEARCH_LIBS(pthread_barrier_wait, pthread) AC_SEARCH_LIBS(pthread_barrier_wait, pthread)
fi fi
...@@ -2330,38 +2326,6 @@ if test "$enable_tap_tests" = yes; then ...@@ -2330,38 +2326,6 @@ if test "$enable_tap_tests" = yes; then
fi fi
fi fi
# 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
if test "$PORTNAME" != "win32"
then
AC_MSG_CHECKING([thread safety of required library functions])
_CFLAGS="$CFLAGS"
_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$LIBS $PTHREAD_LIBS"
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[#include "$srcdir/config/thread_test.c"]])],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_MSG_ERROR([thread test program failed
This platform is not thread-safe. Check the file 'config.log' for the
exact reason, or use --disable-thread-safety to disable thread safety.])],
[AC_MSG_RESULT(maybe)
AC_MSG_WARN([
*** Skipping thread test program because of cross-compile build.
])])
CFLAGS="$_CFLAGS"
LIBS="$_LIBS"
else
AC_MSG_WARN([*** skipping thread test on Win32])
fi
fi
# If compiler will take -Wl,--as-needed (or various platform-specific # If compiler will take -Wl,--as-needed (or various platform-specific
# spellings thereof) then add that to LDFLAGS. This is much easier than # spellings thereof) then add that to LDFLAGS. This is much easier than
# trying to filter LIBS to the minimum for each executable. # trying to filter LIBS to the minimum for each executable.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment