This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients christian.heimes
Date 2021-10-22.15:22:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634916163.65.0.792026628337.issue45573@roundup.psfhosted.org>
In-reply-to
Content
pkg-config [1] is a standard tool on Linux and other platforms to detect presence of dependencies as well as to figure out which compiler and linker flags they require. Development packages provide a .pc file, e.g. ncurses provides a ncursesw.pc file.

$ pkg-config --libs --cflags ncursesw
-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -lncursesw -ltinfo

I propose to use a modified version of pkg-config's PKG_HAVE_DEFINE_WITH_MODULES macro in our configure script. On succss the modified macro defines:

* HAVE_FOO=1
* FOO_CFLAGS="some compile flags"
* FOO_LIBS="some library flags for linker"

On error, it sets nothing and does not cause configure to stop with an error.

The macro also allows users to override flags by setting FOO_CFLAGS and FOO_LIBS env vars. HAVE_FOO is added to pyconfig.h. The FOO_CFLAGS/LIBS are added to Makefile, from where it can be consumed by Modules/Setup.

Eventually Python could use the flags in setup.py, too. For now I would like to start with Modules/Setup. It is only used by some power users and has less risk of breaking the setup of beginners.

[1] https://www.freedesktop.org/wiki/Software/pkg-config/
History
Date User Action Args
2021-10-22 15:22:43christian.heimessetrecipients: + christian.heimes
2021-10-22 15:22:43christian.heimessetmessageid: <1634916163.65.0.792026628337.issue45573@roundup.psfhosted.org>
2021-10-22 15:22:43christian.heimeslinkissue45573 messages
2021-10-22 15:22:43christian.heimescreate