@@ -306,17 +306,6 @@ else
306306 patch -p1 -i " ${ROOT} /patch-python-configure-add-enable-static-libpython-for-interpreter-${PYTHON_MAJMIN_VERSION} .patch"
307307fi
308308
309- # We patched configure.ac above. Reflect those changes.
310- autoconf
311-
312- # configure assumes cross compiling when host != target and doesn't provide a way to
313- # override. Our target triple normalization may lead configure into thinking we
314- # aren't cross-compiling when we are. So force a static "yes" value when our
315- # build system says we are cross-compiling.
316- if [ -n " ${CROSS_COMPILING} " ]; then
317- patch -p1 -i ${ROOT} /patch-force-cross-compile.patch
318- fi
319-
320309# BOLT instrumented binaries segfault in some test_embed tests for unknown reasons.
321310# On 3.12 (minimum BOLT version), the segfault causes the test harness to
322311# abort and BOLT optimization uses the partial test results. On 3.13, the segfault
@@ -582,6 +571,14 @@ else
582571fi
583572
584573if [ -n " ${CROSS_COMPILING} " ]; then
574+ # configure assumes cross compiling when host != target and doesn't
575+ # provide a way to override. Our target triple normalization may
576+ # lead configure into thinking we aren't cross-compiling when we
577+ # are. So force a static "yes" value when our build system says we
578+ # are cross-compiling.
579+ # See also https://savannah.gnu.org/support/?110348
580+ CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} cross_compiling=yes"
581+
585582 # configure doesn't like a handful of scenarios when cross-compiling.
586583 #
587584 # getaddrinfo buggy test fails for some reason. So we short-circuit it.
@@ -598,8 +595,18 @@ if [ -n "${CROSS_COMPILING}" ]; then
598595 if [ " ${PYBUILD_PLATFORM} " != " macos" ]; then
599596 CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} ac_cv_working_tzset=yes"
600597 fi
598+
599+ # Also, it cannot detect whether the compiler supports -pthread or
600+ # not, and conservatively defaults to no, which is not the right
601+ # default on relatively modern compilers.
602+ CONFIGURE_FLAGS=" ${CONFIGURE_FLAGS} ac_cv_pthread=yes"
603+
604+ # TODO: There are probably more of these, see #399.
601605fi
602606
607+ # We patched configure.ac above. Reflect those changes.
608+ autoconf
609+
603610CFLAGS=$CFLAGS CPPFLAGS=$CFLAGS LDFLAGS=$LDFLAGS \
604611 ./configure ${CONFIGURE_FLAGS}
605612
0 commit comments