1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

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 8a2121185.)
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 8a2121185.

Discussion: https://postgr.es/m/CADhDkKzPSiNvA3Hyq+wSR_icuPmazG0cFe=YnC3U-CFcYLc8Xw@mail.gmail.com
This commit is contained in:
Tom Lane
2021-07-24 12:16:39 -04:00
parent 678f5448c2
commit 76fa3db336
3 changed files with 57 additions and 636 deletions

View File

@ -1178,17 +1178,13 @@ AC_SEARCH_LIBS(shm_unlink, rt)
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
# Solaris:
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:
AC_SEARCH_LIBS(shmget, cygipc)
# *BSD:
AC_SEARCH_LIBS(backtrace_symbols, execinfo)
if test "$enable_thread_safety" = yes; then
AC_SEARCH_LIBS(gethostbyname_r, nsl)
AC_SEARCH_LIBS(pthread_barrier_wait, pthread)
fi
@ -2362,38 +2358,6 @@ if test "$enable_tap_tests" = yes; then
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
# spellings thereof) then add that to LDFLAGS. This is much easier than
# trying to filter LIBS to the minimum for each executable.