From 6e3282fe3893a42eb9c5cc4eba5387a3be4e8d10 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 28 Jun 2022 17:10:53 -0500 Subject: [PATCH] Refactor recent AC_FUNC_ALLOCA fix * lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Simplify and use AS_IF. Had I done it this way originally I would have avoided the bug that Jim just fixed. --- lib/autoconf/functions.m4 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 51aeb0b9..70eb8760 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -426,10 +426,9 @@ if test $ac_cv_working_alloca_h = yes; then fi AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works, -[if test $ac_cv_working_alloca_h = yes; then - ac_cv_func_alloca_works=yes -else - AC_LINK_IFELSE([AC_LANG_PROGRAM( +[ac_cv_func_alloca_works=$ac_cv_working_alloca_h +AS_IF([test "$ac_cv_func_alloca_works" != yes], + [AC_LINK_IFELSE([AC_LANG_PROGRAM( [[#include #include #ifndef alloca @@ -447,11 +446,7 @@ void *alloca (size_t); #endif ]], [[char *p = (char *) alloca (1); if (p) return 0;]])], - [ac_cv_func_alloca_works=yes], - [ac_cv_func_alloca_works=no] - ) -fi -]) + [ac_cv_func_alloca_works=yes])])]) if test $ac_cv_func_alloca_works = yes; then AC_DEFINE(HAVE_ALLOCA, 1, -- 2.36.1