]> granicus.if.org Git - php/commitdiff
- fix build on linux (static)
authorPierre Joye <pajoye@php.net>
Thu, 6 Nov 2008 10:14:37 +0000 (10:14 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 6 Nov 2008 10:14:37 +0000 (10:14 +0000)
- add gd[Format]Version[Int|String] first methods to work around the png
  header issues

ext/gd/gd.c
ext/gd/libgd/gd.h
ext/gd/libgd/gd_jpeg.c
ext/gd/libgd/gd_png.c

index 8c6f5fe7f6cd596006613c565e3dfd5e9a029393..acadf7042170efa929789ab6e52c06affc6f8303 100644 (file)
 #include "config.h"
 #endif
 
-#ifdef HAVE_GD_PNG
-/* needs to be first */
-#include <png.h>
-#endif
-#ifdef HAVE_GD_JPG
-/* needs to be first */
-#include <jpeglib.h>
-#endif
-
 #include "php.h"
 #include "php_ini.h"
 #include "ext/standard/head.h"
@@ -1395,15 +1386,16 @@ PHP_MINFO_FUNCTION(gd)
 #endif
 #ifdef HAVE_GD_JPG
        {
-               char tmp[256];
-               snprintf(tmp, sizeof(tmp), "%d", JPEG_LIB_VERSION);
+               char tmp[12];
+               snprintf(tmp, sizeof(tmp), "%d", gdJpegGetVersionInt());
                php_info_print_table_row(2, "JPG Support", "enabled");
-               php_info_print_table_row(2, "libJPEG Version", tmp);
+               php_info_print_table_row(2, "libPNG Version", tmp);
        }
 #endif
+
 #ifdef HAVE_GD_PNG
        php_info_print_table_row(2, "PNG Support", "enabled");
-       php_info_print_table_row(2, "libPNG Version", PNG_LIBPNG_VER_STRING);
+       php_info_print_table_row(2, "libPNG Version", gdPngGetVersionString());
 #endif
 #ifdef HAVE_GD_WBMP
        php_info_print_table_row(2, "WBMP Support", "enabled");
index 7ef2caa4889e26d24ff1c6db53e045082c6a9319..5df48271c12c0f6dc6341bca7d6edf4bcfeac99c 100644 (file)
@@ -250,6 +250,8 @@ gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
 gdImagePtr gdImageCreateFromJpeg(FILE *infile, int ignore_warning);
 gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile, int ignore_warning);
 
+int gdJpegGetVersionInt();
+const char * gdPngGetVersionString();
 /* A custom data source. */
 /* The source function must return -1 on error, otherwise the number
         of bytes fetched. 0 is EOF, not an error! */
index 9573c1cf695687d00b0fca8a8b1cada96b2a0450..a71469137f2870363ee29c7ed08de169e919db2a 100644 (file)
@@ -102,6 +102,11 @@ static void fatal_jpeg_error (j_common_ptr cinfo)
        exit (99);
 }
 
+int gdJpegGetVersionInt()
+{
+       return JPEG_LIB_VERSION;
+}
+
 /*
  * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality
  * QUALITY.  If QUALITY is in the range 0-100, increasing values
index 7591dc0c673ece5e0097dfa319a73713e22e05a0..e15ede73ccf75550ff84678de7aadd7505496ecc 100644 (file)
 
   ---------------------------------------------------------------------------*/
 
+const char * gdPngGetVersionString()
+{
+       return PNG_LIBPNG_VER_STRING;
+}
+
 #ifndef PNG_SETJMP_NOT_SUPPORTED
 typedef struct _jmpbuf_wrapper
 {