From: Christoph M. Becker Date: Thu, 27 Jun 2019 11:04:49 +0000 (+0200) Subject: Show actual enchant version if possible X-Git-Tag: php-7.4.0alpha3~163 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=218c18530aa09ac28b9bf16cf34382c28f4589bd;p=php 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] --- 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();