From: Ondřej Surý Date: Fri, 3 May 2013 13:37:39 +0000 (+0200) Subject: Move png and jpeg version functions to gd.c so the external library build doesn't... X-Git-Tag: php-5.5.0RC1~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a2ac5f2bef6a779477c76d34c346ac9044185af;p=php Move png and jpeg version functions to gd.c so the external library build doesn't include anything from libgd/. --- diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index 4a29ab9264..5d02bed785 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -337,7 +337,6 @@ else if test "$PHP_GD" != "no"; then GD_MODULE_TYPE=external - extra_sources="libgd/gd_compat.c" dnl Various checks for GD features PHP_GD_ZLIB diff --git a/ext/gd/gd.c b/ext/gd/gd.c index eefa5df801..f412b2f03b 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -29,6 +29,14 @@ #include "config.h" #endif +#ifdef HAVE_GD_PNG +#include +#endif + +#ifdef HAVE_GD_JPG +# include +#endif + #include "php.h" #include "php_ini.h" #include "ext/standard/head.h" @@ -53,6 +61,42 @@ # include #endif +#ifndef HAVE_GD_BUNDLED +#ifdef HAVE_GD_PNG +const char * gdPngGetVersionString() +{ + return PNG_LIBPNG_VER_STRING; +} +#endif /* HAVE_GD_PNG */ + +#ifdef HAVE_GD_JPG +int gdJpegGetVersionInt() +{ + return JPEG_LIB_VERSION; +} + +const char * gdJpegGetVersionString() +{ + switch(JPEG_LIB_VERSION) { + case 62: + return "6b"; + break; + + case 70: + return "7"; + break; + + case 80: + return "8"; + break; + + default: + return "unknown"; + } +} +#endif /* HAVE_GD_JPG */ +#endif /* HAVE_GD_BUNDLED */ + static int le_gd, le_gd_font; #if HAVE_LIBT1 #include @@ -1310,6 +1354,7 @@ PHP_MINFO_FUNCTION(gd) php_info_print_table_row(2, "libJPEG Version", gdJpegGetVersionString()); } #endif + #ifdef HAVE_GD_PNG php_info_print_table_row(2, "PNG Support", "enabled"); php_info_print_table_row(2, "libPNG Version", gdPngGetVersionString()); diff --git a/ext/gd/libgd/gd_compat.c b/ext/gd/libgd/gd_compat.c deleted file mode 100644 index 875fbd6f79..0000000000 --- a/ext/gd/libgd/gd_compat.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "php_config.h" -#ifdef HAVE_GD_PNG -/* needs to be first */ -# include -#endif - -#ifdef HAVE_GD_JPG -# include -#endif - -#ifdef HAVE_GD_JPG -int gdJpegGetVersionInt() -{ - return JPEG_LIB_VERSION; -} - -const char * gdJpegGetVersionString() -{ - switch(JPEG_LIB_VERSION) { - case 62: - return "6b"; - break; - default: - return "unknown"; - } -} -#endif - -#ifdef HAVE_GD_PNG -const char * gdPngGetVersionString() -{ - return PNG_LIBPNG_VER_STRING; -} -#endif diff --git a/ext/gd/libgd/gd_compat.h b/ext/gd/libgd/gd_compat.h deleted file mode 100644 index 13fff2b603..0000000000 --- a/ext/gd/libgd/gd_compat.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef GD_COMPAT_H -#define GD_COMPAT_H 1 - -#if HAVE_GD_BUNDLED -# include "gd.h" -#else -# include -#endif - -const char * gdPngGetVersionString(); -const char * gdJpegGetVersionString(); -int gdJpegGetVersionInt(); - -#endif /* GD_COMPAT_H */