xref: /php-src/sapi/fpm/config.m4 (revision 1a126c54)
1PHP_ARG_ENABLE([fpm],
2  [for FPM build],
3  [AS_HELP_STRING([--enable-fpm],
4    [Enable building of the fpm SAPI executable])],
5  [no],
6  [no])
7
8dnl Configure checks.
9AC_DEFUN([PHP_FPM_CLOCK], [
10AC_CHECK_FUNCS([clock_gettime],, [
11  LIBS_save=$LIBS
12  AC_SEARCH_LIBS([clock_gettime], [rt], [
13    ac_cv_func_clock_gettime=yes
14    AC_DEFINE([HAVE_CLOCK_GETTIME], [1])
15    AS_VAR_IF([ac_cv_search_clock_gettime], ["none required"],,
16      [AS_VAR_APPEND([FPM_EXTRA_LIBS], [" $ac_cv_search_clock_gettime"])])
17  ])
18  LIBS=$LIBS_save
19])
20
21AS_VAR_IF([ac_cv_func_clock_gettime], [no],
22  [AC_CACHE_CHECK([for clock_get_time], [php_cv_func_clock_get_time],
23    [AC_RUN_IFELSE([AC_LANG_SOURCE([
24      #include <mach/mach.h>
25      #include <mach/clock.h>
26      #include <mach/mach_error.h>
27
28      int main(void)
29      {
30        kern_return_t ret; clock_serv_t aClock; mach_timespec_t aTime;
31        ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &aClock);
32
33        if (ret != KERN_SUCCESS) {
34          return 1;
35        }
36
37        ret = clock_get_time(aClock, &aTime);
38        if (ret != KERN_SUCCESS) {
39          return 2;
40        }
41
42        return 0;
43      }
44    ])],
45    [php_cv_func_clock_get_time=yes],
46    [php_cv_func_clock_get_time=no],
47    [php_cv_func_clock_get_time=no])])
48  AS_VAR_IF([php_cv_func_clock_get_time], [yes],
49    [AC_DEFINE([HAVE_CLOCK_GET_TIME], [1],
50      [Define to 1 if you have the 'clock_get_time' function.])])
51])])
52
53AC_DEFUN([PHP_FPM_TRACE],
54[AC_CACHE_CHECK([for ptrace], [php_cv_func_ptrace],
55  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
56    #include <sys/types.h>
57    #include <sys/ptrace.h>
58  ],
59  [ptrace(0, 0, (void *) 0, 0);])],
60  [AC_RUN_IFELSE([AC_LANG_SOURCE([
61      #include <unistd.h>
62      #include <signal.h>
63      #include <sys/wait.h>
64      #include <sys/types.h>
65      #include <sys/ptrace.h>
66      #include <errno.h>
67
68      #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH)
69      #define PTRACE_ATTACH PT_ATTACH
70      #endif
71
72      #if !defined(PTRACE_DETACH) && defined(PT_DETACH)
73      #define PTRACE_DETACH PT_DETACH
74      #endif
75
76      #if !defined(PTRACE_PEEKDATA) && defined(PT_READ_D)
77      #define PTRACE_PEEKDATA PT_READ_D
78      #endif
79
80      int main(void)
81      {
82        /* copy will fail if sizeof(long) == 8 and we've got "int ptrace()" */
83        long v1 = (unsigned int) -1;
84        long v2;
85        pid_t child;
86        int status;
87
88        if ( (child = fork()) ) { /* parent */
89          int ret = 0;
90
91          if (0 > ptrace(PTRACE_ATTACH, child, 0, 0)) {
92            return 2;
93          }
94
95          waitpid(child, &status, 0);
96
97      #ifdef PT_IO
98          struct ptrace_io_desc ptio = {
99            .piod_op = PIOD_READ_D,
100            .piod_offs = &v1,
101            .piod_addr = &v2,
102            .piod_len = sizeof(v1)
103          };
104
105          if (0 > ptrace(PT_IO, child, (void *) &ptio, 0)) {
106            ret = 3;
107          }
108      #else
109          errno = 0;
110
111          v2 = ptrace(PTRACE_PEEKDATA, child, (void *) &v1, 0);
112
113          if (errno) {
114            ret = 4;
115          }
116      #endif
117          ptrace(PTRACE_DETACH, child, (void *) 1, 0);
118
119          kill(child, SIGKILL);
120
121          return ret ? ret : (v1 != v2);
122        }
123        else { /* child */
124          sleep(10);
125          return 0;
126        }
127      }
128    ])],
129    [php_cv_func_ptrace=yes],
130    [php_cv_func_ptrace=no],
131    [php_cv_func_ptrace=yes])],
132  [php_cv_func_ptrace=no])])
133
134AS_VAR_IF([php_cv_func_ptrace], [yes],
135  [AC_DEFINE([HAVE_PTRACE], [1],
136    [Define to 1 if you have the 'ptrace' function.])],
137  [AC_CACHE_CHECK([for mach_vm_read], [php_cv_func_mach_vm_read],
138    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <mach/mach.h>
139      #include <mach/mach_vm.h>
140    ], [
141      mach_vm_read(
142        (vm_map_t)0,
143        (mach_vm_address_t)0,
144        (mach_vm_size_t)0,
145        (vm_offset_t *)0,
146        (mach_msg_type_number_t*)0);
147    ])],
148    [php_cv_func_mach_vm_read=yes],
149    [php_cv_func_mach_vm_read=no])])
150])
151
152AS_VAR_IF([php_cv_func_mach_vm_read], [yes],
153  [AC_DEFINE([HAVE_MACH_VM_READ], [1],
154    [Define to 1 if you have the 'mach_vm_read' function.])])
155
156AC_CACHE_CHECK([for proc mem file], [php_cv_file_proc_mem],
157[AS_IF([test -r /proc/$$/mem], [proc_mem_file=mem],
158  [test -r /proc/$$/as], [proc_mem_file=as],
159  [proc_mem_file=])
160
161AS_VAR_IF([proc_mem_file],,,
162  [AC_RUN_IFELSE([AC_LANG_SOURCE([[
163      #ifndef _GNU_SOURCE
164      #define _GNU_SOURCE
165      #endif
166      #define _FILE_OFFSET_BITS 64
167      #include <stdint.h>
168      #include <unistd.h>
169      #include <sys/types.h>
170      #include <sys/stat.h>
171      #include <fcntl.h>
172      #include <stdio.h>
173      int main(void)
174      {
175        long v1 = (unsigned int) -1, v2 = 0;
176        char buf[128];
177        int fd;
178        sprintf(buf, "/proc/%d/$proc_mem_file", getpid());
179        fd = open(buf, O_RDONLY);
180        if (0 > fd) {
181          return 1;
182        }
183        if (sizeof(long) != pread(fd, &v2, sizeof(long), (uintptr_t) &v1)) {
184          close(fd);
185          return 1;
186        }
187        close(fd);
188        return v1 != v2;
189      }
190    ]])],
191    [php_cv_file_proc_mem=$proc_mem_file],
192    [php_cv_file_proc_mem=],
193    [php_cv_file_proc_mem=$proc_mem_file])
194  ])
195])
196
197AS_VAR_IF([php_cv_file_proc_mem],,,
198  [AC_DEFINE_UNQUOTED([PROC_MEM_FILE], ["$php_cv_file_proc_mem"],
199    [Define to the /proc/pid/mem interface filename value.])])
200
201AS_IF([test "x$php_cv_func_ptrace" = xyes], [fpm_trace_type=ptrace],
202  [test -n "$php_cv_file_proc_mem"], [fpm_trace_type=pread],
203  [test "x$php_cv_func_mach_vm_read" = xyes], [fpm_trace_type=mach],
204  [fpm_trace_type=])
205
206AS_VAR_IF([fpm_trace_type],,
207  [AC_MSG_WARN([FPM Trace - ptrace, pread, or mach: could not be found])])
208])
209
210AC_DEFUN([PHP_FPM_BUILTIN_ATOMIC],
211[AC_CACHE_CHECK([if compiler supports __sync_bool_compare_and_swap],
212  [php_cv_have___sync_bool_compare_and_swap],
213  [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [
214    int variable = 1;
215    return (__sync_bool_compare_and_swap(&variable, 1, 2)
216           && __sync_add_and_fetch(&variable, 1)) ? 1 : 0;
217  ])],
218  [php_cv_have___sync_bool_compare_and_swap=yes],
219  [php_cv_have___sync_bool_compare_and_swap=no])])
220AS_VAR_IF([php_cv_have___sync_bool_compare_and_swap], [yes],
221  [AC_DEFINE([HAVE_BUILTIN_ATOMIC], [1],
222    [Define to 1 if compiler supports __sync_bool_compare_and_swap() a.o.])])
223])
224
225AC_DEFUN([PHP_FPM_LQ],
226[AC_CACHE_CHECK([for TCP_INFO], [php_cv_have_TCP_INFO],
227  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netinet/tcp.h>], [
228    struct tcp_info ti;
229    int x = TCP_INFO;
230    (void)ti;
231    (void)x;
232  ])],
233  [php_cv_have_TCP_INFO=yes],
234  [php_cv_have_TCP_INFO=no])])
235AS_VAR_IF([php_cv_have_TCP_INFO], [yes],
236  [AC_DEFINE([HAVE_LQ_TCP_INFO], [1], [Define to 1 if you have 'TCP_INFO'.])])
237
238AC_CACHE_CHECK([for TCP_CONNECTION_INFO], [php_cv_have_TCP_CONNECTION_INFO],
239  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netinet/tcp.h>], [
240    struct tcp_connection_info ti;
241    int x = TCP_CONNECTION_INFO;
242    (void)ti;
243    (void)x;
244  ])],
245  [php_cv_have_TCP_CONNECTION_INFO=yes],
246  [php_cv_have_TCP_CONNECTION_INFO=no])])
247AS_VAR_IF([php_cv_have_TCP_CONNECTION_INFO], [yes],
248  [AC_DEFINE([HAVE_LQ_TCP_CONNECTION_INFO], [1],
249    [Define to 1 if you have 'TCP_CONNECTION_INFO'.])])
250
251AC_CACHE_CHECK([for SO_LISTENQLEN], [php_cv_have_SO_LISTENQLEN],
252  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>], [
253    int x = SO_LISTENQLIMIT;
254    int y = SO_LISTENQLEN;
255    (void)x;
256    (void)y;
257  ])],
258  [php_cv_have_SO_LISTENQLEN=yes],
259  [php_cv_have_SO_LISTENQLEN=no])])
260AS_VAR_IF([php_cv_have_SO_LISTENQLEN], [yes],
261  [AC_DEFINE([HAVE_LQ_SO_LISTENQ], [1],
262    [Define to 1 if you have 'SO_LISTENQ*'.])])
263])
264
265AC_DEFUN([PHP_FPM_KQUEUE],
266[AC_CACHE_CHECK([for kqueue],
267  [php_cv_have_kqueue],
268  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
269    #include <sys/types.h>
270    #include <sys/event.h>
271    #include <sys/time.h>
272  ], [dnl
273    int kfd;
274    struct kevent k;
275    kfd = kqueue();
276    /* 0 -> STDIN_FILENO */
277    EV_SET(&k, 0, EVFILT_READ , EV_ADD | EV_CLEAR, 0, 0, NULL);
278    (void)kfd;
279  ])],
280  [php_cv_have_kqueue=yes],
281  [php_cv_have_kqueue=no])])
282AS_VAR_IF([php_cv_have_kqueue], [yes],
283  [AC_DEFINE([HAVE_KQUEUE], [1],
284    [Define to 1 if system has a working 'kqueue' function.])])
285])
286
287AC_DEFUN([PHP_FPM_EPOLL],
288[AC_CACHE_CHECK([for epoll],
289  [php_cv_have_epoll],
290  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [dnl
291    int epollfd;
292    struct epoll_event e;
293
294    epollfd = epoll_create(1);
295    if (epollfd < 0) {
296      return 1;
297    }
298
299    e.events = EPOLLIN | EPOLLET;
300    e.data.fd = 0;
301
302    if (epoll_ctl(epollfd, EPOLL_CTL_ADD, 0, &e) == -1) {
303      return 1;
304    }
305
306    e.events = 0;
307    if (epoll_wait(epollfd, &e, 1, 1) < 0) {
308      return 1;
309    }
310  ])],
311  [php_cv_have_epoll=yes],
312  [php_cv_have_epoll=no])])
313AS_VAR_IF([php_cv_have_epoll], [yes],
314  [AC_DEFINE([HAVE_EPOLL], [1], [Define to 1 if system has a working epoll.])])
315])
316
317AC_DEFUN([PHP_FPM_SELECT],
318[AC_CACHE_CHECK([for select],
319  [php_cv_have_select],
320  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
321    /* According to POSIX.1-2001 */
322    #include <sys/select.h>
323
324    /* According to earlier standards */
325    #include <sys/time.h>
326    #include <sys/types.h>
327    #include <unistd.h>
328  ], [dnl
329    fd_set fds;
330    struct timeval t;
331    t.tv_sec = 0;
332    t.tv_usec = 42;
333    FD_ZERO(&fds);
334    /* 0 -> STDIN_FILENO */
335    FD_SET(0, &fds);
336    select(FD_SETSIZE, &fds, NULL, NULL, &t);
337  ])],
338  [php_cv_have_select=yes],
339  [php_cv_have_select=no])])
340AS_VAR_IF([php_cv_have_select], [yes],
341  [AC_DEFINE([HAVE_SELECT], [1],
342    [Define to 1 if system has a working 'select' function.])])
343])
344
345if test "$PHP_FPM" != "no"; then
346  PHP_FPM_CLOCK
347  PHP_FPM_TRACE
348  PHP_FPM_BUILTIN_ATOMIC
349  PHP_FPM_LQ
350  PHP_FPM_KQUEUE
351  PHP_FPM_EPOLL
352  PHP_FPM_SELECT
353
354  AC_CHECK_FUNCS([clearenv setproctitle setproctitle_fast])
355
356  AC_CHECK_HEADER([priv.h], [AC_CHECK_FUNCS([setpflags])])
357  AC_CHECK_HEADER([sys/times.h], [AC_CHECK_FUNCS([times])])
358  AC_CHECK_HEADER([port.h], [AC_CHECK_FUNCS([port_create])])
359
360  PHP_ARG_WITH([fpm-user],,
361    [AS_HELP_STRING([[--with-fpm-user[=USER]]],
362      [Set the user for php-fpm to run as. (default: nobody)])],
363    [nobody],
364    [no])
365
366  PHP_ARG_WITH([fpm-group],,
367    [AS_HELP_STRING([[--with-fpm-group[=GRP]]],
368      [Set the group for php-fpm to run as. For a system user, this should
369      usually be set to match the fpm username (default: nobody)])],
370    [nobody],
371    [no])
372
373  PHP_ARG_WITH([fpm-systemd],
374    [whether to enable systemd integration in PHP-FPM],
375    [AS_HELP_STRING([--with-fpm-systemd],
376      [Activate systemd integration])],
377    [no],
378    [no])
379
380  PHP_ARG_WITH([fpm-acl],
381    [whether to use Access Control Lists (ACL) in PHP-FPM],
382    [AS_HELP_STRING([--with-fpm-acl],
383      [Use POSIX Access Control Lists])],
384    [no],
385    [no])
386
387  PHP_ARG_WITH([fpm-apparmor],
388    [whether to enable AppArmor confinement in PHP-FPM],
389    [AS_HELP_STRING([--with-fpm-apparmor],
390      [Support AppArmor confinement through libapparmor])],
391    [no],
392    [no])
393
394  PHP_ARG_WITH([fpm-selinux],
395    [whether to enable SELinux support in PHP-FPM],
396    [AS_HELP_STRING([--with-fpm-selinux],
397      [Support SELinux policy library])],
398    [no],
399    [no])
400
401  AS_VAR_IF([PHP_FPM_SYSTEMD], [no], [php_fpm_systemd=simple], [
402    PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 209])
403
404    AC_DEFINE([HAVE_SYSTEMD], [1],
405      [Define to 1 if FPM has systemd integration.])
406    PHP_FPM_SD_FILES="fpm/fpm_systemd.c"
407    PHP_EVAL_LIBLINE([$SYSTEMD_LIBS], [FPM_EXTRA_LIBS], [yes])
408    PHP_EVAL_INCLINE([$SYSTEMD_CFLAGS])
409
410    php_fpm_systemd=notify
411
412    dnl Sanity check.
413    CFLAGS_save=$CFLAGS
414    CFLAGS="$INCLUDES $CFLAGS"
415    AC_CHECK_HEADER([systemd/sd-daemon.h],,
416      [AC_MSG_FAILURE([Required <systemd/sd-daemon.h> header file not found.])])
417    CFLAGS=$CFLAGS_save
418  ])
419
420  AC_SUBST([php_fpm_systemd])
421
422  AS_VAR_IF([PHP_FPM_ACL], [no],, [
423    AC_CHECK_HEADERS([sys/acl.h])
424
425    dnl *BSD has acl_* built into libc, macOS doesn't have user/group support.
426    LIBS_save=$LIBS
427    AC_SEARCH_LIBS([acl_free], [acl],
428    [AC_CACHE_CHECK([for ACL user/group permissions support],
429      [php_cv_lib_acl_user_group],
430      [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/acl.h>], [
431        acl_t acl;
432        acl_entry_t user, group;
433        acl = acl_init(1);
434        acl_create_entry(&acl, &user);
435        acl_set_tag_type(user, ACL_USER);
436        acl_create_entry(&acl, &group);
437        acl_set_tag_type(user, ACL_GROUP);
438        acl_free(acl);
439      ])],
440      [php_cv_lib_acl_user_group=yes],
441      [php_cv_lib_acl_user_group=no])])
442      AS_VAR_IF([php_cv_lib_acl_user_group], [yes], [
443        AC_DEFINE([HAVE_FPM_ACL], [1],
444          [Define to 1 if PHP-FPM has ACL support.])
445        AS_VAR_IF([ac_cv_search_acl_free], ["none required"],,
446          [AS_VAR_APPEND([FPM_EXTRA_LIBS], [" $ac_cv_search_acl_free"])])
447      ])
448    ])
449    LIBS=$LIBS_save
450  ])
451
452  AS_VAR_IF([PHP_FPM_APPARMOR], [no],, [
453    PKG_CHECK_MODULES([APPARMOR], [libapparmor],
454      [PHP_EVAL_INCLINE([$APPARMOR_CFLAGS])],
455      [AC_CHECK_LIB([apparmor], [aa_change_profile],
456        [APPARMOR_LIBS=-lapparmor],
457        [AC_MSG_FAILURE([Required libapparmor library not found.])])])
458    PHP_EVAL_LIBLINE([$APPARMOR_LIBS], [FPM_EXTRA_LIBS], [yes])
459
460    dnl Sanity check.
461    CFLAGS_save=$CFLAGS
462    CFLAGS="$INCLUDES $CFLAGS"
463    AC_CHECK_HEADER([sys/apparmor.h],
464      [AC_DEFINE([HAVE_APPARMOR], [1],
465        [Define to 1 if AppArmor confinement is available for PHP-FPM.])],
466      [AC_MSG_FAILURE([Required <sys/apparmor.h> header file not found.])])
467    CFLAGS=$CFLAGS_save
468  ])
469
470  AS_VAR_IF([PHP_FPM_SELINUX], [no],, [
471    PKG_CHECK_MODULES([SELINUX], [libselinux],
472      [PHP_EVAL_INCLINE([$SELINUX_CFLAGS])],
473      [AC_CHECK_LIB([selinux], [security_setenforce],
474        [SELINUX_LIBS=-lselinux],
475        [AC_MSG_FAILURE([Required SELinux library not found.])])])
476    PHP_EVAL_LIBLINE([$SELINUX_LIBS], [FPM_EXTRA_LIBS], [yes])
477
478    dnl Sanity check.
479    CFLAGS_save=$CFLAGS
480    CFLAGS="$INCLUDES $CFLAGS"
481    AC_CHECK_HEADER([selinux/selinux.h],
482      [AC_DEFINE([HAVE_SELINUX], [1],
483        [Define to 1 if SELinux is available in PHP-FPM.])],
484      [AC_MSG_FAILURE([Required <selinux/selinux.h> header file not found.])])
485    CFLAGS=$CFLAGS_save
486  ])
487
488  if test -z "$PHP_FPM_USER" || test "$PHP_FPM_USER" = "yes" || test "$PHP_FPM_USER" = "no"; then
489    php_fpm_user=nobody
490  else
491    php_fpm_user=$PHP_FPM_USER
492  fi
493
494  if test -z "$PHP_FPM_GROUP" || test "$PHP_FPM_GROUP" = "yes" || test "$PHP_FPM_GROUP" = "no"; then
495    php_fpm_group=nobody
496  else
497    php_fpm_group=$PHP_FPM_GROUP
498  fi
499
500  AC_SUBST([php_fpm_user])
501  AC_SUBST([php_fpm_group])
502  php_fpm_sysconfdir=$(eval echo $sysconfdir)
503  AC_SUBST([php_fpm_sysconfdir])
504  php_fpm_localstatedir=$(eval echo $localstatedir)
505  AC_SUBST([php_fpm_localstatedir])
506  php_fpm_prefix=$(eval echo $prefix)
507  AC_SUBST([php_fpm_prefix])
508
509  PHP_ADD_BUILD_DIR([
510    sapi/fpm/fpm
511    sapi/fpm/fpm/events
512  ])
513  AC_CONFIG_FILES([
514    sapi/fpm/init.d.php-fpm
515    sapi/fpm/php-fpm.8
516    sapi/fpm/php-fpm.conf
517    sapi/fpm/php-fpm.service
518    sapi/fpm/status.html
519    sapi/fpm/www.conf
520  ])
521  PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag])
522
523  SAPI_FPM_PATH=sapi/fpm/php-fpm
524
525  AS_VAR_IF([fpm_trace_type],,,
526    [AS_IF([test -f "$abs_srcdir/sapi/fpm/fpm/fpm_trace_$fpm_trace_type.c"],
527      [PHP_FPM_TRACE_FILES="fpm/fpm_trace.c fpm/fpm_trace_$fpm_trace_type.c"])])
528
529  PHP_FPM_FILES="fpm/fpm.c \
530    fpm/fpm_children.c \
531    fpm/fpm_cleanup.c \
532    fpm/fpm_clock.c \
533    fpm/fpm_conf.c \
534    fpm/fpm_env.c \
535    fpm/fpm_events.c \
536    fpm/fpm_log.c \
537    fpm/fpm_main.c \
538    fpm/fpm_php.c \
539    fpm/fpm_php_trace.c \
540    fpm/fpm_process_ctl.c \
541    fpm/fpm_request.c \
542    fpm/fpm_shm.c \
543    fpm/fpm_scoreboard.c \
544    fpm/fpm_signals.c \
545    fpm/fpm_sockets.c \
546    fpm/fpm_status.c \
547    fpm/fpm_stdio.c \
548    fpm/fpm_unix.c \
549    fpm/fpm_worker_pool.c \
550    fpm/zlog.c \
551    fpm/events/select.c \
552    fpm/events/poll.c \
553    fpm/events/epoll.c \
554    fpm/events/kqueue.c \
555    fpm/events/port.c \
556  "
557
558  PHP_SELECT_SAPI([fpm],
559    [program],
560    [$PHP_FPM_FILES $PHP_FPM_TRACE_FILES $PHP_FPM_SD_FILES],
561    [-I$abs_srcdir/sapi/fpm -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
562
563  AS_CASE([$host_alias],
564    [*aix*], [
565      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)"
566    ],
567    [*darwin*], [
568      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)"
569    ], [
570      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)"
571    ])
572
573  PHP_SUBST([SAPI_FPM_PATH])
574  PHP_SUBST([BUILD_FPM])
575  PHP_SUBST([FPM_EXTRA_LIBS])
576fi
577