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 000000000000000..ec3c798995849b2 --- /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 51e657ff0d61e31..c3aa188f86119d5 100755 --- a/configure +++ b/configure @@ -26693,8 +26693,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 f93a9f29b39aff8..3f97ba4f76adb9f 100644 --- a/configure.ac +++ b/configure.ac @@ -6835,8 +6835,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])