Skip to content

Commit 6e1d20c

Browse files
authored
Wrap sched_getcpu AC_RUN_IFELSE check in AC_CACHE_CHECK (#14336)
For cross-compiling configuration, this wraps the check with the php_cv_func_sched_getcpu variable.
1 parent 8cf8751 commit 6e1d20c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

ext/pcntl/config.m4

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,21 @@ if test "$PHP_PCNTL" != "no"; then
2525
]))
2626

2727
dnl if unsupported, -1 means automatically ENOSYS in this context
28-
AC_MSG_CHECKING([if sched_getcpu is supported])
29-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
28+
AC_CACHE_CHECK([if sched_getcpu is supported], [php_cv_func_sched_getcpu],
29+
[AC_RUN_IFELSE([AC_LANG_SOURCE([
3030
#include <sched.h>
3131
int main(void) {
3232
if (sched_getcpu() == -1) {
3333
return 1;
3434
}
3535
return 0;
3636
}
37-
]])],[
38-
AC_MSG_RESULT(yes)
39-
AC_DEFINE([HAVE_SCHED_GETCPU],1,[Whether sched_getcpu is properly supported])
40-
],[
41-
AC_MSG_RESULT(no)
42-
],[
43-
AC_MSG_RESULT([no, cross-compiling])
44-
])
37+
])],
38+
[php_cv_func_sched_getcpu=yes],
39+
[php_cv_func_sched_getcpu=no],
40+
[php_cv_func_sched_getcpu=no])])
41+
AS_VAR_IF([php_cv_func_sched_getcpu], [yes],
42+
[AC_DEFINE([HAVE_SCHED_GETCPU], [1], [Whether sched_getcpu is properly supported])])
4543

4644
AC_CHECK_TYPE([siginfo_t],[PCNTL_CFLAGS="-DHAVE_STRUCT_SIGINFO_T"],,[#include <signal.h>])
4745

0 commit comments

Comments
 (0)