111-optional-decimal.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. Add an option to disable decimal
  2. This patch replaces the existing --with-system-libmpdec option with a
  3. --with-libmpdec={system,builtin,none} option, which allows to tell
  4. Python whether we want to use the system libmpdec (already installed),
  5. the libmpdec builtin the Python sources, or no libmpdec at all.
  6. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  7. ---
  8. Index: b/configure.ac
  9. ===================================================================
  10. --- a/configure.ac
  11. +++ b/configure.ac
  12. @@ -2405,13 +2405,20 @@
  13. AC_MSG_RESULT($with_system_ffi)
  14. # Check for use of the system libmpdec library
  15. -AC_MSG_CHECKING(for --with-system-libmpdec)
  16. -AC_ARG_WITH(system_libmpdec,
  17. - AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library]),
  18. +AC_MSG_CHECKING(for --with-libmpdec)
  19. +AC_ARG_WITH(libmpdec,
  20. + AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]),
  21. [],
  22. - [with_system_libmpdec="no"])
  23. + [with_libmpdec="builtin"])
  24. -AC_MSG_RESULT($with_system_libmpdec)
  25. +AC_MSG_RESULT($with_libmpdec)
  26. +if test "$with_libmpdec" != "none"; then
  27. + MPDEC=yes
  28. +else
  29. + DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal"
  30. + MPDEC=no
  31. +fi
  32. +AC_SUBST(MPDEC)
  33. # Check for support for loadable sqlite extensions
  34. AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
  35. Index: b/setup.py
  36. ===================================================================
  37. --- a/setup.py
  38. +++ b/setup.py
  39. @@ -1968,7 +1968,7 @@
  40. def _decimal_ext(self):
  41. extra_compile_args = []
  42. undef_macros = []
  43. - if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
  44. + if '--with-libmpdec=system' in sysconfig.get_config_var("CONFIG_ARGS"):
  45. include_dirs = []
  46. libraries = [':libmpdec.so.2']
  47. sources = ['_decimal/_decimal.c']