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.
This commit is contained in:
Peter Kokot 2024-06-02 20:13:00 +02:00 committed by GitHub
parent ca55603d8a
commit 75033c01c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -159,9 +159,8 @@ AC_CHECK_FUNCS([sigsetjmp],,
dnl Test whether the stack grows downwards dnl Test whether the stack grows downwards
dnl Assumes contiguous stack dnl Assumes contiguous stack
AC_MSG_CHECKING(whether the stack grows downwards) AC_CACHE_CHECK([whether the stack grows downwards], [php_cv_have_stack_limit],
[AC_RUN_IFELSE([AC_LANG_SOURCE([
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdint.h> #include <stdint.h>
int (*volatile f)(uintptr_t); int (*volatile f)(uintptr_t);
@ -177,14 +176,13 @@ int main(void) {
f = stack_grows_downwards; f = stack_grows_downwards;
return f((uintptr_t)&local) ? 0 : 1; return f((uintptr_t)&local) ? 0 : 1;
} }
]])], [ ])],
AC_DEFINE([ZEND_CHECK_STACK_LIMIT], 1, [Define if checking the stack limit is supported]) [php_cv_have_stack_limit=yes],
AC_MSG_RESULT(yes) [php_cv_have_stack_limit=no],
], [ [php_cv_have_stack_limit=no])])
AC_MSG_RESULT(no) AS_VAR_IF([php_cv_have_stack_limit], [yes],
], [ [AC_DEFINE([ZEND_CHECK_STACK_LIMIT], [1],
AC_MSG_RESULT(no) [Define to 1 if checking the stack limit is supported.])])
])
ZEND_CHECK_FLOAT_PRECISION ZEND_CHECK_FLOAT_PRECISION
]) ])