]> granicus.if.org Git - php/commitdiff
use pkg-config for libedit
authorRemi Collet <remi@php.net>
Tue, 19 Feb 2019 08:10:06 +0000 (09:10 +0100)
committerRemi Collet <remi@php.net>
Tue, 19 Feb 2019 08:10:06 +0000 (09:10 +0100)
UPGRADING
ext/readline/config.m4

index 6176e296df15b0e11b3da81a1beb81e4dedc850e..c1a3c19ff62586882b93b8ed1b898d65a55c5fbb 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -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
index d11a2c11ecbd4e73a62b6878ae8bf6b22f05bd4a..21f4f63b04e3db29c6ab53e1e3c825260463d7be 100644 (file)
@@ -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,
@@ -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,
   [
@@ -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, [ ])