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..679b3548dfb0a5e --- /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 with libraries in ``LIBS`` and ``--without-curses``. +Patched by Shamil Abdulaev. diff --git a/configure b/configure index ea560d600722592..f5a634f8f0ebf01 100755 --- a/configure +++ b/configure @@ -29698,8 +29698,8 @@ printf "%s\n" "$with_curses" >&6; } # Detect the selected backend. ncursesw/ncurses are found via pkg-config; # native curses has no .pc file and is left to the header/link probes below. -# curses_libs/panel_libs drive the AC_SEARCH_LIBS fallback; for "no" they are -# empty so nothing links and have_curses stays "no". +# curses_libs/panel_libs drive the AC_SEARCH_LIBS fallback; "no" skips the +# probes below. case $with_curses in #( ncursesw) : @@ -30884,6 +30884,11 @@ fi curses_libs="ncursesw ncurses"; panel_libs="panelw panel gnupanel" ;; esac +if test "x$with_curses" = xno +then : + +else case e in #( + e) save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS @@ -31038,8 +31043,16 @@ then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" if test "x$have_curses" = xno then : - have_curses=yes - CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} + + have_curses=yes + if test "x$ac_cv_search_initscr" = x"none required" +then : + +else case e in #( + e) CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} ;; +esac +fi + fi else case e in #( e) have_curses=no ;; @@ -31112,8 +31125,16 @@ then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" if test "x$have_panel" = xno then : - have_panel=yes - PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} + + have_panel=yes + if test "x$ac_cv_search_update_panels" = x"none required" +then : + +else case e in #( + e) PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} ;; +esac +fi + fi else case e in #( e) have_panel=no ;; @@ -33620,7 +33641,9 @@ CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS - + ;; +esac +fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for device files" >&5 printf "%s\n" "$as_me: checking for device files" >&6;} diff --git a/configure.ac b/configure.ac index 7dfc6ca29297a8b..9405f4067c665cc 100644 --- a/configure.ac +++ b/configure.ac @@ -7248,8 +7248,8 @@ AS_VAR_POPDEF([panel_var])]) # Detect the selected backend. ncursesw/ncurses are found via pkg-config; # native curses has no .pc file and is left to the header/link probes below. -# curses_libs/panel_libs drive the AC_SEARCH_LIBS fallback; for "no" they are -# empty so nothing links and have_curses stays "no". +# curses_libs/panel_libs drive the AC_SEARCH_LIBS fallback; "no" skips the +# probes below. AS_CASE([$with_curses], [ncursesw], [PY_CHECK_CURSES([ncursesw], [panelw]) curses_libs="ncursesw"; panel_libs="panelw gnupanel"], @@ -7262,6 +7262,7 @@ AS_CASE([$with_curses], AS_VAR_IF([have_curses], [no], [PY_CHECK_CURSES([ncurses], [panel])]) curses_libs="ncursesw ncurses"; panel_libs="panelw panel gnupanel"]) +AS_VAR_IF([with_curses], [no], [], [ WITH_SAVE_ENV([ # Make sure we've got the header defines. For the native "curses" backend, # probe only the plain headers: a system may also have ncurses headers (e.g. @@ -7280,14 +7281,18 @@ WITH_SAVE_ENV([ # also serves as a fallback in case pkg-config failed. AS_VAR_APPEND([LIBS], [" $CURSES_LIBS $PANEL_LIBS"]) AC_SEARCH_LIBS([initscr], [$curses_libs], - [AS_VAR_IF([have_curses], [no], - [AS_VAR_SET([have_curses], [yes]) - CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"}])], + [AS_VAR_IF([have_curses], [no], [ + AS_VAR_SET([have_curses], [yes]) + AS_VAR_IF([ac_cv_search_initscr], ["none required"], [], + [CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"}]) + ])], [AS_VAR_SET([have_curses], [no])]) AC_SEARCH_LIBS([update_panels], [$panel_libs], - [AS_VAR_IF([have_panel], [no], - [AS_VAR_SET([have_panel], [yes]) - PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"}])], + [AS_VAR_IF([have_panel], [no], [ + AS_VAR_SET([have_panel], [yes]) + AS_VAR_IF([ac_cv_search_update_panels], ["none required"], [], + [PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"}]) + ])], [AS_VAR_SET([have_panel], [no])]) dnl Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque @@ -7498,6 +7503,7 @@ PY_CHECK_CURSES_FUNC([scr_set]) CPPFLAGS=$ac_save_cppflags ])dnl have_curses != no ])dnl save env +])dnl with_curses != no AC_MSG_NOTICE([checking for device files])