Skip to content

Commit 0ff9e36

Browse files
committed
compile cli sapi sources only once
1 parent a15294c commit 0ff9e36

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

sapi/cli/config.m4

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,17 @@ if test "$PHP_CLI" != "no"; then
3737
dnl Select SAPI.
3838
PHP_SELECT_SAPI([cli],
3939
[program],
40-
[php_cli.c php_cli_main.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c],
40+
[php_cli_main.c],
4141
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
4242

43+
dnl Everything except the main() entry point, so that the embed SAPI can link
44+
dnl the same objects into libphp for do_php_cli().
45+
PHP_ADD_SOURCES_X([sapi/cli],
46+
[php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c],
47+
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1],
48+
[PHP_CLI_SHARED_OBJS])
49+
PHP_CLI_OBJS="$PHP_CLI_OBJS $PHP_CLI_SHARED_OBJS"
50+
4351
AS_CASE([$host_alias],
4452
[*aix*], [
4553
AS_VAR_IF([php_sapi_module], [shared], [

sapi/embed/config.m4

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,8 @@ if test "$PHP_EMBED" != "no"; then
2727
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
2828
PHP_INSTALL_HEADERS([sapi/embed], [php_embed.h])
2929
30-
dnl Include CLI sources for do_php_cli() in libphp.
31-
dnl We rebuild them here because cli isn't guaranteed to compile with -fPIC
32-
PHP_ADD_SOURCES([sapi/cli],
33-
[php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c],
34-
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1],
35-
[sapi])
30+
dnl Link the CLI objects into libphp for do_php_cli().
31+
PHP_SAPI_OBJS="$PHP_SAPI_OBJS $PHP_CLI_SHARED_OBJS"
3632
])
3733
else
3834
AC_MSG_RESULT([no])

0 commit comments

Comments
 (0)