summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2019-03-27 10:04:18 +0100
committerJoe Watkins <krakjoe@php.net>2019-03-27 10:04:36 +0100
commit56293d0637b3e9e706414e3f5689d153ba6bb1f2 (patch)
treee726709e0315209b7383e69ccdf7c40b71b8f410 /sapi
parentf177a2ac586124374e13b93da0c0b9e0e4980ff6 (diff)
parenteb405a2192bd8a0092c0795cd161d96b89f9d534 (diff)
downloadphp-git-56293d0637b3e9e706414e3f5689d153ba6bb1f2.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #77805 phpdbg build fails when readline is shared
Diffstat (limited to 'sapi')
-rw-r--r--sapi/phpdbg/config.m416
-rw-r--r--sapi/phpdbg/phpdbg.h14
-rw-r--r--sapi/phpdbg/phpdbg_cmd.c11
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c20
4 files changed, 37 insertions, 24 deletions
diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4
index a3f7a4028b..9abc990224 100644
--- a/sapi/phpdbg/config.m4
+++ b/sapi/phpdbg/config.m4
@@ -20,6 +20,9 @@ PHP_ARG_ENABLE([phpdbg-debug],
[no],
[no])
+PHP_ARG_ENABLE(phpdbg-readline, for phpdbg readline support,
+[ --enable-phpdbg-readline Enable readline support in phpdbg (depends on static ext/readline)], yes, yes)
+
if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
AC_HEADER_TIOCGWINSZ
AC_DEFINE(HAVE_PHPDBG, 1, [ ])
@@ -33,8 +36,17 @@ if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
PHP_PHPDBG_CFLAGS="-D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
PHP_PHPDBG_FILES="phpdbg.c phpdbg_parser.c phpdbg_lexer.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c phpdbg_cmd.c phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_btree.c phpdbg_sigsafe.c phpdbg_wait.c phpdbg_io.c phpdbg_eol.c phpdbg_out.c"
- if test "$PHP_READLINE" != "no" -o "$PHP_LIBEDIT" != "no"; then
- PHPDBG_EXTRA_LIBS="$PHP_READLINE_LIBS"
+ AC_MSG_CHECKING([for phpdbg and readline integration])
+ if test "$PHP_PHPDBG_READLINE" = "yes"; then
+ if test "$PHP_READLINE" != "no" -o "$PHP_LIBEDIT" != "no"; then
+ AC_DEFINE(HAVE_PHPDBG_READLINE, 1, [ ])
+ PHPDBG_EXTRA_LIBS="$PHP_READLINE_LIBS"
+ AC_MSG_RESULT([ok])
+ else
+ AC_MSG_RESULT([readline is not available])
+ fi
+ else
+ AC_MSG_RESULT([disabled])
fi
PHP_SUBST(PHP_PHPDBG_CFLAGS)
diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index 06d2535fb9..c2298037d4 100644
--- a/sapi/phpdbg/phpdbg.h
+++ b/sapi/phpdbg/phpdbg.h
@@ -83,12 +83,14 @@
#define zend_hash_str_add(...) zend_hash_str_add_tmp(__VA_ARGS__)
#endif
-#ifdef HAVE_LIBREADLINE
-# include <readline/readline.h>
-# include <readline/history.h>
-#endif
-#ifdef HAVE_LIBEDIT
-# include <editline/readline.h>
+#ifdef HAVE_PHPDBG_READLINE
+# ifdef HAVE_LIBREADLINE
+# include <readline/readline.h>
+# include <readline/history.h>
+# endif
+# ifdef HAVE_LIBEDIT
+# include <editline/readline.h>
+# endif
#endif
/* {{{ remote console headers */
diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index 0357b63bda..b736481089 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.c
@@ -751,20 +751,15 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
}
if (buffered == NULL) {
-#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)
-#define USE_LIB_STAR 1
-#else
-#define USE_LIB_STAR 0
-#endif
+#ifdef HAVE_PHPDBG_READLINE
/* note: EOF makes readline write prompt again in local console mode - and ignored if compiled without readline */
-#if USE_LIB_STAR
if ((PHPDBG_G(flags) & PHPDBG_IS_REMOTE) || !isatty(PHPDBG_G(io)[PHPDBG_STDIN].fd))
#endif
{
phpdbg_write("prompt", "", "%s", phpdbg_get_prompt());
phpdbg_consume_stdin_line(cmd = buf);
}
-#if USE_LIB_STAR
+#ifdef HAVE_PHPDBG_READLINE
else {
cmd = readline(phpdbg_get_prompt());
PHPDBG_G(last_was_newline) = 1;
@@ -783,7 +778,7 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */
buffer = estrdup(cmd);
-#if USE_LIB_STAR
+#ifdef HAVE_PHPDBG_READLINE
if (!buffered && cmd && !(PHPDBG_G(flags) & PHPDBG_IS_REMOTE) && isatty(PHPDBG_G(io)[PHPDBG_STDIN].fd)) {
free(cmd);
}
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index f0d0e13e3b..c962ce52c3 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -1158,15 +1158,19 @@ PHPDBG_COMMAND(info) /* {{{ */
{
phpdbg_out("Execution Context Information\n\n");
phpdbg_xml("<printinfo %r>");
-#ifdef HAVE_LIBREADLINE
- phpdbg_writeln("info", "readline=\"yes\"", "Readline yes");
+#ifdef HAVE_PHPDBG_READLINE
+# ifdef HAVE_LIBREADLINE
+ phpdbg_writeln("info", "readline=\"yes\"", "Readline yes");
+# else
+ phpdbg_writeln("info", "readline=\"no\"", "Readline no");
+# endif
+# ifdef HAVE_LIBEDIT
+ phpdbg_writeln("info", "libedit=\"yes\"", "Libedit yes");
+# else
+ phpdbg_writeln("info", "libedit=\"no\"", "Libedit no");
+# endif
#else
- phpdbg_writeln("info", "readline=\"no\"", "Readline no");
-#endif
-#ifdef HAVE_LIBEDIT
- phpdbg_writeln("info", "libedit=\"yes\"", "Libedit yes");
-#else
- phpdbg_writeln("info", "libedit=\"no\"", "Libedit no");
+ phpdbg_writeln("info", "readline=\"unavailable\"", "Readline unavailable");
#endif
phpdbg_writeln("info", "context=\"%s\"", "Exec %s", PHPDBG_G(exec) ? PHPDBG_G(exec) : "none");