Skip to content

Commit

Permalink
"Export" relevant GD macros
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cmb69 committed Nov 24, 2021
1 parent be271f2 commit 9237055
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions ext/gd/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ if (PHP_GD != "no") {
if ((CHECK_LIB("libwebp_a.lib", "gd", PHP_GD) || CHECK_LIB("libwebp.lib", "gd", PHP_GD)) &&
CHECK_HEADER_ADD_INCLUDE("decode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp") &&
CHECK_HEADER_ADD_INCLUDE("encode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp")) {
ADD_FLAG("CFLAGS_GD", "/D HAVE_LIBWEBP /D HAVE_GD_WEBP");
AC_DEFINE("HAVE_LIBWEBP", 1, "WebP support");
AC_DEFINE("HAVE_GD_WEBP", 1, "WebP support");
} else {
WARNING("libwebp not enabled; libraries and headers not found");
}
Expand All @@ -42,10 +43,20 @@ if (PHP_GD != "no") {
gd_filter.c gd_pixelate.c gd_rotate.c gd_color_match.c gd_webp.c \
gd_crop.c gd_interpolation.c gd_matrix.c gd_bmp.c gd_tga.c", "gd");
AC_DEFINE('HAVE_LIBGD', 1, 'GD support');
AC_DEFINE('HAVE_GD_BUNDLED', 1, "Bundled GD");
AC_DEFINE('HAVE_GD_PNG', 1, "PNG support");
AC_DEFINE('HAVE_GD_BMP', 1, "BMP support");
AC_DEFINE('HAVE_GD_TGA', 1, "TGA support");
AC_DEFINE('HAVE_LIBPNG', 1, "PNG support");
AC_DEFINE('HAVE_LIBJPEG', 1, "JPEG support");
AC_DEFINE('HAVE_GD_JPG', 1, "JPEG support");
AC_DEFINE('HAVE_XPM', 1, "XPM support");
AC_DEFINE('HAVE_GD_XPM', 1, "XPM support");
AC_DEFINE('HAVE_LIBFREETYPE', 1, "Freetype support");
AC_DEFINE('HAVE_GD_FREETYPE', 1, "Freetype support");
ADD_FLAG("CFLAGS_GD", " \
/D PHP_GD_EXPORTS=1 \
/D HAVE_GD_DYNAMIC_CTX_EX=1 \
/D HAVE_GD_BUNDLED=1 \
/D HAVE_GD_GD2 \
/D HAVE_GD_GIF_READ=1 \
/D HAVE_GD_GIF_CREATE=1 \
Expand All @@ -54,24 +65,14 @@ if (PHP_GD != "no") {
/D HAVE_GD_IMAGESETTILE=1 \
/D HAVE_GD_FONTCACHESHUTDOWN=1 \
/D HAVE_GD_FONTMUTEX=1 \
/D HAVE_LIBFREETYPE=1 \
/D HAVE_GD_JPG \
/D HAVE_GD_PNG \
/D HAVE_GD_STRINGFTEX=1 \
/D HAVE_GD_STRINGTTF=1 \
/D HAVE_GD_WBMP \
/D HAVE_GD_XBM \
/D HAVE_GD_XPM \
/D HAVE_GD_FREETYPE=1 \
/D HAVE_GD_BMP \
/D HAVE_GD_TGA \
/D HAVE_LIBGD13=1 \
/D HAVE_LIBGD15=1 \
/D HAVE_LIBGD20=1 \
/D HAVE_LIBGD204=1 \
/D HAVE_LIBJPEG \
/D HAVE_LIBPNG \
/D HAVE_XPM \
/D HAVE_COLORCLOSESTHWB \
/D HAVE_GD_GET_INTERPOLATION \
/D USE_GD_IOCTX \
Expand Down

0 comments on commit 9237055

Please sign in to comment.