Skip to content

Commit cad246f

Browse files
committed
Autotools: Enhance phpdbg readline enabling
PHP_READLINE, PHP_LIBEDIT, and PHP_READLINE_LIBS variables are not available in sapi before the extensions arguments get processed by the configure script. But the Autoconf raw default variables with_readline and with_libedit are. This checks if readline support can be enabled in phpdbg This is partial fix towards the more proper phpGH-13184 or similar in the future to make phpdbg readline integration easier to use. Previous check silently enabled the phpdbg readline integration when readline is built as shared and failed on the make step: undefined reference to 'readline' undefined reference to 'add_history' These cases enable it: ./configure --enable-phpdbg-readline --with-libedit ./configure --enable-phpdbg-readline --with-readline These cases don't enable it: ./configure --enable-phpdbg-readline ./configure --enable-phpdbg-readline --with-libedit=shared ./configure --enable-phpdbg-readline --with-readline=shared
1 parent bd77462 commit cad246f

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

sapi/phpdbg/config.m4

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,30 @@ PHP_ARG_ENABLE([phpdbg-readline],
2121
[no])
2222

2323
if test "$PHP_PHPDBG" != "no"; then
24+
AS_VAR_IF([PHP_PHPDBG_READLINE], [yes], [
25+
AC_MSG_CHECKING([if readline can be enabled in phpdbg])
26+
phpdbg_readline="no (readline extension is not enabled)"
27+
AS_IF(m4_normalize([
28+
(test -n "$with_readline" && test "x$with_readline" != xno) ||
29+
(test -n "$with_libedit" && test "x$with_libedit" != xno)
30+
]), [phpdbg_readline=yes])
31+
AS_CASE([$with_readline], [*shared*],
32+
[phpdbg_readline="no (shared readline extension not supported)"])
33+
AS_CASE([$with_libedit], [*shared*],
34+
[phpdbg_readline="no (shared readline extension not supported)"])
35+
AS_VAR_IF([phpdbg_readline], [yes], [
36+
AC_DEFINE([HAVE_PHPDBG_READLINE], [1],
37+
[Define to 1 if the phpdbg SAPI has libedit/readline integration.])
38+
])
39+
AC_MSG_RESULT([$phpdbg_readline])
40+
])
41+
2442
AC_HEADER_TIOCGWINSZ
2543

2644
PHP_PHPDBG_CFLAGS="-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
2745
AS_VAR_IF([PHP_PHPDBG_DEBUG], [no],,
2846
[AS_VAR_APPEND([PHP_PHPDBG_CFLAGS], [" -DPHPDBG_DEBUG=1"])])
2947

30-
AC_MSG_CHECKING([for phpdbg and readline integration])
31-
if test "$PHP_PHPDBG_READLINE" = "yes"; then
32-
if test "$PHP_READLINE" != "no" || test "$PHP_LIBEDIT" != "no"; then
33-
AC_DEFINE([HAVE_PHPDBG_READLINE], [1],
34-
[Define to 1 if the phpdbg SAPI has libedit/readline integration.])
35-
PHPDBG_EXTRA_LIBS="$PHP_READLINE_LIBS"
36-
AC_MSG_RESULT([ok])
37-
else
38-
AC_MSG_RESULT([readline is not available])
39-
fi
40-
else
41-
AC_MSG_RESULT([disabled])
42-
fi
43-
4448
AH_TEMPLATE([HAVE_USERFAULTFD_WRITEFAULT],
4549
[Define to 1 if faulting on write-protected memory support can be compiled
4650
for userfaultfd.])

0 commit comments

Comments
 (0)