1From d5fe81cbd51da2a84ed89d1e4c80d921d4efce26 Mon Sep 17 00:00:00 2001 2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 3Date: Wed, 23 Dec 2015 11:51:31 +0100 4Subject: [PATCH] Add an option to disable decimal 5 6This patch replaces the existing --with-system-libmpdec option with a 7--with-libmpdec={system,builtin,none} option, which allows to tell 8Python whether we want to use the system libmpdec (already installed), 9the libmpdec builtin the Python sources, or no libmpdec at all. 10 11Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 12[aduskett@gmail.com: Update for python 3.7.0] 13Signed-off-by: Adam Duskett <aduskett@gmail.com> 14[james.hilliard1@gmail.com: adapt to python 3.9] 15Signed-off-by: James Hilliard <james.hilliard1@gmail.com> 16--- 17 configure.ac | 17 ++++++++++++----- 18 setup.py | 2 +- 19 2 files changed, 13 insertions(+), 6 deletions(-) 20 21diff --git a/configure.ac b/configure.ac 22index 7bd4623ccd..e513ef6a20 100644 23--- a/configure.ac 24+++ b/configure.ac 25@@ -3145,13 +3145,20 @@ fi 26 AC_SUBST(LIBFFI_INCLUDEDIR) 27 28 # Check for use of the system libmpdec library 29-AC_MSG_CHECKING(for --with-system-libmpdec) 30-AC_ARG_WITH(system_libmpdec, 31- AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]), 32+AC_MSG_CHECKING(for --with-libmpdec) 33+AC_ARG_WITH(libmpdec, 34+ AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]), 35 [], 36- [with_system_libmpdec="no"]) 37+ [with_libmpdec="builtin"]) 38 39-AC_MSG_RESULT($with_system_libmpdec) 40+AC_MSG_RESULT($with_libmpdec) 41+if test "$with_libmpdec" != "none"; then 42+ MPDEC=yes 43+else 44+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal" 45+ MPDEC=no 46+fi 47+AC_SUBST(MPDEC) 48 49 # Check whether _decimal should use a coroutine-local or thread-local context 50 AC_MSG_CHECKING(for --with-decimal-contextvar) 51diff --git a/setup.py b/setup.py 52index c4ee989ba3..3d0c74bb7f 100644 53--- a/setup.py 54+++ b/setup.py 55@@ -2321,7 +2321,7 @@ class PyBuildExt(build_ext): 56 # Stefan Krah's _decimal module 57 extra_compile_args = [] 58 undef_macros = [] 59- if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"): 60+ if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"): 61 include_dirs = [] 62 libraries = ['mpdec'] 63 sources = ['_decimal/_decimal.c'] 64-- 652.25.1 66 67