[3.13] gh-115119: Fall back to bundled libmpdec if system libmpdec is not found (GH-119196) (#119217)

(cherry picked from commit 642b25b9a8)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
This commit is contained in:
Miss Islington (bot) 2024-05-20 18:10:21 +02:00 committed by GitHub
parent 8f3fc01c4c
commit e370b642ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 12 deletions

View file

@ -3980,6 +3980,13 @@ AC_ARG_WITH(
[with_system_libmpdec="yes"])
AC_MSG_RESULT([$with_system_libmpdec])
AC_DEFUN([USE_BUNDLED_LIBMPDEC],
[LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
have_mpdec=yes
with_system_libmpdec=no])
AS_VAR_IF(
[with_system_libmpdec], [yes],
[PKG_CHECK_MODULES(
@ -3987,9 +3994,7 @@ AS_VAR_IF(
[LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""}
LIBMPDEC_LIBS=${LIBMPDEC_LIBS-"-lmpdec -lm"}
LIBMPDEC_INTERNAL=])],
[LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"])
[USE_BUNDLED_LIBMPDEC()])
AS_VAR_IF([with_system_libmpdec], [yes],
[WITH_SAVE_ENV([
@ -4006,13 +4011,15 @@ AS_VAR_IF([with_system_libmpdec], [yes],
[have_mpdec=yes],
[have_mpdec=no])
])],
[AS_VAR_SET([have_mpdec], [yes])
AC_MSG_WARN([m4_normalize([
[AC_MSG_WARN([m4_normalize([
the bundled copy of libmpdecimal is scheduled for removal in Python 3.15;
consider using a system installed mpdecimal library.])])])
AS_IF([test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"],
[AC_MSG_WARN([no system libmpdecimal found; unable to build _decimal])])
[AC_MSG_WARN([m4_normalize([
no system libmpdecimal found; falling back to bundled libmpdecimal
(deprecated and scheduled for removal in Python 3.15)])])
USE_BUNDLED_LIBMPDEC()])
# Disable forced inlining in debug builds, see GH-94847
AS_VAR_IF(