From 092108ff97a30264657e3f998de754e691cc58f4 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 23 Jul 2021 08:50:39 +0200 Subject: [PATCH 108/N] build: Cleanup ncursesw include lookup code Mirror what si already done for libffi; Look it up via pkg-config and use the exported path via sysconfig in setup.py This should be merged into "dont include system ncurses path" --- Makefile.pre.in | 1 + configure.ac | 19 ++++++++++--------- setup.py | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 01cc055..fe25d9e 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -313,6 +313,7 @@ IO_OBJS= \ ########################################################################## LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ +NCURSESW_INCLUDEDIR= @NCURSESW_INCLUDEDIR@ ########################################################################## # Parser diff --git a/configure.ac b/configure.ac index 14e4c8c..bab62ad 100644 --- a/configure.ac +++ b/configure.ac @@ -5556,17 +5556,18 @@ then [Define if you have struct stat.st_mtimensec]) fi +if test -n "$PKG_CONFIG"; then + NCURSESW_INCLUDEDIR="`"$PKG_CONFIG" ncursesw --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`" +else + NCURSESW_INCLUDEDIR="" +fi +AC_SUBST(NCURSESW_INCLUDEDIR) + # first curses header check ac_save_cppflags="$CPPFLAGS" -case $host_os in - mingw*) - ;; - *) - if test "$cross_compiling" = no; then - CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" - fi - ;; -esac +if test "$cross_compiling" = no; then + CPPFLAGS="$CPPFLAGS -I$NCURSESW_INCLUDEDIR" +fi AC_CHECK_HEADERS(curses.h ncurses.h) diff --git a/setup.py b/setup.py index a2d5656..4e7a284 100644 --- a/setup.py +++ b/setup.py @@ -1098,7 +1098,7 @@ class PyBuildExt(build_ext): if curses_library == 'ncursesw': curses_defines.append(('HAVE_NCURSESW', '1')) if not CROSS_COMPILING: - curses_includes.append('/usr/include/ncursesw') + curses_includes.append(sysconfig.get_config_var("NCURSESW_INCLUDEDIR")) # Bug 1464056: If _curses.so links with ncursesw, # _curses_panel.so must link with panelw. panel_library = 'panelw' -- 2.32.0