Issue #7652: Enable linking of _decimal.so against an installed libmpdec.

This commit is contained in:
Stefan Krah 2012-03-23 19:06:27 +01:00
parent 0175af85a5
commit 60187b5ee5
4 changed files with 78 additions and 40 deletions

View File

@ -34,6 +34,9 @@ Core and Builtins
Library Library
------- -------
- Issue #7652: Add --with-system-libmpdec option to configure for linking
the _decimal module against an installed libmpdec.
- Issue #14380: MIMEText now defaults to utf-8 when passed non-ASCII unicode - Issue #14380: MIMEText now defaults to utf-8 when passed non-ASCII unicode
with no charset specified. with no charset specified.

18
configure vendored
View File

@ -762,6 +762,7 @@ with_pydebug
with_libs with_libs
with_system_expat with_system_expat
with_system_ffi with_system_ffi
with_system_libmpdec
enable_loadable_sqlite_extensions enable_loadable_sqlite_extensions
with_dbmliborder with_dbmliborder
with_signal_module with_signal_module
@ -1434,6 +1435,8 @@ Optional Packages:
--with-system-expat build pyexpat module using an installed expat --with-system-expat build pyexpat module using an installed expat
library library
--with-system-ffi build _ctypes module using an installed ffi library --with-system-ffi build _ctypes module using an installed ffi library
--with-system-libmpdec build _decimal module using an installed libmpdec
library
--with-dbmliborder=db1:db2:... --with-dbmliborder=db1:db2:...
order to check db backends for dbm. Valid value is a order to check db backends for dbm. Valid value is a
colon separated string with the backend names colon separated string with the backend names
@ -8501,6 +8504,21 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_system_ffi" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_system_ffi" >&5
$as_echo "$with_system_ffi" >&6; } $as_echo "$with_system_ffi" >&6; }
# Check for use of the system libmpdec library
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-system-libmpdec" >&5
$as_echo_n "checking for --with-system-libmpdec... " >&6; }
# Check whether --with-system_libmpdec was given.
if test "${with_system_libmpdec+set}" = set; then :
withval=$with_system_libmpdec;
else
with_system_libmpdec="no"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_system_libmpdec" >&5
$as_echo "$with_system_libmpdec" >&6; }
# Check for support for loadable sqlite extensions # Check for support for loadable sqlite extensions
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-loadable-sqlite-extensions" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-loadable-sqlite-extensions" >&5
$as_echo_n "checking for --enable-loadable-sqlite-extensions... " >&6; } $as_echo_n "checking for --enable-loadable-sqlite-extensions... " >&6; }

View File

@ -2048,6 +2048,15 @@ AC_SUBST(LIBFFI_INCLUDEDIR)
AC_MSG_RESULT($with_system_ffi) AC_MSG_RESULT($with_system_ffi)
# Check for use of the system libmpdec library
AC_MSG_CHECKING(for --with-system-libmpdec)
AC_ARG_WITH(system_libmpdec,
AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library]),
[],
[with_system_libmpdec="no"])
AC_MSG_RESULT($with_system_libmpdec)
# Check for support for loadable sqlite extensions # Check for support for loadable sqlite extensions
AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions) AC_MSG_CHECKING(for --enable-loadable-sqlite-extensions)
AC_ARG_ENABLE(loadable-sqlite-extensions, AC_ARG_ENABLE(loadable-sqlite-extensions,

View File

@ -1796,6 +1796,16 @@ class PyBuildExt(build_ext):
self.use_system_libffi = True self.use_system_libffi = True
def _decimal_ext(self): def _decimal_ext(self):
extra_compile_args = []
undef_macros=['NDEBUG']
if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
include_dirs = []
libraries = ['mpdec']
sources = ['_decimal/_decimal.c']
depends = ['_decimal/docstrings.h']
else:
include_dirs = ['./Modules/_decimal/libmpdec']
libraries = []
sources = [ sources = [
'_decimal/_decimal.c', '_decimal/_decimal.c',
'_decimal/libmpdec/basearith.c', '_decimal/libmpdec/basearith.c',
@ -1832,6 +1842,7 @@ class PyBuildExt(build_ext):
'_decimal/libmpdec/typearith.h', '_decimal/libmpdec/typearith.h',
'_decimal/libmpdec/umodarith.h', '_decimal/libmpdec/umodarith.h',
] ]
config = { config = {
'x64': [('CONFIG_64','1'), ('ASM','1')], 'x64': [('CONFIG_64','1'), ('ASM','1')],
'uint128': [('CONFIG_64','1'), ('ANSI','1'), ('HAVE_UINT128_T','1')], 'uint128': [('CONFIG_64','1'), ('ANSI','1'), ('HAVE_UINT128_T','1')],
@ -1843,10 +1854,6 @@ class PyBuildExt(build_ext):
'universal': [('UNIVERSAL','1')] 'universal': [('UNIVERSAL','1')]
} }
include_dirs = ['./Modules/_decimal/libmpdec']
extra_compile_args = []
undef_macros=['NDEBUG']
platform = self.get_platform() platform = self.get_platform()
cc = sysconfig.get_config_var('CC') cc = sysconfig.get_config_var('CC')
sizeof_size_t = sysconfig.get_config_var('SIZEOF_SIZE_T') sizeof_size_t = sysconfig.get_config_var('SIZEOF_SIZE_T')
@ -1898,6 +1905,7 @@ class PyBuildExt(build_ext):
ext = Extension ( ext = Extension (
'_decimal', '_decimal',
include_dirs=include_dirs, include_dirs=include_dirs,
libraries=libraries,
define_macros=define_macros, define_macros=define_macros,
undef_macros=undef_macros, undef_macros=undef_macros,
extra_compile_args=extra_compile_args, extra_compile_args=extra_compile_args,