xref: /php-src/ext/pcntl/config.m4 (revision f2e50eb6)
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  for function in fork sigaction waitpid; do
8    AC_CHECK_FUNC([$function],,
9      [AC_MSG_FAILURE([ext/pcntl: required function $function() not found.])])
10  done
11
12  AC_CHECK_FUNCS(m4_normalize([
13    forkx
14    getcpuid
15    getpriority
16    pidfd_open
17    pset_bind
18    pthread_set_qos_class_self_np
19    rfork
20    sched_setaffinity
21    setpriority
22    sigwaitinfo
23    sigtimedwait
24    unshare
25    wait3
26    wait4
27    waitid
28  ]))
29
30  AC_CHECK_FUNCS([WIFCONTINUED],,
31    [AC_CHECK_DECL([WIFCONTINUED], [AC_DEFINE([HAVE_WIFCONTINUED], [1])],,
32      [#include <sys/wait.h>])])
33
34  AC_CHECK_DECLS(m4_normalize([
35      WCONTINUED,
36      WEXITED,
37      WSTOPPED,
38      WNOWAIT,
39      P_ALL,
40      P_PIDFD,
41      P_UID,
42      P_JAILID
43    ]),,,
44    [#include <sys/wait.h>])
45
46  dnl if unsupported, -1 means automatically ENOSYS in this context
47  AC_CACHE_CHECK([if sched_getcpu is supported], [php_cv_func_sched_getcpu],
48  [AC_RUN_IFELSE([AC_LANG_SOURCE([
49#include <sched.h>
50int main(void) {
51  if (sched_getcpu() == -1) {
52      return 1;
53  }
54  return 0;
55}
56  ])],
57  [php_cv_func_sched_getcpu=yes],
58  [php_cv_func_sched_getcpu=no],
59  [php_cv_func_sched_getcpu=no])])
60  AS_VAR_IF([php_cv_func_sched_getcpu], [yes],
61    [AC_DEFINE([HAVE_SCHED_GETCPU], [1],
62      [Define to 1 if the 'sched_getcpu' function is properly supported.])])
63
64  AC_CHECK_TYPE([siginfo_t], [PCNTL_CFLAGS="-DHAVE_STRUCT_SIGINFO_T"],,
65    [#include <signal.h>])
66
67  PHP_NEW_EXTENSION([pcntl],
68    [pcntl.c php_signal.c],
69    [$ext_shared],
70    [cli],
71    [$PCNTL_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
72fi
73