diff options
author | Erlend E. Aasland <erlend@python.org> | 2024-07-01 08:10:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-01 08:10:03 (GMT) |
commit | f80376b129ad947263a6b03a6c3a874e9f8706e6 (patch) | |
tree | 3544f2d954f5a817aae4f6514cf449af2c7e63db /Include/py_curses.h | |
parent | bd473aa598c5161521a7018896dc124728214a6c (diff) | |
download | cpython-f80376b129ad947263a6b03a6c3a874e9f8706e6.zip cpython-f80376b129ad947263a6b03a6c3a874e9f8706e6.tar.gz cpython-f80376b129ad947263a6b03a6c3a874e9f8706e6.tar.bz2 |
gh-113565: Improve and harden detection of curses dependencies (#119816)
1. Use pkg-config to check for ncursesw/panelw. If that fails, use
pkg-config to check for ncurses/panel.
2. Regardless of pkg-config output, search for curses/panel headers, so
we're sure we have all defines in pyconfig.h.
3. Regardless of pkg-config output, check if libncurses or libncursesw
contains the 'initscr' symbol; if it does _and_ pkg-config failed
earlier, add the resulting -llib linker option to CURSES_LIBS.
Ditto for 'update_panels' and PANEL_LIBS.
4. Wrap the rest of the checks with WITH_SAVE_ENV and make sure we're
using updated LIBS and CPPFLAGS for those.
Add the PY_CHECK_CURSES convenience macro.
Diffstat (limited to 'Include/py_curses.h')
-rw-r--r-- | Include/py_curses.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Include/py_curses.h b/Include/py_curses.h index a51d998..79b1b01 100644 --- a/Include/py_curses.h +++ b/Include/py_curses.h @@ -36,13 +36,21 @@ #define NCURSES_OPAQUE 0 #endif -#ifdef HAVE_NCURSES_H -#include <ncurses.h> -#else -#include <curses.h> +#if defined(HAVE_NCURSESW_NCURSES_H) +# include <ncursesw/ncurses.h> +#elif defined(HAVE_NCURSESW_CURSES_H) +# include <ncursesw/curses.h> +#elif defined(HAVE_NCURSES_NCURSES_H) +# include <ncurses/ncurses.h> +#elif defined(HAVE_NCURSES_CURSES_H) +# include <ncurses/curses.h> +#elif defined(HAVE_NCURSES_H) +# include <ncurses.h> +#elif defined(HAVE_CURSES_H) +# include <curses.h> #endif -#ifdef HAVE_NCURSES_H +#ifdef NCURSES_VERSION /* configure was checking <curses.h>, but we will use <ncurses.h>, which has some or all these features. */ #if !defined(WINDOW_HAS_FLAGS) && \ |