Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

gh-115119: Detect _decimal dependencies using pkg-config #115406

Merged
merged 8 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,17 @@ Options for third-party dependencies
C compiler and linker flags for ``libffi``, used by :mod:`ctypes` module,
overriding ``pkg-config``.

.. option:: LIBMPDEC_CFLAGS
.. option:: LIBMPDEC_LIBS

C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module,
overriding ``pkg-config``.

.. note::

These environment variables have no effect unless
:option:`--with-system-libmpdec` is specified.

.. option:: LIBLZMA_CFLAGS
.. option:: LIBLZMA_LIBS

Expand Down Expand Up @@ -798,6 +809,8 @@ Libraries options

.. versionadded:: 3.3

.. seealso:: :option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`.

.. option:: --with-readline=readline|editline

Designate a backend library for the :mod:`readline` module.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:program:`configure` now uses :program:`pkg-config` to detect :mod:`decimal`
dependencies if the :option:`--with-system-libmpdec` option is given.
14 changes: 13 additions & 1 deletion Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_typeobject.h"
#include "complexobject.h"
#include "mpdecimal.h"

#include <mpdecimal.h>

// Reuse config from mpdecimal.h if present.
#if defined(MPD_CONFIG_64)
#ifndef CONFIG_64
#define CONFIG_64 MPD_CONFIG_64
#endif
#elif defined(MPD_CONFIG_32)
#ifndef CONFIG_32
#define CONFIG_32 MPD_CONFIG_32
#endif
#endif

#include <ctype.h> // isascii()
#include <stdlib.h>
Expand Down
159 changes: 118 additions & 41 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading