]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Refactor recent AC_FUNC_ALLOCA fix
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Jun 2022 22:10:53 +0000 (17:10 -0500)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 28 Jun 2022 23:27:40 +0000 (18:27 -0500)
* 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

index 51aeb0b9273e384ea6e4a502bed6373e32dc7590..70eb876089a12b12f89fa500028264419aa5d1e0 100644 (file)
@@ -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 <stdlib.h>
 #include <stddef.h>
 #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,