Browse files

Fixed bug#54450 (callback function when built against libedit)

  • Loading branch information...
1 parent 049a7c4 commit b1dd2f4e68a276ceeac52c761a46f4be5eb36db7 @bjori bjori committed Sep 6, 2011
Showing with 30 additions and 0 deletions.
  1. +4 −0 NEWS
  2. +21 −0 ext/readline/config.m4
  3. +5 −0 ext/readline/readline.c
View
4 NEWS
@@ -38,6 +38,10 @@ PHP NEWS
- Improved CLI SAPI:
. Added friendly log messages - Req #55109 (Arpad)
+- Improved readline extension:
+ . Fixed bug #54450 (Enable callback support when built against libedit).
+ (fedora at famillecollet dot com, Hannes)
+
- Improved Session extension:
. Expose session status via new function, session_status (Req #52982) (Arpad)
View
21 ext/readline/config.m4
@@ -60,6 +60,13 @@ if test "$PHP_READLINE" && test "$PHP_READLINE" != "no"; then
-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
])
+ PHP_CHECK_LIBRARY(edit, rl_on_new_line,
+ [
+ AC_DEFINE(HAVE_RL_ON_NEW_LINE, 1, [ ])
+ ],[],[
+ -L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
+ ])
+
AC_DEFINE(HAVE_LIBREADLINE, 1, [ ])
elif test "$PHP_LIBEDIT" != "no"; then
@@ -93,6 +100,20 @@ elif test "$PHP_LIBEDIT" != "no"; then
-L$READLINE_DIR/$PHP_LIBDIR
])
+ PHP_CHECK_LIBRARY(edit, rl_callback_read_char,
+ [
+ AC_DEFINE(HAVE_RL_CALLBACK_READ_CHAR, 1, [ ])
+ ],[],[
+ -L$READLINE_DIR/$PHP_LIBDIR
+ ])
+
+ PHP_CHECK_LIBRARY(edit, rl_on_new_line,
+ [
+ AC_DEFINE(HAVE_RL_ON_NEW_LINE, 1, [ ])
+ ],[],[
+ -L$READLINE_DIR/$PHP_LIBDIR
+ ])
+
AC_DEFINE(HAVE_LIBEDIT, 1, [ ])
fi
View
5 ext/readline/readline.c
@@ -144,6 +144,8 @@ static const zend_function_entry php_readline_functions[] = {
PHP_FE(readline_callback_read_char, arginfo_readline_callback_read_char)
PHP_FE(readline_callback_handler_remove, arginfo_readline_callback_handler_remove)
PHP_FE(readline_redisplay, arginfo_readline_redisplay)
+#endif
+#if HAVE_RL_ON_NEW_LINE
PHP_FE(readline_on_new_line, arginfo_readline_on_new_line)
#endif
PHP_FE_END
@@ -617,6 +619,9 @@ PHP_FUNCTION(readline_redisplay)
}
/* }}} */
+#endif
+
+#if HAVE_RL_ON_NEW_LINE
/* {{{ proto void readline_on_new_line(void)
Inform readline that the cursor has moved to a new line */
PHP_FUNCTION(readline_on_new_line)

0 comments on commit b1dd2f4

Please sign in to comment.