[php-src] master: Improve check for broken iconv //IGNORE (#13898)

From: Date: Wed, 10 Apr 2024 20:16:21 +0000
Subject: [php-src] master: Improve check for broken iconv //IGNORE (#13898)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-128064@lists.php.net to get a copy of this message
Author: Peter Kokot (petk) Committer: GitHub (web-flow) Pusher: petk Date: 2024-04-10T22:16:15+02:00 Commit: https://github.com/php/php-src/commit/4d28e408049a21b8ef38ef422995b230fe6a45d2 Raw diff: https://github.com/php/php-src/commit/4d28e408049a21b8ef38ef422995b230fe6a45d2.diff Improve check for broken iconv //IGNORE (#13898) Previous check defined the symbol ICONV_BROKEN_IGNORE to 0 or 1 and the #ifdef macro condition in iconv.c file was always using a bypass. Even when the //IGNORE is supported (for example, on GNU Libiconv). With this change, the ICONV_BROKEN_IGNORE symbol is only defined if the //IGNORE Autoconf check fails or when cross-compiling without setting the php_cv_iconv_ignore variable. This also enables overriding the ext/iconv //IGNORE check when cross-compiling, by setting the php_cv_iconv_ignore variable to "yes" in case the iconv library is known to have a working //IGNORE (for example, GNU libiconv). These cache variables can be set at configure step, when cross-compiling ./configure php_cv_iconv_ignore=yes Changed paths: M ext/iconv/config.m4 Diff: diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4 index e29642969e517..91a51f3d288e5 100644 --- a/ext/iconv/config.m4 +++ b/ext/iconv/config.m4 @@ -112,8 +112,8 @@ int main(void) { AC_MSG_RESULT(yes, cross-compiling) ]) - AC_MSG_CHECKING([if iconv supports //IGNORE]) - AC_RUN_IFELSE([AC_LANG_SOURCE([[ + AC_CACHE_CHECK([if iconv supports //IGNORE], [php_cv_iconv_ignore], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <iconv.h> #include <stdlib.h> @@ -132,16 +132,13 @@ int main(void) { } return 0; } - ]])],[ - AC_MSG_RESULT(yes) - AC_DEFINE([ICONV_BROKEN_IGNORE],0,[Whether iconv supports IGNORE]) - ],[ - AC_MSG_RESULT(no) - AC_DEFINE([ICONV_BROKEN_IGNORE],1,[Whether iconv supports IGNORE]) - ],[ - AC_MSG_RESULT(no, cross-compiling) - AC_DEFINE([ICONV_BROKEN_IGNORE],0,[Whether iconv supports IGNORE]) - ]) + ]])], + [php_cv_iconv_ignore=yes], + [php_cv_iconv_ignore=no], + [php_cv_iconv_ignore=no])]) + + AS_VAR_IF([php_cv_iconv_ignore], [no], + [AC_DEFINE([ICONV_BROKEN_IGNORE], [1], [Whether iconv has broken IGNORE.])]) LDFLAGS="$save_LDFLAGS" CFLAGS="$save_CFLAGS"

« previous php.cvs (#128064) next »