From abe7c4733f104199006000a30f62db8640278ebf Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 8 Oct 2022 03:55:17 +0300 Subject: [PATCH 37/37] configure: Add cache variable for readline runtime detection See osdn #45460 Signed-off-by: Marko Lindqvist --- m4/readline.m4 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/m4/readline.m4 b/m4/readline.m4 index 5124d8dd47..90326b4483 100644 --- a/m4/readline.m4 +++ b/m4/readline.m4 @@ -8,10 +8,11 @@ dnl to included -lreadline and parameter EXTRA-LIBS. dnl Should already have checked that header and library exist. dnl AC_DEFUN([FC_CHECK_READLINE_RUNTIME], -[AC_MSG_CHECKING([whether readline works at runtime]) -templibs="$LIBS" +[templibs="$LIBS" LIBS="-lreadline $1 $LIBS" -AC_RUN_IFELSE([AC_LANG_SOURCE([[ +AC_CACHE_CHECK([whether readline works at runtime], + [ac_cv_lib_working_readline], +[AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* * testrl.c * File revision 0 @@ -48,12 +49,20 @@ int main(void) { rl_callback_handler_remove(); /* needed to re-set terminal */ return(0); } -]])],[AC_MSG_RESULT(yes) - [$2]],[AC_MSG_RESULT(no) - [$3]],[AC_MSG_RESULT(unknown: cross-compiling) - [$2]]) +]])],[ac_cv_lib_working_readline=yes], + [ac_cv_lib_working_readline=no], + [dnl Assuming "yes" when cross-compiling + ac_cv_lib_working_readline=yes]) LIBS="$templibs" ]) +if test "$ac_cv_lib_working_readline" = "yes" ; then + [$2] + : +else + [$3] + : +fi +]) AC_DEFUN([FC_HAS_READLINE], [ -- 2.35.1