summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2013-05-03 15:37:39 +0200
committerRemi Collet <remi@php.net>2013-05-04 16:50:13 +0200
commit2a2ac5f2bef6a779477c76d34c346ac9044185af (patch)
tree982389865c31833f559264790b7c516425b74de3
parente6704501f8ab56d661f37c4e70b0b9e442ca5ed2 (diff)
downloadphp-git-2a2ac5f2bef6a779477c76d34c346ac9044185af.tar.gz
Move png and jpeg version functions to gd.c so the external library build doesn't include anything from libgd/.
-rw-r--r--ext/gd/config.m41
-rw-r--r--ext/gd/gd.c45
-rw-r--r--ext/gd/libgd/gd_compat.c34
-rw-r--r--ext/gd/libgd/gd_compat.h14
4 files changed, 45 insertions, 49 deletions
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 <png.h>
+#endif
+
+#ifdef HAVE_GD_JPG
+# include <jpeglib.h>
+#endif
+
#include "php.h"
#include "php_ini.h"
#include "ext/standard/head.h"
@@ -53,6 +61,42 @@
# include <Wingdi.h>
#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 <t1lib.h>
@@ -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 <png.h>
-#endif
-
-#ifdef HAVE_GD_JPG
-# include <jpeglib.h>
-#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 <gd.h>
-#endif
-
-const char * gdPngGetVersionString();
-const char * gdJpegGetVersionString();
-int gdJpegGetVersionInt();
-
-#endif /* GD_COMPAT_H */