Skip to content

Commit

Permalink
build: Fix ncursesw include lookup
Browse files Browse the repository at this point in the history
Mirror what is already done for libffi; Look it up via
pkg-config and use the exported path via sysconfig in setup.py
  • Loading branch information
Alexpux authored and lazka committed Jul 19, 2023
1 parent bac123a commit a27e104
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ IO_OBJS= \
##########################################################################

LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
NCURSESW_INCLUDEDIR= @NCURSESW_INCLUDEDIR@

##########################################################################
# Parser
Expand Down
9 changes: 8 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6410,10 +6410,17 @@ 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"
if test "$cross_compiling" = no; then
CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
CPPFLAGS="$CPPFLAGS -I$NCURSESW_INCLUDEDIR"
fi

AC_CHECK_HEADERS(curses.h ncurses.h)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ def detect_readline_curses(self):
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'
Expand Down

0 comments on commit a27e104

Please sign in to comment.