Skip to content

Commit 66060b1

Browse files
authored
Support building ext/gd without libxpm on Windows (GH-15846)
For GD, libxpm is an optional dependency, and we should treat it as such, i.e. if the library is not found, we build ext/gd without XPM support. This should also be done for other optional dependencies (like libjpeg), but since we're close to PHP 8.4.0RC1, we postpone that. However, wrt libxpm[1] we're taking action immediately, so that we can ship builds without XPM support, or at least custom builds without XPM support are possible without modifying the sources. [1] <https://news-web.php.net/php.internals/125502>
1 parent 306a519 commit 66060b1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ext/gd/config.w32

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ if (PHP_GD != "no") {
1717
(CHECK_LIB("libiconv_a.lib;libiconv.lib", "gd", PHP_GD) || CHECK_LIB("iconv_a.lib;iconv.lib", "gd", PHP_GD)) &&
1818
CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_GD", PHP_GD) &&
1919
(((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD) )) ||
20-
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "gd", PHP_GD)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
21-
CHECK_LIB("libXpm_a.lib", "gd", PHP_GD) &&
22-
CHECK_HEADER_ADD_INCLUDE("xpm.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\X11")
20+
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "gd", PHP_GD)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED)))
2321
) {
2422

23+
if (CHECK_LIB("libXpm_a.lib", "gd", PHP_GD) &&
24+
CHECK_HEADER_ADD_INCLUDE("xpm.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\X11")
25+
) {
26+
AC_DEFINE('HAVE_XPM', 1, "Define to 1 if you have the xpm library.");
27+
AC_DEFINE('HAVE_GD_XPM', 1, "Define to 1 if gd extension has XPM support.");
28+
}
2529
if (PHP_LIBWEBP != "no") {
2630
if ((CHECK_LIB("libwebp_a.lib", "gd", PHP_GD) || CHECK_LIB("libwebp.lib", "gd", PHP_GD)) &&
2731
CHECK_HEADER_ADD_INCLUDE("decode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp") &&
@@ -62,8 +66,6 @@ if (PHP_GD != "no") {
6266
AC_DEFINE('HAVE_LIBPNG', 1, "Define to 1 if you have the libpng library.");
6367
AC_DEFINE('HAVE_LIBJPEG', 1, "Define to 1 if you have the libjpeg library.");
6468
AC_DEFINE('HAVE_GD_JPG', 1, "Define to 1 if gd extension has JPEG support.");
65-
AC_DEFINE('HAVE_XPM', 1, "Define to 1 if you have the xpm library.");
66-
AC_DEFINE('HAVE_GD_XPM', 1, "Define to 1 if gd extension has XPM support.");
6769
AC_DEFINE('HAVE_LIBFREETYPE', 1, "Define to 1 if you have the FreeType library.");
6870
AC_DEFINE('HAVE_GD_FREETYPE', 1, "Define to 1 if gd extension has FreeType support.");
6971
ADD_FLAG("CFLAGS_GD", " \

0 commit comments

Comments
 (0)