Skip to content

Add cross-compiling argument to AC_RUN_IFELSE #12966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add cross-compiling 3rd argument to AC_RUN_IFELSE
Autotools emits warning if 3rd argument is empty. Call is wrapped in the
AC_CACHE_CHECK with php_cv_* cache variable name according to the docs.
  • Loading branch information
petk committed Dec 22, 2023
commit bcab663f17f70aa59891dcfdb05b50522dd2d928
5 changes: 3 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1586,15 +1586,16 @@ if test "$PHP_UNDEFINED_SANITIZER" = "yes"; then
dnl cast to void*. In that case, set -fno-sanitize=function.
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-sanitize-recover=undefined"
AC_CACHE_CHECK([whether to add -fno-sanitize=function],[php_cv_ubsan_no_function],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
void foo(char *string) {}
int main(void) {
void (*f)(void *) = (void (*)(void *))foo;
f("foo");
}
]])],,[ubsan_needs_no_function=yes],)
]])],[php_cv_ubsan_no_function=no],[php_cv_ubsan_no_function=yes],[php_cv_ubsan_no_function=no])])
CFLAGS="$OLD_CFLAGS"
if test "$ubsan_needs_no_function" = yes; then
if test "$php_cv_ubsan_no_function" = yes; then
CFLAGS="$CFLAGS -fno-sanitize=function"
CXXFLAGS="$CFLAGS -fno-sanitize=function"
fi
Expand Down