Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move to main/cli folder
  • Loading branch information
henderkes committed Mar 10, 2026
commit 5794331bd01050e96dedb4a7311d3eb94eab5653
2 changes: 1 addition & 1 deletion ext/readline/readline_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#include "zend_highlight.h"
#include "zend_exceptions.h"

#include "sapi/cli/cli.h"
#include "main/cli/cli.h"
#include "readline_cli.h"

#if defined(COMPILE_DL_READLINE) && !defined(PHP_WIN32)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion sapi/cli/cli_win32.c
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define PHP_CLI_WIN32_NO_CONSOLE 1
#include "php_cli.c"
#include "main/cli/php_cli.c"
8 changes: 6 additions & 2 deletions sapi/cli/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ if test "$PHP_CLI" != "no"; then
dnl Select SAPI.
PHP_SELECT_SAPI([cli],
[program],
[php_cli.c php_cli_main.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c],
[php_cli_main.c],
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])

PHP_ADD_SOURCES([main/cli],
[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])

AS_CASE([$host_alias],
Expand All @@ -58,5 +62,5 @@ if test "$PHP_CLI" != "no"; then

AC_CONFIG_FILES([sapi/cli/php.1])

PHP_INSTALL_HEADERS([sapi/cli], [cli.h])
PHP_INSTALL_HEADERS([main/cli], [cli.h])
fi
10 changes: 5 additions & 5 deletions sapi/cli/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ ARG_ENABLE('cli', 'Build CLI version of PHP', 'yes');
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');

if (PHP_CLI == "yes") {
SAPI('cli', 'php_cli.c php_cli_main.c php_http_parser.c php_cli_server.c', 'php.exe', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_SOURCES(configure_module_dirname, 'php_cli_process_title.c ps_title.c', 'cli');
SAPI('cli', 'php_cli_main.c', 'php.exe', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_SOURCES("main/cli", "php_cli.c php_http_parser.c php_cli_server.c php_cli_process_title.c ps_title.c", "cli");
ADD_FLAG("LIBS_CLI", "ws2_32.lib");
ADD_FLAG("LIBS_CLI", "shell32.lib");
ADD_FLAG("LDFLAGS_CLI", "/stack:67108864");
PHP_INSTALL_HEADERS("sapi/cli", "cli.h");
PHP_INSTALL_HEADERS("main/cli", "cli.h");

if (CHECK_LIB("edit_a.lib;edit.lib", "cli", PHP_CLI) &&
CHECK_HEADER("editline/readline.h", "CFLAGS_CLI")) {
Expand All @@ -18,8 +18,8 @@ if (PHP_CLI == "yes") {
}

if (PHP_CLI_WIN32 == "yes") {
SAPI('cli_win32', 'cli_win32.c cli_win32_main.c', 'php-win.exe', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_SOURCES(configure_module_dirname, ' php_cli_process_title.c ps_title.c', 'cli_win32', undefined, PHP_CLI == "yes");
SAPI('cli_win32', 'cli_win32.c', 'php-win.exe', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_SOURCES("main/cli", "php_cli_process_title.c ps_title.c", "cli_win32", undefined, PHP_CLI == "yes");
ADD_FLAG("LDFLAGS_CLI_WIN32", "/stack:67108864");
ADD_FLAG("LIBS_CLI_WIN32", "shell32.lib");
}
3 changes: 2 additions & 1 deletion sapi/cli/php_cli_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
+----------------------------------------------------------------------+
*/

#include "cli.h"
#include "php.h"
#include "main/cli/cli.h"
#include <stdlib.h>

#ifdef PHP_WIN32
Expand Down
35 changes: 33 additions & 2 deletions sapi/embed/config.m4
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
PHP_ARG_ENABLE([embed],,
[AS_HELP_STRING([[--enable-embed[=TYPE]]],
[Enable building of embedded SAPI library TYPE is either
'shared' or 'static'. [TYPE=shared]])],
[no],
[no])

AC_MSG_CHECKING([for embedded SAPI library support])

if test "$PHP_EMBED" != "no"; then
Expand Down Expand Up @@ -26,8 +33,32 @@ if test "$PHP_EMBED" != "no"; then
[php_embed.c],
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])

dnl Reuse CLI object files (excluding php_cli_main.lo) for do_php_cli()
PHP_SAPI_OBJS="$PHP_SAPI_OBJS sapi/cli/php_cli.lo sapi/cli/php_http_parser.lo sapi/cli/php_cli_server.lo sapi/cli/ps_title.lo sapi/cli/php_cli_process_title.lo"
dnl Feature checks for CLI sources.
AC_CHECK_FUNCS([setproctitle])

AC_CHECK_HEADERS([sys/pstat.h])

AC_CACHE_CHECK([for PS_STRINGS], [php_cv_var_PS_STRINGS],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <machine/vmparam.h>
#include <sys/exec.h>
],
[
PS_STRINGS->ps_nargvstr = 1;
PS_STRINGS->ps_argvstr = "foo";
])],
[php_cv_var_PS_STRINGS=yes],
[php_cv_var_PS_STRINGS=no])])
AS_VAR_IF([php_cv_var_PS_STRINGS], [yes],
[AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS exists.])])

dnl When CLI SAPI is also enabled, these are already in PHP_GLOBAL_OBJS.
if test "$PHP_CLI" = "no"; then
PHP_ADD_SOURCES([main/cli],
[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])
fi

PHP_INSTALL_HEADERS([sapi/embed], [php_embed.h])
])
Expand Down
3 changes: 1 addition & 2 deletions sapi/embed/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ var PHP_EMBED_PGO = false;

if (PHP_EMBED != "no") {
SAPI('embed', 'php_embed.c', 'php' + PHP_VERSION + 'embed.lib', '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_SOURCES("sapi/cli", "php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c", "embed");
ADD_SOURCES("main/cli", "php_cli.c php_http_parser.c php_cli_server.c ps_title.c php_cli_process_title.c", "embed");
ADD_FLAG("LIBS_EMBED", "ws2_32.lib");
ADD_FLAG("LIBS_EMBED", "shell32.lib");
PHP_INSTALL_HEADERS("sapi/embed", "php_embed.h");
PHP_INSTALL_HEADERS("sapi/cli", "cli.h");
}
11 changes: 0 additions & 11 deletions sapi/embed/config0.m4

This file was deleted.

2 changes: 1 addition & 1 deletion sapi/embed/php_embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <main/php_variables.h>
#include <main/php_ini.h>
#include <zend_ini.h>
#include <sapi/cli/cli.h>

#define PHP_EMBED_START_BLOCK(x,y) { \
php_embed_init(x, y); \
Expand All @@ -50,6 +49,7 @@ BEGIN_EXTERN_C()
EMBED_SAPI_API int php_embed_init(int argc, char **argv);
EMBED_SAPI_API void php_embed_shutdown(void);
extern EMBED_SAPI_API sapi_module_struct php_embed_module;
EMBED_SAPI_API int do_php_cli(int argc, char *argv[]);
END_EXTERN_C()


Expand Down
Loading