mirror of https://github.com/python/cpython
bpo-45798: Move _decimal build setup into configure (GH-29541)
Settings for :mod:`decimal` internal C extension are now detected by :program:`configure`. The bundled `libmpdec` library is built in ``Makefile``. Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
4c792f39e6
commit
0486570f7b
102
Makefile.pre.in
102
Makefile.pre.in
|
@ -496,6 +496,47 @@ LIBRARY_OBJS= \
|
||||||
DTRACE_DEPS = \
|
DTRACE_DEPS = \
|
||||||
Python/ceval.o Python/import.o Python/sysmodule.o Modules/gcmodule.o
|
Python/ceval.o Python/import.o Python/sysmodule.o Modules/gcmodule.o
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# decimal's libmpdec
|
||||||
|
|
||||||
|
LIBMPDEC_OBJS= \
|
||||||
|
Modules/_decimal/libmpdec/basearith.o \
|
||||||
|
Modules/_decimal/libmpdec/constants.o \
|
||||||
|
Modules/_decimal/libmpdec/context.o \
|
||||||
|
Modules/_decimal/libmpdec/convolute.o \
|
||||||
|
Modules/_decimal/libmpdec/crt.o \
|
||||||
|
Modules/_decimal/libmpdec/difradix2.o \
|
||||||
|
Modules/_decimal/libmpdec/fnt.o \
|
||||||
|
Modules/_decimal/libmpdec/fourstep.o \
|
||||||
|
Modules/_decimal/libmpdec/io.o \
|
||||||
|
Modules/_decimal/libmpdec/mpalloc.o \
|
||||||
|
Modules/_decimal/libmpdec/mpdecimal.o \
|
||||||
|
Modules/_decimal/libmpdec/numbertheory.o \
|
||||||
|
Modules/_decimal/libmpdec/sixstep.o \
|
||||||
|
Modules/_decimal/libmpdec/transpose.o
|
||||||
|
# _decimal does not use signaling API
|
||||||
|
# Modules/_decimal/libmpdec/mpsignal.o
|
||||||
|
|
||||||
|
LIBMPDEC_HEADERS= \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/basearith.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/bits.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/constants.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/convolute.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/crt.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/difradix2.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/fnt.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/fourstep.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/io.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/mpalloc.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/mpdecimal.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/numbertheory.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/sixstep.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/transpose.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/typearith.h \
|
||||||
|
$(srcdir)/Modules/_decimal/libmpdec/umodarith.h
|
||||||
|
|
||||||
|
LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Rules
|
# Rules
|
||||||
|
|
||||||
|
@ -647,7 +688,7 @@ $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl
|
||||||
# -s, --silent or --quiet is always the first char.
|
# -s, --silent or --quiet is always the first char.
|
||||||
# Under BSD make, MAKEFLAGS might be " -s -v x=y".
|
# Under BSD make, MAKEFLAGS might be " -s -v x=y".
|
||||||
# Ignore macros passed by GNU make, passed after --
|
# Ignore macros passed by GNU make, passed after --
|
||||||
sharedmods: $(BUILDPYTHON) pybuilddir.txt
|
sharedmods: $(BUILDPYTHON) pybuilddir.txt @LIBMPDEC_INTERNAL@
|
||||||
@case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \
|
@case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \
|
||||||
*\ -s*|s*) quiet="-q";; \
|
*\ -s*|s*) quiet="-q";; \
|
||||||
*) quiet="";; \
|
*) quiet="";; \
|
||||||
|
@ -729,6 +770,63 @@ $(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
|
||||||
else true; \
|
else true; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# Build static libmpdec.a
|
||||||
|
LIBMPDEC_CFLAGS=$(PY_STDMODULE_CFLAGS) $(CCSHARED) @LIBMPDEC_CFLAGS@
|
||||||
|
|
||||||
|
# for setup.py
|
||||||
|
DECIMAL_CFLAGS=@LIBMPDEC_CFLAGS@
|
||||||
|
DECIMAL_LDFLAGS=@LIBMPDEC_LDFLAGS@
|
||||||
|
|
||||||
|
# "%.o: %c" is not portable
|
||||||
|
Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/basearith.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/constants.o: $(srcdir)/Modules/_decimal/libmpdec/constants.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/constants.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/context.o: $(srcdir)/Modules/_decimal/libmpdec/context.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/context.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/convolute.o: $(srcdir)/Modules/_decimal/libmpdec/convolute.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/convolute.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/crt.o: $(srcdir)/Modules/_decimal/libmpdec/crt.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/crt.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/difradix2.o: $(srcdir)/Modules/_decimal/libmpdec/difradix2.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/difradix2.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/fnt.o: $(srcdir)/Modules/_decimal/libmpdec/fnt.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/fnt.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/fourstep.o: $(srcdir)/Modules/_decimal/libmpdec/fourstep.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/fourstep.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/io.o: $(srcdir)/Modules/_decimal/libmpdec/io.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/io.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/mpalloc.o: $(srcdir)/Modules/_decimal/libmpdec/mpalloc.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpalloc.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/mpdecimal.o: $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/mpsignal.o: $(srcdir)/Modules/_decimal/libmpdec/mpsignal.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/mpsignal.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/numbertheory.o: $(srcdir)/Modules/_decimal/libmpdec/numbertheory.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/numbertheory.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/sixstep.o: $(srcdir)/Modules/_decimal/libmpdec/sixstep.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/sixstep.c
|
||||||
|
|
||||||
|
Modules/_decimal/libmpdec/transpose.o: $(srcdir)/Modules/_decimal/libmpdec/transpose.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
|
||||||
|
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/transpose.c
|
||||||
|
|
||||||
|
$(LIBMPDEC_A): $(LIBMPDEC_OBJS)
|
||||||
|
-rm -f $@
|
||||||
|
$(AR) $(ARFLAGS) $@ $(LIBMPDEC_OBJS)
|
||||||
|
|
||||||
# create relative links from build/lib.platform/egg.so to Modules/egg.so
|
# create relative links from build/lib.platform/egg.so to Modules/egg.so
|
||||||
# pybuilddir.txt is created too late. We cannot use it in Makefile
|
# pybuilddir.txt is created too late. We cannot use it in Makefile
|
||||||
|
@ -2313,7 +2411,7 @@ MODULE_PYEXPAT_DEPS=$(srcdir)/Modules/expat/ascii.h $(srcdir)/Modules/expat/asci
|
||||||
MODULE_UNICODEDATA_DEPS=$(srcdir)/Modules/unicodedata_db.h $(srcdir)/Modules/unicodename_db.h
|
MODULE_UNICODEDATA_DEPS=$(srcdir)/Modules/unicodedata_db.h $(srcdir)/Modules/unicodename_db.h
|
||||||
MODULE__BLAKE2_DEPS=$(srcdir)/Modules/_blake2/impl/blake2-config.h $(srcdir)/Modules/_blake2/impl/blake2-dispatch.c $(srcdir)/Modules/_blake2/impl/blake2-impl.h $(srcdir)/Modules/_blake2/impl/blake2-kat.h $(srcdir)/Modules/_blake2/impl/blake2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2b-ref.c $(srcdir)/Modules/_blake2/impl/blake2b-round.h $(srcdir)/Modules/_blake2/impl/blake2b-test.c $(srcdir)/Modules/_blake2/impl/blake2b.c $(srcdir)/Modules/_blake2/impl/blake2bp-test.c $(srcdir)/Modules/_blake2/impl/blake2bp.c $(srcdir)/Modules/_blake2/impl/blake2s-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2s-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2s-load-xop.h $(srcdir)/Modules/_blake2/impl/blake2s-ref.c $(srcdir)/Modules/_blake2/impl/blake2s-round.h $(srcdir)/Modules/_blake2/impl/blake2s-test.c $(srcdir)/Modules/_blake2/impl/blake2s.c $(srcdir)/Modules/_blake2/impl/blake2sp-test.c $(srcdir)/Modules/_blake2/impl/blake2sp.c $(srcdir)/Modules/hashlib.h
|
MODULE__BLAKE2_DEPS=$(srcdir)/Modules/_blake2/impl/blake2-config.h $(srcdir)/Modules/_blake2/impl/blake2-dispatch.c $(srcdir)/Modules/_blake2/impl/blake2-impl.h $(srcdir)/Modules/_blake2/impl/blake2-kat.h $(srcdir)/Modules/_blake2/impl/blake2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2b-ref.c $(srcdir)/Modules/_blake2/impl/blake2b-round.h $(srcdir)/Modules/_blake2/impl/blake2b-test.c $(srcdir)/Modules/_blake2/impl/blake2b.c $(srcdir)/Modules/_blake2/impl/blake2bp-test.c $(srcdir)/Modules/_blake2/impl/blake2bp.c $(srcdir)/Modules/_blake2/impl/blake2s-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2s-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2s-load-xop.h $(srcdir)/Modules/_blake2/impl/blake2s-ref.c $(srcdir)/Modules/_blake2/impl/blake2s-round.h $(srcdir)/Modules/_blake2/impl/blake2s-test.c $(srcdir)/Modules/_blake2/impl/blake2s.c $(srcdir)/Modules/_blake2/impl/blake2sp-test.c $(srcdir)/Modules/_blake2/impl/blake2sp.c $(srcdir)/Modules/hashlib.h
|
||||||
MODULE__CTYPES_DEPS=$(srcdir)/Modules/_ctypes/ctypes.h
|
MODULE__CTYPES_DEPS=$(srcdir)/Modules/_ctypes/ctypes.h
|
||||||
MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h $(srcdir)/Modules/_decimal/libmpdec/basearith.h $(srcdir)/Modules/_decimal/libmpdec/bits.h $(srcdir)/Modules/_decimal/libmpdec/constants.h $(srcdir)/Modules/_decimal/libmpdec/convolute.h $(srcdir)/Modules/_decimal/libmpdec/crt.h $(srcdir)/Modules/_decimal/libmpdec/difradix2.h $(srcdir)/Modules/_decimal/libmpdec/fnt.h $(srcdir)/Modules/_decimal/libmpdec/fourstep.h $(srcdir)/Modules/_decimal/libmpdec/io.h $(srcdir)/Modules/_decimal/libmpdec/mpalloc.h $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.h $(srcdir)/Modules/_decimal/libmpdec/numbertheory.h $(srcdir)/Modules/_decimal/libmpdec/sixstep.h $(srcdir)/Modules/_decimal/libmpdec/transpose.h $(srcdir)/Modules/_decimal/libmpdec/typearith.h $(srcdir)/Modules/_decimal/libmpdec/umodarith.h
|
MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h $(LIBMPDEC_HEADERS) @LIBMPDEC_INTERNAL@
|
||||||
MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/expat/ascii.h $(srcdir)/Modules/expat/asciitab.h $(srcdir)/Modules/expat/expat.h $(srcdir)/Modules/expat/expat_config.h $(srcdir)/Modules/expat/expat_external.h $(srcdir)/Modules/expat/internal.h $(srcdir)/Modules/expat/latin1tab.h $(srcdir)/Modules/expat/utf8tab.h $(srcdir)/Modules/expat/xmlparse.c $(srcdir)/Modules/expat/xmlrole.c $(srcdir)/Modules/expat/xmlrole.h $(srcdir)/Modules/expat/xmltok.c $(srcdir)/Modules/expat/xmltok.h $(srcdir)/Modules/expat/xmltok_impl.h $(srcdir)/Modules/pyexpat.c
|
MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/expat/ascii.h $(srcdir)/Modules/expat/asciitab.h $(srcdir)/Modules/expat/expat.h $(srcdir)/Modules/expat/expat_config.h $(srcdir)/Modules/expat/expat_external.h $(srcdir)/Modules/expat/internal.h $(srcdir)/Modules/expat/latin1tab.h $(srcdir)/Modules/expat/utf8tab.h $(srcdir)/Modules/expat/xmlparse.c $(srcdir)/Modules/expat/xmlrole.c $(srcdir)/Modules/expat/xmlrole.h $(srcdir)/Modules/expat/xmltok.c $(srcdir)/Modules/expat/xmltok.h $(srcdir)/Modules/expat/xmltok_impl.h $(srcdir)/Modules/pyexpat.c
|
||||||
MODULE__HASHLIB_DEPS=$(srcdir)/Modules/hashlib.h
|
MODULE__HASHLIB_DEPS=$(srcdir)/Modules/hashlib.h
|
||||||
MODULE__IO_DEPS=$(srcdir)/Modules/_io/_iomodule.h
|
MODULE__IO_DEPS=$(srcdir)/Modules/_io/_iomodule.h
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Settings for :mod:`decimal` internal C extension are now detected by
|
||||||
|
``configure``. The bundled ``libmpdec`` library is built in ``Makefile``.
|
|
@ -149,8 +149,7 @@ time timemodule.c
|
||||||
#_contextvars _contextvarsmodule.c
|
#_contextvars _contextvarsmodule.c
|
||||||
#_csv _csv.c
|
#_csv _csv.c
|
||||||
#_datetime _datetimemodule.c
|
#_datetime _datetimemodule.c
|
||||||
# UNIVERSAL: let mpdecimal.h detect settings
|
#_decimal _decimal/_decimal.c $(DECIMAL_CFLAGS) $(DECIMAL_LDFLAGS)
|
||||||
#_decimal -DUNIVERSAL -I$(srcdir)/Modules/_decimal/libmpdec _decimal/_decimal.c _decimal/libmpdec/basearith.c _decimal/libmpdec/constants.c _decimal/libmpdec/context.c _decimal/libmpdec/convolute.c _decimal/libmpdec/crt.c _decimal/libmpdec/difradix2.c _decimal/libmpdec/fnt.c _decimal/libmpdec/fourstep.c _decimal/libmpdec/io.c _decimal/libmpdec/mpalloc.c _decimal/libmpdec/mpdecimal.c _decimal/libmpdec/numbertheory.c _decimal/libmpdec/sixstep.c _decimal/libmpdec/transpose.c
|
|
||||||
#_heapq _heapqmodule.c
|
#_heapq _heapqmodule.c
|
||||||
#_json _json.c
|
#_json _json.c
|
||||||
#_lsprof _lsprof.c rotatingtree.c
|
#_lsprof _lsprof.c rotatingtree.c
|
||||||
|
|
|
@ -184,6 +184,11 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
|
||||||
*.c++) srcs="$srcs $arg";;
|
*.c++) srcs="$srcs $arg";;
|
||||||
*.cxx) srcs="$srcs $arg";;
|
*.cxx) srcs="$srcs $arg";;
|
||||||
*.cpp) srcs="$srcs $arg";;
|
*.cpp) srcs="$srcs $arg";;
|
||||||
|
\$\(*_CFLAGS\)) cpps="$cpps $arg";;
|
||||||
|
\$\(*_INCLUDES\)) cpps="$cpps $arg";;
|
||||||
|
\$\(*_LIBS\)) libs="$libs $arg";;
|
||||||
|
\$\(*_LDFLAGS\)) libs="$libs $arg";;
|
||||||
|
\$\(*_RPATH\)) libs="$libs $arg";;
|
||||||
\$*) libs="$libs $arg"
|
\$*) libs="$libs $arg"
|
||||||
cpps="$cpps $arg";;
|
cpps="$cpps $arg";;
|
||||||
*.*) echo 1>&2 "bad word $arg in $line"
|
*.*) echo 1>&2 "bad word $arg in $line"
|
||||||
|
|
|
@ -660,6 +660,9 @@ DFLAGS
|
||||||
DTRACE
|
DTRACE
|
||||||
TCLTK_LIBS
|
TCLTK_LIBS
|
||||||
TCLTK_INCLUDES
|
TCLTK_INCLUDES
|
||||||
|
LIBMPDEC_INTERNAL
|
||||||
|
LIBMPDEC_LDFLAGS
|
||||||
|
LIBMPDEC_CFLAGS
|
||||||
LIBFFI_INCLUDEDIR
|
LIBFFI_INCLUDEDIR
|
||||||
TZPATH
|
TZPATH
|
||||||
SHLIBS
|
SHLIBS
|
||||||
|
@ -1533,7 +1536,8 @@ Optional Features:
|
||||||
Optional Packages:
|
Optional Packages:
|
||||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||||
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
||||||
--with-pkg-config use pkg-config to detect build options (default is
|
--with-pkg-config=[yes|no|check]
|
||||||
|
use pkg-config to detect build options (default is
|
||||||
check)
|
check)
|
||||||
--with-universal-archs=ARCH
|
--with-universal-archs=ARCH
|
||||||
specify the kind of macOS universal binary that
|
specify the kind of macOS universal binary that
|
||||||
|
@ -10764,10 +10768,27 @@ else
|
||||||
with_system_libmpdec="no"
|
with_system_libmpdec="no"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_system_libmpdec" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_system_libmpdec" >&5
|
||||||
$as_echo "$with_system_libmpdec" >&6; }
|
$as_echo "$with_system_libmpdec" >&6; }
|
||||||
|
|
||||||
|
if test "x$with_system_libmpdec" = xyes; then :
|
||||||
|
|
||||||
|
LIBMPDEC_CFLAGS=""
|
||||||
|
LIBMPDEC_LDFLAGS="-lmpdec"
|
||||||
|
LIBMPDEC_INTERNAL=
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
|
||||||
|
LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
|
||||||
|
LIBMPDEC_INTERNAL="\$(LIBMPDEC_A)"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether _decimal should use a coroutine-local or thread-local context
|
# Check whether _decimal should use a coroutine-local or thread-local context
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-decimal-contextvar" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-decimal-contextvar" >&5
|
||||||
$as_echo_n "checking for --with-decimal-contextvar... " >&6; }
|
$as_echo_n "checking for --with-decimal-contextvar... " >&6; }
|
||||||
|
@ -10790,6 +10811,95 @@ fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_decimal_contextvar" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_decimal_contextvar" >&5
|
||||||
$as_echo "$with_decimal_contextvar" >&6; }
|
$as_echo "$with_decimal_contextvar" >&6; }
|
||||||
|
|
||||||
|
# Check for libmpdec machine flavor
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for decimal libmpdec machine" >&5
|
||||||
|
$as_echo_n "checking for decimal libmpdec machine... " >&6; }
|
||||||
|
case $ac_sys_system in #(
|
||||||
|
Darwin*) :
|
||||||
|
libmpdec_system=Darwin ;; #(
|
||||||
|
SunOS*) :
|
||||||
|
libmpdec_system=sunos ;; #(
|
||||||
|
*) :
|
||||||
|
libmpdec_system=other
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
libmpdec_machine=unknown
|
||||||
|
if test "$libmpdec_system" = Darwin; then
|
||||||
|
case $MACOSX_DEFAULT_ARCH in #(
|
||||||
|
i386) :
|
||||||
|
libmpdec_machine=ansi32 ;; #(
|
||||||
|
ppc) :
|
||||||
|
libmpdec_machine=ansi32 ;; #(
|
||||||
|
x86_64) :
|
||||||
|
libmpdec_machine=x64 ;; #(
|
||||||
|
ppc64) :
|
||||||
|
libmpdec_machine=ansi64 ;; #(
|
||||||
|
arm64) :
|
||||||
|
libmpdec_machine=ansi64 ;; #(
|
||||||
|
*) :
|
||||||
|
libmpdec_machine=universal
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
elif test $ac_cv_sizeof_size_t -eq 8; then
|
||||||
|
if test "$ac_cv_gcc_asm_for_x64" = yes; then
|
||||||
|
libmpdec_machine=x64
|
||||||
|
elif test "$ac_cv_type___uint128_t" = yes; then
|
||||||
|
libmpdec_machine=uint128
|
||||||
|
else
|
||||||
|
libmpdec_machine=ansi64
|
||||||
|
fi
|
||||||
|
elif test $ac_cv_sizeof_size_t -eq 4; then
|
||||||
|
if test "$ac_cv_gcc_asm_for_x87" = yes -a "$libmpdec_system" != sunos; then
|
||||||
|
case $CC in #(
|
||||||
|
*gcc*) :
|
||||||
|
libmpdec_machine=ppro ;; #(
|
||||||
|
*clang*) :
|
||||||
|
libmpdec_machine=ppro ;; #(
|
||||||
|
*) :
|
||||||
|
libmpdec_machine=ansi32
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
libmpdec_machine=ansi32
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libmpdec_machine" >&5
|
||||||
|
$as_echo "$libmpdec_machine" >&6; }
|
||||||
|
|
||||||
|
case $libmpdec_machine in #(
|
||||||
|
x64) :
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -DCONFIG_64=1 -DASM=1" ;; #(
|
||||||
|
uint128) :
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -DCONFIG_64=1 -DANSI=1 -DHAVE_UINT128_T=1" ;; #(
|
||||||
|
ansi64) :
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -DCONFIG_64=1 -DANSI=1" ;; #(
|
||||||
|
ppro) :
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -DCONFIG_32=1 -DANSI=1 -DASM=1 -Wno-unknown-pragmas" ;; #(
|
||||||
|
ansi32) :
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -DCONFIG_32=1 -DANSI=1" ;; #(
|
||||||
|
ansi-legacy) :
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -DCONFIG_32=1 -DANSI=1 -DLEGACY_COMPILER=1" ;; #(
|
||||||
|
universal) :
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -DUNIVERSAL=1" ;; #(
|
||||||
|
*) :
|
||||||
|
as_fn_error $? "_decimal: unsupported architecture" "$LINENO" 5
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test "$have_ipa_pure_const_bug" = yes; then
|
||||||
|
# Some versions of gcc miscompile inline asm:
|
||||||
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
|
||||||
|
# https://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -fno-ipa-pure-const"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$have_glibc_memmove_bug" = yes; then
|
||||||
|
# _FORTIFY_SOURCE wrappers for memmove and bcopy are incorrect:
|
||||||
|
# https://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
|
||||||
|
as_fn_append LIBMPDEC_CFLAGS " -U_FORTIFY_SOURCE"
|
||||||
|
fi
|
||||||
|
|
||||||
# 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; }
|
||||||
|
|
78
configure.ac
78
configure.ac
|
@ -3057,9 +3057,22 @@ AC_ARG_WITH(system_libmpdec,
|
||||||
AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]),
|
AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]),
|
||||||
[],
|
[],
|
||||||
[with_system_libmpdec="no"])
|
[with_system_libmpdec="no"])
|
||||||
|
|
||||||
AC_MSG_RESULT($with_system_libmpdec)
|
AC_MSG_RESULT($with_system_libmpdec)
|
||||||
|
|
||||||
|
AS_VAR_IF([with_system_libmpdec], [yes], [
|
||||||
|
LIBMPDEC_CFLAGS=""
|
||||||
|
LIBMPDEC_LDFLAGS="-lmpdec"
|
||||||
|
LIBMPDEC_INTERNAL=
|
||||||
|
], [
|
||||||
|
LIBMPDEC_CFLAGS="-I\$(srcdir)/Modules/_decimal/libmpdec"
|
||||||
|
LIBMPDEC_LDFLAGS="-lm \$(LIBMPDEC_A)"
|
||||||
|
LIBMPDEC_INTERNAL="\$(LIBMPDEC_A)"
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_SUBST([LIBMPDEC_CFLAGS])
|
||||||
|
AC_SUBST([LIBMPDEC_LDFLAGS])
|
||||||
|
AC_SUBST([LIBMPDEC_INTERNAL])
|
||||||
|
|
||||||
# Check whether _decimal should use a coroutine-local or thread-local context
|
# Check whether _decimal should use a coroutine-local or thread-local context
|
||||||
AC_MSG_CHECKING(for --with-decimal-contextvar)
|
AC_MSG_CHECKING(for --with-decimal-contextvar)
|
||||||
AC_ARG_WITH(decimal_contextvar,
|
AC_ARG_WITH(decimal_contextvar,
|
||||||
|
@ -3075,6 +3088,69 @@ fi
|
||||||
|
|
||||||
AC_MSG_RESULT($with_decimal_contextvar)
|
AC_MSG_RESULT($with_decimal_contextvar)
|
||||||
|
|
||||||
|
# Check for libmpdec machine flavor
|
||||||
|
AC_MSG_CHECKING(for decimal libmpdec machine)
|
||||||
|
AS_CASE([$ac_sys_system],
|
||||||
|
[Darwin*], [libmpdec_system=Darwin],
|
||||||
|
[SunOS*], [libmpdec_system=sunos],
|
||||||
|
[libmpdec_system=other]
|
||||||
|
)
|
||||||
|
|
||||||
|
libmpdec_machine=unknown
|
||||||
|
if test "$libmpdec_system" = Darwin; then
|
||||||
|
AS_CASE([$MACOSX_DEFAULT_ARCH],
|
||||||
|
[i386], [libmpdec_machine=ansi32],
|
||||||
|
[ppc], [libmpdec_machine=ansi32],
|
||||||
|
[x86_64], [libmpdec_machine=x64],
|
||||||
|
[ppc64], [libmpdec_machine=ansi64],
|
||||||
|
[arm64], [libmpdec_machine=ansi64],
|
||||||
|
[libmpdec_machine=universal]
|
||||||
|
)
|
||||||
|
elif test $ac_cv_sizeof_size_t -eq 8; then
|
||||||
|
if test "$ac_cv_gcc_asm_for_x64" = yes; then
|
||||||
|
libmpdec_machine=x64
|
||||||
|
elif test "$ac_cv_type___uint128_t" = yes; then
|
||||||
|
libmpdec_machine=uint128
|
||||||
|
else
|
||||||
|
libmpdec_machine=ansi64
|
||||||
|
fi
|
||||||
|
elif test $ac_cv_sizeof_size_t -eq 4; then
|
||||||
|
if test "$ac_cv_gcc_asm_for_x87" = yes -a "$libmpdec_system" != sunos; then
|
||||||
|
AS_CASE([$CC],
|
||||||
|
[*gcc*], [libmpdec_machine=ppro],
|
||||||
|
[*clang*], [libmpdec_machine=ppro],
|
||||||
|
[libmpdec_machine=ansi32]
|
||||||
|
)
|
||||||
|
else
|
||||||
|
libmpdec_machine=ansi32
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT([$libmpdec_machine])
|
||||||
|
|
||||||
|
AS_CASE([$libmpdec_machine],
|
||||||
|
[x64], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_64=1 -DASM=1"])],
|
||||||
|
[uint128], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_64=1 -DANSI=1 -DHAVE_UINT128_T=1"])],
|
||||||
|
[ansi64], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_64=1 -DANSI=1"])],
|
||||||
|
[ppro], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_32=1 -DANSI=1 -DASM=1 -Wno-unknown-pragmas"])],
|
||||||
|
[ansi32], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_32=1 -DANSI=1"])],
|
||||||
|
[ansi-legacy], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DCONFIG_32=1 -DANSI=1 -DLEGACY_COMPILER=1"])],
|
||||||
|
[universal], [AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -DUNIVERSAL=1"])],
|
||||||
|
[AC_MSG_ERROR([_decimal: unsupported architecture])]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "$have_ipa_pure_const_bug" = yes; then
|
||||||
|
# Some versions of gcc miscompile inline asm:
|
||||||
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
|
||||||
|
# https://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
|
||||||
|
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -fno-ipa-pure-const"])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$have_glibc_memmove_bug" = yes; then
|
||||||
|
# _FORTIFY_SOURCE wrappers for memmove and bcopy are incorrect:
|
||||||
|
# https://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
|
||||||
|
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -U_FORTIFY_SOURCE"])
|
||||||
|
fi
|
||||||
|
|
||||||
# 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,
|
||||||
|
|
121
setup.py
121
setup.py
|
@ -7,6 +7,7 @@ import importlib.util
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
import sysconfig
|
import sysconfig
|
||||||
import warnings
|
import warnings
|
||||||
|
@ -2016,117 +2017,27 @@ class PyBuildExt(build_ext):
|
||||||
|
|
||||||
def detect_decimal(self):
|
def detect_decimal(self):
|
||||||
# Stefan Krah's _decimal module
|
# Stefan Krah's _decimal module
|
||||||
extra_compile_args = []
|
sources = ['_decimal/_decimal.c']
|
||||||
undef_macros = []
|
depends = ['_decimal/docstrings.h']
|
||||||
if '--with-system-libmpdec' in sysconfig.get_config_var("CONFIG_ARGS"):
|
define_macros = []
|
||||||
include_dirs = []
|
|
||||||
libraries = ['mpdec']
|
cflags = sysconfig.get_config_var("DECIMAL_CFLAGS")
|
||||||
sources = ['_decimal/_decimal.c']
|
extra_compile_args = shlex.split(cflags) if cflags else None
|
||||||
depends = ['_decimal/docstrings.h']
|
# ldflags includes either system libmpdec or full path to
|
||||||
else:
|
# our static libmpdec.a.
|
||||||
include_dirs = [os.path.abspath(os.path.join(self.srcdir,
|
ldflags = sysconfig.get_config_var("DECIMAL_LDFLAGS")
|
||||||
'Modules',
|
extra_link_args = shlex.split(ldflags) if ldflags else None
|
||||||
'_decimal',
|
|
||||||
'libmpdec'))]
|
libmpdec_a = sysconfig.get_config_var("LIBMPDEC_A")
|
||||||
libraries = ['m']
|
if libmpdec_a:
|
||||||
sources = [
|
depends.append(libmpdec_a)
|
||||||
'_decimal/_decimal.c',
|
|
||||||
'_decimal/libmpdec/basearith.c',
|
|
||||||
'_decimal/libmpdec/constants.c',
|
|
||||||
'_decimal/libmpdec/context.c',
|
|
||||||
'_decimal/libmpdec/convolute.c',
|
|
||||||
'_decimal/libmpdec/crt.c',
|
|
||||||
'_decimal/libmpdec/difradix2.c',
|
|
||||||
'_decimal/libmpdec/fnt.c',
|
|
||||||
'_decimal/libmpdec/fourstep.c',
|
|
||||||
'_decimal/libmpdec/io.c',
|
|
||||||
'_decimal/libmpdec/mpalloc.c',
|
|
||||||
'_decimal/libmpdec/mpdecimal.c',
|
|
||||||
'_decimal/libmpdec/numbertheory.c',
|
|
||||||
'_decimal/libmpdec/sixstep.c',
|
|
||||||
'_decimal/libmpdec/transpose.c',
|
|
||||||
]
|
|
||||||
depends = [
|
|
||||||
'_decimal/docstrings.h',
|
|
||||||
'_decimal/libmpdec/basearith.h',
|
|
||||||
'_decimal/libmpdec/bits.h',
|
|
||||||
'_decimal/libmpdec/constants.h',
|
|
||||||
'_decimal/libmpdec/convolute.h',
|
|
||||||
'_decimal/libmpdec/crt.h',
|
|
||||||
'_decimal/libmpdec/difradix2.h',
|
|
||||||
'_decimal/libmpdec/fnt.h',
|
|
||||||
'_decimal/libmpdec/fourstep.h',
|
|
||||||
'_decimal/libmpdec/io.h',
|
|
||||||
'_decimal/libmpdec/mpalloc.h',
|
|
||||||
'_decimal/libmpdec/mpdecimal.h',
|
|
||||||
'_decimal/libmpdec/numbertheory.h',
|
|
||||||
'_decimal/libmpdec/sixstep.h',
|
|
||||||
'_decimal/libmpdec/transpose.h',
|
|
||||||
'_decimal/libmpdec/typearith.h',
|
|
||||||
'_decimal/libmpdec/umodarith.h',
|
|
||||||
]
|
|
||||||
|
|
||||||
config = {
|
|
||||||
'x64': [('CONFIG_64','1'), ('ASM','1')],
|
|
||||||
'uint128': [('CONFIG_64','1'), ('ANSI','1'), ('HAVE_UINT128_T','1')],
|
|
||||||
'ansi64': [('CONFIG_64','1'), ('ANSI','1')],
|
|
||||||
'ppro': [('CONFIG_32','1'), ('PPRO','1'), ('ASM','1')],
|
|
||||||
'ansi32': [('CONFIG_32','1'), ('ANSI','1')],
|
|
||||||
'ansi-legacy': [('CONFIG_32','1'), ('ANSI','1'),
|
|
||||||
('LEGACY_COMPILER','1')],
|
|
||||||
'universal': [('UNIVERSAL','1')]
|
|
||||||
}
|
|
||||||
|
|
||||||
cc = sysconfig.get_config_var('CC')
|
|
||||||
sizeof_size_t = sysconfig.get_config_var('SIZEOF_SIZE_T')
|
|
||||||
machine = os.environ.get('PYTHON_DECIMAL_WITH_MACHINE')
|
|
||||||
|
|
||||||
if machine:
|
|
||||||
# Override automatic configuration to facilitate testing.
|
|
||||||
define_macros = config[machine]
|
|
||||||
elif MACOS:
|
|
||||||
# Universal here means: build with the same options Python
|
|
||||||
# was built with.
|
|
||||||
define_macros = config['universal']
|
|
||||||
elif sizeof_size_t == 8:
|
|
||||||
if sysconfig.get_config_var('HAVE_GCC_ASM_FOR_X64'):
|
|
||||||
define_macros = config['x64']
|
|
||||||
elif sysconfig.get_config_var('HAVE_GCC_UINT128_T'):
|
|
||||||
define_macros = config['uint128']
|
|
||||||
else:
|
|
||||||
define_macros = config['ansi64']
|
|
||||||
elif sizeof_size_t == 4:
|
|
||||||
ppro = sysconfig.get_config_var('HAVE_GCC_ASM_FOR_X87')
|
|
||||||
if ppro and ('gcc' in cc or 'clang' in cc) and \
|
|
||||||
not 'sunos' in HOST_PLATFORM:
|
|
||||||
# solaris: problems with register allocation.
|
|
||||||
# icc >= 11.0 works as well.
|
|
||||||
define_macros = config['ppro']
|
|
||||||
extra_compile_args.append('-Wno-unknown-pragmas')
|
|
||||||
else:
|
|
||||||
define_macros = config['ansi32']
|
|
||||||
else:
|
|
||||||
raise DistutilsError("_decimal: unsupported architecture")
|
|
||||||
|
|
||||||
# Workarounds for toolchain bugs:
|
|
||||||
if sysconfig.get_config_var('HAVE_IPA_PURE_CONST_BUG'):
|
|
||||||
# Some versions of gcc miscompile inline asm:
|
|
||||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
|
|
||||||
# https://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
|
|
||||||
extra_compile_args.append('-fno-ipa-pure-const')
|
|
||||||
if sysconfig.get_config_var('HAVE_GLIBC_MEMMOVE_BUG'):
|
|
||||||
# _FORTIFY_SOURCE wrappers for memmove and bcopy are incorrect:
|
|
||||||
# https://sourceware.org/ml/libc-alpha/2010-12/msg00009.html
|
|
||||||
undef_macros.append('_FORTIFY_SOURCE')
|
|
||||||
|
|
||||||
# Uncomment for extra functionality:
|
# Uncomment for extra functionality:
|
||||||
#define_macros.append(('EXTRA_FUNCTIONALITY', 1))
|
#define_macros.append(('EXTRA_FUNCTIONALITY', 1))
|
||||||
self.add(Extension('_decimal',
|
self.add(Extension('_decimal',
|
||||||
include_dirs=include_dirs,
|
|
||||||
libraries=libraries,
|
|
||||||
define_macros=define_macros,
|
define_macros=define_macros,
|
||||||
undef_macros=undef_macros,
|
|
||||||
extra_compile_args=extra_compile_args,
|
extra_compile_args=extra_compile_args,
|
||||||
|
extra_link_args=extra_link_args,
|
||||||
sources=sources,
|
sources=sources,
|
||||||
depends=depends))
|
depends=depends))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue