xref: /PHP-8.3/sapi/fpm/config.m4 (revision 04954f6b)
1PHP_ARG_ENABLE([fpm],,
2  [AS_HELP_STRING([--enable-fpm],
3    [Enable building of the fpm SAPI executable])],
4  [no],
5  [no])
6
7dnl Configure checks.
8AC_DEFUN([AC_FPM_STDLIBS],
9[
10  AC_CHECK_FUNCS(clearenv setproctitle setproctitle_fast)
11
12  AC_SEARCH_LIBS(socket, socket)
13  AC_SEARCH_LIBS(inet_addr, nsl)
14])
15
16AC_DEFUN([AC_FPM_SETPFLAGS],
17[
18  AC_MSG_CHECKING([for setpflags])
19
20  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <priv.h>]], [[setpflags(0, 0);]])], [
21    AC_DEFINE([HAVE_SETPFLAGS], 1, [do we have setpflags?])
22    AC_MSG_RESULT([yes])
23  ], [
24    AC_MSG_RESULT([no])
25  ])
26])
27
28AC_DEFUN([AC_FPM_CLOCK],
29[
30  have_clock_gettime=no
31
32  AC_MSG_CHECKING([for clock_gettime])
33
34  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);]])], [
35    have_clock_gettime=yes
36    AC_MSG_RESULT([yes])
37  ], [
38    AC_MSG_RESULT([no])
39  ])
40
41  if test "$have_clock_gettime" = "no"; then
42    AC_MSG_CHECKING([for clock_gettime in -lrt])
43
44    SAVED_LIBS="$LIBS"
45    LIBS="$LIBS -lrt"
46
47    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);]])], [
48      have_clock_gettime=yes
49      AC_MSG_RESULT([yes])
50    ], [
51      LIBS="$SAVED_LIBS"
52      AC_MSG_RESULT([no])
53    ])
54  fi
55
56  if test "$have_clock_gettime" = "yes"; then
57    AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [do we have clock_gettime?])
58  fi
59
60  have_clock_get_time=no
61
62  if test "$have_clock_gettime" = "no"; then
63    AC_MSG_CHECKING([for clock_get_time])
64
65    AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <mach/mach.h>
66      #include <mach/clock.h>
67      #include <mach/mach_error.h>
68
69      int main(void)
70      {
71        kern_return_t ret; clock_serv_t aClock; mach_timespec_t aTime;
72        ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &aClock);
73
74        if (ret != KERN_SUCCESS) {
75          return 1;
76        }
77
78        ret = clock_get_time(aClock, &aTime);
79        if (ret != KERN_SUCCESS) {
80          return 2;
81        }
82
83        return 0;
84      }
85    ]])], [
86      have_clock_get_time=yes
87      AC_MSG_RESULT([yes])
88    ], [
89      AC_MSG_RESULT([no])
90    ], [AC_MSG_RESULT([no (cross-compiling)])])
91  fi
92
93  if test "$have_clock_get_time" = "yes"; then
94    AC_DEFINE([HAVE_CLOCK_GET_TIME], 1, [do we have clock_get_time?])
95  fi
96])
97
98AC_DEFUN([AC_FPM_TRACE],
99[
100  have_ptrace=no
101  have_broken_ptrace=no
102
103  AC_MSG_CHECKING([for ptrace])
104
105  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
106    #include <sys/types.h>
107    #include <sys/ptrace.h> ]], [[ptrace(0, 0, (void *) 0, 0);]])], [
108    have_ptrace=yes
109    AC_MSG_RESULT([yes])
110  ], [
111    AC_MSG_RESULT([no])
112  ])
113
114  if test "$have_ptrace" = "yes"; then
115    AC_MSG_CHECKING([whether ptrace works])
116
117    AC_RUN_IFELSE([AC_LANG_SOURCE([[
118      #include <unistd.h>
119      #include <signal.h>
120      #include <sys/wait.h>
121      #include <sys/types.h>
122      #include <sys/ptrace.h>
123      #include <errno.h>
124
125      #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)
126      #define PTRACE_ATTACH PT_ATTACH
127      #endif
128
129      #if !defined(PTRACE_DETACH) && defined(PT_DETACH)
130      #define PTRACE_DETACH PT_DETACH
131      #endif
132
133      #if !defined(PTRACE_PEEKDATA) && defined(PT_READ_D)
134      #define PTRACE_PEEKDATA PT_READ_D
135      #endif
136
137      int main(void)
138      {
139        long v1 = (unsigned int) -1; /* copy will fail if sizeof(long) == 8 and we've got "int ptrace()" */
140        long v2;
141        pid_t child;
142        int status;
143
144        if ( (child = fork()) ) { /* parent */
145          int ret = 0;
146
147          if (0 > ptrace(PTRACE_ATTACH, child, 0, 0)) {
148            return 2;
149          }
150
151          waitpid(child, &status, 0);
152
153      #ifdef PT_IO
154          struct ptrace_io_desc ptio = {
155            .piod_op = PIOD_READ_D,
156            .piod_offs = &v1,
157            .piod_addr = &v2,
158            .piod_len = sizeof(v1)
159          };
160
161          if (0 > ptrace(PT_IO, child, (void *) &ptio, 0)) {
162            ret = 3;
163          }
164      #else
165          errno = 0;
166
167          v2 = ptrace(PTRACE_PEEKDATA, child, (void *) &v1, 0);
168
169          if (errno) {
170            ret = 4;
171          }
172      #endif
173          ptrace(PTRACE_DETACH, child, (void *) 1, 0);
174
175          kill(child, SIGKILL);
176
177          return ret ? ret : (v1 != v2);
178        }
179        else { /* child */
180          sleep(10);
181          return 0;
182        }
183      }
184    ]])], [
185      AC_MSG_RESULT([yes])
186    ], [
187      have_ptrace=no
188      have_broken_ptrace=yes
189      AC_MSG_RESULT([no])
190    ], [
191      AC_MSG_RESULT([skipped (cross-compiling)])
192    ])
193  fi
194
195  if test "$have_ptrace" = "yes"; then
196    AC_DEFINE([HAVE_PTRACE], 1, [do we have ptrace?])
197  fi
198
199  have_mach_vm_read=no
200
201  if test "$have_broken_ptrace" = "yes"; then
202    AC_MSG_CHECKING([for mach_vm_read])
203
204    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mach/mach.h>
205      #include <mach/mach_vm.h>
206    ]], [[
207      mach_vm_read((vm_map_t)0, (mach_vm_address_t)0, (mach_vm_size_t)0, (vm_offset_t *)0, (mach_msg_type_number_t*)0);
208    ]])], [
209      have_mach_vm_read=yes
210      AC_MSG_RESULT([yes])
211    ], [
212      AC_MSG_RESULT([no])
213    ])
214  fi
215
216  if test "$have_mach_vm_read" = "yes"; then
217    AC_DEFINE([HAVE_MACH_VM_READ], 1, [do we have mach_vm_read?])
218  fi
219
220  proc_mem_file=""
221
222  if test -r /proc/$$/mem ; then
223    proc_mem_file="mem"
224  else
225    if test -r /proc/$$/as ; then
226      proc_mem_file="as"
227    fi
228  fi
229
230  if test -n "$proc_mem_file" ; then
231    AC_MSG_CHECKING([for proc mem file])
232
233    AC_RUN_IFELSE([AC_LANG_SOURCE([[
234      #define _GNU_SOURCE
235      #define _FILE_OFFSET_BITS 64
236      #include <stdint.h>
237      #include <unistd.h>
238      #include <sys/types.h>
239      #include <sys/stat.h>
240      #include <fcntl.h>
241      #include <stdio.h>
242      int main(void)
243      {
244        long v1 = (unsigned int) -1, v2 = 0;
245        char buf[128];
246        int fd;
247        sprintf(buf, "/proc/%d/$proc_mem_file", getpid());
248        fd = open(buf, O_RDONLY);
249        if (0 > fd) {
250          return 1;
251        }
252        if (sizeof(long) != pread(fd, &v2, sizeof(long), (uintptr_t) &v1)) {
253          close(fd);
254          return 1;
255        }
256        close(fd);
257        return v1 != v2;
258      }
259    ]])], [
260      AC_MSG_RESULT([$proc_mem_file])
261    ], [
262      proc_mem_file=""
263      AC_MSG_RESULT([no])
264    ], [
265      AC_MSG_RESULT([skipped (cross-compiling)])
266    ])
267  fi
268
269  if test -n "$proc_mem_file"; then
270    AC_DEFINE_UNQUOTED([PROC_MEM_FILE], "$proc_mem_file", [/proc/pid/mem interface])
271  fi
272
273  fpm_trace_type=""
274
275  if test "$have_ptrace" = "yes"; then
276    fpm_trace_type=ptrace
277
278  elif test -n "$proc_mem_file"; then
279    fpm_trace_type=pread
280
281  elif test "$have_mach_vm_read" = "yes" ; then
282    fpm_trace_type=mach
283
284  else
285    AC_MSG_WARN([FPM Trace - ptrace, pread, or mach: could not be found])
286  fi
287
288])
289
290AC_DEFUN([AC_FPM_BUILTIN_ATOMIC],
291[
292  AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
293  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
294    int variable = 1;
295    return (__sync_bool_compare_and_swap(&variable, 1, 2)
296           && __sync_add_and_fetch(&variable, 1)) ? 1 : 0;
297  ]])], [
298    AC_MSG_RESULT([yes])
299    AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
300  ], [
301    AC_MSG_RESULT([no])
302  ])
303])
304
305AC_DEFUN([AC_FPM_LQ],
306[
307  have_lq=no
308
309  AC_MSG_CHECKING([for TCP_INFO])
310
311  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/tcp.h>]], [[struct tcp_info ti; int x = TCP_INFO;]])], [
312    have_lq=tcp_info
313    AC_MSG_RESULT([yes])
314  ], [
315    AC_MSG_RESULT([no])
316  ])
317
318  if test "$have_lq" = "tcp_info"; then
319    AC_DEFINE([HAVE_LQ_TCP_INFO], 1, [do we have TCP_INFO?])
320  fi
321
322  AC_MSG_CHECKING([for TCP_CONNECTION_INFO])
323
324  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/tcp.h>]], [[struct tcp_connection_info ti; int x = TCP_CONNECTION_INFO;]])], [
325    have_lq=tcp_connection_info
326    AC_MSG_RESULT([yes])
327  ], [
328    AC_MSG_RESULT([no])
329  ])
330
331  if test "$have_lq" = "tcp_connection_info"; then
332    AC_DEFINE([HAVE_LQ_TCP_CONNECTION_INFO], 1, [do we have TCP_CONNECTION_INFO?])
333  fi
334
335  if test "$have_lq" = "no" ; then
336    AC_MSG_CHECKING([for SO_LISTENQLEN])
337
338    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[int x = SO_LISTENQLIMIT; int y = SO_LISTENQLEN;]])], [
339      have_lq=so_listenq
340      AC_MSG_RESULT([yes])
341    ], [
342      AC_MSG_RESULT([no])
343    ])
344
345    if test "$have_lq" = "tcp_info"; then
346      AC_DEFINE([HAVE_LQ_SO_LISTENQ], 1, [do we have SO_LISTENQxxx?])
347    fi
348  fi
349])
350
351AC_DEFUN([AC_FPM_SYSCONF],
352[
353	AC_MSG_CHECKING([for sysconf])
354
355	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[sysconf(_SC_CLK_TCK);]])],[
356		AC_DEFINE([HAVE_SYSCONF], 1, [do we have sysconf?])
357		AC_MSG_RESULT([yes])
358	], [
359		AC_MSG_RESULT([no])
360	])
361])
362
363AC_DEFUN([AC_FPM_TIMES],
364[
365	AC_MSG_CHECKING([for times])
366
367	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/times.h>]], [[struct tms t; times(&t);]])],[
368		AC_DEFINE([HAVE_TIMES], 1, [do we have times?])
369		AC_MSG_RESULT([yes])
370	], [
371		AC_MSG_RESULT([no])
372	])
373])
374
375AC_DEFUN([AC_FPM_KQUEUE],
376[
377	AC_MSG_CHECKING([for kqueue])
378
379	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
380		#include <sys/types.h>
381		#include <sys/event.h>
382		#include <sys/time.h>
383	]], [[
384		int kfd;
385		struct kevent k;
386		kfd = kqueue();
387		/* 0 -> STDIN_FILENO */
388		EV_SET(&k, 0, EVFILT_READ , EV_ADD | EV_CLEAR, 0, 0, NULL);
389	]])], [
390		AC_DEFINE([HAVE_KQUEUE], 1, [do we have kqueue?])
391		AC_MSG_RESULT([yes])
392	], [
393		AC_MSG_RESULT([no])
394	])
395])
396
397AC_DEFUN([AC_FPM_PORT],
398[
399	AC_MSG_CHECKING([for port framework])
400
401	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
402		#include <port.h>
403	]], [[
404		int port;
405
406		port = port_create();
407		if (port < 0) {
408			return 1;
409		}
410	]])], [
411		AC_DEFINE([HAVE_PORT], 1, [do we have port framework?])
412		AC_MSG_RESULT([yes])
413	], [
414		AC_MSG_RESULT([no])
415	])
416])
417
418AC_DEFUN([AC_FPM_DEVPOLL],
419[
420	AC_MSG_CHECKING([for /dev/poll])
421
422	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
423		#include <stdio.h>
424		#include <sys/devpoll.h>
425	]], [[
426		int n, dp;
427		struct dvpoll dvp;
428		dp = 0;
429		dvp.dp_fds = NULL;
430		dvp.dp_nfds = 0;
431		dvp.dp_timeout = 0;
432		n = ioctl(dp, DP_POLL, &dvp)
433	]])], [
434		AC_DEFINE([HAVE_DEVPOLL], 1, [do we have /dev/poll?])
435		AC_MSG_RESULT([yes])
436	], [
437		AC_MSG_RESULT([no])
438	])
439])
440
441AC_DEFUN([AC_FPM_EPOLL],
442[
443	AC_MSG_CHECKING([for epoll])
444
445	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
446		#include <sys/epoll.h>
447	]], [[
448		int epollfd;
449		struct epoll_event e;
450
451		epollfd = epoll_create(1);
452		if (epollfd < 0) {
453			return 1;
454		}
455
456		e.events = EPOLLIN | EPOLLET;
457		e.data.fd = 0;
458
459		if (epoll_ctl(epollfd, EPOLL_CTL_ADD, 0, &e) == -1) {
460			return 1;
461		}
462
463		e.events = 0;
464		if (epoll_wait(epollfd, &e, 1, 1) < 0) {
465			return 1;
466		}
467	]])], [
468		AC_DEFINE([HAVE_EPOLL], 1, [do we have epoll?])
469		AC_MSG_RESULT([yes])
470	], [
471		AC_MSG_RESULT([no])
472	])
473])
474
475AC_DEFUN([AC_FPM_SELECT],
476[
477	AC_MSG_CHECKING([for select])
478
479	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
480		/* According to POSIX.1-2001 */
481		#include <sys/select.h>
482
483		/* According to earlier standards */
484		#include <sys/time.h>
485		#include <sys/types.h>
486		#include <unistd.h>
487	]], [[
488		fd_set fds;
489		struct timeval t;
490		t.tv_sec = 0;
491		t.tv_usec = 42;
492		FD_ZERO(&fds);
493		/* 0 -> STDIN_FILENO */
494		FD_SET(0, &fds);
495		select(FD_SETSIZE, &fds, NULL, NULL, &t);
496	]])], [
497		AC_DEFINE([HAVE_SELECT], 1, [do we have select?])
498		AC_MSG_RESULT([yes])
499	], [
500		AC_MSG_RESULT([no])
501	])
502])
503
504AC_MSG_CHECKING(for FPM build)
505if test "$PHP_FPM" != "no"; then
506  AC_MSG_RESULT($PHP_FPM)
507
508  AC_FPM_STDLIBS
509  AC_FPM_SETPFLAGS
510  AC_FPM_CLOCK
511  AC_FPM_TRACE
512  AC_FPM_BUILTIN_ATOMIC
513  AC_FPM_LQ
514  AC_FPM_SYSCONF
515  AC_FPM_TIMES
516  AC_FPM_KQUEUE
517  AC_FPM_PORT
518  AC_FPM_DEVPOLL
519  AC_FPM_EPOLL
520  AC_FPM_SELECT
521
522  PHP_ARG_WITH([fpm-user],,
523    [AS_HELP_STRING([[--with-fpm-user[=USER]]],
524      [Set the user for php-fpm to run as. (default: nobody)])],
525    [nobody],
526    [no])
527
528  PHP_ARG_WITH([fpm-group],,
529    [AS_HELP_STRING([[--with-fpm-group[=GRP]]],
530      [Set the group for php-fpm to run as. For a system user, this should
531      usually be set to match the fpm username (default: nobody)])],
532    [nobody],
533    [no])
534
535  PHP_ARG_WITH([fpm-systemd],,
536    [AS_HELP_STRING([--with-fpm-systemd],
537      [Activate systemd integration])],
538    [no],
539    [no])
540
541  PHP_ARG_WITH([fpm-acl],,
542    [AS_HELP_STRING([--with-fpm-acl],
543      [Use POSIX Access Control Lists])],
544    [no],
545    [no])
546
547  PHP_ARG_WITH([fpm-apparmor],,
548    [AS_HELP_STRING([--with-fpm-apparmor],
549      [Support AppArmor confinement through libapparmor])],
550    [no],
551    [no])
552
553  PHP_ARG_WITH([fpm-selinux],,
554    [AS_HELP_STRING([--with-fpm-selinux],
555      [Support SELinux policy library])],
556    [no],
557    [no])
558
559  if test "$PHP_FPM_SYSTEMD" != "no" ; then
560    PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 209])
561
562    AC_CHECK_HEADERS(systemd/sd-daemon.h, [HAVE_SD_DAEMON_H="yes"], [HAVE_SD_DAEMON_H="no"])
563    if test $HAVE_SD_DAEMON_H = "no"; then
564      AC_MSG_ERROR([Your system does not support systemd.])
565    else
566      AC_DEFINE(HAVE_SYSTEMD, 1, [FPM use systemd integration])
567      PHP_FPM_SD_FILES="fpm/fpm_systemd.c"
568      PHP_EVAL_LIBLINE($SYSTEMD_LIBS)
569      PHP_EVAL_INCLINE($SYSTEMD_CFLAGS)
570      php_fpm_systemd=notify
571    fi
572  else
573    php_fpm_systemd=simple
574  fi
575
576  if test "$PHP_FPM_ACL" != "no" ; then
577    AC_MSG_CHECKING([for acl user/group permissions support])
578    AC_CHECK_HEADERS([sys/acl.h])
579
580    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
581      int main(void)
582      {
583        acl_t acl;
584        acl_entry_t user, group;
585        acl = acl_init(1);
586        acl_create_entry(&acl, &user);
587        acl_set_tag_type(user, ACL_USER);
588        acl_create_entry(&acl, &group);
589        acl_set_tag_type(user, ACL_GROUP);
590        acl_free(acl);
591        return 0;
592      }
593    ]])], [
594      AC_CHECK_LIB(acl, acl_free,
595        [PHP_ADD_LIBRARY(acl)
596          have_fpm_acl=yes
597          AC_MSG_RESULT([yes])
598        ],[
599          AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
600            int main(void)
601            {
602              acl_t acl;
603              acl_entry_t user, group;
604              acl = acl_init(1);
605              acl_create_entry(&acl, &user);
606              acl_set_tag_type(user, ACL_USER);
607              acl_create_entry(&acl, &group);
608              acl_set_tag_type(user, ACL_GROUP);
609              acl_free(acl);
610              return 0;
611            }
612          ]])], [
613            have_fpm_acl=yes
614            AC_MSG_RESULT([yes])
615          ], [
616            have_fpm_acl=no
617            AC_MSG_RESULT([no])
618          ], [AC_MSG_RESULT([skipped])])
619        ])
620    ], [
621      have_fpm_acl=no
622      AC_MSG_RESULT([no])
623    ], [AC_MSG_RESULT([skipped (cross-compiling)])])
624
625    if test "$have_fpm_acl" = "yes"; then
626      AC_DEFINE([HAVE_FPM_ACL], 1, [do we have acl support?])
627    fi
628  fi
629
630  if test "x$PHP_FPM_APPARMOR" != "xno" ; then
631    AC_CHECK_HEADERS([sys/apparmor.h])
632    AC_CHECK_LIB(apparmor, aa_change_profile, [
633      PHP_ADD_LIBRARY(apparmor)
634      AC_DEFINE(HAVE_APPARMOR, 1, [ AppArmor confinement available ])
635    ],[
636      AC_MSG_ERROR(libapparmor required but not found)
637    ])
638  fi
639
640  if test "x$PHP_FPM_SELINUX" != "xno" ; then
641    AC_CHECK_HEADERS([selinux/selinux.h])
642    AC_CHECK_LIB(selinux, security_setenforce, [
643      PHP_ADD_LIBRARY(selinux)
644      AC_DEFINE(HAVE_SELINUX, 1, [ SElinux available ])
645    ],[])
646  fi
647
648  PHP_SUBST_OLD(php_fpm_systemd)
649  AC_DEFINE_UNQUOTED(PHP_FPM_SYSTEMD, "$php_fpm_systemd", [fpm systemd service type])
650
651  if test -z "$PHP_FPM_USER" -o "$PHP_FPM_USER" = "yes" -o "$PHP_FPM_USER" = "no"; then
652    php_fpm_user="nobody"
653  else
654    php_fpm_user="$PHP_FPM_USER"
655  fi
656
657  if test -z "$PHP_FPM_GROUP" -o "$PHP_FPM_GROUP" = "yes" -o "$PHP_FPM_GROUP" = "no"; then
658    php_fpm_group="nobody"
659  else
660    php_fpm_group="$PHP_FPM_GROUP"
661  fi
662
663  PHP_SUBST_OLD(php_fpm_user)
664  PHP_SUBST_OLD(php_fpm_group)
665  php_fpm_sysconfdir=`eval echo $sysconfdir`
666  PHP_SUBST_OLD(php_fpm_sysconfdir)
667  php_fpm_localstatedir=`eval echo $localstatedir`
668  PHP_SUBST_OLD(php_fpm_localstatedir)
669  php_fpm_prefix=`eval echo $prefix`
670  PHP_SUBST_OLD(php_fpm_prefix)
671
672  AC_DEFINE_UNQUOTED(PHP_FPM_USER, "$php_fpm_user", [fpm user name])
673  AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, "$php_fpm_group", [fpm group name])
674
675  PHP_ADD_BUILD_DIR(sapi/fpm/fpm)
676  PHP_ADD_BUILD_DIR(sapi/fpm/fpm/events)
677  PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/www.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html)
678  PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag])
679
680  SAPI_FPM_PATH=sapi/fpm/php-fpm
681
682  if test "$fpm_trace_type" && test -f "$abs_srcdir/sapi/fpm/fpm/fpm_trace_$fpm_trace_type.c"; then
683    PHP_FPM_TRACE_FILES="fpm/fpm_trace.c fpm/fpm_trace_$fpm_trace_type.c"
684  fi
685
686  PHP_FPM_CFLAGS="-I$abs_srcdir/sapi/fpm -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
687
688  PHP_FPM_FILES="fpm/fpm.c \
689    fpm/fpm_children.c \
690    fpm/fpm_cleanup.c \
691    fpm/fpm_clock.c \
692    fpm/fpm_conf.c \
693    fpm/fpm_env.c \
694    fpm/fpm_events.c \
695		fpm/fpm_log.c \
696    fpm/fpm_main.c \
697    fpm/fpm_php.c \
698    fpm/fpm_php_trace.c \
699    fpm/fpm_process_ctl.c \
700    fpm/fpm_request.c \
701    fpm/fpm_shm.c \
702    fpm/fpm_scoreboard.c \
703    fpm/fpm_signals.c \
704    fpm/fpm_sockets.c \
705    fpm/fpm_status.c \
706    fpm/fpm_stdio.c \
707    fpm/fpm_unix.c \
708    fpm/fpm_worker_pool.c \
709    fpm/zlog.c \
710		fpm/events/select.c \
711		fpm/events/poll.c \
712		fpm/events/epoll.c \
713		fpm/events/kqueue.c \
714		fpm/events/devpoll.c \
715		fpm/events/port.c \
716  "
717
718  PHP_SELECT_SAPI(fpm, program, $PHP_FPM_FILES $PHP_FPM_TRACE_FILES $PHP_FPM_SD_FILES, $PHP_FPM_CFLAGS, '$(SAPI_FPM_PATH)')
719
720  case $host_alias in
721      *aix*)
722        BUILD_FPM="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FPM_OBJS) | sed 's/\([A-Za-z0-9_]*\)\.lo/\1.o/g'\` | \$(AWK) '{ if (((\$\$2 == \"T\") || (\$\$2 == \"D\") || (\$\$2 == \"B\")) && (substr(\$\$3,1,1) != \".\")) { print \$\$3 } }' | sort -u >> php.sym && \$(LIBTOOL) --tag=CC --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) -Wl,-brtl -Wl,-bE:php.sym \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_FPM_OBJS) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
723        ;;
724      *darwin*)
725        BUILD_FPM="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_FPM_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
726      ;;
727      *)
728        BUILD_FPM="\$(LIBTOOL) --tag=CC --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_FPM_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
729      ;;
730  esac
731
732  PHP_SUBST(SAPI_FPM_PATH)
733  PHP_SUBST(BUILD_FPM)
734
735else
736  AC_MSG_RESULT(no)
737fi
738