Skip to content

Commit 4c98b8d

Browse files
committed
address review: add --with-libmpdec option
1 parent fed39e1 commit 4c98b8d

File tree

4 files changed

+51
-16
lines changed

4 files changed

+51
-16
lines changed

Doc/using/configure.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,12 @@ Libraries options
851851

852852
.. seealso:: :option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`.
853853

854+
.. option:: --with-libmpdec
855+
856+
Whether build the ``_decimal`` extension module.
857+
858+
.. versionadded:: next
859+
854860
.. option:: --with-readline=readline|editline
855861

856862
Designate a backend library for the :mod:`readline` module.

Doc/whatsnew/3.15.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ Build changes
257257
* Removed implicit fallback to the buildled copy of the ``libmpdec`` library.
258258
Now this should be explicitly enabled with :option:`--with-system-libmpdec`
259259
set to ``no`` or with :option:`!--without-system-libmpdec`.
260+
The :option:`!--without-libmpdec` should be used to permit building of
261+
the CPython without the ``_decimal`` module.
260262
(Contributed by Sergey B Kirpichev in :gh:`115119`.)
261263

262264

configure

Lines changed: 25 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4171,6 +4171,16 @@ if test "$ac_cv_ffi_complex_double_supported" = "yes"; then
41714171
[Defined if _Complex C type can be used with libffi.])
41724172
fi
41734173

4174+
# Check for use of the libmpdec library
4175+
AC_MSG_CHECKING([for --with-libmpdec])
4176+
AC_ARG_WITH(
4177+
[libmpdec],
4178+
[AS_HELP_STRING(
4179+
[--with-libmpdec],
4180+
[build _decimal module (default is yes)]
4181+
)])
4182+
AC_MSG_RESULT([$with_libmpdec])
4183+
41744184
# Check for use of the system libmpdec library
41754185
AC_MSG_CHECKING([for --with-system-libmpdec])
41764186
AC_DEFUN([USE_BUNDLED_LIBMPDEC],
@@ -4185,7 +4195,7 @@ AC_ARG_WITH(
41854195
[--with-system-libmpdec],
41864196
[build _decimal module using an installed mpdecimal library, see Doc/library/decimal.rst (default is yes)]
41874197
)],
4188-
[AS_IF([test "x$with_system_libmpdec" = xno],
4198+
[AS_IF([test "x$with_system_libmpdec" = xno && test "x$with_libmpdec" = xyes],
41894199
[USE_BUNDLED_LIBMPDEC()])],
41904200
[with_system_libmpdec="yes"])
41914201
AC_MSG_RESULT([$with_system_libmpdec])
@@ -4213,16 +4223,16 @@ AS_VAR_IF([with_system_libmpdec], [yes],
42134223
[have_mpdec=yes],
42144224
[have_mpdec=no])
42154225
])])
4216-
AS_VAR_IF([with_system_libmpdec], [no],
4226+
AS_IF([test "$with_system_libmpdec" = "no" && test "$with_libmpdec" = "yes"],
42174227
[AC_MSG_WARN([m4_normalize([
4218-
the bundled copy of libmpdecimal is scheduled for removal in Python 3.16;
4228+
the bundled copy of libmpdec is scheduled for removal in Python 3.16;
42194229
consider using a system installed mpdecimal library.])])])
42204230

4221-
AS_IF([test "$with_system_libmpdec" = "yes" && test "$have_mpdec" = "no"],
4222-
[AC_MSG_WARN([m4_normalize([
4223-
no system libmpdecimal found; falling back to pure-Python version
4224-
for the decimal module])])
4225-
AS_VAR_SET([py_cv_module_]_decimal, [n/a])])
4231+
AS_IF([test "$with_libmpdec" = "yes" && test "$have_mpdec" = "no"],
4232+
[AC_MSG_ERROR([m4_normalize([
4233+
no system libmpdec found; use --without-libmpdec to build Python with only pure-Python version for the decimal module])])])
4234+
AS_VAR_IF([with_libmpdec], [no],
4235+
[AS_VAR_SET([py_cv_module_]_decimal, [n/a])])
42264236

42274237
# Disable forced inlining in debug builds, see GH-94847
42284238
AS_VAR_IF(

0 commit comments

Comments
 (0)