xref: /PHP-8.0/ext/gd/config.w32 (revision 92370551)
1// vim:ft=javascript
2
3ARG_WITH("gd", "Bundled GD support", "yes,shared");
4ARG_WITH("libwebp", "webp support", "yes");
5
6if (PHP_GD != "no") {
7	if (
8		CHECK_LIB("libjpeg_a.lib;libjpeg.lib", "gd", PHP_GD) &&
9		CHECK_LIB("freetype_a.lib;freetype.lib", "gd", PHP_GD) &&
10		CHECK_HEADER_ADD_INCLUDE("ft2build.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\freetype2;" + PHP_PHP_BUILD + "\\include\\freetype") &&
11		CHECK_LIB("libpng_a.lib;libpng.lib", "gd", PHP_GD) &&
12		CHECK_HEADER_ADD_INCLUDE("gd.h", "CFLAGS_GD", PHP_GD + ";ext\\gd\\libgd") &&
13		(CHECK_HEADER_ADD_INCLUDE("png.h", "CFLAGS_GD", PHP_GD +  ";" + PHP_PHP_BUILD + "\\include\\libpng16") ||
14		CHECK_HEADER_ADD_INCLUDE("png.h", "CFLAGS_GD", PHP_GD +  ";" + PHP_PHP_BUILD + "\\include\\libpng15") ||
15		CHECK_HEADER_ADD_INCLUDE("png.h", "CFLAGS_GD", PHP_GD +  ";" + PHP_PHP_BUILD + "\\include\\libpng12")) &&
16		(CHECK_LIB("libiconv_a.lib;libiconv.lib", "gd", PHP_GD) || CHECK_LIB("iconv_a.lib;iconv.lib", "gd", PHP_GD)) &&
17		 CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_GD", PHP_GD) &&
18		(((PHP_ZLIB=="no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "gd", PHP_GD) )) ||
19			(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "gd", PHP_GD)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
20		CHECK_LIB("libXpm_a.lib", "gd", PHP_GD) &&
21		CHECK_HEADER_ADD_INCLUDE("xpm.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\X11")
22		) {
23
24		if (PHP_LIBWEBP != "no") {
25			if ((CHECK_LIB("libwebp_a.lib", "gd", PHP_GD) || CHECK_LIB("libwebp.lib", "gd", PHP_GD)) &&
26				CHECK_HEADER_ADD_INCLUDE("decode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp") &&
27				CHECK_HEADER_ADD_INCLUDE("encode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp")) {
28				AC_DEFINE("HAVE_LIBWEBP", 1, "WebP support");
29				AC_DEFINE("HAVE_GD_WEBP", 1, "WebP support");
30			} else {
31				WARNING("libwebp not enabled; libraries and headers not found");
32			}
33		}
34		CHECK_LIB("User32.lib", "gd", PHP_GD);
35		CHECK_LIB("Gdi32.lib", "gd", PHP_GD);
36
37		EXTENSION("gd", "gd.c", null, "-Iext/gd/libgd");
38		ADD_SOURCES("ext/gd/libgd", "gd2copypal.c gd.c \
39			gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c \
40			gdft.c gd_gd2.c gd_gd.c gd_gif_in.c gd_gif_out.c gdhelpers.c gd_io.c gd_io_dp.c \
41			gd_io_file.c gd_io_ss.c gd_jpeg.c gdkanji.c gd_png.c gd_ss.c \
42			gdtables.c gd_topal.c gd_wbmp.c gdxpm.c wbmp.c gd_xbm.c gd_security.c gd_transform.c \
43			gd_filter.c gd_pixelate.c gd_rotate.c gd_color_match.c gd_webp.c \
44			gd_crop.c gd_interpolation.c gd_matrix.c gd_bmp.c gd_tga.c", "gd");
45		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");
57		ADD_FLAG("CFLAGS_GD", " \
58/D PHP_GD_EXPORTS=1 \
59/D HAVE_GD_DYNAMIC_CTX_EX=1 \
60/D HAVE_GD_GD2  \
61/D HAVE_GD_GIF_READ=1  \
62/D HAVE_GD_GIF_CREATE=1  \
63/D HAVE_GDIMAGECOLORRESOLVE=1  \
64/D HAVE_GD_IMAGESETBRUSH=1  \
65/D HAVE_GD_IMAGESETTILE=1 \
66/D HAVE_GD_FONTCACHESHUTDOWN=1 \
67/D HAVE_GD_FONTMUTEX=1 \
68/D HAVE_GD_STRINGFTEX=1  \
69/D HAVE_GD_STRINGTTF=1  \
70/D HAVE_GD_WBMP  \
71/D HAVE_GD_XBM  \
72/D HAVE_LIBGD13=1  \
73/D HAVE_LIBGD15=1  \
74/D HAVE_LIBGD20=1  \
75/D HAVE_LIBGD204=1 \
76/D HAVE_COLORCLOSESTHWB  \
77/D HAVE_GD_GET_INTERPOLATION \
78/D USE_GD_IOCTX \
79/D MSWIN32 \
80		");
81		if (ICC_TOOLSET) {
82			ADD_FLAG("LDFLAGS_GD", "/nodefaultlib:libcmt");
83		}
84
85		PHP_INSTALL_HEADERS("", "ext/gd ext/gd/libgd" );
86	} else {
87		WARNING("gd not enabled; libraries and headers not found");
88	}
89}
90