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 ) { 22 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 } 29 if (PHP_LIBWEBP != "no") { 30 if ((CHECK_LIB("libwebp_a.lib", "gd", PHP_GD) || CHECK_LIB("libwebp.lib", "gd", PHP_GD)) && 31 CHECK_HEADER_ADD_INCLUDE("decode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp") && 32 CHECK_HEADER_ADD_INCLUDE("encode.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\webp")) { 33 AC_DEFINE("HAVE_LIBWEBP", 1, "Define to 1 if you have the libwebp library."); 34 AC_DEFINE("HAVE_GD_WEBP", 1, "Define to 1 if gd extension has WebP support."); 35 } else { 36 WARNING("libwebp not enabled; libraries and headers not found"); 37 } 38 } 39 if (PHP_LIBAVIF != "no") { 40 if (CHECK_LIB("avif_a.lib", "gd", PHP_GD) && 41 CHECK_LIB("aom_a.lib", "gd", PHP_GD) && 42 CHECK_HEADER_ADD_INCLUDE("avif.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\avif")) { 43 ADD_FLAG("CFLAGS_GD", "/D HAVE_LIBAVIF /D HAVE_GD_AVIF"); 44 } else if (CHECK_LIB("avif.lib", "gd", PHP_GD) && 45 CHECK_HEADER_ADD_INCLUDE("avif.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\avif")) { 46 ADD_FLAG("CFLAGS_GD", "/D HAVE_LIBAVIF /D HAVE_GD_AVIF"); 47 } else { 48 WARNING("libavif not enabled; libraries and headers not found"); 49 } 50 } 51 CHECK_LIB("User32.lib", "gd", PHP_GD); 52 CHECK_LIB("Gdi32.lib", "gd", PHP_GD); 53 54 EXTENSION("gd", "gd.c", null, "-Iext/gd/libgd"); 55 ADD_SOURCES("ext/gd/libgd", "gd2copypal.c gd.c \ 56 gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c \ 57 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 \ 58 gd_io_file.c gd_io_ss.c gd_jpeg.c gdkanji.c gd_png.c gd_ss.c \ 59 gdtables.c gd_topal.c gd_wbmp.c gdxpm.c wbmp.c gd_xbm.c gd_security.c gd_transform.c \ 60 gd_filter.c gd_pixelate.c gd_rotate.c gd_color_match.c gd_webp.c gd_avif.c \ 61 gd_crop.c gd_interpolation.c gd_matrix.c gd_bmp.c gd_tga.c", "gd"); 62 AC_DEFINE('HAVE_GD_BUNDLED', 1, "Define to 1 if gd extension uses GD library bundled in PHP."); 63 AC_DEFINE('HAVE_GD_PNG', 1, "Define to 1 if gd extension has PNG support."); 64 AC_DEFINE('HAVE_GD_BMP', 1, "Define to 1 if gd extension has BMP support."); 65 AC_DEFINE('HAVE_GD_TGA', 1, "Define to 1 if gd extension has TGA support."); 66 AC_DEFINE('HAVE_LIBPNG', 1, "Define to 1 if you have the libpng library."); 67 AC_DEFINE('HAVE_LIBJPEG', 1, "Define to 1 if you have the libjpeg library."); 68 AC_DEFINE('HAVE_GD_JPG', 1, "Define to 1 if gd extension has JPEG support."); 69 AC_DEFINE('HAVE_LIBFREETYPE', 1, "Define to 1 if you have the FreeType library."); 70 AC_DEFINE('HAVE_GD_FREETYPE', 1, "Define to 1 if gd extension has FreeType support."); 71 ADD_FLAG("CFLAGS_GD", " \ 72/D PHP_GD_EXPORTS=1 \ 73/D HAVE_GD_GET_INTERPOLATION \ 74 "); 75 if (ICC_TOOLSET) { 76 ADD_FLAG("LDFLAGS_GD", "/nodefaultlib:libcmt"); 77 } 78 79 PHP_INSTALL_HEADERS("ext/gd", "php_gd.h libgd/"); 80 } else { 81 WARNING("gd not enabled; libraries and headers not found"); 82 } 83} 84