Skip to content

Commit 75033c0

Browse files
authored
Wrap Zend stack limit check in AC_CACHE_CHECK (#14437)
The php_cv_have_stack_limit cache variable enables cross-compiling edge cases to override the check manually.
1 parent ca55603 commit 75033c0

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Zend/Zend.m4

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ AC_CHECK_FUNCS([sigsetjmp],,
159159
160160
dnl Test whether the stack grows downwards
161161
dnl Assumes contiguous stack
162-
AC_MSG_CHECKING(whether the stack grows downwards)
163-
164-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
162+
AC_CACHE_CHECK([whether the stack grows downwards], [php_cv_have_stack_limit],
163+
[AC_RUN_IFELSE([AC_LANG_SOURCE([
165164
#include <stdint.h>
166165
167166
int (*volatile f)(uintptr_t);
@@ -177,14 +176,13 @@ int main(void) {
177176
f = stack_grows_downwards;
178177
return f((uintptr_t)&local) ? 0 : 1;
179178
}
180-
]])], [
181-
AC_DEFINE([ZEND_CHECK_STACK_LIMIT], 1, [Define if checking the stack limit is supported])
182-
AC_MSG_RESULT(yes)
183-
], [
184-
AC_MSG_RESULT(no)
185-
], [
186-
AC_MSG_RESULT(no)
187-
])
179+
])],
180+
[php_cv_have_stack_limit=yes],
181+
[php_cv_have_stack_limit=no],
182+
[php_cv_have_stack_limit=no])])
183+
AS_VAR_IF([php_cv_have_stack_limit], [yes],
184+
[AC_DEFINE([ZEND_CHECK_STACK_LIMIT], [1],
185+
[Define to 1 if checking the stack limit is supported.])])
188186
189187
ZEND_CHECK_FLOAT_PRECISION
190188
])

0 commit comments

Comments
 (0)