From fefd3d2dccbd21b01a649fa9683d98f2648c83f6 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Sat, 3 Oct 2020 12:31:44 -0400 Subject: [PATCH] bpo-41916: allow cross-compiled python to have -pthread set for CXX When cross-compiling, the compile/run test for -pthread always fails so -pthread will never be automatically set without an override from the cache. ac_cv_pthread can already be overridden, so do the same thing for ac_cv_cxx_thread. --- .../Build/2022-03-04-10-47-23.bpo-41916.1d2GLU.rst | 2 ++ configure | 13 ++++++++++--- configure.ac | 12 +++++++----- 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2022-03-04-10-47-23.bpo-41916.1d2GLU.rst diff --git a/Misc/NEWS.d/next/Build/2022-03-04-10-47-23.bpo-41916.1d2GLU.rst b/Misc/NEWS.d/next/Build/2022-03-04-10-47-23.bpo-41916.1d2GLU.rst new file mode 100644 index 00000000000000..2fc5f8ec77b132 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2022-03-04-10-47-23.bpo-41916.1d2GLU.rst @@ -0,0 +1,2 @@ +Allow override of ac_cv_cxx_thread so that cross compiled python can set +-pthread for CXX. diff --git a/configure b/configure index 0e9f72faa7b120..72886b2a9522c4 100755 --- a/configure +++ b/configure @@ -9509,12 +9509,14 @@ fi # If we have set a CC compiler flag for thread support then # check if it works for CXX, too. -ac_cv_cxx_thread=no if test ! -z "$CXX" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX also accepts flags for thread support" >&5 $as_echo_n "checking whether $CXX also accepts flags for thread support... " >&6; } -ac_save_cxx="$CXX" +if ${ac_cv_cxx_thread+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx="$CXX" if test "$ac_cv_kpthread" = "yes" then @@ -9528,6 +9530,8 @@ elif test "$ac_cv_pthread" = "yes" then CXX="$CXX -pthread" ac_cv_cxx_thread=yes +else + ac_cv_cxx_thread=no fi if test $ac_cv_cxx_thread = yes @@ -9543,10 +9547,13 @@ then fi rm -fr conftest* fi +CXX="$ac_save_cxx" +fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_thread" >&5 $as_echo "$ac_cv_cxx_thread" >&6; } +else + ac_cv_cxx_thread=no fi -CXX="$ac_save_cxx" diff --git a/configure.ac b/configure.ac index a4f3b0ab84664a..7fcf7949c1e163 100644 --- a/configure.ac +++ b/configure.ac @@ -2664,11 +2664,10 @@ fi # If we have set a CC compiler flag for thread support then # check if it works for CXX, too. -ac_cv_cxx_thread=no if test ! -z "$CXX" then -AC_MSG_CHECKING(whether $CXX also accepts flags for thread support) -ac_save_cxx="$CXX" +AC_CACHE_CHECK([whether $CXX also accepts flags for thread support], [ac_cv_cxx_thread], +[ac_save_cxx="$CXX" if test "$ac_cv_kpthread" = "yes" then @@ -2682,6 +2681,8 @@ elif test "$ac_cv_pthread" = "yes" then CXX="$CXX -pthread" ac_cv_cxx_thread=yes +else + ac_cv_cxx_thread=no fi if test $ac_cv_cxx_thread = yes @@ -2697,9 +2698,10 @@ then fi rm -fr conftest* fi -AC_MSG_RESULT($ac_cv_cxx_thread) +CXX="$ac_save_cxx"]) +else + ac_cv_cxx_thread=no fi -CXX="$ac_save_cxx" dnl # check for ANSI or K&R ("traditional") preprocessor dnl AC_MSG_CHECKING(for C preprocessor type)