]> granicus.if.org Git - php/commitdiff
Use libenchant-2 when available
authorRemi Collet <remi@php.net>
Mon, 4 May 2020 06:27:31 +0000 (08:27 +0200)
committerRemi Collet <remi@php.net>
Mon, 4 May 2020 06:27:31 +0000 (08:27 +0200)
NEWS
UPGRADING
ext/enchant/config.m4

diff --git a/NEWS b/NEWS
index 5536119a808147d16bdaa567e7c3b5c7c18fd3ec..b8cb7be1e9e26aad86e0961cf89930783bc555f0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,7 @@ PHP                                                                        NEWS
   . Deprecate enchant_broker_set_dict_path, enchant_broker_get_dict_path
     enchant_dict_add_to_personal and enchant_dict_is_in_session
   . Add enchant_dict_add and enchant_dict_is_added functions
+  . Use libenchant-2 when available
 
 - FPM:
   . Fixed bug #64865 (Search for .user.ini files from script dir up to
index 5345111acc0e1066aa9723f234a6d8b3aabd1186..dc97eb6cc4e1bfaa104b2632588f16ae1609884f 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -607,6 +607,11 @@ PHP 8.0 UPGRADE NOTES
 - CURL:
   . The CURL extension now requires at least libcurl 7.29.0.
 
+- Enchant:
+  . The enchant extension now uses libenchant-2 by default when available.
+    libenchant version 1 is still supported but is deprecated and could
+    be removed in the future.
+
 - GD:
   . The $num_points parameter of imagepolygon(), imageopenpolygon() and
     imagefilledpolygon() is now optional, i.e. these functions may be called
index f8d4f1b3e2f85d5f00396147dedafe9b6cbe238e..949db83247d30d39f2ff51572ae8043134ce7d1a 100644 (file)
@@ -4,26 +4,38 @@ PHP_ARG_WITH([enchant],
     [Include Enchant support])])
 
 if test "$PHP_ENCHANT" != "no"; then
-  PKG_CHECK_MODULES([ENCHANT], [enchant >= 1.4.2])
+  PKG_CHECK_MODULES([ENCHANT2], [enchant-2], [found_enchant_2=yes], [found_enchant_2=no])
 
-  PHP_EVAL_INCLINE($ENCHANT_CFLAGS)
-  PHP_EVAL_LIBLINE($ENCHANT_LIBS, ENCHANT_SHARED_LIBADD)
+  if test "$found_enchant_2" = "yes"; then
 
-  AC_DEFINE(HAVE_ENCHANT, 1, [ ])
+    PHP_EVAL_INCLINE($ENCHANT2_CFLAGS)
+    PHP_EVAL_LIBLINE($ENCHANT2_LIBS, ENCHANT_SHARED_LIBADD)
 
-  PHP_CHECK_LIBRARY(enchant, enchant_get_version,
-  [
     AC_DEFINE(HAVE_ENCHANT_GET_VERSION, 1, [ enchant_get_version since 1.6.0 ])
-  ], [ ], [
-    $ENCHANT_LIBS
-  ])
-
-  PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param,
-  [
-    AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ enchant_broker_set_param since 1.5.0 and removed in 2.x ])
-  ], [ ], [
-    $ENCHANT_LIBS
-  ])
+
+  else
+    AC_MSG_WARN([libenchant-2 not found trying with old libenchant])
+    PKG_CHECK_MODULES([ENCHANT], [enchant >= 1.4.2])
+
+    PHP_EVAL_INCLINE($ENCHANT_CFLAGS)
+    PHP_EVAL_LIBLINE($ENCHANT_LIBS, ENCHANT_SHARED_LIBADD)
+
+    PHP_CHECK_LIBRARY(enchant, enchant_get_version,
+    [
+      AC_DEFINE(HAVE_ENCHANT_GET_VERSION, 1, [ enchant_get_version since 1.6.0 ])
+    ], [ ], [
+      $ENCHANT_LIBS
+    ])
+
+    PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param,
+    [
+      AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ enchant_broker_set_param since 1.5.0 and removed in 2.x ])
+    ], [ ], [
+      $ENCHANT_LIBS
+    ])
+  fi
+
+  AC_DEFINE(HAVE_ENCHANT, 1, [ ])
 
   PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
   PHP_SUBST(ENCHANT_SHARED_LIBADD)