xref: /php-src/ext/pcntl/config.m4 (revision d4072667)
1PHP_ARG_ENABLE([pcntl],
2  [whether to enable pcntl support],
3  [AS_HELP_STRING([--enable-pcntl],
4    [Enable pcntl support (CLI/CGI only)])])
5
6if test "$PHP_PCNTL" != "no"; then
7  AC_CHECK_FUNCS([fork], [], [AC_MSG_ERROR([pcntl: fork() not supported by this platform])])
8  AC_CHECK_FUNCS([waitpid], [], [AC_MSG_ERROR([pcntl: waitpid() not supported by this platform])])
9  AC_CHECK_FUNCS([sigaction], [], [AC_MSG_ERROR([pcntl: sigaction() not supported by this platform])])
10  AC_CHECK_FUNCS([getpriority setpriority wait3 wait4 sigwaitinfo sigtimedwait unshare rfork forkx pidfd_open sched_setaffinity pthread_set_qos_class_self_np])
11
12  dnl if unsupported, -1 means automatically ENOSYS in this context
13  AC_MSG_CHECKING([if sched_getcpu is supported])
14  AC_RUN_IFELSE([AC_LANG_SOURCE([[
15#include <sched.h>
16int main(void) {
17  if (sched_getcpu() == -1) {
18      return 1;
19  }
20  return 0;
21}
22  ]])],[
23    AC_MSG_RESULT(yes)
24    AC_DEFINE([HAVE_SCHED_GETCPU],1,[Whether sched_getcpu is properly supported])
25  ],[
26    AC_MSG_RESULT(no)
27  ],[
28    AC_MSG_RESULT([no, cross-compiling])
29  ])
30
31  AC_CHECK_TYPE([siginfo_t],[PCNTL_CFLAGS="-DHAVE_STRUCT_SIGINFO_T"],,[#include <signal.h>])
32
33  PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared, cli, $PCNTL_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
34fi
35