summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-06-28 17:10:53 -0500
committerPaul Eggert <eggert@cs.ucla.edu>2022-06-28 18:27:40 -0500
commit6e3282fe3893a42eb9c5cc4eba5387a3be4e8d10 (patch)
tree92d77f76d9ef8d3cd849bd261d7a21f6544b7426
parent68fac90c09a4a77d9aad730b5939438294c68a43 (diff)
downloadautoconf-6e3282fe3893a42eb9c5cc4eba5387a3be4e8d10.tar.gz
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.
-rw-r--r--lib/autoconf/functions.m413
1 files 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 <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,