Skip to content

Commit b62d61f

Browse files
erlend-aaslandzware
authored andcommitted
pythongh-115119: Default to --with-system-libmpdec=yes (python#118539)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
1 parent 85a5202 commit b62d61f

File tree

6 files changed

+116
-20
lines changed

6 files changed

+116
-20
lines changed

.github/workflows/posix-deps-apt.sh

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ apt-get -yq install \
1515
libgdbm-dev \
1616
libgdbm-compat-dev \
1717
liblzma-dev \
18+
libmpdec-dev \
1819
libncurses5-dev \
1920
libreadline6-dev \
2021
libsqlite3-dev \

Doc/using/configure.rst

+9-2
Original file line numberDiff line numberDiff line change
@@ -804,11 +804,18 @@ Libraries options
804804

805805
.. option:: --with-system-libmpdec
806806

807-
Build the ``_decimal`` extension module using an installed ``mpdec``
808-
library, see the :mod:`decimal` module (default is no).
807+
Build the ``_decimal`` extension module using an installed ``mpdecimal``
808+
library, see the :mod:`decimal` module (default is yes).
809809

810810
.. versionadded:: 3.3
811811

812+
.. versionchanged:: 3.13
813+
Default to using the installed ``mpdecimal`` library.
814+
815+
.. deprecated-removed:: 3.13 3.15
816+
A copy of the ``mpdecimal`` library sources will no longer be distributed
817+
with Python 3.15.
818+
812819
.. seealso:: :option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`.
813820

814821
.. option:: --with-readline=readline|editline

Doc/whatsnew/3.13.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,10 @@ Changes in the Python API
18071807
Build Changes
18081808
=============
18091809

1810+
* The :file:`configure` option :option:`--with-system-libmpdec` now defaults
1811+
to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python
1812+
3.15.
1813+
18101814
* Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate
18111815
the :file:`configure` script.
18121816
(Contributed by Christian Heimes in :gh:`89886`.)
@@ -2336,6 +2340,7 @@ Pending Removal in Python 3.14
23362340
Pending Removal in Python 3.15
23372341
------------------------------
23382342

2343+
* The bundled copy of ``libmpdecimal``.
23392344
* :c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule`.
23402345
* :c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead.
23412346
* :c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The :file:`configure` option :option:`--with-system-libmpdec` now defaults to ``yes``.
2+
The bundled copy of ``libmpdecimal`` will be removed in Python 3.15.

configure

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

configure.ac

+29-4
Original file line numberDiff line numberDiff line change
@@ -3974,23 +3974,46 @@ AC_ARG_WITH(
39743974
[system_libmpdec],
39753975
[AS_HELP_STRING(
39763976
[--with-system-libmpdec],
3977-
[build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]
3977+
[build _decimal module using an installed mpdecimal library, see Doc/library/decimal.rst (default is yes)]
39783978
)],
39793979
[],
3980-
[with_system_libmpdec="no"])
3980+
[with_system_libmpdec="yes"])
39813981
AC_MSG_RESULT([$with_system_libmpdec])
39823982

39833983
AS_VAR_IF(
39843984
[with_system_libmpdec], [yes],
39853985
[PKG_CHECK_MODULES(
3986-
[LIBMPDEC], [libmpdec], [],
3986+
[LIBMPDEC], [libmpdec >= 2.5.0], [],
39873987
[LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""}
39883988
LIBMPDEC_LIBS=${LIBMPDEC_LIBS-"-lmpdec -lm"}
39893989
LIBMPDEC_INTERNAL=])],
39903990
[LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
39913991
LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
39923992
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"])
39933993

3994+
AS_VAR_IF([with_system_libmpdec], [yes],
3995+
[WITH_SAVE_ENV([
3996+
CPPFLAGS="$LIBMPDEC_CFLAGS $CPPFLAGS"
3997+
LIBS="$LIBMPDEC_LIBS $LIBS"
3998+
3999+
AC_LINK_IFELSE([
4000+
AC_LANG_PROGRAM([
4001+
#include <mpdecimal.h>
4002+
#if MPD_VERSION_HEX < 0x02050000
4003+
# error "mpdecimal 2.5.0 or higher required"
4004+
#endif
4005+
], [const char *x = mpd_version();])],
4006+
[have_mpdec=yes],
4007+
[have_mpdec=no])
4008+
])],
4009+
[AS_VAR_SET([have_mpdec], [yes])
4010+
AC_MSG_WARN([m4_normalize([
4011+
the bundled copy of libmpdecimal is scheduled for removal in Python 3.15;
4012+
consider using a system installed mpdecimal library.])])])
4013+
4014+
AS_IF([test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"],
4015+
[AC_MSG_WARN([no system libmpdecimal found; unable to build _decimal])])
4016+
39944017
# Disable forced inlining in debug builds, see GH-94847
39954018
AS_VAR_IF(
39964019
[with_pydebug], [yes],
@@ -7668,7 +7691,9 @@ PY_STDLIB_MOD([_curses_panel],
76687691
[], [test "$have_panel" != "no"],
76697692
[$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS]
76707693
)
7671-
PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LIBS])
7694+
PY_STDLIB_MOD([_decimal],
7695+
[], [test "$have_mpdec" = "yes"],
7696+
[$LIBMPDEC_CFLAGS], [$LIBMPDEC_LIBS])
76727697
PY_STDLIB_MOD([_dbm],
76737698
[test -n "$with_dbmliborder"], [test "$have_dbm" != "no"],
76747699
[$DBM_CFLAGS], [$DBM_LIBS])

0 commit comments

Comments
 (0)