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..90a2dd486c1956 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2022-06-30-17-18-23.gh-issue-90005.EIOOla.rst @@ -0,0 +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. Workaround for missing ``termcap`` or ``tinfo`` library +has been removed. 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..38481eea8475ec 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 @@ -20497,48 +20533,114 @@ $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; + 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=yes + with_readline=readline + 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 "x$with_readline" = xreadline; then : -if test "$with_readline" != no; then - case "$with_readline" in - editline|edit) - LIBREADLINE=edit -$as_echo "#define WITH_EDITLINE 1" >>confdefs.h +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBREADLINE" >&5 +$as_echo_n "checking for LIBREADLINE... " >&6; } - ;; - yes|readline) - LIBREADLINE=readline - ;; - *) - as_fn_error $? "proper usage is --with(out)-readline[=editline]" "$LINENO" 5 - ;; - esac +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\""; } >&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" 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\""; } >&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" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi - # 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 + + +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" 2>&1` + else + 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 +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 + + + { $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 +LIBS="-lreadline $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -20557,71 +20659,68 @@ return readline (); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - py_cv_lib_readline=yes + ac_cv_lib_readline_readline=yes +else + ac_cv_lib_readline_readline=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_readline" >&5 +$as_echo "$ac_cv_lib_readline_readline" >&6; } +if test "x$ac_cv_lib_readline_readline" = 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; } + LIBREADLINE=readline + READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} + +else -$as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h + with_readline=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 + with_readline=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 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 -LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" +LIBS="-lreadline $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20631,43 +20730,150 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_pre_input_hook (); +char readline (); int main () { -return rl_pre_input_hook (); +return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_lib_readline_readline=yes else - eval "$as_ac_Lib=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 -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_readline" >&5 +$as_echo "$ac_cv_lib_readline_readline" >&6; } +if test "x$ac_cv_lib_readline_readline" = xyes; then : -$as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h + LIBREADLINE=readline + READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} + +else + + with_readline=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 : +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + + +else + with_readline=no +fi + +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; } + + 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 +$as_echo_n "checking for LIBEDIT... " >&6; } + +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 + pkg_failed=yes +fi + 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 + + + +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 + + + { $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 -LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" +LIBS="-ledit $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20677,43 +20883,80 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_completion_display_matches_hook (); +char readline (); int main () { -return rl_completion_display_matches_hook (); +return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_lib_edit_readline=yes else - eval "$as_ac_Lib=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 -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_readline" >&5 +$as_echo "$ac_cv_lib_edit_readline" >&6; } +if test "x$ac_cv_lib_edit_readline" = xyes; then : -$as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h + LIBREADLINE=edit + $as_echo "#define WITH_EDITLINE 1" >>confdefs.h + + READLINE_CFLAGS=${LIBEDIT_CFLAGS-""} + READLINE_LIBS=${LIBEDIT_LIBS-"-ledit"} + +else + + with_readline=no 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 : +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + + +else + with_readline=no +fi + +done + + +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 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 -LIBS="-l$LIBREADLINE $READLINE_LIBS $LIBS" +LIBS="-ledit $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20723,145 +20966,393 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_resize_terminal (); +char readline (); int main () { -return rl_resize_terminal (); +return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" + ac_cv_lib_edit_readline=yes else - eval "$as_ac_Lib=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 -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 +{ $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 : -fi + LIBREADLINE=edit + $as_echo "#define WITH_EDITLINE 1" >>confdefs.h + READLINE_CFLAGS=${LIBEDIT_CFLAGS-""} + READLINE_LIBS=${LIBEDIT_LIBS-"-ledit"} - # 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 $READLINE_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char rl_completion_matches (); + with_readline=no + +fi + + +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + + +else + with_readline=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; } + + $as_echo "#define WITH_EDITLINE 1" >>confdefs.h + + 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$with_readline" = 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: $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 +save_LDFLAGS=$LDFLAGS +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" " + #include /* Must be first for Gnu Readline */ + #ifdef WITH_EDITLINE + # include + #else + # include + # include + #endif + +" +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 + + + 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 + # include + #endif + +" +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 + + + # check for readline 4.0 + { $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 ${ac_cv_readline_rl_pre_input_hook+:} false; then : + $as_echo_n "(cached) " >&6 +else + + 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 () { -return rl_completion_matches (); +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 -$as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h fi + # also in 4.0 + { $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 ${ac_cv_readline_rl_completion_display_matches_hook+:} false; then : + $as_echo_n "(cached) " >&6 +else - # 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 + 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 () +{ +void *x = rl_completion_display_matches_hook + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_readline_rl_completion_display_matches_hook=yes +else + ac_cv_readline_rl_completion_display_matches_hook=no + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $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 + + +fi + + # also in 4.0, but not in editline + { $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 ${ac_cv_readline_rl_resize_terminal+:} false; then : + $as_echo_n "(cached) " >&6 +else + + 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 () +{ +void *x = rl_resize_terminal + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_readline_rl_resize_terminal=yes +else + ac_cv_readline_rl_resize_terminal=no + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $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 + + +fi + + # check for readline 4.2 + { $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 ${ac_cv_readline_rl_completion_matches+:} false; then : + $as_echo_n "(cached) " >&6 +else + + 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 () +{ +void *x = rl_completion_matches + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_readline_rl_completion_matches=yes +else + ac_cv_readline_rl_completion_matches=no + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $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 + + +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 + # include + #endif " if test "x$ac_cv_have_decl_rl_catch_signals" = xyes; then : + $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 $READLINE_LIBS $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 -fi fi -# End of readline checks: restore LIBS -LIBS=$LIBS_no_readline + + +CFLAGS=$save_CFLAGS +CPPFLAGS=$save_CPPFLAGS +LDFLAGS=$save_LDFLAGS +LIBS=$save_LIBS + + +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken nice()" >&5 $as_echo_n "checking for broken nice()... " >&6; } @@ -21003,145 +21494,989 @@ int main() exit(1); #endif - putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); - tzset(); - if (localtime(&groundhogday)->tm_hour != 19) - exit(1); -#if HAVE_TZNAME - if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT")) - exit(1); -#endif + putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); + tzset(); + if (localtime(&groundhogday)->tm_hour != 19) + exit(1); +#if HAVE_TZNAME + if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT")) + 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 : + + if test "$ac_sys_system" != "Darwin"; 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 + 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 +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" + $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; } +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 : + 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 "$ac_sys_system" != "Darwin"; 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 + + + +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=panelw + +fi + +fi + fi - 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 test "x$have_curses" = xncurses; then : -#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); -} +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PANEL" >&5 +$as_echo_n "checking for PANEL... " >&6; } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_working_tzset=yes +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 - ac_cv_working_tzset=no + pkg_failed=yes fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + 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 + + +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 -# 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 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking panel flags" >&5 +$as_echo_n "checking panel flags... " >&6; } +if test "x$have_panel" = xno; then : -done + { $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" +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 +25972,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 +$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 +$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 +26178,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 "$with_readline" != "no"; 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 +27158,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 +27182,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..42e181bca9dace 100644 --- a/configure.ac +++ b/configure.ac @@ -5780,127 +5780,169 @@ 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. pkg-config file is readline.pc +dnl - libedit provides "editline/readline.h" header and "libedit" shared +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. -# 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 +AH_TEMPLATE([WITH_EDITLINE], [Define to build the readline module against libedit.]) -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) +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] +) + +AS_VAR_IF([with_readline], [readline], [ + PKG_CHECK_MODULES([LIBREADLINE], [readline], [ LIBREADLINE=readline - ;; - *) - AC_MSG_ERROR([proper usage is --with(out)-readline@<:@=editline@:>@]) - ;; - esac + READLINE_CFLAGS=$LIBREADLINE_CFLAGS + READLINE_LIBS=$LIBREADLINE_LIBS + ], [ + AC_CHECK_HEADERS([readline/readline.h], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([readline], [readline], [ + LIBREADLINE=readline + READLINE_CFLAGS=${LIBREADLINE_CFLAGS-""} + READLINE_LIBS=${LIBREADLINE_LIBS-"-lreadline"} + ], [ + with_readline=no + ]) + ]) + ], [with_readline=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 +AS_VAR_IF([with_readline], [edit], [ + PKG_CHECK_MODULES([LIBEDIT], [libedit], [ + AC_DEFINE([WITH_EDITLINE], [1]) + LIBREADLINE=edit + READLINE_CFLAGS=$LIBEDIT_CFLAGS + READLINE_LIBS=$LIBEDIT_LIBS + ], [ + AC_CHECK_HEADERS([editline/readline.h], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([edit], [readline], [ + LIBREADLINE=edit + AC_DEFINE([WITH_EDITLINE], [1]) + READLINE_CFLAGS=${LIBEDIT_CFLAGS-""} + READLINE_LIBS=${LIBEDIT_LIBS-"-ledit"} + ], [ + with_readline=no + ]) + ]) + ], [with_readline=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 -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_MSG_CHECKING([how to link readline]) +AS_VAR_IF([with_readline], [no], [ + AC_MSG_RESULT([no]) +], [ + AC_MSG_RESULT([$with_readline (CFLAGS: $READLINE_CFLAGS, LIBS: $READLINE_LIBS)]) + + WITH_SAVE_ENV([ + 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 ]) - 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 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]) + ], [], [readline_includes]) + + # check for readline 4.0 + 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]) ]) - # 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 + # also in 4.0 + 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]) ]) - AC_CHECK_LIB($LIBREADLINE, append_history, - AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1, - [Define if readline supports append_history]),,$READLINE_LIBS) -fi + # also in 4.0, but not in editline + 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]) + ]) -# End of readline checks: restore LIBS -LIBS=$LIBS_no_readline + # check for readline 4.2 + 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]) + ]) + + # 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_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]) + ]) + + m4_undefine([readline_includes]) + ])dnl WITH_SAVE_ENV() +]) AC_CACHE_CHECK([for broken nice()], [ac_cv_broken_nice], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -6056,14 +6098,124 @@ 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], [ + 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], [ + have_curses=ncurses + ], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([ncurses], [initscr], [ + have_curses=ncurses + CURSES_CFLAGS=${CURSES_CFLAGS-""} + CURSES_LIBS=${CURSES_LIBS-"-lncurses"} + ]) + ]) + ]) + ]) + +])dnl ac_cv_header_ncurses_h = yes + +dnl 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. + 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]) +AS_VAR_IF([have_curses], [no], [ + AC_MSG_RESULT([no]) +], [ + AC_MSG_RESULT([$have_curses (CFLAGS: $CURSES_CFLAGS, LIBS: $CURSES_LIBS)]) +]) + +dnl check for ncurses' panel/panelw library +AC_CHECK_HEADERS([panel.h]) + +AS_VAR_IF([ac_cv_header_panel_h], [yes], [ + + if test "$ac_sys_system" != "Darwin"; then + dnl On macOS, there is no separate /usr/lib/libncursesw nor libpanelw. + AS_VAR_IF([have_curses], [ncursesw], [ + PKG_CHECK_MODULES([PANEL], [panelw], [ + have_panel=panelw + ], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([panelw], [update_panels], [ + have_panel=panelw + PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanelw"} + ]) + ]) + ]) + ]) + fi + + AS_VAR_IF([have_curses], [ncurses], [ + PKG_CHECK_MODULES([PANEL], [panel], [ + have_panel=panel + ], [ + WITH_SAVE_ENV([ + AC_CHECK_LIB([panel], [update_panels], [ + have_panel=panel + PANEL_CFLAGS=${PANEL_CFLAGS-""} + PANEL_LIBS=${PANEL_LIBS-"-lpanel"} + ]) + ]) + ]) + ]) + +])dnl ac_cv_header_panel_h = yes + +AC_MSG_CHECKING([panel flags]) +AS_VAR_IF([have_panel], [no], [ + AC_MSG_RESULT([no]) +], [ + AC_MSG_RESULT([$have_panel (CFLAGS: $PANEL_CFLAGS, LIBS: $PANEL_LIBS)]) +]) + # first curses header check ac_save_cppflags="$CPPFLAGS" if test "$cross_compiling" = no; then 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 +7137,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] +) +PY_STDLIB_MOD([_curses_panel], + [], [test "$have_panel" != "no"], + [$PANEL_CFLAGS $CURSES_CFLAGS], [$PANEL_LIBS $CURSES_LIBS] +) PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS]) PY_STDLIB_MOD([_dbm], [test -n "$with_dbmliborder"], [test "$have_dbm" != "no"], @@ -6997,7 +7155,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 "$with_readline" != "no"], + [$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..aa9fc559fa2511 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 @@ -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 */ 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']))