From 761158cb38508dbb91ca7fff474b4f6e041583a7 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Fri, 26 Aug 2022 08:16:12 +1200 Subject: [PATCH] Avoid adding -pthread to backend unintentionally. --- configure | 35 +++++++++++++++++------------------ configure.ac | 7 +++---- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/configure b/configure index 814014a96b..fefe97e520 100755 --- a/configure +++ b/configure @@ -647,13 +647,13 @@ MSGFMT PG_CRC32C_OBJS CFLAGS_ARMV8_CRC32C CFLAGS_SSE42 -LIBOBJS ZSTD LZ4 UUID_LIBS LDAP_LIBS_BE LDAP_LIBS_FE with_ssl +LIBOBJS PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC @@ -12429,6 +12429,7 @@ fi if test "$enable_thread_safety" = yes; then + _LIBS="$LIBS" { $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; } if ${ac_cv_search_pthread_barrier_wait+:} false; then : @@ -12485,6 +12486,21 @@ if test "$ac_res" != no; then : fi + ac_fn_c_check_func "$LINENO" "pthread_barrier_wait" "ac_cv_func_pthread_barrier_wait" +if test "x$ac_cv_func_pthread_barrier_wait" = xyes; then : + $as_echo "#define HAVE_PTHREAD_BARRIER_WAIT 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" pthread_barrier_wait.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS pthread_barrier_wait.$ac_objext" + ;; +esac + +fi + + + LIBS="$_LIBS" fi if test "$with_readline" = yes; then @@ -16369,23 +16385,6 @@ fi -if test "$enable_thread_safety" = yes; then - ac_fn_c_check_func "$LINENO" "pthread_barrier_wait" "ac_cv_func_pthread_barrier_wait" -if test "x$ac_cv_func_pthread_barrier_wait" = xyes; then : - $as_echo "#define HAVE_PTHREAD_BARRIER_WAIT 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" pthread_barrier_wait.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS pthread_barrier_wait.$ac_objext" - ;; -esac - -fi - - -fi - if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then # Cygwin and (apparently, based on test results) Mingw both # have a broken strtof(), so substitute its implementation. diff --git a/configure.ac b/configure.ac index 6ff294d405..c51f174fde 100644 --- a/configure.ac +++ b/configure.ac @@ -1260,7 +1260,10 @@ AC_SEARCH_LIBS(shmget, cygipc) AC_SEARCH_LIBS(backtrace_symbols, execinfo) if test "$enable_thread_safety" = yes; then + _LIBS="$LIBS" AC_SEARCH_LIBS(pthread_barrier_wait, pthread) + AC_REPLACE_FUNCS([pthread_barrier_wait]) + LIBS="$_LIBS" fi if test "$with_readline" = yes; then @@ -1831,10 +1834,6 @@ AC_REPLACE_FUNCS(m4_normalize([ strnlen ])) -if test "$enable_thread_safety" = yes; then - AC_REPLACE_FUNCS(pthread_barrier_wait) -fi - if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then # Cygwin and (apparently, based on test results) Mingw both # have a broken strtof(), so substitute its implementation. -- 2.37.1