From 71a243dcf0a2369ffa5027a9afa8c26ce990097f Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Fri, 31 May 2024 02:05:48 +0200 Subject: [PATCH 01/14] gh-113565: Use pkg-config to detect ncurses[w] and panel[w] --- configure | 773 +++++++++++++------------------------------------- configure.ac | 145 ++++------ pyconfig.h.in | 29 +- 3 files changed, 278 insertions(+), 669 deletions(-) diff --git a/configure b/configure index 6cfe114fb2104c..ce4b6833b20063 100755 --- a/configure +++ b/configure @@ -829,8 +829,12 @@ SRCDIRS THREADHEADERS PANEL_LIBS PANEL_CFLAGS -CURSES_LIBS -CURSES_CFLAGS +NCURSES_LIBS +NCURSES_CFLAGS +PANELW_LIBS +PANELW_CFLAGS +NCURSESW_LIBS +NCURSESW_CFLAGS LIBEDIT_LIBS LIBEDIT_CFLAGS LIBREADLINE_LIBS @@ -1169,8 +1173,12 @@ LIBREADLINE_CFLAGS LIBREADLINE_LIBS LIBEDIT_CFLAGS LIBEDIT_LIBS -CURSES_CFLAGS -CURSES_LIBS +NCURSESW_CFLAGS +NCURSESW_LIBS +PANELW_CFLAGS +PANELW_LIBS +NCURSES_CFLAGS +NCURSES_LIBS PANEL_CFLAGS PANEL_LIBS LIBB2_CFLAGS @@ -2005,9 +2013,17 @@ Some influential environment variables: C compiler flags for LIBEDIT, overriding pkg-config LIBEDIT_LIBS linker flags for LIBEDIT, overriding pkg-config - CURSES_CFLAGS - C compiler flags for CURSES, overriding pkg-config - CURSES_LIBS linker flags for CURSES, overriding pkg-config + NCURSESW_CFLAGS + C compiler flags for NCURSESW, overriding pkg-config + NCURSESW_LIBS + linker flags for NCURSESW, overriding pkg-config + PANELW_CFLAGS + C compiler flags for PANELW, overriding pkg-config + PANELW_LIBS linker flags for PANELW, overriding pkg-config + NCURSES_CFLAGS + C compiler flags for NCURSES, overriding pkg-config + NCURSES_LIBS + linker flags for NCURSES, overriding pkg-config PANEL_CFLAGS C compiler flags for PANEL, overriding pkg-config PANEL_LIBS linker flags for PANEL, overriding pkg-config @@ -25868,31 +25884,16 @@ have_curses=no have_panel=no -ac_fn_c_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" -if test "x$ac_cv_header_curses_h" = xyes -then : - printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h - -fi -ac_fn_c_check_header_compile "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default" -if test "x$ac_cv_header_ncurses_h" = xyes -then : - printf "%s\n" "#define HAVE_NCURSES_H 1" >>confdefs.h - -fi -if test "x$ac_cv_header_ncurses_h" = xyes -then : - if test "$ac_sys_system" != "Darwin"; then pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncursesw" >&5 printf %s "checking for ncursesw... " >&6; } -if test -n "$CURSES_CFLAGS"; then - pkg_cv_CURSES_CFLAGS="$CURSES_CFLAGS" +if test -n "$NCURSESW_CFLAGS"; then + pkg_cv_NCURSESW_CFLAGS="$NCURSESW_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncursesw\""; } >&5 @@ -25900,7 +25901,7 @@ if test -n "$CURSES_CFLAGS"; then ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_CURSES_CFLAGS=`$PKG_CONFIG --cflags "ncursesw" 2>/dev/null` + pkg_cv_NCURSESW_CFLAGS=`$PKG_CONFIG --cflags "ncursesw" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -25908,8 +25909,8 @@ fi else pkg_failed=untried fi -if test -n "$CURSES_LIBS"; then - pkg_cv_CURSES_LIBS="$CURSES_LIBS" +if test -n "$NCURSESW_LIBS"; then + pkg_cv_NCURSESW_LIBS="$NCURSESW_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncursesw\""; } >&5 @@ -25917,7 +25918,7 @@ if test -n "$CURSES_LIBS"; then ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_CURSES_LIBS=`$PKG_CONFIG --libs "ncursesw" 2>/dev/null` + pkg_cv_NCURSESW_LIBS=`$PKG_CONFIG --libs "ncursesw" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -25938,169 +25939,71 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CURSES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncursesw" 2>&1` + NCURSESW_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncursesw" 2>&1` else - CURSES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncursesw" 2>&1` + NCURSESW_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncursesw" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$CURSES_PKG_ERRORS" >&5 - + echo "$NCURSESW_PKG_ERRORS" >&5 - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 -printf %s "checking for initscr in -lncursesw... " >&6; } -if test ${ac_cv_lib_ncursesw_initscr+y} + for ac_header in ncurses.h curses.h ncursesw/curses.h ncursesw/ncurses.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncursesw $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char initscr (); -int -main (void) -{ -return initscr (); - ; - return 0; -} + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_ncursesw_initscr=yes -else $as_nop - ac_cv_lib_ncursesw_initscr=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5 -printf "%s\n" "$ac_cv_lib_ncursesw_initscr" >&6; } -if test "x$ac_cv_lib_ncursesw_initscr" = xyes -then : - - printf "%s\n" "#define HAVE_NCURSESW 1" >>confdefs.h - - have_curses=ncursesw - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} - + have_curses=ncursesw fi - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - +done elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 -printf %s "checking for initscr in -lncursesw... " >&6; } -if test ${ac_cv_lib_ncursesw_initscr+y} + for ac_header in ncurses.h curses.h ncursesw/curses.h ncursesw/ncurses.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncursesw $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char initscr (); -int -main (void) -{ -return initscr (); - ; - return 0; -} + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_ncursesw_initscr=yes -else $as_nop - ac_cv_lib_ncursesw_initscr=no + have_curses=ncursesw fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5 -printf "%s\n" "$ac_cv_lib_ncursesw_initscr" >&6; } -if test "x$ac_cv_lib_ncursesw_initscr" = xyes -then : - - printf "%s\n" "#define HAVE_NCURSESW 1" >>confdefs.h - - have_curses=ncursesw - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} - -fi - - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - +done else - CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS - CURSES_LIBS=$pkg_cv_CURSES_LIBS + NCURSESW_CFLAGS=$pkg_cv_NCURSESW_CFLAGS + NCURSESW_LIBS=$pkg_cv_NCURSESW_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - printf "%s\n" "#define HAVE_NCURSESW 1" >>confdefs.h - - have_curses=ncursesw +printf "%s\n" "#define HAVE_NCURSESW 1" >>confdefs.h + have_curses=ncursesw + CURSES_CFLAGS=$NCURSESW_CFLAGS + CURSES_LIBS=$NCURSESW_LIBS fi - fi - - if test "x$have_curses" = xno +if test "x$have_curses" = xncursesw then : - pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncurses" >&5 -printf %s "checking for ncurses... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for panelw" >&5 +printf %s "checking for panelw... " >&6; } -if test -n "$CURSES_CFLAGS"; then - pkg_cv_CURSES_CFLAGS="$CURSES_CFLAGS" +if test -n "$PANELW_CFLAGS"; then + pkg_cv_PANELW_CFLAGS="$PANELW_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 - ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panelw\""; } >&5 + ($PKG_CONFIG --exists --print-errors "panelw") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_CURSES_CFLAGS=`$PKG_CONFIG --cflags "ncurses" 2>/dev/null` + pkg_cv_PANELW_CFLAGS=`$PKG_CONFIG --cflags "panelw" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26108,16 +26011,16 @@ fi else pkg_failed=untried fi -if test -n "$CURSES_LIBS"; then - pkg_cv_CURSES_LIBS="$CURSES_LIBS" +if test -n "$PANELW_LIBS"; then + pkg_cv_PANELW_LIBS="$PANELW_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 - ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panelw\""; } >&5 + ($PKG_CONFIG --exists --print-errors "panelw") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_CURSES_LIBS=`$PKG_CONFIG --libs "ncurses" 2>/dev/null` + pkg_cv_PANELW_LIBS=`$PKG_CONFIG --libs "panelw" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26138,204 +26041,76 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CURSES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` + PANELW_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "panelw" 2>&1` else - CURSES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` + PANELW_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "panelw" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$CURSES_PKG_ERRORS" >&5 - - - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - + echo "$PANELW_PKG_ERRORS" >&5 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 -printf %s "checking for initscr in -lncurses... " >&6; } -if test ${ac_cv_lib_ncurses_initscr+y} + for ac_header in panel.h ncursesw/panel.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char initscr (); -int -main (void) -{ -return initscr (); - ; - return 0; -} + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_ncurses_initscr=yes -else $as_nop - ac_cv_lib_ncurses_initscr=no + have_panel=panelw fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 -printf "%s\n" "$ac_cv_lib_ncurses_initscr" >&6; } -if test "x$ac_cv_lib_ncurses_initscr" = xyes -then : - - have_curses=ncurses - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncurses"} - -fi - - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - +done elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 -printf %s "checking for initscr in -lncurses... " >&6; } -if test ${ac_cv_lib_ncurses_initscr+y} + for ac_header in panel.h ncursesw/panel.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char initscr (); -int -main (void) -{ -return initscr (); - ; - return 0; -} + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_ncurses_initscr=yes -else $as_nop - ac_cv_lib_ncurses_initscr=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + have_panel=panelw fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 -printf "%s\n" "$ac_cv_lib_ncurses_initscr" >&6; } -if test "x$ac_cv_lib_ncurses_initscr" = xyes -then : - - have_curses=ncurses - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncurses"} - -fi - - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - +done else - CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS - CURSES_LIBS=$pkg_cv_CURSES_LIBS + PANELW_CFLAGS=$pkg_cv_PANELW_CFLAGS + PANELW_LIBS=$pkg_cv_PANELW_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - have_curses=ncurses - -fi - -fi - +printf "%s\n" "#define HAVE_PANELW 1" >>confdefs.h + have_panel=panelw + PANEL_CFLAGS=$PANELW_CFLAGS + PANEL_LIBS=$PANELW_LIBS fi -CURSES_CFLAGS=$(echo $CURSES_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') - -if test "$have_curses" != no -a "$ac_sys_system" = "Darwin"; then - - as_fn_append CURSES_CFLAGS " -D_XOPEN_SOURCE_EXTENDED=1" - printf "%s\n" "#define HAVE_NCURSESW 1" >>confdefs.h - fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking curses module flags" >&5 -printf %s "checking curses module flags... " >&6; } if test "x$have_curses" = xno then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -else $as_nop - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_curses (CFLAGS: $CURSES_CFLAGS, LIBS: $CURSES_LIBS)" >&5 -printf "%s\n" "$have_curses (CFLAGS: $CURSES_CFLAGS, LIBS: $CURSES_LIBS)" >&6; } - -fi - -ac_fn_c_check_header_compile "$LINENO" "panel.h" "ac_cv_header_panel_h" "$ac_includes_default" -if test "x$ac_cv_header_panel_h" = xyes -then : - printf "%s\n" "#define HAVE_PANEL_H 1" >>confdefs.h - -fi - - -if test "x$ac_cv_header_panel_h" = xyes -then : - - - if test "$ac_sys_system" != "Darwin"; then - if test "x$have_curses" = xncursesw -then : pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for panelw" >&5 -printf %s "checking for panelw... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncurses" >&5 +printf %s "checking for ncurses... " >&6; } -if test -n "$PANEL_CFLAGS"; then - pkg_cv_PANEL_CFLAGS="$PANEL_CFLAGS" +if test -n "$NCURSES_CFLAGS"; then + pkg_cv_NCURSES_CFLAGS="$NCURSES_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panelw\""; } >&5 - ($PKG_CONFIG --exists --print-errors "panelw") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PANEL_CFLAGS=`$PKG_CONFIG --cflags "panelw" 2>/dev/null` + pkg_cv_NCURSES_CFLAGS=`$PKG_CONFIG --cflags "ncurses" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26343,16 +26118,16 @@ fi else pkg_failed=untried fi -if test -n "$PANEL_LIBS"; then - pkg_cv_PANEL_LIBS="$PANEL_LIBS" +if test -n "$NCURSES_LIBS"; then + pkg_cv_NCURSES_LIBS="$NCURSES_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panelw\""; } >&5 - ($PKG_CONFIG --exists --print-errors "panelw") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PANEL_LIBS=`$PKG_CONFIG --libs "panelw" 2>/dev/null` + pkg_cv_NCURSES_LIBS=`$PKG_CONFIG --libs "ncurses" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26373,151 +26148,57 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PANEL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "panelw" 2>&1` + NCURSES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` else - PANEL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "panelw" 2>&1` + NCURSES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$PANEL_PKG_ERRORS" >&5 + echo "$NCURSES_PKG_ERRORS" >&5 - - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanelw" >&5 -printf %s "checking for update_panels in -lpanelw... " >&6; } -if test ${ac_cv_lib_panelw_update_panels+y} + for ac_header in ncurses.h curses.h ncurses/curses.h ncurses/ncurses.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpanelw $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char update_panels (); -int -main (void) -{ -return update_panels (); - ; - return 0; -} + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_panelw_update_panels=yes -else $as_nop - ac_cv_lib_panelw_update_panels=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panelw_update_panels" >&5 -printf "%s\n" "$ac_cv_lib_panelw_update_panels" >&6; } -if test "x$ac_cv_lib_panelw_update_panels" = xyes -then : - - have_panel=panelw - PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanelw"} - + have_curses=ncurses fi - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - +done elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanelw" >&5 -printf %s "checking for update_panels in -lpanelw... " >&6; } -if test ${ac_cv_lib_panelw_update_panels+y} + for ac_header in ncurses.h curses.h ncurses/curses.h ncurses/ncurses.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpanelw $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char update_panels (); -int -main (void) -{ -return update_panels (); - ; - return 0; -} + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_panelw_update_panels=yes -else $as_nop - ac_cv_lib_panelw_update_panels=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panelw_update_panels" >&5 -printf "%s\n" "$ac_cv_lib_panelw_update_panels" >&6; } -if test "x$ac_cv_lib_panelw_update_panels" = xyes -then : - - have_panel=panelw - PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanelw"} - + have_curses=ncurses fi - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - +done else - PANEL_CFLAGS=$pkg_cv_PANEL_CFLAGS - PANEL_LIBS=$pkg_cv_PANEL_LIBS + NCURSES_CFLAGS=$pkg_cv_NCURSES_CFLAGS + NCURSES_LIBS=$pkg_cv_NCURSES_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - have_panel=panelw - -fi +printf "%s\n" "#define HAVE_NCURSES 1" >>confdefs.h + have_curses=ncurses + CURSES_CFLAGS=$NCURSES_CFLAGS + CURSES_LIBS=$NCURSES_LIBS fi - fi - - if test "x$have_curses" = xncurses +if test "x$have_curses" = xncurses then : - pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for panel" >&5 printf %s "checking for panel... " >&6; } @@ -26576,158 +26257,97 @@ fi # Put the nasty error message in config.log where it belongs echo "$PANEL_PKG_ERRORS" >&5 - - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanel" >&5 -printf %s "checking for update_panels in -lpanel... " >&6; } -if test ${ac_cv_lib_panel_update_panels+y} + for ac_header in panel.h ncurses/panel.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpanel $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char update_panels (); -int -main (void) -{ -return update_panels (); - ; - return 0; -} + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_panel_update_panels=yes -else $as_nop - ac_cv_lib_panel_update_panels=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panel_update_panels" >&5 -printf "%s\n" "$ac_cv_lib_panel_update_panels" >&6; } -if test "x$ac_cv_lib_panel_update_panels" = xyes -then : - - have_panel=panel - PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanel"} - + have_panel=panel fi - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - +done elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanel" >&5 -printf %s "checking for update_panels in -lpanel... " >&6; } -if test ${ac_cv_lib_panel_update_panels+y} + for ac_header in panel.h ncurses/panel.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpanel $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char update_panels (); -int -main (void) -{ -return update_panels (); - ; - return 0; -} + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_panel_update_panels=yes -else $as_nop - ac_cv_lib_panel_update_panels=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + have_panel=panel fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panel_update_panels" >&5 -printf "%s\n" "$ac_cv_lib_panel_update_panels" >&6; } -if test "x$ac_cv_lib_panel_update_panels" = xyes -then : - - have_panel=panel - PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanel"} - -fi - - -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - +done else PANEL_CFLAGS=$pkg_cv_PANEL_CFLAGS PANEL_LIBS=$pkg_cv_PANEL_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - have_panel=panel +printf "%s\n" "#define HAVE_PANEL 1" >>confdefs.h + have_panel=panel + PANEL_CFLAGS=$PANEL_CFLAGS + PANEL_LIBS=$PANEL_LIBS fi - fi fi -PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') +case $have_curses in #( + ncursesw) : + CURSES_CFLAGS=${CURSES_CFLAGS-""} + CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} ;; #( + ncurses) : + CURSES_CFLAGS=${CURSES_CFLAGS-""} + CURSES_LIBS=${CURSES_LIBS-"-lncurses"} ;; #( + *) : + ;; +esac +case $have_panel in #( + panelw) : + PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanelw"} ;; #( + panel) : + PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanel"} ;; #( + *) : + ;; +esac +# TODO: rewrite these using AC_COMPILE_IFELSE +#AS_IF([test "have_curses" != "no"], +# [WITH_SAVE_ENV([CPPFLAGS="$CURSES_CFLAGS $CPPFLAGS" +# LDFLAGS="$CURSES_LIBS $LDFLAGS" +# AC_CHECK_FUNC([initscr], [], [have_curses=no])])]) +#AS_IF([test "have_panel" != "no"], +# [WITH_SAVE_ENV([CPPFLAGS="$PANEL_CFLAGS $CPPFLAGS" +# LDFLAGS="$PANEL_LIBS $LDFLAGS" +# AC_CHECK_FUNC([update_panels], [], [have_panel=no])])]) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking panel flags" >&5 -printf %s "checking panel flags... " >&6; } -if test "x$have_panel" = xno +if test "have_curses" != "no" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } +CURSES_CFLAGS=$(echo $CURSES_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') + +if test "x$ac_sys_system" = xDarwin +then : -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_panel (CFLAGS: $PANEL_CFLAGS, LIBS: $PANEL_LIBS)" >&5 -printf "%s\n" "$have_panel (CFLAGS: $PANEL_CFLAGS, LIBS: $PANEL_LIBS)" >&6; } + as_fn_append CURSES_CFLAGS " -D_XOPEN_SOURCE_EXTENDED=1" fi + +PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') + # first curses header check ac_save_cppflags="$CPPFLAGS" if test "$cross_compiling" = no; then @@ -27343,6 +26963,7 @@ fi CPPFLAGS=$ac_save_cppflags +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 8657e09c9a7008..94fd269237f760 100644 --- a/configure.ac +++ b/configure.ac @@ -6573,48 +6573,61 @@ dnl have_panel=[no, panelw, panel] have_curses=no have_panel=no -AH_TEMPLATE([HAVE_NCURSESW], [Define to 1 if you have the `ncursesw' library.]) -AC_CHECK_HEADERS([curses.h ncurses.h]) - -AS_VAR_IF([ac_cv_header_ncurses_h], [yes], [ - if test "$ac_sys_system" != "Darwin"; then - dnl On macOS, there is no separate /usr/lib/libncursesw nor libpanelw. - PKG_CHECK_MODULES([CURSES], [ncursesw], [ - AC_DEFINE([HAVE_NCURSESW], [1]) - have_curses=ncursesw - ], [ - WITH_SAVE_ENV([ - AC_CHECK_LIB([ncursesw], [initscr], [ - AC_DEFINE([HAVE_NCURSESW], [1]) - have_curses=ncursesw - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} - ]) - ]) - ]) - fi - - AS_VAR_IF([have_curses], [no], [ - PKG_CHECK_MODULES([CURSES], [ncurses], [ - have_curses=ncurses - ], [ - WITH_SAVE_ENV([ - AC_CHECK_LIB([ncurses], [initscr], [ - have_curses=ncurses - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncurses"} - ]) - ]) - ]) - ]) - -])dnl ac_cv_header_ncurses_h = yes - +dnl PY_CHECK_CURSES(LIBCURSES, LIBPANEL) +dnl Sets 'have_curses' and 'have_panel'. +AC_DEFUN([PY_CHECK_CURSES], [dnl +AS_VAR_PUSHDEF([curses_var], [m4_toupper([$1])]) +AS_VAR_PUSHDEF([panel_var], [m4_toupper([$2])]) +PKG_CHECK_MODULES(curses_var, [$1], + [AC_DEFINE([HAVE_]curses_var, [1], [Define if you have the '$1' library]) + AS_VAR_SET([have_curses], [$1]) + AS_VAR_SET([CURSES_CFLAGS], [$curses_var[_CFLAGS]]) + AS_VAR_SET([CURSES_LIBS], [$curses_var[_LIBS]])], + [AC_CHECK_HEADERS([ncurses.h curses.h $1/curses.h $1/ncurses.h], + [AS_VAR_SET([have_curses], [$1])])]) +AS_VAR_IF([have_curses], [$1], + [PKG_CHECK_MODULES(panel_var, [$2], + [AC_DEFINE([HAVE_]panel_var, [1], [Define if you hve the '$2' library]) + AS_VAR_SET([have_panel], [$2]) + AS_VAR_SET([PANEL_CFLAGS], [$panel_var[_CFLAGS]]) + AS_VAR_SET([PANEL_LIBS], [$panel_var[_LIBS]])], + [AC_CHECK_HEADERS([panel.h $1/panel.h], + [AS_VAR_SET([have_panel], [$2])])])]) +AS_VAR_POPDEF([curses_var]) +AS_VAR_POPDEF([panel_var])]) + +PY_CHECK_CURSES([ncursesw], [panelw]) +AS_VAR_IF([have_curses], [no], [PY_CHECK_CURSES([ncurses], [panel])]) +AS_CASE([$have_curses], + [ncursesw], + [CURSES_CFLAGS=${CURSES_CFLAGS-""} + CURSES_LIBS=${CURSES_LIBS-"-lncursesw"}], + [ncurses], + [CURSES_CFLAGS=${CURSES_CFLAGS-""} + CURSES_LIBS=${CURSES_LIBS-"-lncurses"}]) +AS_CASE([$have_panel], + [panelw], + [PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanelw"}], + [panel], + [PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanel"}]) +# TODO: rewrite these using AC_COMPILE_IFELSE +#AS_IF([test "have_curses" != "no"], +# [WITH_SAVE_ENV([CPPFLAGS="$CURSES_CFLAGS $CPPFLAGS" +# LDFLAGS="$CURSES_LIBS $LDFLAGS" +# AC_CHECK_FUNC([initscr], [], [have_curses=no])])]) +#AS_IF([test "have_panel" != "no"], +# [WITH_SAVE_ENV([CPPFLAGS="$PANEL_CFLAGS $CPPFLAGS" +# LDFLAGS="$PANEL_LIBS $LDFLAGS" +# AC_CHECK_FUNC([update_panels], [], [have_panel=no])])]) + +AS_IF([test "have_curses" != "no"], [ dnl remove _XOPEN_SOURCE macro from curses cflags. pyconfig.h sets dnl the macro to 700. CURSES_CFLAGS=$(echo $CURSES_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') -if test "$have_curses" != no -a "$ac_sys_system" = "Darwin"; then +AS_VAR_IF([ac_sys_system], [Darwin], [ dnl On macOS, there is no separate /usr/lib/libncursesw nor libpanelw. dnl System-supplied ncurses combines libncurses/libpanel and supports wide dnl characters, so we can use it like ncursesw. @@ -6624,66 +6637,13 @@ if test "$have_curses" != no -a "$ac_sys_system" = "Darwin"; then dnl _XOPEN_SOURCE_EXTENDED here for ncurses wide char support. AS_VAR_APPEND([CURSES_CFLAGS], [" -D_XOPEN_SOURCE_EXTENDED=1"]) - AC_DEFINE([HAVE_NCURSESW], [1]) -fi - -dnl TODO: detect "curses" and special cases tinfo, terminfo, or termcap - -AC_MSG_CHECKING([curses module flags]) -AS_VAR_IF([have_curses], [no], [ - AC_MSG_RESULT([no]) -], [ - AC_MSG_RESULT([$have_curses (CFLAGS: $CURSES_CFLAGS, LIBS: $CURSES_LIBS)]) ]) -dnl check for ncurses' panel/panelw library -AC_CHECK_HEADERS([panel.h]) - -AS_VAR_IF([ac_cv_header_panel_h], [yes], [ - - if test "$ac_sys_system" != "Darwin"; then - dnl On macOS, there is no separate /usr/lib/libncursesw nor libpanelw. - AS_VAR_IF([have_curses], [ncursesw], [ - PKG_CHECK_MODULES([PANEL], [panelw], [ - have_panel=panelw - ], [ - WITH_SAVE_ENV([ - AC_CHECK_LIB([panelw], [update_panels], [ - have_panel=panelw - PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanelw"} - ]) - ]) - ]) - ]) - fi - - AS_VAR_IF([have_curses], [ncurses], [ - PKG_CHECK_MODULES([PANEL], [panel], [ - have_panel=panel - ], [ - WITH_SAVE_ENV([ - AC_CHECK_LIB([panel], [update_panels], [ - have_panel=panel - PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanel"} - ]) - ]) - ]) - ]) - -])dnl ac_cv_header_panel_h = yes +dnl TODO: detect "curses" and special cases tinfo, terminfo, or termcap dnl pyconfig.h defines _XOPEN_SOURCE=700 PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') -AC_MSG_CHECKING([panel flags]) -AS_VAR_IF([have_panel], [no], [ - AC_MSG_RESULT([no]) -], [ - AC_MSG_RESULT([$have_panel (CFLAGS: $PANEL_CFLAGS, LIBS: $PANEL_LIBS)]) -]) - # first curses header check ac_save_cppflags="$CPPFLAGS" if test "$cross_compiling" = no; then @@ -6774,6 +6734,7 @@ PY_CHECK_CURSES_FUNC([has_key]) PY_CHECK_CURSES_FUNC([typeahead]) PY_CHECK_CURSES_FUNC([use_env]) CPPFLAGS=$ac_save_cppflags +])dnl have_curses != no AC_MSG_NOTICE([checking for device files]) diff --git a/pyconfig.h.in b/pyconfig.h.in index c279b147db3bdd..1bc1f9e8a11977 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -829,12 +829,33 @@ /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP -/* Define to 1 if you have the `ncursesw' library. */ +/* Define if you have the 'ncurses' library */ +#undef HAVE_NCURSES + +/* Define if you have the 'ncursesw' library */ #undef HAVE_NCURSESW +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSESW_CURSES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSESW_NCURSES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSESW_PANEL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_CURSES_H + /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_NCURSES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NCURSES_PANEL_H + /* Define to 1 if you have the header file. */ #undef HAVE_NDBM_H @@ -878,6 +899,12 @@ /* Define to 1 if you have the `openpty' function. */ #undef HAVE_OPENPTY +/* Define if you hve the 'panel' library */ +#undef HAVE_PANEL + +/* Define if you hve the 'panelw' library */ +#undef HAVE_PANELW + /* Define to 1 if you have the header file. */ #undef HAVE_PANEL_H From a57e18d72e508f19c32f4816b68bd214734954d8 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 Jun 2024 00:58:40 +0200 Subject: [PATCH 02/14] Clean up pkg-config variables, fix manual check --- configure | 702 ++++++++++++++++++++++++++++++++++++++++----------- configure.ac | 117 +++++---- 2 files changed, 627 insertions(+), 192 deletions(-) diff --git a/configure b/configure index ce4b6833b20063..e85abe7ad76e2a 100755 --- a/configure +++ b/configure @@ -829,12 +829,8 @@ SRCDIRS THREADHEADERS PANEL_LIBS PANEL_CFLAGS -NCURSES_LIBS -NCURSES_CFLAGS -PANELW_LIBS -PANELW_CFLAGS -NCURSESW_LIBS -NCURSESW_CFLAGS +CURSES_LIBS +CURSES_CFLAGS LIBEDIT_LIBS LIBEDIT_CFLAGS LIBREADLINE_LIBS @@ -1173,12 +1169,8 @@ LIBREADLINE_CFLAGS LIBREADLINE_LIBS LIBEDIT_CFLAGS LIBEDIT_LIBS -NCURSESW_CFLAGS -NCURSESW_LIBS -PANELW_CFLAGS -PANELW_LIBS -NCURSES_CFLAGS -NCURSES_LIBS +CURSES_CFLAGS +CURSES_LIBS PANEL_CFLAGS PANEL_LIBS LIBB2_CFLAGS @@ -2013,17 +2005,9 @@ Some influential environment variables: C compiler flags for LIBEDIT, overriding pkg-config LIBEDIT_LIBS linker flags for LIBEDIT, overriding pkg-config - NCURSESW_CFLAGS - C compiler flags for NCURSESW, overriding pkg-config - NCURSESW_LIBS - linker flags for NCURSESW, overriding pkg-config - PANELW_CFLAGS - C compiler flags for PANELW, overriding pkg-config - PANELW_LIBS linker flags for PANELW, overriding pkg-config - NCURSES_CFLAGS - C compiler flags for NCURSES, overriding pkg-config - NCURSES_LIBS - linker flags for NCURSES, overriding pkg-config + CURSES_CFLAGS + C compiler flags for CURSES, overriding pkg-config + CURSES_LIBS linker flags for CURSES, overriding pkg-config PANEL_CFLAGS C compiler flags for PANEL, overriding pkg-config PANEL_LIBS linker flags for PANEL, overriding pkg-config @@ -25885,6 +25869,7 @@ have_panel=no +# Check for ncursesw/panelw first. If that fails, try ncurses/panel. @@ -25892,8 +25877,8 @@ pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncursesw" >&5 printf %s "checking for ncursesw... " >&6; } -if test -n "$NCURSESW_CFLAGS"; then - pkg_cv_NCURSESW_CFLAGS="$NCURSESW_CFLAGS" +if test -n "$CURSES_CFLAGS"; then + pkg_cv_CURSES_CFLAGS="$CURSES_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncursesw\""; } >&5 @@ -25901,7 +25886,7 @@ if test -n "$NCURSESW_CFLAGS"; then ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_NCURSESW_CFLAGS=`$PKG_CONFIG --cflags "ncursesw" 2>/dev/null` + pkg_cv_CURSES_CFLAGS=`$PKG_CONFIG --cflags "ncursesw" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -25909,8 +25894,8 @@ fi else pkg_failed=untried fi -if test -n "$NCURSESW_LIBS"; then - pkg_cv_NCURSESW_LIBS="$NCURSESW_LIBS" +if test -n "$CURSES_LIBS"; then + pkg_cv_CURSES_LIBS="$CURSES_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncursesw\""; } >&5 @@ -25918,7 +25903,7 @@ if test -n "$NCURSESW_LIBS"; then ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_NCURSESW_LIBS=`$PKG_CONFIG --libs "ncursesw" 2>/dev/null` + pkg_cv_CURSES_LIBS=`$PKG_CONFIG --libs "ncursesw" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -25939,14 +25924,20 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - NCURSESW_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncursesw" 2>&1` + CURSES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncursesw" 2>&1` else - NCURSESW_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncursesw" 2>&1` + CURSES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncursesw" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$NCURSESW_PKG_ERRORS" >&5 + echo "$CURSES_PKG_ERRORS" >&5 - for ac_header in ncurses.h curses.h ncursesw/curses.h ncursesw/ncurses.h + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + +as_fn_append CPPFLAGS " $CURSES_CFLAGS" + for ac_header in ncursesw/curses.h ncursesw/ncurses.h do : as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -25959,10 +25950,22 @@ _ACEOF fi done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - for ac_header in ncurses.h curses.h ncursesw/curses.h ncursesw/ncurses.h + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + +as_fn_append CPPFLAGS " $CURSES_CFLAGS" + for ac_header in ncursesw/curses.h ncursesw/ncurses.h do : as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -25975,17 +25978,21 @@ _ACEOF fi done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + else - NCURSESW_CFLAGS=$pkg_cv_NCURSESW_CFLAGS - NCURSESW_LIBS=$pkg_cv_NCURSESW_LIBS + CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS + CURSES_LIBS=$pkg_cv_CURSES_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_NCURSESW 1" >>confdefs.h have_curses=ncursesw - CURSES_CFLAGS=$NCURSESW_CFLAGS - CURSES_LIBS=$NCURSESW_LIBS fi if test "x$have_curses" = xncursesw then : @@ -25994,8 +26001,8 @@ pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for panelw" >&5 printf %s "checking for panelw... " >&6; } -if test -n "$PANELW_CFLAGS"; then - pkg_cv_PANELW_CFLAGS="$PANELW_CFLAGS" +if test -n "$PANEL_CFLAGS"; then + pkg_cv_PANEL_CFLAGS="$PANEL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panelw\""; } >&5 @@ -26003,7 +26010,7 @@ if test -n "$PANELW_CFLAGS"; then ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PANELW_CFLAGS=`$PKG_CONFIG --cflags "panelw" 2>/dev/null` + pkg_cv_PANEL_CFLAGS=`$PKG_CONFIG --cflags "panelw" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26011,8 +26018,8 @@ fi else pkg_failed=untried fi -if test -n "$PANELW_LIBS"; then - pkg_cv_PANELW_LIBS="$PANELW_LIBS" +if test -n "$PANEL_LIBS"; then + pkg_cv_PANEL_LIBS="$PANEL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panelw\""; } >&5 @@ -26020,7 +26027,7 @@ if test -n "$PANELW_LIBS"; then ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PANELW_LIBS=`$PKG_CONFIG --libs "panelw" 2>/dev/null` + pkg_cv_PANEL_LIBS=`$PKG_CONFIG --libs "panelw" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26041,53 +26048,69 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PANELW_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "panelw" 2>&1` + PANEL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "panelw" 2>&1` else - PANELW_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "panelw" 2>&1` + PANEL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "panelw" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$PANELW_PKG_ERRORS" >&5 + echo "$PANEL_PKG_ERRORS" >&5 + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS - for ac_header in panel.h ncursesw/panel.h +as_fn_append CPPFLAGS " $PANEL_CFLAGS" + for ac_header in ncursesw/panel.h do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" + ac_fn_c_check_header_compile "$LINENO" "ncursesw/panel.h" "ac_cv_header_ncursesw_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_ncursesw_panel_h" = xyes then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + printf "%s\n" "#define HAVE_NCURSESW_PANEL_H 1" >>confdefs.h have_panel=panelw fi done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - for ac_header in panel.h ncursesw/panel.h + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + +as_fn_append CPPFLAGS " $PANEL_CFLAGS" + for ac_header in ncursesw/panel.h do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" + ac_fn_c_check_header_compile "$LINENO" "ncursesw/panel.h" "ac_cv_header_ncursesw_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_ncursesw_panel_h" = xyes then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + printf "%s\n" "#define HAVE_NCURSESW_PANEL_H 1" >>confdefs.h have_panel=panelw fi done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + else - PANELW_CFLAGS=$pkg_cv_PANELW_CFLAGS - PANELW_LIBS=$pkg_cv_PANELW_LIBS + PANEL_CFLAGS=$pkg_cv_PANEL_CFLAGS + PANEL_LIBS=$pkg_cv_PANEL_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_PANELW 1" >>confdefs.h have_panel=panelw - PANEL_CFLAGS=$PANELW_CFLAGS - PANEL_LIBS=$PANELW_LIBS fi fi @@ -26101,8 +26124,8 @@ pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncurses" >&5 printf %s "checking for ncurses... " >&6; } -if test -n "$NCURSES_CFLAGS"; then - pkg_cv_NCURSES_CFLAGS="$NCURSES_CFLAGS" +if test -n "$CURSES_CFLAGS"; then + pkg_cv_CURSES_CFLAGS="$CURSES_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 @@ -26110,7 +26133,7 @@ if test -n "$NCURSES_CFLAGS"; then ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_NCURSES_CFLAGS=`$PKG_CONFIG --cflags "ncurses" 2>/dev/null` + pkg_cv_CURSES_CFLAGS=`$PKG_CONFIG --cflags "ncurses" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26118,8 +26141,8 @@ fi else pkg_failed=untried fi -if test -n "$NCURSES_LIBS"; then - pkg_cv_NCURSES_LIBS="$NCURSES_LIBS" +if test -n "$CURSES_LIBS"; then + pkg_cv_CURSES_LIBS="$CURSES_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 @@ -26127,7 +26150,7 @@ if test -n "$NCURSES_LIBS"; then ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_NCURSES_LIBS=`$PKG_CONFIG --libs "ncurses" 2>/dev/null` + pkg_cv_CURSES_LIBS=`$PKG_CONFIG --libs "ncurses" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -26148,14 +26171,20 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - NCURSES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` + CURSES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` else - NCURSES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` + CURSES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$NCURSES_PKG_ERRORS" >&5 + echo "$CURSES_PKG_ERRORS" >&5 + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS - for ac_header in ncurses.h curses.h ncurses/curses.h ncurses/ncurses.h +as_fn_append CPPFLAGS " $CURSES_CFLAGS" + for ac_header in ncurses/curses.h ncurses/ncurses.h do : as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -26168,10 +26197,22 @@ _ACEOF fi done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - for ac_header in ncurses.h curses.h ncurses/curses.h ncurses/ncurses.h + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + +as_fn_append CPPFLAGS " $CURSES_CFLAGS" + for ac_header in ncurses/curses.h ncurses/ncurses.h do : as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -26184,17 +26225,21 @@ _ACEOF fi done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + else - NCURSES_CFLAGS=$pkg_cv_NCURSES_CFLAGS - NCURSES_LIBS=$pkg_cv_NCURSES_LIBS + CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS + CURSES_LIBS=$pkg_cv_CURSES_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_NCURSES 1" >>confdefs.h have_curses=ncurses - CURSES_CFLAGS=$NCURSES_CFLAGS - CURSES_LIBS=$NCURSES_LIBS fi if test "x$have_curses" = xncurses then : @@ -26257,35 +26302,53 @@ fi # Put the nasty error message in config.log where it belongs echo "$PANEL_PKG_ERRORS" >&5 - for ac_header in panel.h ncurses/panel.h + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + +as_fn_append CPPFLAGS " $PANEL_CFLAGS" + for ac_header in ncurses/panel.h do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" + ac_fn_c_check_header_compile "$LINENO" "ncurses/panel.h" "ac_cv_header_ncurses_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_ncurses_panel_h" = xyes then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + printf "%s\n" "#define HAVE_NCURSES_PANEL_H 1" >>confdefs.h have_panel=panel fi done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - for ac_header in panel.h ncurses/panel.h + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + +as_fn_append CPPFLAGS " $PANEL_CFLAGS" + for ac_header in ncurses/panel.h do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" + ac_fn_c_check_header_compile "$LINENO" "ncurses/panel.h" "ac_cv_header_ncurses_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_ncurses_panel_h" = xyes then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + printf "%s\n" "#define HAVE_NCURSES_PANEL_H 1" >>confdefs.h have_panel=panel fi done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + else PANEL_CFLAGS=$pkg_cv_PANEL_CFLAGS PANEL_LIBS=$pkg_cv_PANEL_LIBS @@ -26295,8 +26358,6 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_PANEL 1" >>confdefs.h have_panel=panel - PANEL_CFLAGS=$PANEL_CFLAGS - PANEL_LIBS=$PANEL_LIBS fi fi @@ -26322,15 +26383,183 @@ case $have_panel in #( *) : ;; esac -# TODO: rewrite these using AC_COMPILE_IFELSE -#AS_IF([test "have_curses" != "no"], -# [WITH_SAVE_ENV([CPPFLAGS="$CURSES_CFLAGS $CPPFLAGS" -# LDFLAGS="$CURSES_LIBS $LDFLAGS" -# AC_CHECK_FUNC([initscr], [], [have_curses=no])])]) -#AS_IF([test "have_panel" != "no"], -# [WITH_SAVE_ENV([CPPFLAGS="$PANEL_CFLAGS $CPPFLAGS" -# LDFLAGS="$PANEL_LIBS $LDFLAGS" -# AC_CHECK_FUNC([update_panels], [], [have_panel=no])])]) + + + +# If pkg-config failed, try manually. +if test "x$have_curses" = xno +then : + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + +as_fn_append CPPFLAGS " $CURSES_CFLAGS" + as_fn_append LIBS " $CURSES_LIBS" + for ac_header in curses.h ncurses.h +do : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + { 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} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main (void) +{ +return initscr (); + ; + return 0; +} +_ACEOF +for ac_lib in '' ncurses ncursesw +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_initscr=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_initscr+y} +then : + break +fi +done +if test ${ac_cv_search_initscr+y} +then : + +else $as_nop + ac_cv_search_initscr=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_initscr" >&5 +printf "%s\n" "$ac_cv_search_initscr" >&6; } +ac_res=$ac_cv_search_initscr +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + have_curses=yes + CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} +fi + +fi + +done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + +fi +if test "x$have_panel" = xno +then : + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + +as_fn_append CPPFLAGS " $PANEL_CFLAGS" + as_fn_append LIBS " $PANEL_LIBS" + for ac_header in panel.h +do : + ac_fn_c_check_header_compile "$LINENO" "panel.h" "ac_cv_header_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_panel_h" = xyes +then : + printf "%s\n" "#define HAVE_PANEL_H 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing update_panels" >&5 +printf %s "checking for library containing update_panels... " >&6; } +if test ${ac_cv_search_update_panels+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char update_panels (); +int +main (void) +{ +return update_panels (); + ; + return 0; +} +_ACEOF +for ac_lib in '' panel panelw +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_update_panels=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_update_panels+y} +then : + break +fi +done +if test ${ac_cv_search_update_panels+y} +then : + +else $as_nop + ac_cv_search_update_panels=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_update_panels" >&5 +printf "%s\n" "$ac_cv_search_update_panels" >&6; } +ac_res=$ac_cv_search_update_panels +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + have_panel=yes + PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} +fi + +fi + +done +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + +fi if test "have_curses" != "no" then : @@ -26345,19 +26574,25 @@ then : fi - PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') -# first curses header check -ac_save_cppflags="$CPPFLAGS" -if test "$cross_compiling" = no; then - CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" -fi - # On Solaris, term.h requires curses.h ac_fn_c_check_header_compile "$LINENO" "term.h" "ac_cv_header_term_h" " -#ifdef HAVE_CURSES_H -#include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include #endif " @@ -26377,7 +26612,24 @@ then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif + int main (void) { @@ -26407,10 +26659,6 @@ printf "%s\n" "#define MVWDELCH_IS_EXPRESSION 1" >>confdefs.h fi -# Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque -# structs since version 5.7. If the macro is defined as zero before including -# [n]curses.h, ncurses will expose fields of the structs regardless of the -# configuration. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags" >&5 printf %s "checking whether WINDOW has _flags... " >&6; } if test ${ac_cv_window_has_flags+y} @@ -26420,8 +26668,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26466,8 +26728,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26512,8 +26788,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26558,8 +26848,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26604,8 +26908,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26650,8 +26968,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26696,8 +27028,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26742,8 +27088,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26788,8 +27148,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26834,8 +27208,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26880,8 +27268,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) @@ -26926,8 +27328,22 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #define NCURSES_OPAQUE 0 - #include +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif int main (void) diff --git a/configure.ac b/configure.ac index 94fd269237f760..84f2dcd10c883b 100644 --- a/configure.ac +++ b/configure.ac @@ -6575,29 +6575,34 @@ have_panel=no dnl PY_CHECK_CURSES(LIBCURSES, LIBPANEL) dnl Sets 'have_curses' and 'have_panel'. +dnl For the PKG_CHECK_MODULES() calls, we can safely reuse the first variable +dnl here, since we're only calling the macro a second time if the first call +dnl fails. AC_DEFUN([PY_CHECK_CURSES], [dnl AS_VAR_PUSHDEF([curses_var], [m4_toupper([$1])]) AS_VAR_PUSHDEF([panel_var], [m4_toupper([$2])]) -PKG_CHECK_MODULES(curses_var, [$1], +PKG_CHECK_MODULES([CURSES], [$1], [AC_DEFINE([HAVE_]curses_var, [1], [Define if you have the '$1' library]) - AS_VAR_SET([have_curses], [$1]) - AS_VAR_SET([CURSES_CFLAGS], [$curses_var[_CFLAGS]]) - AS_VAR_SET([CURSES_LIBS], [$curses_var[_LIBS]])], - [AC_CHECK_HEADERS([ncurses.h curses.h $1/curses.h $1/ncurses.h], - [AS_VAR_SET([have_curses], [$1])])]) + AS_VAR_SET([have_curses], [$1])], + [WITH_SAVE_ENV( + [AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS"]) + AC_CHECK_HEADERS([$1/curses.h $1/ncurses.h], + [AS_VAR_SET([have_curses], [$1])])])]) AS_VAR_IF([have_curses], [$1], - [PKG_CHECK_MODULES(panel_var, [$2], + [PKG_CHECK_MODULES([PANEL], [$2], [AC_DEFINE([HAVE_]panel_var, [1], [Define if you hve the '$2' library]) - AS_VAR_SET([have_panel], [$2]) - AS_VAR_SET([PANEL_CFLAGS], [$panel_var[_CFLAGS]]) - AS_VAR_SET([PANEL_LIBS], [$panel_var[_LIBS]])], - [AC_CHECK_HEADERS([panel.h $1/panel.h], - [AS_VAR_SET([have_panel], [$2])])])]) + AS_VAR_SET([have_panel], [$2])], + [WITH_SAVE_ENV( + [AS_VAR_APPEND([CPPFLAGS], [" $PANEL_CFLAGS"]) + AC_CHECK_HEADERS([$1/panel.h], + [AS_VAR_SET([have_panel], [$2])])])])]) AS_VAR_POPDEF([curses_var]) AS_VAR_POPDEF([panel_var])]) +# Check for ncursesw/panelw first. If that fails, try ncurses/panel. PY_CHECK_CURSES([ncursesw], [panelw]) -AS_VAR_IF([have_curses], [no], [PY_CHECK_CURSES([ncurses], [panel])]) +AS_VAR_IF([have_curses], [no], + [PY_CHECK_CURSES([ncurses], [panel])]) AS_CASE([$have_curses], [ncursesw], [CURSES_CFLAGS=${CURSES_CFLAGS-""} @@ -6612,15 +6617,52 @@ AS_CASE([$have_panel], [panel], [PANEL_CFLAGS=${PANEL_CFLAGS-""} PANEL_LIBS=${PANEL_LIBS-"-lpanel"}]) -# TODO: rewrite these using AC_COMPILE_IFELSE -#AS_IF([test "have_curses" != "no"], -# [WITH_SAVE_ENV([CPPFLAGS="$CURSES_CFLAGS $CPPFLAGS" -# LDFLAGS="$CURSES_LIBS $LDFLAGS" -# AC_CHECK_FUNC([initscr], [], [have_curses=no])])]) -#AS_IF([test "have_panel" != "no"], -# [WITH_SAVE_ENV([CPPFLAGS="$PANEL_CFLAGS $CPPFLAGS" -# LDFLAGS="$PANEL_LIBS $LDFLAGS" -# AC_CHECK_FUNC([update_panels], [], [have_panel=no])])]) + +dnl Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque +dnl structs since version 5.7. If the macro is defined as zero before including +dnl [n]curses.h, ncurses will expose fields of the structs regardless of the +dnl configuration. +AC_DEFUN([_CURSES_INCLUDES],dnl +[ +#define NCURSES_OPAQUE 0 +#ifdef HAVE_NCURSESW_CURSES_H +# include +#endif +#ifdef HAVE_NCURSESW_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_CURSES_H +# include +#endif +#ifdef HAVE_NCURSES_NCURSES_H +# include +#endif +#ifdef HAVE_NCURSES_H +# include +#endif +]) + +# If pkg-config failed, try manually. +AS_VAR_IF([have_curses], [no], + [WITH_SAVE_ENV( + [AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS"]) + AS_VAR_APPEND([LIBS], [" $CURSES_LIBS"]) + AC_CHECK_HEADERS( + [curses.h ncurses.h], + [AC_SEARCH_LIBS( + [initscr], [ncurses ncursesw], + [AS_VAR_SET([have_curses], [yes]) + CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"}])])])]) +AS_VAR_IF([have_panel], [no], + [WITH_SAVE_ENV( + [AS_VAR_APPEND([CPPFLAGS], [" $PANEL_CFLAGS"]) + AS_VAR_APPEND([LIBS], [" $PANEL_LIBS"]) + AC_CHECK_HEADERS( + [panel.h], + [AC_SEARCH_LIBS( + [update_panels], [panel panelw], + [AS_VAR_SET([have_panel], [yes]) + PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"}])])])]) AS_IF([test "have_curses" != "no"], [ dnl remove _XOPEN_SOURCE macro from curses cflags. pyconfig.h sets @@ -6639,27 +6681,15 @@ AS_VAR_IF([ac_sys_system], [Darwin], [ AS_VAR_APPEND([CURSES_CFLAGS], [" -D_XOPEN_SOURCE_EXTENDED=1"]) ]) -dnl TODO: detect "curses" and special cases tinfo, terminfo, or termcap - dnl pyconfig.h defines _XOPEN_SOURCE=700 PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') -# first curses header check -ac_save_cppflags="$CPPFLAGS" -if test "$cross_compiling" = no; then - CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" -fi - # On Solaris, term.h requires curses.h -AC_CHECK_HEADERS([term.h], [], [], [ -#ifdef HAVE_CURSES_H -#include -#endif -]) +AC_CHECK_HEADERS([term.h], [], [], _CURSES_INCLUDES) # On HP/UX 11.0, mvwdelch is a block with a return statement AC_CACHE_CHECK([whether mvwdelch is an expression], [ac_cv_mvwdelch_is_expression], -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_CURSES_INCLUDES, [[ int rtn; rtn = mvwdelch(0,0,0); ]])], @@ -6672,15 +6702,8 @@ then [Define if mvwdelch in curses.h is an expression.]) fi -# Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque -# structs since version 5.7. If the macro is defined as zero before including -# [n]curses.h, ncurses will expose fields of the structs regardless of the -# configuration. AC_CACHE_CHECK([whether WINDOW has _flags], [ac_cv_window_has_flags], -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #define NCURSES_OPAQUE 0 - #include -]], [[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_CURSES_INCLUDES, [[ WINDOW *w; w->_flags = 0; ]])], @@ -6702,11 +6725,7 @@ AC_DEFUN([PY_CHECK_CURSES_FUNC], [for curses function $1], [py_var], [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [ - #define NCURSES_OPAQUE 0 - #include - ], [ + [AC_LANG_PROGRAM(_CURSES_INCLUDES, [ #ifndef $1 void *x=$1 #endif From de5864767e3a7b3afb47365b5baf2c3fda1a3818 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 Jun 2024 01:17:23 +0200 Subject: [PATCH 03/14] Correctly choose includes in configure.ac and py_curses.h; use NCURSES_VERSION to guard ncurses features --- Include/py_curses.h | 18 +++++++++++++----- Modules/_cursesmodule.c | 2 +- configure.ac | 20 +++++++++----------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Include/py_curses.h b/Include/py_curses.h index a51d9980eee401..79b1b01fcfa594 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 -#else -#include +#if defined(HAVE_NCURSESW_NCURSES_H) +# include +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) +# include +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) +# include +#elif defined(HAVE_CURSES_H) +# include #endif -#ifdef HAVE_NCURSES_H +#ifdef NCURSES_VERSION /* configure was checking , but we will use , which has some or all these features. */ #if !defined(WINDOW_HAS_FLAGS) && \ diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 3a011963968b1a..b5854e8c33f28a 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -128,7 +128,7 @@ static const char PyCursesVersion[] = "2.2"; #include #endif -#if !defined(HAVE_NCURSES_H) && (defined(sgi) || defined(__sun) || defined(SCO5)) +#if !defined(NCURSES_VERSION) && (defined(sgi) || defined(__sun) || defined(SCO5)) #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ typedef chtype attr_t; /* No attr_t type is available */ #endif diff --git a/configure.ac b/configure.ac index 84f2dcd10c883b..dcd0b3f6e4a11a 100644 --- a/configure.ac +++ b/configure.ac @@ -6625,20 +6625,18 @@ dnl configuration. AC_DEFUN([_CURSES_INCLUDES],dnl [ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif ]) From f874d3f5c10d363d662cf6401d9ce8a2231335f5 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 Jun 2024 13:23:35 +0200 Subject: [PATCH 04/14] Add NEWS --- .../next/Build/2024-06-02-13-23-26.gh-issue-113565.8xBlId.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2024-06-02-13-23-26.gh-issue-113565.8xBlId.rst diff --git a/Misc/NEWS.d/next/Build/2024-06-02-13-23-26.gh-issue-113565.8xBlId.rst b/Misc/NEWS.d/next/Build/2024-06-02-13-23-26.gh-issue-113565.8xBlId.rst new file mode 100644 index 00000000000000..e26509cd434110 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2024-06-02-13-23-26.gh-issue-113565.8xBlId.rst @@ -0,0 +1,2 @@ +Improve :mod:`curses` and :mod:`curses.panel` dependency checks in +:program:`configure`. From 4eb1580753b5f5c7bb1d7d4930a4219515fa5c8e Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 Jun 2024 13:24:33 +0200 Subject: [PATCH 05/14] Simplify pkg-config checks and make sure we always do our header and library checks --- configure | 636 +++++++++++++++++--------------------------------- configure.ac | 84 +++---- pyconfig.h.in | 4 +- 3 files changed, 251 insertions(+), 473 deletions(-) diff --git a/configure b/configure index e85abe7ad76e2a..be7340b726b185 100755 --- a/configure +++ b/configure @@ -25931,59 +25931,11 @@ fi # Put the nasty error message in config.log where it belongs echo "$CURSES_PKG_ERRORS" >&5 - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - -as_fn_append CPPFLAGS " $CURSES_CFLAGS" - for ac_header in ncursesw/curses.h ncursesw/ncurses.h -do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" -then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - have_curses=ncursesw -fi - -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - + have_curses=no= elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - -as_fn_append CPPFLAGS " $CURSES_CFLAGS" - for ac_header in ncursesw/curses.h ncursesw/ncurses.h -do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" -then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - have_curses=ncursesw -fi - -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - + have_curses=no= else CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS CURSES_LIBS=$pkg_cv_CURSES_LIBS @@ -25992,10 +25944,7 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_NCURSESW 1" >>confdefs.h - have_curses=ncursesw -fi -if test "x$have_curses" = xncursesw -then : + have_curses=yes pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for panelw" >&5 @@ -26055,53 +26004,11 @@ fi # Put the nasty error message in config.log where it belongs echo "$PANEL_PKG_ERRORS" >&5 - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - -as_fn_append CPPFLAGS " $PANEL_CFLAGS" - for ac_header in ncursesw/panel.h -do : - ac_fn_c_check_header_compile "$LINENO" "ncursesw/panel.h" "ac_cv_header_ncursesw_panel_h" "$ac_includes_default" -if test "x$ac_cv_header_ncursesw_panel_h" = xyes -then : - printf "%s\n" "#define HAVE_NCURSESW_PANEL_H 1" >>confdefs.h - have_panel=panelw -fi - -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - + have_panel=no elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - -as_fn_append CPPFLAGS " $PANEL_CFLAGS" - for ac_header in ncursesw/panel.h -do : - ac_fn_c_check_header_compile "$LINENO" "ncursesw/panel.h" "ac_cv_header_ncursesw_panel_h" "$ac_includes_default" -if test "x$ac_cv_header_ncursesw_panel_h" = xyes -then : - printf "%s\n" "#define HAVE_NCURSESW_PANEL_H 1" >>confdefs.h - have_panel=panelw -fi - -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - + have_panel=no else PANEL_CFLAGS=$pkg_cv_PANEL_CFLAGS PANEL_LIBS=$pkg_cv_PANEL_LIBS @@ -26110,7 +26017,7 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_PANELW 1" >>confdefs.h - have_panel=panelw + have_panel=yes fi fi @@ -26178,59 +26085,11 @@ fi # Put the nasty error message in config.log where it belongs echo "$CURSES_PKG_ERRORS" >&5 - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - -as_fn_append CPPFLAGS " $CURSES_CFLAGS" - for ac_header in ncurses/curses.h ncurses/ncurses.h -do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" -then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - have_curses=ncurses -fi - -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - + have_curses=no= elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - -as_fn_append CPPFLAGS " $CURSES_CFLAGS" - for ac_header in ncurses/curses.h ncurses/ncurses.h -do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" -then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - have_curses=ncurses -fi - -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - + have_curses=no= else CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS CURSES_LIBS=$pkg_cv_CURSES_LIBS @@ -26239,10 +26098,7 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_NCURSES 1" >>confdefs.h - have_curses=ncurses -fi -if test "x$have_curses" = xncurses -then : + have_curses=yes pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for panel" >&5 @@ -26302,110 +26158,94 @@ fi # Put the nasty error message in config.log where it belongs echo "$PANEL_PKG_ERRORS" >&5 - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS + have_panel=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_panel=no +else + PANEL_CFLAGS=$pkg_cv_PANEL_CFLAGS + PANEL_LIBS=$pkg_cv_PANEL_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -as_fn_append CPPFLAGS " $PANEL_CFLAGS" - for ac_header in ncurses/panel.h -do : - ac_fn_c_check_header_compile "$LINENO" "ncurses/panel.h" "ac_cv_header_ncurses_panel_h" "$ac_includes_default" -if test "x$ac_cv_header_ncurses_panel_h" = xyes -then : - printf "%s\n" "#define HAVE_NCURSES_PANEL_H 1" >>confdefs.h - have_panel=panel +printf "%s\n" "#define HAVE_PANEL 1" >>confdefs.h + + have_panel=yes +fi fi -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS +fi -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - save_CFLAGS=$CFLAGS +save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS -as_fn_append CPPFLAGS " $PANEL_CFLAGS" - for ac_header in ncurses/panel.h -do : - ac_fn_c_check_header_compile "$LINENO" "ncurses/panel.h" "ac_cv_header_ncurses_panel_h" "$ac_includes_default" -if test "x$ac_cv_header_ncurses_panel_h" = xyes -then : - printf "%s\n" "#define HAVE_NCURSES_PANEL_H 1" >>confdefs.h - have_panel=panel -fi -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS + # Make sure we've got the header defines. + as_fn_append CPPFLAGS " $CURSES_CFLAGS" + ac_fn_c_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" +if test "x$ac_cv_header_curses_h" = xyes +then : + printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncurses_h" = xyes +then : + printf "%s\n" "#define HAVE_NCURSES_H 1" >>confdefs.h -else - PANEL_CFLAGS=$pkg_cv_PANEL_CFLAGS - PANEL_LIBS=$pkg_cv_PANEL_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } +fi +ac_fn_c_check_header_compile "$LINENO" "panel.h" "ac_cv_header_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_panel_h" = xyes +then : + printf "%s\n" "#define HAVE_PANEL_H 1" >>confdefs.h -printf "%s\n" "#define HAVE_PANEL 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "ncurses/curses.h" "ac_cv_header_ncurses_curses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncurses_curses_h" = xyes +then : + printf "%s\n" "#define HAVE_NCURSES_CURSES_H 1" >>confdefs.h - have_panel=panel fi +ac_fn_c_check_header_compile "$LINENO" "ncurses/ncurses.h" "ac_cv_header_ncurses_ncurses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncurses_ncurses_h" = xyes +then : + printf "%s\n" "#define HAVE_NCURSES_NCURSES_H 1" >>confdefs.h + fi +ac_fn_c_check_header_compile "$LINENO" "ncurses/panel.h" "ac_cv_header_ncurses_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_ncurses_panel_h" = xyes +then : + printf "%s\n" "#define HAVE_NCURSES_PANEL_H 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "ncursesw/curses.h" "ac_cv_header_ncursesw_curses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncursesw_curses_h" = xyes +then : + printf "%s\n" "#define HAVE_NCURSESW_CURSES_H 1" >>confdefs.h fi -case $have_curses in #( - ncursesw) : - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} ;; #( - ncurses) : - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncurses"} ;; #( - *) : - ;; -esac -case $have_panel in #( - panelw) : - PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanelw"} ;; #( - panel) : - PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanel"} ;; #( - *) : - ;; -esac +ac_fn_c_check_header_compile "$LINENO" "ncursesw/ncurses.h" "ac_cv_header_ncursesw_ncurses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncursesw_ncurses_h" = xyes +then : + printf "%s\n" "#define HAVE_NCURSESW_NCURSES_H 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "ncursesw/panel.h" "ac_cv_header_ncursesw_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_ncursesw_panel_h" = xyes +then : + printf "%s\n" "#define HAVE_NCURSESW_PANEL_H 1" >>confdefs.h +fi -# If pkg-config failed, try manually. -if test "x$have_curses" = xno -then : - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS -as_fn_append CPPFLAGS " $CURSES_CFLAGS" - as_fn_append LIBS " $CURSES_LIBS" - for ac_header in curses.h ncurses.h -do : - as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" -then : - cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing initscr" >&5 + # 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" + { 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} then : @@ -26461,36 +26301,11 @@ ac_res=$ac_cv_search_initscr if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - have_curses=yes - CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} -fi - -fi - -done -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - -fi -if test "x$have_panel" = xno + if test "x$have_curses" = xno then : - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - -as_fn_append CPPFLAGS " $PANEL_CFLAGS" - as_fn_append LIBS " $PANEL_LIBS" - for ac_header in panel.h -do : - ac_fn_c_check_header_compile "$LINENO" "panel.h" "ac_cv_header_panel_h" "$ac_includes_default" -if test "x$ac_cv_header_panel_h" = xyes -then : - printf "%s\n" "#define HAVE_PANEL_H 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing update_panels" >&5 + have_curses=yes + CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing update_panels" >&5 printf %s "checking for library containing update_panels... " >&6; } if test ${ac_cv_search_update_panels+y} then : @@ -26546,20 +26361,29 @@ ac_res=$ac_cv_search_update_panels if test "$ac_res" != no 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"} + PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} +fi +else $as_nop + have_panel=no fi fi +else $as_nop + have_curses=no +fi + -done CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS -fi + + if test "have_curses" != "no" then : @@ -26579,20 +26403,18 @@ PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') # On Solaris, term.h requires curses.h ac_fn_c_check_header_compile "$LINENO" "term.h" "ac_cv_header_term_h" " #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif " @@ -26614,20 +26436,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -26669,20 +26489,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -26729,20 +26547,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -26789,20 +26605,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -26849,20 +26663,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -26909,20 +26721,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -26969,20 +26779,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -27029,20 +26837,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -27089,20 +26895,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -27149,20 +26953,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -27209,20 +27011,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -27269,20 +27069,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int @@ -27329,20 +27127,18 @@ else $as_nop /* end confdefs.h. */ #define NCURSES_OPAQUE 0 -#ifdef HAVE_NCURSESW_CURSES_H -# include -#endif -#ifdef HAVE_NCURSESW_NCURSES_H +#if defined(HAVE_NCURSESW_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_CURSES_H -# include -#endif -#ifdef HAVE_NCURSES_NCURSES_H +#elif defined(HAVE_NCURSESW_CURSES_H) +# include +#elif defined(HAVE_NCURSES_NCURSES_H) # include -#endif -#ifdef HAVE_NCURSES_H +#elif defined(HAVE_NCURSES_CURSES_H) +# include +#elif defined(HAVE_NCURSES_H) # include +#elif defined(HAVE_CURSES_H) +# include #endif int diff --git a/configure.ac b/configure.ac index dcd0b3f6e4a11a..46917c8717c1d5 100644 --- a/configure.ac +++ b/configure.ac @@ -6568,8 +6568,8 @@ fi dnl check for ncurses/ncursesw and panel/panelw dnl NOTE: old curses is not detected. -dnl have_curses=[no, ncursesw, ncurses] -dnl have_panel=[no, panelw, panel] +dnl have_curses=[no, yes] +dnl have_panel=[no, yes] have_curses=no have_panel=no @@ -6583,19 +6583,12 @@ AS_VAR_PUSHDEF([curses_var], [m4_toupper([$1])]) AS_VAR_PUSHDEF([panel_var], [m4_toupper([$2])]) PKG_CHECK_MODULES([CURSES], [$1], [AC_DEFINE([HAVE_]curses_var, [1], [Define if you have the '$1' library]) - AS_VAR_SET([have_curses], [$1])], - [WITH_SAVE_ENV( - [AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS"]) - AC_CHECK_HEADERS([$1/curses.h $1/ncurses.h], - [AS_VAR_SET([have_curses], [$1])])])]) -AS_VAR_IF([have_curses], [$1], - [PKG_CHECK_MODULES([PANEL], [$2], - [AC_DEFINE([HAVE_]panel_var, [1], [Define if you hve the '$2' library]) - AS_VAR_SET([have_panel], [$2])], - [WITH_SAVE_ENV( - [AS_VAR_APPEND([CPPFLAGS], [" $PANEL_CFLAGS"]) - AC_CHECK_HEADERS([$1/panel.h], - [AS_VAR_SET([have_panel], [$2])])])])]) + AS_VAR_SET([have_curses], [yes]) + PKG_CHECK_MODULES([PANEL], [$2], + [AC_DEFINE([HAVE_]panel_var, [1], [Define if you have the '$2' library]) + AS_VAR_SET([have_panel], [yes])], + [AS_VAR_SET([have_panel], [no])])], + [AS_VAR_SET([have_curses=no])]) AS_VAR_POPDEF([curses_var]) AS_VAR_POPDEF([panel_var])]) @@ -6603,20 +6596,31 @@ AS_VAR_POPDEF([panel_var])]) PY_CHECK_CURSES([ncursesw], [panelw]) AS_VAR_IF([have_curses], [no], [PY_CHECK_CURSES([ncurses], [panel])]) -AS_CASE([$have_curses], - [ncursesw], - [CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncursesw"}], - [ncurses], - [CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncurses"}]) -AS_CASE([$have_panel], - [panelw], - [PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanelw"}], - [panel], - [PANEL_CFLAGS=${PANEL_CFLAGS-""} - PANEL_LIBS=${PANEL_LIBS-"-lpanel"}]) + +WITH_SAVE_ENV([ + # Make sure we've got the header defines. + AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS"]) + AC_CHECK_HEADERS(m4_normalize([ + curses.h ncurses.h panel.h + ncurses/curses.h ncurses/ncurses.h ncurses/panel.h + ncursesw/curses.h ncursesw/ncurses.h ncursesw/panel.h + ])) + + # 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"]) + AC_SEARCH_LIBS([initscr], [ncurses ncursesw], + [AS_VAR_IF([have_curses], [no], + [AS_VAR_SET([have_curses], [yes]) + CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} + AC_SEARCH_LIBS( + [update_panels], [panel panelw], + [AS_VAR_IF([have_panel], [no], + [AS_VAR_SET([have_panel], [yes]) + PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"}])], + [AS_VAR_SET([have_panel], [no])])])], + [AS_VAR_SET([have_curses], [no])]) +]) dnl Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque dnl structs since version 5.7. If the macro is defined as zero before including @@ -6640,28 +6644,6 @@ AC_DEFUN([_CURSES_INCLUDES],dnl #endif ]) -# If pkg-config failed, try manually. -AS_VAR_IF([have_curses], [no], - [WITH_SAVE_ENV( - [AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS"]) - AS_VAR_APPEND([LIBS], [" $CURSES_LIBS"]) - AC_CHECK_HEADERS( - [curses.h ncurses.h], - [AC_SEARCH_LIBS( - [initscr], [ncurses ncursesw], - [AS_VAR_SET([have_curses], [yes]) - CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"}])])])]) -AS_VAR_IF([have_panel], [no], - [WITH_SAVE_ENV( - [AS_VAR_APPEND([CPPFLAGS], [" $PANEL_CFLAGS"]) - AS_VAR_APPEND([LIBS], [" $PANEL_LIBS"]) - AC_CHECK_HEADERS( - [panel.h], - [AC_SEARCH_LIBS( - [update_panels], [panel panelw], - [AS_VAR_SET([have_panel], [yes]) - PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"}])])])]) - AS_IF([test "have_curses" != "no"], [ dnl remove _XOPEN_SOURCE macro from curses cflags. pyconfig.h sets dnl the macro to 700. diff --git a/pyconfig.h.in b/pyconfig.h.in index 1bc1f9e8a11977..4d8b1d4f25440a 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -899,10 +899,10 @@ /* Define to 1 if you have the `openpty' function. */ #undef HAVE_OPENPTY -/* Define if you hve the 'panel' library */ +/* Define if you have the 'panel' library */ #undef HAVE_PANEL -/* Define if you hve the 'panelw' library */ +/* Define if you have the 'panelw' library */ #undef HAVE_PANELW /* Define to 1 if you have the header file. */ From fb275e256966117105ac39e8a9e25c5ffea799c4 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 Jun 2024 13:51:54 +0200 Subject: [PATCH 06/14] Disable curses/panel if not found; don't mark them as missing --- configure | 12 ++++++------ configure.ac | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configure b/configure index be7340b726b185..62c578951dd347 100755 --- a/configure +++ b/configure @@ -26185,7 +26185,7 @@ save_LIBS=$LIBS # Make sure we've got the header defines. - as_fn_append CPPFLAGS " $CURSES_CFLAGS" + as_fn_append CPPFLAGS " $CURSES_CFLAGS $PANEL_CFLAGS" ac_fn_c_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" if test "x$ac_cv_header_curses_h" = xyes then : @@ -26244,7 +26244,7 @@ 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" + as_fn_append 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} @@ -30243,9 +30243,9 @@ printf %s "checking for stdlib extension module _curses... " >&6; } if test "$py_cv_module__curses" != "n/a" then : - if true + if test "$have_curses" = "yes" then : - if test "$have_curses" != "no" + if true then : py_cv_module__curses=yes else $as_nop @@ -30282,9 +30282,9 @@ printf %s "checking for stdlib extension module _curses_panel... " >&6; } if test "$py_cv_module__curses_panel" != "n/a" then : - if true + if test "$have_panel" = "yes" then : - if test "$have_panel" != "no" + if true then : py_cv_module__curses_panel=yes else $as_nop diff --git a/configure.ac b/configure.ac index 46917c8717c1d5..5b4c824e613f5d 100644 --- a/configure.ac +++ b/configure.ac @@ -6599,7 +6599,7 @@ AS_VAR_IF([have_curses], [no], WITH_SAVE_ENV([ # Make sure we've got the header defines. - AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS"]) + AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS $PANEL_CFLAGS"]) AC_CHECK_HEADERS(m4_normalize([ curses.h ncurses.h panel.h ncurses/curses.h ncurses/ncurses.h ncurses/panel.h @@ -6608,7 +6608,7 @@ 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"]) + AS_VAR_APPEND([LIBS], [" $CURSES_LIBS $PANEL_LIBS"]) AC_SEARCH_LIBS([initscr], [ncurses ncursesw], [AS_VAR_IF([have_curses], [no], [AS_VAR_SET([have_curses], [yes]) @@ -7651,11 +7651,11 @@ PY_STDLIB_MOD([_ctypes], [], [test "$have_libffi" = yes], [$NO_STRICT_OVERFLOW_CFLAGS $LIBFFI_CFLAGS], [$LIBFFI_LIBS]) PY_STDLIB_MOD([_curses], - [], [test "$have_curses" != "no"], + [test "$have_curses" = "yes"], [], [$CURSES_CFLAGS], [$CURSES_LIBS] ) PY_STDLIB_MOD([_curses_panel], - [], [test "$have_panel" != "no"], + [test "$have_panel" = "yes"], [], [$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS] ) PY_STDLIB_MOD([_decimal], From 18b68c5b86136c8c844f73e00cec66fe66755c3c Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 Jun 2024 14:04:51 +0200 Subject: [PATCH 07/14] Enable panel only if curses is also found; harden term.h check, and check for update_panels() independently of initscr() --- configure | 34 ++++++++++++++++++++++++---------- configure.ac | 22 ++++++++++++---------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/configure b/configure index 62c578951dd347..2133c874f7040b 100755 --- a/configure +++ b/configure @@ -26305,7 +26305,12 @@ then : then : have_curses=yes CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing update_panels" >&5 +fi +else $as_nop + have_curses=no +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing update_panels" >&5 printf %s "checking for library containing update_panels... " >&6; } if test ${ac_cv_search_update_panels+y} then : @@ -26364,17 +26369,12 @@ then : if test "x$have_panel" = xno then : have_panel=yes - PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} + PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} fi else $as_nop have_panel=no fi -fi -else $as_nop - have_curses=no -fi - CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS @@ -26400,8 +26400,15 @@ fi PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') -# On Solaris, term.h requires curses.h -ac_fn_c_check_header_compile "$LINENO" "term.h" "ac_cv_header_term_h" " +save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + as_fn_append CPPFLAGS " $CURSES_CFLAGS" + # On Solaris, term.h requires curses.h + ac_fn_c_check_header_compile "$LINENO" "term.h" "ac_cv_header_term_h" " #define NCURSES_OPAQUE 0 #if defined(HAVE_NCURSESW_NCURSES_H) # include @@ -26425,6 +26432,13 @@ then : fi +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + + # On HP/UX 11.0, mvwdelch is a block with a return statement { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5 printf %s "checking whether mvwdelch is an expression... " >&6; } @@ -30282,7 +30296,7 @@ printf %s "checking for stdlib extension module _curses_panel... " >&6; } if test "$py_cv_module__curses_panel" != "n/a" then : - if test "$have_panel" = "yes" + if test "$have_curses" = "yes" && test "$have_panel" = "yes" then : if true then : diff --git a/configure.ac b/configure.ac index 5b4c824e613f5d..e0452acd64b473 100644 --- a/configure.ac +++ b/configure.ac @@ -6612,14 +6612,13 @@ WITH_SAVE_ENV([ AC_SEARCH_LIBS([initscr], [ncurses ncursesw], [AS_VAR_IF([have_curses], [no], [AS_VAR_SET([have_curses], [yes]) - CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} - AC_SEARCH_LIBS( - [update_panels], [panel panelw], - [AS_VAR_IF([have_panel], [no], - [AS_VAR_SET([have_panel], [yes]) - PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"}])], - [AS_VAR_SET([have_panel], [no])])])], + CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"}])], [AS_VAR_SET([have_curses], [no])]) + AC_SEARCH_LIBS([update_panels], [panel panelw], + [AS_VAR_IF([have_panel], [no], + [AS_VAR_SET([have_panel], [yes]) + 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 @@ -6664,8 +6663,11 @@ AS_VAR_IF([ac_sys_system], [Darwin], [ dnl pyconfig.h defines _XOPEN_SOURCE=700 PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') -# On Solaris, term.h requires curses.h -AC_CHECK_HEADERS([term.h], [], [], _CURSES_INCLUDES) +WITH_SAVE_ENV([ + AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS"]) + # On Solaris, term.h requires curses.h + AC_CHECK_HEADERS([term.h], [], [], _CURSES_INCLUDES) +]) # On HP/UX 11.0, mvwdelch is a block with a return statement AC_CACHE_CHECK([whether mvwdelch is an expression], [ac_cv_mvwdelch_is_expression], @@ -7655,7 +7657,7 @@ PY_STDLIB_MOD([_curses], [$CURSES_CFLAGS], [$CURSES_LIBS] ) PY_STDLIB_MOD([_curses_panel], - [test "$have_panel" = "yes"], [], + [test "$have_curses" = "yes" && test "$have_panel" = "yes"], [], [$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS] ) PY_STDLIB_MOD([_decimal], From bedd4b02dc0124dd6c1938fdd307649e2f2e8684 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Sun, 2 Jun 2024 14:32:04 +0200 Subject: [PATCH 08/14] Use WITH_SAVE_ENV for all curses feature checks --- configure | 15 ++++++++------- configure.ac | 8 +++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 2133c874f7040b..a28d6e96e26ec5 100755 --- a/configure +++ b/configure @@ -26305,6 +26305,7 @@ then : then : have_curses=yes CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} + as_fn_append LIBS " $ac_cv_search_initscr" fi else $as_nop have_curses=no @@ -26370,19 +26371,13 @@ then : then : have_panel=yes PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} + as_fn_append LIBS " $ac_cv_search_update_panels" fi else $as_nop have_panel=no fi -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - if test "have_curses" != "no" @@ -27190,6 +27185,12 @@ fi CPPFLAGS=$ac_save_cppflags fi +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + { 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 e0452acd64b473..c0478aa206fcee 100644 --- a/configure.ac +++ b/configure.ac @@ -6612,14 +6612,15 @@ WITH_SAVE_ENV([ AC_SEARCH_LIBS([initscr], [ncurses ncursesw], [AS_VAR_IF([have_curses], [no], [AS_VAR_SET([have_curses], [yes]) - CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"}])], + CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} + AS_VAR_APPEND([LIBS], [" $ac_cv_search_initscr"])])], [AS_VAR_SET([have_curses], [no])]) AC_SEARCH_LIBS([update_panels], [panel panelw], [AS_VAR_IF([have_panel], [no], [AS_VAR_SET([have_panel], [yes]) - PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"}])], + PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} + AS_VAR_APPEND([LIBS], [" $ac_cv_search_update_panels"])])], [AS_VAR_SET([have_panel], [no])]) -]) dnl Issue #25720: ncurses has introduced the NCURSES_OPAQUE symbol making opaque dnl structs since version 5.7. If the macro is defined as zero before including @@ -6736,6 +6737,7 @@ PY_CHECK_CURSES_FUNC([typeahead]) PY_CHECK_CURSES_FUNC([use_env]) CPPFLAGS=$ac_save_cppflags ])dnl have_curses != no +])dnl save env AC_MSG_NOTICE([checking for device files]) From e61f55d5aeece7a3189ba6014bb826bb4f693dec Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 3 Jun 2024 11:13:41 +0200 Subject: [PATCH 09/14] Fix pkg-config failure clause --- configure | 8 ++++---- configure.ac | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure b/configure index a28d6e96e26ec5..0264313d35b354 100755 --- a/configure +++ b/configure @@ -25931,11 +25931,11 @@ fi # Put the nasty error message in config.log where it belongs echo "$CURSES_PKG_ERRORS" >&5 - have_curses=no= + have_curses=no elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - have_curses=no= + have_curses=no else CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS CURSES_LIBS=$pkg_cv_CURSES_LIBS @@ -26085,11 +26085,11 @@ fi # Put the nasty error message in config.log where it belongs echo "$CURSES_PKG_ERRORS" >&5 - have_curses=no= + have_curses=no elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - have_curses=no= + have_curses=no else CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS CURSES_LIBS=$pkg_cv_CURSES_LIBS diff --git a/configure.ac b/configure.ac index c0478aa206fcee..cbf4b1c135ab90 100644 --- a/configure.ac +++ b/configure.ac @@ -6588,7 +6588,7 @@ PKG_CHECK_MODULES([CURSES], [$1], [AC_DEFINE([HAVE_]panel_var, [1], [Define if you have the '$2' library]) AS_VAR_SET([have_panel], [yes])], [AS_VAR_SET([have_panel], [no])])], - [AS_VAR_SET([have_curses=no])]) + [AS_VAR_SET([have_curses], [no])]) AS_VAR_POPDEF([curses_var]) AS_VAR_POPDEF([panel_var])]) From 289058cae5a8f87be4bb4812f76903a3a897a0b4 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 3 Jun 2024 11:18:23 +0200 Subject: [PATCH 10/14] Mark curses/panel as missing iso. disabled if deps are not found --- configure | 8 ++++---- configure.ac | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 0264313d35b354..c53b1ef282a4f1 100755 --- a/configure +++ b/configure @@ -30258,9 +30258,9 @@ printf %s "checking for stdlib extension module _curses... " >&6; } if test "$py_cv_module__curses" != "n/a" then : - if test "$have_curses" = "yes" + if true then : - if true + if test "$have_curses" = "yes" then : py_cv_module__curses=yes else $as_nop @@ -30297,9 +30297,9 @@ printf %s "checking for stdlib extension module _curses_panel... " >&6; } if test "$py_cv_module__curses_panel" != "n/a" then : - if test "$have_curses" = "yes" && test "$have_panel" = "yes" + if true then : - if true + if test "$have_curses" = "yes" && test "$have_panel" = "yes" then : py_cv_module__curses_panel=yes else $as_nop diff --git a/configure.ac b/configure.ac index cbf4b1c135ab90..bc3ddb8d27cae2 100644 --- a/configure.ac +++ b/configure.ac @@ -7655,11 +7655,11 @@ PY_STDLIB_MOD([_ctypes], [], [test "$have_libffi" = yes], [$NO_STRICT_OVERFLOW_CFLAGS $LIBFFI_CFLAGS], [$LIBFFI_LIBS]) PY_STDLIB_MOD([_curses], - [test "$have_curses" = "yes"], [], + [], [test "$have_curses" = "yes"], [$CURSES_CFLAGS], [$CURSES_LIBS] ) PY_STDLIB_MOD([_curses_panel], - [test "$have_curses" = "yes" && test "$have_panel" = "yes"], [], + [], [test "$have_curses" = "yes" && test "$have_panel" = "yes"], [$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS] ) PY_STDLIB_MOD([_decimal], From 739af749138c711b20a84957215da59503434c96 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 3 Jun 2024 12:54:16 +0200 Subject: [PATCH 11/14] Don't mess up compiler and linker flags; WITH_SAVE_ENV does not nest --- configure | 18 ++---------------- configure.ac | 7 ++----- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/configure b/configure index c53b1ef282a4f1..f83369420def7a 100755 --- a/configure +++ b/configure @@ -26395,15 +26395,8 @@ fi PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') -save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS - - - as_fn_append CPPFLAGS " $CURSES_CFLAGS" - # On Solaris, term.h requires curses.h - ac_fn_c_check_header_compile "$LINENO" "term.h" "ac_cv_header_term_h" " +# On Solaris, term.h requires curses.h +ac_fn_c_check_header_compile "$LINENO" "term.h" "ac_cv_header_term_h" " #define NCURSES_OPAQUE 0 #if defined(HAVE_NCURSESW_NCURSES_H) # include @@ -26427,13 +26420,6 @@ then : fi -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS - - - # On HP/UX 11.0, mvwdelch is a block with a return statement { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5 printf %s "checking whether mvwdelch is an expression... " >&6; } diff --git a/configure.ac b/configure.ac index bc3ddb8d27cae2..ee80517877adde 100644 --- a/configure.ac +++ b/configure.ac @@ -6664,11 +6664,8 @@ AS_VAR_IF([ac_sys_system], [Darwin], [ dnl pyconfig.h defines _XOPEN_SOURCE=700 PANEL_CFLAGS=$(echo $PANEL_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//g') -WITH_SAVE_ENV([ - AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS"]) - # On Solaris, term.h requires curses.h - AC_CHECK_HEADERS([term.h], [], [], _CURSES_INCLUDES) -]) +# On Solaris, term.h requires curses.h +AC_CHECK_HEADERS([term.h], [], [], _CURSES_INCLUDES) # On HP/UX 11.0, mvwdelch is a block with a return statement AC_CACHE_CHECK([whether mvwdelch is an expression], [ac_cv_mvwdelch_is_expression], From 7edb5766df92ef8deded4c51164b382d2d72ec6f Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 3 Jun 2024 14:17:36 +0200 Subject: [PATCH 12/14] AC_SEARCH_LIBS implicitly updates LIBS; no need for us to duplicate that effort --- configure | 2 -- configure.ac | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/configure b/configure index f83369420def7a..87483c5e9099b7 100755 --- a/configure +++ b/configure @@ -26305,7 +26305,6 @@ then : then : have_curses=yes CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} - as_fn_append LIBS " $ac_cv_search_initscr" fi else $as_nop have_curses=no @@ -26371,7 +26370,6 @@ then : then : have_panel=yes PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} - as_fn_append LIBS " $ac_cv_search_update_panels" fi else $as_nop have_panel=no diff --git a/configure.ac b/configure.ac index ee80517877adde..f8d9db102bfefd 100644 --- a/configure.ac +++ b/configure.ac @@ -6612,14 +6612,12 @@ WITH_SAVE_ENV([ AC_SEARCH_LIBS([initscr], [ncurses ncursesw], [AS_VAR_IF([have_curses], [no], [AS_VAR_SET([have_curses], [yes]) - CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"} - AS_VAR_APPEND([LIBS], [" $ac_cv_search_initscr"])])], + CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"}])], [AS_VAR_SET([have_curses], [no])]) AC_SEARCH_LIBS([update_panels], [panel panelw], [AS_VAR_IF([have_panel], [no], [AS_VAR_SET([have_panel], [yes]) - PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"} - AS_VAR_APPEND([LIBS], [" $ac_cv_search_update_panels"])])], + 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 From 68336b7e590742c0a6a8beecae22e5e03487b8da Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 3 Jun 2024 14:20:14 +0200 Subject: [PATCH 13/14] Prioritise the *w libs in all checks and guards --- configure | 40 ++++++++++++++++++++-------------------- configure.ac | 10 +++++----- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/configure b/configure index 87483c5e9099b7..432f746c6c5d8b 100755 --- a/configure +++ b/configure @@ -26186,22 +26186,22 @@ save_LIBS=$LIBS # Make sure we've got the header defines. as_fn_append CPPFLAGS " $CURSES_CFLAGS $PANEL_CFLAGS" - ac_fn_c_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" -if test "x$ac_cv_header_curses_h" = xyes + ac_fn_c_check_header_compile "$LINENO" "ncursesw/curses.h" "ac_cv_header_ncursesw_curses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncursesw_curses_h" = xyes then : - printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h + printf "%s\n" "#define HAVE_NCURSESW_CURSES_H 1" >>confdefs.h fi -ac_fn_c_check_header_compile "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default" -if test "x$ac_cv_header_ncurses_h" = xyes +ac_fn_c_check_header_compile "$LINENO" "ncursesw/ncurses.h" "ac_cv_header_ncursesw_ncurses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncursesw_ncurses_h" = xyes then : - printf "%s\n" "#define HAVE_NCURSES_H 1" >>confdefs.h + printf "%s\n" "#define HAVE_NCURSESW_NCURSES_H 1" >>confdefs.h fi -ac_fn_c_check_header_compile "$LINENO" "panel.h" "ac_cv_header_panel_h" "$ac_includes_default" -if test "x$ac_cv_header_panel_h" = xyes +ac_fn_c_check_header_compile "$LINENO" "ncursesw/panel.h" "ac_cv_header_ncursesw_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_ncursesw_panel_h" = xyes then : - printf "%s\n" "#define HAVE_PANEL_H 1" >>confdefs.h + printf "%s\n" "#define HAVE_NCURSESW_PANEL_H 1" >>confdefs.h fi ac_fn_c_check_header_compile "$LINENO" "ncurses/curses.h" "ac_cv_header_ncurses_curses_h" "$ac_includes_default" @@ -26222,22 +26222,22 @@ then : printf "%s\n" "#define HAVE_NCURSES_PANEL_H 1" >>confdefs.h fi -ac_fn_c_check_header_compile "$LINENO" "ncursesw/curses.h" "ac_cv_header_ncursesw_curses_h" "$ac_includes_default" -if test "x$ac_cv_header_ncursesw_curses_h" = xyes +ac_fn_c_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" +if test "x$ac_cv_header_curses_h" = xyes then : - printf "%s\n" "#define HAVE_NCURSESW_CURSES_H 1" >>confdefs.h + printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h fi -ac_fn_c_check_header_compile "$LINENO" "ncursesw/ncurses.h" "ac_cv_header_ncursesw_ncurses_h" "$ac_includes_default" -if test "x$ac_cv_header_ncursesw_ncurses_h" = xyes +ac_fn_c_check_header_compile "$LINENO" "ncurses.h" "ac_cv_header_ncurses_h" "$ac_includes_default" +if test "x$ac_cv_header_ncurses_h" = xyes then : - printf "%s\n" "#define HAVE_NCURSESW_NCURSES_H 1" >>confdefs.h + printf "%s\n" "#define HAVE_NCURSES_H 1" >>confdefs.h fi -ac_fn_c_check_header_compile "$LINENO" "ncursesw/panel.h" "ac_cv_header_ncursesw_panel_h" "$ac_includes_default" -if test "x$ac_cv_header_ncursesw_panel_h" = xyes +ac_fn_c_check_header_compile "$LINENO" "panel.h" "ac_cv_header_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_panel_h" = xyes then : - printf "%s\n" "#define HAVE_NCURSESW_PANEL_H 1" >>confdefs.h + printf "%s\n" "#define HAVE_PANEL_H 1" >>confdefs.h fi @@ -26267,7 +26267,7 @@ return initscr (); return 0; } _ACEOF -for ac_lib in '' ncurses ncursesw +for ac_lib in '' ncursesw ncurses do if test -z "$ac_lib"; then ac_res="none required" @@ -26332,7 +26332,7 @@ return update_panels (); return 0; } _ACEOF -for ac_lib in '' panel panelw +for ac_lib in '' panelw panel do if test -z "$ac_lib"; then ac_res="none required" diff --git a/configure.ac b/configure.ac index f8d9db102bfefd..e895666a4ee279 100644 --- a/configure.ac +++ b/configure.ac @@ -6566,7 +6566,7 @@ then [Define if you have struct stat.st_mtimensec]) fi -dnl check for ncurses/ncursesw and panel/panelw +dnl check for ncursesw/ncurses and panelw/panel dnl NOTE: old curses is not detected. dnl have_curses=[no, yes] dnl have_panel=[no, yes] @@ -6601,20 +6601,20 @@ WITH_SAVE_ENV([ # Make sure we've got the header defines. AS_VAR_APPEND([CPPFLAGS], [" $CURSES_CFLAGS $PANEL_CFLAGS"]) AC_CHECK_HEADERS(m4_normalize([ - curses.h ncurses.h panel.h - ncurses/curses.h ncurses/ncurses.h ncurses/panel.h ncursesw/curses.h ncursesw/ncurses.h ncursesw/panel.h + ncurses/curses.h ncurses/ncurses.h ncurses/panel.h + curses.h ncurses.h panel.h ])) # 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"]) - AC_SEARCH_LIBS([initscr], [ncurses ncursesw], + AC_SEARCH_LIBS([initscr], [ncursesw ncurses], [AS_VAR_IF([have_curses], [no], [AS_VAR_SET([have_curses], [yes]) CURSES_LIBS=${CURSES_LIBS-"$ac_cv_search_initscr"}])], [AS_VAR_SET([have_curses], [no])]) - AC_SEARCH_LIBS([update_panels], [panel panelw], + AC_SEARCH_LIBS([update_panels], [panelw panel], [AS_VAR_IF([have_panel], [no], [AS_VAR_SET([have_panel], [yes]) PANEL_LIBS=${PANEL_LIBS-"$ac_cv_search_update_panels"}])], From 311da9a82f73fdf65235a7c556ed18c8f0465ff0 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 3 Jun 2024 22:52:03 +0200 Subject: [PATCH 14/14] Guard panel includes If none of the guards are defined, the file won't compile, so don't bother with an explicit #error --- Modules/_curses_panel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index 125c72dbbe7712..bbbb62c9066df0 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -19,7 +19,13 @@ static const char PyCursesVersion[] = "2.1"; #include "py_curses.h" -#include +#if defined(HAVE_NCURSESW_PANEL_H) +# include +#elif defined(HAVE_NCURSES_PANEL_H) +# include +#elif defined(HAVE_PANEL_H) +# include +#endif typedef struct { PyObject *PyCursesError; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy