summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-06-27 13:04:49 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-06-27 13:04:49 +0200
commit218c18530aa09ac28b9bf16cf34382c28f4589bd (patch)
tree6ac1fcfe6acb0fdf4b6162ed6f43fe31696be599
parente7446c1b2d6ea06c9f862ec531a0ced9c1ec5b9f (diff)
downloadphp-git-218c18530aa09ac28b9bf16cf34382c28f4589bd.tar.gz
Show actual enchant version if possible
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/>
-rw-r--r--ext/enchant/config.m48
-rw-r--r--ext/enchant/config.w321
-rw-r--r--ext/enchant/enchant.c6
3 files changed, 11 insertions, 4 deletions
diff --git a/ext/enchant/config.m4 b/ext/enchant/config.m4
index cfde0f77b6..6c8dd726ce 100644
--- a/ext/enchant/config.m4
+++ b/ext/enchant/config.m4
@@ -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
])
diff --git a/ext/enchant/config.w32 b/ext/enchant/config.w32
index a1ff5909e7..2418d99206 100644
--- a/ext/enchant/config.w32
+++ b/ext/enchant/config.w32
@@ -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 {
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index 5f5ad507ae..41700c8bed 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -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();