gh-115119: Default to --with-system-libmpdec=yes (#118539)

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
This commit is contained in:
Erlend E. Aasland 2024-05-06 21:16:08 +02:00 committed by GitHub
parent e5353d49dc
commit 325a1da18d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 116 additions and 20 deletions

View File

@ -15,6 +15,7 @@ apt-get -yq install \
libgdbm-dev \
libgdbm-compat-dev \
liblzma-dev \
libmpdec-dev \
libncurses5-dev \
libreadline6-dev \
libsqlite3-dev \

View File

@ -804,11 +804,18 @@ Libraries options
.. option:: --with-system-libmpdec
Build the ``_decimal`` extension module using an installed ``mpdec``
library, see the :mod:`decimal` module (default is no).
Build the ``_decimal`` extension module using an installed ``mpdecimal``
library, see the :mod:`decimal` module (default is yes).
.. versionadded:: 3.3
.. versionchanged:: 3.13
Default to using the installed ``mpdecimal`` library.
.. deprecated-removed:: 3.13 3.15
A copy of the ``mpdecimal`` library sources will no longer be distributed
with Python 3.15.
.. seealso:: :option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`.
.. option:: --with-readline=readline|editline

View File

@ -1807,6 +1807,10 @@ Changes in the Python API
Build Changes
=============
* The :file:`configure` option :option:`--with-system-libmpdec` now defaults
to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python
3.15.
* Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate
the :file:`configure` script.
(Contributed by Christian Heimes in :gh:`89886`.)
@ -2336,6 +2340,7 @@ Pending Removal in Python 3.14
Pending Removal in Python 3.15
------------------------------
* The bundled copy of ``libmpdecimal``.
* :c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule`.
* :c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead.
* :c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead.

View File

@ -0,0 +1,2 @@
The :file:`configure` option :option:`--with-system-libmpdec` now defaults to ``yes``.
The bundled copy of ``libmpdecimal`` will be removed in Python 3.15.

84
configure generated vendored
View File

@ -1892,8 +1892,9 @@ Optional Packages:
--with-libs='lib1 ...' link against additional libs (default is no)
--with-system-expat build pyexpat module using an installed expat
library, see Doc/library/pyexpat.rst (default is no)
--with-system-libmpdec build _decimal module using an installed libmpdec
library, see Doc/library/decimal.rst (default is no)
--with-system-libmpdec build _decimal module using an installed mpdecimal
library, see Doc/library/decimal.rst (default is
yes)
--with-decimal-contextvar
build _decimal module using a coroutine-local rather
than a thread-local context (default is yes)
@ -14611,7 +14612,7 @@ if test ${with_system_libmpdec+y}
then :
withval=$with_system_libmpdec;
else $as_nop
with_system_libmpdec="no"
with_system_libmpdec="yes"
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_system_libmpdec" >&5
@ -14621,19 +14622,19 @@ if test "x$with_system_libmpdec" = xyes
then :
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libmpdec" >&5
printf %s "checking for libmpdec... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libmpdec >= 2.5.0" >&5
printf %s "checking for libmpdec >= 2.5.0... " >&6; }
if test -n "$LIBMPDEC_CFLAGS"; then
pkg_cv_LIBMPDEC_CFLAGS="$LIBMPDEC_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmpdec\""; } >&5
($PKG_CONFIG --exists --print-errors "libmpdec") 2>&5
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmpdec >= 2.5.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libmpdec >= 2.5.0") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBMPDEC_CFLAGS=`$PKG_CONFIG --cflags "libmpdec" 2>/dev/null`
pkg_cv_LIBMPDEC_CFLAGS=`$PKG_CONFIG --cflags "libmpdec >= 2.5.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -14645,12 +14646,12 @@ if test -n "$LIBMPDEC_LIBS"; then
pkg_cv_LIBMPDEC_LIBS="$LIBMPDEC_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmpdec\""; } >&5
($PKG_CONFIG --exists --print-errors "libmpdec") 2>&5
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmpdec >= 2.5.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libmpdec >= 2.5.0") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBMPDEC_LIBS=`$PKG_CONFIG --libs "libmpdec" 2>/dev/null`
pkg_cv_LIBMPDEC_LIBS=`$PKG_CONFIG --libs "libmpdec >= 2.5.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -14671,9 +14672,9 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBMPDEC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libmpdec" 2>&1`
LIBMPDEC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libmpdec >= 2.5.0" 2>&1`
else
LIBMPDEC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libmpdec" 2>&1`
LIBMPDEC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libmpdec >= 2.5.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBMPDEC_PKG_ERRORS" >&5
@ -14700,6 +14701,61 @@ else $as_nop
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"
fi
if test "x$with_system_libmpdec" = xyes
then :
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
CPPFLAGS="$LIBMPDEC_CFLAGS $CPPFLAGS"
LIBS="$LIBMPDEC_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <mpdecimal.h>
#if MPD_VERSION_HEX < 0x02050000
# error "mpdecimal 2.5.0 or higher required"
#endif
int
main (void)
{
const char *x = mpd_version();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
have_mpdec=yes
else $as_nop
have_mpdec=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
else $as_nop
have_mpdec=yes
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.15; consider using a system installed mpdecimal library." >&5
printf "%s\n" "$as_me: WARNING: the bundled copy of libmpdecimal is scheduled for removal in Python 3.15; consider using a system installed mpdecimal library." >&2;}
fi
if test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: no system libmpdecimal found; unable to build _decimal" >&5
printf "%s\n" "$as_me: WARNING: no system libmpdecimal found; unable to build _decimal" >&2;}
fi
# Disable forced inlining in debug builds, see GH-94847
if test "x$with_pydebug" = xyes
then :
@ -30426,7 +30482,7 @@ then :
if true
then :
if true
if test "$have_mpdec" = "yes"
then :
py_cv_module__decimal=yes
else $as_nop

View File

@ -3974,16 +3974,16 @@ AC_ARG_WITH(
[system_libmpdec],
[AS_HELP_STRING(
[--with-system-libmpdec],
[build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]
[build _decimal module using an installed mpdecimal library, see Doc/library/decimal.rst (default is yes)]
)],
[],
[with_system_libmpdec="no"])
[with_system_libmpdec="yes"])
AC_MSG_RESULT([$with_system_libmpdec])
AS_VAR_IF(
[with_system_libmpdec], [yes],
[PKG_CHECK_MODULES(
[LIBMPDEC], [libmpdec], [],
[LIBMPDEC], [libmpdec >= 2.5.0], [],
[LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""}
LIBMPDEC_LIBS=${LIBMPDEC_LIBS-"-lmpdec -lm"}
LIBMPDEC_INTERNAL=])],
@ -3991,6 +3991,29 @@ AS_VAR_IF(
LIBMPDEC_LIBS="-lm \$(LIBMPDEC_A)"
LIBMPDEC_INTERNAL="\$(LIBMPDEC_HEADERS) \$(LIBMPDEC_A)"])
AS_VAR_IF([with_system_libmpdec], [yes],
[WITH_SAVE_ENV([
CPPFLAGS="$LIBMPDEC_CFLAGS $CPPFLAGS"
LIBS="$LIBMPDEC_LIBS $LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#include <mpdecimal.h>
#if MPD_VERSION_HEX < 0x02050000
# error "mpdecimal 2.5.0 or higher required"
#endif
], [const char *x = mpd_version();])],
[have_mpdec=yes],
[have_mpdec=no])
])],
[AS_VAR_SET([have_mpdec], [yes])
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])])
# Disable forced inlining in debug builds, see GH-94847
AS_VAR_IF(
[with_pydebug], [yes],
@ -7668,7 +7691,9 @@ PY_STDLIB_MOD([_curses_panel],
[], [test "$have_panel" != "no"],
[$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS]
)
PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LIBS])
PY_STDLIB_MOD([_decimal],
[], [test "$have_mpdec" = "yes"],
[$LIBMPDEC_CFLAGS], [$LIBMPDEC_LIBS])
PY_STDLIB_MOD([_dbm],
[test -n "$with_dbmliborder"], [test "$have_dbm" != "no"],
[$DBM_CFLAGS], [$DBM_LIBS])