Skip to content

Commit 003e238

Browse files
authored
Autotools: Quote and fix PHP_SELECT_SAPI arguments (#15118)
This macro once had also the 5th argument (the build target), which was removed via 2a6da0f. This quotes all PHP_SELECT_SAPI arguments and removes the redundant ones. The basic macro usage help text is moved to the macros section from the obsolete docs file.
1 parent 5270ada commit 003e238

File tree

10 files changed

+44
-31
lines changed

10 files changed

+44
-31
lines changed

build/php.m4

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,16 @@ EOF
843843
])
844844

845845
dnl
846-
dnl PHP_SELECT_SAPI(name, type[, sources [, extra-cflags [, build-target]]])
847-
dnl
848-
dnl Selects the SAPI name and type (static, shared, bundle, program) and
849-
dnl optionally also the source-files for the SAPI-specific objects.
846+
dnl PHP_SELECT_SAPI(name, type[, sources [, extra-cflags]])
847+
dnl
848+
dnl When developing PHP SAPI modules, this macro specifies the SAPI "name" by
849+
dnl its "type", how PHP is supposed to be built (static, shared, bundle, or
850+
dnl program). It optionally adds the source files "sources" and compilation
851+
dnl flags "extra-cflags" to build the SAPI-specific objects. For example:
852+
dnl PHP_SELECT_SAPI([apache2handler],
853+
dnl [shared],
854+
dnl [<sources...>],
855+
dnl [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
850856
dnl
851857
AC_DEFUN([PHP_SELECT_SAPI],[
852858
if test "$2" = "program"; then

docs-old/unix-build-system.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,6 @@ Make sure to prefix *all* relative paths correctly with either `$(builddir)` or
9292
anymore, we must use either absolute paths or relative ones to the top
9393
build-directory. Correct prefixing ensures that.
9494

95-
### SAPI developers
96-
97-
Instead of using `PHP_SAPI=foo/PHP_BUILD_XYZ`, you will need to type
98-
99-
```m4
100-
PHP_SELECT_SAPI(name, type, sources.c)
101-
```
102-
103-
I.e. specify the source-code files as above and also pass the information
104-
regarding how PHP is supposed to be built (shared module, program, etc).
105-
106-
For example for APXS:
107-
108-
```m4
109-
PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php.c php_apache.c)
110-
```
111-
11295
## General info
11396

11497
The foundation for the new system is the flexible handling of sources and their

sapi/apache2handler/config.m4

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ if test "$PHP_APXS2" != "no"; then
8585
case $host_alias in
8686
*aix*)
8787
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
88-
PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
88+
PHP_SELECT_SAPI([apache2handler],
89+
[shared],
90+
[mod_php.c sapi_apache2.c apache_config.c php_functions.c],
91+
[$APACHE_CFLAGS])
8992
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
9093
;;
9194
*darwin*)
@@ -100,12 +103,18 @@ if test "$PHP_APXS2" != "no"; then
100103
fi
101104
MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
102105
PHP_SUBST([MH_BUNDLE_FLAGS])
103-
PHP_SELECT_SAPI(apache2handler, bundle, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
106+
PHP_SELECT_SAPI([apache2handler],
107+
[bundle],
108+
[mod_php.c sapi_apache2.c apache_config.c php_functions.c],
109+
[$APACHE_CFLAGS])
104110
SAPI_SHARED=libs/libphp.so
105111
INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
106112
;;
107113
*)
108-
PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
114+
PHP_SELECT_SAPI([apache2handler],
115+
[shared],
116+
[mod_php.c sapi_apache2.c apache_config.c php_functions.c],
117+
[$APACHE_CFLAGS])
109118
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
110119
;;
111120
esac

sapi/cgi/config9.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ if test "$PHP_CGI" != "no"; then
3434
esac
3535

3636
dnl Select SAPI.
37-
PHP_SELECT_SAPI(cgi, program, cgi_main.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, '$(SAPI_CGI_PATH)')
37+
PHP_SELECT_SAPI([cgi],
38+
[program],
39+
[cgi_main.c],
40+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
3841

3942
case $host_alias in
4043
*aix*)

sapi/cli/config.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ if test "$PHP_CLI" != "no"; then
2727
SAPI_CLI_PATH=sapi/cli/php
2828

2929
dnl Select SAPI.
30-
PHP_SELECT_SAPI(cli, program, php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, '$(SAPI_CLI_PATH)')
30+
PHP_SELECT_SAPI([cli],
31+
[program],
32+
[php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c],
33+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
3134

3235
case $host_alias in
3336
*aix*)

sapi/embed/config.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ if test "$PHP_EMBED" != "no"; then
2525
esac
2626
if test "$PHP_EMBED_TYPE" != "no"; then
2727
PHP_SUBST([LIBPHP_CFLAGS])
28-
PHP_SELECT_SAPI(embed, $PHP_EMBED_TYPE, php_embed.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
28+
PHP_SELECT_SAPI([embed],
29+
[$PHP_EMBED_TYPE],
30+
[php_embed.c],
31+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
2932
PHP_INSTALL_HEADERS([sapi/embed], [php_embed.h])
3033
fi
3134
AC_MSG_RESULT([$PHP_EMBED_TYPE])

sapi/fpm/config.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,10 @@ if test "$PHP_FPM" != "no"; then
548548
fpm/events/port.c \
549549
"
550550

551-
PHP_SELECT_SAPI(fpm, program, $PHP_FPM_FILES $PHP_FPM_TRACE_FILES $PHP_FPM_SD_FILES, $PHP_FPM_CFLAGS, '$(SAPI_FPM_PATH)')
551+
PHP_SELECT_SAPI([fpm],
552+
[program],
553+
[$PHP_FPM_FILES $PHP_FPM_TRACE_FILES $PHP_FPM_SD_FILES],
554+
[$PHP_FPM_CFLAGS])
552555

553556
case $host_alias in
554557
*aix*)

sapi/fuzzer/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if test "$PHP_FUZZER" != "no"; then
4646
PHP_SUBST([FUZZING_LIB])
4747
PHP_SUBST([FUZZING_CC])
4848

49-
dnl PHP_SELECT_SAPI(fuzzer-parser, program, $FUZZER_SOURCES, , '$(SAPI_FUZZER_PATH)')
49+
dnl PHP_SELECT_SAPI([fuzzer-parser], [program], [$FUZZER_SOURCES])
5050

5151
PHP_ADD_BUILD_DIR([sapi/fuzzer])
5252
PHP_FUZZER_BINARIES=""

sapi/litespeed/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if test "$PHP_LITESPEED" != "no"; then
99
[$abs_srcdir/sapi/litespeed],
1010
[sapi/litespeed])
1111
SAPI_LITESPEED_PATH=sapi/litespeed/php
12-
PHP_SELECT_SAPI(litespeed, program, lsapi_main.c lsapilib.c, "", '$(SAPI_LITESPEED_PATH)')
12+
PHP_SELECT_SAPI([litespeed], [program], [lsapi_main.c lsapilib.c])
1313
case $host_alias in
1414
*darwin*)
1515
BUILD_LITESPEED="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_LITESPEED_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"

sapi/phpdbg/config.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ if test "$PHP_PHPDBG" != "no"; then
6666
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/phpdbg/Makefile.frag],
6767
[$abs_srcdir/sapi/phpdbg],
6868
[$abs_builddir/sapi/phpdbg])
69-
PHP_SELECT_SAPI(phpdbg, program, $PHP_PHPDBG_FILES, $PHP_PHPDBG_CFLAGS, [$(SAPI_PHPDBG_PATH)])
69+
PHP_SELECT_SAPI([phpdbg],
70+
[program],
71+
[$PHP_PHPDBG_FILES],
72+
[$PHP_PHPDBG_CFLAGS])
7073

7174
BUILD_BINARY="sapi/phpdbg/phpdbg"
7275
BUILD_SHARED="sapi/phpdbg/libphpdbg.la"

0 commit comments

Comments
 (0)