Skip to content

Commit

Permalink
use pkg-config for libedit
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Feb 19, 2019
1 parent 2850e09 commit b537203
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
3 changes: 3 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ The following extensions are affected:
. --with-pcre-regex has been removed. Instead --with-external-pcre is provided
to opt into using an external PCRE library, rather than the bundled one.

- Readline:
. --with-libedit no longer accepts a directory.

- GD:
. --with-gd becomes --enable-gd (whether to enable the extension at all) and
--with-external-gd (to opt into using an external libgd, rather than the
Expand Down
26 changes: 11 additions & 15 deletions ext/readline/config.m4
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dnl config.m4 for extension readline

PHP_ARG_WITH(libedit,for libedit readline replacement,
[ --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)])
[ --with-libedit Include libedit readline replacement (CLI/CGI only)])

if test "$PHP_LIBEDIT" = "no"; then
PHP_ARG_WITH(readline,for readline support,
Expand Down Expand Up @@ -76,16 +76,13 @@ if test "$PHP_READLINE" && test "$PHP_READLINE" != "no"; then
AC_DEFINE(HAVE_LIBREADLINE, 1, [ ])

elif test "$PHP_LIBEDIT" != "no"; then

for i in $PHP_LIBEDIT /usr/local /usr; do
test -f $i/include/editline/readline.h && LIBEDIT_DIR=$i && break
done

if test -z "$LIBEDIT_DIR"; then
AC_MSG_ERROR(Please reinstall libedit - I cannot find readline.h)
if test "$PHP_LIBEDIT" != "yes"; then
AC_MSG_WARN([libedit directory ignored, rely on pkg-config])
fi

PHP_ADD_INCLUDE($LIBEDIT_DIR/include)
PKG_CHECK_MODULES([EDIT], [libedit])
PHP_EVAL_LIBLINE($EDIT_LIBS, READLINE_SHARED_LIBADD)
PHP_EVAL_INCLINE($EDIT_CFLAGS)

AC_CHECK_LIB(ncurses, tgetent,
[
Expand All @@ -99,39 +96,38 @@ elif test "$PHP_LIBEDIT" != "no"; then

PHP_CHECK_LIBRARY(edit, readline,
[
PHP_ADD_LIBRARY_WITH_PATH(edit, $LIBEDIT_DIR/$PHP_LIBDIR, READLINE_SHARED_LIBADD)
], [
AC_MSG_ERROR(edit library required by readline not found)
], [
-L$READLINE_DIR/$PHP_LIBDIR
$READLINE_SHARED_LIBADD
])

PHP_CHECK_LIBRARY(edit, rl_callback_read_char,
[
AC_DEFINE(HAVE_RL_CALLBACK_READ_CHAR, 1, [ ])
],[],[
-L$READLINE_DIR/$PHP_LIBDIR
$READLINE_SHARED_LIBADD
])

PHP_CHECK_LIBRARY(edit, rl_on_new_line,
[
AC_DEFINE(HAVE_RL_ON_NEW_LINE, 1, [ ])
],[],[
-L$READLINE_DIR/$PHP_LIBDIR
$READLINE_SHARED_LIBADD
])

PHP_CHECK_LIBRARY(edit, rl_completion_matches,
[
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1, [ ])
],[],[
-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
$READLINE_SHARED_LIBADD
])

PHP_CHECK_LIBRARY(edit, history_list,
[
AC_DEFINE(HAVE_HISTORY_LIST, 1, [ ])
],[],[
-L$READLINE_DIR/$PHP_LIBDIR $PHP_READLINE_LIBS
$READLINE_SHARED_LIBADD
])

AC_DEFINE(HAVE_LIBEDIT, 1, [ ])
Expand Down

0 comments on commit b537203

Please sign in to comment.