diff --git a/CHANGES b/CHANGES index 25767e1c93..04a6c91376 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +4106. [port] Improve readline support. [RT #38938] + 4105. [port] Misc fixes for Microsoft Visual Studio 2015 CTP6 in 64 bit mode. [RT #39308] diff --git a/configure b/configure index ee02173b3d..4076a57875 100755 --- a/configure +++ b/configure @@ -1729,7 +1729,7 @@ Optional Packages: --with-purify=PATH use Rational purify --with-gperftools-profiler use gperftools CPU profiler --with-kame=PATH use Kame IPv6 default path /usr/local/v6 - --with-readline=LIBSPEC specify readline library default -lreadline + --with-readline=LIBSPEC specify readline library default auto --with-docbook-xsl=PATH specify path for Docbook-XSL stylesheets --with-idn=MPREFIX enable IDN support using idnkit default PREFIX @@ -18515,18 +18515,69 @@ fi if test "${with_readline+set}" = set; then : withval=$with_readline; readline="$withval" else - readline="-lreadline" + readline="auto" fi case "$readline" in no) ;; +yes|auto) + saved_LIBS="$LIBS" + for readline in -ledit -lreadline + do + LIBS="$readline" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline with $readline" >&5 +$as_echo "$as_me: checking for readline with $readline" >&6;} + for ac_func in readline +do : + ac_fn_c_check_func "$LINENO" "readline" "ac_cv_func_readline" +if test "x$ac_cv_func_readline" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_READLINE 1 +_ACEOF + +fi +done + + if test "$ac_cv_func_readline" = "yes" + then + READLINE_LIB="$readline" + break + fi + if test "X$readline" = "X" + then + continue + fi + for lib in -lterminfo -ltermcap -lncurses -lcurses + do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline with $readline $lib" >&5 +$as_echo "$as_me: checking for readline with $readline $lib" >&6;} + unset ac_cv_func_readline + LIBS="$readline $lib" + for ac_func in readline +do : + ac_fn_c_check_func "$LINENO" "readline" "ac_cv_func_readline" +if test "x$ac_cv_func_readline" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_READLINE 1 +_ACEOF + +fi +done + + if test "$ac_cv_func_readline" = "yes" + then + READLINE_LIB="$readline $lib" + break + fi + done + done + LIBS="$saved_LIBS" + ;; *) - if test "x$readline" = "xyes" - then - readline=-lreadline - fi saved_LIBS="$LIBS" LIBS="$readline" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline with $readline" >&5 +$as_echo "$as_me: checking for readline with $readline" >&6;} for ac_func in readline do : ac_fn_c_check_func "$LINENO" "readline" "ac_cv_func_readline" @@ -18541,12 +18592,35 @@ done if test "$ac_cv_func_readline" = "yes" then READLINE_LIB="$readline" + else + for lib in -lterminfo -ltermcap -lncurses -lcurses + do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline with $readline $lib" >&5 +$as_echo "$as_me: checking for readline with $readline $lib" >&6;} + unset ac_cv_func_readline + LIBS="$readline $lib" + for ac_func in readline +do : + ac_fn_c_check_func "$LINENO" "readline" "ac_cv_func_readline" +if test "x$ac_cv_func_readline" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_READLINE 1 +_ACEOF + +fi +done + + if test "$ac_cv_func_readline" = "yes" + then + READLINE_LIB="$readline $lib" + break + fi + done fi LIBS="$saved_LIBS" ;; esac - ISC_PRINT_OBJS= ISC_PRINT_SRCS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking sprintf" >&5 diff --git a/configure.in b/configure.in index 80a8231761..24324da577 100644 --- a/configure.in +++ b/configure.in @@ -3185,27 +3185,67 @@ AC_SUBST(ISC_PLATFORM_NEEDSTRCASESTR) AC_SUBST(READLINE_LIB) AC_ARG_WITH(readline, - [ --with-readline[=LIBSPEC] specify readline library [default -lreadline]], - readline="$withval", readline="-lreadline") + [ --with-readline[=LIBSPEC] specify readline library [default auto]], + readline="$withval", readline="auto") case "$readline" in no) ;; +yes|auto) + saved_LIBS="$LIBS" + for readline in -ledit -lreadline + do + LIBS="$readline" + AC_MSG_NOTICE(checking for readline with $readline) + AC_CHECK_FUNCS(readline) + if test "$ac_cv_func_readline" = "yes" + then + READLINE_LIB="$readline" + break + fi + if test "X$readline" = "X" + then + continue + fi + for lib in -lterminfo -ltermcap -lncurses -lcurses + do + AC_MSG_NOTICE(checking for readline with $readline $lib) + unset ac_cv_func_readline + LIBS="$readline $lib" + AC_CHECK_FUNCS(readline) + if test "$ac_cv_func_readline" = "yes" + then + READLINE_LIB="$readline $lib" + break + fi + done + done + LIBS="$saved_LIBS" + ;; *) - if test "x$readline" = "xyes" - then - readline=-lreadline - fi saved_LIBS="$LIBS" LIBS="$readline" + AC_MSG_NOTICE(checking for readline with $readline) AC_CHECK_FUNCS(readline) if test "$ac_cv_func_readline" = "yes" then READLINE_LIB="$readline" + else + for lib in -lterminfo -ltermcap -lncurses -lcurses + do + AC_MSG_NOTICE(checking for readline with $readline $lib) + unset ac_cv_func_readline + LIBS="$readline $lib" + AC_CHECK_FUNCS(readline) + if test "$ac_cv_func_readline" = "yes" + then + READLINE_LIB="$readline $lib" + break + fi + done fi LIBS="$saved_LIBS" ;; esac - ISC_PRINT_OBJS= ISC_PRINT_SRCS= AC_MSG_CHECKING(sprintf)