From d0deea359a0e0b8491e6f54cfe0477e6fd2a1793 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 22 Aug 2026 11:37:35 +0300 Subject: [PATCH] [3.15] gh-155911: Fix curses detection with libraries in LIBS (GH-156130) AC_SEARCH_LIBS tries linking with no extra library first, so a curses library already in LIBS made the search report "none required", which then became the module's link flag. Search with only the libraries the module is linked with. (cherry picked from commit f74cdf80a120649e4c353430da8cbd1305c00993) Co-authored-by: Shamil --- .../Build/2026-08-20-17-41-11.gh-issue-155911.yL3z8q.rst | 2 ++ configure | 5 +++-- configure.ac | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2026-08-20-17-41-11.gh-issue-155911.yL3z8q.rst diff --git a/Misc/NEWS.d/next/Build/2026-08-20-17-41-11.gh-issue-155911.yL3z8q.rst b/Misc/NEWS.d/next/Build/2026-08-20-17-41-11.gh-issue-155911.yL3z8q.rst new file mode 100644 index 00000000000000..ec3c798995849b --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-08-20-17-41-11.gh-issue-155911.yL3z8q.rst @@ -0,0 +1,2 @@ +Fix curses detection when a curses library is already in ``LIBS``. +Patch by Shamil Abdulaev. diff --git a/configure b/configure index 2c0349c8c4c98e..90c2780fdfc252 100755 --- a/configure +++ b/configure @@ -29428,8 +29428,9 @@ fi # Check that we're able to link with crucial curses/panel functions. This - # also serves as a fallback in case pkg-config failed. - as_fn_append LIBS " $CURSES_LIBS $PANEL_LIBS" + # also serves as a fallback in case pkg-config failed. Extension modules are + # not linked with LIBS, so exclude it to get the required libraries. + LIBS="$CURSES_LIBS $PANEL_LIBS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing initscr" >&5 printf %s "checking for library containing initscr... " >&6; } if test ${ac_cv_search_initscr+y} diff --git a/configure.ac b/configure.ac index 928a7b6d72388f..77718e4d80b546 100644 --- a/configure.ac +++ b/configure.ac @@ -7149,8 +7149,9 @@ WITH_SAVE_ENV([ ])) # Check that we're able to link with crucial curses/panel functions. This - # also serves as a fallback in case pkg-config failed. - AS_VAR_APPEND([LIBS], [" $CURSES_LIBS $PANEL_LIBS"]) + # also serves as a fallback in case pkg-config failed. Extension modules are + # not linked with LIBS, so exclude it to get the required libraries. + LIBS="$CURSES_LIBS $PANEL_LIBS" AC_SEARCH_LIBS([initscr], [ncursesw ncurses], [AS_VAR_IF([have_curses], [no], [AS_VAR_SET([have_curses], [yes])