diff --git a/configure b/configure index 0070783033..8dfcfd2b35 100755 --- a/configure +++ b/configure @@ -18781,20 +18781,24 @@ fi # Check whether --with-readline was given. if test "${with_readline+set}" = set; then : - withval=$with_readline; readline="$withval" + withval=$with_readline; use_readline="$withval" else - readline="auto" + use_readline="auto" fi -case "$readline" in +case "$use_readline" in no) ;; -yes|auto) +*) saved_LIBS="$LIBS" - for xreadline in -ledit -lreadline + case "$use_readline" in + yes|auto) try_readline="-ledit"; or_readline="-lreadline" ;; + *) try_readline="$use_readline" + esac + for readline in "$try_readline" $or_readline do - LIBS="$xreadline" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline with $xreadline" >&5 -$as_echo "$as_me: checking for readline with $xreadline" >&6;} + 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" @@ -18808,63 +18812,9 @@ done if test "$ac_cv_func_readline" = "yes" then - READLINE_LIB="$xreadline" + READLINE_LIB="$readline" break fi - for lib in -lterminfo -ltermcap -lncurses -lcurses - do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline with $xreadline $lib" >&5 -$as_echo "$as_me: checking for readline with $xreadline $lib" >&6;} - unset ac_cv_func_readline - LIBS="$xreadline $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="$xreadline $lib" - break - fi - done - if test "$ac_cv_func_readline" = "yes" - then - break - fi - done - if test "X$xreadline" = Xyes -a "$ac_cv_func_readline" != yes - then - as_fn_error $? "The readline library was not found." "$LINENO" 5 - fi - LIBS="$saved_LIBS" - ;; -*) - 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" -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" - else for lib in -lterminfo -ltermcap -lncurses -lcurses do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline with $readline $lib" >&5 @@ -18888,8 +18838,13 @@ done break fi done - fi - if test "$ac_cv_func_readline" != yes + if test "$ac_cv_func_readline" = "yes" + then + break + fi + done + if test "$use_readline" != "auto" && + test "X$READLINE_LIB" = "X" then as_fn_error $? "The readline library was not found." "$LINENO" 5 fi diff --git a/configure.in b/configure.in index f0774bf1e0..044ae91d3b 100644 --- a/configure.in +++ b/configure.in @@ -3327,53 +3327,25 @@ AC_SUBST(ISC_PLATFORM_NEEDSTRCASESTR) AC_SUBST(READLINE_LIB) AC_ARG_WITH(readline, [ --with-readline[=LIBSPEC] specify readline library [default auto]], - readline="$withval", readline="auto") -case "$readline" in + use_readline="$withval", use_readline="auto") +case "$use_readline" in no) ;; -yes|auto) +*) saved_LIBS="$LIBS" - for xreadline in -ledit -lreadline + case "$use_readline" in + yes|auto) try_readline="-ledit"; or_readline="-lreadline" ;; + *) try_readline="$use_readline" + esac + for readline in "$try_readline" $or_readline do - LIBS="$xreadline" - AC_MSG_NOTICE(checking for readline with $xreadline) + LIBS="$readline" + AC_MSG_NOTICE(checking for readline with $readline) AC_CHECK_FUNCS(readline) if test "$ac_cv_func_readline" = "yes" then - READLINE_LIB="$xreadline" + READLINE_LIB="$readline" break fi - for lib in -lterminfo -ltermcap -lncurses -lcurses - do - AC_MSG_NOTICE(checking for readline with $xreadline $lib) - unset ac_cv_func_readline - LIBS="$xreadline $lib" - AC_CHECK_FUNCS(readline) - if test "$ac_cv_func_readline" = "yes" - then - READLINE_LIB="$xreadline $lib" - break - fi - done - if test "$ac_cv_func_readline" = "yes" - then - break - fi - done - if test "X$xreadline" = Xyes -a "$ac_cv_func_readline" != yes - then - AC_MSG_ERROR([The readline library was not found.]) - fi - LIBS="$saved_LIBS" - ;; -*) - 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) @@ -3386,8 +3358,13 @@ yes|auto) break fi done - fi - if test "$ac_cv_func_readline" != yes + if test "$ac_cv_func_readline" = "yes" + then + break + fi + done + if test "$use_readline" != "auto" && + test "X$READLINE_LIB" = "X" then AC_MSG_ERROR([The readline library was not found.]) fi