From 0f7444c4a845ae2fcf0b5d6a75f52f9ce9b13500 Mon Sep 17 00:00:00 2001 From: Sander Steffann Date: Wed, 24 Nov 1999 21:43:54 +0000 Subject: [PATCH] Some patched versions of GD support both GIF and PNG. The GD module now checks for both instead of assuming that PNG support means that there is no GIF support anymore. --- ext/gd/config.h.stub | 3 +++ ext/gd/config.m4 | 2 ++ ext/gd/gd.c | 9 ++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ext/gd/config.h.stub b/ext/gd/config.h.stub index d13e8df475..1fce8aa1a0 100644 --- a/ext/gd/config.h.stub +++ b/ext/gd/config.h.stub @@ -8,4 +8,7 @@ #undef FREETYPE_4BIT_ANTIALIAS_HACK #undef HAVE_LIBFREETYPE #undef HAVE_LIBTTF + +/* Some versions of GD support both PNG and GIF. Set defines for both. */ #undef HAVE_GD_PNG +#undef HAVE_GD_GIF diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index aa7208b043..ccb332cafc 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -25,7 +25,9 @@ AC_ARG_WITH(gd, AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) LIBS="$LIBS -lpng -lz" AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE,1)]) +dnl Some versions of GD support both PNG and GIF. Check for both. AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1)]) + AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF, 1)]) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS diff --git a/ext/gd/gd.c b/ext/gd/gd.c index b2b7a8bcf9..7d4bddd642 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -101,7 +101,8 @@ function_entry gd_functions[] = { #ifdef HAVE_GD_PNG PHP_FE(imagecreatefrompng, NULL) PHP_FE(imagepng, NULL) -#else +#endif +#ifdef HAVE_GD_GIF PHP_FE(imagecreatefromgif, NULL) PHP_FE(imagegif, NULL) #endif @@ -479,7 +480,9 @@ void php3_imagepng (INTERNAL_FUNCTION_PARAMETERS) { } /* }}} */ -#else +#endif /* HAVE_GD_PNG */ + +#ifdef HAVE_GD_GIF /* {{{ proto int imagecreatefromgif(string filename) Create a new image from file or URL */ @@ -604,7 +607,7 @@ PHP_FUNCTION(imagegif ) } /* }}} */ -#endif /* HAVE_IMAGECREATEFROMPNG */ +#endif /* HAVE_GD_GIF */ /* {{{ proto int imagedestroy(int im) Destroy an image */ -- 2.50.1