From 4c9745364c6f309a3460df6d54c0365053cc18a8 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 30 Jun 2022 17:19:12 +0200 Subject: [PATCH 1/7] gh-90005: Port readline and curses to PY_STDLIB_MOD --- ...2-06-30-17-18-23.gh-issue-90005.EIOOla.rst | 4 + Modules/Setup.stdlib.in | 12 +- configure | 1779 ++++++++++++++--- configure.ac | 347 ++-- pyconfig.h.in | 36 +- setup.py | 146 +- 6 files changed, 1756 insertions(+), 568 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst diff --git a/Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst b/Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst new file mode 100644 index 00000000000000..3789e38801104c --- /dev/null +++ b/Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst @@ -0,0 +1,4 @@ +Dependencies of :mod:`readline` and :mod:`curses` module are now detected in +``configure`` script with ``pkg-config``. Only ``ncurses`` / ``ncursesw`` +are detected automatically. The old ``curses`` library is not configured +automatically. diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in index ad34f85e254514..7357aacd7267ae 100644 --- a/Modules/Setup.stdlib.in +++ b/Modules/Setup.stdlib.in @@ -72,8 +72,8 @@ # gdbm module needs -lgdbm @MODULE__GDBM_TRUE@_gdbm _gdbmmodule.c -# needs -lreadline or -leditline, sometimes termcap, termlib, or tinfo -#@MODULE_READLINE_TRUE@readline readline.c +# needs -lreadline or -ledit, sometimes termcap, termlib, or tinfo +@MODULE_READLINE_TRUE@readline readline.c # hashing builtins, can be disabled with --without-builtin-hashlib-hashes @MODULE__MD5_TRUE@_md5 md5module.c @@ -138,10 +138,10 @@ # needs -lffi and -ldl @MODULE__CTYPES_TRUE@_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c @MODULE__CTYPES_MALLOC_CLOSURE@ -# needs -lncurses, -lncursesw or -lcurses, sometimes -ltermcap -#@MODULE__CURSES_TRUE@_curses _cursesmodule.c -# needs -lncurses and -lpanel -#@MODULE__CURSES_PANEL_TRUE@_curses_panel _curses_panel.c +# needs -lncurses[w], sometimes -ltermcap/tinfo +@MODULE__CURSES_TRUE@_curses _cursesmodule.c +# needs -lncurses[w] and -lpanel[w] +@MODULE__CURSES_PANEL_TRUE@_curses_panel _curses_panel.c @MODULE__SQLITE3_TRUE@_sqlite3 _sqlite/blob.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c diff --git a/configure b/configure index 8d0ba9740b8eaf..43c746e89e3128 100755 --- a/configure +++ b/configure @@ -660,6 +660,8 @@ MODULE__TKINTER_FALSE MODULE__TKINTER_TRUE MODULE__SQLITE3_FALSE MODULE__SQLITE3_TRUE +MODULE_READLINE_FALSE +MODULE_READLINE_TRUE MODULE_NIS_FALSE MODULE_NIS_TRUE MODULE__GDBM_FALSE @@ -668,6 +670,10 @@ MODULE__DBM_FALSE MODULE__DBM_TRUE MODULE__DECIMAL_FALSE MODULE__DECIMAL_TRUE +MODULE__CURSES_PANEL_FALSE +MODULE__CURSES_PANEL_TRUE +MODULE__CURSES_FALSE +MODULE__CURSES_TRUE MODULE__CTYPES_FALSE MODULE__CTYPES_TRUE MODULE__CRYPT_FALSE @@ -792,6 +798,14 @@ OPENSSL_INCLUDES ENSUREPIP SRCDIRS THREADHEADERS +PANEL_LIBS +PANEL_CFLAGS +CURSES_LIBS +CURSES_CFLAGS +LIBEDIT_LIBS +LIBEDIT_CFLAGS +LIBREADLINE_LIBS +LIBREADLINE_CFLAGS WHEEL_PKG_DIR LIBPL PY_ENABLE_SHARED @@ -1108,6 +1122,14 @@ LIBLZMA_CFLAGS LIBLZMA_LIBS LIBCRYPT_CFLAGS LIBCRYPT_LIBS +LIBREADLINE_CFLAGS +LIBREADLINE_LIBS +LIBEDIT_CFLAGS +LIBEDIT_LIBS +CURSES_CFLAGS +CURSES_LIBS +PANEL_CFLAGS +PANEL_LIBS LIBB2_CFLAGS LIBB2_LIBS' @@ -1848,8 +1870,8 @@ Optional Packages: --with-wheel-pkg-dir=PATH Directory of wheel packages used by ensurepip (default: none) - --with(out)-readline[=editline] - use Editline for backend or disable readline module + --with(out)-readline[=editline|readline|no] + use libedit for backend or disable readline module --with-computed-gotos enable computed gotos in evaluation loop (enabled by default on supported compilers) --with-ensurepip[=install|upgrade|no] @@ -1923,6 +1945,20 @@ Some influential environment variables: C compiler flags for LIBCRYPT, overriding pkg-config LIBCRYPT_LIBS linker flags for LIBCRYPT, overriding pkg-config + LIBREADLINE_CFLAGS + C compiler flags for LIBREADLINE, overriding pkg-config + LIBREADLINE_LIBS + linker flags for LIBREADLINE, overriding pkg-config + LIBEDIT_CFLAGS + 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 + PANEL_CFLAGS + C compiler flags for PANEL, overriding pkg-config + PANEL_LIBS linker flags for PANEL, overriding pkg-config LIBB2_CFLAGS C compiler flags for LIBB2, overriding pkg-config LIBB2_LIBS linker flags for LIBB2, overriding pkg-config @@ -3985,8 +4021,6 @@ if test $define_xopen_source = yes then # X/Open 7, incorporating POSIX.1-2008 -$as_echo "#define _XOPEN_SOURCE 700" >>confdefs.h - # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else @@ -20497,48 +20531,88 @@ $as_echo "#define HAVE_GETC_UNLOCKED 1" >>confdefs.h fi -# Check whether --with-readline was given. -if test "${with_readline+set}" = set; then : - withval=$with_readline; + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBREADLINE" >&5 +$as_echo_n "checking for LIBREADLINE... " >&6; } + +if test -n "$LIBREADLINE_CFLAGS"; then + pkg_cv_LIBREADLINE_CFLAGS="$LIBREADLINE_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"readline >= 4.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "readline >= 4.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBREADLINE_CFLAGS=`$PKG_CONFIG --cflags "readline >= 4.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBREADLINE_LIBS"; then + pkg_cv_LIBREADLINE_LIBS="$LIBREADLINE_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"readline >= 4.2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "readline >= 4.2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBREADLINE_LIBS=`$PKG_CONFIG --libs "readline >= 4.2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - with_readline=yes + pkg_failed=yes +fi + else + pkg_failed=untried fi -# check where readline lives -py_cv_lib_readline=no -# save the value of LIBS so we don't actually link Python with readline -LIBS_no_readline=$LIBS -if test "$with_readline" != no; then - case "$with_readline" in - editline|edit) - LIBREADLINE=edit +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBREADLINE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "readline >= 4.2" 2>&1` + else + LIBREADLINE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "readline >= 4.2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBREADLINE_PKG_ERRORS" >&5 -$as_echo "#define WITH_EDITLINE 1" >>confdefs.h - ;; - yes|readline) - LIBREADLINE=readline - ;; - *) - as_fn_error $? "proper usage is --with(out)-readline[=editline]" "$LINENO" 5 - ;; - esac + for ac_header in readline/readline.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" +if test "x$ac_cv_header_readline_readline_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_READLINE_READLINE_H 1 +_ACEOF - # On some systems we need to link readline to a termcap compatible - # library. NOTE: Keep the precedence of listed libraries synchronised - # with setup.py. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline libs" >&5 -$as_echo_n "checking how to link readline libs... " >&6; } - for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do - if test -z "$py_libtermcap"; then - READLINE_LIBS="-l$LIBREADLINE" - else - READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap" - fi - LIBS="$READLINE_LIBS $LIBS_no_readline" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_catch_signals in -lreadline" >&5 +$as_echo_n "checking for rl_catch_signals in -lreadline... " >&6; } +if ${ac_cv_lib_readline_rl_catch_signals+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lreadline $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -20547,81 +20621,78 @@ $as_echo_n "checking how to link readline libs... " >&6; } #ifdef __cplusplus extern "C" #endif -char readline (); +char rl_catch_signals (); int main () { -return readline (); +return rl_catch_signals (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - py_cv_lib_readline=yes + ac_cv_lib_readline_rl_catch_signals=yes +else + ac_cv_lib_readline_rl_catch_signals=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test $py_cv_lib_readline = yes; then - break - fi - done +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_catch_signals" >&5 +$as_echo "$ac_cv_lib_readline_rl_catch_signals" >&6; } +if test "x$ac_cv_lib_readline_rl_catch_signals" = xyes; then : - # Uncomment this line if you want to use READLINE_LIBS in Makefile or scripts - #AC_SUBST([READLINE_LIBS]) - if test $py_cv_lib_readline = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_LIBS" >&5 -$as_echo "$READLINE_LIBS" >&6; } + have_libreadline=yes + LIBREADLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + LIBREADLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} -$as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h +else + + have_libreadline=no - fi fi -if test "$py_cv_lib_readline" = yes; then - # check for readline 2.2 - ac_fn_c_check_decl "$LINENO" "rl_completion_append_character" "ac_cv_have_decl_rl_completion_append_character" " -#include /* Must be first for Gnu Readline */ -#ifdef WITH_EDITLINE -# include -#else -# include -#endif -" -if test "x$ac_cv_have_decl_rl_completion_append_character" = xyes; then : +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + -$as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h +else + have_libreadline=no fi - ac_fn_c_check_decl "$LINENO" "rl_completion_suppress_append" "ac_cv_have_decl_rl_completion_suppress_append" " -#include /* Must be first for Gnu Readline */ -#ifdef WITH_EDITLINE -# include -#else -# include -#endif +done -" -if test "x$ac_cv_have_decl_rl_completion_suppress_append" = xyes; then : -$as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1" >>confdefs.h +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } -fi + for ac_header in readline/readline.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" +if test "x$ac_cv_header_readline_readline_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_READLINE_READLINE_H 1 +_ACEOF + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS - # check for readline 4.0 - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_pre_input_hook" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -l$LIBREADLINE" >&5 -$as_echo_n "checking for rl_pre_input_hook in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_catch_signals in -lreadline" >&5 +$as_echo_n "checking for rl_catch_signals in -lreadline... " >&6; } +if ${ac_cv_lib_readline_rl_catch_signals+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" +LIBS="-lreadline $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20631,135 +20702,144 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_pre_input_hook (); +char rl_catch_signals (); int main () { -return rl_pre_input_hook (); +return rl_catch_signals (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_lib_readline_rl_catch_signals=yes else - eval "$as_ac_Lib=no" + ac_cv_lib_readline_rl_catch_signals=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_catch_signals" >&5 +$as_echo "$ac_cv_lib_readline_rl_catch_signals" >&6; } +if test "x$ac_cv_lib_readline_rl_catch_signals" = xyes; then : -$as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h + have_libreadline=yes + LIBREADLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + LIBREADLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} + +else + + have_libreadline=no fi - # also in 4.0 - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_display_matches_hook" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -l$LIBREADLINE" >&5 -$as_echo_n "checking for rl_completion_display_matches_hook in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + -/* 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. */ -#ifdef __cplusplus -extern "C" -#endif -char rl_completion_display_matches_hook (); -int -main () -{ -return rl_completion_display_matches_hook (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + have_libreadline=no fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : -$as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h +done + + +else + LIBREADLINE_CFLAGS=$pkg_cv_LIBREADLINE_CFLAGS + LIBREADLINE_LIBS=$pkg_cv_LIBREADLINE_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + have_libreadline=yes fi - # also in 4.0, but not in editline - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_resize_terminal" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -l$LIBREADLINE" >&5 -$as_echo_n "checking for rl_resize_terminal in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBEDIT" >&5 +$as_echo_n "checking for LIBEDIT... " >&6; } -/* 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. */ -#ifdef __cplusplus -extern "C" -#endif -char rl_resize_terminal (); -int -main () -{ -return rl_resize_terminal (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" +if test -n "$LIBEDIT_CFLAGS"; then + pkg_cv_LIBEDIT_CFLAGS="$LIBEDIT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libedit") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBEDIT_CFLAGS=`$PKG_CONFIG --cflags "libedit" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - eval "$as_ac_Lib=no" + pkg_failed=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + else + pkg_failed=untried +fi +if test -n "$LIBEDIT_LIBS"; then + pkg_cv_LIBEDIT_LIBS="$LIBEDIT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libedit") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBEDIT_LIBS=`$PKG_CONFIG --libs "libedit" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : -$as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libedit" 2>&1` + else + LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libedit" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBEDIT_PKG_ERRORS" >&5 + + + for ac_header in editline/readline.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default" +if test "x$ac_cv_header_editline_readline_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EDITLINE_READLINE_H 1 +_ACEOF + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS - # check for readline 4.2 - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_matches" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -l$LIBREADLINE" >&5 -$as_echo_n "checking for rl_completion_matches in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_catch_signals in -ledit" >&5 +$as_echo_n "checking for rl_catch_signals in -ledit... " >&6; } +if ${ac_cv_lib_edit_rl_catch_signals+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" +LIBS="-ledit $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20769,59 +20849,78 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_completion_matches (); +char rl_catch_signals (); int main () { -return rl_completion_matches (); +return rl_catch_signals (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_lib_edit_rl_catch_signals=yes else - eval "$as_ac_Lib=no" + ac_cv_lib_edit_rl_catch_signals=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_rl_catch_signals" >&5 +$as_echo "$ac_cv_lib_edit_rl_catch_signals" >&6; } +if test "x$ac_cv_lib_edit_rl_catch_signals" = xyes; then : -$as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h + have_libedit=yes + LIBEDIT_CFLAGS=${LIBEDIT_CFLAGS-""} + LIBEDIT_LIBS=${LIBEDIT_LIBS-"-ledit"} + +else + + have_libedit=no fi - # also in readline 4.2 - ac_fn_c_check_decl "$LINENO" "rl_catch_signals" "ac_cv_have_decl_rl_catch_signals" " -#include /* Must be first for Gnu Readline */ -#ifdef WITH_EDITLINE -# include -#else -# include -#endif +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS -" -if test "x$ac_cv_have_decl_rl_catch_signals" = xyes; then : -$as_echo "#define HAVE_RL_CATCH_SIGNAL 1" >>confdefs.h +else + have_libedit=no fi +done + - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_append_history" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -l$LIBREADLINE" >&5 -$as_echo_n "checking for append_history in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + for ac_header in editline/readline.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default" +if test "x$ac_cv_header_editline_readline_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EDITLINE_READLINE_H 1 +_ACEOF + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_catch_signals in -ledit" >&5 +$as_echo_n "checking for rl_catch_signals in -ledit... " >&6; } +if ${ac_cv_lib_edit_rl_catch_signals+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" +LIBS="-ledit $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20831,37 +20930,205 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char append_history (); +char rl_catch_signals (); int main () { -return append_history (); +return rl_catch_signals (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_lib_edit_rl_catch_signals=yes else - eval "$as_ac_Lib=no" + ac_cv_lib_edit_rl_catch_signals=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_rl_catch_signals" >&5 +$as_echo "$ac_cv_lib_edit_rl_catch_signals" >&6; } +if test "x$ac_cv_lib_edit_rl_catch_signals" = xyes; then : -$as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h + have_libedit=yes + LIBEDIT_CFLAGS=${LIBEDIT_CFLAGS-""} + LIBEDIT_LIBS=${LIBEDIT_LIBS-"-ledit"} + +else + + have_libedit=no + +fi + + +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + + +else + have_libedit=no +fi + +done + + +else + LIBEDIT_CFLAGS=$pkg_cv_LIBEDIT_CFLAGS + LIBEDIT_LIBS=$pkg_cv_LIBEDIT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + have_libedit=yes + +fi + + +# Check whether --with-readline was given. +if test "${with_readline+set}" = set; then : + withval=$with_readline; +else + with_readline=readline + +fi + + +py_cv_lib_readline=no + +case $with_readline in #( + editline|edit) : + + with_readline=edit + READLINE_CFLAGS=$LIBEDIT_CFLAGS + READLINE_LIBS=$LIBEDIT_LIBS + +$as_echo "#define WITH_EDITLINE 1" >>confdefs.h + + ;; #( + yes|readline) : + + with_readline=readline + READLINE_CFLAGS=$LIBREADLINE_CFLAGS + READLINE_LIBS=$LIBREADLINE_LIBS + ;; #( + no) : + ;; #( + *) : + as_fn_error $? "proper usage is --with(out)-readline[=editline|readline|no]" "$LINENO" 5 + ;; +esac + +if test "$with_readline" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline libs" >&5 +$as_echo_n "checking how to link readline libs... " >&6; } + # for py_libtermcap in "" tinfo ncursesw ncurses termcap; do + # if test -z "$py_libtermcap"; then + # READLINE_TERMCAP_LIBS="" + # else + # READLINE_TERMCAP_LIBS="-l$py_libtermcap" + # fi + + READLINE_TERMCAP_LIBS="" + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + CPPFLAGS="$READLINE_CFLAGS $CFLAGS" + LIBS="$READLINE_LIBS $READLINE_TERMCAP_LIBS $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #endif + +int +main () +{ + + rl_catch_signals = 0; + void *x1 = rl_resize_terminal; + void *x2 = append_history; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + py_cv_lib_readline=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + + + # AS_VAR_IF([py_cv_lib_readline], [yes], [ + # if test -n "$ADD_READLINE_LIBS"; then + # AS_VAR_APPEND([READLINE_LIBS], [" $READLINE_TERMCAP_LIBS"]) + # fi + # break + # ]) + # done + + if test "x$py_cv_lib_readline" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_LIBS" >&5 +$as_echo "$READLINE_LIBS" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } fi fi -# End of readline checks: restore LIBS -LIBS=$LIBS_no_readline +if test "x$py_cv_lib_readline" = xyes; then : + + +$as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h + + +$as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1" >>confdefs.h + + +$as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h + + +$as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h + + +$as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h + + +$as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h + + +$as_echo "#define HAVE_RL_CATCH_SIGNAL 1" >>confdefs.h + + +$as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h + + +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken nice()" >&5 $as_echo_n "checking for broken nice()... " >&6; } @@ -21012,136 +21279,954 @@ int main() exit(1); #endif - putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0"); - tzset(); - if (localtime(&groundhogday)->tm_hour != 11) - exit(1); -#if HAVE_TZNAME - if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT")) - exit(1); -#endif + putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0"); + tzset(); + if (localtime(&groundhogday)->tm_hour != 11) + exit(1); +#if HAVE_TZNAME + if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT")) + exit(1); +#endif + +#if HAVE_STRUCT_TM_TM_ZONE + if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT")) + exit(1); + if (strcmp(localtime(&midyear)->tm_zone, "AEST")) + exit(1); +#endif + + exit(0); +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_working_tzset=yes +else + ac_cv_working_tzset=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_tzset" >&5 +$as_echo "$ac_cv_working_tzset" >&6; } +if test "$ac_cv_working_tzset" = yes +then + +$as_echo "#define HAVE_WORKING_TZSET 1" >>confdefs.h + +fi + +# Look for subsecond timestamps in struct stat +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec in struct stat" >&5 +$as_echo_n "checking for tv_nsec in struct stat... " >&6; } +if ${ac_cv_stat_tv_nsec+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + +struct stat st; +st.st_mtim.tv_nsec = 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_stat_tv_nsec=yes +else + ac_cv_stat_tv_nsec=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_stat_tv_nsec" >&5 +$as_echo "$ac_cv_stat_tv_nsec" >&6; } +if test "$ac_cv_stat_tv_nsec" = yes +then + +$as_echo "#define HAVE_STAT_TV_NSEC 1" >>confdefs.h + +fi + +# Look for BSD style subsecond timestamps in struct stat +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec2 in struct stat" >&5 +$as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } +if ${ac_cv_stat_tv_nsec2+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + +struct stat st; +st.st_mtimespec.tv_nsec = 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_stat_tv_nsec2=yes +else + ac_cv_stat_tv_nsec2=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_stat_tv_nsec2" >&5 +$as_echo "$ac_cv_stat_tv_nsec2" >&6; } +if test "$ac_cv_stat_tv_nsec2" = yes +then + +$as_echo "#define HAVE_STAT_TV_NSEC2 1" >>confdefs.h + +fi + +have_curses=no +have_panel=no + + +for ac_header in curses.h ncurses.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "x$ac_cv_header_ncurses_h" = xyes; then : + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CURSES" >&5 +$as_echo_n "checking for CURSES... " >&6; } + +if test -n "$CURSES_CFLAGS"; then + pkg_cv_CURSES_CFLAGS="$CURSES_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncursesw\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncursesw") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CURSES_CFLAGS=`$PKG_CONFIG --cflags "ncursesw" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CURSES_LIBS"; then + pkg_cv_CURSES_LIBS="$CURSES_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncursesw\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncursesw") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CURSES_LIBS=`$PKG_CONFIG --libs "ncursesw" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +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` + else + 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 "$CURSES_PKG_ERRORS" >&5 + + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 +$as_echo_n "checking for initscr in -lncursesw... " >&6; } +if ${ac_cv_lib_ncursesw_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncursesw_initscr=yes +else + ac_cv_lib_ncursesw_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5 +$as_echo "$ac_cv_lib_ncursesw_initscr" >&6; } +if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then : + + $as_echo "#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 + + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 +$as_echo_n "checking for initscr in -lncursesw... " >&6; } +if ${ac_cv_lib_ncursesw_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncursesw_initscr=yes +else + ac_cv_lib_ncursesw_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5 +$as_echo "$ac_cv_lib_ncursesw_initscr" >&6; } +if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then : + + $as_echo "#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 + + + +else + CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS + CURSES_LIBS=$pkg_cv_CURSES_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + have_curses=ncursesw + +fi + + if test "x$have_curses" = xno; then : + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CURSES" >&5 +$as_echo_n "checking for CURSES... " >&6; } + +if test -n "$CURSES_CFLAGS"; then + pkg_cv_CURSES_CFLAGS="$CURSES_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CURSES_CFLAGS=`$PKG_CONFIG --cflags "ncurses" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CURSES_LIBS"; then + pkg_cv_CURSES_LIBS="$CURSES_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 + ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CURSES_LIBS=`$PKG_CONFIG --libs "ncurses" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +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` + else + 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 "$CURSES_PKG_ERRORS" >&5 + + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 +$as_echo_n "checking for initscr in -lncurses... " >&6; } +if ${ac_cv_lib_ncurses_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncurses_initscr=yes +else + ac_cv_lib_ncurses_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 +$as_echo "$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 + + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 +$as_echo_n "checking for initscr in -lncurses... " >&6; } +if ${ac_cv_lib_ncurses_initscr+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncurses_initscr=yes +else + ac_cv_lib_ncurses_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 +$as_echo "$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 + + + +else + CURSES_CFLAGS=$pkg_cv_CURSES_CFLAGS + CURSES_LIBS=$pkg_cv_CURSES_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + have_curses=ncurses + +fi + +fi + + +fi +if test "$have_curses" = no -a "$ac_sys_system" = "Darwin"; then + + as_fn_append CURSES_CFLAGS " -D_XOPEN_SOURCE_EXTENDED=1" + $as_echo "#define HAVE_NCURSESW 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking curses module flags" >&5 +$as_echo_n "checking curses module flags... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURSES_CFLAGS $CURSES_LIBS" >&5 +$as_echo "$CURSES_CFLAGS $CURSES_LIBS" >&6; } + +for ac_header in panel.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "panel.h" "ac_cv_header_panel_h" "$ac_includes_default" +if test "x$ac_cv_header_panel_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PANEL_H 1 +_ACEOF + +fi + +done + + +if test "x$ac_cv_header_panel_h" = xyes; then : + + + if test "x$have_curses" = xncursesw; then : + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PANEL" >&5 +$as_echo_n "checking for PANEL... " >&6; } + +if test -n "$PANEL_CFLAGS"; then + pkg_cv_PANEL_CFLAGS="$PANEL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panelw\""; } >&5 + ($PKG_CONFIG --exists --print-errors "panelw") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PANEL_CFLAGS=`$PKG_CONFIG --cflags "panelw" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PANEL_LIBS"; then + pkg_cv_PANEL_LIBS="$PANEL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panelw\""; } >&5 + ($PKG_CONFIG --exists --print-errors "panelw") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PANEL_LIBS=`$PKG_CONFIG --libs "panelw" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +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` + else + 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 "$PANEL_PKG_ERRORS" >&5 + + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanelw" >&5 +$as_echo_n "checking for update_panels in -lpanelw... " >&6; } +if ${ac_cv_lib_panelw_update_panels+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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. */ +#ifdef __cplusplus +extern "C" +#endif +char update_panels (); +int +main () +{ +return update_panels (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_panelw_update_panels=yes +else + ac_cv_lib_panelw_update_panels=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panelw_update_panels" >&5 +$as_echo "$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"} + +fi + + +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanelw" >&5 +$as_echo_n "checking for update_panels in -lpanelw... " >&6; } +if ${ac_cv_lib_panelw_update_panels+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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. */ +#ifdef __cplusplus +extern "C" +#endif +char update_panels (); +int +main () +{ +return update_panels (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_panelw_update_panels=yes +else + ac_cv_lib_panelw_update_panels=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panelw_update_panels" >&5 +$as_echo "$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"} + +fi + + +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS -#if HAVE_STRUCT_TM_TM_ZONE - if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT")) - exit(1); - if (strcmp(localtime(&midyear)->tm_zone, "AEST")) - exit(1); -#endif - exit(0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_working_tzset=yes else - ac_cv_working_tzset=no + PANEL_CFLAGS=$pkg_cv_PANEL_CFLAGS + PANEL_LIBS=$pkg_cv_PANEL_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + have_panel=panelw + fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test "x$have_curses" = xncurses; then : + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PANEL" >&5 +$as_echo_n "checking for PANEL... " >&6; } + +if test -n "$PANEL_CFLAGS"; then + pkg_cv_PANEL_CFLAGS="$PANEL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panel\""; } >&5 + ($PKG_CONFIG --exists --print-errors "panel") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PANEL_CFLAGS=`$PKG_CONFIG --cflags "panel" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PANEL_LIBS"; then + pkg_cv_PANEL_LIBS="$PANEL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"panel\""; } >&5 + ($PKG_CONFIG --exists --print-errors "panel") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PANEL_LIBS=`$PKG_CONFIG --libs "panel" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_tzset" >&5 -$as_echo "$ac_cv_working_tzset" >&6; } -if test "$ac_cv_working_tzset" = yes -then -$as_echo "#define HAVE_WORKING_TZSET 1" >>confdefs.h + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +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 "panel" 2>&1` + else + PANEL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "panel" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PANEL_PKG_ERRORS" >&5 -# Look for subsecond timestamps in struct stat -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec in struct stat" >&5 -$as_echo_n "checking for tv_nsec in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec+:} false; then : + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanel" >&5 +$as_echo_n "checking for update_panels in -lpanel... " >&6; } +if ${ac_cv_lib_panel_update_panels+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpanel $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +/* 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. */ +#ifdef __cplusplus +extern "C" +#endif +char update_panels (); int main () { - -struct stat st; -st.st_mtim.tv_nsec = 1; - +return update_panels (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_stat_tv_nsec=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_panel_update_panels=yes else - ac_cv_stat_tv_nsec=no + ac_cv_lib_panel_update_panels=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_stat_tv_nsec" >&5 -$as_echo "$ac_cv_stat_tv_nsec" >&6; } -if test "$ac_cv_stat_tv_nsec" = yes -then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panel_update_panels" >&5 +$as_echo "$ac_cv_lib_panel_update_panels" >&6; } +if test "x$ac_cv_lib_panel_update_panels" = xyes; then : -$as_echo "#define HAVE_STAT_TV_NSEC 1" >>confdefs.h + have_panel=panel + PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanel"} fi -# Look for BSD style subsecond timestamps in struct stat -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec2 in struct stat" >&5 -$as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } -if ${ac_cv_stat_tv_nsec2+:} false; then : + +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanel" >&5 +$as_echo_n "checking for update_panels in -lpanel... " >&6; } +if ${ac_cv_lib_panel_update_panels+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpanel $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +/* 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. */ +#ifdef __cplusplus +extern "C" +#endif +char update_panels (); int main () { - -struct stat st; -st.st_mtimespec.tv_nsec = 1; - +return update_panels (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_stat_tv_nsec2=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_panel_update_panels=yes else - ac_cv_stat_tv_nsec2=no + ac_cv_lib_panel_update_panels=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_stat_tv_nsec2" >&5 -$as_echo "$ac_cv_stat_tv_nsec2" >&6; } -if test "$ac_cv_stat_tv_nsec2" = yes -then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_panel_update_panels" >&5 +$as_echo "$ac_cv_lib_panel_update_panels" >&6; } +if test "x$ac_cv_lib_panel_update_panels" = xyes; then : -$as_echo "#define HAVE_STAT_TV_NSEC2 1" >>confdefs.h + have_panel=panel + PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanel"} fi -# first curses header check -ac_save_cppflags="$CPPFLAGS" -if test "$cross_compiling" = no; then - CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" -fi -for ac_header in curses.h ncurses.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + have_panel=panel fi -done +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking panel flags" >&5 +$as_echo_n "checking panel flags... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PANEL_CFLAGS $PANEL_LIBS" >&5 +$as_echo "$PANEL_CFLAGS $PANEL_LIBS" >&6; } +# 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 for ac_header in term.h @@ -24637,6 +25722,76 @@ fi $as_echo "$py_cv_module__ctypes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _curses" >&5 +$as_echo_n "checking for stdlib extension module _curses... " >&6; } + if test "$py_cv_module__curses" != "n/a"; then : + + if true; then : + if test "$have_curses" != "no"; then : + py_cv_module__curses=yes +else + py_cv_module__curses=missing +fi +else + py_cv_module__curses=disabled +fi + +fi + as_fn_append MODULE_BLOCK "MODULE__CURSES_STATE=$py_cv_module__curses$as_nl" + if test "x$py_cv_module__curses" = xyes; then : + + as_fn_append MODULE_BLOCK "MODULE__CURSES_CFLAGS=$CURSES_CFLAGS$as_nl" + as_fn_append MODULE_BLOCK "MODULE__CURSES_LDFLAGS=$CURSES_LIBS $READLINE_TERMCAP_LIBS +$as_nl" + +fi + if test "$py_cv_module__curses" = yes; then + MODULE__CURSES_TRUE= + MODULE__CURSES_FALSE='#' +else + MODULE__CURSES_TRUE='#' + MODULE__CURSES_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__curses" >&5 +$as_echo "$py_cv_module__curses" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _curses_panel" >&5 +$as_echo_n "checking for stdlib extension module _curses_panel... " >&6; } + if test "$py_cv_module__curses_panel" != "n/a"; then : + + if true; then : + if test "$have_panel" != "no"; then : + py_cv_module__curses_panel=yes +else + py_cv_module__curses_panel=missing +fi +else + py_cv_module__curses_panel=disabled +fi + +fi + as_fn_append MODULE_BLOCK "MODULE__CURSES_PANEL_STATE=$py_cv_module__curses_panel$as_nl" + if test "x$py_cv_module__curses_panel" = xyes; then : + + as_fn_append MODULE_BLOCK "MODULE__CURSES_PANEL_CFLAGS=$PANEL_CFLAGS $CURSES_CFLAGS$as_nl" + as_fn_append MODULE_BLOCK "MODULE__CURSES_PANEL_LDFLAGS=$PANEL_LIBS $CURSES_LIBS $READLINE_TERMCAP_LIBS +$as_nl" + +fi + if test "$py_cv_module__curses_panel" = yes; then + MODULE__CURSES_PANEL_TRUE= + MODULE__CURSES_PANEL_FALSE='#' +else + MODULE__CURSES_PANEL_TRUE='#' + MODULE__CURSES_PANEL_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__curses_panel" >&5 +$as_echo "$py_cv_module__curses_panel" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _decimal" >&5 $as_echo_n "checking for stdlib extension module _decimal... " >&6; } if test "$py_cv_module__decimal" != "n/a"; then : @@ -24773,6 +25928,40 @@ fi $as_echo "$py_cv_module_nis" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module readline" >&5 +$as_echo_n "checking for stdlib extension module readline... " >&6; } + if test "$py_cv_module_readline" != "n/a"; then : + + if true; then : + if test "$py_cv_lib_readline" = "yes"; then : + py_cv_module_readline=yes +else + py_cv_module_readline=missing +fi +else + py_cv_module_readline=disabled +fi + +fi + as_fn_append MODULE_BLOCK "MODULE_READLINE_STATE=$py_cv_module_readline$as_nl" + if test "x$py_cv_module_readline" = xyes; then : + + as_fn_append MODULE_BLOCK "MODULE_READLINE_CFLAGS=$READLINE_CFLAGS$as_nl" + as_fn_append MODULE_BLOCK "MODULE_READLINE_LDFLAGS=$READLINE_LIBS$as_nl" + +fi + if test "$py_cv_module_readline" = yes; then + MODULE_READLINE_TRUE= + MODULE_READLINE_FALSE='#' +else + MODULE_READLINE_TRUE='#' + MODULE_READLINE_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_readline" >&5 +$as_echo "$py_cv_module_readline" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sqlite3" >&5 $as_echo_n "checking for stdlib extension module _sqlite3... " >&6; } if test "$py_cv_module__sqlite3" != "n/a"; then : @@ -25719,6 +26908,14 @@ if test -z "${MODULE__CTYPES_TRUE}" && test -z "${MODULE__CTYPES_FALSE}"; then as_fn_error $? "conditional \"MODULE__CTYPES\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MODULE__CURSES_TRUE}" && test -z "${MODULE__CURSES_FALSE}"; then + as_fn_error $? "conditional \"MODULE__CURSES\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__CURSES_PANEL_TRUE}" && test -z "${MODULE__CURSES_PANEL_FALSE}"; then + as_fn_error $? "conditional \"MODULE__CURSES_PANEL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -25735,6 +26932,10 @@ if test -z "${MODULE_NIS_TRUE}" && test -z "${MODULE_NIS_FALSE}"; then as_fn_error $? "conditional \"MODULE_NIS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MODULE_READLINE_TRUE}" && test -z "${MODULE_READLINE_FALSE}"; then + as_fn_error $? "conditional \"MODULE_READLINE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MODULE__SQLITE3_TRUE}" && test -z "${MODULE__SQLITE3_FALSE}"; then as_fn_error $? "conditional \"MODULE__SQLITE3\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index b03ead3bdefa04..ab13e9c92e682d 100644 --- a/configure.ac +++ b/configure.ac @@ -675,8 +675,14 @@ esac if test $define_xopen_source = yes then # X/Open 7, incorporating POSIX.1-2008 - AC_DEFINE(_XOPEN_SOURCE, 700, - Define to the level of X/Open that your system supports) + dnl NOTE: #undef does not work here, it gets commented out by templating. + AH_VERBATIM([_XOPEN_SOURCE], [ + /* Define to the level of X/Open that your system supports */ + /* some pkg-config files add CFLAGS -D_XOPEN_SOURCE=600 */ + #if !defined(_XOPEN_SOURCE) + # define _XOPEN_SOURCE 700 + #endif + ]) # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else @@ -5780,127 +5786,130 @@ then [Define this if you have flockfile(), getc_unlocked(), and funlockfile()]) fi -AC_ARG_WITH([readline], - [AS_HELP_STRING([--with(out)-readline@<:@=editline@:>@], - [use Editline for backend or disable readline module])], - [], - [with_readline=yes]) +dnl Check for libreadline and libedit +dnl - libreadline provides "readline/readline.h" header and "libreadline" +dnl shared library. +dnl - libedit provides "editline/readline.h" header and "libedit" shared +dnl library. +dnl - editline is not supported ("readline.h" and "libeditline" shared library) -# check where readline lives -py_cv_lib_readline=no -# save the value of LIBS so we don't actually link Python with readline -LIBS_no_readline=$LIBS - -if test "$with_readline" != no; then - case "$with_readline" in - editline|edit) - LIBREADLINE=edit - AC_DEFINE(WITH_EDITLINE, 1, - [Define to build the readline module against Editline.]) - ;; - yes|readline) - LIBREADLINE=readline - ;; - *) - AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline@:>@]) - ;; - esac +PKG_CHECK_MODULES([LIBREADLINE], [readline >= 4.2], [ + have_libreadline=yes +], [ + AC_CHECK_HEADERS([readline/readline.h], [ + WITH_SAVE_ENV([ + dnl rl_catch_signals is available since readline 4.2 + AC_CHECK_LIB([readline], [rl_catch_signals], [ + have_libreadline=yes + LIBREADLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + LIBREADLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} + ], [ + have_libreadline=no + ]) + ]) + ], [have_libreadline=no]) +]) - # On some systems we need to link readline to a termcap compatible - # library. NOTE: Keep the precedence of listed libraries synchronised - # with setup.py. - AC_MSG_CHECKING([how to link readline libs]) - for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do - if test -z "$py_libtermcap"; then - READLINE_LIBS="-l$LIBREADLINE" - else - READLINE_LIBS="-l$LIBREADLINE -l$py_libtermcap" - fi - LIBS="$READLINE_LIBS $LIBS_no_readline" - AC_LINK_IFELSE( - [AC_LANG_CALL([],[readline])], - [py_cv_lib_readline=yes]) - if test $py_cv_lib_readline = yes; then - break - fi - done +PKG_CHECK_MODULES([LIBEDIT], [libedit], [ + have_libedit=yes +], [ + AC_CHECK_HEADERS([editline/readline.h], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([edit], [rl_catch_signals], [ + have_libedit=yes + LIBEDIT_CFLAGS=${LIBEDIT_CFLAGS-""} + LIBEDIT_LIBS=${LIBEDIT_LIBS-"-ledit"} + ], [ + have_libedit=no + ]) + ]) + ], [have_libedit=no]) +]) - # Uncomment this line if you want to use READLINE_LIBS in Makefile or scripts - #AC_SUBST([READLINE_LIBS]) - if test $py_cv_lib_readline = no; then - AC_MSG_RESULT([none]) - else - AC_MSG_RESULT([$READLINE_LIBS]) - AC_DEFINE(HAVE_LIBREADLINE, 1, - [Define to build the readline module.]) - fi -fi +AC_ARG_WITH( + [readline], + [AS_HELP_STRING([--with(out)-readline@<:@=editline|readline|no@:>@], + [use libedit for backend or disable readline module])], + [], + [with_readline=readline] +) -if test "$py_cv_lib_readline" = yes; then - # check for readline 2.2 - AC_CHECK_DECL(rl_completion_append_character, - AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, - [Define if you have readline 2.2]),, - [ -#include /* Must be first for Gnu Readline */ -#ifdef WITH_EDITLINE -# include -#else -# include -#endif - ]) - AC_CHECK_DECL(rl_completion_suppress_append, - AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1, - [Define if you have rl_completion_suppress_append]),, - [ -#include /* Must be first for Gnu Readline */ -#ifdef WITH_EDITLINE -# include -#else -# include -#endif - ]) +py_cv_lib_readline=no - # check for readline 4.0 - AC_CHECK_LIB($LIBREADLINE, rl_pre_input_hook, - AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, - [Define if you have readline 4.0]),,$READLINE_LIBS) - - # also in 4.0 - AC_CHECK_LIB($LIBREADLINE, rl_completion_display_matches_hook, - AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1, - [Define if you have readline 4.0]),,$READLINE_LIBS) - - # also in 4.0, but not in editline - AC_CHECK_LIB($LIBREADLINE, rl_resize_terminal, - AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1, - [Define if you have readline 4.0]),,$READLINE_LIBS) - - # check for readline 4.2 - AC_CHECK_LIB($LIBREADLINE, rl_completion_matches, - AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, - [Define if you have readline 4.2]),,$READLINE_LIBS) - - # also in readline 4.2 - AC_CHECK_DECL(rl_catch_signals, - AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, - [Define if you can turn off readline's signal handling.]),, - [ -#include /* Must be first for Gnu Readline */ -#ifdef WITH_EDITLINE -# include -#else -# include -#endif +AS_CASE( + [$with_readline], + [editline|edit], [ + with_readline=edit + READLINE_CFLAGS=$LIBEDIT_CFLAGS + READLINE_LIBS=$LIBEDIT_LIBS + AC_DEFINE([WITH_EDITLINE], [1], [Define to build the readline module against libedit.]) + ], + [yes|readline], [ + with_readline=readline + READLINE_CFLAGS=$LIBREADLINE_CFLAGS + READLINE_LIBS=$LIBREADLINE_LIBS + ], + [no], [], + [AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline|readline|no@:>@])] +) + +if test "$with_readline" != "no"; then + AC_MSG_CHECKING([how to link readline libs]) + # for py_libtermcap in "" tinfo ncursesw ncurses termcap; do + # if test -z "$py_libtermcap"; then + # READLINE_TERMCAP_LIBS="" + # else + # READLINE_TERMCAP_LIBS="-l$py_libtermcap" + # fi + + READLINE_TERMCAP_LIBS="" + WITH_SAVE_ENV([ + CPPFLAGS="$READLINE_CFLAGS $CFLAGS" + LIBS="$READLINE_LIBS $READLINE_TERMCAP_LIBS $LIBS" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #endif + ],[ + rl_catch_signals = 0; + void *x1 = rl_resize_terminal; + void *x2 = append_history; + ]) + ], [py_cv_lib_readline=yes]) ]) - AC_CHECK_LIB($LIBREADLINE, append_history, - AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1, - [Define if readline supports append_history]),,$READLINE_LIBS) + # AS_VAR_IF([py_cv_lib_readline], [yes], [ + # if test -n "$ADD_READLINE_LIBS"; then + # AS_VAR_APPEND([READLINE_LIBS], [" $READLINE_TERMCAP_LIBS"]) + # fi + # break + # ]) + # done + + AS_VAR_IF([py_cv_lib_readline], [yes], [ + AC_MSG_RESULT([$READLINE_LIBS]) + ], [ + AC_MSG_RESULT([none]) + ]) + fi -# End of readline checks: restore LIBS -LIBS=$LIBS_no_readline +AS_VAR_IF([py_cv_lib_readline], [yes], [ + dnl We have readline >= 4.2 or compatible libedit. + AC_DEFINE([HAVE_RL_COMPLETION_APPEND_CHARACTER], [1], [Define if you have rl_completion_append_character]) + AC_DEFINE([HAVE_RL_COMPLETION_SUPPRESS_APPEND], [1], [Define if you have rl_completion_suppress_append]) + AC_DEFINE([HAVE_RL_PRE_INPUT_HOOK], [1], [Define if you have rl_pre_input_hook]) + AC_DEFINE([HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK], [1], [Define if you haverl_completion_display_matches_hook]) + AC_DEFINE([HAVE_RL_RESIZE_TERMINAL], [1], [Define if you have rl_resize_terminal]) + AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], [1], [Define if you have rl_completion_matches]) + AC_DEFINE([HAVE_RL_CATCH_SIGNAL], [1], [Define if you can turn off readline's signal handling.]) + AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history]) +]) AC_CACHE_CHECK([for broken nice()], [ac_cv_broken_nice], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -6056,14 +6065,106 @@ then [Define if you have struct stat.st_mtimensec]) 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] +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], [ + PKG_CHECK_MODULES([CURSES], [ncursesw], [ + 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"} + ]) + ]) + ]) + + 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 + +if test "$have_curses" = no -a "$ac_sys_system" = "Darwin"; then + dnl On macOS, there is no separate /usr/lib/libncursesw nor libpanelw. + dnl If we are here, we found a locally-supplied version of libncursesw. + dnl There should also be a libpanelw. + dnl _XOPEN_SOURCE defines are usually excluded for macOS, but we need + 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]) +AC_MSG_RESULT([$CURSES_CFLAGS $CURSES_LIBS]) + +dnl check for ncurses' panel/panelw library +AC_CHECK_HEADERS([panel.h]) + +AS_VAR_IF([ac_cv_header_panel_h], [yes], [ + + 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"} + ]) + ]) + ]) + ])dnl panelw + + 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 panelw + +])dnl ac_cv_header_panel_h = yes + +AC_MSG_CHECKING([panel flags]) +AC_MSG_RESULT([$PANEL_CFLAGS $PANEL_LIBS]) + # first curses header check ac_save_cppflags="$CPPFLAGS" if test "$cross_compiling" = no; then CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" fi -AC_CHECK_HEADERS(curses.h ncurses.h) - # On Solaris, term.h requires curses.h AC_CHECK_HEADERS(term.h,,,[ #ifdef HAVE_CURSES_H @@ -6985,8 +7086,14 @@ PY_STDLIB_MOD([_crypt], PY_STDLIB_MOD([_ctypes], [], [test "$have_libffi" = yes], [$LIBFFI_CFLAGS], [$LIBFFI_LIBS]) -dnl PY_STDLIB_MOD([_curses], [], [], [], []) -dnl PY_STDLIB_MOD([_curses_panel], [], [], [], []) +PY_STDLIB_MOD([_curses], + [], [test "$have_curses" != "no"], + [$CURSES_CFLAGS], [$CURSES_LIBS $READLINE_TERMCAP_LIBS] +) +PY_STDLIB_MOD([_curses_panel], + [], [test "$have_panel" != "no"], + [$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS $READLINE_TERMCAP_LIBS] +) PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS]) PY_STDLIB_MOD([_dbm], [test -n "$with_dbmliborder"], [test "$have_dbm" != "no"], @@ -6997,7 +7104,9 @@ PY_STDLIB_MOD([_gdbm], PY_STDLIB_MOD([nis], [], [test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes], [$LIBNSL_CFLAGS], [$LIBNSL_LIBS]) -dnl PY_STDLIB_MOD([readline], [], [], [], []) + PY_STDLIB_MOD([readline], + [], [test "$py_cv_lib_readline" = "yes"], + [$READLINE_CFLAGS], [$READLINE_LIBS]) PY_STDLIB_MOD([_sqlite3], [test "$have_sqlite3" = "yes"], [test "$have_supported_sqlite3" = "yes"], diff --git a/pyconfig.h.in b/pyconfig.h.in index b05ddd41c2bba3..514980eed5f725 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -290,6 +290,9 @@ /* Defined when any dynamic module loading is enabled. */ #undef HAVE_DYNAMIC_LOADING +/* Define to 1 if you have the header file. */ +#undef HAVE_EDITLINE_READLINE_H + /* Define to 1 if you have the header file. */ #undef HAVE_ENDIAN_H @@ -646,9 +649,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H -/* Define to build the readline module. */ -#undef HAVE_LIBREADLINE - /* Define to 1 if you have the `resolv' library (-lresolv). */ #undef HAVE_LIBRESOLV @@ -784,6 +784,9 @@ /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP +/* Define to 1 if you have the `ncursesw' library. */ +#undef HAVE_NCURSESW + /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_H @@ -821,6 +824,9 @@ /* Define to 1 if you have the `openpty' function. */ #undef HAVE_OPENPTY +/* Define to 1 if you have the header file. */ +#undef HAVE_PANEL_H + /* Define to 1 if you have the `pathconf' function. */ #undef HAVE_PATHCONF @@ -905,6 +911,9 @@ /* Define to 1 if you have the `pwritev2' function. */ #undef HAVE_PWRITEV2 +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_READLINE_H + /* Define to 1 if you have the `readlink' function. */ #undef HAVE_READLINK @@ -926,22 +935,22 @@ /* Define if you can turn off readline's signal handling. */ #undef HAVE_RL_CATCH_SIGNAL -/* Define if you have readline 2.2 */ +/* Define if you have rl_completion_append_character */ #undef HAVE_RL_COMPLETION_APPEND_CHARACTER -/* Define if you have readline 4.0 */ +/* Define if you haverl_completion_display_matches_hook */ #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -/* Define if you have readline 4.2 */ +/* Define if you have rl_completion_matches */ #undef HAVE_RL_COMPLETION_MATCHES /* Define if you have rl_completion_suppress_append */ #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND -/* Define if you have readline 4.0 */ +/* Define if you have rl_pre_input_hook */ #undef HAVE_RL_PRE_INPUT_HOOK -/* Define if you have readline 4.0 */ +/* Define if you have rl_resize_terminal */ #undef HAVE_RL_RESIZE_TERMINAL /* Define to 1 if you have the header file. */ @@ -1662,7 +1671,7 @@ Dyld is necessary to support frameworks. */ #undef WITH_DYLD -/* Define to build the readline module against Editline. */ +/* Define to build the readline module against libedit. */ #undef WITH_EDITLINE /* Define if you want to compile in object freelists optimization */ @@ -1748,8 +1757,13 @@ /* Define to 1 if you want to emulate signals on WASI */ #undef _WASI_EMULATED_SIGNAL -/* Define to the level of X/Open that your system supports */ -#undef _XOPEN_SOURCE + + /* Define to the level of X/Open that your system supports */ + /* some pkg-config files add CFLAGS -D_XOPEN_SOURCE=600 */ + #if !defined(_XOPEN_SOURCE) + # define _XOPEN_SOURCE 700 + #endif + /* Define to activate Unix95-and-earlier features */ #undef _XOPEN_SOURCE_EXTENDED diff --git a/setup.py b/setup.py index cc11dedee1b2e2..2edcb08b4fd7f8 100644 --- a/setup.py +++ b/setup.py @@ -1015,149 +1015,9 @@ def detect_test_extensions(self): )) def detect_readline_curses(self): - # readline - readline_termcap_library = "" - curses_library = "" - # Cannot use os.popen here in py3k. - tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib') - if not os.path.exists(self.build_temp): - os.makedirs(self.build_temp) - # Determine if readline is already linked against curses or tinfo. - if sysconfig.get_config_var('HAVE_LIBREADLINE'): - if sysconfig.get_config_var('WITH_EDITLINE'): - readline_lib = 'edit' - else: - readline_lib = 'readline' - do_readline = self.compiler.find_library_file(self.lib_dirs, - readline_lib) - if CROSS_COMPILING: - ret = run_command("%s -d %s | grep '(NEEDED)' > %s" - % (sysconfig.get_config_var('READELF'), - do_readline, tmpfile)) - elif find_executable('ldd'): - ret = run_command("ldd %s > %s" % (do_readline, tmpfile)) - else: - ret = 1 - if ret == 0: - with open(tmpfile) as fp: - for ln in fp: - if 'curses' in ln: - readline_termcap_library = re.sub( - r'.*lib(n?cursesw?)\.so.*', r'\1', ln - ).rstrip() - break - # termcap interface split out from ncurses - if 'tinfo' in ln: - readline_termcap_library = 'tinfo' - break - if os.path.exists(tmpfile): - os.unlink(tmpfile) - else: - do_readline = False - # Issue 7384: If readline is already linked against curses, - # use the same library for the readline and curses modules. - if 'curses' in readline_termcap_library: - curses_library = readline_termcap_library - elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'): - curses_library = 'ncursesw' - # Issue 36210: OSS provided ncurses does not link on AIX - # Use IBM supplied 'curses' for successful build of _curses - elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'): - curses_library = 'curses' - elif self.compiler.find_library_file(self.lib_dirs, 'ncurses'): - curses_library = 'ncurses' - elif self.compiler.find_library_file(self.lib_dirs, 'curses'): - curses_library = 'curses' - - if MACOS: - os_release = int(os.uname()[2].split('.')[0]) - dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') - if (dep_target and - (tuple(int(n) for n in dep_target.split('.')[0:2]) - < (10, 5) ) ): - os_release = 8 - if os_release < 9: - # MacOSX 10.4 has a broken readline. Don't try to build - # the readline module unless the user has installed a fixed - # readline package - if find_file('readline/rlconf.h', self.inc_dirs, []) is None: - do_readline = False - if do_readline: - readline_libs = [readline_lib] - if readline_termcap_library: - pass # Issue 7384: Already linked against curses or tinfo. - elif curses_library: - readline_libs.append(curses_library) - elif self.compiler.find_library_file(self.lib_dirs + - ['/usr/lib/termcap'], - 'termcap'): - readline_libs.append('termcap') - self.add(Extension('readline', ['readline.c'], - library_dirs=['/usr/lib/termcap'], - libraries=readline_libs)) - else: - self.missing.append('readline') - - # Curses support, requiring the System V version of curses, often - # provided by the ncurses library. - curses_defines = [] - curses_includes = [] - panel_library = 'panel' - if curses_library == 'ncursesw': - curses_defines.append(('HAVE_NCURSESW', '1')) - if not CROSS_COMPILING: - curses_includes.append('/usr/include/ncursesw') - # Bug 1464056: If _curses.so links with ncursesw, - # _curses_panel.so must link with panelw. - panel_library = 'panelw' - if MACOS: - # On OS X, there is no separate /usr/lib/libncursesw nor - # libpanelw. If we are here, we found a locally-supplied - # version of libncursesw. There should also be a - # libpanelw. _XOPEN_SOURCE defines are usually excluded - # for OS X but we need _XOPEN_SOURCE_EXTENDED here for - # ncurses wide char support - curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1')) - elif MACOS and curses_library == 'ncurses': - # Building with the system-suppied combined libncurses/libpanel - curses_defines.append(('HAVE_NCURSESW', '1')) - curses_defines.append(('_XOPEN_SOURCE_EXTENDED', '1')) - - curses_enabled = True - if curses_library.startswith('ncurses'): - curses_libs = [curses_library] - self.add(Extension('_curses', ['_cursesmodule.c'], - include_dirs=curses_includes, - define_macros=curses_defines, - libraries=curses_libs)) - elif curses_library == 'curses' and not MACOS: - # OSX has an old Berkeley curses, not good enough for - # the _curses module. - if (self.compiler.find_library_file(self.lib_dirs, 'terminfo')): - curses_libs = ['curses', 'terminfo'] - elif (self.compiler.find_library_file(self.lib_dirs, 'termcap')): - curses_libs = ['curses', 'termcap'] - else: - curses_libs = ['curses'] - - self.add(Extension('_curses', ['_cursesmodule.c'], - define_macros=curses_defines, - libraries=curses_libs)) - else: - curses_enabled = False - self.missing.append('_curses') - - # If the curses module is enabled, check for the panel module - # _curses_panel needs some form of ncurses - skip_curses_panel = True if AIX else False - if (curses_enabled and not skip_curses_panel and - self.compiler.find_library_file(self.lib_dirs, panel_library)): - self.add(Extension('_curses_panel', ['_curses_panel.c'], - include_dirs=curses_includes, - define_macros=curses_defines, - libraries=[panel_library, *curses_libs])) - elif not skip_curses_panel: - self.missing.append('_curses_panel') + self.addext(Extension('readline', ['readline.c'])) + self.addext(Extension('_curses', ['_cursesmodule.c'])) + self.addext(Extension('_curses_panel', ['_curses_panel.c'])) def detect_crypt(self): self.addext(Extension('_crypt', ['_cryptmodule.c'])) From bd467ae4660c6dfe4c7d9bf1ee8c2f7ff5a17b92 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 30 Jun 2022 18:06:31 +0200 Subject: [PATCH 2/7] _XOPEN_SOURCE handling --- configure | 4 ++++ configure.ac | 14 ++++++-------- pyconfig.h.in | 9 ++------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 43c746e89e3128..704004ce6d288b 100755 --- a/configure +++ b/configure @@ -4021,6 +4021,8 @@ if test $define_xopen_source = yes then # X/Open 7, incorporating POSIX.1-2008 +$as_echo "#define _XOPEN_SOURCE 700" >>confdefs.h + # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else @@ -21800,6 +21802,8 @@ fi fi +CURSES_CFLAGS=$(echo $CURSES_CFLAGS | sed 's/-D_XOPEN_SOURCE=600//') + if test "$have_curses" = no -a "$ac_sys_system" = "Darwin"; then as_fn_append CURSES_CFLAGS " -D_XOPEN_SOURCE_EXTENDED=1" diff --git a/configure.ac b/configure.ac index ab13e9c92e682d..179ea52d167636 100644 --- a/configure.ac +++ b/configure.ac @@ -675,14 +675,8 @@ esac if test $define_xopen_source = yes then # X/Open 7, incorporating POSIX.1-2008 - dnl NOTE: #undef does not work here, it gets commented out by templating. - AH_VERBATIM([_XOPEN_SOURCE], [ - /* Define to the level of X/Open that your system supports */ - /* some pkg-config files add CFLAGS -D_XOPEN_SOURCE=600 */ - #if !defined(_XOPEN_SOURCE) - # define _XOPEN_SOURCE 700 - #endif - ]) + AC_DEFINE(_XOPEN_SOURCE, 700, + Define to the level of X/Open that your system supports) # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else @@ -6105,6 +6099,10 @@ AS_VAR_IF([ac_cv_header_ncurses_h], [yes], [ ])dnl ac_cv_header_ncurses_h = yes +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//') + if test "$have_curses" = no -a "$ac_sys_system" = "Darwin"; then dnl On macOS, there is no separate /usr/lib/libncursesw nor libpanelw. dnl If we are here, we found a locally-supplied version of libncursesw. diff --git a/pyconfig.h.in b/pyconfig.h.in index 514980eed5f725..a1f31135ed6ff5 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1757,13 +1757,8 @@ /* Define to 1 if you want to emulate signals on WASI */ #undef _WASI_EMULATED_SIGNAL - - /* Define to the level of X/Open that your system supports */ - /* some pkg-config files add CFLAGS -D_XOPEN_SOURCE=600 */ - #if !defined(_XOPEN_SOURCE) - # define _XOPEN_SOURCE 700 - #endif - +/* Define to the level of X/Open that your system supports */ +#undef _XOPEN_SOURCE /* Define to activate Unix95-and-earlier features */ #undef _XOPEN_SOURCE_EXTENDED From a0caa1f83c76f62211b56c40137c3912e617085f Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 30 Jun 2022 21:29:34 +0200 Subject: [PATCH 3/7] Refactor readline block --- ...2-06-30-17-18-23.gh-issue-90005.EIOOla.rst | 3 +- configure | 625 ++++++++++++------ configure.ac | 293 ++++---- pyconfig.h.in | 10 +- 4 files changed, 608 insertions(+), 323 deletions(-) diff --git a/Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst b/Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst index 3789e38801104c..90a2dd486c1956 100644 --- a/Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst +++ b/Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst @@ -1,4 +1,5 @@ Dependencies of :mod:`readline` and :mod:`curses` module are now detected in ``configure`` script with ``pkg-config``. Only ``ncurses`` / ``ncursesw`` are detected automatically. The old ``curses`` library is not configured -automatically. +automatically. Workaround for missing ``termcap`` or ``tinfo`` library +has been removed. diff --git a/configure b/configure index 704004ce6d288b..d6d0601fbd2ad7 100755 --- a/configure +++ b/configure @@ -20534,6 +20534,33 @@ fi +py_cv_lib_readline=no + + +# Check whether --with-readline was given. +if test "${with_readline+set}" = set; then : + withval=$with_readline; + case $with_readline in #( + editline|edit) : + with_readline=edit ;; #( + yes|readline) : + with_readline=readline ;; #( + no) : + ;; #( + *) : + as_fn_error $? "proper usage is --with(out)-readline[=editline|readline|no]" "$LINENO" 5 + ;; +esac + +else + with_readline=readline + +fi + + +if test "x$with_readline" = xreadline; then : + + pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBREADLINE" >&5 $as_echo_n "checking for LIBREADLINE... " >&6; } @@ -20542,12 +20569,12 @@ if test -n "$LIBREADLINE_CFLAGS"; then pkg_cv_LIBREADLINE_CFLAGS="$LIBREADLINE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"readline >= 4.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "readline >= 4.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"readline\""; } >&5 + ($PKG_CONFIG --exists --print-errors "readline") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBREADLINE_CFLAGS=`$PKG_CONFIG --cflags "readline >= 4.2" 2>/dev/null` + pkg_cv_LIBREADLINE_CFLAGS=`$PKG_CONFIG --cflags "readline" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -20559,12 +20586,12 @@ if test -n "$LIBREADLINE_LIBS"; then pkg_cv_LIBREADLINE_LIBS="$LIBREADLINE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"readline >= 4.2\""; } >&5 - ($PKG_CONFIG --exists --print-errors "readline >= 4.2") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"readline\""; } >&5 + ($PKG_CONFIG --exists --print-errors "readline") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBREADLINE_LIBS=`$PKG_CONFIG --libs "readline >= 4.2" 2>/dev/null` + pkg_cv_LIBREADLINE_LIBS=`$PKG_CONFIG --libs "readline" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -20585,15 +20612,15 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBREADLINE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "readline >= 4.2" 2>&1` + LIBREADLINE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "readline" 2>&1` else - LIBREADLINE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "readline >= 4.2" 2>&1` + LIBREADLINE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "readline" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBREADLINE_PKG_ERRORS" >&5 - for ac_header in readline/readline.h + for ac_header in readline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_readline_readline_h" = xyes; then : @@ -20601,15 +20628,15 @@ if test "x$ac_cv_header_readline_readline_h" = xyes; then : #define HAVE_READLINE_READLINE_H 1 _ACEOF - save_CFLAGS=$CFLAGS + save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_catch_signals in -lreadline" >&5 -$as_echo_n "checking for rl_catch_signals in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_catch_signals+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5 +$as_echo_n "checking for readline in -lreadline... " >&6; } +if ${ac_cv_lib_readline_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -20623,35 +20650,36 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_catch_signals (); +char readline (); int main () { -return rl_catch_signals (); +return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_readline_rl_catch_signals=yes + ac_cv_lib_readline_readline=yes else - ac_cv_lib_readline_rl_catch_signals=no + ac_cv_lib_readline_readline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_catch_signals" >&5 -$as_echo "$ac_cv_lib_readline_rl_catch_signals" >&6; } -if test "x$ac_cv_lib_readline_rl_catch_signals" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5 +$as_echo "$ac_cv_lib_readline_readline" >&6; } +if test "x$ac_cv_lib_readline_readline" = xyes; then : - have_libreadline=yes - LIBREADLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} - LIBREADLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} + py_cv_lib_readline=yes + LIBREADLINE=readline + READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} else - have_libreadline=no + with_readline=no fi @@ -20664,7 +20692,7 @@ LIBS=$save_LIBS else - have_libreadline=no + with_readline=no fi done @@ -20674,7 +20702,7 @@ elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - for ac_header in readline/readline.h + for ac_header in readline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_readline_readline_h" = xyes; then : @@ -20682,15 +20710,15 @@ if test "x$ac_cv_header_readline_readline_h" = xyes; then : #define HAVE_READLINE_READLINE_H 1 _ACEOF - save_CFLAGS=$CFLAGS + save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_catch_signals in -lreadline" >&5 -$as_echo_n "checking for rl_catch_signals in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_catch_signals+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5 +$as_echo_n "checking for readline in -lreadline... " >&6; } +if ${ac_cv_lib_readline_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -20704,35 +20732,36 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_catch_signals (); +char readline (); int main () { -return rl_catch_signals (); +return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_readline_rl_catch_signals=yes + ac_cv_lib_readline_readline=yes else - ac_cv_lib_readline_rl_catch_signals=no + ac_cv_lib_readline_readline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_catch_signals" >&5 -$as_echo "$ac_cv_lib_readline_rl_catch_signals" >&6; } -if test "x$ac_cv_lib_readline_rl_catch_signals" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5 +$as_echo "$ac_cv_lib_readline_readline" >&6; } +if test "x$ac_cv_lib_readline_readline" = xyes; then : - have_libreadline=yes - LIBREADLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} - LIBREADLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} + py_cv_lib_readline=yes + LIBREADLINE=readline + READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} else - have_libreadline=no + with_readline=no fi @@ -20745,7 +20774,7 @@ LIBS=$save_LIBS else - have_libreadline=no + with_readline=no fi done @@ -20757,10 +20786,17 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - have_libreadline=yes + py_cv_lib_readline=yes + LIBREADLINE=readline + READLINE_CFLAGS=$LIBREADLINE_CFLAGS + READLINE_LIBS=$LIBREADLINE_LIBS fi +fi + +if test "x$with_readline" = xedit; then : + pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBEDIT" >&5 @@ -20821,7 +20857,7 @@ fi echo "$LIBEDIT_PKG_ERRORS" >&5 - for ac_header in editline/readline.h + for ac_header in editline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_editline_readline_h" = xyes; then : @@ -20829,15 +20865,15 @@ if test "x$ac_cv_header_editline_readline_h" = xyes; then : #define HAVE_EDITLINE_READLINE_H 1 _ACEOF - save_CFLAGS=$CFLAGS + save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_catch_signals in -ledit" >&5 -$as_echo_n "checking for rl_catch_signals in -ledit... " >&6; } -if ${ac_cv_lib_edit_rl_catch_signals+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -ledit" >&5 +$as_echo_n "checking for readline in -ledit... " >&6; } +if ${ac_cv_lib_edit_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -20851,35 +20887,38 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_catch_signals (); +char readline (); int main () { -return rl_catch_signals (); +return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_edit_rl_catch_signals=yes + ac_cv_lib_edit_readline=yes else - ac_cv_lib_edit_rl_catch_signals=no + ac_cv_lib_edit_readline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_rl_catch_signals" >&5 -$as_echo "$ac_cv_lib_edit_rl_catch_signals" >&6; } -if test "x$ac_cv_lib_edit_rl_catch_signals" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_readline" >&5 +$as_echo "$ac_cv_lib_edit_readline" >&6; } +if test "x$ac_cv_lib_edit_readline" = xyes; then : - have_libedit=yes - LIBEDIT_CFLAGS=${LIBEDIT_CFLAGS-""} - LIBEDIT_LIBS=${LIBEDIT_LIBS-"-ledit"} + py_cv_lib_readline=yes + LIBREADLINE=edit + $as_echo "#define WITH_EDITLINE 1" >>confdefs.h + + READLINE_CFLAGS=${LIBEDIT_CFLAGS-""} + READLINE_LIBS=${LIBEDIT_LIBS-"-ledit"} else - have_libedit=no + with_readline=no fi @@ -20892,7 +20931,7 @@ LIBS=$save_LIBS else - have_libedit=no + with_readline=no fi done @@ -20902,7 +20941,7 @@ elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - for ac_header in editline/readline.h + for ac_header in editline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_editline_readline_h" = xyes; then : @@ -20910,15 +20949,15 @@ if test "x$ac_cv_header_editline_readline_h" = xyes; then : #define HAVE_EDITLINE_READLINE_H 1 _ACEOF - save_CFLAGS=$CFLAGS + save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_catch_signals in -ledit" >&5 -$as_echo_n "checking for rl_catch_signals in -ledit... " >&6; } -if ${ac_cv_lib_edit_rl_catch_signals+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -ledit" >&5 +$as_echo_n "checking for readline in -ledit... " >&6; } +if ${ac_cv_lib_edit_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -20932,35 +20971,38 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_catch_signals (); +char readline (); int main () { -return rl_catch_signals (); +return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_edit_rl_catch_signals=yes + ac_cv_lib_edit_readline=yes else - ac_cv_lib_edit_rl_catch_signals=no + ac_cv_lib_edit_readline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_rl_catch_signals" >&5 -$as_echo "$ac_cv_lib_edit_rl_catch_signals" >&6; } -if test "x$ac_cv_lib_edit_rl_catch_signals" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_readline" >&5 +$as_echo "$ac_cv_lib_edit_readline" >&6; } +if test "x$ac_cv_lib_edit_readline" = xyes; then : + + py_cv_lib_readline=yes + LIBREADLINE=edit + $as_echo "#define WITH_EDITLINE 1" >>confdefs.h - have_libedit=yes - LIBEDIT_CFLAGS=${LIBEDIT_CFLAGS-""} - LIBEDIT_LIBS=${LIBEDIT_LIBS-"-ledit"} + READLINE_CFLAGS=${LIBEDIT_CFLAGS-""} + READLINE_LIBS=${LIBEDIT_LIBS-"-ledit"} else - have_libedit=no + with_readline=no fi @@ -20973,7 +21015,7 @@ LIBS=$save_LIBS else - have_libedit=no + with_readline=no fi done @@ -20985,149 +21027,326 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - have_libedit=yes + $as_echo "#define WITH_EDITLINE 1" >>confdefs.h + + py_cv_lib_readline=yes + LIBREADLINE=edit + READLINE_CFLAGS=$LIBEDIT_CFLAGS + READLINE_LIBS=$LIBEDIT_LIBS fi +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline" >&5 +$as_echo_n "checking how to link readline... " >&6; } +if test "x$py_cv_lib_readline" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)" >&5 +$as_echo "$with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)" >&6; } -# Check whether --with-readline was given. -if test "${with_readline+set}" = set; then : - withval=$with_readline; else - with_readline=readline + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi +if test "x$py_cv_lib_readline" = xyes; then : -py_cv_lib_readline=no + save_CFLAGS=$CFLAGS +save_CPPFLAGS=$CPPFLAGS +save_LDFLAGS=$LDFLAGS +save_LIBS=$LIBS -case $with_readline in #( - editline|edit) : - with_readline=edit - READLINE_CFLAGS=$LIBEDIT_CFLAGS - READLINE_LIBS=$LIBEDIT_LIBS + CPPFLAGS="$READLINE_CFLAGS $CFLAGS" + LIBS="$READLINE_LIBS $LIBS" -$as_echo "#define WITH_EDITLINE 1" >>confdefs.h + # check for readline 2.2 + ac_fn_c_check_decl "$LINENO" "rl_completion_append_character" "ac_cv_have_decl_rl_completion_append_character" " + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + #endif - ;; #( - yes|readline) : +" +if test "x$ac_cv_have_decl_rl_completion_append_character" = xyes; then : - with_readline=readline - READLINE_CFLAGS=$LIBREADLINE_CFLAGS - READLINE_LIBS=$LIBREADLINE_LIBS - ;; #( - no) : - ;; #( - *) : - as_fn_error $? "proper usage is --with(out)-readline[=editline|readline|no]" "$LINENO" 5 - ;; -esac +$as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h -if test "$with_readline" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline libs" >&5 -$as_echo_n "checking how to link readline libs... " >&6; } - # for py_libtermcap in "" tinfo ncursesw ncurses termcap; do - # if test -z "$py_libtermcap"; then - # READLINE_TERMCAP_LIBS="" - # else - # READLINE_TERMCAP_LIBS="-l$py_libtermcap" - # fi - - READLINE_TERMCAP_LIBS="" - save_CFLAGS=$CFLAGS -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -save_LIBS=$LIBS +fi - CPPFLAGS="$READLINE_CFLAGS $CFLAGS" - LIBS="$READLINE_LIBS $READLINE_TERMCAP_LIBS $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + ac_fn_c_check_decl "$LINENO" "rl_completion_suppress_append" "ac_cv_have_decl_rl_completion_suppress_append" " + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + #endif +" +if test "x$ac_cv_have_decl_rl_completion_suppress_append" = xyes; then : - #include /* Must be first for Gnu Readline */ - #ifdef WITH_EDITLINE - # include - #else - # include - # include - #endif +$as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1" >>confdefs.h +fi + + + # check for readline 4.0 + as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_pre_input_hook" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -l$LIBREADLINE" >&5 +$as_echo_n "checking for rl_pre_input_hook in -l$LIBREADLINE... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$LIBREADLINE $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. */ +#ifdef __cplusplus +extern "C" +#endif +char rl_pre_input_hook (); int main () { - - rl_catch_signals = 0; - void *x1 = rl_resize_terminal; - void *x2 = append_history; - +return rl_pre_input_hook (); ; return 0; } - _ACEOF if ac_fn_c_try_link "$LINENO"; then : - py_cv_lib_readline=yes + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : -CFLAGS=$save_CFLAGS -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS -LIBS=$save_LIBS +$as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h + +fi + # also in 4.0 + as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_display_matches_hook" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -l$LIBREADLINE" >&5 +$as_echo_n "checking for rl_completion_display_matches_hook in -l$LIBREADLINE... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$LIBREADLINE $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. */ +#ifdef __cplusplus +extern "C" +#endif +char rl_completion_display_matches_hook (); +int +main () +{ +return rl_completion_display_matches_hook (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + +$as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h - # AS_VAR_IF([py_cv_lib_readline], [yes], [ - # if test -n "$ADD_READLINE_LIBS"; then - # AS_VAR_APPEND([READLINE_LIBS], [" $READLINE_TERMCAP_LIBS"]) - # fi - # break - # ]) - # done +fi - if test "x$py_cv_lib_readline" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_LIBS" >&5 -$as_echo "$READLINE_LIBS" >&6; } + # also in 4.0, but not in editline + as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_resize_terminal" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -l$LIBREADLINE" >&5 +$as_echo_n "checking for rl_resize_terminal in -l$LIBREADLINE... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$LIBREADLINE $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. */ +#ifdef __cplusplus +extern "C" +#endif +char rl_resize_terminal (); +int +main () +{ +return rl_resize_terminal (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } +$as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h fi -fi -if test "x$py_cv_lib_readline" = xyes; then : + # check for readline 4.2 + as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_matches" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -l$LIBREADLINE" >&5 +$as_echo_n "checking for rl_completion_matches in -l$LIBREADLINE... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$LIBREADLINE $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. */ +#ifdef __cplusplus +extern "C" +#endif +char rl_completion_matches (); +int +main () +{ +return rl_completion_matches (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : -$as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h +$as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h +fi -$as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1" >>confdefs.h + # also in readline 4.2 + ac_fn_c_check_decl "$LINENO" "rl_catch_signals" "ac_cv_have_decl_rl_catch_signals" " + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + #endif -$as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h +" +if test "x$ac_cv_have_decl_rl_catch_signals" = xyes; then : +$as_echo "#define HAVE_RL_CATCH_SIGNAL 1" >>confdefs.h -$as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h +fi -$as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h + as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_append_history" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -l$LIBREADLINE" >&5 +$as_echo_n "checking for append_history in -l$LIBREADLINE... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$LIBREADLINE $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. */ +#ifdef __cplusplus +extern "C" +#endif +char append_history (); +int +main () +{ +return append_history (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : -$as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h +$as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h +fi -$as_echo "#define HAVE_RL_CATCH_SIGNAL 1" >>confdefs.h -$as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS fi @@ -21412,6 +21631,7 @@ done if test "x$ac_cv_header_ncurses_h" = xyes; then : + if test "$ac_sys_system" != "Darwin"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CURSES" >&5 @@ -21472,13 +21692,13 @@ fi echo "$CURSES_PKG_ERRORS" >&5 - save_CFLAGS=$CFLAGS + save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 $as_echo_n "checking for initscr in -lncursesw... " >&6; } if ${ac_cv_lib_ncursesw_initscr+:} false; then : $as_echo_n "(cached) " >&6 @@ -21516,11 +21736,11 @@ fi $as_echo "$ac_cv_lib_ncursesw_initscr" >&6; } if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then : - $as_echo "#define HAVE_NCURSESW 1" >>confdefs.h + $as_echo "#define HAVE_NCURSESW 1" >>confdefs.h - have_curses=ncursesw - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} + have_curses=ncursesw + CURSES_CFLAGS=${CURSES_CFLAGS-""} + CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} fi @@ -21536,13 +21756,13 @@ elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - save_CFLAGS=$CFLAGS + save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 $as_echo_n "checking for initscr in -lncursesw... " >&6; } if ${ac_cv_lib_ncursesw_initscr+:} false; then : $as_echo_n "(cached) " >&6 @@ -21580,11 +21800,11 @@ fi $as_echo "$ac_cv_lib_ncursesw_initscr" >&6; } if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then : - $as_echo "#define HAVE_NCURSESW 1" >>confdefs.h + $as_echo "#define HAVE_NCURSESW 1" >>confdefs.h - have_curses=ncursesw - CURSES_CFLAGS=${CURSES_CFLAGS-""} - CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} + have_curses=ncursesw + CURSES_CFLAGS=${CURSES_CFLAGS-""} + CURSES_LIBS=${CURSES_LIBS-"-lncursesw"} fi @@ -21602,9 +21822,10 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - have_curses=ncursesw + have_curses=ncursesw fi + fi if test "x$have_curses" = xno; then : @@ -21814,8 +22035,17 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking curses module flags" >&5 $as_echo_n "checking curses module flags... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURSES_CFLAGS $CURSES_LIBS" >&5 -$as_echo "$CURSES_CFLAGS $CURSES_LIBS" >&6; } +if test "x$have_curses" = xno; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_curses (CFLAGS: $CURSES_CFLAGS, LIBS: $CURSES_LIBS)" >&5 +$as_echo "$have_curses (CFLAGS: $CURSES_CFLAGS, LIBS: $CURSES_LIBS)" >&6; } + +fi for ac_header in panel.h do : @@ -21833,7 +22063,8 @@ done if test "x$ac_cv_header_panel_h" = xyes; then : - if test "x$have_curses" = xncursesw; then : + if test "$ac_sys_system" != "Darwin"; then + if test "x$have_curses" = xncursesw; then : pkg_failed=no @@ -21895,13 +22126,13 @@ fi echo "$PANEL_PKG_ERRORS" >&5 - save_CFLAGS=$CFLAGS + save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanelw" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanelw" >&5 $as_echo_n "checking for update_panels in -lpanelw... " >&6; } if ${ac_cv_lib_panelw_update_panels+:} false; then : $as_echo_n "(cached) " >&6 @@ -21939,9 +22170,9 @@ fi $as_echo "$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_panel=panelw + PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanelw"} fi @@ -21957,13 +22188,13 @@ elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - save_CFLAGS=$CFLAGS + save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS save_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanelw" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanelw" >&5 $as_echo_n "checking for update_panels in -lpanelw... " >&6; } if ${ac_cv_lib_panelw_update_panels+:} false; then : $as_echo_n "(cached) " >&6 @@ -22001,9 +22232,9 @@ fi $as_echo "$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_panel=panelw + PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanelw"} fi @@ -22021,11 +22252,13 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - have_panel=panelw + have_panel=panelw fi fi + fi + if test "x$have_curses" = xncurses; then : @@ -22220,11 +22453,21 @@ fi fi + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking panel flags" >&5 $as_echo_n "checking panel flags... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PANEL_CFLAGS $PANEL_LIBS" >&5 -$as_echo "$PANEL_CFLAGS $PANEL_LIBS" >&6; } +if test "x$have_panel" = xno; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_panel (CFLAGS: $PANEL_CFLAGS, LIBS: $PANEL_LIBS)" >&5 +$as_echo "$have_panel (CFLAGS: $PANEL_CFLAGS, LIBS: $PANEL_LIBS)" >&6; } + +fi # first curses header check ac_save_cppflags="$CPPFLAGS" @@ -25745,7 +25988,7 @@ fi if test "x$py_cv_module__curses" = xyes; then : as_fn_append MODULE_BLOCK "MODULE__CURSES_CFLAGS=$CURSES_CFLAGS$as_nl" - as_fn_append MODULE_BLOCK "MODULE__CURSES_LDFLAGS=$CURSES_LIBS $READLINE_TERMCAP_LIBS + as_fn_append MODULE_BLOCK "MODULE__CURSES_LDFLAGS=$CURSES_LIBS $as_nl" fi @@ -25780,7 +26023,7 @@ fi if test "x$py_cv_module__curses_panel" = xyes; then : as_fn_append MODULE_BLOCK "MODULE__CURSES_PANEL_CFLAGS=$PANEL_CFLAGS $CURSES_CFLAGS$as_nl" - as_fn_append MODULE_BLOCK "MODULE__CURSES_PANEL_LDFLAGS=$PANEL_LIBS $CURSES_LIBS $READLINE_TERMCAP_LIBS + as_fn_append MODULE_BLOCK "MODULE__CURSES_PANEL_LDFLAGS=$PANEL_LIBS $CURSES_LIBS $as_nl" fi diff --git a/configure.ac b/configure.ac index 179ea52d167636..6ce69c69b74cbe 100644 --- a/configure.ac +++ b/configure.ac @@ -5782,127 +5782,154 @@ fi dnl Check for libreadline and libedit dnl - libreadline provides "readline/readline.h" header and "libreadline" -dnl shared library. +dnl shared library. pkg-config file is readline.pc dnl - libedit provides "editline/readline.h" header and "libedit" shared -dnl library. +dnl library. pkg-config file ins libedit.pc dnl - editline is not supported ("readline.h" and "libeditline" shared library) +dnl +dnl NOTE: In the past we checked if readline needs an additional termcap +dnl library (tinfo ncursesw ncurses termcap). We now assume that libreadline +dnl or readline.pc provide correct linker information. -PKG_CHECK_MODULES([LIBREADLINE], [readline >= 4.2], [ - have_libreadline=yes -], [ - AC_CHECK_HEADERS([readline/readline.h], [ - WITH_SAVE_ENV([ - dnl rl_catch_signals is available since readline 4.2 - AC_CHECK_LIB([readline], [rl_catch_signals], [ - have_libreadline=yes - LIBREADLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} - LIBREADLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} - ], [ - have_libreadline=no - ]) - ]) - ], [have_libreadline=no]) -]) - -PKG_CHECK_MODULES([LIBEDIT], [libedit], [ - have_libedit=yes -], [ - AC_CHECK_HEADERS([editline/readline.h], [ - WITH_SAVE_ENV([ - AC_CHECK_LIB([edit], [rl_catch_signals], [ - have_libedit=yes - LIBEDIT_CFLAGS=${LIBEDIT_CFLAGS-""} - LIBEDIT_LIBS=${LIBEDIT_LIBS-"-ledit"} - ], [ - have_libedit=no - ]) - ]) - ], [have_libedit=no]) -]) +AH_TEMPLATE([WITH_EDITLINE], [Define to build the readline module against libedit.]) +py_cv_lib_readline=no AC_ARG_WITH( [readline], [AS_HELP_STRING([--with(out)-readline@<:@=editline|readline|no@:>@], [use libedit for backend or disable readline module])], - [], + [ + AS_CASE([$with_readline], + [editline|edit], [with_readline=edit], + [yes|readline], [with_readline=readline], + [no], [], + [AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline|readline|no@:>@])] + ) + ], [with_readline=readline] ) -py_cv_lib_readline=no - -AS_CASE( - [$with_readline], - [editline|edit], [ - with_readline=edit - READLINE_CFLAGS=$LIBEDIT_CFLAGS - READLINE_LIBS=$LIBEDIT_LIBS - AC_DEFINE([WITH_EDITLINE], [1], [Define to build the readline module against libedit.]) - ], - [yes|readline], [ - with_readline=readline +AS_VAR_IF([with_readline], [readline], [ + PKG_CHECK_MODULES([LIBREADLINE], [readline], [ + py_cv_lib_readline=yes + LIBREADLINE=readline READLINE_CFLAGS=$LIBREADLINE_CFLAGS READLINE_LIBS=$LIBREADLINE_LIBS - ], - [no], [], - [AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline|readline|no@:>@])] -) - -if test "$with_readline" != "no"; then - AC_MSG_CHECKING([how to link readline libs]) - # for py_libtermcap in "" tinfo ncursesw ncurses termcap; do - # if test -z "$py_libtermcap"; then - # READLINE_TERMCAP_LIBS="" - # else - # READLINE_TERMCAP_LIBS="-l$py_libtermcap" - # fi - - READLINE_TERMCAP_LIBS="" - WITH_SAVE_ENV([ - CPPFLAGS="$READLINE_CFLAGS $CFLAGS" - LIBS="$READLINE_LIBS $READLINE_TERMCAP_LIBS $LIBS" - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([ - #include /* Must be first for Gnu Readline */ - #ifdef WITH_EDITLINE - # include - #else - # include - # include - #endif - ],[ - rl_catch_signals = 0; - void *x1 = rl_resize_terminal; - void *x2 = append_history; + ], [ + AC_CHECK_HEADERS([readline/readline.h], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([readline], [readline], [ + py_cv_lib_readline=yes + LIBREADLINE=readline + READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} + ], [ + with_readline=no ]) - ], [py_cv_lib_readline=yes]) - ]) - - # AS_VAR_IF([py_cv_lib_readline], [yes], [ - # if test -n "$ADD_READLINE_LIBS"; then - # AS_VAR_APPEND([READLINE_LIBS], [" $READLINE_TERMCAP_LIBS"]) - # fi - # break - # ]) - # done + ]) + ], [with_readline=no]) + ]) +]) - AS_VAR_IF([py_cv_lib_readline], [yes], [ - AC_MSG_RESULT([$READLINE_LIBS]) +AS_VAR_IF([with_readline], [edit], [ + PKG_CHECK_MODULES([LIBEDIT], [libedit], [ + AC_DEFINE([WITH_EDITLINE], [1]) + py_cv_lib_readline=yes + LIBREADLINE=edit + READLINE_CFLAGS=$LIBEDIT_CFLAGS + READLINE_LIBS=$LIBEDIT_LIBS ], [ - AC_MSG_RESULT([none]) + AC_CHECK_HEADERS([editline/readline.h], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([edit], [readline], [ + py_cv_lib_readline=yes + LIBREADLINE=edit + AC_DEFINE([WITH_EDITLINE], [1]) + READLINE_CFLAGS=${LIBEDIT_CFLAGS-""} + READLINE_LIBS=${LIBEDIT_LIBS-"-ledit"} + ], [ + with_readline=no + ]) + ]) + ], [with_readline=no]) ]) +]) -fi +AC_MSG_CHECKING([how to link readline]) +AS_VAR_IF([py_cv_lib_readline], [yes], [ + AC_MSG_RESULT([$with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)]) +], [ + AC_MSG_RESULT([no]) +]) AS_VAR_IF([py_cv_lib_readline], [yes], [ - dnl We have readline >= 4.2 or compatible libedit. - AC_DEFINE([HAVE_RL_COMPLETION_APPEND_CHARACTER], [1], [Define if you have rl_completion_append_character]) - AC_DEFINE([HAVE_RL_COMPLETION_SUPPRESS_APPEND], [1], [Define if you have rl_completion_suppress_append]) - AC_DEFINE([HAVE_RL_PRE_INPUT_HOOK], [1], [Define if you have rl_pre_input_hook]) - AC_DEFINE([HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK], [1], [Define if you haverl_completion_display_matches_hook]) - AC_DEFINE([HAVE_RL_RESIZE_TERMINAL], [1], [Define if you have rl_resize_terminal]) - AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], [1], [Define if you have rl_completion_matches]) - AC_DEFINE([HAVE_RL_CATCH_SIGNAL], [1], [Define if you can turn off readline's signal handling.]) - AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history]) + WITH_SAVE_ENV([ + CPPFLAGS="$READLINE_CFLAGS $CFLAGS" + LIBS="$READLINE_LIBS $LIBS" + + # check for readline 2.2 + AC_CHECK_DECL(rl_completion_append_character, + AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, + [Define if you have readline 2.2]),, + [ + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + #endif + ]) + + AC_CHECK_DECL(rl_completion_suppress_append, + AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1, + [Define if you have rl_completion_suppress_append]),, + [ + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + #endif + ]) + + # check for readline 4.0 + AC_CHECK_LIB($LIBREADLINE, rl_pre_input_hook, + AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, + [Define if you have readline 4.0])) + + # also in 4.0 + AC_CHECK_LIB($LIBREADLINE, rl_completion_display_matches_hook, + AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1, + [Define if you have readline 4.0])) + + # also in 4.0, but not in editline + AC_CHECK_LIB($LIBREADLINE, rl_resize_terminal, + AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1, + [Define if you have readline 4.0])) + + # check for readline 4.2 + AC_CHECK_LIB($LIBREADLINE, rl_completion_matches, + AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, + [Define if you have readline 4.2])) + + # also in readline 4.2 + AC_CHECK_DECL(rl_catch_signals, + AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, + [Define if you can turn off readline's signal handling.]),, + [ + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + #endif + ]) + + AC_CHECK_LIB($LIBREADLINE, append_history, + AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1, + [Define if readline supports append_history])) + + ])dnl WITH_SAVE_ENV() ]) AC_CACHE_CHECK([for broken nice()], [ac_cv_broken_nice], [ @@ -6070,18 +6097,21 @@ 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], [ - PKG_CHECK_MODULES([CURSES], [ncursesw], [ - 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"} + if test "$ac_sys_system" != "Darwin"; then + dnl On macOS, there is no separate /usr/lib/libncursesw nor libpanelw. + PKG_CHECK_MODULES([CURSES], [ncursesw], [ + 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], [ @@ -6117,26 +6147,33 @@ fi dnl TODO: detect "curses" and special cases tinfo, terminfo, or termcap AC_MSG_CHECKING([curses module flags]) -AC_MSG_RESULT([$CURSES_CFLAGS $CURSES_LIBS]) +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], [ - 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"} + 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"} + ]) ]) ]) ]) - ])dnl panelw + fi AS_VAR_IF([have_curses], [ncurses], [ PKG_CHECK_MODULES([PANEL], [panel], [ @@ -6150,12 +6187,16 @@ AS_VAR_IF([ac_cv_header_panel_h], [yes], [ ]) ]) ]) - ])dnl panelw + ]) ])dnl ac_cv_header_panel_h = yes AC_MSG_CHECKING([panel flags]) -AC_MSG_RESULT([$PANEL_CFLAGS $PANEL_LIBS]) +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" @@ -7086,11 +7127,11 @@ PY_STDLIB_MOD([_ctypes], [$LIBFFI_CFLAGS], [$LIBFFI_LIBS]) PY_STDLIB_MOD([_curses], [], [test "$have_curses" != "no"], - [$CURSES_CFLAGS], [$CURSES_LIBS $READLINE_TERMCAP_LIBS] + [$CURSES_CFLAGS], [$CURSES_LIBS] ) PY_STDLIB_MOD([_curses_panel], [], [test "$have_panel" != "no"], - [$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS $READLINE_TERMCAP_LIBS] + [$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS] ) PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS]) PY_STDLIB_MOD([_dbm], diff --git a/pyconfig.h.in b/pyconfig.h.in index a1f31135ed6ff5..aa9fc559fa2511 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -935,22 +935,22 @@ /* Define if you can turn off readline's signal handling. */ #undef HAVE_RL_CATCH_SIGNAL -/* Define if you have rl_completion_append_character */ +/* Define if you have readline 2.2 */ #undef HAVE_RL_COMPLETION_APPEND_CHARACTER -/* Define if you haverl_completion_display_matches_hook */ +/* Define if you have readline 4.0 */ #undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -/* Define if you have rl_completion_matches */ +/* Define if you have readline 4.2 */ #undef HAVE_RL_COMPLETION_MATCHES /* Define if you have rl_completion_suppress_append */ #undef HAVE_RL_COMPLETION_SUPPRESS_APPEND -/* Define if you have rl_pre_input_hook */ +/* Define if you have readline 4.0 */ #undef HAVE_RL_PRE_INPUT_HOOK -/* Define if you have rl_resize_terminal */ +/* Define if you have readline 4.0 */ #undef HAVE_RL_RESIZE_TERMINAL /* Define to 1 if you have the header file. */ From a72b6327d50065863bcd738ed615732789eea573 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 1 Jul 2022 22:08:04 +0200 Subject: [PATCH 4/7] Address review comments --- configure | 43 ++++++++++++++++++----------- configure.ac | 78 +++++++++++++++++++++++++--------------------------- 2 files changed, 64 insertions(+), 57 deletions(-) diff --git a/configure b/configure index d6d0601fbd2ad7..059e016cd5e306 100755 --- a/configure +++ b/configure @@ -20534,7 +20534,6 @@ fi -py_cv_lib_readline=no # Check whether --with-readline was given. @@ -20672,7 +20671,6 @@ fi $as_echo "$ac_cv_lib_readline_readline" >&6; } if test "x$ac_cv_lib_readline_readline" = xyes; then : - py_cv_lib_readline=yes LIBREADLINE=readline READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} @@ -20754,7 +20752,6 @@ fi $as_echo "$ac_cv_lib_readline_readline" >&6; } if test "x$ac_cv_lib_readline_readline" = xyes; then : - py_cv_lib_readline=yes LIBREADLINE=readline READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} @@ -20786,7 +20783,6 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - py_cv_lib_readline=yes LIBREADLINE=readline READLINE_CFLAGS=$LIBREADLINE_CFLAGS READLINE_LIBS=$LIBREADLINE_LIBS @@ -20909,7 +20905,6 @@ fi $as_echo "$ac_cv_lib_edit_readline" >&6; } if test "x$ac_cv_lib_edit_readline" = xyes; then : - py_cv_lib_readline=yes LIBREADLINE=edit $as_echo "#define WITH_EDITLINE 1" >>confdefs.h @@ -20993,7 +20988,6 @@ fi $as_echo "$ac_cv_lib_edit_readline" >&6; } if test "x$ac_cv_lib_edit_readline" = xyes; then : - py_cv_lib_readline=yes LIBREADLINE=edit $as_echo "#define WITH_EDITLINE 1" >>confdefs.h @@ -21029,7 +21023,6 @@ $as_echo "yes" >&6; } $as_echo "#define WITH_EDITLINE 1" >>confdefs.h - py_cv_lib_readline=yes LIBREADLINE=edit READLINE_CFLAGS=$LIBEDIT_CFLAGS READLINE_LIBS=$LIBEDIT_LIBS @@ -21040,19 +21033,15 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline" >&5 $as_echo_n "checking how to link readline... " >&6; } -if test "x$py_cv_lib_readline" = xyes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)" >&5 -$as_echo "$with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)" >&6; } - -else +if test "x$with_readline" = xno; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } -fi +else -if test "x$py_cv_lib_readline" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)" >&5 +$as_echo "$with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)" >&6; } save_CFLAGS=$CFLAGS save_CPPFLAGS=$CPPFLAGS @@ -21062,6 +21051,7 @@ save_LIBS=$LIBS CPPFLAGS="$READLINE_CFLAGS $CFLAGS" LIBS="$READLINE_LIBS $LIBS" + LIBS_SAVE=$LIBS # check for readline 2.2 ac_fn_c_check_decl "$LINENO" "rl_completion_append_character" "ac_cv_have_decl_rl_completion_append_character" " @@ -21075,8 +21065,10 @@ save_LIBS=$LIBS " if test "x$ac_cv_have_decl_rl_completion_append_character" = xyes; then : + $as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h + fi @@ -21091,8 +21083,10 @@ fi " if test "x$ac_cv_have_decl_rl_completion_suppress_append" = xyes; then : + $as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1" >>confdefs.h + fi @@ -21137,10 +21131,13 @@ eval ac_res=\$$as_ac_Lib $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h + fi + LIBS=$LIBS_SAVE # also in 4.0 as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_display_matches_hook" | $as_tr_sh` @@ -21183,10 +21180,13 @@ eval ac_res=\$$as_ac_Lib $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h + fi + LIBS=$LIBS_SAVE # also in 4.0, but not in editline as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_resize_terminal" | $as_tr_sh` @@ -21229,10 +21229,13 @@ eval ac_res=\$$as_ac_Lib $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h + fi + LIBS=$LIBS_SAVE # check for readline 4.2 as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_matches" | $as_tr_sh` @@ -21275,10 +21278,13 @@ eval ac_res=\$$as_ac_Lib $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h + fi + LIBS=$LIBS_SAVE # also in readline 4.2 ac_fn_c_check_decl "$LINENO" "rl_catch_signals" "ac_cv_have_decl_rl_catch_signals" " @@ -21292,8 +21298,10 @@ fi " if test "x$ac_cv_have_decl_rl_catch_signals" = xyes; then : + $as_echo "#define HAVE_RL_CATCH_SIGNAL 1" >>confdefs.h + fi @@ -21337,10 +21345,13 @@ eval ac_res=\$$as_ac_Lib $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h + fi + LIBS=$LIBS_SAVE CFLAGS=$save_CFLAGS @@ -26180,7 +26191,7 @@ $as_echo_n "checking for stdlib extension module readline... " >&6; } if test "$py_cv_module_readline" != "n/a"; then : if true; then : - if test "$py_cv_lib_readline" = "yes"; then : + if test "$with_readline" != "no"; then : py_cv_module_readline=yes else py_cv_module_readline=missing diff --git a/configure.ac b/configure.ac index 6ce69c69b74cbe..49b4b248950899 100644 --- a/configure.ac +++ b/configure.ac @@ -5792,7 +5792,6 @@ dnl library (tinfo ncursesw ncurses termcap). We now assume that libreadline dnl or readline.pc provide correct linker information. AH_TEMPLATE([WITH_EDITLINE], [Define to build the readline module against libedit.]) -py_cv_lib_readline=no AC_ARG_WITH( [readline], @@ -5811,7 +5810,6 @@ AC_ARG_WITH( AS_VAR_IF([with_readline], [readline], [ PKG_CHECK_MODULES([LIBREADLINE], [readline], [ - py_cv_lib_readline=yes LIBREADLINE=readline READLINE_CFLAGS=$LIBREADLINE_CFLAGS READLINE_LIBS=$LIBREADLINE_LIBS @@ -5819,7 +5817,6 @@ AS_VAR_IF([with_readline], [readline], [ AC_CHECK_HEADERS([readline/readline.h], [ WITH_SAVE_ENV([ AC_CHECK_LIB([readline], [readline], [ - py_cv_lib_readline=yes LIBREADLINE=readline READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} @@ -5834,7 +5831,6 @@ AS_VAR_IF([with_readline], [readline], [ AS_VAR_IF([with_readline], [edit], [ PKG_CHECK_MODULES([LIBEDIT], [libedit], [ AC_DEFINE([WITH_EDITLINE], [1]) - py_cv_lib_readline=yes LIBREADLINE=edit READLINE_CFLAGS=$LIBEDIT_CFLAGS READLINE_LIBS=$LIBEDIT_LIBS @@ -5842,7 +5838,6 @@ AS_VAR_IF([with_readline], [edit], [ AC_CHECK_HEADERS([editline/readline.h], [ WITH_SAVE_ENV([ AC_CHECK_LIB([edit], [readline], [ - py_cv_lib_readline=yes LIBREADLINE=edit AC_DEFINE([WITH_EDITLINE], [1]) READLINE_CFLAGS=${LIBEDIT_CFLAGS-""} @@ -5856,78 +5851,79 @@ AS_VAR_IF([with_readline], [edit], [ ]) AC_MSG_CHECKING([how to link readline]) -AS_VAR_IF([py_cv_lib_readline], [yes], [ - AC_MSG_RESULT([$with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)]) -], [ +AS_VAR_IF([with_readline], [no], [ AC_MSG_RESULT([no]) -]) +], [ + AC_MSG_RESULT([$with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)]) -AS_VAR_IF([py_cv_lib_readline], [yes], [ WITH_SAVE_ENV([ CPPFLAGS="$READLINE_CFLAGS $CFLAGS" LIBS="$READLINE_LIBS $LIBS" + LIBS_SAVE=$LIBS # check for readline 2.2 - AC_CHECK_DECL(rl_completion_append_character, - AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1, - [Define if you have readline 2.2]),, - [ + AC_CHECK_DECL([rl_completion_append_character], [ + AC_DEFINE([HAVE_RL_COMPLETION_APPEND_CHARACTER], [1], [Define if you have readline 2.2]) + ], [], [ #include /* Must be first for Gnu Readline */ #ifdef WITH_EDITLINE # include #else # include #endif - ]) + ]) - AC_CHECK_DECL(rl_completion_suppress_append, - AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1, - [Define if you have rl_completion_suppress_append]),, - [ + AC_CHECK_DECL([rl_completion_suppress_append], [ + AC_DEFINE([HAVE_RL_COMPLETION_SUPPRESS_APPEND], [1], [Define if you have rl_completion_suppress_append]) + ], [], [ #include /* Must be first for Gnu Readline */ #ifdef WITH_EDITLINE # include #else # include #endif - ]) + ]) # check for readline 4.0 - AC_CHECK_LIB($LIBREADLINE, rl_pre_input_hook, - AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, - [Define if you have readline 4.0])) + AC_CHECK_LIB([$LIBREADLINE], [rl_pre_input_hook], [ + AC_DEFINE([HAVE_RL_PRE_INPUT_HOOK], [1], [Define if you have readline 4.0]) + ]) + LIBS=$LIBS_SAVE # also in 4.0 - AC_CHECK_LIB($LIBREADLINE, rl_completion_display_matches_hook, - AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1, - [Define if you have readline 4.0])) + AC_CHECK_LIB([$LIBREADLINE], [rl_completion_display_matches_hook], [ + AC_DEFINE([HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK], [1], [Define if you have readline 4.0]) + ]) + LIBS=$LIBS_SAVE # also in 4.0, but not in editline - AC_CHECK_LIB($LIBREADLINE, rl_resize_terminal, - AC_DEFINE(HAVE_RL_RESIZE_TERMINAL, 1, - [Define if you have readline 4.0])) + AC_CHECK_LIB([$LIBREADLINE], [rl_resize_terminal], [ + AC_DEFINE([HAVE_RL_RESIZE_TERMINAL], [1], [Define if you have readline 4.0]) + ]) + LIBS=$LIBS_SAVE # check for readline 4.2 - AC_CHECK_LIB($LIBREADLINE, rl_completion_matches, - AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, - [Define if you have readline 4.2])) + AC_CHECK_LIB([$LIBREADLINE], [rl_completion_matches], [ + AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], [1], [Define if you have readline 4.2]) + ]) + LIBS=$LIBS_SAVE # also in readline 4.2 - AC_CHECK_DECL(rl_catch_signals, - AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1, - [Define if you can turn off readline's signal handling.]),, - [ + AC_CHECK_DECL([rl_catch_signals], [ + AC_DEFINE([HAVE_RL_CATCH_SIGNAL], [1], [Define if you can turn off readline's signal handling.]) + ], [], [ #include /* Must be first for Gnu Readline */ #ifdef WITH_EDITLINE # include #else # include #endif - ]) + ]) - AC_CHECK_LIB($LIBREADLINE, append_history, - AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1, - [Define if readline supports append_history])) + AC_CHECK_LIB([$LIBREADLINE], [append_history], [ + AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history]) + ]) + LIBS=$LIBS_SAVE ])dnl WITH_SAVE_ENV() ]) @@ -7144,7 +7140,7 @@ PY_STDLIB_MOD([nis], [], [test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes], [$LIBNSL_CFLAGS], [$LIBNSL_LIBS]) PY_STDLIB_MOD([readline], - [], [test "$py_cv_lib_readline" = "yes"], + [], [test "$with_readline" != "no"], [$READLINE_CFLAGS], [$READLINE_LIBS]) PY_STDLIB_MOD([_sqlite3], [test "$have_sqlite3" = "yes"], From 550d323e3830ba522f9cb06b98dae2656054f826 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 1 Jul 2022 22:21:16 +0200 Subject: [PATCH 5/7] Consolidate readline_includes Co-authored-by: Erlend Egeberg Aasland --- configure.ac | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index 49b4b248950899..708c6bc5e6467c 100644 --- a/configure.ac +++ b/configure.ac @@ -5860,29 +5860,22 @@ AS_VAR_IF([with_readline], [no], [ CPPFLAGS="$READLINE_CFLAGS $CFLAGS" LIBS="$READLINE_LIBS $LIBS" LIBS_SAVE=$LIBS - - # check for readline 2.2 - AC_CHECK_DECL([rl_completion_append_character], [ - AC_DEFINE([HAVE_RL_COMPLETION_APPEND_CHARACTER], [1], [Define if you have readline 2.2]) - ], [], [ + m4_define([readline_includes], [ #include /* Must be first for Gnu Readline */ #ifdef WITH_EDITLINE # include #else # include #endif - ]) + ] + # check for readline 2.2 + AC_CHECK_DECL([rl_completion_append_character], [ + AC_DEFINE([HAVE_RL_COMPLETION_APPEND_CHARACTER], [1], [Define if you have readline 2.2]) + ], [], [readline_includes]) AC_CHECK_DECL([rl_completion_suppress_append], [ AC_DEFINE([HAVE_RL_COMPLETION_SUPPRESS_APPEND], [1], [Define if you have rl_completion_suppress_append]) - ], [], [ - #include /* Must be first for Gnu Readline */ - #ifdef WITH_EDITLINE - # include - #else - # include - #endif - ]) + ], [], [readline_includes]) # check for readline 4.0 AC_CHECK_LIB([$LIBREADLINE], [rl_pre_input_hook], [ @@ -5911,20 +5904,14 @@ AS_VAR_IF([with_readline], [no], [ # also in readline 4.2 AC_CHECK_DECL([rl_catch_signals], [ AC_DEFINE([HAVE_RL_CATCH_SIGNAL], [1], [Define if you can turn off readline's signal handling.]) - ], [], [ - #include /* Must be first for Gnu Readline */ - #ifdef WITH_EDITLINE - # include - #else - # include - #endif - ]) + ], [], [readline_includes]) AC_CHECK_LIB([$LIBREADLINE], [append_history], [ AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history]) ]) LIBS=$LIBS_SAVE + m4_undefine([readline_includes]) ])dnl WITH_SAVE_ENV() ]) From 64bba74789781fe695fff23ac8d0a0cc712d6cbe Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 1 Jul 2022 22:32:02 +0200 Subject: [PATCH 6/7] Regenerate configure, add missing ) --- configure | 6 ++++++ configure.ac | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 059e016cd5e306..9c0ac2f36267e4 100755 --- a/configure +++ b/configure @@ -21053,6 +21053,8 @@ save_LIBS=$LIBS LIBS="$READLINE_LIBS $LIBS" LIBS_SAVE=$LIBS + + # check for readline 2.2 ac_fn_c_check_decl "$LINENO" "rl_completion_append_character" "ac_cv_have_decl_rl_completion_append_character" " #include /* Must be first for Gnu Readline */ @@ -21060,6 +21062,7 @@ save_LIBS=$LIBS # include #else # include + # include #endif " @@ -21078,6 +21081,7 @@ fi # include #else # include + # include #endif " @@ -21293,6 +21297,7 @@ fi # include #else # include + # include #endif " @@ -21354,6 +21359,7 @@ fi LIBS=$LIBS_SAVE + CFLAGS=$save_CFLAGS CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS diff --git a/configure.ac b/configure.ac index 708c6bc5e6467c..9005b31abeecdc 100644 --- a/configure.ac +++ b/configure.ac @@ -5860,14 +5860,17 @@ AS_VAR_IF([with_readline], [no], [ CPPFLAGS="$READLINE_CFLAGS $CFLAGS" LIBS="$READLINE_LIBS $LIBS" LIBS_SAVE=$LIBS + m4_define([readline_includes], [ #include /* Must be first for Gnu Readline */ #ifdef WITH_EDITLINE # include #else # include + # include #endif - ] + ]) + # check for readline 2.2 AC_CHECK_DECL([rl_completion_append_character], [ AC_DEFINE([HAVE_RL_COMPLETION_APPEND_CHARACTER], [1], [Define if you have readline 2.2]) From 96d60d9fc89b1abfb60baaf3250a3dfd0a5ce910 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 1 Jul 2022 23:17:55 +0200 Subject: [PATCH 7/7] Use AC_LINK_IFELSE instead of AC_CHECK_LIB --- configure | 216 ++++++++++++++++++++++++--------------------------- configure.ac | 46 ++++++++--- 2 files changed, 137 insertions(+), 125 deletions(-) diff --git a/configure b/configure index 9c0ac2f36267e4..38481eea8475ec 100755 --- a/configure +++ b/configure @@ -21031,6 +21031,7 @@ fi fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link readline" >&5 $as_echo_n "checking how to link readline... " >&6; } if test "x$with_readline" = xno; then : @@ -21095,45 +21096,44 @@ fi # check for readline 4.0 - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_pre_input_hook" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -l$LIBREADLINE" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -l$LIBREADLINE" >&5 $as_echo_n "checking for rl_pre_input_hook in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : +if ${ac_cv_readline_rl_pre_input_hook+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + 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. */ -#ifdef __cplusplus -extern "C" -#endif -char rl_pre_input_hook (); + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #endif + int main () { -return rl_pre_input_hook (); +void *x = rl_pre_input_hook ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_readline_rl_pre_input_hook=yes else - eval "$as_ac_Lib=no" + ac_cv_readline_rl_pre_input_hook=no + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_readline_rl_pre_input_hook" >&5 +$as_echo "$ac_cv_readline_rl_pre_input_hook" >&6; } + if test "x$ac_cv_readline_rl_pre_input_hook" = xyes; then : $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h @@ -21141,48 +21141,45 @@ $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h fi - LIBS=$LIBS_SAVE - # also in 4.0 - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_display_matches_hook" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -l$LIBREADLINE" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -l$LIBREADLINE" >&5 $as_echo_n "checking for rl_completion_display_matches_hook in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : +if ${ac_cv_readline_rl_completion_display_matches_hook+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + 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. */ -#ifdef __cplusplus -extern "C" -#endif -char rl_completion_display_matches_hook (); + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #endif + int main () { -return rl_completion_display_matches_hook (); +void *x = rl_completion_display_matches_hook ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_readline_rl_completion_display_matches_hook=yes else - eval "$as_ac_Lib=no" + ac_cv_readline_rl_completion_display_matches_hook=no + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_readline_rl_completion_display_matches_hook" >&5 +$as_echo "$ac_cv_readline_rl_completion_display_matches_hook" >&6; } + if test "x$ac_cv_readline_rl_completion_display_matches_hook" = xyes; then : $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h @@ -21190,48 +21187,45 @@ $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h fi - LIBS=$LIBS_SAVE - # also in 4.0, but not in editline - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_resize_terminal" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -l$LIBREADLINE" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_resize_terminal in -l$LIBREADLINE" >&5 $as_echo_n "checking for rl_resize_terminal in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : +if ${ac_cv_readline_rl_resize_terminal+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + 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. */ -#ifdef __cplusplus -extern "C" -#endif -char rl_resize_terminal (); + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #endif + int main () { -return rl_resize_terminal (); +void *x = rl_resize_terminal ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_readline_rl_resize_terminal=yes else - eval "$as_ac_Lib=no" + ac_cv_readline_rl_resize_terminal=no + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_readline_rl_resize_terminal" >&5 +$as_echo "$ac_cv_readline_rl_resize_terminal" >&6; } + if test "x$ac_cv_readline_rl_resize_terminal" = xyes; then : $as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h @@ -21239,48 +21233,45 @@ $as_echo "#define HAVE_RL_RESIZE_TERMINAL 1" >>confdefs.h fi - LIBS=$LIBS_SAVE - # check for readline 4.2 - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_rl_completion_matches" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -l$LIBREADLINE" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -l$LIBREADLINE" >&5 $as_echo_n "checking for rl_completion_matches in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : +if ${ac_cv_readline_rl_completion_matches+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + 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. */ -#ifdef __cplusplus -extern "C" -#endif -char rl_completion_matches (); + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #endif + int main () { -return rl_completion_matches (); +void *x = rl_completion_matches ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_readline_rl_completion_matches=yes else - eval "$as_ac_Lib=no" + ac_cv_readline_rl_completion_matches=no + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_readline_rl_completion_matches" >&5 +$as_echo "$ac_cv_readline_rl_completion_matches" >&6; } + if test "x$ac_cv_readline_rl_completion_matches" = xyes; then : $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h @@ -21288,8 +21279,6 @@ $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h fi - LIBS=$LIBS_SAVE - # also in readline 4.2 ac_fn_c_check_decl "$LINENO" "rl_catch_signals" "ac_cv_have_decl_rl_catch_signals" " #include /* Must be first for Gnu Readline */ @@ -21310,45 +21299,44 @@ $as_echo "#define HAVE_RL_CATCH_SIGNAL 1" >>confdefs.h fi - as_ac_Lib=`$as_echo "ac_cv_lib_$LIBREADLINE''_append_history" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -l$LIBREADLINE" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for append_history in -l$LIBREADLINE" >&5 $as_echo_n "checking for append_history in -l$LIBREADLINE... " >&6; } -if eval \${$as_ac_Lib+:} false; then : +if ${ac_cv_readline_append_history+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$LIBREADLINE $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + 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. */ -#ifdef __cplusplus -extern "C" -#endif -char append_history (); + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #endif + int main () { -return append_history (); +void *x = append_history ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_readline_append_history=yes else - eval "$as_ac_Lib=no" + ac_cv_readline_append_history=no + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_readline_append_history" >&5 +$as_echo "$ac_cv_readline_append_history" >&6; } + if test "x$ac_cv_readline_append_history" = xyes; then : $as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h @@ -21356,8 +21344,6 @@ $as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h fi - LIBS=$LIBS_SAVE - CFLAGS=$save_CFLAGS diff --git a/configure.ac b/configure.ac index 9005b31abeecdc..42e181bca9dace 100644 --- a/configure.ac +++ b/configure.ac @@ -5850,6 +5850,7 @@ AS_VAR_IF([with_readline], [edit], [ ]) ]) + AC_MSG_CHECKING([how to link readline]) AS_VAR_IF([with_readline], [no], [ AC_MSG_RESULT([no]) @@ -5881,38 +5882,63 @@ AS_VAR_IF([with_readline], [no], [ ], [], [readline_includes]) # check for readline 4.0 - AC_CHECK_LIB([$LIBREADLINE], [rl_pre_input_hook], [ + AC_CACHE_CHECK([for rl_pre_input_hook in -l$LIBREADLINE], [ac_cv_readline_rl_pre_input_hook], [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([readline_includes], [void *x = rl_pre_input_hook])], + [ac_cv_readline_rl_pre_input_hook=yes], [ac_cv_readline_rl_pre_input_hook=no] + ) + ]) + AS_VAR_IF([ac_cv_readline_rl_pre_input_hook], [yes], [ AC_DEFINE([HAVE_RL_PRE_INPUT_HOOK], [1], [Define if you have readline 4.0]) ]) - LIBS=$LIBS_SAVE # also in 4.0 - AC_CHECK_LIB([$LIBREADLINE], [rl_completion_display_matches_hook], [ + AC_CACHE_CHECK([for rl_completion_display_matches_hook in -l$LIBREADLINE], [ac_cv_readline_rl_completion_display_matches_hook], [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([readline_includes], [void *x = rl_completion_display_matches_hook])], + [ac_cv_readline_rl_completion_display_matches_hook=yes], [ac_cv_readline_rl_completion_display_matches_hook=no] + ) + ]) + AS_VAR_IF([ac_cv_readline_rl_completion_display_matches_hook], [yes], [ AC_DEFINE([HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK], [1], [Define if you have readline 4.0]) ]) - LIBS=$LIBS_SAVE # also in 4.0, but not in editline - AC_CHECK_LIB([$LIBREADLINE], [rl_resize_terminal], [ + AC_CACHE_CHECK([for rl_resize_terminal in -l$LIBREADLINE], [ac_cv_readline_rl_resize_terminal], [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([readline_includes], [void *x = rl_resize_terminal])], + [ac_cv_readline_rl_resize_terminal=yes], [ac_cv_readline_rl_resize_terminal=no] + ) + ]) + AS_VAR_IF([ac_cv_readline_rl_resize_terminal], [yes], [ AC_DEFINE([HAVE_RL_RESIZE_TERMINAL], [1], [Define if you have readline 4.0]) ]) - LIBS=$LIBS_SAVE # check for readline 4.2 - AC_CHECK_LIB([$LIBREADLINE], [rl_completion_matches], [ + AC_CACHE_CHECK([for rl_completion_matches in -l$LIBREADLINE], [ac_cv_readline_rl_completion_matches], [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([readline_includes], [void *x = rl_completion_matches])], + [ac_cv_readline_rl_completion_matches=yes], [ac_cv_readline_rl_completion_matches=no] + ) + ]) + AS_VAR_IF([ac_cv_readline_rl_completion_matches], [yes], [ AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], [1], [Define if you have readline 4.2]) ]) - LIBS=$LIBS_SAVE # also in readline 4.2 AC_CHECK_DECL([rl_catch_signals], [ AC_DEFINE([HAVE_RL_CATCH_SIGNAL], [1], [Define if you can turn off readline's signal handling.]) ], [], [readline_includes]) - AC_CHECK_LIB([$LIBREADLINE], [append_history], [ + AC_CACHE_CHECK([for append_history in -l$LIBREADLINE], [ac_cv_readline_append_history], [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([readline_includes], [void *x = append_history])], + [ac_cv_readline_append_history=yes], [ac_cv_readline_append_history=no] + ) + ]) + AS_VAR_IF([ac_cv_readline_append_history], [yes], [ AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history]) ]) - LIBS=$LIBS_SAVE m4_undefine([readline_includes]) ])dnl WITH_SAVE_ENV() 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