]> granicus.if.org Git - php/commitdiff
Show actual enchant version if possible
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 27 Jun 2019 11:04:49 +0000 (13:04 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Thu, 27 Jun 2019 11:04:49 +0000 (13:04 +0200)
As of libenchant 1.6.0 there is enchant_get_version()[1], so we use it,
if available, to show the actual enchant version in the PHP info.  We
also drop the fake ENCHANT_VERSION_STRING altogether, but stick with
showing version 1.5.x if at least HAVE_ENCHANT_BROKER_SET_PARAM is
defined.

Future scope: we may consider requiring enchant 1.6.0 (or later), since
this has been released in April 2010, and likely is available
everywhere.

[1] <https://www.abisource.com/projects/enchant/>

ext/enchant/config.m4
ext/enchant/config.w32
ext/enchant/enchant.c

index cfde0f77b61b40e814561e22e6a02aa1cafca0d2..6c8dd726ce98c51eeba546f39e2b1a8aaa256c48 100644 (file)
@@ -11,10 +11,16 @@ if test "$PHP_ENCHANT" != "no"; then
 
   AC_DEFINE(HAVE_ENCHANT, 1, [ ])
 
+  PHP_CHECK_LIBRARY(enchant, enchant_get_version,
+  [
+    AC_DEFINE(HAVE_ENCHANT_GET_VERSION, 1, [ ])
+  ], [ ], [
+    $ENCHANT_LIBS
+  ])
+
   PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param,
   [
     AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ ])
-    AC_DEFINE(ENCHANT_VERSION_STRING, "1.5.x", [ ])
   ], [ ], [
     $ENCHANT_LIBS
   ])
index a1ff5909e75f7305d34ffba3389d564ae89550ed..2418d99206323b37ebe2ad2d12ee1a69f1f41db1 100644 (file)
@@ -8,6 +8,7 @@ if (PHP_ENCHANT == "yes") {
                        CHECK_LIB("libenchant.lib", "enchant", PHP_ENCHANT) ) {
                EXTENSION("enchant", "enchant.c");
                AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
+               AC_DEFINE('HAVE_ENCHANT_GET_VERSION', 1);
                AC_DEFINE('HAVE_ENCHANT_BROKER_SET_PARAM', 1);
                ADD_FLAG("CFLAG_ENCHANT", "/D _WIN32");
        } else {
index 5f5ad507aeb012b5ff90b707e83a070c3ba966ff..41700c8bed88247d6c76c67486242b585f7dcc35 100644 (file)
@@ -315,10 +315,10 @@ PHP_MINFO_FUNCTION(enchant)
        pbroker = enchant_broker_init();
        php_info_print_table_start();
        php_info_print_table_row(2, "enchant support", "enabled");
-#ifdef ENCHANT_VERSION_STRING
-       php_info_print_table_row(2, "Libenchant Version", ENCHANT_VERSION_STRING);
+#ifdef HAVE_ENCHANT_GET_VERSION
+       php_info_print_table_row(2, "Libenchant Version", enchant_get_version());
 #elif defined(HAVE_ENCHANT_BROKER_SET_PARAM)
-       php_info_print_table_row(2, "Libenchant Version", "1.5.0 or later");
+       php_info_print_table_row(2, "Libenchant Version", "1.5.x");
 #endif
        php_info_print_table_end();