xref: /php-src/sapi/cgi/config9.m4 (revision bcbf7bea)
1PHP_ARG_ENABLE([cgi],
2  [for CGI build],
3  [AS_HELP_STRING([--disable-cgi],
4    [Disable building CGI version of PHP])],
5  [yes],
6  [no])
7
8if test "$PHP_CGI" != "no"; then
9  dnl BSD systems.
10  AC_CHECK_MEMBERS([struct sockaddr_un.sun_len],,,[#include <sys/un.h>])
11
12  AC_CACHE_CHECK([whether cross-process locking is required by accept()],
13    [php_cv_have_cross_process_locking],
14    [AS_CASE([$host_alias],
15      [*solaris*], [php_cv_have_cross_process_locking=yes],
16      [php_cv_have_cross_process_locking=no])])
17  AS_VAR_IF([php_cv_have_cross_process_locking], [yes],
18    [AC_DEFINE([USE_LOCKING], [1],
19      [Define to 1 if cross-process locking is required by 'accept()'.])])
20
21  PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/cgi/Makefile.frag])
22
23  dnl Set filename.
24  AS_CASE([$host_alias],
25    [*cygwin*], [SAPI_CGI_PATH=sapi/cgi/php-cgi.exe],
26    [SAPI_CGI_PATH=sapi/cgi/php-cgi])
27
28  dnl Select SAPI.
29  PHP_SELECT_SAPI([cgi],
30    [program],
31    [cgi_main.c],
32    [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
33
34  AS_CASE([$host_alias],
35    [*aix*], [
36      AS_VAR_IF([php_sapi_module], [shared], [
37        BUILD_CGI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CGI_OBJS) | sed 's/\([A-Za-z0-9_]*\)\.lo/.libs\/\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_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
38      ], [
39        BUILD_CGI="echo '\#! .' > php.sym && echo >>php.sym && nm -BCpg \`echo \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CGI_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_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
40      ])
41    ],
42    [*darwin*], [
43      BUILD_CGI="\$(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_CGI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
44    ], [
45      BUILD_CGI="\$(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_CGI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
46    ])
47
48  PHP_SUBST([SAPI_CGI_PATH])
49  PHP_SUBST([BUILD_CGI])
50
51  AC_CONFIG_FILES([sapi/cgi/php-cgi.1])
52fi
53