[php-src] master: ext/gd: conflicting iconv_t typedef breaking the Solaris build. (#22810)

David CARLIER via GitHub <[email protected]> Thu, 23 Jul 2026 11:45:41 +0000
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: David CARLIER (devnexen)
Committer: GitHub (web-flow)
Pusher: devnexen
Date: 2026-07-23T12:45:38+01:00

Commit: https://github.com/php/php-src/commit/ea8f2cff1647032d4dfbaaf28abdc63329bc2593
Raw diff: https://github.com/php/php-src/commit/ea8f2cff1647032d4dfbaaf28abdc63329bc2593.diff

ext/gd: conflicting iconv_t typedef breaking the Solaris build. (#22810)

The gd 2.4 sync guarded gdkanji.c's 'typedef void *iconv_t' fallback
with HAVE_ICONV_T_DEF, which the bundled build never defined. On
Solaris <iconv.h> declares iconv_t as a struct pointer, so it clashed.
Define HAVE_ICONV_T_DEF when <iconv.h> already provides iconv_t.

Changed paths:
  M  ext/gd/config.m4


Diff:

diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index b32735bc4a69..17f508be2a9a 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -394,6 +394,14 @@ if test "$PHP_GD" != "no"; then
     AC_DEFINE([HAVE_GD_PNG_GET_VERSION_STRING], [1],
       [Define to 1 if GD library has the 'gdPngGetVersionString' function.])
 
+    dnl Some systems (e.g. Solaris) declare iconv_t in <iconv.h> as something
+    dnl other than 'void *'. The bundled libgd/gdkanji.c only falls back to its
+    dnl own 'typedef void *iconv_t' when HAVE_ICONV_T_DEF is undefined, so detect
+    dnl the system definition to avoid a conflicting typedef.
+    AC_EGREP_HEADER([typedef.*iconv_t], [iconv.h],
+      [AC_DEFINE([HAVE_ICONV_T_DEF], [1],
+        [Define to 1 if <iconv.h> defines iconv_t.])])
+
 dnl Various checks for GD features
     PHP_SETUP_ZLIB([GD_SHARED_LIBADD])
     PHP_GD_PNG