Skip to content

Commit e370b64

Browse files
[3.13] gh-115119: Fall back to bundled libmpdec if system libmpdec is not found (GH-119196) (#119217)
(cherry picked from commit 642b25b) Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent 8f3fc01 commit e370b64

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fall back to the bundled libmpdec if a system version cannot be found.

configure

+14-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+13-6
Original file line numberDiff line numberDiff line change
@@ -3980,16 +3980,21 @@ AC_ARG_WITH(
39803980
[with_system_libmpdec="yes"])
39813981
AC_MSG_RESULT([$with_system_libmpdec])
39823982

3983+
AC_DEFUN([USE_BUNDLED_LIBMPDEC],
3984+
[LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
3985+
LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
3986+
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
3987+
have_mpdec=yes
3988+
with_system_libmpdec=no])
3989+
39833990
AS_VAR_IF(
39843991
[with_system_libmpdec], [yes],
39853992
[PKG_CHECK_MODULES(
39863993
[LIBMPDEC], [libmpdec >= 2.5.0], [],
39873994
[LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""}
39883995
LIBMPDEC_LIBS=${LIBMPDEC_LIBS-"-lmpdec -lm"}
39893996
LIBMPDEC_INTERNAL=])],
3990-
[LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
3991-
LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
3992-
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"])
3997+
[USE_BUNDLED_LIBMPDEC()])
39933998

39943999
AS_VAR_IF([with_system_libmpdec], [yes],
39954000
[WITH_SAVE_ENV([
@@ -4006,13 +4011,15 @@ AS_VAR_IF([with_system_libmpdec], [yes],
40064011
[have_mpdec=yes],
40074012
[have_mpdec=no])
40084013
])],
4009-
[AS_VAR_SET([have_mpdec], [yes])
4010-
AC_MSG_WARN([m4_normalize([
4014+
[AC_MSG_WARN([m4_normalize([
40114015
the bundled copy of libmpdecimal is scheduled for removal in Python 3.15;
40124016
consider using a system installed mpdecimal library.])])])
40134017

40144018
AS_IF([test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"],
4015-
[AC_MSG_WARN([no system libmpdecimal found; unable to build _decimal])])
4019+
[AC_MSG_WARN([m4_normalize([
4020+
no system libmpdecimal found; falling back to bundled libmpdecimal
4021+
(deprecated and scheduled for removal in Python 3.15)])])
4022+
USE_BUNDLED_LIBMPDEC()])
40164023

40174024
# Disable forced inlining in debug builds, see GH-94847
40184025
AS_VAR_IF(

0 commit comments

Comments
 (0)