0028-Add-an-option-to-disable-decimal.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From ff77defc777a57d4caee5183796fd44dd265e78b 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. ---
  11. configure.ac | 17 ++++++++++++-----
  12. setup.py | 2 +-
  13. 2 files changed, 13 insertions(+), 6 deletions(-)
  14. diff --git a/configure.ac b/configure.ac
  15. index 6b59792..51e1760 100644
  16. --- a/configure.ac
  17. +++ b/configure.ac
  18. @@ -2624,13 +2624,20 @@ AC_SUBST(LIBFFI_INCLUDEDIR)
  19. AC_MSG_RESULT($with_system_ffi)
  20. # Check for use of the system libmpdec library
  21. -AC_MSG_CHECKING(for --with-system-libmpdec)
  22. -AC_ARG_WITH(system_libmpdec,
  23. - AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library]),
  24. +AC_MSG_CHECKING(for --with-libmpdec)
  25. +AC_ARG_WITH(libmpdec,
  26. + AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]),
  27. [],
  28. - [with_system_libmpdec="no"])
  29. + [with_libmpdec="builtin"])
  30. -AC_MSG_RESULT($with_system_libmpdec)
  31. +AC_MSG_RESULT($with_libmpdec)
  32. +if test "$with_libmpdec" != "none"; then
  33. + MPDEC=yes
  34. +else
  35. + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal"
  36. + MPDEC=no
  37. +fi
  38. +AC_SUBST(MPDEC)
  39. # Check for support for loadable sqlite extensions
  40. AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
  41. diff --git a/setup.py b/setup.py
  42. index 7fe68e8..364b350 100644
  43. --- a/setup.py
  44. +++ b/setup.py
  45. @@ -1988,7 +1988,7 @@ class PyBuildExt(build_ext):
  46. def _decimal_ext(self):
  47. extra_compile_args = []
  48. undef_macros = []
  49. - if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
  50. + if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"):
  51. include_dirs = []
  52. libraries = [':libmpdec.so.2']
  53. sources = ['_decimal/_decimal.c']
  54. --
  55. 2.6.4