1// vim:ft=javascript 2 3ARG_WITH("gd", "Bundled GD support", "yes,shared"); 4ARG_WITH("libwebp", "webp support", "yes"); 5ARG_WITH("libavif", "avif support", "yes"); 6 7if (PHP_GD != "no") { 8 if ( 9 CHECK_LIB("libjpeg_a.lib;libjpeg.lib", "gd", PHP_GD) && 10 CHECK_LIB("freetype_a.lib;freetype.lib", "gd", PHP_GD) && 11 CHECK_HEADER_ADD_INCLUDE("ft2build.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\freetype2;" + PHP_PHP_BUILD + "\\include\\freetype") && 12 CHECK_LIB("libpng_a.lib;libpng.lib", "gd", PHP_GD) && 13 CHECK_HEADER_ADD_INCLUDE("gd.h", "CFLAGS_GD", PHP_GD + ";ext\\gd\\libgd") && 14 (CHECK_HEADER_ADD_INCLUDE("png.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\libpng16") || 15 CHECK_HEADER_ADD_INCLUDE("png.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\libpng15") || 16 CHECK_HEADER_ADD_INCLUDE("png.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\libpng12")) && 17 (CHECK_LIB("libiconv_a.lib;libiconv.lib", "gd", PHP_GD) || CHECK_LIB("iconv_a.lib;iconv.lib", "gd", PHP_GD)) && 18 CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_GD", PHP_GD) && 19 (((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") 23 ) { 24 25 if (PHP_LIBWEBP != "no") { 26 if ((CHECK_LIB("libwebp_a.lib", "gd", PHP_GD) || CHECK_LIB("libwebp.lib", "gd", PHP_GD)) && 27 CHECK_HEADER_ADD_INCLUDE("decode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp") && 28 CHECK_HEADER_ADD_INCLUDE("encode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp")) { 29 AC_DEFINE("HAVE_LIBWEBP", 1, "WebP support"); 30 AC_DEFINE("HAVE_GD_WEBP", 1, "WebP support"); 31 } else { 32 WARNING("libwebp not enabled; libraries and headers not found"); 33 } 34 } 35 if (PHP_LIBAVIF != "no") { 36 if (CHECK_LIB("avif_a.lib", "gd", PHP_GD) && 37 CHECK_LIB("aom_a.lib", "gd", PHP_GD) && 38 CHECK_HEADER_ADD_INCLUDE("avif.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\avif")) { 39 ADD_FLAG("CFLAGS_GD", "/D HAVE_LIBAVIF /D HAVE_GD_AVIF"); 40 } else if (CHECK_LIB("avif.lib", "gd", PHP_GD) && 41 CHECK_HEADER_ADD_INCLUDE("avif.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\avif")) { 42 ADD_FLAG("CFLAGS_GD", "/D HAVE_LIBAVIF /D HAVE_GD_AVIF"); 43 } else { 44 WARNING("libavif not enabled; libraries and headers not found"); 45 } 46 } 47 CHECK_LIB("User32.lib", "gd", PHP_GD); 48 CHECK_LIB("Gdi32.lib", "gd", PHP_GD); 49 50 EXTENSION("gd", "gd.c", null, "-Iext/gd/libgd"); 51 ADD_SOURCES("ext/gd/libgd", "gd2copypal.c gd.c \ 52 gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c \ 53 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 \ 54 gd_io_file.c gd_io_ss.c gd_jpeg.c gdkanji.c gd_png.c gd_ss.c \ 55 gdtables.c gd_topal.c gd_wbmp.c gdxpm.c wbmp.c gd_xbm.c gd_security.c gd_transform.c \ 56 gd_filter.c gd_pixelate.c gd_rotate.c gd_color_match.c gd_webp.c gd_avif.c \ 57 gd_crop.c gd_interpolation.c gd_matrix.c gd_bmp.c gd_tga.c", "gd"); 58 AC_DEFINE('HAVE_LIBGD', 1, 'GD support'); 59 AC_DEFINE('HAVE_GD_BUNDLED', 1, "Bundled GD"); 60 AC_DEFINE('HAVE_GD_PNG', 1, "PNG support"); 61 AC_DEFINE('HAVE_GD_BMP', 1, "BMP support"); 62 AC_DEFINE('HAVE_GD_TGA', 1, "TGA support"); 63 AC_DEFINE('HAVE_LIBPNG', 1, "PNG support"); 64 AC_DEFINE('HAVE_LIBJPEG', 1, "JPEG support"); 65 AC_DEFINE('HAVE_GD_JPG', 1, "JPEG support"); 66 AC_DEFINE('HAVE_XPM', 1, "XPM support"); 67 AC_DEFINE('HAVE_GD_XPM', 1, "XPM support"); 68 AC_DEFINE('HAVE_LIBFREETYPE', 1, "Freetype support"); 69 AC_DEFINE('HAVE_GD_FREETYPE', 1, "Freetype support"); 70 ADD_FLAG("CFLAGS_GD", " \ 71/D PHP_GD_EXPORTS=1 \ 72/D HAVE_GD_GET_INTERPOLATION \ 73 "); 74 if (ICC_TOOLSET) { 75 ADD_FLAG("LDFLAGS_GD", "/nodefaultlib:libcmt"); 76 } 77 78 PHP_INSTALL_HEADERS("", "ext/gd ext/gd/libgd" ); 79 } else { 80 WARNING("gd not enabled; libraries and headers not found"); 81 } 82} 83