0024-Add-an-option-to-disable-decimal.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. From c82efeabd2f9b89ff2ecd5261eceeeb3af022ae8 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 23 Dec 2015 11:51:31 +0100
  4. Subject: [PATCH] Add an option to disable decimal
  5. This patch replaces the existing --with-system-libmpdec option with a
  6. --with-libmpdec={system,builtin,none} option, which allows to tell
  7. Python whether we want to use the system libmpdec (already installed),
  8. the libmpdec builtin the Python sources, or no libmpdec at all.
  9. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  10. [aduskett@gmail.com: Update for python 3.7.0]
  11. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  12. ---
  13. configure.ac | 17 ++++++++++++-----
  14. setup.py | 2 +-
  15. 2 files changed, 13 insertions(+), 6 deletions(-)
  16. diff --git a/configure.ac b/configure.ac
  17. index 8c9706582e..e6255babb6 100644
  18. --- a/configure.ac
  19. +++ b/configure.ac
  20. @@ -3006,13 +3006,20 @@ fi
  21. AC_SUBST(LIBFFI_INCLUDEDIR)
  22. # Check for use of the system libmpdec library
  23. -AC_MSG_CHECKING(for --with-system-libmpdec)
  24. -AC_ARG_WITH(system_libmpdec,
  25. - AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library]),
  26. +AC_MSG_CHECKING(for --with-libmpdec)
  27. +AC_ARG_WITH(libmpdec,
  28. + AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]),
  29. [],
  30. - [with_system_libmpdec="no"])
  31. + [with_libmpdec="builtin"])
  32. -AC_MSG_RESULT($with_system_libmpdec)
  33. +AC_MSG_RESULT($with_libmpdec)
  34. +if test "$with_libmpdec" != "none"; then
  35. + MPDEC=yes
  36. +else
  37. + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal"
  38. + MPDEC=no
  39. +fi
  40. +AC_SUBST(MPDEC)
  41. # Check for support for loadable sqlite extensions
  42. AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
  43. diff --git a/setup.py b/setup.py
  44. index 9f09b3d985..a7f2e23d87 100644
  45. --- a/setup.py
  46. +++ b/setup.py
  47. @@ -2076,7 +2076,7 @@ class PyBuildExt(build_ext):
  48. # Stefan Krah's _decimal module
  49. extra_compile_args = []
  50. undef_macros = []
  51. - if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
  52. + if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"):
  53. include_dirs = []
  54. libraries = [':libmpdec.so.2']
  55. sources = ['_decimal/_decimal.c']
  56. --
  57. 2.20.1