Skip to content

Commit 9237055

Browse files
committed
"Export" relevant GD macros
For parity with non Windows systems, we should `AC_DEFINE` these macros so that they are defined in config.w32.h instead of directly passed to the compiler. This allows extensions which have ext/gd as dependency to check for these macros. E.g. ext/ps does this[1], and fails to build on Windows, because `HAVE_GD_BUNDLED` isn't defined. [1] <https://github.com/steinm/ps/blob/RELEASE_1_4_4/ps.c#L34> Closes GH-7680.
1 parent be271f2 commit 9237055

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

ext/gd/config.w32

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ if (PHP_GD != "no") {
2525
if ((CHECK_LIB("libwebp_a.lib", "gd", PHP_GD) || CHECK_LIB("libwebp.lib", "gd", PHP_GD)) &&
2626
CHECK_HEADER_ADD_INCLUDE("decode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp") &&
2727
CHECK_HEADER_ADD_INCLUDE("encode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp")) {
28-
ADD_FLAG("CFLAGS_GD", "/D HAVE_LIBWEBP /D HAVE_GD_WEBP");
28+
AC_DEFINE("HAVE_LIBWEBP", 1, "WebP support");
29+
AC_DEFINE("HAVE_GD_WEBP", 1, "WebP support");
2930
} else {
3031
WARNING("libwebp not enabled; libraries and headers not found");
3132
}
@@ -42,10 +43,20 @@ if (PHP_GD != "no") {
4243
gd_filter.c gd_pixelate.c gd_rotate.c gd_color_match.c gd_webp.c \
4344
gd_crop.c gd_interpolation.c gd_matrix.c gd_bmp.c gd_tga.c", "gd");
4445
AC_DEFINE('HAVE_LIBGD', 1, 'GD support');
46+
AC_DEFINE('HAVE_GD_BUNDLED', 1, "Bundled GD");
47+
AC_DEFINE('HAVE_GD_PNG', 1, "PNG support");
48+
AC_DEFINE('HAVE_GD_BMP', 1, "BMP support");
49+
AC_DEFINE('HAVE_GD_TGA', 1, "TGA support");
50+
AC_DEFINE('HAVE_LIBPNG', 1, "PNG support");
51+
AC_DEFINE('HAVE_LIBJPEG', 1, "JPEG support");
52+
AC_DEFINE('HAVE_GD_JPG', 1, "JPEG support");
53+
AC_DEFINE('HAVE_XPM', 1, "XPM support");
54+
AC_DEFINE('HAVE_GD_XPM', 1, "XPM support");
55+
AC_DEFINE('HAVE_LIBFREETYPE', 1, "Freetype support");
56+
AC_DEFINE('HAVE_GD_FREETYPE', 1, "Freetype support");
4557
ADD_FLAG("CFLAGS_GD", " \
4658
/D PHP_GD_EXPORTS=1 \
4759
/D HAVE_GD_DYNAMIC_CTX_EX=1 \
48-
/D HAVE_GD_BUNDLED=1 \
4960
/D HAVE_GD_GD2 \
5061
/D HAVE_GD_GIF_READ=1 \
5162
/D HAVE_GD_GIF_CREATE=1 \
@@ -54,24 +65,14 @@ if (PHP_GD != "no") {
5465
/D HAVE_GD_IMAGESETTILE=1 \
5566
/D HAVE_GD_FONTCACHESHUTDOWN=1 \
5667
/D HAVE_GD_FONTMUTEX=1 \
57-
/D HAVE_LIBFREETYPE=1 \
58-
/D HAVE_GD_JPG \
59-
/D HAVE_GD_PNG \
6068
/D HAVE_GD_STRINGFTEX=1 \
6169
/D HAVE_GD_STRINGTTF=1 \
6270
/D HAVE_GD_WBMP \
6371
/D HAVE_GD_XBM \
64-
/D HAVE_GD_XPM \
65-
/D HAVE_GD_FREETYPE=1 \
66-
/D HAVE_GD_BMP \
67-
/D HAVE_GD_TGA \
6872
/D HAVE_LIBGD13=1 \
6973
/D HAVE_LIBGD15=1 \
7074
/D HAVE_LIBGD20=1 \
7175
/D HAVE_LIBGD204=1 \
72-
/D HAVE_LIBJPEG \
73-
/D HAVE_LIBPNG \
74-
/D HAVE_XPM \
7576
/D HAVE_COLORCLOSESTHWB \
7677
/D HAVE_GD_GET_INTERPOLATION \
7778
/D USE_GD_IOCTX \

0 commit comments

Comments
 (0)