Skip to content

Fix bug #51558: shared readline build fails #15242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ PHP NEWS
- Random:
. lcg_value() is now deprecated. (timwolla)

- Readline:
. Fixed bug #51558 (Shared readline build fails). (Peter Kokot)

- Session:
. INI settings session.sid_length and session.sid_bits_per_character are now
deprecated. (timwolla)
Expand Down
21 changes: 14 additions & 7 deletions ext/readline/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ if test "$PHP_READLINE" && test "$PHP_READLINE" != "no"; then
[AC_MSG_FAILURE([The readline library not found.])],
[-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS])

PHP_CHECK_LIBRARY([readline], [rl_pending_input],
[],
[AC_MSG_FAILURE([Invalid readline installation detected. Try --with-libedit instead.])],
[-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS])

PHP_CHECK_LIBRARY([readline], [rl_callback_read_char],
[AC_DEFINE([HAVE_RL_CALLBACK_READ_CHAR], [1], [ ])],
[],
Expand All @@ -72,9 +67,21 @@ if test "$PHP_READLINE" && test "$PHP_READLINE" != "no"; then
CFLAGS="$CFLAGS $INCLUDES"
LDFLAGS="$LDFLAGS -L$READLINE_DIR/$PHP_LIBDIR"
LIBS="$LIBS -lreadline"

dnl Sanity and minimum version check if readline library has variable
dnl rl_pending_input.
AC_CHECK_DECL([rl_pending_input],, [AC_MSG_FAILURE([
Invalid readline installation detected. Try --with-libedit instead.
])], [
#include <stdio.h>
#include <readline/readline.h>
])

AC_CHECK_DECL([rl_erase_empty_line],
[AC_DEFINE([HAVE_ERASE_EMPTY_LINE], [1])],,
[#include <readline/readline.h>])
[AC_DEFINE([HAVE_ERASE_EMPTY_LINE], [1])],, [
#include <stdio.h>
#include <readline/readline.h>
])
CFLAGS=$CFLAGS_SAVE
LDFLAGS=$LDFLAGS_SAVE
LIBS=$LIBS_SAVE
Expand Down