1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Move iconv const check into autoconf (8.3) (#20247)
This commit is contained in:
Calvin Buckley
2025-10-29 14:38:35 -03:00
2 changed files with 20 additions and 6 deletions

View File

@@ -83,6 +83,20 @@ int main(void) {
AS_VAR_IF([php_cv_iconv_errno], [yes],,
[AC_MSG_FAILURE([The iconv check failed, 'errno' is missing.])])
dnl iconv on some platforms (NetBSD pre-10, Solaris) may have a non-standard
dnl const input parameter; libiconv may imitate this on those platforms.
AC_CACHE_CHECK([if iconv input parameter is const (non-standard)], [php_cv_iconv_const],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <iconv.h>
size_t iconv(iconv_t cd, const char **src, size_t *srcleft, char **dst, size_t *dstleft);
])],
[php_cv_iconv_const=const],
[php_cv_iconv_const=non-const])])
dnl non-const is just used for display, set it back
AS_VAR_IF([php_cv_iconv_const], [non-const],
[php_cv_iconv_const=])
AC_CACHE_CHECK([if iconv supports //IGNORE], [php_cv_iconv_ignore],
[AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <iconv.h>
@@ -120,7 +134,7 @@ int main(void) {
PHP_NEW_EXTENSION([iconv],
[iconv.c],
[$ext_shared],,
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DICONV_CONST=$php_cv_iconv_const])
PHP_SUBST([ICONV_SHARED_LIBADD])
PHP_INSTALL_HEADERS([ext/iconv], [php_iconv.h])
fi

View File

@@ -43,11 +43,11 @@
#undef iconv
#endif
#if defined(__NetBSD__)
// unfortunately, netbsd has still the old non posix conformant signature
// libiconv tends to match the eventual system's iconv too.
#define ICONV_CONST const
#else
/* iconv can have different constiness for src on some platforms;
* this is explained in config.m4. On Windows, it's always non-const,
* but it can be awkward to set that on the command line. Do it here.
*/
#ifndef ICONV_CONST
#define ICONV_CONST
#endif